@atomic-ui/ui 0.10.1 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +9631 -6026
- package/dist/base/FieldElement.d.ts +10 -3
- package/dist/{chunk-YWP2Z3JN.js → chunk-2TNF7O43.js} +7 -5
- package/dist/{chunk-YWP2Z3JN.js.map → chunk-2TNF7O43.js.map} +1 -1
- package/dist/{chunk-FKUBEVCU.js → chunk-2WHOBIOY.js} +11 -9
- package/dist/{chunk-FKUBEVCU.js.map → chunk-2WHOBIOY.js.map} +1 -1
- package/dist/{chunk-26BO3W56.js → chunk-3BWCD5U5.js} +5 -3
- package/dist/{chunk-26BO3W56.js.map → chunk-3BWCD5U5.js.map} +1 -1
- package/dist/chunk-3GPGDERO.js +201 -0
- package/dist/chunk-3GPGDERO.js.map +1 -0
- package/dist/{chunk-3T7J66Z2.js → chunk-3KAFK24X.js} +13 -11
- package/dist/chunk-3KAFK24X.js.map +1 -0
- package/dist/chunk-4MMRBNW7.js +104 -0
- package/dist/chunk-4MMRBNW7.js.map +1 -0
- package/dist/{chunk-5OJAJA3U.js → chunk-5HCWL2YD.js} +6 -4
- package/dist/{chunk-5OJAJA3U.js.map → chunk-5HCWL2YD.js.map} +1 -1
- package/dist/{chunk-AG4EP3OY.js → chunk-5IGBH4GL.js} +8 -6
- package/dist/{chunk-AG4EP3OY.js.map → chunk-5IGBH4GL.js.map} +1 -1
- package/dist/{chunk-AL4IUSML.js → chunk-5OYQZWP2.js} +5 -3
- package/dist/{chunk-AL4IUSML.js.map → chunk-5OYQZWP2.js.map} +1 -1
- package/dist/chunk-5PRB7P7N.js +167 -0
- package/dist/chunk-5PRB7P7N.js.map +1 -0
- package/dist/chunk-6CDQSHVW.js +21 -0
- package/dist/chunk-6CDQSHVW.js.map +1 -0
- package/dist/{chunk-MLKNZL5J.js → chunk-6J22I7F6.js} +14 -12
- package/dist/chunk-6J22I7F6.js.map +1 -0
- package/dist/chunk-72WNCCDC.js +136 -0
- package/dist/chunk-72WNCCDC.js.map +1 -0
- package/dist/chunk-7UI3OBXL.js +104 -0
- package/dist/chunk-7UI3OBXL.js.map +1 -0
- package/dist/{chunk-D6NET2VB.js → chunk-ALFE35FS.js} +30 -3
- package/dist/chunk-ALFE35FS.js.map +1 -0
- package/dist/chunk-AYINRYNC.js +184 -0
- package/dist/chunk-AYINRYNC.js.map +1 -0
- package/dist/{chunk-2D2IMQII.js → chunk-BAYSDP44.js} +52 -30
- package/dist/chunk-BAYSDP44.js.map +1 -0
- package/dist/{chunk-2EP3IV3G.js → chunk-BGHAANTP.js} +22 -8
- package/dist/chunk-BGHAANTP.js.map +1 -0
- package/dist/{chunk-OJO62KRX.js → chunk-CFCFKLTN.js} +85 -10
- package/dist/chunk-CFCFKLTN.js.map +1 -0
- package/dist/{chunk-UFPI4I2Y.js → chunk-CQT3VPYK.js} +8 -29
- package/dist/chunk-CQT3VPYK.js.map +1 -0
- package/dist/{chunk-AURT72IC.js → chunk-DXLEYNID.js} +13 -7
- package/dist/chunk-DXLEYNID.js.map +1 -0
- package/dist/{chunk-L4CIBOGK.js → chunk-EKPTMRBG.js} +5 -3
- package/dist/{chunk-L4CIBOGK.js.map → chunk-EKPTMRBG.js.map} +1 -1
- package/dist/{chunk-Z2EWQMTR.js → chunk-F4IXELLK.js} +5 -3
- package/dist/{chunk-Z2EWQMTR.js.map → chunk-F4IXELLK.js.map} +1 -1
- package/dist/{chunk-APQEXM4I.js → chunk-FJHPGOGS.js} +5 -3
- package/dist/{chunk-APQEXM4I.js.map → chunk-FJHPGOGS.js.map} +1 -1
- package/dist/chunk-FLAUZU7Y.js +345 -0
- package/dist/chunk-FLAUZU7Y.js.map +1 -0
- package/dist/{chunk-3NEWOO2P.js → chunk-FZWUQC42.js} +7 -5
- package/dist/{chunk-3NEWOO2P.js.map → chunk-FZWUQC42.js.map} +1 -1
- package/dist/{chunk-ONED3PUB.js → chunk-HSXLSJVG.js} +54 -8
- package/dist/chunk-HSXLSJVG.js.map +1 -0
- package/dist/{chunk-V7EB7Q2M.js → chunk-JTCTQBAX.js} +2 -131
- package/dist/chunk-JTCTQBAX.js.map +1 -0
- package/dist/{chunk-ZL3JFUIE.js → chunk-K5QFVLCI.js} +7 -5
- package/dist/{chunk-ZL3JFUIE.js.map → chunk-K5QFVLCI.js.map} +1 -1
- package/dist/{chunk-DN5YZFSG.js → chunk-KE6WCXQP.js} +55 -9
- package/dist/chunk-KE6WCXQP.js.map +1 -0
- package/dist/chunk-LBHTXY7K.js +75 -0
- package/dist/chunk-LBHTXY7K.js.map +1 -0
- package/dist/{chunk-OZGKK3N5.js → chunk-LP4RTYTL.js} +88 -9
- package/dist/chunk-LP4RTYTL.js.map +1 -0
- package/dist/{chunk-MOO63SHZ.js → chunk-LXVPWTSY.js} +80 -23
- package/dist/chunk-LXVPWTSY.js.map +1 -0
- package/dist/{chunk-JNLKM3JT.js → chunk-N6EEW2GF.js} +6 -4
- package/dist/{chunk-JNLKM3JT.js.map → chunk-N6EEW2GF.js.map} +1 -1
- package/dist/chunk-NHEU5FT6.js +115 -0
- package/dist/chunk-NHEU5FT6.js.map +1 -0
- package/dist/chunk-QPOM7W3D.js +104 -0
- package/dist/chunk-QPOM7W3D.js.map +1 -0
- package/dist/{chunk-FU3CEHBS.js → chunk-R6PBY3YN.js} +6 -4
- package/dist/{chunk-FU3CEHBS.js.map → chunk-R6PBY3YN.js.map} +1 -1
- package/dist/{chunk-TJOYBDKS.js → chunk-R6YMSJR7.js} +65 -36
- package/dist/chunk-R6YMSJR7.js.map +1 -0
- package/dist/{chunk-ZEIV5X3U.js → chunk-SOYKSPPX.js} +73 -23
- package/dist/chunk-SOYKSPPX.js.map +1 -0
- package/dist/{chunk-NKMJMVZP.js → chunk-T52CUOCJ.js} +5 -3
- package/dist/{chunk-NKMJMVZP.js.map → chunk-T52CUOCJ.js.map} +1 -1
- package/dist/chunk-UBNCJROR.js +294 -0
- package/dist/chunk-UBNCJROR.js.map +1 -0
- package/dist/chunk-UFENSIWD.js +135 -0
- package/dist/chunk-UFENSIWD.js.map +1 -0
- package/dist/{chunk-A4M3A4SZ.js → chunk-UYTIJCCW.js} +10 -42
- package/dist/chunk-UYTIJCCW.js.map +1 -0
- package/dist/chunk-XX6JZW5N.js +36 -0
- package/dist/chunk-XX6JZW5N.js.map +1 -0
- package/dist/{chunk-2ZF3J7OO.js → chunk-XXSZL5CY.js} +17 -5
- package/dist/chunk-XXSZL5CY.js.map +1 -0
- package/dist/{chunk-6PMA6NHE.js → chunk-Y55FNQHS.js} +5 -3
- package/dist/{chunk-6PMA6NHE.js.map → chunk-Y55FNQHS.js.map} +1 -1
- package/dist/chunk-ZAWGJC4I.js +176 -0
- package/dist/chunk-ZAWGJC4I.js.map +1 -0
- package/dist/chunk-ZUQ3DOG2.js +110 -0
- package/dist/chunk-ZUQ3DOG2.js.map +1 -0
- package/dist/components/accordion.d.ts +22 -0
- package/dist/components/accordion.js +6 -2
- package/dist/components/alert.d.ts +22 -1
- package/dist/components/alert.js +3 -2
- package/dist/components/app-bar.d.ts +153 -0
- package/dist/components/app-bar.js +15 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-ui.d.ts +29 -2
- package/dist/components/app-ui.js +5 -4
- package/dist/components/badge.d.ts +17 -1
- package/dist/components/badge.js +4 -3
- package/dist/components/blocks.js +5 -4
- package/dist/components/button.d.ts +18 -2
- package/dist/components/button.js +4 -3
- package/dist/components/checkbox-group.js +4 -3
- package/dist/components/checkbox.js +4 -3
- package/dist/components/checked.d.ts +77 -0
- package/dist/components/checked.js +10 -0
- package/dist/components/checked.js.map +1 -0
- package/dist/components/chip-group.d.ts +113 -0
- package/dist/components/chip-group.js +11 -0
- package/dist/components/chip-group.js.map +1 -0
- package/dist/components/chip.d.ts +11 -0
- package/dist/components/chip.js +3 -2
- package/dist/components/code-diff.d.ts +77 -0
- package/dist/components/code-diff.js +10 -0
- package/dist/components/code-diff.js.map +1 -0
- package/dist/components/date-input.js +4 -3
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.js +3 -2
- package/dist/components/fieldset.js +3 -2
- package/dist/components/grid.js +3 -2
- package/dist/components/help.js +3 -2
- package/dist/components/icon.js +3 -2
- package/dist/components/journey.js +4 -3
- package/dist/components/language-switch.d.ts +59 -0
- package/dist/components/language-switch.js +10 -0
- package/dist/components/language-switch.js.map +1 -0
- package/dist/components/layout.d.ts +8 -2
- package/dist/components/layout.js +3 -2
- package/dist/components/link.js +4 -3
- package/dist/components/list.js +3 -2
- package/dist/components/media.js +3 -2
- package/dist/components/meter.d.ts +112 -0
- package/dist/components/meter.js +13 -0
- package/dist/components/meter.js.map +1 -0
- package/dist/components/navigation.d.ts +52 -0
- package/dist/components/navigation.js +4 -3
- package/dist/components/page.d.ts +13 -8
- package/dist/components/page.js +3 -2
- package/dist/components/price.js +3 -2
- package/dist/components/progress.d.ts +16 -2
- package/dist/components/progress.js +3 -2
- package/dist/components/radio-group.js +4 -3
- package/dist/components/redaction.d.ts +51 -0
- package/dist/components/redaction.js +10 -0
- package/dist/components/redaction.js.map +1 -0
- package/dist/components/rows.d.ts +28 -0
- package/dist/components/rows.js +7 -3
- package/dist/components/select.d.ts +6 -0
- package/dist/components/select.js +4 -3
- package/dist/components/shell.js +4 -3
- package/dist/components/source.d.ts +68 -0
- package/dist/components/source.js +10 -0
- package/dist/components/source.js.map +1 -0
- package/dist/components/status-pill-style.d.ts +16 -0
- package/dist/components/status-pill-style.js +15 -0
- package/dist/components/status-pill-style.js.map +1 -0
- package/dist/components/status.d.ts +66 -0
- package/dist/components/status.js +10 -0
- package/dist/components/status.js.map +1 -0
- package/dist/components/summary-list.js +3 -2
- package/dist/components/switch.js +4 -3
- package/dist/components/table.d.ts +19 -0
- package/dist/components/table.js +4 -3
- package/dist/components/text-input.js +5 -4
- package/dist/components/textarea.d.ts +5 -0
- package/dist/components/textarea.js +4 -3
- package/dist/components/tool-card.d.ts +107 -0
- package/dist/components/tool-card.js +11 -0
- package/dist/components/tool-card.js.map +1 -0
- package/dist/components/tool-kit-tokens.d.ts +25 -0
- package/dist/components/tool-kit-tokens.js +8 -0
- package/dist/components/tool-kit-tokens.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +116 -70
- package/dist/standalone/atomic-ui.js +2030 -692
- package/dist/standalone/atomic-ui.js.map +4 -4
- package/package.json +2 -2
- package/dist/chunk-2D2IMQII.js.map +0 -1
- package/dist/chunk-2EP3IV3G.js.map +0 -1
- package/dist/chunk-2ZF3J7OO.js.map +0 -1
- package/dist/chunk-3T7J66Z2.js.map +0 -1
- package/dist/chunk-7UWJXPR3.js +0 -97
- package/dist/chunk-7UWJXPR3.js.map +0 -1
- package/dist/chunk-A4M3A4SZ.js.map +0 -1
- package/dist/chunk-AURT72IC.js.map +0 -1
- package/dist/chunk-AYKYHZGQ.js +0 -108
- package/dist/chunk-AYKYHZGQ.js.map +0 -1
- package/dist/chunk-D6NET2VB.js.map +0 -1
- package/dist/chunk-DN5YZFSG.js.map +0 -1
- package/dist/chunk-MLKNZL5J.js.map +0 -1
- package/dist/chunk-MOO63SHZ.js.map +0 -1
- package/dist/chunk-OJO62KRX.js.map +0 -1
- package/dist/chunk-ONED3PUB.js.map +0 -1
- package/dist/chunk-OZGKK3N5.js.map +0 -1
- package/dist/chunk-QU3U2CS2.js +0 -144
- package/dist/chunk-QU3U2CS2.js.map +0 -1
- package/dist/chunk-TJOYBDKS.js.map +0 -1
- package/dist/chunk-UFPI4I2Y.js.map +0 -1
- package/dist/chunk-V7EB7Q2M.js.map +0 -1
- package/dist/chunk-ZEIV5X3U.js.map +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ImpaktElement,
|
|
3
3
|
focusRing,
|
|
4
|
+
touchTarget
|
|
5
|
+
} from "./chunk-72WNCCDC.js";
|
|
6
|
+
import {
|
|
4
7
|
fontSize,
|
|
5
8
|
fontWeight,
|
|
6
9
|
space,
|
|
7
|
-
t
|
|
8
|
-
|
|
9
|
-
} from "./chunk-V7EB7Q2M.js";
|
|
10
|
+
t
|
|
11
|
+
} from "./chunk-JTCTQBAX.js";
|
|
10
12
|
|
|
11
13
|
// packages/ui/src/components/summary-list.ts
|
|
12
14
|
import { html, css, nothing } from "lit";
|
|
@@ -120,4 +122,4 @@ customElements.define("impakt-summary-list", ImpaktSummaryList);
|
|
|
120
122
|
export {
|
|
121
123
|
ImpaktSummaryList
|
|
122
124
|
};
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
125
|
+
//# sourceMappingURL=chunk-R6PBY3YN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/summary-list.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, touchTarget } 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 ImpaktSummaryList extends ImpaktElement {\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 ...ImpaktElement.styles,\n focusRing,\n touchTarget('dd a'),\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-flex;\n align-items: center;\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 ${\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 }\n </dd>\n </div>\n `,\n )}\n </dl>\n `;\n }\n}\n\ncustomElements.define('impakt-summary-list', ImpaktSummaryList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-summary-list': ImpaktSummaryList;\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/summary-list.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, touchTarget } 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 ImpaktSummaryList extends ImpaktElement {\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 ...ImpaktElement.styles,\n focusRing,\n touchTarget('dd a'),\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-flex;\n align-items: center;\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 ${\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 }\n </dd>\n </div>\n `,\n )}\n </dl>\n `;\n }\n}\n\ncustomElements.define('impakt-summary-list', ImpaktSummaryList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-summary-list': ImpaktSummaryList;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA8BjD,IAAM,oBAAN,cAAgC,cAAc;AAAA,EACnD;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,cAAc;AAAA,MACjB;AAAA,MACA,YAAY,MAAM;AAAA,MAClB;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;AAAA,0BAKG,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,kBAEf,IAAI,aACA,eAAe,IAAI,UAAU;AAAA,yBAC1B,KAAK,UAAU,0BAA0B,IAAI,GAAG;AAAA,yBAEnD,OACN;AAAA;AAAA;AAAA;AAAA,IAIR,CAAC;AAAA;AAAA;AAAA,EAGP;AACF;AAEA,eAAe,OAAO,uBAAuB,iBAAiB;","names":[]}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
iconSvg
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5OYQZWP2.js";
|
|
4
4
|
import {
|
|
5
5
|
ImpaktElement,
|
|
6
6
|
focusRing,
|
|
7
|
+
targetSize,
|
|
8
|
+
touchTarget,
|
|
9
|
+
visuallyHidden
|
|
10
|
+
} from "./chunk-72WNCCDC.js";
|
|
11
|
+
import {
|
|
12
|
+
fontSize,
|
|
7
13
|
fontWeight,
|
|
8
14
|
space,
|
|
9
15
|
t,
|
|
10
|
-
targetSize,
|
|
11
16
|
token,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
visuallyHidden
|
|
15
|
-
} from "./chunk-V7EB7Q2M.js";
|
|
17
|
+
type
|
|
18
|
+
} from "./chunk-JTCTQBAX.js";
|
|
16
19
|
|
|
17
20
|
// packages/ui/src/components/button.ts
|
|
18
21
|
import { html, css, nothing } from "lit";
|
|
22
|
+
var INVERSE = token("color.text.inverse", "var(--impakt-solid-card, var(--impakt-color-surface-card, #ffffff))");
|
|
19
23
|
var ImpaktButton = class extends ImpaktElement {
|
|
20
24
|
constructor() {
|
|
21
25
|
super();
|
|
@@ -34,6 +38,8 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
34
38
|
this.href = "";
|
|
35
39
|
this.icon = "none";
|
|
36
40
|
this.label = "";
|
|
41
|
+
this.spread = false;
|
|
42
|
+
this.centred = false;
|
|
37
43
|
try {
|
|
38
44
|
this.internals = this.attachInternals();
|
|
39
45
|
} catch {
|
|
@@ -58,7 +64,9 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
58
64
|
iconAfter: { type: String, attribute: "icon-after" },
|
|
59
65
|
href: { type: String },
|
|
60
66
|
icon: { type: String },
|
|
61
|
-
label: { type: String }
|
|
67
|
+
label: { type: String },
|
|
68
|
+
spread: { type: Boolean, reflect: true },
|
|
69
|
+
centred: { type: Boolean, reflect: true }
|
|
62
70
|
};
|
|
63
71
|
}
|
|
64
72
|
static {
|
|
@@ -82,20 +90,24 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
82
90
|
display: inline-flex;
|
|
83
91
|
align-items: center;
|
|
84
92
|
justify-content: center;
|
|
85
|
-
gap: ${space(
|
|
93
|
+
gap: ${space(3)};
|
|
86
94
|
inline-size: 100%;
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
/* G2: Archivo Medium 16, 14 by 20, about 47px tall. */
|
|
96
|
+
min-block-size: 44px;
|
|
97
|
+
padding: 14px ${space(5)};
|
|
89
98
|
font-family: inherit;
|
|
90
|
-
${
|
|
91
|
-
|
|
99
|
+
font-size: ${fontSize("md")};
|
|
100
|
+
line-height: 1.2;
|
|
101
|
+
font-weight: ${fontWeight("medium")};
|
|
92
102
|
border-radius: ${t.radiusLg};
|
|
93
103
|
border: ${t.borderThin} solid transparent;
|
|
94
104
|
cursor: pointer;
|
|
95
105
|
transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;
|
|
96
106
|
}
|
|
97
|
-
:host([size='sm']) :is(button, a) { min-block-size: 32px; padding: ${space(1)} ${space(3)}; ${type("sm")} gap: ${space(1.5)}; }
|
|
98
|
-
:host([size='lg']) :is(button, a) { min-block-size:
|
|
107
|
+
:host([size='sm']) :is(button, a) { min-block-size: 32px; padding: ${space(1.5)} ${space(3)}; ${type("sm")} gap: ${space(1.5)}; }
|
|
108
|
+
:host([size='lg']) :is(button, a) { min-block-size: 56px; padding: ${space(4)} ${space(6)}; ${type("lg")} }
|
|
109
|
+
/* Spread: the words at the start, the trailing icon at the far end. A full-width button spreads unless it is centred. */
|
|
110
|
+
:host([spread]) :is(button, a), :host([full]:not([centred])) :is(button, a) { justify-content: space-between; text-align: start; }
|
|
99
111
|
.icon { flex: none; inline-size: 1.15em; block-size: 1.15em; }
|
|
100
112
|
/* The cursor is the only thing that changes while busy. Moving or
|
|
101
113
|
recolouring a control the moment it is pressed is how a user loses it. */
|
|
@@ -107,30 +119,28 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
107
119
|
opacity: 0.5;
|
|
108
120
|
}
|
|
109
121
|
|
|
110
|
-
/* Solid: the brand,
|
|
122
|
+
/* Solid: the brand, flat. On an ink band the band sets the brand to the paper, so it reads "Light". */
|
|
111
123
|
.primary {
|
|
112
|
-
background: ${t.brand};
|
|
113
|
-
color: ${t.onBrand};
|
|
114
|
-
box-shadow: ${t.shadowXs}, inset 0 1px 0 0 rgb(255 255 255 / 0.12);
|
|
124
|
+
background: var(--impakt-button-primary, ${t.brand});
|
|
125
|
+
color: var(--impakt-button-on-primary, ${t.onBrand});
|
|
115
126
|
}
|
|
116
127
|
.primary:hover:not([aria-disabled='true']) {
|
|
117
|
-
background: var(--impakt-color-action-hover, ${t.brandHover});
|
|
118
|
-
color: var(--impakt-color-action-on-hover, ${t.onBrand});
|
|
128
|
+
background: var(--impakt-button-primary-hover, var(--impakt-color-action-hover, ${t.brandHover}));
|
|
129
|
+
color: var(--impakt-button-on-primary, var(--impakt-color-action-on-hover, ${t.onBrand}));
|
|
119
130
|
}
|
|
120
131
|
/* A brand whose buttons turn on hover lifts the trailing arrow a quarter-turn. */
|
|
121
132
|
.after { transition: transform 160ms ease-out; }
|
|
122
133
|
:is(button, a):hover:not([aria-disabled='true']) .after { transform: rotate(var(--impakt-motion-button-turn, 0deg)); }
|
|
123
134
|
@media (prefers-reduced-motion: reduce) { .after { transition: none; } }
|
|
124
135
|
.primary:active:not([aria-disabled='true']) {
|
|
125
|
-
background: ${t.brandActive};
|
|
136
|
+
background: var(--impakt-button-primary-hover, ${t.brandActive});
|
|
126
137
|
}
|
|
127
138
|
|
|
128
139
|
/* Outline: the card, a hairline border and the text colour, for the second choice. */
|
|
129
140
|
.secondary {
|
|
130
141
|
background: ${t.surfaceCard};
|
|
131
142
|
color: ${t.text};
|
|
132
|
-
border-color: ${t.
|
|
133
|
-
box-shadow: ${t.shadowXs};
|
|
143
|
+
border-color: ${t.text};
|
|
134
144
|
}
|
|
135
145
|
.secondary:hover:not([aria-disabled='true']) {
|
|
136
146
|
background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%);
|
|
@@ -146,16 +156,35 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
146
156
|
background: ${t.wash};
|
|
147
157
|
}
|
|
148
158
|
|
|
149
|
-
/*
|
|
159
|
+
/*
|
|
160
|
+
* Dark: the text colour as a fill, the strong second choice on a light page.
|
|
161
|
+
* Its words are the colour that reads on the text colour, which a toned band
|
|
162
|
+
* sets as --impakt-color-text-inverse. They are never the card colour, which
|
|
163
|
+
* a band repaints as a faint wash of its own text, and which left ink words at
|
|
164
|
+
* 10% on an ink fill when this button sat in a banner on an accent band.
|
|
165
|
+
*/
|
|
150
166
|
.dark {
|
|
151
167
|
background: ${t.text};
|
|
152
|
-
color: ${
|
|
168
|
+
color: ${INVERSE};
|
|
153
169
|
}
|
|
154
170
|
.dark:hover:not([aria-disabled='true']) {
|
|
155
|
-
background: color-mix(in srgb, ${t.text}, ${
|
|
171
|
+
background: color-mix(in srgb, ${t.text}, ${INVERSE} 14%);
|
|
156
172
|
}
|
|
157
173
|
.dark:active:not([aria-disabled='true']) {
|
|
158
|
-
background: color-mix(in srgb, ${t.text}, ${
|
|
174
|
+
background: color-mix(in srgb, ${t.text}, ${INVERSE} 24%);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* Outline: transparent, a 1px border and words in the text colour, the design's "Ghost". On an ink band both are the paper. */
|
|
178
|
+
.outline {
|
|
179
|
+
background: transparent;
|
|
180
|
+
color: ${t.text};
|
|
181
|
+
border-color: ${t.text};
|
|
182
|
+
}
|
|
183
|
+
.outline:hover:not([aria-disabled='true']) {
|
|
184
|
+
background: ${t.wash};
|
|
185
|
+
}
|
|
186
|
+
.outline:active:not([aria-disabled='true']) {
|
|
187
|
+
background: color-mix(in srgb, ${t.text} 10%, transparent);
|
|
159
188
|
}
|
|
160
189
|
|
|
161
190
|
/* Subtle: a quiet fill, for an action that sits beside the main one. */
|
|
@@ -185,7 +214,7 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
185
214
|
/* Danger: the danger text colour as a fill, so white words on it keep 4.5:1. */
|
|
186
215
|
.danger {
|
|
187
216
|
background: ${t.dangerText};
|
|
188
|
-
color: ${t.surfaceCard};
|
|
217
|
+
color: var(--impakt-solid-card, ${t.surfaceCard});
|
|
189
218
|
}
|
|
190
219
|
.danger:hover:not([aria-disabled='true']) {
|
|
191
220
|
background: color-mix(in srgb, ${t.dangerText}, ${t.text} 15%);
|
|
@@ -194,17 +223,17 @@ var ImpaktButton = class extends ImpaktElement {
|
|
|
194
223
|
background: color-mix(in srgb, ${t.dangerText}, ${t.text} 28%);
|
|
195
224
|
}
|
|
196
225
|
|
|
197
|
-
/* Icon only:
|
|
226
|
+
/* Icon only: as tall as it is wide, round where the brand rounds its corners and square under Noire. */
|
|
198
227
|
.icon-only {
|
|
199
|
-
inline-size:
|
|
200
|
-
min-inline-size:
|
|
201
|
-
block-size:
|
|
202
|
-
min-block-size:
|
|
228
|
+
inline-size: 47px;
|
|
229
|
+
min-inline-size: 47px;
|
|
230
|
+
block-size: 47px;
|
|
231
|
+
min-block-size: 47px;
|
|
203
232
|
padding: 0;
|
|
204
|
-
border-radius:
|
|
233
|
+
border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999));
|
|
205
234
|
}
|
|
206
235
|
:host([size='sm']) .icon-only { inline-size: 32px; min-inline-size: 32px; block-size: 32px; min-block-size: 32px; padding: 0; }
|
|
207
|
-
:host([size='lg']) .icon-only { inline-size:
|
|
236
|
+
:host([size='lg']) .icon-only { inline-size: 56px; min-inline-size: 56px; block-size: 56px; min-block-size: 56px; padding: 0; }
|
|
208
237
|
|
|
209
238
|
.sr-only {
|
|
210
239
|
${visuallyHidden}
|
|
@@ -279,4 +308,4 @@ customElements.define("impakt-button", ImpaktButton);
|
|
|
279
308
|
export {
|
|
280
309
|
ImpaktButton
|
|
281
310
|
};
|
|
282
|
-
//# sourceMappingURL=chunk-
|
|
311
|
+
//# sourceMappingURL=chunk-R6YMSJR7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/button.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token, type } from '../base/tokens';\n\n/**\n * The colour that reads on the text colour: the card, unless a toned band says\n * otherwise. An ink band sets it to the ink, an accent band to the card.\n */\nconst INVERSE = token('color.text.inverse', 'var(--impakt-solid-card, var(--impakt-color-surface-card, #ffffff))');\nimport { iconSvg } from './icon';\n\n/**\n * A button.\n *\n * Two decisions carry the accessibility weight here.\n *\n * **A busy button is not a disabled button.** While an action is in flight the\n * control keeps its place in the tab order and reports `aria-disabled`, rather\n * than taking the native `disabled` attribute. A natively disabled element is\n * removed from the tab order, so a keyboard user who had just activated it\n * loses their focus position to the top of the document — at precisely the\n * moment something is happening that they need to be told about. Activation is\n * blocked in the handler instead.\n *\n * **It renders a real `<button>`.** A `<div role=\"button\">` needs Enter and\n * Space handling, a tabindex, and a disabled story, and it will still not\n * submit a form. The native element already has all of that, correctly, in\n * every browser and every assistive technology.\n\n *\n * **A button that goes somewhere is a link.** With `href` set it renders an\n * `<a>` styled as a button, so it opens in a new tab, shows its address and is\n * announced as a link, which is what it is.\n *\n * **An icon-only button still has a name.** With `icon` set and no words, the\n * button shows the icon alone and `label` becomes its accessible name, so a\n * screen reader says \"Back\" rather than \"button\". Without a `label` an\n * icon-only button is not rendered as icon-only, because it would be nameless\n * (4.1.2).\n *\n * @category action\n * @icon button\n * @slot - The button label.\n * @fires click - When the button is pressed. Not while it is busy or disabled.\n */\nexport class ImpaktButton extends ImpaktElement {\n static formAssociated = true;\n\n static properties = {\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n variant: { type: String, reflect: true },\n type: { type: String },\n disabled: { type: Boolean, reflect: true },\n busy: { type: Boolean, reflect: true },\n busyLabel: { type: String, attribute: 'busy-label' },\n full: { type: Boolean, reflect: true },\n fullOnPhone: { type: Boolean, attribute: 'full-on-phone', reflect: true },\n size: { type: String, reflect: true },\n iconBefore: { type: String, attribute: 'icon-before' },\n iconAfter: { type: String, attribute: 'icon-after' },\n href: { type: String },\n icon: { type: String },\n label: { type: String },\n spread: { type: Boolean, reflect: true },\n centred: { type: Boolean, reflect: true },\n };\n\n /** Leave it out on a phone, where a header has no room for it. */\n declare hideOn: 'never' | 'phone';\n /**\n * How much the button asks for attention. `dark` is the strong second\n * choice on a light page, `subtle` a quiet filled one, `danger` an\n * action that removes or cancels something, and `accent` the brand's\n * second colour, for the one action a page is built around.\n */\n declare variant: 'primary' | 'secondary' | 'ghost' | 'dark' | 'subtle' | 'danger' | 'accent' | 'outline';\n /**\n * Put the words at the start and the trailing icon at the far end, as the\n * G2 buttons that run the width of a form or a card do. A `full` button\n * spreads anyway; set `centred` on it to keep its words in the middle.\n */\n declare spread: boolean;\n /** Keep a `full` button's words in the middle rather than spread. */\n declare centred: boolean;\n declare type: 'button' | 'submit' | 'reset';\n declare disabled: boolean;\n declare busy: boolean;\n /** Announced when the button becomes busy. Says what is happening, not that something is. */\n declare busyLabel: string;\n declare full: boolean;\n /** As wide as its space on a phone only, such as a form's send button. */\n declare fullOnPhone: boolean;\n declare size: 'sm' | 'md' | 'lg';\n /** An icon before the words, such as phone or calendar. */\n declare iconBefore:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** An icon after the words, such as arrow-right. */\n declare iconAfter:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** Where the button goes, when it opens a page rather than doing something here. */\n declare href: string;\n /** Draws the button as this icon alone, a square button (round where the brand rounds its corners). Needs `label`. */\n declare icon:\n | 'none'\n | 'arrow-right'\n | 'arrow-left'\n | 'chevron-right'\n | 'chevron-down'\n | 'check'\n | 'close'\n | 'menu'\n | 'plus'\n | 'minus'\n | 'search'\n | 'external'\n | 'download'\n | 'home'\n | 'phone'\n | 'mail'\n | 'map-pin'\n | 'calendar'\n | 'clock'\n | 'user'\n | 'star'\n | 'heart'\n | 'shield'\n | 'leaf'\n | 'sun'\n | 'bolt'\n | 'key'\n | 'info'\n | 'warning'\n | 'document'\n | 'pound'\n | 'chat'\n | 'grid'\n | 'clipboard'\n | 'map-pinned'\n | 'users'\n | 'radio'\n | 'settings'\n | 'log-out'\n | 'arrow-up-right'\n | 'more'\n | 'upload'\n | 'image'\n | 'lock'\n | 'eye'\n | 'trash'\n | 'pencil'\n | 'qr-code'\n | 'battery';\n /** The accessible name of an icon-only button, such as \"Back\" or \"More actions\". */\n declare label: string;\n\n private internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.variant = 'primary';\n this.type = 'button';\n this.disabled = false;\n this.busy = false;\n this.busyLabel = 'Working';\n this.full = false;\n this.fullOnPhone = false;\n this.size = 'md';\n this.iconBefore = 'none';\n this.iconAfter = 'none';\n this.href = '';\n this.icon = 'none';\n this.label = '';\n this.spread = false;\n this.centred = false;\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('button, a'),\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n :host {\n display: inline-block;\n }\n :host([full]) {\n display: block;\n }\n @media (max-width: 40rem) { :host([full-on-phone]) { display: block; } }\n button, a {\n ${targetSize}\n box-sizing: border-box;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ${space(3)};\n inline-size: 100%;\n /* G2: Archivo Medium 16, 14 by 20, about 47px tall. */\n min-block-size: 44px;\n padding: 14px ${space(5)};\n font-family: inherit;\n font-size: ${fontSize('md')};\n line-height: 1.2;\n font-weight: ${fontWeight('medium')};\n border-radius: ${t.radiusLg};\n border: ${t.borderThin} solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n :host([size='sm']) :is(button, a) { min-block-size: 32px; padding: ${space(1.5)} ${space(3)}; ${type('sm')} gap: ${space(1.5)}; }\n :host([size='lg']) :is(button, a) { min-block-size: 56px; padding: ${space(4)} ${space(6)}; ${type('lg')} }\n /* Spread: the words at the start, the trailing icon at the far end. A full-width button spreads unless it is centred. */\n :host([spread]) :is(button, a), :host([full]:not([centred])) :is(button, a) { justify-content: space-between; text-align: start; }\n .icon { flex: none; inline-size: 1.15em; block-size: 1.15em; }\n /* The cursor is the only thing that changes while busy. Moving or\n recolouring a control the moment it is pressed is how a user loses it. */\n button[aria-disabled='true'] {\n cursor: progress;\n }\n :host([disabled]) button {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n /* Solid: the brand, flat. On an ink band the band sets the brand to the paper, so it reads \"Light\". */\n .primary {\n background: var(--impakt-button-primary, ${t.brand});\n color: var(--impakt-button-on-primary, ${t.onBrand});\n }\n .primary:hover:not([aria-disabled='true']) {\n background: var(--impakt-button-primary-hover, var(--impakt-color-action-hover, ${t.brandHover}));\n color: var(--impakt-button-on-primary, var(--impakt-color-action-on-hover, ${t.onBrand}));\n }\n /* A brand whose buttons turn on hover lifts the trailing arrow a quarter-turn. */\n .after { transition: transform 160ms ease-out; }\n :is(button, a):hover:not([aria-disabled='true']) .after { transform: rotate(var(--impakt-motion-button-turn, 0deg)); }\n @media (prefers-reduced-motion: reduce) { .after { transition: none; } }\n .primary:active:not([aria-disabled='true']) {\n background: var(--impakt-button-primary-hover, ${t.brandActive});\n }\n\n /* Outline: the card, a hairline border and the text colour, for the second choice. */\n .secondary {\n background: ${t.surfaceCard};\n color: ${t.text};\n border-color: ${t.text};\n }\n .secondary:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%);\n border-color: color-mix(in srgb, ${t.text} 25%, transparent);\n }\n\n /* Plain: words only until it is pointed at. */\n .ghost {\n background: transparent;\n color: ${t.link};\n }\n .ghost:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n\n /*\n * Dark: the text colour as a fill, the strong second choice on a light page.\n * Its words are the colour that reads on the text colour, which a toned band\n * sets as --impakt-color-text-inverse. They are never the card colour, which\n * a band repaints as a faint wash of its own text, and which left ink words at\n * 10% on an ink fill when this button sat in a banner on an accent band.\n */\n .dark {\n background: ${t.text};\n color: ${INVERSE};\n }\n .dark:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${INVERSE} 14%);\n }\n .dark:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text}, ${INVERSE} 24%);\n }\n\n /* Outline: transparent, a 1px border and words in the text colour, the design's \"Ghost\". On an ink band both are the paper. */\n .outline {\n background: transparent;\n color: ${t.text};\n border-color: ${t.text};\n }\n .outline:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n .outline:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.text} 10%, transparent);\n }\n\n /* Subtle: a quiet fill, for an action that sits beside the main one. */\n .subtle {\n background: ${t.surfaceInset};\n color: ${t.text};\n }\n .subtle:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 6%);\n }\n .subtle:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceInset}, ${t.text} 12%);\n }\n\n /* Accent: the brand's second colour as a fill, for the one action a page is built around. The words on it are the colour the tokens measured against it. */\n .accent {\n background: ${token('color.accent.default', '#ffd43b')};\n color: ${token('color.accent.on', '#1a1a1a')};\n }\n .accent:hover:not([aria-disabled='true']) {\n background: ${token('color.accent.hover', '#e0bb34')};\n }\n .accent:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${token('color.accent.hover', '#e0bb34')}, ${token('color.accent.on', '#1a1a1a')} 10%);\n }\n\n /* Danger: the danger text colour as a fill, so white words on it keep 4.5:1. */\n .danger {\n background: ${t.dangerText};\n color: var(--impakt-solid-card, ${t.surfaceCard});\n }\n .danger:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 15%);\n }\n .danger:active:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.dangerText}, ${t.text} 28%);\n }\n\n /* Icon only: as tall as it is wide, round where the brand rounds its corners and square under Noire. */\n .icon-only {\n inline-size: 47px;\n min-inline-size: 47px;\n block-size: 47px;\n min-block-size: 47px;\n padding: 0;\n border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999));\n }\n :host([size='sm']) .icon-only { inline-size: 32px; min-inline-size: 32px; block-size: 32px; min-block-size: 32px; padding: 0; }\n :host([size='lg']) .icon-only { inline-size: 56px; min-inline-size: 56px; block-size: 56px; min-block-size: 56px; padding: 0; }\n\n .sr-only {\n ${visuallyHidden}\n }\n\n /* Windows High Contrast Mode drops background and border colours, so a\n button styled only by background becomes invisible. A forced-colors\n border puts the boundary back. */\n @media (forced-colors: active) {\n button, a {\n border-color: ButtonBorder;\n }\n }\n `,\n ];\n\n private onClick(event: MouseEvent): void {\n if (this.disabled || this.busy) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n // A shadow-rooted button does not submit the outer form by itself, because\n // the click never reaches it. `requestSubmit` rather than `submit` so that\n // native validation and the submit event both still run.\n if (this.type === 'submit') this.internals?.form?.requestSubmit();\n if (this.type === 'reset') this.internals?.form?.reset();\n }\n\n render(): TemplateResult {\n const iconOnly = Boolean(this.icon && this.icon !== 'none' && this.label);\n const cls = iconOnly ? `${this.variant} icon-only` : this.variant;\n if (iconOnly) {\n const drawn = iconSvg(this.icon);\n if (this.href && !this.disabled) {\n return html`<a class=${cls} href=${this.href} part=\"button\" aria-label=${this.label}>${drawn}</a>`;\n }\n return html`\n <button\n class=${cls}\n type=\"button\"\n part=\"button\"\n aria-label=${this.label}\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${drawn}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n const words = html`${iconSvg(this.iconBefore)}<slot></slot>${this.iconAfter && this.iconAfter !== 'none' ? html`<span class=\"after\" aria-hidden=\"true\">${iconSvg(this.iconAfter)}</span>` : nothing}`;\n if (this.href && !this.disabled) {\n return html`<a class=${this.variant} href=${this.href} part=\"button\">${words}</a>`;\n }\n return html`\n <button\n class=${this.variant}\n type=\"button\"\n part=\"button\"\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${words}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n}\n\ncustomElements.define('impakt-button', ImpaktButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-button': ImpaktButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AASxD,IAAM,UAAU,MAAM,sBAAsB,qEAAqE;AAqC1G,IAAM,eAAN,cAA2B,cAAc;AAAA,EAgN9C,cAAc;AACZ,UAAM;AAHR,SAAQ,YAAqC;AAI3C,SAAK,SAAS;AACd,SAAK,UAAU;AACf,SAAK,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AY,OAAO;AAAA;AAAA;AAAA,EAGlF;AACF;AAEA,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
|
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pageLocale
|
|
3
3
|
} from "./chunk-UNGAG44M.js";
|
|
4
|
+
import {
|
|
5
|
+
FieldElement
|
|
6
|
+
} from "./chunk-HSXLSJVG.js";
|
|
4
7
|
import {
|
|
5
8
|
lockScroll,
|
|
6
9
|
unlockScroll
|
|
7
10
|
} from "./chunk-2YRTFWW2.js";
|
|
8
11
|
import {
|
|
9
12
|
iconSvg
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import {
|
|
12
|
-
FieldElement
|
|
13
|
-
} from "./chunk-ONED3PUB.js";
|
|
13
|
+
} from "./chunk-5OYQZWP2.js";
|
|
14
14
|
import {
|
|
15
15
|
ImpaktElement,
|
|
16
16
|
focusRing,
|
|
17
|
-
fontWeight,
|
|
18
17
|
say,
|
|
19
|
-
space,
|
|
20
|
-
spaceAround,
|
|
21
|
-
t,
|
|
22
18
|
targetSize,
|
|
23
19
|
touchTarget,
|
|
24
|
-
type,
|
|
25
20
|
visuallyHidden
|
|
26
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-72WNCCDC.js";
|
|
22
|
+
import {
|
|
23
|
+
fontWeight,
|
|
24
|
+
space,
|
|
25
|
+
spaceAround,
|
|
26
|
+
t,
|
|
27
|
+
type
|
|
28
|
+
} from "./chunk-JTCTQBAX.js";
|
|
27
29
|
|
|
28
30
|
// packages/ui/src/components/app-ui.ts
|
|
29
|
-
import { css, html, nothing } from "lit";
|
|
31
|
+
import { css, html, nothing, unsafeCSS } from "lit";
|
|
30
32
|
var ImpaktDrawer = class extends ImpaktElement {
|
|
31
33
|
constructor() {
|
|
32
34
|
super();
|
|
@@ -206,6 +208,7 @@ var ImpaktToast = class extends ImpaktElement {
|
|
|
206
208
|
</div>`;
|
|
207
209
|
}
|
|
208
210
|
};
|
|
211
|
+
var LINE_SOFT = unsafeCSS("var(--impakt-color-line-soft, #dcdcd8)");
|
|
209
212
|
var ImpaktMenu = class extends ImpaktElement {
|
|
210
213
|
constructor() {
|
|
211
214
|
super();
|
|
@@ -217,6 +220,7 @@ var ImpaktMenu = class extends ImpaktElement {
|
|
|
217
220
|
this.items = [];
|
|
218
221
|
this.edge = "start";
|
|
219
222
|
this.open = false;
|
|
223
|
+
this.triggerLook = "button";
|
|
220
224
|
}
|
|
221
225
|
static {
|
|
222
226
|
this.properties = {
|
|
@@ -224,7 +228,8 @@ var ImpaktMenu = class extends ImpaktElement {
|
|
|
224
228
|
icon: { type: String },
|
|
225
229
|
items: { type: Array },
|
|
226
230
|
edge: { type: String, reflect: true },
|
|
227
|
-
open: { type: Boolean, reflect: true }
|
|
231
|
+
open: { type: Boolean, reflect: true },
|
|
232
|
+
triggerLook: { type: String, reflect: true, attribute: "trigger-look" }
|
|
228
233
|
};
|
|
229
234
|
}
|
|
230
235
|
static {
|
|
@@ -234,18 +239,31 @@ var ImpaktMenu = class extends ImpaktElement {
|
|
|
234
239
|
touchTarget(".trigger, .item"),
|
|
235
240
|
css`
|
|
236
241
|
:host { position: relative; display: inline-block; }
|
|
237
|
-
.trigger { ${targetSize} display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(2)} ${space(3.5)}; font: inherit; ${type("sm")} font-weight: ${fontWeight("
|
|
242
|
+
.trigger { ${targetSize} display: inline-flex; align-items: center; gap: ${space(2)}; padding: ${space(2)} ${space(3.5)}; font: inherit; ${type("sm")} font-weight: ${fontWeight("medium")}; color: ${t.text}; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radiusLg}; cursor: pointer; }
|
|
243
|
+
:host([trigger-look='text']) .trigger { padding: ${space(1)} ${space(1)}; font-size: 1rem; line-height: 1.25; background: transparent; border-color: transparent; }
|
|
244
|
+
:host([trigger-look='text']) .trigger:hover { background: transparent; text-decoration: underline; text-underline-offset: 0.2em; }
|
|
245
|
+
.caret { font-size: 0.75em; line-height: 1; }
|
|
238
246
|
.trigger:hover { background: ${t.surfaceSubtle}; }
|
|
239
247
|
.chev { display: inline-flex; color: ${t.textMuted}; transition: transform 120ms ease-in-out; }
|
|
240
248
|
:host([open]) .chev { transform: rotate(180deg); }
|
|
241
|
-
|
|
242
|
-
.
|
|
249
|
+
/* G2: a 1px ink border and the one shadow the design allows, the open menu's. */
|
|
250
|
+
.panel { position: absolute; z-index: 100; inset-block-start: calc(100% + ${space(1.5)}); inset-inline-start: 0; box-sizing: border-box; min-inline-size: 13rem; max-inline-size: min(24rem, 90vw); padding: ${space(2)} 0; background: ${t.surfaceCard}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radiusXl}; box-shadow: var(--impakt-shadow-overlay, 0 16px 32px rgb(0 0 0 / 0.2)); animation: pop 120ms ease-out; }
|
|
251
|
+
.list, .group { margin: 0; padding: 0; list-style: none; }
|
|
252
|
+
.grouped + .grouped, .grouped:not(:first-child) { margin-block-start: ${space(2)}; padding-block-start: ${space(2)}; border-block-start: ${t.borderThin} solid ${LINE_SOFT}; }
|
|
253
|
+
.group-label { display: block; padding: ${space(2)} 18px ${space(1)}; font-family: ${t.fontMono}; font-size: 0.875rem; line-height: 1.4; color: ${t.textMuted}; }
|
|
243
254
|
.header { padding: ${space(2)} ${space(2.5)} ${space(2.5)}; margin-block-end: ${space(1.5)}; border-block-end: ${t.borderThin} solid ${t.border}; ${type("sm")} color: ${t.textMuted}; overflow-wrap: anywhere; }
|
|
244
255
|
:host([edge='end']) .panel, .panel.flip-end { inset-inline: auto 0; }
|
|
245
256
|
:host([edge='end']) .panel.flip-start { inset-inline: 0 auto; }
|
|
246
257
|
@keyframes pop { from { opacity: 0; transform: translateY(-${space(1)}); } }
|
|
247
|
-
.item { ${targetSize} box-sizing: border-box; display: flex; align-items: center; gap: ${space(2.5)}; inline-size: 100%; padding: ${space(
|
|
258
|
+
.item { ${targetSize} box-sizing: border-box; display: flex; align-items: center; gap: ${space(2.5)}; inline-size: 100%; padding: ${space(3)} 18px; font: inherit; font-size: 1rem; line-height: 1.25; font-weight: ${fontWeight("medium")}; text-align: start; color: ${t.text}; text-decoration: none; background: none; border: 0; border-radius: 0; cursor: pointer; }
|
|
248
259
|
.item:hover, .item:focus { background: ${t.surfaceSubtle}; }
|
|
260
|
+
.item .meta { margin-inline-start: auto; padding-inline-start: ${space(4)}; font-family: ${t.fontMono}; font-size: 0.875rem; font-weight: ${fontWeight("regular")}; color: ${t.textMuted}; white-space: nowrap; }
|
|
261
|
+
.item[aria-current] { background: ${t.text}; color: var(--impakt-color-text-inverse, var(--impakt-solid-card, ${t.surfaceCard})); }
|
|
262
|
+
.item[aria-current] .meta { color: color-mix(in srgb, var(--impakt-color-text-inverse, var(--impakt-solid-card, ${t.surfaceCard})) 66%, ${t.text}); }
|
|
263
|
+
.item[aria-disabled='true'] { color: ${t.textMuted}; cursor: not-allowed; }
|
|
264
|
+
.item[aria-disabled='true']:hover { background: none; }
|
|
265
|
+
.item[aria-disabled='true']:focus { background: ${t.surfaceSubtle}; }
|
|
266
|
+
@media (forced-colors: active) { .panel { border-color: CanvasText; } .item[aria-current] { outline: 2px solid Highlight; outline-offset: -2px; } .item[aria-disabled='true'] { color: GrayText; } }
|
|
249
267
|
.item.danger { color: ${t.dangerText}; }
|
|
250
268
|
.item svg { flex: none; }
|
|
251
269
|
`
|
|
@@ -309,19 +327,47 @@ var ImpaktMenu = class extends ImpaktElement {
|
|
|
309
327
|
this.trigger?.focus();
|
|
310
328
|
} else if (event.key === "Tab") this.toggle(false);
|
|
311
329
|
}
|
|
312
|
-
choose(item) {
|
|
330
|
+
choose(item, event) {
|
|
331
|
+
if (item.disabled) {
|
|
332
|
+
event?.preventDefault();
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
313
335
|
this.toggle(false);
|
|
314
336
|
this.trigger?.focus();
|
|
315
337
|
if (!item.href) this.dispatchEvent(new CustomEvent("impakt-select", { detail: { value: item.value ?? item.text }, bubbles: true, composed: true }));
|
|
316
338
|
}
|
|
339
|
+
renderItem(item) {
|
|
340
|
+
const meta = item.meta || (item.current ? say("You are here") : "");
|
|
341
|
+
const inner = html`${iconSvg(item.icon, "18px")}<span class="text">${item.text}</span>${meta ? html`<span class="meta">${meta}</span>` : nothing}`;
|
|
342
|
+
const cls = `item ${item.tone === "danger" ? "danger" : ""}`;
|
|
343
|
+
const current = item.current ? "page" : nothing;
|
|
344
|
+
const disabled = item.disabled ? "true" : nothing;
|
|
345
|
+
return html`<li role="none">${item.href && !item.disabled ? html`<a class=${cls} role="menuitem" tabindex="-1" href=${item.href} aria-current=${current} @click=${(e) => this.choose(item, e)}>${inner}</a>` : html`<button class=${cls} role="menuitem" tabindex="-1" type="button" aria-current=${current} aria-disabled=${disabled} @click=${(e) => this.choose(item, e)}>${inner}</button>`}</li>`;
|
|
346
|
+
}
|
|
347
|
+
/** The items in runs: each run of items with the same group, in order. Items with no group are a run with no label. */
|
|
348
|
+
get runs() {
|
|
349
|
+
const runs = [];
|
|
350
|
+
for (const item of this.items ?? []) {
|
|
351
|
+
const group = item.group ?? "";
|
|
352
|
+
const last = runs[runs.length - 1];
|
|
353
|
+
const existing = group ? runs.find((r) => r.group === group) : void 0;
|
|
354
|
+
if (existing) existing.items.push(item);
|
|
355
|
+
else if (last && !group && !last.group) last.items.push(item);
|
|
356
|
+
else runs.push({ group, items: [item] });
|
|
357
|
+
}
|
|
358
|
+
return runs;
|
|
359
|
+
}
|
|
317
360
|
render() {
|
|
318
|
-
const
|
|
361
|
+
const text = this.triggerLook === "text";
|
|
362
|
+
const runs = this.runs;
|
|
363
|
+
const grouped = runs.some((r) => r.group);
|
|
319
364
|
return html`<button class="trigger" part="trigger" type="button" aria-haspopup="menu" aria-expanded=${String(this.open)} aria-controls=${this.id_("list")}
|
|
320
|
-
@click=${() => this.toggle(!this.open)} @keydown=${this.triggerKey}><slot name="trigger">${iconSvg(this.icon, "18px")}${this.label}</slot
|
|
365
|
+
@click=${() => this.toggle(!this.open)} @keydown=${this.triggerKey}><slot name="trigger">${iconSvg(this.icon, "18px")}${this.label}</slot>${text ? html`<span class="caret" part="chevron" aria-hidden="true">${this.open ? "\u25B4" : "\u25BE"}</span>` : html`<span class="chev" part="chevron">${iconSvg("chevron-down", "16px")}</span>`}</button>
|
|
321
366
|
${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
|
-
${
|
|
323
|
-
|
|
324
|
-
|
|
367
|
+
${grouped ? runs.map((run, i) => {
|
|
368
|
+
const id = this.id_(`group-${i}`);
|
|
369
|
+
return html`<li role="none" class="grouped">${run.group ? html`<span class="group-label" id=${id} part="group-label">${run.group}</span>` : nothing}<ul class="group" role="group" aria-labelledby=${run.group ? id : nothing}>${run.items.map((item) => this.renderItem(item))}</ul></li>`;
|
|
370
|
+
}) : (this.items ?? []).map((item) => this.renderItem(item))}
|
|
325
371
|
</ul></div>` : nothing}`;
|
|
326
372
|
}
|
|
327
373
|
};
|
|
@@ -419,6 +465,7 @@ var ImpaktAvatar = class extends ImpaktElement {
|
|
|
419
465
|
...ImpaktElement.styles,
|
|
420
466
|
css`
|
|
421
467
|
:host { --size: 40px; display: inline-block; inline-size: var(--size); block-size: var(--size); vertical-align: middle; }
|
|
468
|
+
:host([size='xs']) { --size: 22px; }
|
|
422
469
|
:host([size='sm']) { --size: 32px; }
|
|
423
470
|
:host([size='lg']) { --size: 56px; }
|
|
424
471
|
:host([size='xl']) { --size: 80px; }
|
|
@@ -465,6 +512,9 @@ var ImpaktAvatarGroup = class extends ImpaktElement {
|
|
|
465
512
|
li:first-child { margin-inline-start: 0; }
|
|
466
513
|
.more { display: flex; align-items: center; justify-content: center; inline-size: 40px; block-size: 40px; ${type("xs")} line-height: 1; font-weight: ${fontWeight("semibold")}; color: ${t.text}; background: ${t.surfaceSubtle}; border-radius: 50%; }
|
|
467
514
|
:host([size='sm']) .more { inline-size: 32px; block-size: 32px; }
|
|
515
|
+
:host([size='xs']) li { margin-inline-start: -${space(1)}; box-shadow: 0 0 0 1px ${t.text}; }
|
|
516
|
+
:host([size='xs']) li:first-child { margin-inline-start: 0; }
|
|
517
|
+
:host([size='xs']) .more { inline-size: 22px; block-size: 22px; font-size: 10px; }
|
|
468
518
|
:host([size='lg']) .more { inline-size: 56px; block-size: 56px; }
|
|
469
519
|
.sr { ${visuallyHidden} }
|
|
470
520
|
`
|
|
@@ -637,4 +687,4 @@ export {
|
|
|
637
687
|
ImpaktEmptyState,
|
|
638
688
|
ImpaktSlotPicker
|
|
639
689
|
};
|
|
640
|
-
//# sourceMappingURL=chunk-
|
|
690
|
+
//# sourceMappingURL=chunk-SOYKSPPX.js.map
|