@atomic-ui/ui 0.7.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +27 -6
- package/dist/{chunk-HURHKQTJ.js → chunk-FAE6TGGT.js} +4 -2
- package/dist/chunk-FAE6TGGT.js.map +1 -0
- package/dist/{chunk-VYYY5DDZ.js → chunk-TJOYBDKS.js} +14 -1
- package/dist/chunk-TJOYBDKS.js.map +1 -0
- package/dist/{chunk-HA6OJRVI.js → chunk-WRYV6QGA.js} +14 -1
- package/dist/chunk-WRYV6QGA.js.map +1 -0
- package/dist/components/button.d.ts +4 -3
- package/dist/components/button.js +1 -1
- package/dist/components/navigation.js +1 -1
- package/dist/components/page.d.ts +12 -1
- package/dist/components/page.js +1 -1
- package/dist/index.js +3 -3
- package/dist/standalone/atomic-ui.js +43 -20
- package/dist/standalone/atomic-ui.js.map +3 -3
- package/package.json +2 -2
- package/dist/chunk-HA6OJRVI.js.map +0 -1
- package/dist/chunk-HURHKQTJ.js.map +0 -1
- package/dist/chunk-VYYY5DDZ.js.map +0 -1
package/custom-elements.json
CHANGED
|
@@ -3187,9 +3187,9 @@
|
|
|
3187
3187
|
"name": "variant",
|
|
3188
3188
|
"privacy": "public",
|
|
3189
3189
|
"type": {
|
|
3190
|
-
"text": "'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger'"
|
|
3190
|
+
"text": "'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger' | 'accent'"
|
|
3191
3191
|
},
|
|
3192
|
-
"description": "How much the button asks for attention. `dark` is the strong second\nchoice on a light page, `subtle` a quiet filled one,
|
|
3192
|
+
"description": "How much the button asks for attention. `dark` is the strong second\nchoice on a light page, `subtle` a quiet filled one, `danger` an\naction that removes or cancels something, and `accent` the brand's\nsecond colour, for the one action a page is built around.",
|
|
3193
3193
|
"default": "'primary'",
|
|
3194
3194
|
"attribute": "variant",
|
|
3195
3195
|
"reflects": true
|
|
@@ -3407,9 +3407,9 @@
|
|
|
3407
3407
|
{
|
|
3408
3408
|
"name": "variant",
|
|
3409
3409
|
"type": {
|
|
3410
|
-
"text": "'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger'"
|
|
3410
|
+
"text": "'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger' | 'accent'"
|
|
3411
3411
|
},
|
|
3412
|
-
"description": "How much the button asks for attention. `dark` is the strong second\nchoice on a light page, `subtle` a quiet filled one,
|
|
3412
|
+
"description": "How much the button asks for attention. `dark` is the strong second\nchoice on a light page, `subtle` a quiet filled one, `danger` an\naction that removes or cancels something, and `accent` the brand's\nsecond colour, for the one action a page is built around.",
|
|
3413
3413
|
"default": "'primary'",
|
|
3414
3414
|
"fieldName": "variant"
|
|
3415
3415
|
},
|
|
@@ -11602,7 +11602,7 @@
|
|
|
11602
11602
|
"name": "tone",
|
|
11603
11603
|
"privacy": "public",
|
|
11604
11604
|
"type": {
|
|
11605
|
-
"text": "'none' | 'subtle' | 'inset' | 'brand' | 'card'"
|
|
11605
|
+
"text": "'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent'"
|
|
11606
11606
|
},
|
|
11607
11607
|
"description": "The band's background. Text on it takes the matching colour, so it stays readable.",
|
|
11608
11608
|
"default": "'none'",
|
|
@@ -11645,6 +11645,18 @@
|
|
|
11645
11645
|
"attribute": "bleed",
|
|
11646
11646
|
"reflects": true
|
|
11647
11647
|
},
|
|
11648
|
+
{
|
|
11649
|
+
"kind": "field",
|
|
11650
|
+
"name": "pattern",
|
|
11651
|
+
"privacy": "public",
|
|
11652
|
+
"type": {
|
|
11653
|
+
"text": "'none' | 'grid' | 'blueprint' | 'columns' | 'ruled'"
|
|
11654
|
+
},
|
|
11655
|
+
"description": "Fine lines drawn across the band: a square grid, a closer blueprint grid,\nupright columns or ruled lines. They are decoration, drawn in the band's\nown text colour at a tenth of its strength, and are left out in a forced\ncolours mode.",
|
|
11656
|
+
"default": "'none'",
|
|
11657
|
+
"attribute": "pattern",
|
|
11658
|
+
"reflects": true
|
|
11659
|
+
},
|
|
11648
11660
|
{
|
|
11649
11661
|
"kind": "field",
|
|
11650
11662
|
"name": "label",
|
|
@@ -11717,7 +11729,7 @@
|
|
|
11717
11729
|
{
|
|
11718
11730
|
"name": "tone",
|
|
11719
11731
|
"type": {
|
|
11720
|
-
"text": "'none' | 'subtle' | 'inset' | 'brand' | 'card'"
|
|
11732
|
+
"text": "'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent'"
|
|
11721
11733
|
},
|
|
11722
11734
|
"description": "The band's background. Text on it takes the matching colour, so it stays readable.",
|
|
11723
11735
|
"default": "'none'",
|
|
@@ -11750,6 +11762,15 @@
|
|
|
11750
11762
|
"default": "true",
|
|
11751
11763
|
"fieldName": "bleed"
|
|
11752
11764
|
},
|
|
11765
|
+
{
|
|
11766
|
+
"name": "pattern",
|
|
11767
|
+
"type": {
|
|
11768
|
+
"text": "'none' | 'grid' | 'blueprint' | 'columns' | 'ruled'"
|
|
11769
|
+
},
|
|
11770
|
+
"description": "Fine lines drawn across the band: a square grid, a closer blueprint grid,\nupright columns or ruled lines. They are decoration, drawn in the band's\nown text colour at a tenth of its strength, and are left out in a forced\ncolours mode.",
|
|
11771
|
+
"default": "'none'",
|
|
11772
|
+
"fieldName": "pattern"
|
|
11773
|
+
},
|
|
11753
11774
|
{
|
|
11754
11775
|
"name": "label",
|
|
11755
11776
|
"type": {
|
|
@@ -18,7 +18,9 @@ function where(href) {
|
|
|
18
18
|
if (typeof location === "undefined" || !href || href.startsWith("#")) return null;
|
|
19
19
|
let path;
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
const url = new URL(href, location.href);
|
|
22
|
+
if (url.origin !== location.origin) return null;
|
|
23
|
+
path = url.pathname.replace(/\/$/, "") || "/";
|
|
22
24
|
} catch {
|
|
23
25
|
return null;
|
|
24
26
|
}
|
|
@@ -183,4 +185,4 @@ export {
|
|
|
183
185
|
ImpaktNav,
|
|
184
186
|
ImpaktBreadcrumbs
|
|
185
187
|
};
|
|
186
|
-
//# sourceMappingURL=chunk-
|
|
188
|
+
//# sourceMappingURL=chunk-FAE6TGGT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/navigation.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { 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 };\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 /** 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 }\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 `,\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 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')) {\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 render(): TemplateResult {\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 = 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 };\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 }\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 .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;AAaxD,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,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,CAAC;AAAA,2DAC3D,MAAM,CAAC,CAAC;AAAA,8GAC2C,EAAE,SAAS,oCAAoC,EAAE,SAAS,8CAA8C,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,iBACzN,EAAE,IAAI,8EAA8E,EAAE,QAAQ;AAAA,uBACxF,EAAE,SAAS;AAAA,8BACJ,EAAE,SAAS;AAAA,iBACxB,cAAc;AAAA;AAAA,IAE7B;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,QAAQ,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":[]}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
space,
|
|
9
9
|
t,
|
|
10
10
|
targetSize,
|
|
11
|
+
token,
|
|
11
12
|
touchTarget,
|
|
12
13
|
type,
|
|
13
14
|
visuallyHidden
|
|
@@ -169,6 +170,18 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
169
170
|
background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 12%);
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
/* 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. */
|
|
174
|
+
.accent {
|
|
175
|
+
background: ${token("color.accent.default", "#ffd43b")};
|
|
176
|
+
color: ${token("color.accent.on", "#1a1a1a")};
|
|
177
|
+
}
|
|
178
|
+
.accent:hover:not([aria-disabled='true']) {
|
|
179
|
+
background: ${token("color.accent.hover", "#e0bb34")};
|
|
180
|
+
}
|
|
181
|
+
.accent:active:not([aria-disabled='true']) {
|
|
182
|
+
background: color-mix(in srgb, ${token("color.accent.hover", "#e0bb34")}, ${token("color.accent.on", "#1a1a1a")} 10%);
|
|
183
|
+
}
|
|
184
|
+
|
|
172
185
|
/* Danger: the danger text colour as a fill, so white words on it keep 4.5:1. */
|
|
173
186
|
.danger {
|
|
174
187
|
background: ${t.dangerText};
|
|
@@ -266,4 +279,4 @@ customElements.define("impakt-button", ImpaktButton);
|
|
|
266
279
|
export {
|
|
267
280
|
ImpaktButton
|
|
268
281
|
};
|
|
269
|
-
//# sourceMappingURL=chunk-
|
|
282
|
+
//# sourceMappingURL=chunk-TJOYBDKS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 { fontWeight, space, t, token, type } from '../base/tokens';\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 };\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';\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 round button. 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 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(2)};\n inline-size: 100%;\n min-block-size: 40px;\n padding: ${space(2)} ${space(4)};\n font-family: inherit;\n ${type('sm')}\n font-weight: ${fontWeight('semibold')};\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)} ${space(3)}; ${type('sm')} gap: ${space(1.5)}; }\n :host([size='lg']) :is(button, a) { min-block-size: 48px; padding: ${space(3)} ${space(6)}; ${type('md')} }\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, with a hairline highlight along the top edge. */\n .primary {\n background: ${t.brand};\n color: ${t.onBrand};\n box-shadow: ${t.shadowXs}, inset 0 1px 0 0 rgb(255 255 255 / 0.12);\n }\n .primary:hover:not([aria-disabled='true']) {\n background: var(--impakt-color-action-hover, ${t.brandHover});\n color: 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: ${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.rule};\n box-shadow: ${t.shadowXs};\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 /* Dark: the text colour as a fill, the strong second choice on a light page. */\n .dark {\n background: ${t.text};\n color: ${t.surfaceCard};\n }\n .dark:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 14%);\n }\n .dark:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${t.surfaceCard} 24%);\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: ${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: a round button as tall as it is wide. */\n .icon-only {\n inline-size: 40px;\n min-inline-size: 40px;\n block-size: 40px;\n min-block-size: 40px;\n padding: 0;\n border-radius: 999px;\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: 48px; min-inline-size: 48px; block-size: 48px; min-block-size: 48px; 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;AAwCjD,IAAM,eAAN,cAA2B,cAAc;AAAA,EAsM9C,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,QAAI;AACF,WAAK,YAAY,KAAK,g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AAAA,0BACT,KAAK,OAAO,SAAS,OAAO;AAAA,sBAChC,KAAK,OAAO,SAAS,OAAO;AAAA,mBAC/B,KAAK,OAAO;AAAA;AAAA,YAEnB,KAAK;AAAA,YACL,KAAK,OAAO,6BAA6B,KAAK,SAAS,YAAY,OAAO;AAAA;AAAA;AAAA,IAGlF;AACA,UAAM,QAAQ,OAAO,QAAQ,KAAK,UAAU,CAAC,gBAAgB,KAAK,aAAa,KAAK,cAAc,SAAS,8CAA8C,QAAQ,KAAK,SAAS,CAAC,YAAY,OAAO;AACnM,QAAI,KAAK,QAAQ,CAAC,KAAK,UAAU;AAC/B,aAAO,gBAAgB,KAAK,OAAO,SAAS,KAAK,IAAI,kBAAkB,KAAK;AAAA,IAC9E;AACA,WAAO;AAAA;AAAA,gBAEK,KAAK,OAAO;AAAA;AAAA;AAAA,oBAGR,KAAK,QAAQ;AAAA,wBACT,KAAK,OAAO,SAAS,OAAO;AAAA,oBAChC,KAAK,OAAO,SAAS,OAAO;AAAA,iBAC/B,KAAK,OAAO;AAAA;AAAA,UAEnB,KAAK;AAAA,UACL,KAAK,OAAO,6BAA6B,KAAK,SAAS,YAAY,OAAO;AAAA;AAAA;AAAA,EAGlF;AACF;AAEA,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
|
|
@@ -133,6 +133,7 @@ var ImpaktSection = class extends ImpaktElement {
|
|
|
133
133
|
padding: { type: String, reflect: true },
|
|
134
134
|
width: { type: String, reflect: true },
|
|
135
135
|
bleed: { type: Boolean, reflect: true },
|
|
136
|
+
pattern: { type: String, reflect: true },
|
|
136
137
|
label: { type: String },
|
|
137
138
|
spaceAbove: { type: String, reflect: true, attribute: "space-above" },
|
|
138
139
|
spaceBelow: { type: String, reflect: true, attribute: "space-below" }
|
|
@@ -144,6 +145,7 @@ var ImpaktSection = class extends ImpaktElement {
|
|
|
144
145
|
this.padding = "lg";
|
|
145
146
|
this.width = "standard";
|
|
146
147
|
this.bleed = true;
|
|
148
|
+
this.pattern = "none";
|
|
147
149
|
this.label = "";
|
|
148
150
|
this.spaceAbove = "none";
|
|
149
151
|
this.spaceBelow = "none";
|
|
@@ -164,6 +166,17 @@ var ImpaktSection = class extends ImpaktElement {
|
|
|
164
166
|
:host([tone='inset']) .band { background: ${t.surfaceInset}; }
|
|
165
167
|
:host([tone='card']) .band { background: ${t.surfaceCard}; }
|
|
166
168
|
:host([tone='brand']) .band { background: ${t.brand}; 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}; --impakt-color-text-link-hover: ${t.onBrand}; }
|
|
169
|
+
/* Ink and accent bands take their colours from the host, because the band repaints the text colour for what is inside it. */
|
|
170
|
+
:host([tone='ink']) { --impakt-band: ${t.text}; --impakt-band-on: ${t.surfaceCard}; --impakt-band-muted: color-mix(in srgb, ${t.surfaceCard} 78%, ${t.text}); --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }
|
|
171
|
+
:host([tone='accent']) { --impakt-band: ${token("color.accent.default", "#ffd43b")}; --impakt-band-on: ${token("color.accent.on", "#1a1a1a")}; --impakt-band-muted: ${token("color.accent.on", "#1a1a1a")}; --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }
|
|
172
|
+
:host(:is([tone='ink'], [tone='accent'])) .band { background-color: var(--impakt-band); color: var(--impakt-band-on); --impakt-eyebrow: var(--impakt-band-muted); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band-on) 10%, transparent); --impakt-color-text-heading: var(--impakt-band-on); --impakt-color-text-default: var(--impakt-band-on); --impakt-color-text-muted: var(--impakt-band-muted); --impakt-color-text-link: var(--impakt-band-on); --impakt-color-text-link-hover: var(--impakt-band-on); }
|
|
173
|
+
/* The lines are a tenth of the band's own text colour, so they suit any tone. They carry no meaning. */
|
|
174
|
+
:host([pattern]:not([pattern='none'])) .band { --impakt-pattern-line: color-mix(in srgb, currentColor 10%, transparent); }
|
|
175
|
+
:host(:is([pattern='grid'], [pattern='blueprint'])) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px), linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 7rem 7rem; }
|
|
176
|
+
:host([pattern='blueprint']) .band { background-size: 1.75rem 1.75rem; }
|
|
177
|
+
:host([pattern='columns']) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 5.625rem 100%; }
|
|
178
|
+
:host([pattern='ruled']) .band { background-image: linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 100% 2.5rem; }
|
|
179
|
+
@media (forced-colors: active) { .band { background-image: none !important; } }
|
|
167
180
|
:host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }
|
|
168
181
|
:host([padding='sm']) .band { padding-block: ${space(4)}; }
|
|
169
182
|
:host([padding='md']) .band { padding-block: ${space(8)}; }
|
|
@@ -185,4 +198,4 @@ export {
|
|
|
185
198
|
ImpaktPage,
|
|
186
199
|
ImpaktSection
|
|
187
200
|
};
|
|
188
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-WRYV6QGA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/page.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { space, spaceAround, t, token } from '../base/tokens';\n\n/** The widest a line of content runs, for each choice of `width`. */\nconst widths = css`\n :host { --impakt-page-inner: ${token('layout.page-width', '1200px')}; }\n :host([width='narrow']) { --impakt-page-inner: 760px; }\n :host([width='wide']) { --impakt-page-inner: 1440px; }\n`;\n\n/**\n * The side margins, from the brand's layout: narrow on a phone, wider on a\n * tablet and a desktop. Measured against the page itself, so a page drawn in a\n * narrow preview gets phone margins whatever the window is.\n */\nconst margins = css`\n :host { --impakt-page-margin: ${token('layout.margin.phone', '16px')}; }\n @container impakt-page (min-width: 40rem) { .frame { --impakt-page-margin: ${token('layout.margin.tablet', '32px')}; } }\n @container impakt-page (min-width: 64rem) { .frame { --impakt-page-margin: ${token('layout.margin.desktop', '64px')}; } }\n`;\n\n/**\n * The frame every page sits in: a header, the page's own content, and a\n * footer, each kept to the brand's page width with the brand's side margins.\n *\n * A layout puts this at its root, with the site's header and footer in their\n * slots and the page content in the middle, so an app draws the same frame the\n * CMS shows. Without it, a page runs edge to edge.\n *\n * **It gives the page its landmarks.** The header, main content and footer are\n * `header`, `main` and `footer` elements, so a screen reader can jump between\n * them (1.3.1), and the first thing in the page is a \"Skip to content\" link\n * that appears when it has focus (2.4.1).\n *\n * @category layout\n * @icon layout\n * @slot header - The site's header: its logo, navigation and a call to action.\n * @slot - The page's own content.\n * @slot footer - The site's footer.\n */\nexport class ImpaktPage extends ImpaktElement {\n static properties = {\n width: { type: String, reflect: true },\n stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },\n skipText: { type: String, attribute: 'skip-text' },\n };\n /** How wide the content runs. Standard is the brand's page width. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Keep the header at the top of the screen while the page scrolls. */\n declare stickyHeader: boolean;\n /** The words of the link that skips past the header to the content. */\n declare skipText: string;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n widths,\n margins,\n css`\n :host { display: block; container: impakt-page / inline-size; }\n .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }\n .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impakt-page-inner) + 2 * var(--impakt-page-margin)); margin-inline: auto; padding-inline: var(--impakt-page-margin); }\n header { background: ${token('color.surface.header', 'transparent')}; color: ${token('color.text.on-header', 'inherit')}; padding-block: ${space(4)}; }\n /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */\n header { --impakt-color-text-default: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-header', 'inherit')}; }\n footer { --impakt-color-text-default: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-muted: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-footer', 'inherit')}; }\n :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }\n main { flex: 1; padding-block: ${space(6)} ${space(10)}; }\n main:focus { outline: none; }\n /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */\n :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impakt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }\n :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impakt-page-margin)); max-inline-size: var(--impakt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token('color.surface.header', '#fff')}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }\n :host([floating]) main { padding-block-start: 0; }\n footer { background: ${token('color.surface.footer', 'transparent')}; color: ${token('color.text.on-footer', 'inherit')}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token('color.border.subtle', 'transparent')}; }\n .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n .empty { display: none; }\n `,\n ];\n\n private hasSlot(name: string): boolean {\n return Array.from(this.children).some((c) => c.getAttribute('slot') === name);\n }\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n // The header and footer are left out when nothing is in them, so a page\n // with no site header has no empty landmark for a screen reader to land on.\n const header = this.hasSlot('header');\n const footer = this.hasSlot('footer');\n return html`<div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n ${header ? html`<header part=\"header\"><div class=\"inner\"><slot name=\"header\"></slot></div></header>` : nothing}\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><div class=\"inner\"><slot></slot></div></main>\n ${footer ? html`<footer part=\"footer\"><div class=\"inner\"><slot name=\"footer\"></slot></div></footer>` : nothing}\n </div>`;\n }\n\n /**\n * The header floats when the page opens on a full-picture hero, sitting on the\n * picture itself, so nothing has to be set for it. It stays an ordinary bar\n * while editing, where the blocks are kept inside the page's box.\n */\n private place = (): void => {\n const hero = this.querySelector('impakt-hero[treatment=\"cover\"]');\n const editing = getComputedStyle(this).getPropertyValue('--impakt-bleed').trim() === '0';\n const floats = !!hero && !editing && this.opensOn(hero);\n this.toggleAttribute('floating', floats);\n if (!floats) return;\n const frame = this.renderRoot.querySelector('.frame');\n if (frame) this.style.setProperty('--impakt-header-top', `${Math.round(hero!.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);\n };\n\n /** Whether nothing a reader would notice comes before this block, other than an announcement. */\n private opensOn(hero: Element): boolean {\n for (const element of Array.from(this.querySelectorAll('*'))) {\n if (element === hero) return true;\n if (element.closest('[slot=\"header\"],[slot=\"footer\"]')) continue;\n if (element.tagName.startsWith('IMPAKT-') && !/^IMPAKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;\n }\n return false;\n }\n\n // A header or footer added after the first render still gets its landmark.\n connectedCallback(): void {\n super.connectedCallback();\n this.observer = new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ['slot'] });\n this.watcher = new MutationObserver(this.place);\n this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['treatment'] });\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(this.place);\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.watcher?.disconnect();\n this.resize?.disconnect();\n }\n\n protected firstUpdated(): void {\n this.place();\n }\n\n private observer?: MutationObserver;\n private watcher?: MutationObserver;\n private resize?: ResizeObserver;\n}\n\n/**\n * A band across the whole width of the page, with its own background, and its\n * content kept to the page width inside it: a coloured strip of features, a\n * quote on a tinted background, a call to action at the foot of a page.\n *\n * Inside a Page it reaches the edges of the screen whatever the page width is,\n * so a page can alternate bands without any of them knowing the frame. Set\n * `bleed` off to keep the band to the page width, as a panel.\n *\n * @category layout\n * @icon section\n * @slot - The section's content.\n */\nexport class ImpaktSection extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n width: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n pattern: { type: String, reflect: true },\n label: { type: String },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /** The band's background. Text on it takes the matching colour, so it stays readable. */\n declare tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent';\n /** Space inside the band, above and below its content. */\n declare padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** How wide the content inside runs. */\n declare width: 'narrow' | 'standard' | 'wide';\n /** Run the background to the edges of the screen. */\n declare bleed: boolean;\n /**\n * Fine lines drawn across the band: a square grid, a closer blueprint grid,\n * upright columns or ruled lines. They are decoration, drawn in the band's\n * own text colour at a tenth of its strength, and are left out in a forced\n * colours mode.\n */\n declare pattern: 'none' | 'grid' | 'blueprint' | 'columns' | 'ruled';\n /** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */\n declare label: string;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'none';\n this.padding = 'lg';\n this.width = 'standard';\n this.bleed = true;\n this.pattern = 'none';\n this.label = '';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n widths,\n css`\n :host { display: block; --impakt-page-margin: inherit; }\n /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */\n :host([tone='brand']) { --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }\n /* --impakt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */\n :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impakt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impakt-bleed, 1) * (50vw - 50%))); }\n :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }\n :host([tone='inset']) .band { background: ${t.surfaceInset}; }\n :host([tone='card']) .band { background: ${t.surfaceCard}; }\n :host([tone='brand']) .band { background: ${t.brand}; 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}; --impakt-color-text-link-hover: ${t.onBrand}; }\n /* Ink and accent bands take their colours from the host, because the band repaints the text colour for what is inside it. */\n :host([tone='ink']) { --impakt-band: ${t.text}; --impakt-band-on: ${t.surfaceCard}; --impakt-band-muted: color-mix(in srgb, ${t.surfaceCard} 78%, ${t.text}); --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host([tone='accent']) { --impakt-band: ${token('color.accent.default', '#ffd43b')}; --impakt-band-on: ${token('color.accent.on', '#1a1a1a')}; --impakt-band-muted: ${token('color.accent.on', '#1a1a1a')}; --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host(:is([tone='ink'], [tone='accent'])) .band { background-color: var(--impakt-band); color: var(--impakt-band-on); --impakt-eyebrow: var(--impakt-band-muted); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band-on) 10%, transparent); --impakt-color-text-heading: var(--impakt-band-on); --impakt-color-text-default: var(--impakt-band-on); --impakt-color-text-muted: var(--impakt-band-muted); --impakt-color-text-link: var(--impakt-band-on); --impakt-color-text-link-hover: var(--impakt-band-on); }\n /* The lines are a tenth of the band's own text colour, so they suit any tone. They carry no meaning. */\n :host([pattern]:not([pattern='none'])) .band { --impakt-pattern-line: color-mix(in srgb, currentColor 10%, transparent); }\n :host(:is([pattern='grid'], [pattern='blueprint'])) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px), linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 7rem 7rem; }\n :host([pattern='blueprint']) .band { background-size: 1.75rem 1.75rem; }\n :host([pattern='columns']) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 5.625rem 100%; }\n :host([pattern='ruled']) .band { background-image: linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 100% 2.5rem; }\n @media (forced-colors: active) { .band { background-image: none !important; } }\n :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }\n :host([padding='sm']) .band { padding-block: ${space(4)}; }\n :host([padding='md']) .band { padding-block: ${space(8)}; }\n :host([padding='lg']) .band { padding-block: ${space(12)}; }\n :host([padding='xl']) .band { padding-block: ${space(16)}; }\n :host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }\n .content { max-inline-size: var(--impakt-page-inner); margin-inline: auto; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<section class=\"band\" part=\"band\" aria-label=${this.label || nothing} role=${this.label ? nothing : 'presentation'}><div class=\"content\" part=\"content\"><slot></slot></div></section>`;\n }\n}\n\ncustomElements.define('impakt-page', ImpaktPage);\ncustomElements.define('impakt-section', ImpaktSection);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-page': ImpaktPage;\n 'impakt-section': ImpaktSection;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAMxD,IAAM,SAAS;AAAA,iCACkB,MAAM,qBAAqB,QAAQ,CAAC;AAAA;AAAA;AAAA;AAUrE,IAAM,UAAU;AAAA,kCACkB,MAAM,uBAAuB,MAAM,CAAC;AAAA,+EACS,MAAM,wBAAwB,MAAM,CAAC;AAAA,+EACrC,MAAM,yBAAyB,MAAM,CAAC;AAAA;AAsB9G,IAAM,aAAN,cAAyB,cAAc;AAAA,EAa5C,cAAc;AACZ,UAAM;AA+DR;AAAA;AAAA;AAAA;AAAA;AAAA,SAAQ,QAAQ,MAAY;AAC1B,YAAM,OAAO,KAAK,cAAc,gCAAgC;AAChE,YAAM,UAAU,iBAAiB,IAAI,EAAE,iBAAiB,gBAAgB,EAAE,KAAK,MAAM;AACrF,YAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,IAAI;AACtD,WAAK,gBAA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ACT,MAAM,EAAE,CAAC;AAAA,0DACF,MAAM,EAAE,CAAC,UAAU,MAAM,EAAE,CAAC;AAAA;AAAA;AAAA,IAGpF;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO,oDAAoD,KAAK,SAAS,OAAO,SAAS,KAAK,QAAQ,UAAU,cAAc;AAAA,EAChI;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;AAC/C,eAAe,OAAO,kBAAkB,aAAa;","names":[]}
|
|
@@ -96,10 +96,11 @@ export declare class ImpaktButton extends ImpaktElement {
|
|
|
96
96
|
hideOn: 'never' | 'phone';
|
|
97
97
|
/**
|
|
98
98
|
* How much the button asks for attention. `dark` is the strong second
|
|
99
|
-
* choice on a light page, `subtle` a quiet filled one,
|
|
100
|
-
* action that removes or cancels something
|
|
99
|
+
* choice on a light page, `subtle` a quiet filled one, `danger` an
|
|
100
|
+
* action that removes or cancels something, and `accent` the brand's
|
|
101
|
+
* second colour, for the one action a page is built around.
|
|
101
102
|
*/
|
|
102
|
-
variant: 'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger';
|
|
103
|
+
variant: 'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger' | 'accent';
|
|
103
104
|
type: 'button' | 'submit' | 'reset';
|
|
104
105
|
disabled: boolean;
|
|
105
106
|
busy: boolean;
|
|
@@ -92,6 +92,10 @@ export declare class ImpaktSection extends ImpaktElement {
|
|
|
92
92
|
type: BooleanConstructor;
|
|
93
93
|
reflect: boolean;
|
|
94
94
|
};
|
|
95
|
+
pattern: {
|
|
96
|
+
type: StringConstructor;
|
|
97
|
+
reflect: boolean;
|
|
98
|
+
};
|
|
95
99
|
label: {
|
|
96
100
|
type: StringConstructor;
|
|
97
101
|
};
|
|
@@ -107,13 +111,20 @@ export declare class ImpaktSection extends ImpaktElement {
|
|
|
107
111
|
};
|
|
108
112
|
};
|
|
109
113
|
/** The band's background. Text on it takes the matching colour, so it stays readable. */
|
|
110
|
-
tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card';
|
|
114
|
+
tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent';
|
|
111
115
|
/** Space inside the band, above and below its content. */
|
|
112
116
|
padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
113
117
|
/** How wide the content inside runs. */
|
|
114
118
|
width: 'narrow' | 'standard' | 'wide';
|
|
115
119
|
/** Run the background to the edges of the screen. */
|
|
116
120
|
bleed: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Fine lines drawn across the band: a square grid, a closer blueprint grid,
|
|
123
|
+
* upright columns or ruled lines. They are decoration, drawn in the band's
|
|
124
|
+
* own text colour at a tenth of its strength, and are left out in a forced
|
|
125
|
+
* colours mode.
|
|
126
|
+
*/
|
|
127
|
+
pattern: 'none' | 'grid' | 'blueprint' | 'columns' | 'ruled';
|
|
117
128
|
/** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */
|
|
118
129
|
label: string;
|
|
119
130
|
spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
package/dist/components/page.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -58,11 +58,11 @@ import {
|
|
|
58
58
|
import {
|
|
59
59
|
ImpaktBreadcrumbs,
|
|
60
60
|
ImpaktNav
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-FAE6TGGT.js";
|
|
62
62
|
import {
|
|
63
63
|
ImpaktPage,
|
|
64
64
|
ImpaktSection
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-WRYV6QGA.js";
|
|
66
66
|
import {
|
|
67
67
|
ImpaktPrice
|
|
68
68
|
} from "./chunk-7C56LPNJ.js";
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
} from "./chunk-JNLKM3JT.js";
|
|
132
132
|
import {
|
|
133
133
|
ImpaktButton
|
|
134
|
-
} from "./chunk-
|
|
134
|
+
} from "./chunk-TJOYBDKS.js";
|
|
135
135
|
import {
|
|
136
136
|
ICONS,
|
|
137
137
|
ICON_NAMES,
|