@atomic-ui/ui 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +71 -2
- package/dist/base/motion.d.ts +44 -0
- package/dist/{chunk-DKVLA7AF.js → chunk-22XEQ4HD.js} +2 -2
- package/dist/{chunk-X57BTN6V.js → chunk-46DONRMK.js} +11 -1
- package/dist/chunk-46DONRMK.js.map +1 -0
- package/dist/{chunk-H5HWJ2D4.js → chunk-7RZYC2IX.js} +2 -2
- package/dist/chunk-FF6GQADC.js +241 -0
- package/dist/chunk-FF6GQADC.js.map +1 -0
- package/dist/{chunk-WGFHYSXH.js → chunk-FJOZL25F.js} +3 -2
- package/dist/{chunk-WGFHYSXH.js.map → chunk-FJOZL25F.js.map} +1 -1
- package/dist/{chunk-NCVBRUJM.js → chunk-FQ4I6TD6.js} +11 -6
- package/dist/chunk-FQ4I6TD6.js.map +1 -0
- package/dist/{chunk-K5QFVLCI.js → chunk-GHUVRNWS.js} +8 -3
- package/dist/chunk-GHUVRNWS.js.map +1 -0
- package/dist/{chunk-VR543SMV.js → chunk-IBBW4CVA.js} +2 -2
- package/dist/{chunk-EFP7PJ6C.js → chunk-J3XAAGFG.js} +7 -2
- package/dist/chunk-J3XAAGFG.js.map +1 -0
- package/dist/{chunk-JDKOHA3B.js → chunk-JBEPS77S.js} +2 -2
- package/dist/chunk-K542UBDD.js +100 -0
- package/dist/chunk-K542UBDD.js.map +1 -0
- package/dist/{chunk-C767LTJE.js → chunk-KBCCL45Y.js} +3 -3
- package/dist/chunk-KBCCL45Y.js.map +1 -0
- package/dist/{chunk-BTACNWU6.js → chunk-KXHRD4FK.js} +2 -2
- package/dist/{chunk-CN4J5RS2.js → chunk-LRDK2G3E.js} +2 -2
- package/dist/{chunk-JX5RJRME.js → chunk-MXPFOBXZ.js} +15 -3
- package/dist/chunk-MXPFOBXZ.js.map +1 -0
- package/dist/{chunk-KDU2POFS.js → chunk-NN6L3HLD.js} +2 -2
- package/dist/{chunk-GIIJ32FN.js → chunk-NTRIND3W.js} +2 -2
- package/dist/{chunk-6IQIFKY6.js → chunk-SLNHUYGJ.js} +2 -2
- package/dist/{chunk-273AYERA.js → chunk-YOJF5ESL.js} +2 -2
- package/dist/components/app-bar.js +2 -2
- package/dist/components/app-ui.js +2 -2
- package/dist/components/button.js +2 -1
- package/dist/components/checkbox-group.js +2 -2
- package/dist/components/checkbox.js +2 -2
- package/dist/components/chip-group.js +3 -2
- package/dist/components/chip.js +1 -1
- package/dist/components/date-input.js +2 -2
- package/dist/components/journey.js +2 -2
- package/dist/components/link.js +2 -1
- package/dist/components/navigation.d.ts +3 -2
- package/dist/components/navigation.js +1 -1
- package/dist/components/page.js +1 -1
- package/dist/components/radio-group.js +2 -2
- package/dist/components/select.js +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/text-input.js +2 -2
- package/dist/components/textarea.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +41 -17
- package/dist/reveal.d.ts +54 -0
- package/dist/reveal.js +19 -0
- package/dist/reveal.js.map +1 -0
- package/dist/standalone/atomic-ui-reveal.js +3 -0
- package/dist/standalone/atomic-ui-reveal.js.map +7 -0
- package/dist/standalone/atomic-ui.js +773 -689
- package/dist/standalone/atomic-ui.js.map +4 -4
- package/package.json +10 -2
- package/dist/chunk-C767LTJE.js.map +0 -1
- package/dist/chunk-EFP7PJ6C.js.map +0 -1
- package/dist/chunk-JX5RJRME.js.map +0 -1
- package/dist/chunk-K5QFVLCI.js.map +0 -1
- package/dist/chunk-NCVBRUJM.js.map +0 -1
- package/dist/chunk-X57BTN6V.js.map +0 -1
- /package/dist/{chunk-DKVLA7AF.js.map → chunk-22XEQ4HD.js.map} +0 -0
- /package/dist/{chunk-H5HWJ2D4.js.map → chunk-7RZYC2IX.js.map} +0 -0
- /package/dist/{chunk-VR543SMV.js.map → chunk-IBBW4CVA.js.map} +0 -0
- /package/dist/{chunk-JDKOHA3B.js.map → chunk-JBEPS77S.js.map} +0 -0
- /package/dist/{chunk-BTACNWU6.js.map → chunk-KXHRD4FK.js.map} +0 -0
- /package/dist/{chunk-CN4J5RS2.js.map → chunk-LRDK2G3E.js.map} +0 -0
- /package/dist/{chunk-KDU2POFS.js.map → chunk-NN6L3HLD.js.map} +0 -0
- /package/dist/{chunk-GIIJ32FN.js.map → chunk-NTRIND3W.js.map} +0 -0
- /package/dist/{chunk-6IQIFKY6.js.map → chunk-SLNHUYGJ.js.map} +0 -0
- /package/dist/{chunk-273AYERA.js.map → chunk-YOJF5ESL.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atomic-ui/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "The Impakt component library: standard custom elements, styled only from design tokens, built to WCAG 2.2 AA.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,10 +23,18 @@
|
|
|
23
23
|
"types": "./dist/server.d.ts",
|
|
24
24
|
"import": "./dist/server.js"
|
|
25
25
|
},
|
|
26
|
+
"./reveal": {
|
|
27
|
+
"types": "./dist/reveal.d.ts",
|
|
28
|
+
"import": "./dist/reveal.js"
|
|
29
|
+
},
|
|
26
30
|
"./standalone": {
|
|
27
31
|
"types": "./dist/index.d.ts",
|
|
28
32
|
"default": "./dist/standalone/atomic-ui.js"
|
|
29
33
|
},
|
|
34
|
+
"./standalone/reveal": {
|
|
35
|
+
"types": "./dist/reveal.d.ts",
|
|
36
|
+
"default": "./dist/standalone/atomic-ui-reveal.js"
|
|
37
|
+
},
|
|
30
38
|
"./custom-elements.json": "./custom-elements.json",
|
|
31
39
|
"./package.json": "./package.json"
|
|
32
40
|
},
|
|
@@ -35,7 +43,7 @@
|
|
|
35
43
|
},
|
|
36
44
|
"dependencies": {
|
|
37
45
|
"lit": "^3.3.3",
|
|
38
|
-
"@atomic-ui/design-tokens": "^0.
|
|
46
|
+
"@atomic-ui/design-tokens": "^0.14.0"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
41
49
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chip.ts","../src/base/tone.ts"],"sourcesContent":["/**\n * A short label: a branch, a status with its dot, or a code such as a commit\n * hash.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { hideOn } from '../base/styles';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\nimport { toneOf, type Tone } from '../base/tone';\n\n/** Code-like labels: a branch, a hash, a commit message. */\nconst MONO = t.fontMono;\n\n/**\n * A short label: a branch name with its icon, a status with its dot, or a\n * code such as a commit hash. It says something; it does nothing.\n *\n * @category content\n * @icon badge\n */\nexport class ImpaktChip extends ImpaktElement {\n static properties = {\n label: { type: String },\n meta: { type: String },\n icon: { type: String, reflect: true },\n tone: { type: String },\n look: { type: String, reflect: true },\n size: { type: String, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n declare label: string;\n /** A code after the label, quieter, such as a hash. */\n declare meta: string;\n /** A coloured dot, a branch, or nothing before the label. */\n declare icon: 'none' | 'dot' | 'branch';\n /** The dot's colour: a named tone, or 1 to 5 for the brand's chart colours. */\n declare tone: Tone;\n /** `outlined` on the card colour, `filled` with a faint wash, or `plain` words in the code face. */\n declare look: 'outlined' | 'filled' | 'plain';\n /**\n * `md` is the chip in a line of text. `marketing` sets the words in\n * capitals at 11px with 6% tracking, as the site's labels are. `lg` is a\n * studio tool tag: a square 49px box with an ink border, the label in\n * Archivo at 20px and the meta in capitals in the code face (frame 21:1152).\n */\n declare size: 'md' | 'marketing' | 'body' | 'lg';\n declare hideOn: 'never' | 'phone' | 'wide';\n\n constructor() {\n super();\n this.label = '';\n this.meta = '';\n this.icon = 'none';\n this.tone = 'success';\n this.look = 'filled';\n this.size = 'md';\n this.hideOn = 'never';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n hideOn,\n css`\n :host { display: inline-flex; flex: none; }\n span.chip { display: inline-flex; align-items: center; gap: ${space(1.5)}; padding: 3px ${space(2.5)}; border-radius: var(--impakt-radius-pill, calc(${t.radius} * 9999)); font-family: ${MONO}; font-size: ${fontSize('xs')}; line-height: 1.2; white-space: nowrap; }\n :host([look='filled']) span.chip { border-radius: ${t.radius}; background: color-mix(in srgb, currentColor 7%, transparent); }\n /* The edge is the border grey where the brand derives it, and ink under Noire (G2) (chip.outlined.edge, #69). */\n /* Spaced 0.04em where the brand derives it, and not at all under Noire (G2) (chip.outlined.tracking). */\n :host([look='outlined']) span.chip { border: ${t.borderThin} solid color-mix(in srgb, ${t.text} ${token('chip.outlined.edge', '0%')}, ${t.border}); background: ${t.surfaceCard}; letter-spacing: ${token('chip.outlined.tracking', '0.04em')}; }\n :host([size='marketing']) span.chip { font-size: 11px; font-weight: ${fontWeight('medium')}; text-transform: uppercase; letter-spacing: 0.06em; }\n /* Body: a 35px square box in the body face, for a row of tags such as a stack (G2 case study, 21:1493). */\n :host([size='body']) span.chip { box-sizing: border-box; min-block-size: 35px; padding: ${space(1.5)} ${space(3)}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radius}; font-family: ${t.fontBody}; font-size: 14px; line-height: 1.2; }\n :host([size='lg']) span.chip { box-sizing: border-box; min-block-size: 49px; gap: ${space(3)}; padding: ${space(2)} ${space(4)}; border: ${t.borderThin} solid ${t.text}; border-radius: ${t.radius}; font-family: ${t.fontBody}; font-size: 20px; line-height: 1.2; }\n :host([size='lg']) .meta { font-family: ${MONO}; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 1; color: ${t.textMuted}; }\n :host([look='plain']) span.chip { padding: 0; }\n .dot { flex: none; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--tone); }\n /* Yellow means \"needs your attention\": the accent, with an ink stroke so it shows on white. */\n .dot.warn { background: ${token('color.accent.default', '#ffd43b')}; box-shadow: 0 0 0 1px ${t.text}; }\n @media (forced-colors: active) { .dot, .dot.warn { background: CanvasText; } }\n svg { inline-size: 12px; block-size: 12px; }\n .meta { opacity: 0.72; text-transform: none; }\n :host([look='plain']) .label { opacity: 0.72; }\n `,\n ];\n\n render(): TemplateResult {\n const icon =\n this.icon === 'dot'\n ? html`<span class=\"dot ${this.tone === 'warning' ? 'warn' : ''}\" aria-hidden=\"true\"></span>`\n : this.icon === 'branch'\n ? html`<svg viewBox=\"0 0 14 14\" aria-hidden=\"true\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\"><circle cx=\"3.5\" cy=\"3\" r=\"1.5\"/><circle cx=\"3.5\" cy=\"11\" r=\"1.5\"/><circle cx=\"10.5\" cy=\"4.5\" r=\"1.5\"/><path d=\"M3.5 4.5v5M10.5 6c0 2.5-3 2.5-6 4\"/></svg>`\n : nothing;\n return html`<span class=\"chip\" part=\"chip\" style=${`--tone:${toneOf(this.tone, 0)}`}>${icon}<span class=\"label\">${this.label}</span>${this.meta ? html` <span class=\"meta\">${this.meta}</span>` : nothing}</span>`;\n }\n}\n\ncustomElements.define('impakt-chip', ImpaktChip);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-chip': ImpaktChip;\n }\n}\n","/**\n * Colours named by what they are in the brand, for a line, a lane, a dot or a\n * stripe. A tone is a brand token, never a hex value, so a partner's brand\n * restyles everything drawn with one.\n *\n * It is shared: `impakt-chip` here and the changelog, site and estimator blocks\n * in `@atomic-ui/blocks` all colour themselves with it.\n */\n\n/** A colour for a line or a lane, named by what it is in the brand. */\nexport type NamedTone = 'brand' | 'accent' | 'info' | 'success' | 'warning' | 'danger';\n/** A named tone, or 1 to 5 for the brand's chart colours in order. */\nexport type Tone = NamedTone | 1 | 2 | 3 | 4 | 5;\nexport const TONE: Record<NamedTone, string> = {\n brand: 'var(--impakt-color-brand-default, #1f4ed8)',\n accent: 'var(--impakt-color-accent-default, #c8a15a)',\n info: 'var(--impakt-color-status-info-default, #1f4ed8)',\n success: 'var(--impakt-color-status-success-default, #047857)',\n warning: 'var(--impakt-color-status-warning-default, #b45309)',\n danger: 'var(--impakt-color-status-danger-default, #c8102e)',\n};\n/** When an item names no tone, lanes take these in turn. */\nexport const CYCLE: NamedTone[] = ['success', 'info', 'warning', 'accent', 'danger', 'brand'];\n/**\n * A named tone, or for an item that names none, the brand's chart colour for its\n * place (color.chart.1 to 5), falling back to the status colours in turn.\n */\nexport const toneOf = (tone: Tone | undefined, i: number): string => {\n if (typeof tone === 'number') return `var(--impakt-color-chart-${tone}, ${TONE[CYCLE[(tone - 1) % CYCLE.length]!]})`;\n if (tone && tone in TONE) return TONE[tone];\n return `var(--impakt-color-chart-${(i % 5) + 1}, ${TONE[CYCLE[i % CYCLE.length]!]})`;\n};\n"],"mappings":";;;;;;;;;;;;;AAIA,SAAS,KAAK,MAAM,eAAoC;;;ACSjD,IAAM,OAAkC;AAAA,EAC7C,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AACV;AAEO,IAAM,QAAqB,CAAC,WAAW,QAAQ,WAAW,UAAU,UAAU,OAAO;AAKrF,IAAM,SAAS,CAAC,MAAwB,MAAsB;AACnE,MAAI,OAAO,SAAS,SAAU,QAAO,4BAA4B,IAAI,KAAK,KAAK,OAAO,OAAO,KAAK,MAAM,MAAM,CAAE,CAAC;AACjH,MAAI,QAAQ,QAAQ,KAAM,QAAO,KAAK,IAAI;AAC1C,SAAO,4BAA6B,IAAI,IAAK,CAAC,KAAK,KAAK,MAAM,IAAI,MAAM,MAAM,CAAE,CAAC;AACnF;;;ADpBA,IAAM,OAAO,EAAE;AASR,IAAM,aAAN,cAAyB,cAAc;AAAA,EAC5C;AAAA,SAAO,aAAa;AAAA,MAClB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,MAA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S,CAAC,2BAA2B,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMrG;AAAA;AAAA,EAEA,SAAyB;AACvB,UAAM,OACJ,KAAK,SAAS,QACV,wBAAwB,KAAK,SAAS,YAAY,SAAS,EAAE,iCAC7D,KAAK,SAAS,WACZ,oQACA;AACR,WAAO,4CAA4C,UAAU,OAAO,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,IAAI,uBAAuB,KAAK,KAAK,UAAU,KAAK,OAAO,2BAA2B,KAAK,IAAI,YAAY,OAAO;AAAA,EAC3M;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/button.ts"],"sourcesContent":["import { html, svg, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { space, t, token } 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 * The button's shape, from the brand (`button.*` in `@atomic-ui/design-tokens`). Each fallback is\n * the shape every brand derives: 40px, the small type in semibold, the words of a full-width\n * button in the middle. The Impakt theme sets the G2 Noire shape over it.\n */\nconst B = {\n height: token('button.height', '40px'),\n paddingBlock: token('button.padding-block', '8px'),\n paddingInline: token('button.padding-inline', '16px'),\n gap: token('button.gap', '8px'),\n fontSize: token('button.font-size', '0.875rem'),\n lineHeight: token('button.line-height', '1.429'),\n weight: token('button.weight', '600'),\n smPaddingBlock: token('button.sm.padding-block', '4px'),\n smHeight: token('button.sm.height', '32px'),\n smPaddingInline: token('button.sm.padding-inline', '12px'),\n smFontSize: token('button.sm.font-size', '0.875rem'),\n smLineHeight: token('button.sm.line-height', '1.429'),\n smGap: token('button.sm.gap', '6px'),\n solidEdge: token('button.solid-edge-width', '1px'),\n arrowIcon: token('button.arrow-icon', 'inline-block'),\n arrowGlyph: token('button.arrow-glyph', 'none'),\n lgHeight: token('button.lg.height', '48px'),\n lgPaddingBlock: token('button.lg.padding-block', '12px'),\n lgFontSize: token('button.lg.font-size', '1rem'),\n lgLineHeight: token('button.lg.line-height', '1.5'),\n iconSize: token('button.icon-size', '40px'),\n lgIconSize: token('button.lg.icon-size', '48px'),\n fullJustify: token('button.full.justify', 'center'),\n fullAlign: token('button.full.align', 'center'),\n highlight: token('button.highlight', 'inset 0 1px 0 0 rgb(255 255 255 / 0.12)'),\n edge: token('button.edge', '15%'),\n};\n\n/** The \"→\" glyph of the G2 button (8:314), a long thin arrow in the words' colour. */\nconst ARROW_GLYPH = svg`<svg class=\"glyph\" viewBox=\"0 0 15 10\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.25\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M0 5h14\" /><path d=\"M9.75 0.75 14 5l-4.25 4.25\" /></svg>`;\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: ${B.gap};\n inline-size: 100%;\n /* The brand's button shape: 40px in the small type in semibold, or under Noire (G2) Archivo Medium 16, 14 by 20, about 47px tall. */\n min-block-size: ${B.height};\n padding: ${B.paddingBlock} ${B.paddingInline};\n font-family: inherit;\n font-size: ${B.fontSize};\n line-height: ${B.lineHeight};\n font-weight: ${B.weight};\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: ${B.smHeight}; padding: ${B.smPaddingBlock} ${B.smPaddingInline}; font-size: ${B.smFontSize}; line-height: ${B.smLineHeight}; gap: ${B.smGap}; }\n :host([size='lg']) :is(button, a) { min-block-size: ${B.lgHeight}; padding: ${B.lgPaddingBlock} ${space(6)}; font-size: ${B.lgFontSize}; line-height: ${B.lgLineHeight}; }\n /* A full-width button keeps its words in the middle, or spreads them where the brand does, as Noire does unless it is centred. */\n :host([full]:not([centred]):not([spread])) :is(button, a) { justify-content: ${B.fullJustify}; text-align: ${B.fullAlign}; }\n /* Spread: the words at the start, the trailing icon at the far end. */\n :host([spread]) :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 /* A hairline highlight along the top edge, where the brand draws one. Noire is flat. */\n box-shadow: ${t.shadowXs}, ${B.highlight};\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 /* The trailing icon sits in a box as tall as the icon, so it never makes the line taller than the label's (#50). */\n .after { display: inline-flex; align-items: center; flex: none; transition: transform 160ms ease-out; }\n .after.arrow .icon { display: ${B.arrowIcon}; }\n /* The \"→\" of the G2 button, drawn so it does not depend on the font file holding it: as long as the label is high, with a thin stroke and a small head. */\n .after .glyph { display: ${B.arrowGlyph}; inline-size: 0.9375em; block-size: 0.625em; overflow: visible; }\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 /*\n * A filled button draws no edge where the brand says so, as Noire does: the G2 button is 14px, the label's 19.2px\n * line and 14px, so 47px tall, and only an outlined one adds its 1px edge, to 49px (#50). Forced colours keep the\n * edge, since there the fill is gone.\n */\n :is(.primary, .dark, .subtle, .accent, .danger, .ghost) { border-width: ${B.solidEdge}; }\n @media (forced-colors: active) { :is(.primary, .dark, .subtle, .accent, .danger, .ghost) { border-width: 1px; } }\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: color-mix(in srgb, ${t.text} ${B.edge}, transparent);\n box-shadow: ${t.shadowXs};\n }\n .secondary:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%);\n border-color: color-mix(in srgb, ${t.text} 25%, transparent);\n }\n\n /* Plain: words only until it is pointed at. */\n .ghost {\n background: transparent;\n color: ${t.link};\n }\n .ghost:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n\n /*\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: ${B.iconSize};\n min-inline-size: ${B.iconSize};\n block-size: ${B.iconSize};\n min-block-size: ${B.iconSize};\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: ${B.lgIconSize}; min-inline-size: ${B.lgIconSize}; block-size: ${B.lgIconSize}; min-block-size: ${B.lgIconSize}; 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=${this.iconAfter === 'arrow-right' ? 'after arrow' : 'after'} aria-hidden=\"true\">${iconSvg(this.iconAfter)}${this.iconAfter === 'arrow-right' ? ARROW_GLYPH : nothing}</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,KAAK,eAAoC;AAS7D,IAAM,UAAU,MAAM,sBAAsB,qEAAqE;AAQjH,IAAM,IAAI;AAAA,EACR,QAAQ,MAAM,iBAAiB,MAAM;AAAA,EACrC,cAAc,MAAM,wBAAwB,KAAK;AAAA,EACjD,eAAe,MAAM,yBAAyB,MAAM;AAAA,EACpD,KAAK,MAAM,cAAc,KAAK;AAAA,EAC9B,UAAU,MAAM,oBAAoB,UAAU;AAAA,EAC9C,YAAY,MAAM,sBAAsB,OAAO;AAAA,EAC/C,QAAQ,MAAM,iBAAiB,KAAK;AAAA,EACpC,gBAAgB,MAAM,2BAA2B,KAAK;AAAA,EACtD,UAAU,MAAM,oBAAoB,MAAM;AAAA,EAC1C,iBAAiB,MAAM,4BAA4B,MAAM;AAAA,EACzD,YAAY,MAAM,uBAAuB,UAAU;AAAA,EACnD,cAAc,MAAM,yBAAyB,OAAO;AAAA,EACpD,OAAO,MAAM,iBAAiB,KAAK;AAAA,EACnC,WAAW,MAAM,2BAA2B,KAAK;AAAA,EACjD,WAAW,MAAM,qBAAqB,cAAc;AAAA,EACpD,YAAY,MAAM,sBAAsB,MAAM;AAAA,EAC9C,UAAU,MAAM,oBAAoB,MAAM;AAAA,EAC1C,gBAAgB,MAAM,2BAA2B,MAAM;AAAA,EACvD,YAAY,MAAM,uBAAuB,MAAM;AAAA,EAC/C,cAAc,MAAM,yBAAyB,KAAK;AAAA,EAClD,UAAU,MAAM,oBAAoB,MAAM;AAAA,EAC1C,YAAY,MAAM,uBAAuB,MAAM;AAAA,E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KAAK;AAAA,MAC9F;AACA,aAAO;AAAA;AAAA,kBAEK,GAAG;AAAA;AAAA;AAAA,uBAGE,KAAK,KAAK;AAAA,sBACX,KAAK,QAAQ;AAAA,0BACT,KAAK,OAAO,SAAS,OAAO;AAAA,sBAChC,KAAK,OAAO,SAAS,OAAO;AAAA,mBAC/B,KAAK,OAAO;AAAA;AAAA,YAEnB,KAAK;AAAA,YACL,KAAK,OAAO,6BAA6B,KAAK,SAAS,YAAY,OAAO;AAAA;AAAA;AAAA,IAGlF;AACA,UAAM,QAAQ,OAAO,QAAQ,KAAK,UAAU,CAAC,gBAAgB,KAAK,aAAa,KAAK,cAAc,SAAS,mBAAmB,KAAK,cAAc,gBAAgB,gBAAgB,OAAO,uBAAuB,QAAQ,KAAK,SAAS,CAAC,GAAG,KAAK,cAAc,gBAAgB,cAAc,OAAO,YAAY,OAAO;AACpT,QAAI,KAAK,QAAQ,CAAC,KAAK,UAAU;AAC/B,aAAO,gBAAgB,KAAK,OAAO,SAAS,KAAK,IAAI,kBAAkB,KAAK;AAAA,IAC9E;AACA,WAAO;AAAA;AAAA,gBAEK,KAAK,OAAO;AAAA;AAAA;AAAA,oBAGR,KAAK,QAAQ;AAAA,wBACT,KAAK,OAAO,SAAS,OAAO;AAAA,oBAChC,KAAK,OAAO,SAAS,OAAO;AAAA,iBAC/B,KAAK,OAAO;AAAA;AAAA,UAEnB,KAAK;AAAA,UACL,KAAK,OAAO,6BAA6B,KAAK,SAAS,YAAY,OAAO;AAAA;AAAA;AAAA,EAGlF;AACF;AAEA,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chip-group.ts"],"sourcesContent":["/**\n * A choice made with square chips: one, or several.\n */\nimport { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { space, t } from '../base/tokens';\nimport { kit } from './tool-kit-tokens';\n\nexport interface ChipOption {\n value: string;\n label: string;\n}\n\n/**\n * A short choice drawn as a row of square chips, such as \"What do you need\"\n * or \"Budget\" on a brief form, or the answers in an estimator.\n *\n * **Under each chip is a native control.** A single choice is a set of radios\n * and several is a set of checkboxes, so a single choice has the arrow keys,\n * Home and End and the right announcement without any script, and each\n * checkbox is its own tab stop, as it should be. The control lies over its\n * chip, invisible, so the whole chip is what is pressed and a screen reader\n * exploring by touch finds it where it is drawn.\n *\n * The question is a `legend` in a `fieldset`, because it is asked of the set.\n * `look=\"site\"` draws it in the site's form style: mono, uppercase, 11px.\n *\n * It joins its form like the other fields. A single choice submits its value;\n * several submit their values joined with commas, in the options' order.\n * `required` with nothing chosen makes the form invalid.\n *\n * Figma: site brief form `20:1157`; estimator `10:547`, `10:557`; mobile `15:945`.\n *\n * @category form\n * @icon checkbox\n * @csspart chip - Each chip.\n * @csspart fieldset - The fieldset.\n * @cssprop --impakt-chip-group-gap - The space between the chips, 6px unless set; the estimator sets 8px, as its frame does (`10:547`).\n */\nexport class ImpaktChipGroup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n values: { type: Array },\n multiple: { type: Boolean, reflect: true },\n look: { type: String, reflect: true },\n missingText: { type: String, attribute: 'missing-text' },\n };\n\n declare options: ChipOption[];\n /** What is chosen when `multiple` is set. */\n declare values: string[];\n /** Choose several, as checkboxes, rather than one, as radios. */\n declare multiple: boolean;\n /** `default` takes the product's field label; `site` is the mono uppercase label of the site's forms. */\n declare look: 'default' | 'site';\n /** What the browser says when a required choice is missing. */\n declare missingText: string;\n\n constructor() {\n super();\n this.options = [];\n this.values = [];\n this.multiple = false;\n this.look = 'default';\n this.missingText = 'Choose an option';\n }\n\n static styles = [\n ...FieldElement.styles,\n css`\n fieldset {\n border: 0;\n margin: 0;\n padding: 0;\n min-inline-size: 0;\n }\n legend {\n padding: 0;\n }\n :host([look='site']) legend {\n font-family: ${t.fontMono};\n /* G2 Mono S is 11px (20:1100); the ramp's 2xs is 12px, so the size is set here, as the text fields' site label is. */\n font-size: 0.6875rem;\n font-weight: ${kit.medium};\n text-transform: uppercase;\n letter-spacing: 0.06em;\n margin-block-end: ${space(2)};\n }\n .chips {\n display: flex;\n flex-wrap: wrap;\n gap: var(--impakt-chip-group-gap, ${space(1.5)});\n }\n .chip {\n position: relative;\n display: inline-flex;\n align-items: center;\n min-block-size: 35px;\n padding: 0 ${space(3)};\n font-family: ${t.fontBody};\n font-size: ${kit.small};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: 1px solid ${t.text};\n border-radius: 0;\n cursor: pointer;\n }\n .chip input {\n position: absolute;\n inset: 0;\n inline-size: 100%;\n block-size: 100%;\n margin: 0;\n opacity: 0;\n cursor: inherit;\n }\n .chip:hover {\n background: ${t.surfaceSubtle};\n }\n .chip.on {\n color: ${kit.onInverse};\n background: ${kit.inverse};\n }\n .chip:has(input:focus-visible) {\n outline: 2px solid transparent;\n outline-offset: ${t.focusOffset};\n box-shadow: ${t.focusShadow};\n }\n :host([disabled]) .chip {\n opacity: 0.6;\n cursor: not-allowed;\n }\n :host([invalid]) .chip {\n border-color: ${t.danger};\n }\n @media (pointer: coarse) {\n .chip {\n min-block-size: 44px;\n }\n }\n @media (forced-colors: active) {\n .chip {\n border-color: ButtonText;\n }\n .chip.on {\n forced-color-adjust: none;\n color: HighlightText;\n background: Highlight;\n border-color: Highlight;\n }\n .chip:has(input:focus-visible) {\n outline-color: Highlight;\n }\n }\n `,\n ];\n\n protected renderLabel(): TemplateResult {\n return html`<legend class=\"label\" part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </legend>`;\n }\n\n private chosen(value: string): boolean {\n return this.multiple ? this.values.includes(value) : this.value === value;\n }\n\n private choose(value: string, checked: boolean): void {\n if (this.multiple) {\n const next = checked ? [...this.values, value] : this.values.filter((v) => v !== value);\n this.values = this.options.filter((o) => next.includes(o.value)).map((o) => o.value);\n this.setFormValue(this.values.join(','));\n } else this.setFormValue(value);\n this.syncValidity();\n }\n\n private syncValidity(): void {\n const empty = this.multiple ? this.values.length === 0 : !this.value;\n try {\n if (this.required && empty) {\n const anchor = this.renderRoot?.querySelector?.('input') ?? undefined;\n this.internals?.setValidity({ valueMissing: true }, this.missingText, anchor as HTMLElement | undefined);\n } else this.internals?.setValidity({});\n } catch {\n // An engine without ElementInternals validity still has a working control.\n }\n }\n\n protected renderControl(): TemplateResult {\n const type = this.multiple ? 'checkbox' : 'radio';\n return html`<div class=\"chips\">\n ${this.options.map((option, i) => {\n const on = this.chosen(option.value);\n return html`<label class=\"chip ${on ? 'on' : ''}\" part=\"chip\">\n <input\n type=${type}\n id=${i === 0 ? this.controlId : this.id_(`opt-${i}`)}\n name=${this.uid}\n value=${option.value}\n .checked=${on}\n ?disabled=${this.disabled}\n ?required=${!this.multiple && this.required && i === 0}\n @change=${(e: Event) => this.choose(option.value, (e.target as HTMLInputElement).checked)}\n /><span>${option.label}</span>\n </label>`;\n })}\n </div>`;\n }\n\n render(): TemplateResult {\n return html`\n <fieldset part=\"fieldset\" aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}>\n ${this.renderLabel()}\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">${this.error || nothing}</div>\n </fieldset>\n `;\n }\n\n firstUpdated(): void {\n const initial = this.multiple ? this.values.join(',') : this.value;\n this.internals?.setFormValue(initial || null);\n this.syncValidity();\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n if (changed.has('required') || changed.has('multiple')) this.syncValidity();\n }\n\n /** A form reset clears the choice. */\n formResetCallback(): void {\n this.value = '';\n this.values = [];\n this.internals?.setFormValue(null);\n this.syncValidity();\n }\n}\n\ncustomElements.define('impakt-chip-group', ImpaktChipGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-chip-group': Impakt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EAC5E;AAAA;AAAA,EAGA,oBAA0B;AACxB,SAAK,QAAQ;AACb,SAAK,SAAS,CAAC;AACf,SAAK,WAAW,aAAa,IAAI;AACjC,SAAK,aAAa;AAAA,EACpB;AACF;AAEA,eAAe,OAAO,qBAAqB,eAAe;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/link.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, visuallyHidden } from '../base/styles';\nimport { fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A link.\n *\n * **A new tab is always announced.** When `external` is set, the accessible\n * name gains \"opens in a new tab\" — not as a tooltip, which no screen reader\n * reads, and not as an icon alone, which carries no text. An unannounced new\n * tab breaks the back button for someone who cannot see that the window\n * changed, and that is what 3.2.5 is about.\n *\n * **It is underlined.** 1.4.1 Use of Colour: a link distinguished from body\n * text only by being a different colour is not distinguished at all for a\n * reader who cannot tell the two colours apart.\n\n *\n * @category action\n * @icon link\n * @slot - The link text.\n */\nexport class ImpaktLink extends ImpaktElement {\n static properties = {\n href: { type: String },\n external: { type: Boolean, reflect: true },\n externalText: { type: String, attribute: 'external-text' },\n variant: { type: String, reflect: true },\n icon: { type: String },\n };\n\n declare href: string;\n declare external: boolean;\n declare externalText: string;\n /** In a sentence, or on its own line as a call to action, bolder and with an arrow. */\n declare variant: 'inline' | 'standalone';\n /** An icon after the words. A standalone link has an arrow unless it says otherwise. */\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\n constructor() {\n super();\n this.href = '';\n this.external = false;\n this.externalText = 'opens in a new tab';\n this.variant = 'inline';\n this.icon = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: inline;\n }\n a {\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n border-radius: ${t.radiusSm};\n }\n a:hover {\n color: ${t.linkHover};\n }\n :host([variant='standalone']) { display: inline-block; }\n :host([variant='standalone']) a { display: inline-flex; align-items: center; gap: ${space(1)}; font-weight: ${fontWeight('semibold')}; text-decoration-thickness: 1px; }\n :host([variant='standalone']) a:hover .icon { transform: translateX(2px); }\n .icon { flex: none; transition: transform 120ms ease-in-out; }\n .sr-only {\n ${visuallyHidden}\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <a\n part=\"link\"\n href=${this.href || nothing}\n target=${this.external ? '_blank' : nothing}\n rel=${this.external ? 'noopener noreferrer' : nothing}\n >\n <slot></slot>${iconSvg(this.icon !== 'none' ? this.icon : this.variant === 'standalone' ? (this.external ? 'external' : 'arrow-right') : undefined, '1em')}${this.external ? html`<span class=\"sr-only\"> (${this.externalText})</span>` : nothing}\n </a>\n `;\n }\n}\n\ncustomElements.define('impakt-link', ImpaktLink);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-link': ImpaktLink;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAwBjD,IAAM,aAAN,cAAyB,cAAc;AAAA,EAC5C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,UAAU,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MACzC,cAAc,EAAE,MAAM,QAAQ,WAAW,gBAAgB;AAAA,MACzD,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,MAAM,EAAE,MAAM,OAAO;AAAA,IACvB;AAAA;AAAA,EA2DA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,eAAe;AACpB,SAAK,UAAU;AACf,SAAK,OAAO;AAAA,EACd;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,cAAc;AAAA,MACjB;AAAA,MACA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKa,EAAE,IAAI;AAAA;AAAA;AAAA,yBAGE,EAAE,QAAQ;AAAA;AAAA;AAAA,iBAGlB,EAAE,SAAS;AAAA;AAAA;AAAA,0FAG8D,MAAM,CAAC,CAAC,kBAAkB,WAAW,UAAU,CAAC;AAAA;AAAA;AAAA;AAAA,UAIhI,cAAc;AAAA;AAAA;AAAA,IAGtB;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO;AAAA;AAAA;AAAA,eAGI,KAAK,QAAQ,OAAO;AAAA,iBAClB,KAAK,WAAW,WAAW,OAAO;AAAA,cACrC,KAAK,WAAW,wBAAwB,OAAO;AAAA;AAAA,uBAEtC,QAAQ,KAAK,SAAS,SAAS,KAAK,OAAO,KAAK,YAAY,eAAgB,KAAK,WAAW,aAAa,gBAAiB,QAAW,KAAK,CAAC,GAAG,KAAK,WAAW,+BAA+B,KAAK,YAAY,aAAa,OAAO;AAAA;AAAA;AAAA,EAGvP;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/navigation.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { say } from '../base/say';\nimport { focusRing, targetSize, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/** One link in a navigation or a trail. */\nexport interface NavLink {\n label: string;\n href: string;\n}\n\n/**\n * Whether a link is the page the visitor is on, or a page above it. Given `current`, the href of\n * the page as the page itself names it, only that link is the page; otherwise it is worked out\n * from the address, and on a server, where there is no address, nothing is.\n */\nexport function linkCurrent(href: string, current = ''): 'page' | 'section' | null {\n if (current) return href === current ? 'page' : null;\n return where(href);\n}\n\n/** Whether a link is the page the visitor is on, or a page above it. */\nfunction where(href: string): 'page' | 'section' | null {\n // A link to a place on this page, or to nowhere yet (\"#\"), is not where the reader is.\n if (typeof location === 'undefined' || !href || href.startsWith('#')) return null;\n let path: string;\n try {\n const url = new URL(href, location.href);\n // A link to another site is never where the reader is, even when its path matches, as a\n // product at app.example.com linking back to example.com/ would otherwise mark that link.\n if (url.origin !== location.origin) return null;\n path = url.pathname.replace(/\\/$/, '') || '/';\n } catch {\n return null;\n }\n const here = location.pathname.replace(/\\/$/, '') || '/';\n if (path === here) return 'page';\n return path !== '/' && here.startsWith(`${path}/`) ? 'section' : null;\n}\n\n/**\n * The site's main navigation: a row of links that folds into a Menu button\n * when there is not room for all of them, whatever the screen.\n *\n * **The page you are on is marked in words as well as colour.** Its link\n * carries `aria-current=\"page\"`, which a screen reader announces, and an\n * underline, so it does not rely on colour alone (1.4.1).\n *\n * **The menu is a disclosure, not a pop-up.** The Menu button says whether the\n * list is open (`aria-expanded`), the links follow it in the reading order, and\n * Escape closes it and returns focus to the button.\n *\n * @category action\n * @icon menu\n */\nexport class ImpaktNav extends ImpaktElement {\n static properties = {\n links: { type: Array },\n label: { type: String },\n menuText: { type: String, attribute: 'menu-text' },\n menuLook: { type: String, reflect: true, attribute: 'menu-look' },\n size: { type: String, reflect: true },\n align: { type: String, reflect: true },\n fold: { type: String, reflect: true },\n actionText: { type: String, attribute: 'action-text' },\n actionHref: { type: String, attribute: 'action-href' },\n look: { type: String, reflect: true },\n current: { type: String },\n };\n /** The links, in order. */\n declare links: NavLink[];\n /** What the navigation is called for a screen reader, such as \"Main\". */\n declare label: string;\n /** The words on the button that opens the links on a narrow screen. */\n declare menuText: string;\n /**\n * The Menu button: `button` with its words, or `icon`, a round button with\n * only the icon, the words kept as its name for screen readers.\n */\n declare menuLook: 'button' | 'icon';\n /** `sm` sets the links a step smaller and closer, as a site header's are. */\n declare size: 'md' | 'sm';\n /** Where the links sit along the row. */\n declare align: 'start' | 'center' | 'end';\n /**\n * How the links fold behind the Menu button. `measure` folds them when they do not fit, which\n * needs script. `narrow` folds them when the container around the nav is 40rem wide or less,\n * which is decided in CSS, and the Menu button then opens a whole-screen menu with no script at\n * all. `narrow` is for a page that may be drawn on a server and shown without script. It needs a\n * size container around the nav, and `impakt-site-header` is one.\n */\n declare fold: 'measure' | 'narrow';\n /** With `fold=\"narrow\"`: an action shown at the foot of the whole-screen menu, for a header that hides its own button on a narrow screen. */\n declare actionText: string;\n /** Where that action goes. */\n declare actionHref: string;\n /**\n * `links` is a row of words. `tabs` is the G2 site header's file tabs: a\n * bordered group on the soft surface, each tab 42px tall, and the page you\n * are on a white tab with a dot before it (frame 9:264). The current tab is\n * still `aria-current`, so it is not said by colour alone.\n */\n declare look: 'links' | 'tabs';\n /** The href of the link to mark as the page you are on, for when the page's address cannot say it (a preview, or `#` links). Unset, it is worked out from the address. */\n declare current: string;\n /** Whether the menu is open on a narrow screen. Not a setting: it is the visitor's. */\n private menuOpen = false;\n private get open(): boolean {\n return this.menuOpen;\n }\n private set open(next: boolean) {\n this.menuOpen = next;\n this.requestUpdate();\n }\n\n constructor() {\n super();\n this.links = [];\n this.label = 'Main';\n this.menuText = 'Menu';\n this.menuLook = 'button';\n this.size = 'md';\n this.align = 'end';\n this.fold = 'measure';\n this.actionText = '';\n this.actionHref = '';\n this.look = 'links';\n this.current = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n /* It grows to fill a row it sits in, because it measures itself to decide when to fold. */\n :host { display: block; flex: 1 1 8rem; min-inline-size: 0; }\n nav { display: flex; flex-direction: column; position: relative; }\n li { flex: none; }\n ul { list-style: none; margin: 0; padding: 0; display: flex; gap: ${space(1)} ${space(6)}; align-items: center; justify-content: flex-end; }\n :host([align='start']) ul { justify-content: flex-start; }\n :host([align='center']) ul { justify-content: center; }\n a { ${targetSize} display: inline-flex; align-items: center; padding: ${space(2)} ${space(1)}; color: inherit; font-weight: ${fontWeight('semibold')}; text-decoration: none; border-radius: ${t.radiusSm}; }\n a:hover { text-decoration: underline; text-underline-offset: 0.25em; }\n a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }\n .toggle { display: none; ${targetSize} align-items: center; gap: ${space(2)}; align-self: flex-end; padding: ${space(2)} ${space(3)}; font: inherit; font-weight: ${fontWeight('semibold')}; color: inherit; background: transparent; border: ${t.borderThin} solid currentColor; border-radius: ${t.radius}; cursor: pointer; }\n /* When they do not fit, the links fold behind a Menu button and open as a panel under it. */\n :host([folded]) { flex: 0 0 auto; }\n :host([folded]) .toggle { display: inline-flex; }\n :host([menu-look='icon']) .toggle { inline-size: 44px; block-size: 44px; padding: 0; justify-content: center; border: 0; border-radius: 50%; background: ${t.brand}; color: ${t.onBrand}; }\n :host([menu-look='icon']) .toggle .words { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n :host([size='sm']) ul { column-gap: ${space(6)}; }\n :host([size='sm']) a { padding-inline: 0; font-size: ${fontSize('sm')}; font-weight: ${fontWeight('medium')}; }\n :host([size='sm'][folded]) a { padding-inline: ${space(3)}; }\n :host([folded]) ul { display: none; position: absolute; inset-block-start: calc(100% + ${space(2)}); inset-inline-end: 0; z-index: 30; flex-direction: column; align-items: stretch; gap: 0; min-inline-size: 14rem; padding: ${space(2)}; background: ${t.surfaceCard}; color: ${t.text}; border: ${t.borderThin} solid ${t.border}; border-radius: ${t.radiusLg}; box-shadow: 0 8px 24px rgb(0 0 0 / 14%); }\n :host([folded]) ul.open { display: flex; }\n :host([folded]) li { text-align: start; }\n :host([folded]) a { display: flex; padding: ${space(3)} ${space(3)}; }\n /* Tabs: a bordered group on the soft surface; the current tab is white with a dot before it. */\n :host([look='tabs']) ul { gap: 0; padding: 3px; background: ${t.surfaceSubtle}; border: ${t.borderThin} solid var(--impakt-color-line-soft, #dcdcd8); }\n :host([look='tabs']) a { min-block-size: 42px; gap: ${space(2)}; padding: 0 ${space(4)}; font-size: ${fontSize('sm')}; font-weight: ${fontWeight('regular')}; border-radius: 0; }\n :host([look='tabs']) a:hover { text-decoration: none; background: ${t.wash}; }\n :host([look='tabs']) a[aria-current] { text-decoration: none; background: ${t.surfaceCard}; box-shadow: inset 0 0 0 1px var(--impakt-color-line-soft, #dcdcd8); }\n :host([look='tabs']) a[aria-current]::before { content: ''; flex: none; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; }\n @media (forced-colors: active) { :host([look='tabs']) a[aria-current] { outline: 1px solid CanvasText; } }\n :host([look='tabs'][folded]) ul { padding: ${space(2)}; }\n /* With no script the element is never defined, so it cannot measure itself and fold. The links\n wrap onto more lines instead, so they are never cut off or drawn over what is beside them. */\n :host(:not(:defined)) ul { flex-wrap: wrap; row-gap: 0; }\n /*\n * fold=\"narrow\": the fold is decided here, by the width of the container around the nav, so it\n * is the same before the script runs, after it, and without it. The Menu button opens the\n * panel as a popover, which the browser does by itself. On a wide screen the panel is not a box\n * at all, and its links sit in the row as they always did.\n */\n :host([fold='narrow']) .panel { display: contents; color: inherit; }\n :host([fold='narrow']) .close, :host([fold='narrow']) .action { display: none; }\n @container (max-width: 40rem) {\n :host([fold='narrow']) { flex: 0 0 auto; }\n :host([fold='narrow']) .toggle { display: inline-flex; }\n :host([fold='narrow']) .panel { display: none; }\n :host([fold='narrow']) .panel:popover-open { display: flex; flex-direction: column; gap: ${space(6)}; position: fixed; inset: 0; box-sizing: border-box; inline-size: 100%; block-size: 100%; max-inline-size: none; max-block-size: none; margin: 0; padding: ${space(3)} ${space(4)} calc(${space(6)} + env(safe-area-inset-bottom)); border: 0; overflow: auto; overscroll-behavior: contain; background: ${t.text}; color: ${t.surfaceCard}; }\n :host([fold='narrow']) .close { display: inline-flex; ${targetSize} align-items: center; gap: ${space(2)}; align-self: flex-end; padding: ${space(2)} ${space(3)}; font: inherit; font-weight: ${fontWeight('semibold')}; color: inherit; background: transparent; border: ${t.borderThin} solid currentColor; border-radius: ${t.radius}; cursor: pointer; }\n :host([fold='narrow']) ul { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; }\n :host([fold='narrow']) li { border-block-end: ${t.borderThin} solid color-mix(in srgb, currentColor 22%, transparent); }\n :host([fold='narrow']) li a { display: flex; padding: ${space(4)} 0; font-family: ${t.fontHeading}; font-size: ${fontSize('2xl')}; font-weight: ${fontWeight('semibold')}; letter-spacing: -0.02em; }\n :host([fold='narrow']) .action { display: flex; ${targetSize} align-items: center; justify-content: center; margin-block-start: auto; padding: ${space(3)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.text}; font-weight: ${fontWeight('semibold')}; text-decoration: none; border-radius: ${t.radius}; }\n :host([fold='narrow']) .action:hover { text-decoration: underline; }\n /*\n * The tabs look, folded: the whole-screen menu is ink, so the tab track's paper and the current tab's white box\n * are left off, and the tabs are drawn as the menu's large links. The current page keeps its dot and is\n * underlined, so it is marked by more than colour (1.4.1).\n */\n :host([fold='narrow'][look='tabs']) ul { padding: 0; background: transparent; border: 0; }\n :host([fold='narrow'][look='tabs']) li a { min-block-size: 0; gap: ${space(3)}; align-items: center; padding: ${space(4)} 0; color: inherit; background: transparent; box-shadow: none; }\n :host([fold='narrow'][look='tabs']) li a:hover { background: transparent; text-decoration: underline; text-underline-offset: 0.25em; }\n :host([fold='narrow'][look='tabs']) li a[aria-current] { background: transparent; box-shadow: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }\n :host([fold='narrow'][look='tabs']) li a[aria-current]::before { inline-size: 8px; block-size: 8px; }\n }\n `,\n ];\n\n /** The width the links need in one row. Measured once for each set of links, and again while folded it cannot be read. */\n private needs = 0;\n private resize?: ResizeObserver;\n\n private fit(): void {\n // With fold=\"narrow\" the fold is CSS's to decide, and nothing is measured.\n if (this.fold === 'narrow') {\n this.removeAttribute('folded');\n return;\n }\n // An element the server drew waits for the element around it before it draws here, and the\n // screen can report a size in that wait. There is nothing to measure until it has drawn.\n if (!this.hasUpdated) return;\n const room = this.getBoundingClientRect().width;\n if (room <= 0) return;\n if (!this.needs) {\n this.removeAttribute('folded');\n const items = Array.from(this.renderRoot.querySelectorAll('li'));\n const gap = Number.parseFloat(getComputedStyle(this.renderRoot.querySelector('ul')!).columnGap) || 0;\n this.needs = items.reduce((total, item) => total + item.getBoundingClientRect().width, 0) + gap * Math.max(0, items.length - 1);\n }\n const fold = this.needs > room;\n this.toggleAttribute('folded', fold);\n if (!fold && this.menuOpen) this.open = false;\n }\n\n protected updated(changed: Map<string, unknown>): void {\n if (changed.has('links') || changed.has('fold')) {\n this.needs = 0;\n this.fit();\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(() => this.fit());\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.resize?.disconnect();\n }\n\n private toggle(): void {\n this.open = !this.open;\n }\n\n private onKey(event: KeyboardEvent): void {\n if (event.key !== 'Escape' || !this.open) return;\n this.open = false;\n this.renderRoot.querySelector<HTMLButtonElement>('.toggle')?.focus();\n }\n\n /**\n * fold=\"narrow\": the Menu button and the panel are tied by `popovertarget`, so the browser opens\n * and closes the panel, moves on to it with Tab, and closes it on Escape, with no script. The\n * browser also tells a screen reader whether it is open.\n */\n private renderNarrow(): TemplateResult {\n const panel = this.id_('panel');\n return html`<nav aria-label=${this.label || nothing} part=\"nav\">\n <button class=\"toggle\" type=\"button\" popovertarget=${panel}>${iconSvg(this.menuLook === 'icon' ? 'menu-two' : 'menu')}<span class=\"words\">${this.menuText}</span></button>\n <div id=${panel} class=\"panel\" popover=\"auto\" part=\"panel\">\n <button class=\"close\" type=\"button\" popovertarget=${panel} popovertargetaction=\"hide\">${iconSvg('close')}<span>${say('Close')}</span></button>\n <ul part=\"list\">\n ${(this.links ?? []).map((link) => {\n const current = this.current ? (link.href === this.current ? 'page' : null) : where(link.href);\n return html`<li><a href=${link.href} aria-current=${current === 'page' ? 'page' : current === 'section' ? 'true' : nothing} part=\"link\">${link.label}</a></li>`;\n })}\n </ul>\n ${this.actionText ? html`<a class=\"action\" href=${this.actionHref || '#'} part=\"action\">${this.actionText}</a>` : nothing}\n </div>\n </nav>`;\n }\n\n render(): TemplateResult {\n if (this.fold === 'narrow') return this.renderNarrow();\n const list = this.id_('links');\n return html`<nav aria-label=${this.label || nothing} part=\"nav\" @keydown=${this.onKey}>\n <button class=\"toggle\" type=\"button\" aria-expanded=${this.open ? 'true' : 'false'} aria-controls=${list} @click=${this.toggle}>${iconSvg(this.open ? 'close' : this.menuLook === 'icon' ? 'menu-two' : 'menu')}<span class=\"words\">${this.menuText}</span></button>\n <ul id=${list} class=${this.open ? 'open' : ''} part=\"list\">\n ${(this.links ?? []).map((link) => {\n const current = this.current ? (link.href === this.current ? 'page' : null) : where(link.href);\n return html`<li><a href=${link.href} aria-current=${current === 'page' ? 'page' : current === 'section' ? 'true' : nothing} part=\"link\">${link.label}</a></li>`;\n })}\n </ul>\n </nav>`;\n }\n}\n\n/**\n * Where the page sits in the site, as a trail of links back to the top: Home,\n * then Developments, then this page.\n *\n * The last item is the page itself. It is not a link, and it carries\n * `aria-current=\"page\"`. The separators are drawn, not written, so a screen\n * reader reads the trail as a list rather than a string of slashes.\n *\n * @category action\n * @icon breadcrumbs\n */\nexport class ImpaktBreadcrumbs extends ImpaktElement {\n static properties = {\n items: { type: Array },\n label: { type: String },\n look: { type: String, reflect: true },\n };\n /** `default` is the body face with links. `mono` is the code face at 14px, muted, as the G2 tools' trail is (frame 34:602). */\n declare look: 'default' | 'mono';\n /** The trail, from the top of the site down to this page. */\n declare items: NavLink[];\n /** What the trail is called for a screen reader. */\n declare label: string;\n\n constructor() {\n super();\n this.items = [];\n this.label = 'Breadcrumb';\n this.look = 'default';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host { display: block; font-size: ${fontSize('sm')}; }\n ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${space(1)}; }\n li { display: inline-flex; align-items: center; gap: ${space(1)}; }\n li + li::before { content: ''; inline-size: 0.45em; block-size: 0.45em; border-block-start: 1.5px solid ${t.textMuted}; border-inline-end: 1.5px solid ${t.textMuted}; transform: rotate(45deg); margin-inline: ${space(1)} ${space(2)}; }\n a { color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; border-radius: ${t.radiusSm}; }\n a:hover { color: ${t.linkHover}; }\n [aria-current] { color: ${t.textMuted}; }\n :host([look='mono']) { font-family: ${t.fontMono}; font-size: ${fontSize('sm')}; color: ${t.textMuted}; }\n /* The G2 trail (34:602): \"Home / Tools / Accessibility\", a slash between, the links underlined only on hover. A trail is its own list, not a link in a sentence, so it needs no underline to be told apart (1.4.1). */\n :host([look='mono']) a { color: ${t.textMuted}; text-decoration: none; }\n :host([look='mono']) a:hover { color: ${t.text}; text-decoration: underline; text-decoration-thickness: 1px; }\n :host([look='mono']) [aria-current] { color: ${t.text}; }\n :host([look='mono']) li + li::before { content: '/'; inline-size: auto; block-size: auto; border: 0; transform: none; margin-inline: ${space(1)}; color: ${t.textMuted}; }\n .sr-only { ${visuallyHidden} }\n `,\n ];\n\n render(): TemplateResult {\n const items = this.items ?? [];\n return html`<nav aria-label=${this.label} part=\"nav\"><ol>\n ${items.map(\n (item, i) =>\n html`<li>${\n i === items.length - 1 ? html`<span aria-current=\"page\">${item.label}</span>` : html`<a href=${item.href} part=\"link\">${item.label}</a>`\n }</li>`,\n )}\n </ol></nav>`;\n }\n}\n\ncustomElements.define('impakt-nav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A,EAEA,SAAyB;AACvB,UAAM,QAAQ,KAAK,SAAS,CAAC;AAC7B,WAAO,uBAAuB,KAAK,KAAK;AAAA,QACpC,MAAM;AAAA,MACN,CAAC,MAAM,MACL,WACE,MAAM,MAAM,SAAS,IAAI,iCAAiC,KAAK,KAAK,YAAY,eAAe,KAAK,IAAI,gBAAgB,KAAK,KAAK,MACpI;AAAA,IACJ,CAAC;AAAA;AAAA,EAEL;AACF;AAEA,eAAe,OAAO,cAAc,SAAS;AAC7C,eAAe,OAAO,sBAAsB,iBAAiB;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/base/FieldElement.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type CSSResult, type TemplateResult } from 'lit';\nimport { ImpaktElement } from './ImpaktElement';\nimport { focusRing, visuallyHidden } from './styles';\nimport { fontSize, fontWeight, lineHeight, space, t, token } from './tokens';\n\n/**\n * The shared anatomy of a form control: a label, an optional description, a\n * control, and an error.\n *\n * This exists because the ARIA wiring between those four is where accessible\n * forms actually fail, and it fails the same way every time — a description\n * that is never announced, an error that appears silently, a label that points\n * at nothing. Written once, it is right once.\n *\n * Everything is rendered inside this component's own shadow root, including\n * the native control. That is not an implementation detail: `aria-describedby`\n * cannot cross a shadow boundary, so a component that slotted the input from\n * outside could not describe it. Keeping the whole relationship in one tree is\n * what makes the wiring work at all.\n */\n/**\n * How wide a single-line control is, from what it holds: a postcode is short,\n * an email address is long. A width that matches the answer is a hint about\n * what to type (1.3.5 is about the purpose, this is about the size). Applied by\n * the controls that take a `width`, through `--impakt-field-width`.\n */\nexport const fieldWidths = css`\n :host { --impakt-field-width: 100%; }\n :host([width='xs']) { --impakt-field-width: 8ch; }\n :host([width='sm']) { --impakt-field-width: 14ch; }\n :host([width='md']) { --impakt-field-width: 24ch; }\n :host([width='lg']) { --impakt-field-width: 40ch; }\n`;\n\n/**\n * The field's shape, from the brand (`field.*` in `@atomic-ui/design-tokens`). Each fallback is\n * the shape every brand derives: a 44px box with the grey border that darkens when pointed at,\n * and the brand's halo round the focus ring. The Impakt theme sets the G2 Noire shape over it:\n * a 50px box with an ink edge and the plain focus ring (frames 33:492 and 36:398).\n *\n * An edge is how much of the text colour it takes, mixed here rather than on the root, so a\n * band that repaints the text colour repaints the edge with it.\n */\nexport const F = {\n height: token('field.height', '44px'),\n paddingBlock: token('field.padding-block', '10px'),\n paddingInline: token('field.padding-inline', '12px'),\n lineHeight: token('field.line-height', 'normal'),\n radius: token('field.radius', '8px'),\n edge: token('field.edge', '0%'),\n focusEdge: token('field.focus-edge', '0%'),\n focusHalo: token('field.focus-halo', '6px'),\n};\n\n/**\n * The box a single control is drawn in, shared by the text input, the select and\n * the textarea so they match, in the brand's field shape (`F` above).\n * A product can still set `--impakt-shadow-field` or `--impakt-color-field-border`.\n */\nexport const fieldControl = (selector: string): CSSResult => {\n const s = unsafeCSS(selector);\n return css`\n ${s} {\n inline-size: min(100%, var(--impakt-field-width));\n min-block-size: ${F.height};\n padding: ${F.paddingBlock} ${F.paddingInline};\n font-family: inherit;\n font-size: ${fontSize('md')};\n line-height: ${F.lineHeight};\n color: ${t.text};\n background: var(--impakt-color-field-surface, ${t.surfaceCard});\n border: ${t.borderThin} solid var(--impakt-color-field-border, color-mix(in srgb, ${t.text} ${F.edge}, ${t.border}));\n border-radius: ${F.radius};\n box-shadow: var(--impakt-shadow-field, ${t.shadowXs});\n transition: border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n ${s}:hover:not(:disabled) {\n border-color: var(--impakt-color-field-border, color-mix(in srgb, ${t.text} ${F.edge}, ${t.borderStrong}));\n }\n /* The focus ring, and the brand's halo round it where the brand draws one, so the field being typed in is plain at a glance. */\n ${s}:focus-visible {\n border-color: color-mix(in srgb, ${t.text} ${F.focusEdge}, ${t.brand});\n box-shadow: ${t.focusShadow}, 0 0 0 ${F.focusHalo} ${t.brandHalo};\n }\n ${s}::placeholder {\n color: ${t.textPlaceholder};\n }\n ${s}:disabled {\n background: ${t.surfaceInset};\n cursor: not-allowed;\n }\n /* The border thickens as well as reddening, and the message below says it in words (1.4.1). */\n :host([invalid]) ${s} {\n border-color: ${t.danger};\n border-width: ${t.borderThick};\n }\n `;\n};\n\n/**\n * The base of every form control.\n *\n * @fires {CustomEvent<{ value: string }>} impakt-change - When the answer changes. The answer is in detail.value.\n */\nexport abstract class FieldElement extends ImpaktElement {\n /** Form controls participate in a `<form>` like native ones. */\n static formAssociated = true;\n\n static properties = {\n label: { type: String },\n name: { type: String },\n value: { type: String },\n description: { type: String },\n error: { type: String },\n required: { type: Boolean, reflect: true },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n requiredText: { type: String, attribute: 'required-text' },\n look: { type: String, reflect: true },\n };\n\n declare label: string;\n declare name: string;\n declare value: string;\n declare description: string;\n declare error: string;\n declare required: boolean;\n declare disabled: boolean;\n declare readonly: boolean;\n /**\n * How \"you must answer this\" is said.\n *\n * Words, not an asterisk. 3.3.2 asks for labels or instructions, and an\n * asterisk is neither until a legend explains it — which puts the\n * explanation somewhere other than the field it explains. It is a property\n * so a partner can reword it, not so they can empty it.\n */\n declare requiredText: string;\n /**\n * `default` takes the brand's field label; `site` is the mono uppercase label of the site's\n * forms, as the G2 contact frame (20:1100) draws \"NAME\" and \"MESSAGE\" and as\n * `impakt-chip-group look=\"site\"` draws its own (#66).\n */\n declare look: 'default' | 'site';\n\n protected internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.label = '';\n this.name = '';\n this.value = '';\n this.description = '';\n this.error = '';\n this.required = false;\n this.disabled = false;\n this.readonly = false;\n this.requiredText = 'required';\n this.look = 'default';\n // happy-dom and older engines do not implement attachInternals. A control\n // that cannot associate with a form is still a usable control, so this\n // degrades rather than throwing on construction.\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n /*\n * The question, at 14px in the ink: semibold in the body face, or under Noire in the code\n * face (G2). The brand sets the face and weight (field.label.*); a page can set it\n * another way through these properties, such as the site's contact form, which sets its\n * labels in capitals at 11px (frame 20:1157).\n */\n .label {\n display: block;\n font-family: var(--impakt-field-label-font, ${t.fontBody});\n font-size: var(--impakt-field-label-size, ${fontSize('sm')});\n font-weight: var(--impakt-field-label-weight, ${fontWeight('semibold')});\n letter-spacing: var(--impakt-field-label-tracking, normal);\n text-transform: var(--impakt-field-label-transform, none);\n line-height: ${lineHeight('normal')};\n margin-block-end: var(--impakt-field-label-space, ${space(1)});\n color: ${t.text};\n }\n /* The site's form label (20:1100): G2 Mono S, IBM Plex Mono medium at 11px, in capitals, 8px above the box (#66). */\n :host([look='site']) {\n --impakt-field-label-font: ${t.fontMono};\n --impakt-field-label-size: 0.6875rem;\n --impakt-field-label-weight: ${fontWeight('medium')};\n --impakt-field-label-tracking: 0.06em;\n --impakt-field-label-transform: uppercase;\n --impakt-field-label-space: ${space(2)};\n }\n .required {\n font-weight: ${fontWeight('regular')};\n color: ${t.textMuted};\n }\n .description {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.textMuted};\n margin-block-end: ${space(2)};\n }\n .error {\n font-size: ${fontSize('sm')};\n line-height: ${lineHeight('normal')};\n color: ${t.dangerText};\n margin-block-start: ${space(1)};\n display: flex;\n gap: ${space(1)};\n }\n .error:empty {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n /*\n * Only the control is dimmed. Dimming the whole host took the question,\n * the hint and the error below 4.5:1, and a disabled field still has to\n * say what it is and why it cannot be changed. The native disabled\n * control itself is exempt from the contrast criterion.\n */\n :host([disabled]) :is(input, select, textarea, button) {\n opacity: 0.6;\n cursor: not-allowed;\n }\n `,\n ];\n\n protected get controlId(): string {\n return this.id_('control');\n }\n\n /**\n * What the control points `aria-describedby` at.\n *\n * The error id is included only while there is an error. A describedby that\n * always names an empty element trains a screen-reader user to expect\n * nothing after the description, and then the one time it matters they have\n * already learned to ignore it.\n */\n protected get describedBy(): string | typeof nothing {\n const ids = [this.description ? this.id_('description') : '', this.error ? this.id_('error') : ''].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n /**\n * Focusing the element focuses its control, so `el.focus()` from an app, a\n * React ref or the error summary's link lands where someone can type, rather\n * than on a host that cannot take focus and so silently does nothing.\n */\n focus(options?: FocusOptions): void {\n const control =\n this.renderRoot?.querySelector<HTMLElement>(`#${this.controlId}`) ?? this.renderRoot?.querySelector<HTMLElement>('input, select, textarea, button');\n if (control) control.focus(options);\n else super.focus(options);\n }\n\n /** Subclasses render the control itself; everything round it is here. */\n protected abstract renderControl(): TemplateResult;\n\n /**\n * `<label for>` by default. A group of controls — radios, checkboxes —\n * cannot use one, because `for` names a single control, so those override\n * this and render a `<fieldset>` and `<legend>` instead.\n */\n protected renderLabel(): TemplateResult {\n return html`\n <label class=\"label\" for=${this.controlId} part=\"label\">\n ${this.label}${this.required ? html`<span class=\"required\"> (${this.requiredText})</span>` : nothing}\n </label>\n `;\n }\n\n render(): TemplateResult {\n return html`\n ${this.renderLabel()}\n ${\n this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing\n }\n ${this.renderControl()}\n <!--\n The error region is always present, even when empty. A live region\n inserted at the same moment as its content is announced unreliably\n across screen readers; one that already exists and is then filled is\n announced consistently. \"polite\" rather than \"assertive\" because a\n validation message should not interrupt what is being read.\n -->\n <div\n class=\"error\"\n id=${this.id_('error')}\n part=\"error\"\n aria-live=\"polite\"\n >\n ${this.error || nothing}\n </div>\n `;\n }\n\n /** Keep the form value in step with the control. */\n protected setFormValue(value: string): void {\n this.value = value;\n this.internals?.setFormValue(value);\n this.dispatchEvent(new CustomEvent('impakt-change', { detail: this.changeDetail(value), bubbles: true, composed: true }));\n }\n\n /** What `impakt-change` carries. A control with more to say than its value adds it here. */\n protected changeDetail(value: string): { value: string } {\n return { value };\n }\n}\n"],"m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pJ,QAAI,QAAS,SAAQ,MAAM,OAAO;AAAA,QAC7B,OAAM,MAAM,OAAO;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUU,cAA8B;AACtC,WAAO;AAAA,iCACsB,KAAK,SAAS;AAAA,UACrC,KAAK,KAAK,GAAG,KAAK,WAAW,gCAAgC,KAAK,YAAY,aAAa,OAAO;AAAA;AAAA;AAAA,EAG1G;AAAA,EAEA,SAAyB;AACvB,WAAO;AAAA,QACH,KAAK,YAAY,CAAC;AAAA,QAElB,KAAK,cACD,mCAAmC,KAAK,IAAI,aAAa,CAAC;AAAA,cACxD,KAAK,WAAW;AAAA,oBAElB,OACN;AAAA,QACE,KAAK,cAAc,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAUf,KAAK,IAAI,OAAO,CAAC;AAAA;AAAA;AAAA;AAAA,UAIpB,KAAK,SAAS,OAAO;AAAA;AAAA;AAAA,EAG7B;AAAA;AAAA,EAGU,aAAa,OAAqB;AAC1C,SAAK,QAAQ;AACb,SAAK,WAAW,aAAa,KAAK;AAClC,SAAK,cAAc,IAAI,YAAY,iBAAiB,EAAE,QAAQ,KAAK,aAAa,KAAK,GAAG,SAAS,MAAM,UAAU,KAAK,CAAC,CAAC;AAAA,EAC1H;AAAA;AAAA,EAGU,aAAa,OAAkC;AACvD,WAAO,EAAE,MAAM;AAAA,EACjB;AACF;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|