@atomic-ui/ui 0.9.0 → 0.10.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/README.md +1 -1
- package/custom-elements.json +90 -3
- package/dist/base/server.d.ts +8 -0
- package/dist/{chunk-TE3CBEJQ.js → chunk-2D2IMQII.js} +2 -2
- package/dist/chunk-6WVL3HOC.js +7 -0
- package/dist/chunk-6WVL3HOC.js.map +1 -0
- package/dist/{chunk-WRYV6QGA.js → chunk-D6NET2VB.js} +15 -2
- package/dist/chunk-D6NET2VB.js.map +1 -0
- package/dist/{chunk-KAQJVGYW.js → chunk-DN5YZFSG.js} +2 -2
- package/dist/{chunk-D3JWVMJE.js → chunk-FKUBEVCU.js} +2 -2
- package/dist/{chunk-7C56LPNJ.js → chunk-L4CIBOGK.js} +2 -2
- package/dist/{chunk-FAE6TGGT.js → chunk-OJO62KRX.js} +5 -1
- package/dist/chunk-OJO62KRX.js.map +1 -0
- package/dist/{chunk-EGJZDKMW.js → chunk-QU3U2CS2.js} +27 -5
- package/dist/chunk-QU3U2CS2.js.map +1 -0
- package/dist/{chunk-AVDSYLOY.js → chunk-UFPI4I2Y.js} +3 -2
- package/dist/{chunk-AVDSYLOY.js.map → chunk-UFPI4I2Y.js.map} +1 -1
- package/dist/{chunk-3IGNZTJU.js → chunk-UNGAG44M.js} +2 -2
- package/dist/{chunk-3IGNZTJU.js.map → chunk-UNGAG44M.js.map} +1 -1
- package/dist/{chunk-P6HG5RB2.js → chunk-ZEIV5X3U.js} +3 -3
- package/dist/chunk-ZEIV5X3U.js.map +1 -0
- package/dist/components/accordion.d.ts +13 -0
- package/dist/components/accordion.js +2 -1
- package/dist/components/app-ui.js +2 -2
- package/dist/components/journey.js +2 -2
- package/dist/components/navigation.js +1 -1
- package/dist/components/page.d.ts +21 -0
- package/dist/components/page.js +2 -1
- package/dist/components/price.js +2 -2
- package/dist/components/rows.js +2 -2
- package/dist/components/table.js +2 -2
- package/dist/components/textarea.js +1 -1
- package/dist/index.js +11 -10
- package/dist/standalone/atomic-ui.js +444 -402
- package/dist/standalone/atomic-ui.js.map +4 -4
- package/package.json +7 -6
- package/dist/chunk-EGJZDKMW.js.map +0 -1
- package/dist/chunk-FAE6TGGT.js.map +0 -1
- package/dist/chunk-P6HG5RB2.js.map +0 -1
- package/dist/chunk-WRYV6QGA.js.map +0 -1
- /package/dist/{chunk-TE3CBEJQ.js.map → chunk-2D2IMQII.js.map} +0 -0
- /package/dist/{chunk-KAQJVGYW.js.map → chunk-DN5YZFSG.js.map} +0 -0
- /package/dist/{chunk-D3JWVMJE.js.map → chunk-FKUBEVCU.js.map} +0 -0
- /package/dist/{chunk-7C56LPNJ.js.map → chunk-L4CIBOGK.js.map} +0 -0
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ Stated plainly, because a component library that looks finished is how gaps ship
|
|
|
138
138
|
|
|
139
139
|
- **No manual audit.** Automated checking catches perhaps a third of real issues and judges none of them: whether alt text is useful, whether an error message makes sense, whether the reading order tells a story. A screen-reader pass happens before any brand launches, and nothing here substitutes for it.
|
|
140
140
|
- **One browser.** The browser suite runs Chromium. Firefox and WebKit differ most in exactly the places this library leans on the platform, such as `showModal`, `:focus-visible` and forced colours, so they are worth adding before launch.
|
|
141
|
-
- **Server rendering is
|
|
141
|
+
- **Server rendering is tested for drawing, not for every interaction.** Every element draws with Lit's server renderer, and `atomic-ui.js` carries Lit's hydration support, so the script takes over a server-drawn page without drawing it twice. A browser suite in `@atomic-ui/blocks` checks one whole page with and without script. Elements that measure themselves, such as `impakt-nav`, settle once the script runs, and the React, Vue and Angular bindings have not been tried on a server.
|
|
142
142
|
- **Composition-level criteria are deliberately elsewhere.** Consistent help (3.2.6), redundant entry (3.3.7) and heading order across a page are properties of a page or a journey, not of a component, and they are checked in Strata at publish ([ADR 0009](https://github.com/matthill8286/strata/blob/main/docs/decisions/0009-wcag-is-an-authoring-gate.md)). The browser suite found a heading-order failure in its own gallery, which is a fair illustration: every component was correct and the page was still wrong.
|
|
143
143
|
|
|
144
144
|
The Grid component supplies one to four columns or either sidebar arrangement. Each column has a named slot. It stacks below 40rem of available container width, preserving column order. The designer offers these as draggable layout presets and prevents removing an occupied column.
|
package/custom-elements.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"declarations": [
|
|
9
9
|
{
|
|
10
10
|
"kind": "class",
|
|
11
|
-
"description": "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\nscreen-reader user jump between sections without tabbing through every\nparagraph; the button is what makes the section openable. One without the\nother is a common half-implementation: all-headings cannot be operated,\nall-buttons cannot be navigated.\n\n`headingLevel` is a property because the right level depends on what is\nabove the accordion on the page, and guessing produces exactly the skipped\nlevels that 1.3.1 is about.\n\n**Panels are hidden, not unmounted.** `hidden` keeps the content in the\naccessibility tree's structure and lets in-page search find it when opened,\nand 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\ncomposition can author safely. Content rendered elsewhere, such as an FAQ\nanswer 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\npanel, so the region, its label and its `hidden` state are unchanged, and a\npanel with nothing slotted still shows its body.",
|
|
11
|
+
"description": "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\nscreen-reader user jump between sections without tabbing through every\nparagraph; the button is what makes the section openable. One without the\nother is a common half-implementation: all-headings cannot be operated,\nall-buttons cannot be navigated.\n\n`headingLevel` is a property because the right level depends on what is\nabove the accordion on the page, and guessing produces exactly the skipped\nlevels that 1.3.1 is about.\n\n**Panels are hidden, not unmounted.** `hidden` keeps the content in the\naccessibility tree's structure and lets in-page search find it when opened,\nand 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\ncomposition can author safely. Content rendered elsewhere, such as an FAQ\nanswer 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\npanel, so the region, its label and its `hidden` state are unchanged, and a\npanel with nothing slotted still shows its body.\n\n**Without script every panel is open.** A page built to finished HTML may load\nno script at all, and a closed panel there could never be opened. So an\naccordion drawn on the server has every panel open and its markers hidden: the\nquestions and answers read as a plain list. When the script loads it closes\nthe panels that `open` does not name, and the buttons work.",
|
|
12
12
|
"name": "ImpaktAccordion",
|
|
13
13
|
"members": [
|
|
14
14
|
{
|
|
@@ -53,6 +53,17 @@
|
|
|
53
53
|
"default": "true",
|
|
54
54
|
"attribute": "multiple"
|
|
55
55
|
},
|
|
56
|
+
{
|
|
57
|
+
"kind": "field",
|
|
58
|
+
"name": "enhanced",
|
|
59
|
+
"privacy": "private",
|
|
60
|
+
"type": {
|
|
61
|
+
"text": "boolean"
|
|
62
|
+
},
|
|
63
|
+
"description": "Whether the script is running here, so the panels can be closed and opened.",
|
|
64
|
+
"default": "false",
|
|
65
|
+
"attribute": "enhanced"
|
|
66
|
+
},
|
|
56
67
|
{
|
|
57
68
|
"kind": "method",
|
|
58
69
|
"name": "toggle",
|
|
@@ -140,6 +151,15 @@
|
|
|
140
151
|
"description": "When false, opening one closes the others.",
|
|
141
152
|
"default": "true",
|
|
142
153
|
"fieldName": "multiple"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "enhanced",
|
|
157
|
+
"type": {
|
|
158
|
+
"text": "boolean"
|
|
159
|
+
},
|
|
160
|
+
"description": "Whether the script is running here, so the panels can be closed and opened.",
|
|
161
|
+
"default": "false",
|
|
162
|
+
"fieldName": "enhanced"
|
|
143
163
|
}
|
|
144
164
|
],
|
|
145
165
|
"superclass": {
|
|
@@ -11428,6 +11448,30 @@
|
|
|
11428
11448
|
"default": "'Skip to content'",
|
|
11429
11449
|
"attribute": "skip-text"
|
|
11430
11450
|
},
|
|
11451
|
+
{
|
|
11452
|
+
"kind": "field",
|
|
11453
|
+
"name": "noHeader",
|
|
11454
|
+
"privacy": "public",
|
|
11455
|
+
"type": {
|
|
11456
|
+
"text": "boolean"
|
|
11457
|
+
},
|
|
11458
|
+
"description": "Leave the header landmark out. In a browser the page sees for itself whether a header was\ngiven, so this is only for a page drawn on the server, where it cannot.",
|
|
11459
|
+
"default": "false",
|
|
11460
|
+
"attribute": "no-header",
|
|
11461
|
+
"reflects": true
|
|
11462
|
+
},
|
|
11463
|
+
{
|
|
11464
|
+
"kind": "field",
|
|
11465
|
+
"name": "noFooter",
|
|
11466
|
+
"privacy": "public",
|
|
11467
|
+
"type": {
|
|
11468
|
+
"text": "boolean"
|
|
11469
|
+
},
|
|
11470
|
+
"description": "Leave the footer landmark out, for a page drawn on the server with no footer.",
|
|
11471
|
+
"default": "false",
|
|
11472
|
+
"attribute": "no-footer",
|
|
11473
|
+
"reflects": true
|
|
11474
|
+
},
|
|
11431
11475
|
{
|
|
11432
11476
|
"kind": "method",
|
|
11433
11477
|
"name": "hasSlot",
|
|
@@ -11441,10 +11485,11 @@
|
|
|
11441
11485
|
{
|
|
11442
11486
|
"name": "name",
|
|
11443
11487
|
"type": {
|
|
11444
|
-
"text": "
|
|
11488
|
+
"text": "'header' | 'footer'"
|
|
11445
11489
|
}
|
|
11446
11490
|
}
|
|
11447
|
-
]
|
|
11491
|
+
],
|
|
11492
|
+
"description": "Whether something was given for a slot. An element drawn on the server cannot see its own\nchildren, so there the landmark is drawn unless `no-header` or `no-footer` says to leave it out."
|
|
11448
11493
|
},
|
|
11449
11494
|
{
|
|
11450
11495
|
"kind": "method",
|
|
@@ -11575,6 +11620,24 @@
|
|
|
11575
11620
|
"description": "The words of the link that skips past the header to the content.",
|
|
11576
11621
|
"default": "'Skip to content'",
|
|
11577
11622
|
"fieldName": "skipText"
|
|
11623
|
+
},
|
|
11624
|
+
{
|
|
11625
|
+
"name": "no-header",
|
|
11626
|
+
"type": {
|
|
11627
|
+
"text": "boolean"
|
|
11628
|
+
},
|
|
11629
|
+
"description": "Leave the header landmark out. In a browser the page sees for itself whether a header was\ngiven, so this is only for a page drawn on the server, where it cannot.",
|
|
11630
|
+
"default": "false",
|
|
11631
|
+
"fieldName": "noHeader"
|
|
11632
|
+
},
|
|
11633
|
+
{
|
|
11634
|
+
"name": "no-footer",
|
|
11635
|
+
"type": {
|
|
11636
|
+
"text": "boolean"
|
|
11637
|
+
},
|
|
11638
|
+
"description": "Leave the footer landmark out, for a page drawn on the server with no footer.",
|
|
11639
|
+
"default": "false",
|
|
11640
|
+
"fieldName": "noFooter"
|
|
11578
11641
|
}
|
|
11579
11642
|
],
|
|
11580
11643
|
"superclass": {
|
|
@@ -17912,6 +17975,30 @@
|
|
|
17912
17975
|
}
|
|
17913
17976
|
]
|
|
17914
17977
|
},
|
|
17978
|
+
{
|
|
17979
|
+
"kind": "javascript-module",
|
|
17980
|
+
"path": "src/base/server.ts",
|
|
17981
|
+
"declarations": [
|
|
17982
|
+
{
|
|
17983
|
+
"kind": "variable",
|
|
17984
|
+
"name": "onServer",
|
|
17985
|
+
"type": {
|
|
17986
|
+
"text": "boolean"
|
|
17987
|
+
},
|
|
17988
|
+
"description": "Whether this is a server drawing the page to HTML, where there is no document to read.\n\nLit's own `isServer` follows the \"node\" export condition, so it is also true in a test runner\nthat gives the tests a document. This asks the question the elements need answered: can an\nelement see its own children here? Lit's server renderer gives elements no `children`."
|
|
17989
|
+
}
|
|
17990
|
+
],
|
|
17991
|
+
"exports": [
|
|
17992
|
+
{
|
|
17993
|
+
"kind": "js",
|
|
17994
|
+
"name": "onServer",
|
|
17995
|
+
"declaration": {
|
|
17996
|
+
"name": "onServer",
|
|
17997
|
+
"module": "src/base/server.ts"
|
|
17998
|
+
}
|
|
17999
|
+
}
|
|
18000
|
+
]
|
|
18001
|
+
},
|
|
17915
18002
|
{
|
|
17916
18003
|
"kind": "javascript-module",
|
|
17917
18004
|
"path": "src/base/styles.ts",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this is a server drawing the page to HTML, where there is no document to read.
|
|
3
|
+
*
|
|
4
|
+
* Lit's own `isServer` follows the "node" export condition, so it is also true in a test runner
|
|
5
|
+
* that gives the tests a document. This asks the question the elements need answered: can an
|
|
6
|
+
* element see its own children here? Lit's server renderer gives elements no `children`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const onServer: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pageLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UNGAG44M.js";
|
|
4
4
|
import {
|
|
5
5
|
iconSvg
|
|
6
6
|
} from "./chunk-AL4IUSML.js";
|
|
@@ -282,4 +282,4 @@ export {
|
|
|
282
282
|
ImpaktRow,
|
|
283
283
|
ImpaktFilterChip
|
|
284
284
|
};
|
|
285
|
-
//# sourceMappingURL=chunk-
|
|
285
|
+
//# sourceMappingURL=chunk-2D2IMQII.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base/server.ts"],"sourcesContent":["/**\n * Whether this is a server drawing the page to HTML, where there is no document to read.\n *\n * Lit's own `isServer` follows the \"node\" export condition, so it is also true in a test runner\n * that gives the tests a document. This asks the question the elements need answered: can an\n * element see its own children here? Lit's server renderer gives elements no `children`.\n */\nexport const onServer: boolean = typeof HTMLElement === 'undefined' || !('children' in HTMLElement.prototype);\n"],"mappings":";AAOO,IAAM,WAAoB,OAAO,gBAAgB,eAAe,EAAE,cAAc,YAAY;","names":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
onServer
|
|
3
|
+
} from "./chunk-6WVL3HOC.js";
|
|
1
4
|
import {
|
|
2
5
|
ImpaktElement,
|
|
3
6
|
focusRing,
|
|
@@ -39,12 +42,16 @@ var ImpaktPage = class extends ImpaktElement {
|
|
|
39
42
|
this.width = "standard";
|
|
40
43
|
this.stickyHeader = false;
|
|
41
44
|
this.skipText = "Skip to content";
|
|
45
|
+
this.noHeader = false;
|
|
46
|
+
this.noFooter = false;
|
|
42
47
|
}
|
|
43
48
|
static {
|
|
44
49
|
this.properties = {
|
|
45
50
|
width: { type: String, reflect: true },
|
|
46
51
|
stickyHeader: { type: Boolean, reflect: true, attribute: "sticky-header" },
|
|
47
|
-
skipText: { type: String, attribute: "skip-text" }
|
|
52
|
+
skipText: { type: String, attribute: "skip-text" },
|
|
53
|
+
noHeader: { type: Boolean, reflect: true, attribute: "no-header" },
|
|
54
|
+
noFooter: { type: Boolean, reflect: true, attribute: "no-footer" }
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
57
|
static {
|
|
@@ -76,7 +83,13 @@ var ImpaktPage = class extends ImpaktElement {
|
|
|
76
83
|
`
|
|
77
84
|
];
|
|
78
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether something was given for a slot. An element drawn on the server cannot see its own
|
|
88
|
+
* children, so there the landmark is drawn unless `no-header` or `no-footer` says to leave it out.
|
|
89
|
+
*/
|
|
79
90
|
hasSlot(name) {
|
|
91
|
+
if (name === "header" ? this.noHeader : this.noFooter) return false;
|
|
92
|
+
if (onServer) return true;
|
|
80
93
|
return Array.from(this.children).some((c) => c.getAttribute("slot") === name);
|
|
81
94
|
}
|
|
82
95
|
skip(event) {
|
|
@@ -198,4 +211,4 @@ export {
|
|
|
198
211
|
ImpaktPage,
|
|
199
212
|
ImpaktSection
|
|
200
213
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
214
|
+
//# sourceMappingURL=chunk-D6NET2VB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/page.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { onServer } from '../base/server';\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 noHeader: { type: Boolean, reflect: true, attribute: 'no-header' },\n noFooter: { type: Boolean, reflect: true, attribute: 'no-footer' },\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 * Leave the header landmark out. In a browser the page sees for itself whether a header was\n * given, so this is only for a page drawn on the server, where it cannot.\n */\n declare noHeader: boolean;\n /** Leave the footer landmark out, for a page drawn on the server with no footer. */\n declare noFooter: boolean;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n this.noHeader = false;\n this.noFooter = false;\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 /**\n * Whether something was given for a slot. An element drawn on the server cannot see its own\n * children, so there the landmark is drawn unless `no-header` or `no-footer` says to leave it out.\n */\n private hasSlot(name: 'header' | 'footer'): boolean {\n if (name === 'header' ? this.noHeader : this.noFooter) return false;\n if (onServer) return true;\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;AAOxD,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,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C,EAAE,OAAO,+BAA+B,EAAE,OAAO,qCAAqC,EAAE,OAAO;AAAA;AAAA,2CAEtW,EAAE,IAAI,uBAAuB,EAAE,WAAW,6CAA6C,EAAE,WAAW,SAAS,EAAE,IAAI,2BAA2B,EAAE,WAAW,0BAA0B,EAAE,IAAI,8DAA8D,EAAE,IAAI,4BAA4B,EAAE,SAAS;AAAA,8CACnS,MAAM,wBAAwB,SAAS,CAAC,uBAAuB,MAAM,mBAAmB,SAAS,CAAC,0BAA0B,MAAM,mBAAmB,SAAS,CAAC,0BAA0B,EAAE,WAAW,0BAA0B,EAAE,IAAI,8DAA8D,EAAE,IAAI,4BAA4B,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sEASzT,MAAM,CAAC,CAAC;AAAA,mDAC3B,MAAM,CAAC,CAAC;AAAA,mDACR,MAAM,CAAC,CAAC;AAAA,mDACR,MAAM,EAAE,CAAC;AAAA,mDACT,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":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pageLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UNGAG44M.js";
|
|
4
4
|
import {
|
|
5
5
|
iconSvg
|
|
6
6
|
} from "./chunk-AL4IUSML.js";
|
|
@@ -330,4 +330,4 @@ customElements.define("impakt-table", ImpaktTable);
|
|
|
330
330
|
export {
|
|
331
331
|
ImpaktTable
|
|
332
332
|
};
|
|
333
|
-
//# sourceMappingURL=chunk-
|
|
333
|
+
//# sourceMappingURL=chunk-DN5YZFSG.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pageLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UNGAG44M.js";
|
|
4
4
|
import {
|
|
5
5
|
FieldElement,
|
|
6
6
|
fieldWidths
|
|
@@ -555,4 +555,4 @@ export {
|
|
|
555
555
|
ImpaktRangeInput,
|
|
556
556
|
ImpaktTaskList
|
|
557
557
|
};
|
|
558
|
-
//# sourceMappingURL=chunk-
|
|
558
|
+
//# sourceMappingURL=chunk-FKUBEVCU.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pageLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UNGAG44M.js";
|
|
4
4
|
import {
|
|
5
5
|
ImpaktElement,
|
|
6
6
|
fontSize,
|
|
@@ -86,4 +86,4 @@ customElements.define("impakt-price", ImpaktPrice);
|
|
|
86
86
|
export {
|
|
87
87
|
ImpaktPrice
|
|
88
88
|
};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
89
|
+
//# sourceMappingURL=chunk-L4CIBOGK.js.map
|
|
@@ -87,10 +87,14 @@ var ImpaktNav = class extends ImpaktElement {
|
|
|
87
87
|
:host([folded]) ul.open { display: flex; }
|
|
88
88
|
:host([folded]) li { text-align: start; }
|
|
89
89
|
:host([folded]) a { display: flex; padding: ${space(3)} ${space(3)}; }
|
|
90
|
+
/* With no script the element is never defined, so it cannot measure itself and fold. The links
|
|
91
|
+
wrap onto more lines instead, so they are never cut off or drawn over what is beside them. */
|
|
92
|
+
:host(:not(:defined)) ul { flex-wrap: wrap; row-gap: 0; }
|
|
90
93
|
`
|
|
91
94
|
];
|
|
92
95
|
}
|
|
93
96
|
fit() {
|
|
97
|
+
if (!this.hasUpdated) return;
|
|
94
98
|
const room = this.getBoundingClientRect().width;
|
|
95
99
|
if (room <= 0) return;
|
|
96
100
|
if (!this.needs) {
|
|
@@ -185,4 +189,4 @@ export {
|
|
|
185
189
|
ImpaktNav,
|
|
186
190
|
ImpaktBreadcrumbs
|
|
187
191
|
};
|
|
188
|
-
//# sourceMappingURL=chunk-
|
|
192
|
+
//# sourceMappingURL=chunk-OJO62KRX.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 /* 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 ];\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 // 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')) {\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;AAA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AAM;AAAA,MACrB,OAAO,EAAE,MAAM,OAAO;AAAA,IACxB;AAAA;AAAA,EAMA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ,CAAC;AACd,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,cAAc;AAAA,MACjB;AAAA,MACA;AAAA,yCACqC,SAAS,IAAI,CAAC;AAAA,8GACuD,MAAM,CAAC,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":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
onServer
|
|
3
|
+
} from "./chunk-6WVL3HOC.js";
|
|
1
4
|
import {
|
|
2
5
|
ImpaktElement,
|
|
3
6
|
focusRing,
|
|
@@ -9,14 +12,15 @@ import {
|
|
|
9
12
|
} from "./chunk-V7EB7Q2M.js";
|
|
10
13
|
|
|
11
14
|
// packages/ui/src/components/accordion.ts
|
|
12
|
-
import { html, css
|
|
15
|
+
import { html, css } from "lit";
|
|
13
16
|
var ImpaktAccordion = class extends ImpaktElement {
|
|
14
17
|
static {
|
|
15
18
|
this.properties = {
|
|
16
19
|
items: { type: Array },
|
|
17
20
|
headingLevel: { type: Number, attribute: "heading-level" },
|
|
18
21
|
open: { type: Array },
|
|
19
|
-
multiple: { type: Boolean }
|
|
22
|
+
multiple: { type: Boolean },
|
|
23
|
+
enhanced: { state: true }
|
|
20
24
|
};
|
|
21
25
|
}
|
|
22
26
|
constructor() {
|
|
@@ -25,6 +29,14 @@ var ImpaktAccordion = class extends ImpaktElement {
|
|
|
25
29
|
this.headingLevel = 3;
|
|
26
30
|
this.open = [];
|
|
27
31
|
this.multiple = true;
|
|
32
|
+
this.enhanced = false;
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
if (!onServer && !this.shadowRoot) this.enhanced = true;
|
|
36
|
+
super.connectedCallback();
|
|
37
|
+
}
|
|
38
|
+
firstUpdated() {
|
|
39
|
+
this.enhanced = true;
|
|
28
40
|
}
|
|
29
41
|
static {
|
|
30
42
|
this.styles = [
|
|
@@ -64,6 +76,17 @@ var ImpaktAccordion = class extends ImpaktElement {
|
|
|
64
76
|
button[aria-expanded='true'] .marker {
|
|
65
77
|
transform: rotate(90deg);
|
|
66
78
|
}
|
|
79
|
+
/* With no script the element is never defined: the buttons cannot work, so they do not look as if they do. */
|
|
80
|
+
:host(:not(:defined)) button {
|
|
81
|
+
cursor: default;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
:host(:not(:defined)) button:hover {
|
|
85
|
+
color: ${t.text};
|
|
86
|
+
}
|
|
87
|
+
:host(:not(:defined)) .marker {
|
|
88
|
+
display: none;
|
|
89
|
+
}
|
|
67
90
|
.panel {
|
|
68
91
|
padding-block-end: ${space(4)};
|
|
69
92
|
font-size: ${fontSize("md")};
|
|
@@ -79,7 +102,7 @@ var ImpaktAccordion = class extends ImpaktElement {
|
|
|
79
102
|
render() {
|
|
80
103
|
return html`
|
|
81
104
|
${this.items.map((item) => {
|
|
82
|
-
const expanded = this.open.includes(item.id);
|
|
105
|
+
const expanded = !this.enhanced || this.open.includes(item.id);
|
|
83
106
|
const panelId = this.id_(`panel-${item.id}`);
|
|
84
107
|
const buttonId = this.id_(`button-${item.id}`);
|
|
85
108
|
return html`
|
|
@@ -110,7 +133,6 @@ var ImpaktAccordion = class extends ImpaktElement {
|
|
|
110
133
|
</div>
|
|
111
134
|
`;
|
|
112
135
|
})}
|
|
113
|
-
${this.items.length === 0 ? nothing : nothing}
|
|
114
136
|
`;
|
|
115
137
|
}
|
|
116
138
|
};
|
|
@@ -119,4 +141,4 @@ customElements.define("impakt-accordion", ImpaktAccordion);
|
|
|
119
141
|
export {
|
|
120
142
|
ImpaktAccordion
|
|
121
143
|
};
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
//# sourceMappingURL=chunk-QU3U2CS2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/accordion.ts"],"sourcesContent":["import { html, css, 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';\n\nexport interface AccordionItem {\n id: string;\n heading: string;\n body: string;\n}\n\n/**\n * Disclosure sections — frequently asked questions, \"what does this mean?\".\n *\n * **Each header is a button inside a heading.** The heading is what lets a\n * screen-reader user jump between sections without tabbing through every\n * paragraph; the button is what makes the section openable. One without the\n * other is a common half-implementation: all-headings cannot be operated,\n * all-buttons cannot be navigated.\n *\n * `headingLevel` is a property because the right level depends on what is\n * above the accordion on the page, and guessing produces exactly the skipped\n * levels that 1.3.1 is about.\n *\n * **Panels are hidden, not unmounted.** `hidden` keeps the content in the\n * accessibility tree's structure and lets in-page search find it when opened,\n * and it means `aria-controls` always points at an element that exists.\n *\n * **A panel can hold more than words.** `body` is plain text, which is what a\n * composition can author safely. Content rendered elsewhere, such as an FAQ\n * answer with links and a list, is slotted instead: a child with\n * `slot=\"panel-<item id>\"` replaces that item's body. The slot sits inside the\n * panel, so the region, its label and its `hidden` state are unchanged, and a\n * panel with nothing slotted still shows its body.\n *\n * **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 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 /** 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.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 css`\n :host {\n display: block;\n }\n .item {\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n button {\n ${targetSize}\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: ${space(3)};\n inline-size: 100%;\n padding: ${space(3)} 0;\n background: none;\n border: 0;\n font: inherit;\n font-size: ${fontSize('md')};\n font-weight: ${fontWeight('semibold')};\n color: ${t.text};\n text-align: start;\n cursor: pointer;\n }\n button:hover {\n color: ${t.link};\n }\n .marker {\n flex: none;\n transition: transform 120ms ease-in-out;\n }\n button[aria-expanded='true'] .marker {\n transform: rotate(90deg);\n }\n /* 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)) button:hover {\n color: ${t.text};\n }\n :host(:not(:defined)) .marker {\n display: none;\n }\n .panel {\n padding-block-end: ${space(4)};\n font-size: ${fontSize('md')};\n }\n `,\n ];\n\n private toggle(id: string): void {\n const isOpen = this.open.includes(id);\n if (isOpen) this.open = this.open.filter((o) => o !== id);\n else this.open = this.multiple ? [...this.open, id] : [id];\n }\n\n render(): TemplateResult {\n return html`\n ${this.items.map((item) => {\n const expanded = !this.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\" part=\"item\">\n <div role=\"heading\" aria-level=${this.headingLevel}>\n <button\n id=${buttonId}\n part=\"header\"\n type=\"button\"\n aria-expanded=${expanded ? 'true' : 'false'}\n aria-controls=${panelId}\n @click=${() => this.toggle(item.id)}\n >\n <span>${item.heading}</span>\n <span class=\"marker\" aria-hidden=\"true\">›</span>\n </button>\n </div>\n <div\n id=${panelId}\n class=\"panel\"\n part=\"panel\"\n role=\"region\"\n aria-labelledby=${buttonId}\n ?hidden=${!expanded}\n >\n <slot name=${`panel-${item.id}`}>${item.body}</slot>\n </div>\n </div>\n `;\n })}\n `;\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,WAAgC;AA6CxC,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,UAAU,EAA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A,EAEA,SAAyB;AACvB,WAAO;AAAA,QACH,KAAK,MAAM,IAAI,CAAC,SAAS;AACzB,YAAM,WAAW,CAAC,KAAK,YAAY,KAAK,KAAK,SAAS,KAAK,EAAE;AAC7D,YAAM,UAAU,KAAK,IAAI,SAAS,KAAK,EAAE,EAAE;AAC3C,YAAM,WAAW,KAAK,IAAI,UAAU,KAAK,EAAE,EAAE;AAC7C,aAAO;AAAA;AAAA,6CAE8B,KAAK,YAAY;AAAA;AAAA,qBAEzC,QAAQ;AAAA;AAAA;AAAA,gCAGG,WAAW,SAAS,OAAO;AAAA,gCAC3B,OAAO;AAAA,yBACd,MAAM,KAAK,OAAO,KAAK,EAAE,CAAC;AAAA;AAAA,wBAE3B,KAAK,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,mBAKjB,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":[]}
|
|
@@ -98,11 +98,12 @@ var ImpaktTextarea = class extends FieldElement {
|
|
|
98
98
|
?required=${this.required}
|
|
99
99
|
aria-describedby=${this.describedBy}
|
|
100
100
|
aria-invalid=${this.error ? "true" : nothing}
|
|
101
|
+
.value=${this.value}
|
|
101
102
|
@input=${(e) => {
|
|
102
103
|
this.filledText = "";
|
|
103
104
|
this.setFormValue(e.target.value);
|
|
104
105
|
}}
|
|
105
|
-
|
|
106
|
+
></textarea>
|
|
106
107
|
`;
|
|
107
108
|
}
|
|
108
109
|
updated(changed) {
|
|
@@ -115,4 +116,4 @@ customElements.define("impakt-textarea", ImpaktTextarea);
|
|
|
115
116
|
export {
|
|
116
117
|
ImpaktTextarea
|
|
117
118
|
};
|
|
118
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-UFPI4I2Y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/textarea.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/** Several lines of text — a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n rows: { type: Number },\n maxlength: { type: Number },\n fillFrom: { type: String, attribute: 'fill-from' },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n /** `estimate` starts an empty box with the estimate a cost estimator sent on, so the visitor can edit it. */\n declare fillFrom: 'none' | 'estimate';\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.rows = 4;\n this.maxlength = undefined;\n this.fillFrom = 'none';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n textarea {\n inline-size: min(100%, var(--impakt-field-width));\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n textarea:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n textarea:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n :host([invalid]) textarea {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n private filled = false;\n /** The estimate it was filled with, kept until the visitor edits it, so a binding that has not caught up yet cannot empty the box. */\n private filledText = '';\n\n /** @ignore */\n protected willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate?.(changed as never);\n if (this.filledText && changed.has('value') && !this.value) this.value = this.filledText;\n }\n\n /** Fills the box once, when it is first asked to and is still empty. Props can arrive after the element joins the page. */\n private fill(): void {\n if (this.filled || this.fillFrom !== 'estimate') return;\n this.filled = true;\n if (this.value) return;\n let saved: string | null = null;\n try {\n saved = sessionStorage.getItem('impakt.estimate');\n } catch {\n saved = null;\n }\n if (saved) {\n this.filledText = saved;\n this.setFormValue(saved);\n }\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <textarea\n id=${this.controlId}\n part=\"textarea\"\n name=${this.name || nothing}\n rows=${this.rows}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => {\n this.filledText = '';\n this.setFormValue((e.target as HTMLTextAreaElement).value);\n }}\n
|
|
1
|
+
{"version":3,"sources":["../src/components/textarea.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\n/** Several lines of text — a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n rows: { type: Number },\n maxlength: { type: Number },\n fillFrom: { type: String, attribute: 'fill-from' },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n /** `estimate` starts an empty box with the estimate a cost estimator sent on, so the visitor can edit it. */\n declare fillFrom: 'none' | 'estimate';\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.rows = 4;\n this.maxlength = undefined;\n this.fillFrom = 'none';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n textarea {\n inline-size: min(100%, var(--impakt-field-width));\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n textarea:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n textarea:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n :host([invalid]) textarea {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n private filled = false;\n /** The estimate it was filled with, kept until the visitor edits it, so a binding that has not caught up yet cannot empty the box. */\n private filledText = '';\n\n /** @ignore */\n protected willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate?.(changed as never);\n if (this.filledText && changed.has('value') && !this.value) this.value = this.filledText;\n }\n\n /** Fills the box once, when it is first asked to and is still empty. Props can arrive after the element joins the page. */\n private fill(): void {\n if (this.filled || this.fillFrom !== 'estimate') return;\n this.filled = true;\n if (this.value) return;\n let saved: string | null = null;\n try {\n saved = sessionStorage.getItem('impakt.estimate');\n } catch {\n saved = null;\n }\n if (saved) {\n this.filledText = saved;\n this.setFormValue(saved);\n }\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <textarea\n id=${this.controlId}\n part=\"textarea\"\n name=${this.name || nothing}\n rows=${this.rows}\n maxlength=${this.maxlength ?? nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n .value=${this.value}\n @input=${(e: Event) => {\n this.filledText = '';\n this.setFormValue((e.target as HTMLTextAreaElement).value);\n }}\n ></textarea>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n this.fill();\n }\n}\n\ncustomElements.define('impakt-textarea', ImpaktTextarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-textarea': ImpaktTextarea;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AASjD,IAAM,iBAAN,cAA6B,aAAa;AAAA,EAiB/C,cAAc;AACZ,UAAM;AAwCR,SAAQ,SAAS;AAEjB;AAAA,SAAQ,aAAa;AAzCnB,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,WAAW;AAAA,EAClB;AAAA,EAtBA;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,WAAW,EAAE,MAAM,OAAO;AAAA,MAC1B,UAAU,EAAE,MAAM,QAAQ,WAAW,YAAY;AAAA,IACnD;AAAA;AAAA,EAkBA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA,mBAGe,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA;AAAA,qBAEpB,SAAS,IAAI,CAAC;AAAA,iBAClB,EAAE,IAAI;AAAA,wDACiC,EAAE,WAAW;AAAA,kBACnD,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,yBACvB,EAAE,QAAQ;AAAA,iDACc,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAOnC,EAAE,YAAY;AAAA;AAAA;AAAA,wBAGd,EAAE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@@ -2,7 +2,7 @@
|
|
|
2
2
|
function pageLocale(el) {
|
|
3
3
|
const fromElement = el?.closest?.("[lang]")?.getAttribute("lang");
|
|
4
4
|
const fromHost = !fromElement && el ? el.getRootNode?.()?.host?.closest?.("[lang]")?.getAttribute("lang") ?? "" : "";
|
|
5
|
-
const fromPage = typeof document !== "undefined" ? document.documentElement
|
|
5
|
+
const fromPage = typeof document !== "undefined" ? document.documentElement?.lang ?? "" : "";
|
|
6
6
|
const lang = (fromElement || fromHost || fromPage || "").trim();
|
|
7
7
|
if (!lang || lang.toLowerCase() === "en") return "en-GB";
|
|
8
8
|
return lang;
|
|
@@ -11,4 +11,4 @@ function pageLocale(el) {
|
|
|
11
11
|
export {
|
|
12
12
|
pageLocale
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-UNGAG44M.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/base/locale.ts"],"sourcesContent":["/**\n * The locale a component formats dates, numbers and money in: the language of\n * the page around it (ADR 0026). A delivered page sets `lang` on its root, or\n * on a part of the page in another language, and every component reads the\n * nearest one. English is British English, which is what Strata's sites wrote\n * before they had languages.\n */\nexport function pageLocale(el?: Element | null): string {\n const fromElement = el?.closest?.('[lang]')?.getAttribute('lang');\n const fromHost = !fromElement && el ? ((el.getRootNode?.() as ShadowRoot | undefined)?.host?.closest?.('[lang]')?.getAttribute('lang') ?? '') : '';\n const fromPage = typeof document !== 'undefined' ? document.documentElement
|
|
1
|
+
{"version":3,"sources":["../src/base/locale.ts"],"sourcesContent":["/**\n * The locale a component formats dates, numbers and money in: the language of\n * the page around it (ADR 0026). A delivered page sets `lang` on its root, or\n * on a part of the page in another language, and every component reads the\n * nearest one. English is British English, which is what Strata's sites wrote\n * before they had languages.\n */\nexport function pageLocale(el?: Element | null): string {\n const fromElement = el?.closest?.('[lang]')?.getAttribute('lang');\n const fromHost = !fromElement && el ? ((el.getRootNode?.() as ShadowRoot | undefined)?.host?.closest?.('[lang]')?.getAttribute('lang') ?? '') : '';\n // On the server there is a document but no root element, and the page's language is not known there.\n const fromPage = typeof document !== 'undefined' ? (document.documentElement?.lang ?? '') : '';\n const lang = (fromElement || fromHost || fromPage || '').trim();\n if (!lang || lang.toLowerCase() === 'en') return 'en-GB';\n return lang;\n}\n"],"mappings":";AAOO,SAAS,WAAW,IAA6B;AACtD,QAAM,cAAc,IAAI,UAAU,QAAQ,GAAG,aAAa,MAAM;AAChE,QAAM,WAAW,CAAC,eAAe,KAAO,GAAG,cAAc,GAA8B,MAAM,UAAU,QAAQ,GAAG,aAAa,MAAM,KAAK,KAAM;AAEhJ,QAAM,WAAW,OAAO,aAAa,cAAe,SAAS,iBAAiB,QAAQ,KAAM;AAC5F,QAAM,QAAQ,eAAe,YAAY,YAAY,IAAI,KAAK;AAC9D,MAAI,CAAC,QAAQ,KAAK,YAAY,MAAM,KAAM,QAAO;AACjD,SAAO;AACT;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pageLocale
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UNGAG44M.js";
|
|
4
4
|
import {
|
|
5
5
|
lockScroll,
|
|
6
6
|
unlockScroll
|
|
@@ -318,7 +318,7 @@ var ImpaktMenu = class extends ImpaktElement {
|
|
|
318
318
|
const inner = (item) => html`${iconSvg(item.icon, "18px")}<span>${item.text}</span>`;
|
|
319
319
|
return html`<button class="trigger" part="trigger" type="button" aria-haspopup="menu" aria-expanded=${String(this.open)} aria-controls=${this.id_("list")}
|
|
320
320
|
@click=${() => this.toggle(!this.open)} @keydown=${this.triggerKey}><slot name="trigger">${iconSvg(this.icon, "18px")}${this.label}</slot><span class="chev" part="chevron">${iconSvg("chevron-down", "16px")}</span></button>
|
|
321
|
-
${this.open ? html`<div class="panel" part="panel">${this.querySelector(':scope > [slot="header"]') ? html`<div class="header" part="header"><slot name="header"></slot></div>` : nothing}<ul class="list" part="list" id=${this.id_("list")} role="menu" aria-label=${this.label} @keydown=${this.listKey}>
|
|
321
|
+
${this.open ? html`<div class="panel" part="panel">${this.querySelector?.(':scope > [slot="header"]') ? html`<div class="header" part="header"><slot name="header"></slot></div>` : nothing}<ul class="list" part="list" id=${this.id_("list")} role="menu" aria-label=${this.label} @keydown=${this.listKey}>
|
|
322
322
|
${this.items.map(
|
|
323
323
|
(item) => html`<li role="none">${item.href ? html`<a class="item ${item.tone === "danger" ? "danger" : ""}" role="menuitem" tabindex="-1" href=${item.href} @click=${() => this.choose(item)}>${inner(item)}</a>` : html`<button class="item ${item.tone === "danger" ? "danger" : ""}" role="menuitem" tabindex="-1" type="button" @click=${() => this.choose(item)}>${inner(item)}</button>`}</li>`
|
|
324
324
|
)}
|
|
@@ -637,4 +637,4 @@ export {
|
|
|
637
637
|
ImpaktEmptyState,
|
|
638
638
|
ImpaktSlotPicker
|
|
639
639
|
};
|
|
640
|
-
//# sourceMappingURL=chunk-
|
|
640
|
+
//# sourceMappingURL=chunk-ZEIV5X3U.js.map
|