@atomic-ui/ui 0.1.4 → 0.1.7
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 +30 -6
- package/dist/base/FieldElement.d.ts +7 -0
- package/dist/base/tokens.d.ts +23 -1
- package/dist/chunk-2YQA3VBY.js +85 -0
- package/dist/chunk-2YQA3VBY.js.map +1 -0
- package/dist/{chunk-LFOWTFMR.js → chunk-4HU4Y23Q.js} +3 -3
- package/dist/chunk-5EA4IDUD.js +177 -0
- package/dist/chunk-5EA4IDUD.js.map +1 -0
- package/dist/{chunk-3OSL2HMN.js → chunk-6ICOJPMD.js} +7 -5
- package/dist/chunk-6ICOJPMD.js.map +1 -0
- package/dist/{chunk-ZXCSQ6MK.js → chunk-7BIQ3K6H.js} +10 -2
- package/dist/chunk-7BIQ3K6H.js.map +1 -0
- package/dist/chunk-7Y6UCSUS.js +361 -0
- package/dist/chunk-7Y6UCSUS.js.map +1 -0
- package/dist/chunk-BTGCUONV.js +56 -0
- package/dist/chunk-BTGCUONV.js.map +1 -0
- package/dist/{chunk-QYHWR6C5.js → chunk-C36CZRHK.js} +20 -7
- package/dist/chunk-C36CZRHK.js.map +1 -0
- package/dist/{chunk-MAMBT7BZ.js → chunk-CMAU4DSB.js} +21 -7
- package/dist/chunk-CMAU4DSB.js.map +1 -0
- package/dist/{chunk-HWNY6U5F.js → chunk-G6OVKNL7.js} +2 -2
- package/dist/{chunk-6UDDZQDK.js → chunk-GO2IBRFP.js} +3 -3
- package/dist/chunk-GO2IBRFP.js.map +1 -0
- package/dist/{chunk-PDXOPY22.js → chunk-GSCVG2ER.js} +3 -3
- package/dist/{chunk-IBTOZOGI.js → chunk-HWWA27DN.js} +2 -2
- package/dist/chunk-MLVUMCQ2.js +167 -0
- package/dist/chunk-MLVUMCQ2.js.map +1 -0
- package/dist/{chunk-A4CJ2F3J.js → chunk-MOEMFL4K.js} +21 -7
- package/dist/chunk-MOEMFL4K.js.map +1 -0
- package/dist/{chunk-OBCSDZHP.js → chunk-NQKYHILD.js} +3 -3
- package/dist/{chunk-5NUF7ZQA.js → chunk-NTNXHLTM.js} +24 -3
- package/dist/chunk-NTNXHLTM.js.map +1 -0
- package/dist/{chunk-4Y3HJBJY.js → chunk-OB7LC6NJ.js} +3 -2
- package/dist/chunk-OB7LC6NJ.js.map +1 -0
- package/dist/chunk-QCNT7D5V.js +549 -0
- package/dist/chunk-QCNT7D5V.js.map +1 -0
- package/dist/{chunk-CGMDIZPO.js → chunk-QDNI54ON.js} +3 -3
- package/dist/chunk-T6L3USBZ.js +245 -0
- package/dist/chunk-T6L3USBZ.js.map +1 -0
- package/dist/{chunk-TZD7IVVQ.js → chunk-TPF4MOMF.js} +8 -3
- package/dist/chunk-TPF4MOMF.js.map +1 -0
- package/dist/{chunk-S3EQO33M.js → chunk-VTFCTWSX.js} +6 -4
- package/dist/chunk-VTFCTWSX.js.map +1 -0
- package/dist/{chunk-2RBYVWZT.js → chunk-VWNBB7FW.js} +5 -3
- package/dist/chunk-VWNBB7FW.js.map +1 -0
- package/dist/{chunk-DIZCGSJA.js → chunk-WECSVHIM.js} +15 -3
- package/dist/chunk-WECSVHIM.js.map +1 -0
- package/dist/chunk-X7IPZPTG.js +710 -0
- package/dist/chunk-X7IPZPTG.js.map +1 -0
- package/dist/{chunk-TIKX5POO.js → chunk-XJP45LFA.js} +55 -28
- package/dist/chunk-XJP45LFA.js.map +1 -0
- package/dist/{chunk-6MLXFFH4.js → chunk-XVKEM5JY.js} +3 -3
- package/dist/chunk-XVKEM5JY.js.map +1 -0
- package/dist/chunk-ZBLTU67D.js +424 -0
- package/dist/chunk-ZBLTU67D.js.map +1 -0
- package/dist/{chunk-4KFHQBH2.js → chunk-ZGAOMRYD.js} +17 -4
- package/dist/chunk-ZGAOMRYD.js.map +1 -0
- package/dist/chunk-ZQJD4YEJ.js +195 -0
- package/dist/chunk-ZQJD4YEJ.js.map +1 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.js +2 -2
- package/dist/components/app-ui.d.ts +421 -0
- package/dist/components/app-ui.js +26 -0
- package/dist/components/app-ui.js.map +1 -0
- package/dist/components/blocks.d.ts +174 -0
- package/dist/components/blocks.js +17 -0
- package/dist/components/blocks.js.map +1 -0
- package/dist/components/button.d.ts +33 -0
- package/dist/components/button.js +3 -2
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +3 -3
- package/dist/components/date-input.js +3 -3
- package/dist/components/dialog.js +2 -2
- package/dist/components/fieldset.d.ts +49 -0
- package/dist/components/fieldset.js +8 -0
- package/dist/components/fieldset.js.map +1 -0
- package/dist/components/grid.d.ts +3 -3
- package/dist/components/grid.js +2 -2
- package/dist/components/help.js +2 -2
- package/dist/components/icon.d.ts +89 -0
- package/dist/components/icon.js +14 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/layout.d.ts +75 -7
- package/dist/components/layout.js +2 -2
- package/dist/components/link.d.ts +11 -0
- package/dist/components/link.js +3 -2
- package/dist/components/marketing.d.ts +370 -0
- package/dist/components/marketing.js +21 -0
- package/dist/components/marketing.js.map +1 -0
- package/dist/components/media.d.ts +12 -0
- package/dist/components/media.js +2 -2
- package/dist/components/navigation.d.ts +98 -0
- package/dist/components/navigation.js +11 -0
- package/dist/components/navigation.js.map +1 -0
- package/dist/components/organisms.d.ts +547 -0
- package/dist/components/organisms.js +25 -0
- package/dist/components/organisms.js.map +1 -0
- package/dist/components/page.d.ts +130 -0
- package/dist/components/page.js +10 -0
- package/dist/components/page.js.map +1 -0
- package/dist/components/price.d.ts +5 -0
- package/dist/components/price.js +2 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/property.d.ts +389 -0
- package/dist/components/property.js +19 -0
- package/dist/components/property.js.map +1 -0
- package/dist/components/radio-group.js +3 -3
- package/dist/components/select.d.ts +6 -0
- package/dist/components/select.js +3 -3
- package/dist/components/summary-list.js +2 -2
- package/dist/components/table.js +2 -2
- package/dist/components/text-input.d.ts +6 -0
- package/dist/components/text-input.js +3 -3
- package/dist/components/textarea.d.ts +6 -0
- package/dist/components/textarea.js +3 -3
- package/dist/index.d.ts +9 -0
- package/dist/index.js +140 -36
- package/package.json +2 -2
- package/dist/chunk-2RBYVWZT.js.map +0 -1
- package/dist/chunk-3OSL2HMN.js.map +0 -1
- package/dist/chunk-4KFHQBH2.js.map +0 -1
- package/dist/chunk-4Y3HJBJY.js.map +0 -1
- package/dist/chunk-5NUF7ZQA.js.map +0 -1
- package/dist/chunk-6MLXFFH4.js.map +0 -1
- package/dist/chunk-6UDDZQDK.js.map +0 -1
- package/dist/chunk-A4CJ2F3J.js.map +0 -1
- package/dist/chunk-DIZCGSJA.js.map +0 -1
- package/dist/chunk-GGODB3GY.js +0 -172
- package/dist/chunk-GGODB3GY.js.map +0 -1
- package/dist/chunk-MAMBT7BZ.js.map +0 -1
- package/dist/chunk-QYHWR6C5.js.map +0 -1
- package/dist/chunk-S3EQO33M.js.map +0 -1
- package/dist/chunk-TIKX5POO.js.map +0 -1
- package/dist/chunk-TZD7IVVQ.js.map +0 -1
- package/dist/chunk-ZXCSQ6MK.js.map +0 -1
- /package/dist/{chunk-LFOWTFMR.js.map → chunk-4HU4Y23Q.js.map} +0 -0
- /package/dist/{chunk-HWNY6U5F.js.map → chunk-G6OVKNL7.js.map} +0 -0
- /package/dist/{chunk-PDXOPY22.js.map → chunk-GSCVG2ER.js.map} +0 -0
- /package/dist/{chunk-IBTOZOGI.js.map → chunk-HWWA27DN.js.map} +0 -0
- /package/dist/{chunk-OBCSDZHP.js.map → chunk-NQKYHILD.js.map} +0 -0
- /package/dist/{chunk-CGMDIZPO.js.map → chunk-QDNI54ON.js.map} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
FieldElement
|
|
3
|
-
|
|
2
|
+
FieldElement,
|
|
3
|
+
fieldWidths
|
|
4
|
+
} from "./chunk-7BIQ3K6H.js";
|
|
4
5
|
import {
|
|
5
6
|
fontSize,
|
|
6
7
|
space,
|
|
7
8
|
t
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NTNXHLTM.js";
|
|
9
10
|
|
|
10
11
|
// packages/ui/src/components/select.ts
|
|
11
12
|
import { html, css, nothing } from "lit";
|
|
@@ -13,29 +14,42 @@ var ImpktSelect = class extends FieldElement {
|
|
|
13
14
|
static {
|
|
14
15
|
this.properties = {
|
|
15
16
|
...FieldElement.properties,
|
|
17
|
+
width: { type: String, reflect: true },
|
|
16
18
|
options: { type: Array },
|
|
17
19
|
placeholder: { type: String }
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
22
|
constructor() {
|
|
21
23
|
super();
|
|
24
|
+
this.width = "full";
|
|
22
25
|
this.options = [];
|
|
23
26
|
this.placeholder = "Choose an option";
|
|
24
27
|
}
|
|
25
28
|
static {
|
|
26
29
|
this.styles = [
|
|
27
30
|
...FieldElement.styles,
|
|
31
|
+
fieldWidths,
|
|
28
32
|
css`
|
|
29
33
|
select {
|
|
30
|
-
inline-size: 100
|
|
34
|
+
inline-size: min(100%, var(--impkt-field-width));
|
|
31
35
|
min-block-size: 44px;
|
|
32
|
-
padding: ${space(3)};
|
|
36
|
+
padding: ${space(2.5)} ${space(3)};
|
|
33
37
|
font-family: inherit;
|
|
34
38
|
font-size: ${fontSize("md")};
|
|
35
39
|
color: ${t.text};
|
|
36
40
|
background: ${t.surfaceCard};
|
|
37
41
|
border: ${t.borderThin} solid ${t.border};
|
|
38
|
-
border-radius: ${t.
|
|
42
|
+
border-radius: ${t.radiusLg};
|
|
43
|
+
box-shadow: ${t.shadowXs};
|
|
44
|
+
transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;
|
|
45
|
+
}
|
|
46
|
+
select:hover:not(:disabled) {
|
|
47
|
+
border-color: ${t.borderStrong};
|
|
48
|
+
}
|
|
49
|
+
/* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */
|
|
50
|
+
select:focus-visible {
|
|
51
|
+
border-color: ${t.brand};
|
|
52
|
+
box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};
|
|
39
53
|
}
|
|
40
54
|
select:disabled {
|
|
41
55
|
background: ${t.surfaceInset};
|
|
@@ -76,4 +90,4 @@ customElements.define("impkt-select", ImpktSelect);
|
|
|
76
90
|
export {
|
|
77
91
|
ImpktSelect
|
|
78
92
|
};
|
|
79
|
-
//# sourceMappingURL=chunk-
|
|
93
|
+
//# sourceMappingURL=chunk-CMAU4DSB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/select.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\n/**\n * A dropdown.\n *\n * A native `<select>`, because the alternative is a listbox widget that has to\n * reimplement type-ahead, keyboard selection, and the platform's own picker on\n * touch — and whose main advantage is that the arrow can be restyled. On a\n * phone, native wins outright: it opens the system control that the user\n * already knows how to drive.\n *\n * The empty first option carries a real label rather than being blank, so a\n * screen reader announces a choice to make rather than silence.\n\n *\n * @category form\n * @icon select\n */\nexport class ImpktSelect extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n options: { type: Array },\n placeholder: { type: String },\n };\n\n declare options: SelectOption[];\n declare placeholder: string;\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.options = [];\n this.placeholder = 'Choose an option';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n select {\n inline-size: min(100%, var(--impkt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: ${t.shadowXs};\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n select:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n /* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */\n select:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n select:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n :host([invalid]) select {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <select\n id=${this.controlId}\n part=\"select\"\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}\n >\n <option value=\"\" ?selected=${!this.value}>${this.placeholder}</option>\n ${this.options.map(\n (o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`,\n )}\n </select>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impkt-select', ImpktSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-select': ImpktSelect;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAyBjD,IAAM,cAAN,cAA0B,aAAa;AAAA,EAC5C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,SAAS,EAAE,MAAM,MAAM;AAAA,MACvB,aAAa,EAAE,MAAM,OAAO;AAAA,IAC9B;AAAA;AAAA,EAQA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ;AACb,SAAK,UAAU,CAAC;AAChB,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA;AAAA,SAAO,SAAS;AA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
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
space,
|
|
6
6
|
t,
|
|
7
7
|
visuallyHidden
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NTNXHLTM.js";
|
|
9
9
|
|
|
10
10
|
// packages/ui/src/components/progress.ts
|
|
11
11
|
import { html, css, nothing } from "lit";
|
|
@@ -92,4 +92,4 @@ customElements.define("impkt-progress", ImpktProgress);
|
|
|
92
92
|
export {
|
|
93
93
|
ImpktProgress
|
|
94
94
|
};
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
95
|
+
//# sourceMappingURL=chunk-G6OVKNL7.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
fontWeight,
|
|
6
6
|
space,
|
|
7
7
|
t
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NTNXHLTM.js";
|
|
9
9
|
|
|
10
10
|
// packages/ui/src/components/summary-list.ts
|
|
11
11
|
import { html, css, nothing } from "lit";
|
|
@@ -44,7 +44,7 @@ var ImpktSummaryList = class extends ImpktElement {
|
|
|
44
44
|
dt,
|
|
45
45
|
dd {
|
|
46
46
|
padding: ${space(3)} 0;
|
|
47
|
-
border-block-end: ${t.borderThin} solid ${t.
|
|
47
|
+
border-block-end: ${t.borderThin} solid ${t.rule};
|
|
48
48
|
}
|
|
49
49
|
dt {
|
|
50
50
|
font-weight: ${fontWeight("semibold")};
|
|
@@ -117,4 +117,4 @@ customElements.define("impkt-summary-list", ImpktSummaryList);
|
|
|
117
117
|
export {
|
|
118
118
|
ImpktSummaryList
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-GO2IBRFP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/summary-list.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface SummaryRow {\n key: string;\n value: string;\n /** Where \"Change\" goes. Omitted rows show no action. */\n changeHref?: string;\n}\n\n/**\n * Key and value pairs — an order summary, a confirmation, a check-your-answers\n * screen.\n *\n * **It is a description list.** `<dl>` with `<dt>` and `<dd>` says these are\n * pairs; a stack of divs says nothing, and a table claims a grid that a\n * two-column list does not have.\n *\n * **Every \"Change\" names what it changes.** The visible text stays short, and\n * the accessible name is completed with visually hidden words, so a reader\n * tabbing through hears \"Change date of birth\" rather than six links all called\n * \"Change\". This is 2.4.4 Link Purpose, and it is the single most common\n * failure on a check-your-answers page.\n\n *\n * @category content\n * @icon list\n */\nexport class ImpktSummaryList extends ImpktElement {\n static properties = {\n rows: { type: Array },\n changeText: { type: String, attribute: 'change-text' },\n };\n\n declare rows: SummaryRow[];\n declare changeText: string;\n\n constructor() {\n super();\n this.rows = [];\n this.changeText = 'Change';\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: minmax(8rem, 1fr) 2fr;\n }\n /* A <dl> group may hold only dt and dd — not a third sibling — so the\n action lives inside the value it changes, which is also where it\n belongs semantically. The row uses display:contents so both cells stay\n in the parent grid. */\n .row {\n display: contents;\n }\n dt,\n dd {\n padding: ${space(3)} 0;\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n dt {\n font-weight: ${fontWeight('semibold')};\n font-size: ${fontSize('sm')};\n }\n dd {\n margin: 0;\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: ${space(3)};\n }\n dd a {\n flex: none;\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n display: inline-block;\n min-block-size: ${t.targetMin};\n }\n .sr-only {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n /* One column on a narrow screen. 1.4.10 Reflow: two columns at 320px\n forces horizontal scrolling, and a summary is read, not scanned\n across. */\n @media (max-width: 30rem) {\n dl {\n grid-template-columns: 1fr;\n }\n dt {\n border-block-end: 0;\n padding-block-end: 0;\n }\n dd {\n padding-block-start: 0;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <dl part=\"list\">\n ${this.rows.map(\n (row) => html`\n <div class=\"row\" part=\"row\">\n <dt part=\"key\">${row.key}</dt>\n <dd part=\"value\">\n <span>${row.value}</span>\n ${row.changeHref\n ? html`<a href=${row.changeHref} part=\"action\"\n >${this.changeText}<span class=\"sr-only\"> ${row.key}</span></a\n >`\n : nothing}\n </dd>\n </div>\n `,\n )}\n </dl>\n `;\n }\n}\n\ncustomElements.define('impkt-summary-list', ImpktSummaryList);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-summary-list': ImpktSummaryList }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA8BjD,IAAM,mBAAN,cAA+B,aAAa;AAAA,EACjD;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,MAAM;AAAA,MACpB,YAAY,EAAE,MAAM,QAAQ,WAAW,cAAc;AAAA,IACvD;AAAA;AAAA,EAKA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO,CAAC;AACb,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAkBe,MAAM,CAAC,CAAC;AAAA,4BACC,EAAE,UAAU,UAAU,EAAE,IAAI;AAAA;AAAA;AAAA,uBAGjC,WAAW,UAAU,CAAC;AAAA,qBACxB,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOpB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,iBAIN,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA,0BAIG,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA2BnC;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO;AAAA;AAAA,UAED,KAAK,KAAK;AAAA,MACV,CAAC,QAAQ;AAAA;AAAA,+BAEY,IAAI,GAAG;AAAA;AAAA,wBAEd,IAAI,KAAK;AAAA,kBACf,IAAI,aACF,eAAe,IAAI,UAAU;AAAA,yBACxB,KAAK,UAAU,0BAA0B,IAAI,GAAG;AAAA,yBAErD,OAAO;AAAA;AAAA;AAAA;AAAA,IAInB,CAAC;AAAA;AAAA;AAAA,EAGP;AACF;AAEA,eAAe,OAAO,sBAAsB,gBAAgB;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FieldElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7BIQ3K6H.js";
|
|
4
4
|
import {
|
|
5
5
|
fontSize,
|
|
6
6
|
space,
|
|
7
7
|
t,
|
|
8
8
|
targetSize
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NTNXHLTM.js";
|
|
10
10
|
|
|
11
11
|
// packages/ui/src/components/checkbox-group.ts
|
|
12
12
|
import { html, css, nothing } from "lit";
|
|
@@ -128,4 +128,4 @@ customElements.define("impkt-checkbox-group", ImpktCheckboxGroup);
|
|
|
128
128
|
export {
|
|
129
129
|
ImpktCheckboxGroup
|
|
130
130
|
};
|
|
131
|
-
//# sourceMappingURL=chunk-
|
|
131
|
+
//# sourceMappingURL=chunk-GSCVG2ER.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
focusRing,
|
|
4
4
|
fontWeight,
|
|
5
5
|
t
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NTNXHLTM.js";
|
|
7
7
|
|
|
8
8
|
// packages/ui/src/components/help.ts
|
|
9
9
|
import { html, css, nothing } from "lit";
|
|
@@ -81,4 +81,4 @@ customElements.define("impkt-help", ImpktHelp);
|
|
|
81
81
|
export {
|
|
82
82
|
ImpktHelp
|
|
83
83
|
};
|
|
84
|
-
//# sourceMappingURL=chunk-
|
|
84
|
+
//# sourceMappingURL=chunk-HWWA27DN.js.map
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
iconSvg
|
|
3
|
+
} from "./chunk-2YQA3VBY.js";
|
|
4
|
+
import {
|
|
5
|
+
ImpktElement,
|
|
6
|
+
focusRing,
|
|
7
|
+
fontSize,
|
|
8
|
+
fontWeight,
|
|
9
|
+
space,
|
|
10
|
+
t,
|
|
11
|
+
targetSize,
|
|
12
|
+
visuallyHidden
|
|
13
|
+
} from "./chunk-NTNXHLTM.js";
|
|
14
|
+
|
|
15
|
+
// packages/ui/src/components/navigation.ts
|
|
16
|
+
import { css, html, nothing } from "lit";
|
|
17
|
+
function where(href) {
|
|
18
|
+
if (typeof location === "undefined" || !href) return null;
|
|
19
|
+
let path;
|
|
20
|
+
try {
|
|
21
|
+
path = new URL(href, location.href).pathname.replace(/\/$/, "") || "/";
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const here = location.pathname.replace(/\/$/, "") || "/";
|
|
26
|
+
if (path === here) return "page";
|
|
27
|
+
return path !== "/" && here.startsWith(`${path}/`) ? "section" : null;
|
|
28
|
+
}
|
|
29
|
+
var ImpktNav = class extends ImpktElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
/** Whether the menu is open on a narrow screen. Not a setting: it is the visitor's. */
|
|
33
|
+
this.menuOpen = false;
|
|
34
|
+
/** The width the links need in one row. Measured once for each set of links, and again while folded it cannot be read. */
|
|
35
|
+
this.needs = 0;
|
|
36
|
+
this.links = [];
|
|
37
|
+
this.label = "Main";
|
|
38
|
+
this.menuText = "Menu";
|
|
39
|
+
this.align = "end";
|
|
40
|
+
}
|
|
41
|
+
static {
|
|
42
|
+
this.properties = {
|
|
43
|
+
links: { type: Array },
|
|
44
|
+
label: { type: String },
|
|
45
|
+
menuText: { type: String, attribute: "menu-text" },
|
|
46
|
+
align: { type: String, reflect: true }
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
get open() {
|
|
50
|
+
return this.menuOpen;
|
|
51
|
+
}
|
|
52
|
+
set open(next) {
|
|
53
|
+
this.menuOpen = next;
|
|
54
|
+
this.requestUpdate();
|
|
55
|
+
}
|
|
56
|
+
static {
|
|
57
|
+
this.styles = [...ImpktElement.styles, focusRing, css`
|
|
58
|
+
/* It grows to fill a row it sits in, because it measures itself to decide when to fold. */
|
|
59
|
+
:host { display: block; flex: 1 1 8rem; min-inline-size: 0; }
|
|
60
|
+
nav { display: flex; flex-direction: column; position: relative; }
|
|
61
|
+
li { flex: none; }
|
|
62
|
+
ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)} ${space(6)}; align-items: center; justify-content: flex-end; }
|
|
63
|
+
:host([align='start']) ul { justify-content: flex-start; }
|
|
64
|
+
:host([align='center']) ul { justify-content: center; }
|
|
65
|
+
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}; }
|
|
66
|
+
a:hover { text-decoration: underline; text-underline-offset: 0.25em; }
|
|
67
|
+
a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
|
|
68
|
+
.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; }
|
|
69
|
+
/* When they do not fit, the links fold behind a Menu button and open as a panel under it. */
|
|
70
|
+
:host([folded]) { flex: 0 0 auto; }
|
|
71
|
+
:host([folded]) .toggle { display: inline-flex; }
|
|
72
|
+
: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%); }
|
|
73
|
+
:host([folded]) ul.open { display: flex; }
|
|
74
|
+
:host([folded]) li { text-align: start; }
|
|
75
|
+
:host([folded]) a { display: flex; padding: ${space(3)} ${space(3)}; }
|
|
76
|
+
`];
|
|
77
|
+
}
|
|
78
|
+
fit() {
|
|
79
|
+
const room = this.getBoundingClientRect().width;
|
|
80
|
+
if (room <= 0) return;
|
|
81
|
+
if (!this.needs) {
|
|
82
|
+
this.removeAttribute("folded");
|
|
83
|
+
const items = Array.from(this.renderRoot.querySelectorAll("li"));
|
|
84
|
+
const gap = Number.parseFloat(getComputedStyle(this.renderRoot.querySelector("ul")).columnGap) || 0;
|
|
85
|
+
this.needs = items.reduce((total, item) => total + item.getBoundingClientRect().width, 0) + gap * Math.max(0, items.length - 1);
|
|
86
|
+
}
|
|
87
|
+
const fold = this.needs > room;
|
|
88
|
+
this.toggleAttribute("folded", fold);
|
|
89
|
+
if (!fold && this.menuOpen) this.open = false;
|
|
90
|
+
}
|
|
91
|
+
updated(changed) {
|
|
92
|
+
if (changed.has("links")) {
|
|
93
|
+
this.needs = 0;
|
|
94
|
+
this.fit();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
connectedCallback() {
|
|
98
|
+
super.connectedCallback();
|
|
99
|
+
if (typeof ResizeObserver === "function") {
|
|
100
|
+
this.resize = new ResizeObserver(() => this.fit());
|
|
101
|
+
this.resize.observe(this);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
super.disconnectedCallback();
|
|
106
|
+
this.resize?.disconnect();
|
|
107
|
+
}
|
|
108
|
+
toggle() {
|
|
109
|
+
this.open = !this.open;
|
|
110
|
+
}
|
|
111
|
+
onKey(event) {
|
|
112
|
+
if (event.key !== "Escape" || !this.open) return;
|
|
113
|
+
this.open = false;
|
|
114
|
+
this.renderRoot.querySelector(".toggle")?.focus();
|
|
115
|
+
}
|
|
116
|
+
render() {
|
|
117
|
+
const list = this.id_("links");
|
|
118
|
+
return html`<nav aria-label=${this.label || nothing} part="nav" @keydown=${this.onKey}>
|
|
119
|
+
<button class="toggle" type="button" aria-expanded=${this.open ? "true" : "false"} aria-controls=${list} @click=${this.toggle}>${iconSvg(this.open ? "close" : "menu")}${this.menuText}</button>
|
|
120
|
+
<ul id=${list} class=${this.open ? "open" : ""} part="list">
|
|
121
|
+
${(this.links ?? []).map((link) => {
|
|
122
|
+
const current = where(link.href);
|
|
123
|
+
return html`<li><a href=${link.href} aria-current=${current === "page" ? "page" : current === "section" ? "true" : nothing} part="link">${link.label}</a></li>`;
|
|
124
|
+
})}
|
|
125
|
+
</ul>
|
|
126
|
+
</nav>`;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var ImpktBreadcrumbs = class extends ImpktElement {
|
|
130
|
+
static {
|
|
131
|
+
this.properties = {
|
|
132
|
+
items: { type: Array },
|
|
133
|
+
label: { type: String }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
constructor() {
|
|
137
|
+
super();
|
|
138
|
+
this.items = [];
|
|
139
|
+
this.label = "Breadcrumb";
|
|
140
|
+
}
|
|
141
|
+
static {
|
|
142
|
+
this.styles = [...ImpktElement.styles, focusRing, css`
|
|
143
|
+
:host { display: block; font-size: ${fontSize("sm")}; }
|
|
144
|
+
ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${space(1)}; }
|
|
145
|
+
li { display: inline-flex; align-items: center; gap: ${space(1)}; }
|
|
146
|
+
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)}; }
|
|
147
|
+
a { color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; border-radius: ${t.radiusSm}; }
|
|
148
|
+
a:hover { color: ${t.linkHover}; }
|
|
149
|
+
[aria-current] { color: ${t.textMuted}; }
|
|
150
|
+
.sr-only { ${visuallyHidden} }
|
|
151
|
+
`];
|
|
152
|
+
}
|
|
153
|
+
render() {
|
|
154
|
+
const items = this.items ?? [];
|
|
155
|
+
return html`<nav aria-label=${this.label} part="nav"><ol>
|
|
156
|
+
${items.map((item, i) => html`<li>${i === items.length - 1 ? html`<span aria-current="page">${item.label}</span>` : html`<a href=${item.href} part="link">${item.label}</a>`}</li>`)}
|
|
157
|
+
</ol></nav>`;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
customElements.define("impkt-nav", ImpktNav);
|
|
161
|
+
customElements.define("impkt-breadcrumbs", ImpktBreadcrumbs);
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
ImpktNav,
|
|
165
|
+
ImpktBreadcrumbs
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=chunk-MLVUMCQ2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/navigation.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\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 if (typeof location === 'undefined' || !href) return null;\n let path: string;\n try { path = new URL(href, location.href).pathname.replace(/\\/$/, '') || '/'; } catch { return null; }\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 ImpktNav extends ImpktElement {\n static properties = {\n links: { type: Array },\n label: { type: String },\n menuText: { type: String, attribute: 'menu-text' },\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 /** 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 { return this.menuOpen; }\n private set open(next: boolean) { this.menuOpen = next; this.requestUpdate(); }\n\n constructor() {\n super();\n this.links = [];\n this.label = 'Main';\n this.menuText = 'Menu';\n this.align = 'end';\n }\n\n static styles = [...ImpktElement.styles, focusRing, 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([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 /** 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')) { this.needs = 0; this.fit(); }\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' : 'menu')}${this.menuText}</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 ImpktBreadcrumbs extends ImpktElement {\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 = [...ImpktElement.styles, focusRing, 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 render(): TemplateResult {\n const items = this.items ?? [];\n return html`<nav aria-label=${this.label} part=\"nav\"><ol>\n ${items.map((item, i) => html`<li>${i === items.length - 1\n ? html`<span aria-current=\"page\">${item.label}</span>`\n : html`<a href=${item.href} part=\"link\">${item.label}</a>`}</li>`)}\n </ol></nav>`;\n }\n}\n\ncustomElements.define('impkt-nav', ImpktNav);\ncustomElements.define('impkt-breadcrumbs', ImpktBreadcrumbs);\ndeclare global { interface HTMLElementTagNameMap { 'impkt-nav': ImpktNav; 'impkt-breadcrumbs': ImpktBreadcrumbs } }\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAaxD,SAAS,MAAM,MAAyC;AACtD,MAAI,OAAO,aAAa,eAAe,CAAC,KAAM,QAAO;AACrD,MAAI;AACJ,MAAI;AAAE,WAAO,IAAI,IAAI,MAAM,SAAS,IAAI,EAAE,SAAS,QAAQ,OAAO,EAAE,KAAK;AAAA,EAAK,QAAQ;AAAE,WAAO;AAAA,EAAM;AACrG,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,WAAN,cAAuB,aAAa;AAAA,EAoBzC,cAAc;AACZ,UAAM;AALR;AAAA,SAAQ,WAAW;AAkCnB;AAAA,SAAQ,QAAQ;AA5Bd,SAAK,QAAQ,CAAC;AACd,SAAK,QAAQ;AACb,SAAK,WAAW;AAChB,SAAK,QAAQ;A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AAO,aAAa,QAAQ;AAC3C,eAAe,OAAO,qBAAqB,gBAAgB;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
FieldElement
|
|
3
|
-
|
|
2
|
+
FieldElement,
|
|
3
|
+
fieldWidths
|
|
4
|
+
} from "./chunk-7BIQ3K6H.js";
|
|
4
5
|
import {
|
|
5
6
|
fontSize,
|
|
6
7
|
space,
|
|
7
8
|
t
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NTNXHLTM.js";
|
|
9
10
|
|
|
10
11
|
// packages/ui/src/components/text-input.ts
|
|
11
12
|
import { html, css, nothing } from "lit";
|
|
@@ -13,6 +14,7 @@ var ImpktTextInput = class extends FieldElement {
|
|
|
13
14
|
static {
|
|
14
15
|
this.properties = {
|
|
15
16
|
...FieldElement.properties,
|
|
17
|
+
width: { type: String, reflect: true },
|
|
16
18
|
type: { type: String },
|
|
17
19
|
placeholder: { type: String },
|
|
18
20
|
autocomplete: { type: String },
|
|
@@ -22,6 +24,7 @@ var ImpktTextInput = class extends FieldElement {
|
|
|
22
24
|
}
|
|
23
25
|
constructor() {
|
|
24
26
|
super();
|
|
27
|
+
this.width = "full";
|
|
25
28
|
this.type = "text";
|
|
26
29
|
this.placeholder = "";
|
|
27
30
|
this.autocomplete = "";
|
|
@@ -31,17 +34,28 @@ var ImpktTextInput = class extends FieldElement {
|
|
|
31
34
|
static {
|
|
32
35
|
this.styles = [
|
|
33
36
|
...FieldElement.styles,
|
|
37
|
+
fieldWidths,
|
|
34
38
|
css`
|
|
35
39
|
input {
|
|
36
|
-
inline-size: 100
|
|
40
|
+
inline-size: min(100%, var(--impkt-field-width));
|
|
37
41
|
min-block-size: 44px;
|
|
38
|
-
padding: ${space(3)};
|
|
42
|
+
padding: ${space(2.5)} ${space(3)};
|
|
39
43
|
font-family: inherit;
|
|
40
44
|
font-size: ${fontSize("md")};
|
|
41
45
|
color: ${t.text};
|
|
42
46
|
background: ${t.surfaceCard};
|
|
43
47
|
border: ${t.borderThin} solid ${t.border};
|
|
44
|
-
border-radius: ${t.
|
|
48
|
+
border-radius: ${t.radiusLg};
|
|
49
|
+
box-shadow: ${t.shadowXs};
|
|
50
|
+
transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;
|
|
51
|
+
}
|
|
52
|
+
input:hover:not(:disabled) {
|
|
53
|
+
border-color: ${t.borderStrong};
|
|
54
|
+
}
|
|
55
|
+
/* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */
|
|
56
|
+
input:focus-visible {
|
|
57
|
+
border-color: ${t.brand};
|
|
58
|
+
box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};
|
|
45
59
|
}
|
|
46
60
|
input::placeholder {
|
|
47
61
|
color: ${t.textPlaceholder};
|
|
@@ -89,4 +103,4 @@ customElements.define("impkt-text-input", ImpktTextInput);
|
|
|
89
103
|
export {
|
|
90
104
|
ImpktTextInput
|
|
91
105
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
106
|
+
//# sourceMappingURL=chunk-MOEMFL4K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/text-input.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/**\n * A single-line text field.\n *\n * `inputmode` and `autocomplete` are first-class properties rather than\n * afterthoughts. 1.3.5 Identify Input Purpose is a Level AA criterion that\n * autofill satisfies directly, and it is the single cheapest accessibility win\n * in a checkout journey — a form that fills itself is a form that someone with a\n * motor impairment can actually finish.\n\n *\n * @category form\n * @icon field\n */\nexport class ImpktTextInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n type: { type: String },\n placeholder: { type: String },\n autocomplete: { type: String },\n inputmode: { type: String },\n maxlength: { type: Number },\n };\n\n declare type: 'text' | 'email' | 'tel' | 'number' | 'password' | 'date';\n declare placeholder: string;\n /** A token from the HTML autofill list — `given-name`, `postal-code`, `tel`. */\n declare autocomplete: string;\n declare inputmode: string;\n declare maxlength: number | undefined;\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.type = 'text';\n this.placeholder = '';\n this.autocomplete = '';\n this.inputmode = '';\n this.maxlength = undefined;\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n css`\n input {\n inline-size: min(100%, var(--impkt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n box-shadow: ${t.shadowXs};\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n input:hover:not(:disabled) {\n border-color: ${t.borderStrong};\n }\n /* A brand halo as well as the focus ring, so the field being typed in is plain at a glance. */\n input:focus-visible {\n border-color: ${t.brand};\n box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo};\n }\n input::placeholder {\n color: ${t.textPlaceholder};\n }\n input:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n /* The border thickens as well as reddening. Colour alone would carry the\n error, which 1.4.1 forbids — and the message below says it in words. */\n :host([invalid]) input {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <input\n id=${this.controlId}\n part=\"input\"\n type=${this.type}\n name=${this.name || nothing}\n .value=${this.value}\n placeholder=${this.placeholder || nothing}\n autocomplete=${this.autocomplete || nothing}\n inputmode=${this.inputmode || nothing}\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) => this.setFormValue((e.target as HTMLInputElement).value)}\n />\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impkt-text-input', ImpktTextInput);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-text-input': ImpktTextInput;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAiBjD,IAAM,iBAAN,cAA6B,aAAa;AAAA,EAC/C;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,aAAa,EAAE,MAAM,OAAO;AAAA,MAC5B,cAAc,EAAE,MAAM,OAAO;AAAA,MAC7B,WAAW,EAAE,MAAM,OAAO;AAAA,MAC1B,WAAW,EAAE,MAAM,OAAO;AAAA,IAC5B;AAAA;AAAA,EAYA,cAAc;AACZ,UAAM;AACN,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,SAAK,eAAe;AACpB,SAAK,YAAY;AACjB,SAAK,YAAY;AAAA,EACnB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA;AAAA,mBAIe,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA;AAAA,qBAEpB,SAAS,IAAI,CAAC;AAAA,iBAClB,EAAE,IAAI;AAAA,sBACD,EAAE,WAAW;AAAA,kBACjB,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,yBACvB,EAAE,QAAQ;AAAA,sBACb,EAAE,QAAQ;AAAA;AAAA;AAAA;AAAA,wBAIR,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA,wBAId,EAAE,KAAK;AAAA,sBACT,EAAE,WAAW,eAAe,EAAE,SAAS;AAAA;AAAA;AAAA,iBAG5C,EAAE,eAAe;AAAA;AAAA;AAAA,sBAGZ,EAAE,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAMZ,EAAE,MAAM;AAAA,wBACR,EAAE,WAAW;AAAA;AAAA;AAAA,IAGnC;AAAA;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA;AAAA,aAEE,KAAK,SAAS;AAAA;AAAA,eAEZ,KAAK,IAAI;AAAA,eACT,KAAK,QAAQ,OAAO;AAAA,iBAClB,KAAK,KAAK;AAAA,sBACL,KAAK,eAAe,OAAO;AAAA,uBAC1B,KAAK,gBAAgB,OAAO;AAAA,oBAC/B,KAAK,aAAa,OAAO;AAAA,oBACzB,KAAK,aAAa,OAAO;AAAA,oBACzB,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,oBACb,KAAK,QAAQ;AAAA,2BACN,KAAK,WAAW;AAAA,uBACpB,KAAK,QAAQ,SAAS,OAAO;AAAA,iBACnC,CAAC,MAAa,KAAK,aAAc,EAAE,OAA4B,KAAK,CAAC;AAAA;AAAA;AAAA,EAGpF;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAAA,EAC/E;AACF;AAEA,eAAe,OAAO,oBAAoB,cAAc;","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FieldElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7BIQ3K6H.js";
|
|
4
4
|
import {
|
|
5
5
|
fontSize,
|
|
6
6
|
space,
|
|
7
7
|
t,
|
|
8
8
|
targetSize
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NTNXHLTM.js";
|
|
10
10
|
|
|
11
11
|
// packages/ui/src/components/radio-group.ts
|
|
12
12
|
import { html, css, nothing } from "lit";
|
|
@@ -136,4 +136,4 @@ customElements.define("impkt-radio-group", ImpktRadioGroup);
|
|
|
136
136
|
export {
|
|
137
137
|
ImpktRadioGroup
|
|
138
138
|
};
|
|
139
|
-
//# sourceMappingURL=chunk-
|
|
139
|
+
//# sourceMappingURL=chunk-NQKYHILD.js.map
|
|
@@ -39,9 +39,27 @@ var t = {
|
|
|
39
39
|
radius: token("radius.md", "4px"),
|
|
40
40
|
radiusLg: token("radius.lg", "8px"),
|
|
41
41
|
borderThin: token("border.width.thin", "1px"),
|
|
42
|
-
borderThick: token("border.width.thick", "2px")
|
|
42
|
+
borderThick: token("border.width.thick", "2px"),
|
|
43
|
+
radiusXs: token("radius.xs", "2px"),
|
|
44
|
+
radiusXl: token("radius.xl", "12px"),
|
|
45
|
+
radius2xl: token("radius.2xl", "16px"),
|
|
46
|
+
/** Hairline borders and rings, from the text colour, so they suit any surface. */
|
|
47
|
+
hairline: unsafeCSS("color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 10%, transparent)"),
|
|
48
|
+
rule: unsafeCSS("color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 15%, transparent)"),
|
|
49
|
+
/** A wash of the text colour, for hover and pressed states on quiet controls. */
|
|
50
|
+
wash: unsafeCSS("color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 5%, transparent)"),
|
|
51
|
+
/** The brand at a fifth, for focus halos round fields. */
|
|
52
|
+
brandHalo: unsafeCSS("color-mix(in srgb, var(--impkt-color-brand-default, #1f4ed8) 22%, transparent)"),
|
|
53
|
+
shadowXs: token("shadow.xs", "0 1px 2px 0 rgb(0 0 0 / 0.05)"),
|
|
54
|
+
shadowSm: token("shadow.sm", "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"),
|
|
55
|
+
shadowMd: token("shadow.md", "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"),
|
|
56
|
+
shadowLg: token("shadow.lg", "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)"),
|
|
57
|
+
shadowXl: token("shadow.xl", "0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"),
|
|
58
|
+
trackingTight: token("font.tracking.tight", "-0.02em"),
|
|
59
|
+
trackingWide: token("font.tracking.wide", "0.06em")
|
|
43
60
|
};
|
|
44
|
-
var
|
|
61
|
+
var type = (name) => unsafeCSS(`font-size: var(--impkt-font-size-${name}, 1rem); line-height: var(--impkt-font-leading-${name}, 1.5);`);
|
|
62
|
+
var space = (step) => token(`space.${String(step).replace(".", "-")}`, `${step * 4}px`);
|
|
45
63
|
var fontSize = (name) => token(`font.size.${name}`, "1rem");
|
|
46
64
|
var lineHeight = (name) => token(`font.line-height.${name}`, "1.5");
|
|
47
65
|
var fontWeight = (name) => token(`font.weight.${name}`, "400");
|
|
@@ -50,10 +68,12 @@ var spaceAround = css`
|
|
|
50
68
|
:host([space-above='md']) { margin-block-start: ${space(4)}; }
|
|
51
69
|
:host([space-above='lg']) { margin-block-start: ${space(6)}; }
|
|
52
70
|
:host([space-above='xl']) { margin-block-start: ${space(8)}; }
|
|
71
|
+
:host([space-above='2xl']) { margin-block-start: clamp(${space(14)}, 8vw, ${space(28)}); }
|
|
53
72
|
:host([space-below='sm']) { margin-block-end: ${space(2)}; }
|
|
54
73
|
:host([space-below='md']) { margin-block-end: ${space(4)}; }
|
|
55
74
|
:host([space-below='lg']) { margin-block-end: ${space(6)}; }
|
|
56
75
|
:host([space-below='xl']) { margin-block-end: ${space(8)}; }
|
|
76
|
+
:host([space-below='2xl']) { margin-block-end: clamp(${space(14)}, 8vw, ${space(28)}); }
|
|
57
77
|
`;
|
|
58
78
|
|
|
59
79
|
// packages/ui/src/base/styles.ts
|
|
@@ -136,6 +156,7 @@ var ImpktElement = class extends LitElement {
|
|
|
136
156
|
export {
|
|
137
157
|
token,
|
|
138
158
|
t,
|
|
159
|
+
type,
|
|
139
160
|
space,
|
|
140
161
|
fontSize,
|
|
141
162
|
lineHeight,
|
|
@@ -146,4 +167,4 @@ export {
|
|
|
146
167
|
visuallyHidden,
|
|
147
168
|
ImpktElement
|
|
148
169
|
};
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-NTNXHLTM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base/tokens.ts","../src/base/styles.ts","../src/base/ImpktElement.ts"],"sourcesContent":["/**\n * Token helpers.\n *\n * Components never name a colour, a size or a radius. They name a token, and a\n * brand decides what it holds — which is what makes a rebrand a content\n * publish rather than a rebuild\n * ([ADR 0005](../../../../docs/decisions/0005-design-tokens.md)).\n *\n * Every reference carries a fallback so that a component dropped onto a page\n * with no token stylesheet still renders something legible. An unstyled\n * component is indistinguishable from a broken one, and the fallback is what\n * keeps a missing stylesheet a visible annoyance rather than a blank screen.\n *\n * These return `CSSResult` rather than strings. Lit's `css` tag refuses plain\n * interpolated strings, which is a deliberate guard against injecting\n * attacker-controlled text into a stylesheet; `unsafeCSS` is the documented\n * way past it and is safe here because every value is a literal in this file,\n * never anything authored or fetched.\n */\nimport { css, unsafeCSS, type CSSResult } from 'lit';\n\n/** `color.brand.default` → `var(--impkt-color-brand-default, <fallback>)`. */\nexport const token = (path: string, fallback: string): CSSResult =>\n unsafeCSS(`var(--impkt-${path.replace(/\\./g, '-')}, ${fallback})`);\n\nexport const t = {\n brand: token('color.brand.default', '#1f4ed8'),\n brandHover: token('color.brand.hover', '#1b45be'),\n brandActive: token('color.brand.active', '#183ba4'),\n brandSubtle: token('color.brand.subtle', '#e4eafa'),\n onBrand: token('color.text.on-brand', '#ffffff'),\n\n surfaceCard: token('color.surface.card', '#ffffff'),\n surfaceInset: token('color.surface.inset', '#f4f4f4'),\n surfaceSubtle: token('color.surface.subtle', '#e4eafa'),\n\n text: token('color.text.default', '#1a1a1a'),\n textMuted: token('color.text.muted', '#717171'),\n textPlaceholder: token('color.text.placeholder', '#767676'),\n textHeading: token('color.text.heading', '#1f4ed8'),\n link: token('color.text.link', '#1f4ed8'),\n linkHover: token('color.text.link-hover', '#193ead'),\n\n border: token('color.border.default', '#929292'),\n borderStrong: token('color.border.strong', '#818181'),\n\n danger: token('color.status.danger.default', '#c8102e'),\n dangerText: token('color.status.danger.text', '#c8102e'),\n dangerSubtle: token('color.status.danger.subtle', '#f8e2e6'),\n warning: token('color.status.warning.default', '#b45309'),\n warningText: token('color.status.warning.text', '#b45309'),\n warningSubtle: token('color.status.warning.subtle', '#f6eae1'),\n success: token('color.status.success.default', '#047857'),\n successText: token('color.status.success.text', '#047857'),\n successSubtle: token('color.status.success.subtle', '#e0f0ea'),\n info: token('color.status.info.default', '#1f4ed8'),\n infoText: token('color.status.info.text', '#1f4ed8'),\n infoSubtle: token('color.status.info.subtle', '#e4eafa'),\n\n fontBody: token('font.family.body', 'system-ui, sans-serif'),\n fontHeading: token('font.family.heading', 'system-ui, sans-serif'),\n\n focusShadow: token('focus.ring.shadow', '0 0 0 2px #ffffff, 0 0 0 4px #1a1a1a'),\n focusOffset: token('focus.ring.offset', '2px'),\n\n targetMin: token('target.min', '24px'),\n\n radiusSm: token('radius.sm', '2px'),\n radius: token('radius.md', '4px'),\n radiusLg: token('radius.lg', '8px'),\n\n borderThin: token('border.width.thin', '1px'),\n borderThick: token('border.width.thick', '2px'),\n\n radiusXs: token('radius.xs', '2px'),\n radiusXl: token('radius.xl', '12px'),\n radius2xl: token('radius.2xl', '16px'),\n\n /** Hairline borders and rings, from the text colour, so they suit any surface. */\n hairline: unsafeCSS('color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 10%, transparent)'),\n rule: unsafeCSS('color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 15%, transparent)'),\n /** A wash of the text colour, for hover and pressed states on quiet controls. */\n wash: unsafeCSS('color-mix(in srgb, var(--impkt-color-text-default, #1a1a1a) 5%, transparent)'),\n /** The brand at a fifth, for focus halos round fields. */\n brandHalo: unsafeCSS('color-mix(in srgb, var(--impkt-color-brand-default, #1f4ed8) 22%, transparent)'),\n\n shadowXs: token('shadow.xs', '0 1px 2px 0 rgb(0 0 0 / 0.05)'),\n shadowSm: token('shadow.sm', '0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)'),\n shadowMd: token('shadow.md', '0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)'),\n shadowLg: token('shadow.lg', '0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)'),\n shadowXl: token('shadow.xl', '0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)'),\n\n trackingTight: token('font.tracking.tight', '-0.02em'),\n trackingWide: token('font.tracking.wide', '0.06em'),\n} as const;\n\n/**\n * A size on the type scale with its own line height, so text drawn at\n * `type('xl')` has the leading that size reads best at.\n */\nexport const type = (name: string): CSSResult =>\n unsafeCSS(`font-size: var(--impkt-font-size-${name}, 1rem); line-height: var(--impkt-font-leading-${name}, 1.5);`);\n\n/** `space(3)` → `space.3`, `space(0.5)` → `space.0-5`. Spacing is always a token, never a number. */\nexport const space = (step: number): CSSResult => token(`space.${String(step).replace('.', '-')}`, `${step * 4}px`);\n/** `font.size.lg` → the custom property. */\nexport const fontSize = (name: string): CSSResult => token(`font.size.${name}`, '1rem');\nexport const lineHeight = (name: string): CSSResult => token(`font.line-height.${name}`, '1.5');\nexport const fontWeight = (name: string): CSSResult => token(`font.weight.${name}`, '400');\n\n/**\n * Space above and below a section, from the spacing scale: `none`, `sm`,\n * `md`, `lg` or `xl`, set by `space-above` and `space-below`. A section names\n * a step rather than a size, so a page keeps the brand's rhythm.\n */\nexport const spaceAround: CSSResult = css`\n :host([space-above='sm']) { margin-block-start: ${space(2)}; }\n :host([space-above='md']) { margin-block-start: ${space(4)}; }\n :host([space-above='lg']) { margin-block-start: ${space(6)}; }\n :host([space-above='xl']) { margin-block-start: ${space(8)}; }\n :host([space-above='2xl']) { margin-block-start: clamp(${space(14)}, 8vw, ${space(28)}); }\n :host([space-below='sm']) { margin-block-end: ${space(2)}; }\n :host([space-below='md']) { margin-block-end: ${space(4)}; }\n :host([space-below='lg']) { margin-block-end: ${space(6)}; }\n :host([space-below='xl']) { margin-block-end: ${space(8)}; }\n :host([space-below='2xl']) { margin-block-end: clamp(${space(14)}, 8vw, ${space(28)}); }\n`;\n","/**\n * Shared style fragments.\n *\n * Three of these carry an accessibility guarantee and are therefore not\n * negotiable per component: the focus ring, the minimum target size and the\n * reduced-motion rule. A component that wants its own focus treatment is a\n * component that will get it subtly wrong on one brand, so there is one.\n */\nimport { css } from 'lit';\nimport { t } from './tokens';\n\n/**\n * The focus ring.\n *\n * `:focus-visible` rather than `:focus`, so a mouse click on a button does not\n * draw a ring the user did not ask for while keyboard focus still does.\n *\n * The ring is two-tone — a light inner band inside a dark outer one — drawn\n * with `box-shadow` and a transparent `outline` behind it. The outline is not\n * decoration: it is what survives Windows High Contrast Mode, where box-shadow\n * is dropped entirely and a shadow-only ring disappears for exactly the users\n * who most need it.\n *\n * The colours come from locked tokens a brand cannot reach\n * ([ADR 0010](../../../../docs/decisions/0010-what-a-brand-may-set.md)).\n */\nexport const focusRing = css`\n :host(:focus-visible),\n :host(:not([disabled])) :focus-visible {\n outline: 2px solid transparent;\n outline-offset: ${t.focusOffset};\n box-shadow: ${t.focusShadow};\n }\n`;\n\n/**\n * WCAG 2.2, 2.5.8 Target Size (Minimum): 24 by 24 CSS pixels.\n *\n * Applied as a minimum rather than a fixed size so a control grows with its\n * content and never shrinks below the floor. It reads the locked token, which\n * is deliberately outside the spacing scale — otherwise a brand tightening its\n * spacing unit would shrink every tap target with it.\n */\nexport const targetSize = css`\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n`;\n\n/**\n * Visible to a screen reader, invisible on screen.\n *\n * `clip-path` with a 1px box rather than `display: none` or `visibility:\n * hidden`, both of which remove the text from the accessibility tree — which\n * is the one thing this must not do.\n */\nexport const visuallyHidden = css`\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n`;\n\n/**\n * 2.3.3 Animation from Interactions, and plain decency.\n *\n * `0.01ms` rather than `0` because a zero-duration transition does not fire a\n * `transitionend` event in every engine, and components that wait for one hang.\n */\nexport const reducedMotion = css`\n @media (prefers-reduced-motion: reduce) {\n :host,\n :host *,\n :host *::before,\n :host *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n scroll-behavior: auto !important;\n }\n }\n`;\n\n/** The base every component starts from. */\nexport const base = css`\n :host {\n box-sizing: border-box;\n font-family: ${t.fontBody};\n color: ${t.text};\n }\n :host([hidden]) {\n display: none !important;\n }\n *,\n *::before,\n *::after {\n box-sizing: inherit;\n }\n`;\n","import { LitElement, css } from 'lit';\nimport { base, reducedMotion } from './styles';\n\nlet counter = 0;\n\n/**\n * The base every Impkt component extends.\n *\n * It carries the two style fragments that are not a per-component choice — the\n * reset and the reduced-motion rule — and a stable id generator for the ARIA\n * wiring. It deliberately carries nothing else: a base class that grows\n * behaviour becomes the place every component's exceptions are negotiated.\n */\nexport class ImpktElement extends LitElement {\n static styles = [base, reducedMotion, css``];\n\n /**\n * A unique id for this instance, for `aria-describedby` and friends.\n *\n * Generated once in the constructor rather than in `render`, because an id\n * that changes between renders breaks the relationship it exists to express\n * — and it breaks it silently, since the markup still looks correct.\n */\n protected readonly uid = `impkt-${(counter += 1)}`;\n\n protected id_(part: string): string {\n return `${this.uid}-${part}`;\n }\n}\n"],"mappings":";AAmBA,SAAS,KAAK,iBAAiC;AAGxC,IAAM,QAAQ,CAAC,MAAc,aAClC,UAAU,eAAe,KAAK,QAAQ,OAAO,GAAG,CAAC,KAAK,QAAQ,GAAG;AAE5D,IAAM,I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 import {
|
|
|
2
2
|
ImpktElement,
|
|
3
3
|
spaceAround,
|
|
4
4
|
token
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NTNXHLTM.js";
|
|
6
6
|
|
|
7
7
|
// packages/ui/src/components/grid.ts
|
|
8
8
|
import { css, html } from "lit";
|
|
@@ -44,6 +44,7 @@ var ImpktGrid = class extends ImpktElement {
|
|
|
44
44
|
:host([gap='none']) .columns { gap: 0; }
|
|
45
45
|
:host([gap='sm']) .columns { gap: ${token("layout.gutter.sm", "8px")}; }
|
|
46
46
|
:host([gap='lg']) .columns { gap: ${token("layout.gutter.lg", "32px")}; }
|
|
47
|
+
:host([gap='xl']) .columns { gap: ${token("layout.gutter.xl", "48px")}; }
|
|
47
48
|
:host([align='start']) .columns { align-items: start; }
|
|
48
49
|
:host([align='center']) .columns { align-items: center; }
|
|
49
50
|
:host([align='end']) .columns { align-items: end; }
|
|
@@ -70,4 +71,4 @@ customElements.define("impkt-grid", ImpktGrid);
|
|
|
70
71
|
export {
|
|
71
72
|
ImpktGrid
|
|
72
73
|
};
|
|
73
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-OB7LC6NJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/grid.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { spaceAround, token } from '../base/tokens';\n\n/** Column widths as fractions, for each choice of `widths`. */\nconst WIDTHS: Record<string, string> = {\n '2:1': '2fr 1fr', '1:2': '1fr 2fr', '3:1': '3fr 1fr', '1:3': '1fr 3fr',\n '1:2:1': '1fr 2fr 1fr', '2:1:1': '2fr 1fr 1fr', '1:1:2': '1fr 1fr 2fr',\n};\n\n/**\n * A responsive row with named column slots. Child order stays inside each\n * column; changing a page's visual grid never reorders its reading sequence.\n *\n * Gutters come from the brand's layout, so every grid for a partner keeps the\n * same rhythm. Where the columns stack is a choice, because a three-column\n * row of cards may work on a tablet where two columns of long text do not.\n *\n * @category layout\n * @icon columns\n * @slot column-1 - First column.\n * @slot column-2 - Second column.\n * @slot column-3 - Third column.\n * @slot column-4 - Fourth column.\n */\nexport class ImpktGrid extends ImpktElement {\n static properties = {\n columns: { type: String, reflect: true },\n widths: { type: String, reflect: true },\n gap: { type: String, reflect: true },\n stackOn: { type: String, reflect: true, attribute: 'stack-on' },\n align: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare columns: 'one' | 'two' | 'three' | 'four' | 'sidebar-left' | 'sidebar-right';\n /** How wide each column is against the others. Applies when it has as many parts as there are columns. */\n declare widths: 'equal' | '2:1' | '1:2' | '3:1' | '1:3' | '1:2:1' | '2:1:1' | '1:1:2';\n /** The space between columns, from the brand's gutters. */\n declare gap: 'none' | 'sm' | 'md' | 'lg' | 'xl';\n /** The screens on which the columns stack, one above another, in column order. */\n declare stackOn: 'phone' | 'tablet' | 'never';\n /** How columns of different heights line up. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Space before the grid, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the grid, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n constructor() {\n super();\n this.columns = 'two';\n this.widths = 'equal';\n this.gap = 'md';\n this.stackOn = 'phone';\n this.align = 'stretch';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n static styles = [...ImpktElement.styles, spaceAround, css`\n :host { display: block; min-inline-size: 0; container-type: inline-size; }\n .columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${token('layout.gutter.md', '16px')}; align-items: stretch; }\n :host([gap='none']) .columns { gap: 0; }\n :host([gap='sm']) .columns { gap: ${token('layout.gutter.sm', '8px')}; }\n :host([gap='lg']) .columns { gap: ${token('layout.gutter.lg', '32px')}; }\n :host([gap='xl']) .columns { gap: ${token('layout.gutter.xl', '48px')}; }\n :host([align='start']) .columns { align-items: start; }\n :host([align='center']) .columns { align-items: center; }\n :host([align='end']) .columns { align-items: end; }\n :host([columns='one']) .columns { grid-template-columns: minmax(0, 1fr); }\n :host([columns='three']) .columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }\n :host([columns='four']) .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }\n :host([columns='sidebar-left']) .columns { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }\n :host([columns='sidebar-right']) .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }\n .column { min-inline-size: 0; overflow-wrap: anywhere; }\n ::slotted(*) { max-inline-size: 100%; }\n @container (max-width: 40rem) { :host(:not([stack-on='never'])) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n @container (max-width: 64rem) { :host([stack-on='tablet']) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n `];\n render() {\n const count = this.columns === 'one' ? 1 : this.columns === 'three' ? 3 : this.columns === 'four' ? 4 : 2;\n const fractions = WIDTHS[this.widths]?.split(' ');\n // A width split for a different number of columns would leave a column out, so it is ignored.\n const template = fractions && fractions.length === count ? fractions.map((f) => `minmax(0, ${f})`).join(' ') : '';\n return html`<div class=\"columns\" part=\"row\" style=${template ? `grid-template-columns: ${template}` : ''}>${Array.from({ length: count }, (_, i) => html`<div class=\"column\" part=\"column\"><slot name=${`column-${i + 1}`}></slot></div>`)}</div>`;\n }\n}\ncustomElements.define('impkt-grid', ImpktGrid);\ndeclare global { interface HTMLElementTagNameMap { 'impkt-grid': ImpktGrid } }\n"],"mappings":";;;;;;;AAAA,SAAS,KAAK,YAAY;AAK1B,IAAM,SAAiC;AAAA,EACrC,OAAO;AAAA,EAAW,OAAO;AAAA,EAAW,OAAO;AAAA,EAAW,OAAO;AAAA,EAC7D,SAAS;AAAA,EAAe,SAAS;AAAA,EAAe,SAAS;AAC3D;AAiBO,IAAM,YAA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