@atomic-ui/ui 0.12.1 → 0.13.1
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 +130 -1
- package/dist/base/FieldElement.d.ts +20 -2
- package/dist/{chunk-2WHOBIOY.js → chunk-2BGOBD6Y.js} +2 -2
- package/dist/{chunk-FLAUZU7Y.js → chunk-2RC3QKYA.js} +84 -27
- package/dist/chunk-2RC3QKYA.js.map +1 -0
- package/dist/{chunk-BGHAANTP.js → chunk-5OCDXZXG.js} +3 -2
- package/dist/chunk-5OCDXZXG.js.map +1 -0
- package/dist/{chunk-UYTIJCCW.js → chunk-B2GWXXIW.js} +2 -2
- package/dist/{chunk-CFCFKLTN.js → chunk-EA3M6KPB.js} +11 -1
- package/dist/chunk-EA3M6KPB.js.map +1 -0
- package/dist/{chunk-R6YMSJR7.js → chunk-EFP7PJ6C.js} +68 -25
- package/dist/chunk-EFP7PJ6C.js.map +1 -0
- package/dist/{chunk-BAYSDP44.js → chunk-EIWICFXL.js} +51 -18
- package/dist/chunk-EIWICFXL.js.map +1 -0
- package/dist/{chunk-5IGBH4GL.js → chunk-EUOBFMWC.js} +2 -2
- package/dist/{chunk-FZWUQC42.js → chunk-F2MFV7RM.js} +2 -2
- package/dist/{chunk-3GPGDERO.js → chunk-G7CVRNY5.js} +2 -2
- package/dist/{chunk-2TNF7O43.js → chunk-LSEK5MEZ.js} +2 -2
- package/dist/{chunk-DXLEYNID.js → chunk-LVBYNQ45.js} +5 -3
- package/dist/chunk-LVBYNQ45.js.map +1 -0
- package/dist/{chunk-SOYKSPPX.js → chunk-NZSKUEYS.js} +18 -10
- package/dist/chunk-NZSKUEYS.js.map +1 -0
- package/dist/{chunk-5HCWL2YD.js → chunk-P5FAKEFK.js} +2 -2
- package/dist/{chunk-HSXLSJVG.js → chunk-PII4SJL5.js} +32 -16
- package/dist/chunk-PII4SJL5.js.map +1 -0
- package/dist/{chunk-ALFE35FS.js → chunk-QJBRENLI.js} +3 -3
- package/dist/{chunk-ALFE35FS.js.map → chunk-QJBRENLI.js.map} +1 -1
- package/dist/{chunk-3KAFK24X.js → chunk-RNFGIXJ7.js} +2 -2
- package/dist/{chunk-UBNCJROR.js → chunk-SRXC6ZPM.js} +11 -5
- package/dist/chunk-SRXC6ZPM.js.map +1 -0
- package/dist/{chunk-4MMRBNW7.js → chunk-WEX5RKVC.js} +10 -6
- package/dist/chunk-WEX5RKVC.js.map +1 -0
- package/dist/{chunk-CQT3VPYK.js → chunk-WT7MHYJR.js} +2 -2
- package/dist/{chunk-LXVPWTSY.js → chunk-ZOWOKIE4.js} +37 -21
- package/dist/chunk-ZOWOKIE4.js.map +1 -0
- package/dist/components/accordion.js +1 -1
- package/dist/components/app-bar.d.ts +22 -0
- package/dist/components/app-bar.js +3 -3
- package/dist/components/app-ui.d.ts +8 -0
- package/dist/components/app-ui.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox.js +2 -2
- package/dist/components/chip-group.js +2 -2
- package/dist/components/chip.js +1 -1
- package/dist/components/date-input.js +2 -2
- package/dist/components/dialog.js +1 -1
- package/dist/components/journey.js +2 -2
- package/dist/components/layout.js +1 -1
- package/dist/components/navigation.js +1 -1
- package/dist/components/page.js +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/rows.js +1 -1
- package/dist/components/select.js +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/text-input.js +2 -2
- package/dist/components/textarea.js +2 -2
- package/dist/index.js +21 -21
- package/dist/server.d.ts +42 -0
- package/dist/server.js +26 -0
- package/dist/server.js.map +1 -0
- package/dist/standalone/atomic-ui.js +833 -746
- package/dist/standalone/atomic-ui.js.map +3 -3
- package/package.json +6 -2
- package/dist/chunk-4MMRBNW7.js.map +0 -1
- package/dist/chunk-BAYSDP44.js.map +0 -1
- package/dist/chunk-BGHAANTP.js.map +0 -1
- package/dist/chunk-CFCFKLTN.js.map +0 -1
- package/dist/chunk-DXLEYNID.js.map +0 -1
- package/dist/chunk-FLAUZU7Y.js.map +0 -1
- package/dist/chunk-HSXLSJVG.js.map +0 -1
- package/dist/chunk-LXVPWTSY.js.map +0 -1
- package/dist/chunk-R6YMSJR7.js.map +0 -1
- package/dist/chunk-SOYKSPPX.js.map +0 -1
- package/dist/chunk-UBNCJROR.js.map +0 -1
- /package/dist/{chunk-2WHOBIOY.js.map → chunk-2BGOBD6Y.js.map} +0 -0
- /package/dist/{chunk-UYTIJCCW.js.map → chunk-B2GWXXIW.js.map} +0 -0
- /package/dist/{chunk-5IGBH4GL.js.map → chunk-EUOBFMWC.js.map} +0 -0
- /package/dist/{chunk-FZWUQC42.js.map → chunk-F2MFV7RM.js.map} +0 -0
- /package/dist/{chunk-3GPGDERO.js.map → chunk-G7CVRNY5.js.map} +0 -0
- /package/dist/{chunk-2TNF7O43.js.map → chunk-LSEK5MEZ.js.map} +0 -0
- /package/dist/{chunk-5HCWL2YD.js.map → chunk-P5FAKEFK.js.map} +0 -0
- /package/dist/{chunk-3KAFK24X.js.map → chunk-RNFGIXJ7.js.map} +0 -0
- /package/dist/{chunk-CQT3VPYK.js.map → chunk-WT7MHYJR.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-ui/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "The Impakt component library: standard custom elements, styled only from design tokens, built to WCAG 2.2 AA.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"types": "./dist/components/*.d.ts",
|
|
20
20
|
"import": "./dist/components/*.js"
|
|
21
21
|
},
|
|
22
|
+
"./server": {
|
|
23
|
+
"types": "./dist/server.d.ts",
|
|
24
|
+
"import": "./dist/server.js"
|
|
25
|
+
},
|
|
22
26
|
"./standalone": {
|
|
23
27
|
"types": "./dist/index.d.ts",
|
|
24
28
|
"default": "./dist/standalone/atomic-ui.js"
|
|
@@ -31,7 +35,7 @@
|
|
|
31
35
|
},
|
|
32
36
|
"dependencies": {
|
|
33
37
|
"lit": "^3.3.3",
|
|
34
|
-
"@atomic-ui/design-tokens": "^0.
|
|
38
|
+
"@atomic-ui/design-tokens": "^0.13.1"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
37
41
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/select.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldControl, fieldWidths } from '../base/FieldElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\n/**\n * A dropdown.\n *\n * A native `<select>`, because the alternative is a listbox widget that has to\n * reimplement type-ahead, keyboard selection, and the platform's own picker on\n * touch — and whose main advantage is that the arrow can be restyled. On a\n * phone, native wins outright: it opens the system control that the user\n * already knows how to drive.\n *\n * The empty first option carries a real label rather than being blank, so a\n * screen reader announces a choice to make rather than silence.\n\n *\n * @category form\n * @icon select\n */\nexport class ImpaktSelect extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n options: { type: Array },\n placeholder: { type: String },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n size: { type: String, reflect: true },\n };\n\n declare options: SelectOption[];\n /**\n * Keep the label for screen readers only, for a picker whose purpose is\n * plain from where it sits, such as a filter above a table or a role in a\n * team row. The label stays its accessible name.\n */\n declare hideLabel: boolean;\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 /** `sm` is a compact 32px box for a filter in a toolbar, such as \"Page: All pages\" above a list. It still meets the 24px target size. */\n declare size: 'md' | 'sm';\n\n constructor() {\n super();\n this.width = 'full';\n this.options = [];\n this.placeholder = 'Choose an option';\n this.hideLabel = false;\n this.size = 'md';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n fieldControl('select'),\n css`\n :host([hide-label]) .label {\n ${visuallyHidden}\n }\n /* A compact box sits inline, in a toolbar, so it has none of a form field's spacing under it. */\n :host([size='sm']) {\n margin-block-end: 0;\n }\n /* A compact box is as wide as its longest option, as a filter in a toolbar is. */\n :host([size='sm']) .box {\n inline-size: max-content;\n max-inline-size: 100%;\n }\n :host([size='sm']) select {\n inline-size: auto;\n min-block-size: 32px;\n padding-block: 4px;\n padding-inline-start: 10px;\n font-size: 14px;\n }\n /* Nothing under a compact box until there is an error to show, so it lines up with the chips beside it. */\n :host([size='sm']) .error:empty {\n margin: 0;\n }\n :host([size='sm']) .caret {\n inset-inline-end: 10px;\n font-size: 12px;\n }\n /* The browser's own arrow is replaced by a small \"▾\", drawn beside the box's end and hidden from screen readers. */\n .box { position: relative; display: block; inline-size: min(100%, var(--impakt-field-width)); }\n select { inline-size: 100%; appearance: none; -webkit-appearance: none; padding-inline-end: ${space(9)}; cursor: pointer; }\n .caret { position: absolute; inset-inline-end: ${space(3.5)}; inset-block-start: 50%; transform: translateY(-50%); font-size: ${fontSize('sm')}; line-height: 1; color: ${t.text}; pointer-events: none; }\n /* A forced colours mode draws the box in the system colours; the caret takes the text colour. */\n @media (forced-colors: active) { .caret { color: CanvasText; } }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <span class=\"box\" part=\"box\"><select\n id=${this.controlId}\n part=\"select\"\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}\n >\n <option value=\"\" ?selected=${!this.value}>${this.placeholder}</option>\n ${this.options.map((o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`)}\n </select><span class=\"caret\" aria-hidden=\"true\">▾</span></span>\n `;\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-select', ImpaktSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-select': ImpaktSelect;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA0BjD,IAAM,eAAN,cAA2B,aAAa;AAAA,EAC7C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,SAAS,EAAE,MAAM,MAAM;AAAA,MACvB,aAAa,EAAE,MAAM,OAAO;AAAA,MAC5B,WAAW,EAAE,MAAM,SAAS,WAAW,cAAc,SAAS,KAAK;AAAA,MACnE,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,IACtC;AAAA;AAAA,EAgBA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ;AACb,SAAK,UAAU,CAAC;AAChB,SAAK,cAAc;AACnB,SAAK,YAAY;AACjB,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA,aAAa,QAAQ;AAAA,MACrB;AAAA;AAAA,UAEM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oGA4B4E,MAAM,CAAC,CAAC;AAAA,uDACrD,MAAM,GAAG,CAAC,qEAAqE,SAAS,IAAI,CAAC,4BAA4B,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA,IAIpL;AAAA;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA;AAAA,aAEE,KAAK,SAAS;AAAA;AAAA,eAEZ,KAAK,QAAQ,OAAO;AAAA,oBACf,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,2BACN,KAAK,WAAW;AAAA,uBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,kBAClC,CAAC,MAAa,KAAK,aAAc,EAAE,OAA6B,KAAK,CAAC;AAAA;AAAA,qCAEnD,CAAC,KAAK,KAAK,IAAI,KAAK,WAAW;AAAA,UAC1D,KAAK,QAAQ,IAAI,CAAC,MAAM,qBAAqB,EAAE,KAAK,cAAc,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,CAAC;AAAA;AAAA;AAAA,EAGvH;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAAA,EAC/E;AACF;AAEA,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/rows.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport { pageLocale } from '../base/locale';\nimport { iconSvg } from './icon';\nimport { statusPill, statusPillStyles, type StatusTone } from './status-pill-style';\n\n/** The colour that reads on the text colour, which a toned band sets; the card otherwise. */\nconst INVERSE = token('color.text.inverse', 'var(--impakt-solid-card, var(--impakt-color-surface-card, #ffffff))');\n\n/** The light weight large numbers are set in, 300 when the theme does not say. */\nconst LIGHT = token('font.weight.light', '300');\n\n/**\n * A count with its name: \"UK 4\", \"Active import jobs 12\". A dashboard shows a\n * row of them.\n *\n * **The name comes before the number in the reading order.** A screen reader\n * says \"UK, 4\", which makes sense heard on its own; \"4, UK\" does not. With\n * `href` the whole tile is one link, named by the label, the value and the\n * caption together.\n *\n * **It is the G2 summary tile** (frames 33:451, 36:473, 37:469, 39:770): white,\n * a 1px ink border, the label in the code face, the figure large and tight\n * (a word works as the figure too, such as \"First audit\"), the note under it,\n * and under the note an optional status pill, such as \"All proven\". The\n * status is words, so it does not rest on its dot's colour.\n *\n * @category content\n * @icon badge\n */\nexport class ImpaktStatTile extends ImpaktElement {\n static properties = {\n label: { type: String },\n value: { type: String },\n caption: { type: String },\n href: { type: String },\n tone: { type: String, reflect: true },\n size: { type: String, reflect: true },\n status: { type: String },\n statusTone: { type: String, attribute: 'status-tone' },\n };\n /** What is counted, such as \"UK\" or \"Active import jobs\". */\n declare label: string;\n /** The count or figure, such as \"4\". */\n declare value: string;\n /** A line under the figure, such as \"3 arriving in the next two weeks\". */\n declare caption: string;\n /** Where the tile goes when it is pressed, such as the list it counts. */\n declare href: string;\n /** `plain` is a quiet tile on a card; `brand` is the one figure a screen leads with. */\n declare tone: 'plain' | 'brand';\n /** `lg` sets the figure larger, for the lead figure. */\n declare size: 'md' | 'lg';\n /** A status under the note, drawn as a pill, such as \"All proven\". */\n declare status: string;\n /** The status's tone. */\n declare statusTone: StatusTone;\n\n constructor() {\n super();\n this.label = '';\n this.value = '';\n this.caption = '';\n this.href = '';\n this.tone = 'plain';\n this.size = 'md';\n this.status = '';\n this.statusTone = 'neutral';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n statusPillStyles,\n css`\n :host { display: block; }\n .tile {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: ${space(2.5)};\n block-size: 100%;\n padding: ${space(5)};\n border: ${t.borderThin} solid ${t.text};\n border-radius: ${t.radius};\n background: ${t.surfaceCard};\n color: ${t.text};\n text-decoration: none;\n }\n a.tile:hover { background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%); }\n .label { font-family: ${t.fontMono}; font-size: ${fontSize('sm')}; font-weight: ${fontWeight('regular')}; color: ${t.textMuted}; }\n /* G2: Archivo SemiBold 52/1.04, -4%. A word fits as well as a number. */\n .value { font-size: var(--impakt-type-stat-size, 3.25rem); line-height: 1.04; letter-spacing: -0.04em; font-weight: ${fontWeight('semibold')}; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }\n .caption { font-size: ${fontSize('sm')}; line-height: 1.45; color: ${t.textMuted}; }\n :host([size='lg']) .tile { min-block-size: 200px; padding: ${space(6)}; }\n :host([size='lg']) .value { margin-block-start: auto; font-size: 64px; line-height: 1; font-weight: ${LIGHT}; }\n :host([tone='brand']) .tile { background: ${t.brand}; color: ${t.onBrand}; border-color: ${t.brand}; }\n :host([tone='brand']) a.tile:hover { background: ${t.brandHover}; }\n :host([tone='brand']) .label, :host([tone='brand']) .caption { color: ${t.onBrand}; }\n @media (max-width: 40rem) { .value { font-size: 2.5rem; } }\n @media (forced-colors: active) { .tile { border: 1px solid CanvasText; } }\n `,\n ];\n\n render(): TemplateResult {\n const inner = html`\n <span class=\"label\" part=\"label\">${this.label}</span>\n <span class=\"value\" part=\"value\">${this.value}</span>\n ${this.caption ? html`<span class=\"caption\" part=\"caption\">${this.caption}</span>` : nothing}\n ${statusPill(this.status, this.statusTone)}\n `;\n return this.href ? html`<a class=\"tile\" href=${this.href} part=\"tile\">${inner}</a>` : html`<div class=\"tile\" part=\"tile\">${inner}</div>`;\n }\n}\n\n/**\n * A date as a small block of month and day: \"DEC 2\". It sits at the start of a\n * row, beside what happens on that date.\n *\n * **The full date is what a screen reader hears.** The short month and day are\n * hidden from it, and the date is read in full in the page's language, such as\n * \"2 December 2026\", because \"DEC 2\" said aloud is ambiguous.\n *\n * @category content\n * @icon calendar\n */\nexport class ImpaktDateTile extends ImpaktElement {\n static properties = {\n date: { type: String },\n tone: { type: String, reflect: true },\n };\n /** The date, as YYYY-MM-DD. */\n declare date: string;\n /** `brand` is filled with the brand colour; `plain` is a quiet tile. */\n declare tone: 'brand' | 'plain';\n\n constructor() {\n super();\n this.date = '';\n this.tone = 'brand';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n css`\n :host { display: inline-block; flex: none; }\n time {\n position: relative;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n inline-size: 48px;\n block-size: 52px;\n border-radius: ${t.radiusLg};\n background: ${t.brand};\n color: ${t.onBrand};\n line-height: 1;\n }\n :host([tone='plain']) time { background: ${t.surfaceInset}; color: ${t.text}; }\n .month { font-size: 10px; font-weight: ${fontWeight('medium')}; letter-spacing: ${t.trackingWide}; text-transform: uppercase; }\n .day { margin-block-start: ${space(1)}; font-size: 20px; font-weight: ${fontWeight('medium')}; font-variant-numeric: tabular-nums; }\n .sr-only { ${visuallyHidden} }\n @media (forced-colors: active) { time { border: 1px solid CanvasText; } }\n `,\n ];\n\n private parts(): { month: string; day: string; full: string } | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(this.date ?? '');\n if (!match) return null;\n // Noon UTC, so no time zone moves the date to the day before or after.\n const when = new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]), 12));\n if (Number.isNaN(when.getTime())) return null;\n const locale = pageLocale(this);\n const say = (options: Intl.DateTimeFormatOptions) => new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' }).format(when);\n return { month: say({ month: 'short' }).replace('.', ''), day: say({ day: 'numeric' }), full: say({ day: 'numeric', month: 'long', year: 'numeric' }) };\n }\n\n render(): TemplateResult {\n const parts = this.parts();\n if (!parts) return html`${nothing}`;\n return html`<time datetime=${this.date} part=\"tile\">\n <span class=\"month\" aria-hidden=\"true\">${parts.month}</span>\n <span class=\"day\" aria-hidden=\"true\">${parts.day}</span>\n <span class=\"sr-only\">${parts.full}</span>\n </time>`;\n }\n}\n\n/**\n * One line in a list: a title, a line of detail under it, and room at the\n * start and the end. It is the task with its tick, the job that needs\n * attention, the delivery with its date, the setting with its arrow.\n *\n * **With `href` the whole row is one target, without nesting controls in a\n * link.** The title is the link, and it is stretched over the row, so the row\n * can be pressed anywhere. Anything in the `end` slot, such as a button, sits\n * above the stretched link and stays its own control, because a button inside\n * a link is two controls a screen reader cannot tell apart (4.1.2).\n *\n * A chevron is drawn at the end of a row that is a link, as the sign that it\n * goes somewhere. Put rows in an element with `role=\"list\"` and give each\n * `role=\"listitem\"` when they are a list, so a screen reader says how many\n * there are.\n *\n * @category content\n * @icon list\n * @slot start - Before the title: a dot, a date tile, a checkbox.\n * @slot end - After the title: a badge, a button.\n */\nexport class ImpaktRow extends ImpaktElement {\n static properties = {\n heading: { type: String },\n meta: { type: String },\n href: { type: String },\n divided: { type: Boolean, reflect: true },\n muted: { type: Boolean, reflect: true },\n selected: { type: Boolean, reflect: true },\n };\n /** The row's title. */\n declare heading: string;\n /** The line of detail under the title, such as \"CY-2026-00421 · Due 20 Nov 2026\". */\n declare meta: string;\n /** Where the row goes when it is pressed. */\n declare href: string;\n /** Draw a hairline above the row, for rows stacked on a card. */\n declare divided: boolean;\n /** Set the title quieter, for something finished, such as a done task. */\n declare muted: boolean;\n /**\n * The row being shown, such as the open case in a list beside it: an ink\n * fill with the words turned over (the paper in dark), and `aria-current`\n * on the row so it is not said by colour alone (frame 37:656).\n */\n declare selected: boolean;\n\n constructor() {\n super();\n this.selected = false;\n this.heading = '';\n this.meta = '';\n this.href = '';\n this.divided = false;\n this.muted = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; }\n :host([divided]) .row { border-block-start: ${t.borderThin} solid ${t.hairline}; }\n .row { position: relative; display: flex; align-items: center; gap: ${space(3)}; padding-block: ${space(3)}; }\n .text { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: ${space(0.5)}; }\n .title { font-size: ${fontSize('md')}; font-weight: ${fontWeight('medium')}; color: ${t.text}; }\n :host([muted]) .title { color: ${t.textMuted}; font-weight: ${fontWeight('regular')}; }\n /* The meta is a label: the code face where the brand sets its labels in one, as G2 does (36:452, 37:646). */\n .meta { font-family: ${t.fontEyebrow}; font-size: ${fontSize('sm')}; color: ${t.textMuted}; }\n a { color: inherit; text-decoration: none; }\n /* The link is stretched over the row, so the row is one target. */\n a::after { content: ''; position: absolute; inset: 0; border-radius: ${t.radius}; }\n a:focus-visible { outline: none; }\n a:focus-visible::after { box-shadow: ${t.focusShadow}; }\n .row:has(a):hover .title { text-decoration: underline; text-underline-offset: 0.2em; }\n .start, .end { flex: none; display: flex; align-items: center; gap: ${space(2)}; }\n .start.empty, .end.empty { display: none; }\n /* Controls at the end stay pressable above the stretched link. */\n .end { position: relative; z-index: 1; }\n .chevron { flex: none; color: ${t.textMuted}; }\n :host([selected]) .row { padding-inline: ${space(4)}; background: ${t.text}; --impakt-color-text-default: ${INVERSE}; --impakt-color-text-muted: color-mix(in srgb, ${INVERSE} 72%, ${t.text}); --impakt-color-text-inverse: ${t.text}; }\n :host([selected]) :is(.title, .meta, .chevron) { color: ${INVERSE}; }\n :host([selected]) .meta, :host([selected]) .chevron { color: color-mix(in srgb, ${INVERSE} 72%, ${t.text}); }\n @media (forced-colors: active) { :host([selected]) .row { outline: 2px solid Highlight; } }\n `,\n ];\n\n private filled = { start: false, end: false };\n\n private onSlot(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const name = slot.name as 'start' | 'end';\n this.filled = {\n ...this.filled,\n [name]: slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || (n.textContent ?? '').trim() !== ''),\n };\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n const title = this.href\n ? html`<a class=\"title\" href=${this.href} part=\"link\">${this.heading}</a>`\n : html`<span class=\"title\" part=\"title\">${this.heading}</span>`;\n return html`<div class=\"row\" part=\"row\" aria-current=${this.selected ? 'true' : nothing}>\n <div class=\"start ${this.filled.start ? '' : 'empty'}\"><slot name=\"start\" @slotchange=${this.onSlot}></slot></div>\n <div class=\"text\">${title}${this.meta ? html`<span class=\"meta\" part=\"meta\">${this.meta}</span>` : nothing}</div>\n <div class=\"end ${this.filled.end ? '' : 'empty'}\"><slot name=\"end\" @slotchange=${this.onSlot}></slot></div>\n ${this.href && !this.selected ? html`<span class=\"chevron\" aria-hidden=\"true\">${iconSvg('chevron-right', '20px')}</span>` : nothing}\n </div>`;\n }\n}\n\n/**\n * A pressable filter: \"UK 4\", \"Completed 27\". A row of them narrows a list.\n *\n * **It is a toggle button.** It carries `aria-pressed`, so a screen reader says\n * whether the filter is on, and it is filled when it is on, so that does not\n * rest on colour alone (1.4.1). When only one filter in a row can be on, the\n * app turns the others off when it hears `impakt-change`.\n *\n * The count is read with the label. Set `count-label` when the number needs its\n * noun to make sense aloud, such as \"4 jobs\".\n *\n * @category action\n * @icon badge\n * @fires {CustomEvent<{ pressed: boolean }>} impakt-change - When the filter is turned on or off.\n */\nexport class ImpaktFilterChip extends ImpaktElement {\n static properties = {\n label: { type: String },\n count: { type: Number },\n countLabel: { type: String, attribute: 'count-label' },\n pressed: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n };\n declare label: string;\n /** How many things the filter would show. Left out when not set. */\n declare count: number | undefined;\n /** The count in words for a screen reader, such as \"4 jobs\". The number alone when empty. */\n declare countLabel: string;\n declare pressed: boolean;\n declare disabled: boolean;\n\n constructor() {\n super();\n this.label = '';\n this.count = undefined;\n this.countLabel = '';\n this.pressed = false;\n this.disabled = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('button'),\n css`\n :host { display: inline-block; }\n /* The containing block for the words kept for screen readers, so a control scrolled out of a row cannot widen the page. */\n button {\n ${targetSize}\n position: relative;\n display: inline-flex;\n align-items: center;\n gap: ${space(2)};\n min-block-size: 35px;\n padding: 0 ${space(3.5)};\n font: inherit;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('regular')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.text};\n border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999));\n cursor: pointer;\n white-space: nowrap;\n }\n button:hover:not(:disabled) { background: ${t.surfaceInset}; }\n button[aria-pressed='true'] { background: ${t.text}; color: ${INVERSE}; border-color: ${t.text}; }\n button:disabled { cursor: not-allowed; opacity: 0.5; }\n .count { font-variant-numeric: tabular-nums; color: ${t.textMuted}; }\n button[aria-pressed='true'] .count { color: inherit; opacity: 0.8; }\n .sr-only { ${visuallyHidden} }\n @media (forced-colors: active) { button[aria-pressed='true'] { border: 2px solid Highlight; } }\n `,\n ];\n\n private toggle(): void {\n if (this.disabled) return;\n this.pressed = !this.pressed;\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: { pressed: this.pressed }, bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n const hasCount = typeof this.count === 'number' && !Number.isNaN(this.count);\n return html`<button type=\"button\" part=\"button\" aria-pressed=${this.pressed ? 'true' : 'false'} ?disabled=${this.disabled} @click=${this.toggle}>\n <span>${this.label}</span>\n ${\n hasCount\n ? this.countLabel\n ? html`<span class=\"count\" aria-hidden=\"true\">${this.count}</span><span class=\"sr-only\">${this.countLabel}</span>`\n : html`<span class=\"count\">${this.count}</span>`\n : nothing\n }\n </button>`;\n }\n}\n\ncustomElements.define('impakt-stat-tile', ImpaktStatTile);\ncustomElements.define('impakt-date-tile', ImpaktDateTile);\ncustomElements.define('impakt-row', ImpaktRow);\ncustomElements.define('impakt-filter-chip', ImpaktFilterChip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-stat-tile': ImpaktStatTile;\n 'impakt-date-tile': ImpaktDateTile;\n 'impakt-row': ImpaktRow;\n 'impakt-filter-chip': ImpaktFilterChip;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AASxD,IAAM,UAAU,MAAM,sBAAsB,qEAAqE;AAGjH,IAAM,QAAQ,MAAM,qBAAqB,KAAK;AAoBvC,IAAM,iBAAN,cAA6B,cAAc;AAAA,EAChD;AAAA,SAAO,aAAa;AAAA,MAClB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,OAAO,EAAE,MAAM,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cAAc;AAAA;AAAA;AAAA,IAG7B;AAAA;AAAA,EAEQ,SAAe;AACrB,QAAI,KAAK,SAAU;AACnB,SAAK,UAAU,CAAC,KAAK;AACrB,SAAK,cAAc,IAAI,YAAY,iBAAiB,EAAE,QAAQ,EAAE,SAAS,KAAK,QAAQ,GAAG,SAAS,MAAM,UAAU,KAAK,CAAC,CAAC;AAAA,EAC3H;AAAA,EAEA,SAAyB;AACvB,UAAM,WAAW,OAAO,KAAK,UAAU,YAAY,CAAC,OAAO,MAAM,KAAK,KAAK;AAC3E,WAAO,wDAAwD,KAAK,UAAU,SAAS,OAAO,cAAc,KAAK,QAAQ,WAAW,KAAK,MAAM;AAAA,cACrI,KAAK,KAAK;AAAA,QAEhB,WACI,KAAK,aACH,8CAA8C,KAAK,KAAK,gCAAgC,KAAK,UAAU,YACvG,2BAA2B,KAAK,KAAK,YACvC,OACN;AAAA;AAAA,EAEJ;AACF;AAEA,eAAe,OAAO,oBAAoB,cAAc;AACxD,eAAe,OAAO,oBAAoB,cAAc;AACxD,eAAe,OAAO,cAAc,SAAS;AAC7C,eAAe,OAAO,sBAAsB,gBAAgB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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,SAA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AAI,oBAAoB,EAAE,MAAM,kBAAkB,EAAE,QAAQ;AAAA,wFAC7H,MAAM,CAAC,CAAC,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 +0,0 @@
|
|
|
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,IAAI,IAAI,MAAM,SAAS,IAAI;AAGvC,QAAI,IAAI,WAAW,SAAS,OAAQ,QAAO;AAC3C,WAAO,IAAI,SAAS,QAAQ,OAAO,EAAE,KAAK;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACA,QAAM,OAAO,SAAS,SAAS,QAAQ,OAAO,EAAE,KAAK;AACrD,MAAI,SAAS,KAAM,QAAO;AAC1B,SAAO,SAAS,OAAO,KAAK,WAAW,GAAG,IAAI,GAAG,IAAI,YAAY;AACnE;AAiBO,IAAM,YAAN,cAAwB,cAAc;AAAA,EA4D3C,cAAc;AACZ,UAAM;AAVR;AAAA,SAAQ,WAAW;AAsFnB;AAAA,SAAQ,QAAQ;AA3Ed,SAAK,QAAQ,CAAC;AACd,SAAK,QAAQ;AACb,SAAK,WAAW;AAChB,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,aAAa;AAClB,SAAK,OAAO;AACZ,SAAK,UAAU;AAAA,EACjB;AAAA,EAxEA;AAAA,S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Q,KAAK,SAAS,CAAC;AAC7B,WAAO,uBAAuB,KAAK,KAAK;AAAA,QACpC,MAAM;AAAA,MACN,CAAC,MAAM,MACL,WACE,MAAM,MAAM,SAAS,IAAI,iCAAiC,KAAK,KAAK,YAAY,eAAe,KAAK,IAAI,gBAAgB,KAAK,KAAK,MACpI;AAAA,IACJ,CAAC;AAAA;AAAA,EAEL;AACF;AAEA,eAAe,OAAO,cAAc,SAAS;AAC7C,eAAe,OAAO,sBAAsB,iBAAiB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
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,E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AAC,oBAAoB,EAAE,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKhI;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO;AAAA,EACT;AACF;AAEA,eAAe,OAAO,gBAAgB,WAAW;AACjD,eAAe,OAAO,eAAe,UAAU;AAC/C,eAAe,OAAO,kBAAkB,aAAa;AACrD,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/accordion.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type TemplateResult } from 'lit';\nimport { onServer } from '../base/server';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { statusPill, statusPillStyles, type StatusTone } from './status-pill-style';\n\n/** The G2 soft rule between findings, until the theme carries it. */\nconst LINE_SOFT = unsafeCSS('var(--impakt-color-line-soft, #dcdcd8)');\n\nexport interface AccordionItem {\n id: string;\n heading: string;\n body: string;\n /** A short code before the heading, in the code face, such as \"01\" or \"WCAG 1.4.3\". It is part of the button's name. */\n meta?: string;\n /** A status after the heading, drawn as a pill, such as \"Fixed\". It is outside the button, so its name stays the question. */\n status?: string;\n /** The status's tone. */\n statusTone?: StatusTone;\n /** More pills after the status, such as \"Found by the model\" or \"WCAG 1.1.1\". Each one is words, so none rests on its dot. */\n tags?: Array<{ label: string; tone?: StatusTone }>;\n}\n\n/**\n * Disclosure sections — frequently asked questions, \"what does this mean?\".\n *\n * **Each header is a button inside a heading.** The heading is what lets a\n * screen-reader user jump between sections without tabbing through every\n * paragraph; the button is what makes the section openable. One without the\n * other is a common half-implementation: all-headings cannot be operated,\n * all-buttons cannot be navigated.\n *\n * `headingLevel` is a property because the right level depends on what is\n * above the accordion on the page, and guessing produces exactly the skipped\n * levels that 1.3.1 is about.\n *\n * **Panels are hidden, not unmounted.** `hidden` keeps the content in the\n * accessibility tree's structure and lets in-page search find it when opened,\n * and it means `aria-controls` always points at an element that exists.\n *\n * **A panel can hold more than words.** `body` is plain text, which is what a\n * composition can author safely. Content rendered elsewhere, such as an FAQ\n * answer with links and a list, is slotted instead: a child with\n * `slot=\"panel-<item id>\"` replaces that item's body. The slot sits inside the\n * panel, so the region, its label and its `hidden` state are unchanged, and a\n * panel with nothing slotted still shows its body.\n *\n * **Without script every panel is open.** A page built to finished HTML may load\n * no script at all, and a closed panel there could never be opened. So an\n * accordion drawn on the server has every panel open and its markers hidden: the\n * questions and answers read as a plain list. When the script loads it closes\n * the panels that `open` does not name, and the buttons work.\n *\n * @category content\n * @icon accordion\n */\nexport class ImpaktAccordion extends ImpaktElement {\n static properties = {\n items: { type: Array },\n headingLevel: { type: Number, attribute: 'heading-level' },\n open: { type: Array },\n multiple: { type: Boolean },\n look: { type: String, reflect: true },\n enhanced: { state: true },\n };\n\n declare items: AccordionItem[];\n declare headingLevel: number;\n /** Ids currently expanded. */\n declare open: string[];\n /** When false, opening one closes the others. */\n declare multiple: boolean;\n /**\n * `plain` is the site's questions: a \"+\" at the end that turns to \"−\" when\n * open. `issues` is a list of findings in a tool: the \"+\" at the start and an\n * open panel drawn as an inset soft panel with an ink border.\n */\n declare look: 'plain' | 'issues';\n /** Whether the script is running here, so the panels can be closed and opened. */\n declare private enhanced: boolean;\n\n constructor() {\n super();\n this.items = [];\n this.headingLevel = 3;\n this.open = [];\n this.multiple = true;\n this.look = 'plain';\n this.enhanced = false;\n }\n\n connectedCallback(): void {\n // Drawn here from nothing, the panels start as `open` says. Drawn on the server first, the\n // first draw here must match what the server sent, with every panel open, and firstUpdated\n // then closes them.\n if (!onServer && !this.shadowRoot) this.enhanced = true;\n super.connectedCallback();\n }\n\n protected firstUpdated(): void {\n this.enhanced = true;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n statusPillStyles,\n css`\n :host {\n display: block;\n border-block-start: ${t.borderThin} solid ${t.text};\n }\n .item {\n border-block-end: ${t.borderThin} solid ${t.text};\n }\n /* The heading row. The button is stretched over it, so the whole row opens the panel, the status included. */\n .head {\n position: relative;\n display: flex;\n align-items: center;\n gap: ${space(4)};\n }\n .h {\n flex: 1;\n min-inline-size: 0;\n margin: 0;\n }\n button {\n ${targetSize}\n display: flex;\n align-items: baseline;\n flex-wrap: wrap;\n column-gap: ${space(4)};\n row-gap: ${space(1)};\n inline-size: 100%;\n padding: ${space(8)} 0;\n background: none;\n border: 0;\n font: inherit;\n /* G2 heading S: 24/1.15, -2.5%, semibold. */\n font-size: var(--impakt-type-heading-s-size, 1.5rem);\n line-height: 1.15;\n letter-spacing: -0.025em;\n font-weight: ${fontWeight('semibold')};\n color: ${t.text};\n text-align: start;\n cursor: pointer;\n }\n button::after {\n content: '';\n position: absolute;\n inset: 0;\n }\n button:focus-visible {\n box-shadow: none;\n }\n button:focus-visible::after {\n box-shadow: ${t.focusShadow};\n }\n button:hover .q {\n text-decoration: underline;\n text-decoration-thickness: 1px;\n text-underline-offset: 0.15em;\n }\n .meta {\n font-family: ${t.fontMono};\n font-size: ${fontSize('sm')};\n font-weight: 400;\n letter-spacing: normal;\n color: ${t.textMuted};\n }\n .status-pill {\n flex: none;\n }\n .pills {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: ${space(2)};\n max-inline-size: 50%;\n }\n /* A plus that turns to a minus: two bars, the upright one hidden when open. Drawn, not typed, so it is the same in every face. */\n .marker {\n position: relative;\n flex: none;\n inline-size: 18px;\n block-size: 18px;\n /* Centred on the question's first line, not sat on its baseline. */\n align-self: flex-start;\n margin-block-start: calc((1lh - 18px) / 2);\n }\n .marker::before,\n .marker::after {\n content: '';\n position: absolute;\n background: ${t.text};\n }\n .marker::before {\n inset-inline: 0;\n inset-block-start: calc(50% - 1px);\n block-size: 2px;\n }\n .marker::after {\n inset-block: 0;\n inset-inline-start: calc(50% - 1px);\n inline-size: 2px;\n transition: transform 120ms ease-in-out;\n }\n .item.open .marker::after {\n transform: scaleY(0);\n }\n @media (forced-colors: active) {\n .marker::before,\n .marker::after {\n background: CanvasText;\n }\n }\n /* With no script the element is never defined: the buttons cannot work, so they do not look as if they do. */\n :host(:not(:defined)) button {\n cursor: default;\n pointer-events: none;\n }\n :host(:not(:defined)) .marker {\n display: none;\n }\n .panel {\n max-inline-size: 48rem;\n margin-block-start: calc(-1 * ${space(4)});\n padding-block-end: ${space(8)};\n font-size: ${fontSize('md')};\n line-height: 1.6;\n color: ${t.textMuted};\n }\n /*\n * Issues (frames 36:716, 36:430): rows divided by soft rules, each a code, a small \"+\" and the finding in\n * body type. An open finding becomes an inset soft box with an ink edge: the code above the heading, the\n * heading in heading S, the status at the top right, and the panel under them, with no marker.\n */\n :host([look='issues']) {\n border-block-start: 0;\n }\n :host([look='issues']) .item {\n border-block-end: ${t.borderThin} solid ${LINE_SOFT};\n }\n /* The finding keeps at least 16rem; on a narrow screen the status wraps under it, at the end, rather than squeezing it. */\n :host([look='issues']) .head {\n flex-wrap: wrap;\n gap: ${space(2)} ${space(4)};\n }\n :host([look='issues']) .h {\n flex: 1 1 16rem;\n }\n :host([look='issues']) .head > :is(.status-pill, .pills) {\n margin-inline-start: auto;\n }\n :host([look='issues']) button {\n align-items: center;\n column-gap: ${space(3)};\n padding-block: ${space(5)};\n font-size: 1.25rem;\n line-height: 1.2;\n letter-spacing: -0.01em;\n font-weight: ${fontWeight('regular')};\n }\n :host([look='issues']) .meta {\n margin-inline-end: ${space(1)};\n }\n :host([look='issues']) .marker {\n inline-size: 12px;\n block-size: 12px;\n }\n :host([look='issues']) .marker::before {\n inset-block-start: calc(50% - 0.75px);\n block-size: 1.5px;\n }\n :host([look='issues']) .marker::after {\n inset-inline-start: calc(50% - 0.75px);\n inline-size: 1.5px;\n }\n :host([look='issues']) .item.open {\n margin-block: ${space(4)};\n padding: ${space(6)};\n background: ${t.surfaceSubtle};\n border: ${t.borderThin} solid ${t.text};\n }\n :host([look='issues']) .item.open .head {\n align-items: flex-start;\n }\n :host([look='issues']) .item.open button {\n flex-direction: column;\n align-items: flex-start;\n row-gap: ${space(2)};\n padding-block: 0;\n font-size: var(--impakt-type-heading-s-size, 1.5rem);\n line-height: 1.15;\n letter-spacing: -0.025em;\n font-weight: ${fontWeight('semibold')};\n }\n :host([look='issues']) .item.open .meta {\n letter-spacing: normal;\n font-weight: 400;\n }\n :host([look='issues']) .item.open .marker {\n display: none;\n }\n :host([look='issues']) .panel {\n max-inline-size: none;\n margin: ${space(4)} 0 0;\n padding: 0;\n color: ${t.text};\n }\n :host([look='issues']) .panel[hidden] {\n display: none;\n }\n /* Without script every finding is open and has no marker; it reads as a list, not as boxes. */\n :host([look='issues']:not(:defined)) .item.open {\n margin: 0;\n padding: ${space(5)} 0;\n background: none;\n border: 0;\n border-block-end: ${t.borderThin} solid ${LINE_SOFT};\n }\n @media (max-width: 40rem) {\n button {\n padding-block: ${space(6)};\n font-size: 1.25rem;\n }\n :host([look='issues']) button {\n padding-block: ${space(4)};\n font-size: 1.125rem;\n }\n :host([look='issues']) .item.open {\n padding: ${space(4)};\n }\n :host([look='issues']) .item.open button {\n padding-block: 0;\n font-size: 1.25rem;\n }\n }\n `,\n ];\n\n private toggle(id: string): void {\n const isOpen = this.open.includes(id);\n if (isOpen) this.open = this.open.filter((o) => o !== id);\n else this.open = this.multiple ? [...this.open, id] : [id];\n }\n\n render(): TemplateResult {\n // In the issues look the \"+\" sits between the code and the finding, so it is inside the button.\n const issues = this.look === 'issues';\n return html`\n ${this.items.map((item) => {\n const expanded = !this.enhanced || this.open.includes(item.id);\n const panelId = this.id_(`panel-${item.id}`);\n const buttonId = this.id_(`button-${item.id}`);\n return html`\n <div class=\"item ${expanded ? 'open' : ''}\" part=\"item\">\n <div class=\"head\" part=\"head\">\n <div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>\n <button\n id=${buttonId}\n part=\"header\"\n type=\"button\"\n aria-expanded=${expanded ? 'true' : 'false'}\n aria-controls=${panelId}\n @click=${() => this.toggle(item.id)}\n >\n ${item.meta ? html`<span class=\"meta\" part=\"meta\">${item.meta}</span>` : nothing}\n ${issues ? html`<span class=\"marker\" aria-hidden=\"true\"></span>` : nothing}\n <span class=\"q\">${item.heading}</span>\n </button>\n </div>\n ${\n item.tags?.length\n ? html`<span class=\"pills\" part=\"pills\">\n ${statusPill(item.status, item.statusTone)}${item.tags.map((tag) => statusPill(tag.label, tag.tone ?? 'neutral', 'tag'))}\n </span>`\n : statusPill(item.status, item.statusTone)\n }\n ${issues ? nothing : html`<span class=\"marker\" aria-hidden=\"true\"></span>`}\n </div>\n <div\n id=${panelId}\n class=\"panel\"\n part=\"panel\"\n role=\"region\"\n aria-labelledby=${buttonId}\n ?hidden=${!expanded}\n >\n <slot name=${`panel-${item.id}`}>${item.body}</slot>\n </div>\n </div>\n `;\n })}\n `;\n }\n}\n\ncustomElements.define('impakt-accordion', ImpaktAccordion);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-accordion': ImpaktAccordion;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,SAAS,iBAAsC;AAQnE,IAAM,YAAY,UAAU,wCAAwC;AAiD7D,IAAM,kBAAN,cAA8B,cAAc;AAAA,EACjD;AAAA,SAAO,aAAa;AAAA,MAClB,OAAO,EAAE,MAAM,MAAM;AAAA,MACrB,cAAc,EAAE,MAAM,QAAQ,WAAW,gBAAgB;AAAA,MACzD,MAAM,EAAE,MAAM,MAAM;AAAA,MACpB,UAAU,EAAE,MAAM,QAAQ;AAAA,MAC1B,MAAM,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACpC,UAAU,EAAE,OAAO,KAAK;AAAA,IAC1B;AAAA;AAAA,EAiBA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ,CAAC;AACd,SAAK,eAAe;AACpB,SAAK,OAAO,CAAC;AACb,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,oBAA0B;AAIxB,QAAI,CAAC,YAAY,CAAC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BACE,SAAS,UAAU,qDAAqD;AAAA;AAAA;AAAA,mBAGrE,OAAO;AAAA;AAAA;AAAA;AAAA,gCAIM,QAAQ;AAAA,wBAChB,CAAC,QAAQ;AAAA;AAAA,2BAEN,SAAS,KAAK,EAAE,EAAE,IAAI,KAAK,IAAI;AAAA;AAAA;AAAA;AAAA,IAIpD,CAAC,CAAC;AAAA;AAAA,EAEN;AACF;AAEA,eAAe,OAAO,oBAAoB,eAAe;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/base/FieldElement.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type CSSResult, type TemplateResult } from 'lit';\nimport { ImpaktElement } from './ImpaktElement';\nimport { focusRing, visuallyHidden } from './styles';\nimport { fontSize, fontWeight, lineHeight, space, t } from './tokens';\n\n/**\n * The shared anatomy of a form control: a label, an optional description, a\n * control, and an error.\n *\n * This exists because the ARIA wiring between those four is where accessible\n * forms actually fail, and it fails the same way every time — a description\n * that is never announced, an error that appears silently, a label that points\n * at nothing. Written once, it is right once.\n *\n * Everything is rendered inside this component's own shadow root, including\n * the native control. That is not an implementation detail: `aria-describedby`\n * cannot cross a shadow boundary, so a component that slotted the input from\n * outside could not describe it. Keeping the whole relationship in one tree is\n * what makes the wiring work at all.\n */\n/**\n * How wide a single-line control is, from what it holds: a postcode is short,\n * an email address is long. A width that matches the answer is a hint about\n * what to type (1.3.5 is about the purpose, this is about the size). Applied by\n * the controls that take a `width`, through `--impakt-field-width`.\n */\nexport const fieldWidths = css`\n :host { --impakt-field-width: 100%; }\n :host([width='xs']) { --impakt-field-width: 8ch; }\n :host([width='sm']) { --impakt-field-width: 14ch; }\n :host([width='md']) { --impakt-field-width: 24ch; }\n :host([width='lg']) { --impakt-field-width: 40ch; }\n`;\n\n/**\n * The box a single control is drawn in, shared by the text input, the select and\n * the textarea so they match: a 1px ink border, no shadow, and on focus the\n * locked two-band ring rather than a wide halo (G2 Noire, frames 33:492 and 36:398).\n * A product can still set `--impakt-shadow-field` or `--impakt-color-field-border`.\n */\nexport const fieldControl = (selector: string): CSSResult => {\n const s = unsafeCSS(selector);\n return css`\n ${s} {\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: 50px;\n padding: 13px ${space(3.5)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n line-height: 1.5;\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid var(--impakt-color-field-border, ${t.text});\n border-radius: ${t.radius};\n box-shadow: var(--impakt-shadow-field, none);\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n ${s}:focus-visible {\n border-color: ${t.text};\n box-shadow: ${t.focusShadow};\n }\n ${s}::placeholder {\n color: ${t.textPlaceholder};\n }\n ${s}:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n /* The border thickens as well as reddening, and the message below says it in words (1.4.1). */\n :host([invalid]) ${s} {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `;\n};\n\n/**\n * The base of every form control.\n *\n * @fires {CustomEvent<{ value: string }>} impakt-change - When the answer changes. The answer is in detail.value.\n */\nexport abstract class FieldElement extends ImpaktElement {\n /** Form controls participate in a `<form>` like native ones. */\n static formAssociated = true;\n\n static properties = {\n label: { type: String },\n name: { type: String },\n value: { type: String },\n description: { type: String },\n error: { type: String },\n required: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n requiredText: { type: String, attribute: 'required-text' },\n };\n\n declare label: string;\n declare name: string;\n declare value: string;\n declare description: string;\n declare error: string;\n declare required: boolean;\n declare disabled: boolean;\n declare readonly: boolean;\n /**\n * How \"you must answer this\" is said.\n *\n * Words, not an asterisk. 3.3.2 asks for labels or instructions, and an\n * asterisk is neither until a legend explains it — which puts the\n * explanation somewhere other than the field it explains. It is a property\n * so a partner can reword it, not so they can empty it.\n */\n declare requiredText: string;\n\n protected internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.label = '';\n this.name = '';\n this.value = '';\n this.description = '';\n this.error = '';\n this.required = false;\n this.disabled = false;\n this.readonly = false;\n this.requiredText = 'required';\n // happy-dom and older engines do not implement attachInternals. A control\n // that cannot associate with a form is still a usable control, so this\n // degrades rather than throwing on construction.\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n /*\n * The question, in the code face at 14px in the ink (G2). A page can set it\n * another way through these properties, such as the site's contact form,\n * which sets its labels in capitals at 11px (frame 20:1157).\n */\n .label {\n display: block;\n font-family: var(--impakt-field-label-font, ${t.fontMono});\n font-size: var(--impakt-field-label-size, ${fontSize('sm')});\n font-weight: var(--impakt-field-label-weight, ${fontWeight('regular')});\n letter-spacing: var(--impakt-field-label-tracking, normal);\n text-transform: var(--impakt-field-label-transform, none);\n line-height: ${lineHeight('normal')};\n margin-block-end: ${space(2)};\n color: ${t.text};\n }\n .required {\n font-weight: ${fontWeight('regular')};\n color: ${t.textMuted};\n }\n .description {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.textMuted};\n margin-block-end: ${space(2)};\n }\n .error {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.dangerText};\n margin-block-start: ${space(1)};\n display: flex;\n gap: ${space(1)};\n }\n .error:empty {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n /*\n * Only the control is dimmed. Dimming the whole host took the question,\n * the hint and the error below 4.5:1, and a disabled field still has to\n * say what it is and why it cannot be changed. The native disabled\n * control itself is exempt from the contrast criterion.\n */\n :host([disabled]) :is(input, select, textarea, button) {\n opacity: 0.6;\n cursor: not-allowed;\n }\n `,\n ];\n\n protected get controlId(): string {\n return this.id_('control');\n }\n\n /**\n * What the control points `aria-describedby` at.\n *\n * The error id is included only while there is an error. A describedby that\n * always names an empty element trains a screen-reader user to expect\n * nothing after the description, and then the one time it matters they have\n * already learned to ignore it.\n */\n protected get describedBy(): string | typeof nothing {\n const ids = [this.description ? this.id_('description') : '', this.error ? this.id_('error') : ''].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n /**\n * Focusing the element focuses its control, so `el.focus()` from an app, a\n * React ref or the error summary's link lands where someone can type, rather\n * than on a host that cannot take focus and so silently does nothing.\n */\n focus(options?: FocusOptions): void {\n const control =\n this.renderRoot?.querySelector<HTMLElement>(`#${this.controlId}`) ?? this.renderRoot?.querySelector<HTMLElement>('input, select, textarea, button');\n if (control) control.focus(options);\n else super.focus(options);\n }\n\n /** Subclasses render the control itself; everything round it is here. */\n protected abstract renderControl(): TemplateResult;\n\n /**\n * `<label for>` by default. A group of controls — radios, checkboxes —\n * cannot use one, because `for` names a single control, so those override\n * this and render a `<fieldset>` and `<legend>` instead.\n */\n protected renderLabel(): TemplateResult {\n return html`\n <label class=\"label\" for=${this.controlId} part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </label>\n `;\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderLabel()}\n ${\n this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing\n }\n ${this.renderControl()}\n <!--\n The error region is always present, even when empty. A live region\n inserted at the same moment as its content is announced unreliably\n across screen readers; one that already exists and is then filled is\n announced consistently. \"polite\" rather than \"assertive\" because a\n validation message should not interrupt what is being read.\n -->\n <div\n class=\"error\"\n id=${this.id_('error')}\n part=\"error\"\n aria-live=\"polite\"\n >\n ${this.error || nothing}\n </div>\n `;\n }\n\n /** Keep the form value in step with the control. */\n protected setFormValue(value: string): void {\n this.value = value;\n this.internals?.setFormValue(value);\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: this.changeDetail(value), bubbles: true, composed: true }));\n }\n\n /** What `impakt-change` carries. A control with more to say than its value adds it here. */\n protected changeDetail(value: string): { value: string } {\n return {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AAC,CAAC;AAAA,EAC1H;AAAA;AAAA,EAGU,aAAa,OAAkC;AACvD,WAAO,EAAE,MAAM;AAAA,EACjB;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/dialog.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget } from '../base/styles';\nimport { lockScroll, unlockScroll } from '../base/scroll-lock';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\n/**\n * A modal dialog — \"are you sure you want to leave this order?\".\n *\n * **It is a native `<dialog>` opened with `showModal()`, and that is the whole\n * design.** The platform then provides, correctly and in every browser: a\n * focus trap, Escape to close, the rest of the page made inert so a screen\n * reader cannot wander out of the dialog, rendering in the top layer so no\n * `z-index` can cover it, and focus returned to whatever opened it when it\n * closes.\n *\n * Every one of those is a thing hand-rolled modals get wrong. The focus trap\n * is the famous one, but inertness is the worse failure: a dialog that traps\n * the Tab key but leaves the background in the accessibility tree lets a\n * screen-reader user read straight past it into a page they cannot interact\n * with, and nothing on screen tells them that is what happened.\n *\n * What is left to get right is the labelling. `aria-labelledby` points at the\n * dialog's own heading, so it is announced by name on open rather than as\n * \"dialog\".\n *\n * Two things the platform leaves out are added. The page behind does not scroll\n * while the dialog is open, so a finger on the backdrop does not move the page\n * out from under it. And with `phone-full-screen` the dialog fills a phone's\n * screen, which suits a dialog holding a form; a short question is better left\n * as a box in the middle, which is the default.\n\n *\n * @category feedback\n * @icon dialog\n * @fires {CustomEvent<null>} impakt-close - When the dialog is closed.\n * @slot - The body of the dialog.\n * @slot footer - The dialog's actions, set at the end of a row along its foot, such as \"Cancel\" and \"Send\".\n * @slot actions - The same as `footer`, for a page that names it so.\n */\nexport class ImpaktDialog extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n heading: { type: String },\n closeLabel: { type: String, attribute: 'close-label' },\n dismissible: { type: Boolean },\n phoneFullScreen: { type: Boolean, reflect: true, attribute: 'phone-full-screen' },\n size: { type: String, reflect: true },\n eyebrow: { type: String },\n };\n\n declare open: boolean;\n declare heading: string;\n declare closeLabel: string;\n /** When false, Escape and the backdrop do not close it — a decision must be made. */\n declare dismissible: boolean;\n /** Fill the screen on a phone, for a dialog that holds a form or a long text. */\n declare phoneFullScreen: boolean;\n /** `md` is a short question, 32rem wide. `lg` is 720px, for a dialog that holds a form or a review (G2 frame 45:653). */\n declare size: 'md' | 'lg';\n /** A short line above the heading in the code face, such as \"Step 2 of 3\". It is read before the heading but is not part of the dialog's name. */\n declare eyebrow: string;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.closeLabel = 'Close';\n this.dismissible = true;\n this.phoneFullScreen = false;\n this.size = 'md';\n this.eyebrow = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.close'),\n css`\n dialog {\n padding: 0;\n border: ${t.borderThin} solid ${t.text};\n border-radius: ${t.radius2xl};\n background: ${t.surfaceCard};\n color: ${t.text};\n box-shadow: var(--impakt-shadow-dialog, none);\n max-inline-size: min(32rem, calc(100vw - 2rem));\n /* 1.4.10 Reflow: a dialog taller than the viewport must scroll inside\n itself rather than clipping, at 320px and at 400% zoom alike. */\n max-block-size: calc(100vh - 2rem);\n overflow: auto;\n }\n dialog::backdrop {\n /* The ink at half strength. The text colour is the paper in dark, so the backdrop is the ink there too. */\n background: rgb(17 17 17 / 0.5);\n }\n :host([size='lg']) dialog {\n inline-size: 720px;\n max-inline-size: calc(100vw - 2rem);\n }\n .titles {\n display: flex;\n flex-direction: column;\n gap: ${space(2)};\n min-inline-size: 0;\n }\n .eyebrow {\n margin: 0;\n font-family: ${t.fontMono};\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n .foot {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: ${space(3)};\n padding: ${space(5)} ${space(6)};\n border-block-start: ${t.borderThin} solid var(--impakt-color-line-soft, #dcdcd8);\n }\n .foot.empty {\n display: none;\n }\n .head {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: ${space(3)};\n padding: ${space(6)} ${space(6)} 0;\n }\n /* G2: about 32px, semibold, tight. */\n .heading {\n margin: 0;\n font-family: ${t.fontHeading};\n font-size: var(--impakt-type-heading-m-size, 2rem);\n line-height: 1.1;\n letter-spacing: -0.03em;\n font-weight: ${fontWeight('semibold')};\n color: ${t.textHeading};\n }\n .body {\n padding: ${space(4)} ${space(6)} ${space(6)};\n }\n @media (max-width: 40rem) {\n .heading { font-size: 1.5rem; }\n .head { padding: ${space(5)} ${space(5)} 0; }\n .body { padding: ${space(4)} ${space(5)} ${space(5)}; }\n .foot { padding: ${space(4)} ${space(5)}; }\n }\n @media (max-width: 40rem) {\n :host([phone-full-screen]) dialog {\n inline-size: 100vw;\n max-inline-size: 100vw;\n block-size: 100dvh;\n max-block-size: 100dvh;\n margin: 0;\n border-radius: 0;\n }\n }\n .close {\n ${targetSize}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n font: inherit;\n font-size: ${fontSize('lg')};\n color: ${t.text};\n cursor: pointer;\n }\n `,\n ];\n\n private get dialog(): HTMLDialogElement | null {\n return this.renderRoot.querySelector('dialog');\n }\n\n updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n const dialog = this.dialog;\n if (!dialog) return;\n // happy-dom and older engines do not implement showModal. Falling back to\n // the `open` attribute renders a NON-modal dialog — no focus trap, no\n // inert background — so it is used only to keep tests and ancient browsers\n // from throwing, never as an equivalent.\n if (this.open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n lockScroll(this);\n } else {\n if (typeof dialog.close === 'function' && dialog.open) dialog.close();\n else dialog.removeAttribute('open');\n unlockScroll(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n unlockScroll(this);\n }\n\n private hasFooter = false;\n\n private onFooter(): void {\n const slots = Array.from(this.renderRoot.querySelectorAll<HTMLSlotElement>('slot[name=\"footer\"], slot[name=\"actions\"]'));\n const next = slots.some((slot) => slot.assignedElements({ flatten: true }).length > 0);\n if (next !== this.hasFooter) {\n this.hasFooter = next;\n this.requestUpdate();\n }\n }\n\n private close(): void {\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n return html`\n <dialog\n part=\"dialog\"\n aria-labelledby=${this.heading ? this.id_('heading') : nothing}\n @cancel=${(e: Event) => {\n // `cancel` fires on Escape. Blocking it is what makes a dialog\n // non-dismissible, and it is why `dismissible` exists rather than\n // leaving a caller to re-open on close.\n if (!this.dismissible) e.preventDefault();\n else this.close();\n }}\n @close=${() => {\n if (this.open) this.close();\n }}\n >\n <div class=\"head\">\n <div class=\"titles\">\n ${this.eyebrow ? html`<p class=\"eyebrow\" part=\"eyebrow\">${this.eyebrow}</p>` : nothing}\n ${this.heading ? html`<h2 class=\"heading\" id=${this.id_('heading')} part=\"heading\">${this.heading}</h2>` : nothing}\n </div>\n ${\n this.dismissible\n ? html`<button class=\"close\" part=\"close\" type=\"button\" @click=${this.close}>\n <span aria-hidden=\"true\">×</span>\n <span class=\"sr-only\" style=\"position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)\">${this.closeLabel}</span>\n </button>`\n : nothing\n }\n </div>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n <div class=\"foot ${this.hasFooter ? '' : 'empty'}\" part=\"footer\">\n <slot name=\"footer\" @slotchange=${this.onFooter}></slot><slot name=\"actions\" @slotchange=${this.onFooter}></slot>\n </div>\n </dialog>\n `;\n }\n}\n\ncustomElements.define('impakt-dialog', ImpaktDialog);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-dialog': ImpaktDialog;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAwCjD,IAAM,eA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]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/button.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token, type } from '../base/tokens';\n\n/**\n * The colour that reads on the text colour: the card, unless a toned band says\n * otherwise. An ink band sets it to the ink, an accent band to the card.\n */\nconst INVERSE = token('color.text.inverse', 'var(--impakt-solid-card, var(--impakt-color-surface-card, #ffffff))');\nimport { iconSvg } from './icon';\n\n/**\n * A button.\n *\n * Two decisions carry the accessibility weight here.\n *\n * **A busy button is not a disabled button.** While an action is in flight the\n * control keeps its place in the tab order and reports `aria-disabled`, rather\n * than taking the native `disabled` attribute. A natively disabled element is\n * removed from the tab order, so a keyboard user who had just activated it\n * loses their focus position to the top of the document — at precisely the\n * moment something is happening that they need to be told about. Activation is\n * blocked in the handler instead.\n *\n * **It renders a real `<button>`.** A `<div role=\"button\">` needs Enter and\n * Space handling, a tabindex, and a disabled story, and it will still not\n * submit a form. The native element already has all of that, correctly, in\n * every browser and every assistive technology.\n\n *\n * **A button that goes somewhere is a link.** With `href` set it renders an\n * `<a>` styled as a button, so it opens in a new tab, shows its address and is\n * announced as a link, which is what it is.\n *\n * **An icon-only button still has a name.** With `icon` set and no words, the\n * button shows the icon alone and `label` becomes its accessible name, so a\n * screen reader says \"Back\" rather than \"button\". Without a `label` an\n * icon-only button is not rendered as icon-only, because it would be nameless\n * (4.1.2).\n *\n * @category action\n * @icon button\n * @slot - The button label.\n * @fires click - When the button is pressed. Not while it is busy or disabled.\n */\nexport class ImpaktButton extends ImpaktElement {\n static formAssociated = true;\n\n static properties = {\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n variant: { type: String, reflect: true },\n type: { type: String },\n disabled: { type: Boolean, reflect: true },\n busy: { type: Boolean, reflect: true },\n busyLabel: { type: String, attribute: 'busy-label' },\n full: { type: Boolean, reflect: true },\n fullOnPhone: { type: Boolean, attribute: 'full-on-phone', reflect: true },\n size: { type: String, reflect: true },\n iconBefore: { type: String, attribute: 'icon-before' },\n iconAfter: { type: String, attribute: 'icon-after' },\n href: { type: String },\n icon: { type: String },\n label: { type: String },\n spread: { type: Boolean, reflect: true },\n centred: { type: Boolean, reflect: true },\n };\n\n /** Leave it out on a phone, where a header has no room for it. */\n declare hideOn: 'never' | 'phone';\n /**\n * How much the button asks for attention. `dark` is the strong second\n * choice on a light page, `subtle` a quiet filled one, `danger` an\n * action that removes or cancels something, and `accent` the brand's\n * second colour, for the one action a page is built around.\n */\n declare variant: 'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger' | 'accent' | 'outline';\n /**\n * Put the words at the start and the trailing icon at the far end, as the\n * G2 buttons that run the width of a form or a card do. A `full` button\n * spreads anyway; set `centred` on it to keep its words in the middle.\n */\n declare spread: boolean;\n /** Keep a `full` button's words in the middle rather than spread. */\n declare centred: boolean;\n declare type: 'button' | 'submit' | 'reset';\n declare disabled: boolean;\n declare busy: boolean;\n /** Announced when the button becomes busy. Says what is happening, not that something is. */\n declare busyLabel: string;\n declare full: boolean;\n /** As wide as its space on a phone only, such as a form's send button. */\n declare fullOnPhone: boolean;\n declare size: 'sm' | 'md' | 'lg';\n /** An icon before the words, such as phone or calendar. */\n declare iconBefore:\n | 'none'\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 /** An icon after the words, such as arrow-right. */\n declare iconAfter:\n | 'none'\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 /** Where the button goes, when it opens a page rather than doing something here. */\n declare href: string;\n /** Draws the button as this icon alone, a square button (round where the brand rounds its corners). Needs `label`. */\n declare icon:\n | 'none'\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 /** The accessible name of an icon-only button, such as \"Back\" or \"More actions\". */\n declare label: string;\n\n private internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.variant = 'primary';\n this.type = 'button';\n this.disabled = false;\n this.busy = false;\n this.busyLabel = 'Working';\n this.full = false;\n this.fullOnPhone = false;\n this.size = 'md';\n this.iconBefore = 'none';\n this.iconAfter = 'none';\n this.href = '';\n this.icon = 'none';\n this.label = '';\n this.spread = false;\n this.centred = false;\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('button, a'),\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n :host {\n display: inline-block;\n }\n :host([full]) {\n display: block;\n }\n @media (max-width: 40rem) { :host([full-on-phone]) { display: block; } }\n button, a {\n ${targetSize}\n box-sizing: border-box;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ${space(3)};\n inline-size: 100%;\n /* G2: Archivo Medium 16, 14 by 20, about 47px tall. */\n min-block-size: 44px;\n padding: 14px ${space(5)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n line-height: 1.2;\n font-weight: ${fontWeight('medium')};\n border-radius: ${t.radiusLg};\n border: ${t.borderThin} solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n :host([size='sm']) :is(button, a) { min-block-size: 32px; padding: ${space(1.5)} ${space(3)}; ${type('sm')} gap: ${space(1.5)}; }\n :host([size='lg']) :is(button, a) { min-block-size: 56px; padding: ${space(4)} ${space(6)}; ${type('lg')} }\n /* Spread: the words at the start, the trailing icon at the far end. A full-width button spreads unless it is centred. */\n :host([spread]) :is(button, a), :host([full]:not([centred])) :is(button, a) { justify-content: space-between; text-align: start; }\n .icon { flex: none; inline-size: 1.15em; block-size: 1.15em; }\n /* The cursor is the only thing that changes while busy. Moving or\n recolouring a control the moment it is pressed is how a user loses it. */\n button[aria-disabled='true'] {\n cursor: progress;\n }\n :host([disabled]) button {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n /* Solid: the brand, flat. On an ink band the band sets the brand to the paper, so it reads \"Light\". */\n .primary {\n background: var(--impakt-button-primary, ${t.brand});\n color: var(--impakt-button-on-primary, ${t.onBrand});\n }\n .primary:hover:not([aria-disabled='true']) {\n background: var(--impakt-button-primary-hover, var(--impakt-color-action-hover, ${t.brandHover}));\n color: var(--impakt-button-on-primary, var(--impakt-color-action-on-hover, ${t.onBrand}));\n }\n /* A brand whose buttons turn on hover lifts the trailing arrow a quarter-turn. */\n .after { transition: transform 160ms ease-out; }\n :is(button, a):hover:not([aria-disabled='true']) .after { transform: rotate(var(--impakt-motion-button-turn, 0deg)); }\n @media (prefers-reduced-motion: reduce) { .after { transition: none; } }\n .primary:active:not([aria-disabled='true']) {\n background: var(--impakt-button-primary-hover, ${t.brandActive});\n }\n\n /* Outline: the card, a hairline border and the text colour, for the second choice. */\n .secondary {\n background: ${t.surfaceCard};\n color: ${t.text};\n border-color: ${t.text};\n }\n .secondary:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%);\n border-color: color-mix(in srgb, ${t.text} 25%, transparent);\n }\n\n /* Plain: words only until it is pointed at. */\n .ghost {\n background: transparent;\n color: ${t.link};\n }\n .ghost:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n\n /*\n * Dark: the text colour as a fill, the strong second choice on a light page.\n * Its words are the colour that reads on the text colour, which a toned band\n * sets as --impakt-color-text-inverse. They are never the card colour, which\n * a band repaints as a faint wash of its own text, and which left ink words at\n * 10% on an ink fill when this button sat in a banner on an accent band.\n */\n .dark {\n background: ${t.text};\n color: ${INVERSE};\n }\n .dark:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${INVERSE} 14%);\n }\n .dark:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${INVERSE} 24%);\n }\n\n /* Outline: transparent, a 1px border and words in the text colour, the design's \"Ghost\". On an ink band both are the paper. */\n .outline {\n background: transparent;\n color: ${t.text};\n border-color: ${t.text};\n }\n .outline:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n .outline:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text} 10%, transparent);\n }\n\n /* Subtle: a quiet fill, for an action that sits beside the main one. */\n .subtle {\n background: ${t.surfaceInset};\n color: ${t.text};\n }\n .subtle:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 6%);\n }\n .subtle:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 12%);\n }\n\n /* Accent: the brand's second colour as a fill, for the one action a page is built around. The words on it are the colour the tokens measured against it. */\n .accent {\n background: ${token('color.accent.default', '#ffd43b')};\n color: ${token('color.accent.on', '#1a1a1a')};\n }\n .accent:hover:not([aria-disabled='true']) {\n background: ${token('color.accent.hover', '#e0bb34')};\n }\n .accent:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${token('color.accent.hover', '#e0bb34')}, ${token('color.accent.on', '#1a1a1a')} 10%);\n }\n\n /* Danger: the danger text colour as a fill, so white words on it keep 4.5:1. */\n .danger {\n background: ${t.dangerText};\n color: var(--impakt-solid-card, ${t.surfaceCard});\n }\n .danger:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 15%);\n }\n .danger:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 28%);\n }\n\n /* Icon only: as tall as it is wide, round where the brand rounds its corners and square under Noire. */\n .icon-only {\n inline-size: 47px;\n min-inline-size: 47px;\n block-size: 47px;\n min-block-size: 47px;\n padding: 0;\n border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999));\n }\n :host([size='sm']) .icon-only { inline-size: 32px; min-inline-size: 32px; block-size: 32px; min-block-size: 32px; padding: 0; }\n :host([size='lg']) .icon-only { inline-size: 56px; min-inline-size: 56px; block-size: 56px; min-block-size: 56px; padding: 0; }\n\n .sr-only {\n ${visuallyHidden}\n }\n\n /* Windows High Contrast Mode drops background and border colours, so a\n button styled only by background becomes invisible. A forced-colors\n border puts the boundary back. */\n @media (forced-colors: active) {\n button, a {\n border-color: ButtonBorder;\n }\n }\n `,\n ];\n\n private onClick(event: MouseEvent): void {\n if (this.disabled || this.busy) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n // A shadow-rooted button does not submit the outer form by itself, because\n // the click never reaches it. `requestSubmit` rather than `submit` so that\n // native validation and the submit event both still run.\n if (this.type === 'submit') this.internals?.form?.requestSubmit();\n if (this.type === 'reset') this.internals?.form?.reset();\n }\n\n render(): TemplateResult {\n const iconOnly = Boolean(this.icon && this.icon !== 'none' && this.label);\n const cls = iconOnly ? `${this.variant} icon-only` : this.variant;\n if (iconOnly) {\n const drawn = iconSvg(this.icon);\n if (this.href && !this.disabled) {\n return html`<a class=${cls} href=${this.href} part=\"button\" aria-label=${this.label}>${drawn}</a>`;\n }\n return html`\n <button\n class=${cls}\n type=\"button\"\n part=\"button\"\n aria-label=${this.label}\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${drawn}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n const words = html`${iconSvg(this.iconBefore)}<slot></slot>${this.iconAfter && this.iconAfter !== 'none' ? html`<span class=\"after\" aria-hidden=\"true\">${iconSvg(this.iconAfter)}</span>` : nothing}`;\n if (this.href && !this.disabled) {\n return html`<a class=${this.variant} href=${this.href} part=\"button\">${words}</a>`;\n }\n return html`\n <button\n class=${this.variant}\n type=\"button\"\n part=\"button\"\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${words}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n}\n\ncustomElements.define('impakt-button', ImpaktButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-button': ImpaktButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AASxD,IAAM,UAAU,MAAM,sBAAsB,qEAAqE;AAqC1G,IAAM,eAAN,cAA2B,cAAc;AAAA,EAgN9C,cAAc;AACZ,UAAM;AAHR,SAAQ,YAAqC;AAI3C,SAAK,SAAS;AACd,SAAK,UAAU;AACf,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,YAAY;AACjB,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,UAAU;AACf,QAAI;AACF,WAAK,YAAY,KAAK,gBAAgB;AAAA,IACxC,QAAQ;AACN,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AAAA,EAtOA;AAAA,SAAO,iBAAiB;AAAA;AAAA,EAExB;AAAA,SAAO,aAAa;AAAA,MAClB,QAAQ,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,UAAU;AAAA,MAC5D,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,UAAU,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MACzC,MAAM,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MACrC,WAAW,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,MACnD,MAAM,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MACrC,aAAa,EAAE,MAAM,SAAS,WAAW,iBAAiB,SAAS,KAAK;AAAA,MAC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