@atomic-ui/ui 0.13.1 → 0.13.2

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.
Files changed (73) hide show
  1. package/custom-elements.json +474 -3
  2. package/dist/base/FieldElement.d.ts +10 -0
  3. package/dist/{chunk-2BGOBD6Y.js → chunk-273AYERA.js} +2 -2
  4. package/dist/{chunk-EUOBFMWC.js → chunk-6IQIFKY6.js} +2 -2
  5. package/dist/{chunk-WEX5RKVC.js → chunk-BTACNWU6.js} +2 -2
  6. package/dist/{chunk-5OCDXZXG.js → chunk-C767LTJE.js} +3 -2
  7. package/dist/chunk-C767LTJE.js.map +1 -0
  8. package/dist/{chunk-RNFGIXJ7.js → chunk-CN4J5RS2.js} +2 -2
  9. package/dist/{chunk-SRXC6ZPM.js → chunk-DJLUWM3C.js} +10 -1
  10. package/dist/chunk-DJLUWM3C.js.map +1 -0
  11. package/dist/{chunk-F2MFV7RM.js → chunk-DKVLA7AF.js} +2 -2
  12. package/dist/{chunk-P5FAKEFK.js → chunk-GIIJ32FN.js} +2 -2
  13. package/dist/{chunk-LSEK5MEZ.js → chunk-H5HWJ2D4.js} +2 -2
  14. package/dist/{chunk-B2GWXXIW.js → chunk-JDKOHA3B.js} +2 -2
  15. package/dist/{chunk-G7CVRNY5.js → chunk-JX5RJRME.js} +5 -4
  16. package/dist/chunk-JX5RJRME.js.map +1 -0
  17. package/dist/{chunk-WT7MHYJR.js → chunk-KDU2POFS.js} +11 -5
  18. package/dist/chunk-KDU2POFS.js.map +1 -0
  19. package/dist/{chunk-EA3M6KPB.js → chunk-NCVBRUJM.js} +6 -1
  20. package/dist/chunk-NCVBRUJM.js.map +1 -0
  21. package/dist/{chunk-NZSKUEYS.js → chunk-VR543SMV.js} +2 -2
  22. package/dist/{chunk-QJBRENLI.js → chunk-WGFHYSXH.js} +7 -3
  23. package/dist/{chunk-QJBRENLI.js.map → chunk-WGFHYSXH.js.map} +1 -1
  24. package/dist/{chunk-PII4SJL5.js → chunk-X57BTN6V.js} +14 -2
  25. package/dist/chunk-X57BTN6V.js.map +1 -0
  26. package/dist/components/app-bar.d.ts +5 -4
  27. package/dist/components/app-bar.js +3 -3
  28. package/dist/components/app-ui.d.ts +4 -0
  29. package/dist/components/app-ui.js +2 -2
  30. package/dist/components/checkbox-group.d.ts +4 -0
  31. package/dist/components/checkbox-group.js +2 -2
  32. package/dist/components/checkbox.d.ts +4 -0
  33. package/dist/components/checkbox.js +2 -2
  34. package/dist/components/chip-group.d.ts +1 -0
  35. package/dist/components/chip-group.js +2 -2
  36. package/dist/components/chip.js +1 -1
  37. package/dist/components/date-input.d.ts +4 -0
  38. package/dist/components/date-input.js +2 -2
  39. package/dist/components/journey.d.ts +16 -0
  40. package/dist/components/journey.js +2 -2
  41. package/dist/components/navigation.d.ts +6 -0
  42. package/dist/components/navigation.js +5 -3
  43. package/dist/components/page.js +1 -1
  44. package/dist/components/radio-group.d.ts +4 -0
  45. package/dist/components/radio-group.js +2 -2
  46. package/dist/components/select.d.ts +4 -0
  47. package/dist/components/select.js +2 -2
  48. package/dist/components/switch.d.ts +8 -0
  49. package/dist/components/switch.js +2 -2
  50. package/dist/components/text-input.d.ts +4 -0
  51. package/dist/components/text-input.js +2 -2
  52. package/dist/components/textarea.d.ts +4 -0
  53. package/dist/components/textarea.js +2 -2
  54. package/dist/index.d.ts +1 -1
  55. package/dist/index.js +19 -17
  56. package/dist/standalone/atomic-ui.js +149 -120
  57. package/dist/standalone/atomic-ui.js.map +3 -3
  58. package/package.json +2 -2
  59. package/dist/chunk-5OCDXZXG.js.map +0 -1
  60. package/dist/chunk-EA3M6KPB.js.map +0 -1
  61. package/dist/chunk-G7CVRNY5.js.map +0 -1
  62. package/dist/chunk-PII4SJL5.js.map +0 -1
  63. package/dist/chunk-SRXC6ZPM.js.map +0 -1
  64. package/dist/chunk-WT7MHYJR.js.map +0 -1
  65. /package/dist/{chunk-2BGOBD6Y.js.map → chunk-273AYERA.js.map} +0 -0
  66. /package/dist/{chunk-EUOBFMWC.js.map → chunk-6IQIFKY6.js.map} +0 -0
  67. /package/dist/{chunk-WEX5RKVC.js.map → chunk-BTACNWU6.js.map} +0 -0
  68. /package/dist/{chunk-RNFGIXJ7.js.map → chunk-CN4J5RS2.js.map} +0 -0
  69. /package/dist/{chunk-F2MFV7RM.js.map → chunk-DKVLA7AF.js.map} +0 -0
  70. /package/dist/{chunk-P5FAKEFK.js.map → chunk-GIIJ32FN.js.map} +0 -0
  71. /package/dist/{chunk-LSEK5MEZ.js.map → chunk-H5HWJ2D4.js.map} +0 -0
  72. /package/dist/{chunk-B2GWXXIW.js.map → chunk-JDKOHA3B.js.map} +0 -0
  73. /package/dist/{chunk-NZSKUEYS.js.map → chunk-VR543SMV.js.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomic-ui/ui",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
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",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "lit": "^3.3.3",
38
- "@atomic-ui/design-tokens": "^0.13.1"
38
+ "@atomic-ui/design-tokens": "^0.13.2"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@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 /* 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 ${t.text}; 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,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S,IAAI,CAAC;AAAA,wDACxK,EAAE,MAAM;AAAA;AAAA,mDAEb,EAAE,UAAU,UAAU,EAAE,IAAI,iBAAiB,EAAE,WAAW,qBAAqB,MAAM,0BAA0B,QAAQ,CAAC;AAAA,0EACjG,WAAW,QAAQ,CAAC;AAAA;AAAA,8FAEA,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,aAAa,EAAE,UAAU,UAAU,EAAE,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,EAAE,QAAQ;AAAA,wFAC7H,MAAM,CAAC,CAAC,cAAc,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,aAAa,EAAE,UAAU,UAAU,EAAE,IAAI,oBAAoB,EAAE,MAAM,kBAAkB,EAAE,QAAQ;AAAA,8CACrL,IAAI,4FAA4F,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA,8BAI3H,MAAM,wBAAwB,SAAS,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/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/** 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', ImpaktNav);\ncustomElements.define('impakt-breadcrumbs', ImpaktBreadcrumbs);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-nav': ImpaktNav;\n 'impakt-breadcrumbs': ImpaktBreadcrumbs;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAcxD,SAAS,MAAM,MAAyC;AAEtD,MAAI,OAAO,aAAa,eAAe,CAAC,QAAQ,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"],"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 */\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 font-size: ${kit.tiny};\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: ${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 HTMLElementTagName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IAAI,UAAU,EAAG,MAAK,aAAa;AAAA,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/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 };\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 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 // 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 .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"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,SAAS,iBAAsD;AA0B5E,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBpB,IAAM,IAAI;AAAA,EACf,QAAQ,MAAM,gBAAgB,MAAM;AAAA,EACpC,cAAc,MAAM,uBAAuB,MAAM;AAAA,EACjD,eAAe,MAAM,wBAAwB,MAAM;AAAA,EACnD,YAAY,MAAM,qBAAqB,QAAQ;AAAA,EAC/C,QAAQ,MAAM,gBAAgB,KAAK;AAAA,EACnC,MAAM,MAAM,cAAc,IAAI;AAAA,EAC9B,WAAW,MAAM,oBAAoB,IAAI;AAAA,EACzC,WAAW,MAAM,oBAAoB,KAAK;AAC5C;AAOO,IAAM,eAAe,CAAC,aAAgC;AAC3D,QAAM,IAAI,UAAU,QAAQ;AAC5B,SAAO;AAAA,MACH,CAAC;AAAA;AAAA,wBA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Aa,KAAK,GAAG,SAAS,MAAM,UAAU,KAAK,CAAC,CAAC;AAAA,EAC1H;AAAA;AAAA,EAGU,aAAa,OAAkC;AACvD,WAAO,EAAE,MAAM;AAAA,EACjB;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/app-bar.ts"],"sourcesContent":["/**\n * The frame every AI tool sits in: the app bar.\n */\nimport { css, html, nothing, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, touchTarget } from '../base/styles';\nimport { space, t, token } from '../base/tokens';\nimport { kit } from './tool-kit-tokens';\nimport type { MenuItem } from './app-ui';\nimport './app-ui';\n\nexport interface AppBarLink {\n label: string;\n href: string;\n /** The page that is showing. */\n current?: boolean;\n}\n\n/**\n * An item in the \"All tools\" switcher or the organisation menu. `group`,\n * `meta`, `current` and `disabled` are drawn by `impakt-menu`: the group's\n * heading (\"Tools\", \"Working in\", \"Account\"), a mono note on the right\n * (\"Open\", \"You are here\", \"Coming soon\"), the tool that is showing, and a\n * tool that cannot be opened yet.\n */\nexport type AppBarMenuItem = MenuItem & {\n group?: string;\n meta?: string;\n current?: boolean;\n disabled?: boolean;\n};\n\n/** The menu's parts, passed on under a prefix so a product can reach them from outside the bar. */\nconst MENU_PARTS = ['trigger', 'chevron', 'panel', 'header', 'list', 'group', 'group-label', 'item', 'current', 'label', 'meta'];\nconst exportPrefixed = (prefix: string): string => MENU_PARTS.map((part) => `${part}: ${prefix}-${part}`).join(', ');\nconst SWITCHER_PARTS = exportPrefixed('switcher');\nconst ORGANISATION_PARTS = exportPrefixed('organisation');\n\n/**\n * The bar at the top of every AI tool: the Impakt mark and the tool's name on\n * the left, the tool's own pages in the middle, and the way to other tools and\n * the organisation on the right.\n *\n * It is a `header` landmark, 56px tall. \"impakt\" links home; the tool's name\n * follows a \"/\". The tool's pages, when it has more than one, are a `nav`\n * drawn as a segmented track, and the page that is showing is marked with\n * `aria-current=\"page\"` as well as a dot, so it is never told by colour.\n *\n * On the right, the built-in \"All tools\" switcher is an `impakt-menu` of the\n * `switcher` items, grouped and annotated (Tools, Working in, Account). Put\n * your own controls in the `tools` slot to replace it, and put a language switch\n * or anything else before it in the `extra` slot. Then comes the organisation menu, from\n * `organisation-items`; or, when `signed-out`, a \"Sign in\" link in its place.\n *\n * **On a narrow screen the pages move to a second row** under the mark and\n * the menus, the full width of the bar, and scroll sideways if they still do\n * not fit. Folding them away behind a button would hide where you are; a row\n * that scrolls keeps the current page in view and every page one swipe or one\n * Tab away. The bar reflows to 320px without the page scrolling sideways.\n *\n * Figma: kit `33:361`, `33:365`; every tool screen, such as `36:431`, `36:642`,\n * `37:420`, `37:591`, `39:468`, `39:603`, `39:746`, `53:674`, `53:801`; signed\n * out `36:382`; dark `48:527`, `48:857`; the switcher open `53:960`, `53:800`.\n *\n * @category navigation\n * @icon menu\n * @slot tools - Replaces the built-in \"All tools\" switcher.\n * @slot extra - Before the \"All tools\" switcher, such as an `impakt-language-switch` (39:468).\n * @csspart bar - The header.\n * @csspart home - The link home.\n * @csspart pages - The tool's own pages.\n * @csspart sign-in - The sign-in link.\n * @csspart switcher-trigger - The \"All tools\" switcher's button.\n * @csspart switcher-chevron - The arrow on the switcher's button.\n * @csspart switcher-header - The box round the switcher's header, when it has one.\n * @csspart switcher-panel - The box the switcher opens, 340px wide as in `53:960`.\n * @csspart switcher-list - The switcher's list of items.\n * @csspart switcher-group - A group of the switcher's items, with its label.\n * @csspart switcher-group-label - A group's label in the switcher, such as \"Tools\".\n * @csspart switcher-item - An item in the switcher. The tool you are in is also `switcher-current`.\n * @csspart switcher-current - The switcher's item for the tool you are in.\n * @csspart switcher-label - An item's words in the switcher.\n * @csspart switcher-meta - An item's note in the switcher, such as \"Plans, team, billing\".\n * @csspart organisation-trigger - The organisation menu's button.\n * @csspart organisation-chevron - The arrow on the organisation menu's button.\n * @csspart organisation-panel - The box the organisation menu opens.\n * @csspart organisation-header - The box round the organisation menu's header, when it has one.\n * @csspart organisation-list - The organisation menu's list of items.\n * @csspart organisation-group - A group of the organisation menu's items, with its label.\n * @csspart organisation-group-label - A group's label in the organisation menu.\n * @csspart organisation-item - An item in the organisation menu. The page you are on is also `organisation-current`.\n * @csspart organisation-current - The organisation menu's item for the page you are on.\n * @csspart organisation-label - An item's words in the organisation menu.\n * @csspart organisation-meta - An item's note in the organisation menu.\n */\nexport class ImpaktAppBar extends ImpaktElement {\n static properties = {\n tool: { type: String },\n home: { type: String },\n brand: { type: String },\n links: { type: Array },\n pagesLabel: { type: String, attribute: 'pages-label' },\n switcher: { type: Array },\n switcherLabel: { type: String, attribute: 'switcher-label' },\n toolsHref: { type: String, attribute: 'tools-href' },\n organisation: { type: String },\n organisationItems: { type: Array, attribute: 'organisation-items' },\n organisationHref: { type: String, attribute: 'organisation-href' },\n signedOut: { type: Boolean, reflect: true, attribute: 'signed-out' },\n signInHref: { type: String, attribute: 'sign-in-href' },\n signInText: { type: String, attribute: 'sign-in-text' },\n };\n\n /** The tool's name, as it follows \"impakt /\": \"accessibility\". */\n declare tool: string;\n /** Where \"impakt\" leads. */\n declare home: string;\n /** The word beside the mark. */\n declare brand: string;\n /** The tool's own pages, drawn in the middle. */\n declare links: AppBarLink[];\n /** The name of the pages' navigation landmark. */\n declare pagesLabel: string;\n /** The \"All tools\" menu: the tools, where you are working, and the account. */\n declare switcher: AppBarMenuItem[];\n /** The switcher's button. */\n declare switcherLabel: string;\n /** With no `switcher` items, \"All tools\" is a link here instead. */\n declare toolsHref: string;\n /** The organisation's name on its menu button. */\n declare organisation: string;\n /** The organisation menu. */\n declare organisationItems: AppBarMenuItem[];\n /** With no `organisation-items`, the organisation is a link here instead. */\n declare organisationHref: string;\n /** Nobody is signed in: a \"Sign in\" link takes the organisation's place. */\n declare signedOut: boolean;\n declare signInHref: string;\n declare signInText: string;\n\n constructor() {\n super();\n this.tool = '';\n this.home = '/';\n this.brand = 'impakt';\n this.links = [];\n this.pagesLabel = 'Tool pages';\n this.switcher = [];\n this.switcherLabel = 'All tools';\n this.toolsHref = '';\n this.organisation = 'Your organisation';\n this.organisationItems = [];\n this.organisationHref = '';\n this.signedOut = false;\n this.signInHref = '/sign-in';\n this.signInText = 'Sign in';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.home, .pages a, .sign-in, a.org, .all'),\n css`\n :host {\n display: block;\n container-type: inline-size;\n font-family: ${t.fontBody};\n font-size: ${kit.small};\n }\n .bar {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);\n grid-template-areas: 'start pages end';\n align-items: center;\n gap: ${space(2)} ${space(4)};\n min-block-size: 56px;\n padding: ${space(2)} ${space(4)};\n color: ${t.text};\n background: ${t.surfaceCard};\n border-block-end: 1px solid ${token('color.line.grid', 'light-dark(#DCDCD8, #1F1F1F)')};\n }\n .start {\n grid-area: start;\n display: flex;\n align-items: center;\n gap: ${space(2.5)};\n min-inline-size: 0;\n }\n .home {\n display: inline-flex;\n align-items: center;\n gap: ${space(2.5)};\n min-block-size: ${t.targetMin};\n color: inherit;\n text-decoration: none;\n }\n .home:hover .word {\n text-decoration: underline;\n text-underline-offset: 3px;\n }\n .mark {\n display: inline-grid;\n place-items: center;\n flex: none;\n inline-size: 28px;\n block-size: 28px;\n font-weight: ${kit.medium};\n color: ${kit.onInverse};\n background: ${kit.inverse};\n }\n .sep {\n color: ${t.textMuted};\n }\n .tool {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n .pages {\n grid-area: pages;\n min-inline-size: 0;\n max-inline-size: 100%;\n overflow-x: auto;\n scrollbar-width: thin;\n }\n .pages ul {\n display: flex;\n inline-size: max-content;\n margin: 0;\n padding: 3px;\n list-style: none;\n background: ${t.surfaceSubtle};\n border: 1px solid ${kit.lineSoft};\n }\n .pages a {\n display: inline-flex;\n align-items: center;\n gap: ${space(1.5)};\n min-block-size: 28px;\n padding: 0 ${space(2.5)};\n font-weight: ${kit.regular};\n color: ${t.textMuted};\n text-decoration: none;\n white-space: nowrap;\n border: 1px solid transparent;\n }\n .pages a:hover {\n color: ${t.text};\n }\n .pages a[aria-current='page'] {\n color: ${t.text};\n background: ${t.surfaceCard};\n border-color: ${kit.lineSoft};\n }\n .dot {\n inline-size: 5px;\n block-size: 5px;\n border-radius: 50%;\n background: currentColor;\n }\n .end {\n grid-area: end;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: flex-end;\n gap: ${space(2)} ${space(3)};\n min-inline-size: 0;\n }\n .all {\n color: ${t.textMuted};\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n min-block-size: ${t.targetMin};\n }\n .all:hover {\n color: ${t.text};\n text-decoration: underline;\n }\n impakt-menu.switcher::part(trigger) {\n padding: ${space(1)} ${space(1)};\n font-family: ${t.fontBody};\n font-size: ${kit.small};\n font-weight: ${kit.regular};\n color: ${t.textMuted};\n background: transparent;\n border: 0;\n border-radius: 0;\n box-shadow: none;\n }\n impakt-menu.switcher::part(trigger):hover {\n color: ${t.text};\n }\n impakt-menu::part(chevron) {\n color: inherit;\n }\n /* The switcher's panel is 340 wide (53:960), so \"Your account\" and \"Plans, team, billing\" sit on one line.\n On a 390 screen that still leaves the 16px gutters; narrower than that it keeps to the gutters and the words may wrap. */\n impakt-menu.switcher::part(panel) {\n inline-size: min(21.25rem, calc(100vw - 2 * ${space(4)}));\n max-inline-size: none;\n }\n impakt-menu.org::part(trigger),\n a.org,\n .sign-in {\n display: inline-flex;\n align-items: center;\n gap: ${space(2)};\n padding: 9px 14px;\n font-family: ${t.fontBody};\n font-size: ${kit.small};\n font-weight: ${kit.medium};\n color: ${t.text};\n background: ${t.surfaceCard};\n border: 1px solid ${t.text};\n border-radius: 0;\n box-shadow: none;\n text-decoration: none;\n }\n impakt-menu.org::part(trigger):hover,\n a.org:hover,\n .sign-in:hover {\n background: ${t.surfaceSubtle};\n }\n @container (max-width: 56rem) {\n .bar {\n grid-template-columns: minmax(0, 1fr) auto;\n grid-template-areas: 'start end' 'pages pages';\n padding-block: ${space(2)};\n }\n }\n @container (max-width: 30rem) {\n .bar {\n grid-template-columns: minmax(0, 1fr);\n grid-template-areas: 'start' 'end' 'pages';\n padding-inline: ${space(4)};\n }\n .end {\n justify-content: flex-start;\n }\n }\n @media (forced-colors: active) {\n .pages a[aria-current='page'] {\n border-color: CanvasText;\n }\n .mark {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private renderPages(): TemplateResult | typeof nothing {\n if (!this.links.length) return nothing;\n return html`<nav class=\"pages\" part=\"pages\" aria-label=${this.pagesLabel}>\n <ul>\n ${this.links.map(\n (link) =>\n html`<li>\n <a href=${link.href} aria-current=${link.current ? 'page' : nothing}\n >${link.current ? html`<span class=\"dot\" aria-hidden=\"true\"></span>` : nothing}${link.label}</a\n >\n </li>`,\n )}\n </ul>\n </nav>`;\n }\n\n private renderSwitcher(): TemplateResult | typeof nothing {\n if (this.switcher.length)\n return html`<impakt-menu class=\"switcher\" exportparts=${SWITCHER_PARTS} edge=\"end\" trigger-look=\"text\" .label=${this.switcherLabel} .items=${this.switcher as MenuItem[]}></impakt-menu>`;\n if (this.toolsHref) return html`<a class=\"all\" href=${this.toolsHref}>${this.switcherLabel}</a>`;\n return nothing;\n }\n\n private renderAccount(): TemplateResult | typeof nothing {\n if (this.signedOut) return html`<a class=\"sign-in\" part=\"sign-in\" href=${this.signInHref}>${this.signInText}</a>`;\n if (this.organisationItems.length)\n return html`<impakt-menu class=\"org\" exportparts=${ORGANISATION_PARTS} edge=\"end\" trigger-look=\"text\" .label=${this.organisation} .items=${this.organisationItems as MenuItem[]}></impakt-menu>`;\n if (this.organisationHref) return html`<a class=\"org\" href=${this.organisationHref}>${this.organisation}</a>`;\n return nothing;\n }\n\n render(): TemplateResult {\n return html`<header class=\"bar\" part=\"bar\">\n <div class=\"start\">\n <a class=\"home\" part=\"home\" href=${this.home}><span class=\"mark\" aria-hidden=\"true\">i</span><span class=\"word\">${this.brand}</span></a>\n ${this.tool ? html`<span class=\"sep\" aria-hidden=\"true\">/</span><span class=\"tool\">${this.tool}</span>` : nothing}\n </div>\n ${this.renderPages()}\n <div class=\"end\">\n <slot name=\"extra\"></slot>\n <slot name=\"tools\">${this.renderSwitcher()}</slot>\n ${this.renderAccount()}\n </div>\n </header>`;\n }\n}\n\ncustomElements.define('impakt-app-bar', ImpaktAppBar);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-app-bar': ImpaktAppBar;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,SAAS,KAAK,MAAM,eAAoC;AA8BxD,IAAM,aAAa,CAAC,WAAW,WAAW,SAAS,UAAU,QAAQ,SAAS,eAAe,QAAQ,WAAW,SAAS,MAAM;AAC/H,IAAM,iBAAiB,CAAC,WAA2B,WAAW,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,MAAM,IAAI,IAAI,EAAE,EAAE,KAAK,IAAI;AACnH,IAAM,iBAAiB,eAAe,UAAU;AAChD,IAAM,qBAAqB,eAAe,cAAc;AA2DjD,IAAM,eAAN,cAA2B,cAAc;AAAA,EAC9C;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,OAAO,EAAE,MAAM,OAAO;AAAA,MACtB,OAAO,EAAE,MAAM,MAAM;AAAA,MACrB,YAAY,EAAE,MAAM,QAAQ,WAAW,cAAc;AAAA,MACrD,UAAU,EAAE,MAAM,MAAM;AAAA,MACxB,eAAe,EAAE,MAAM,QAAQ,WAAW,iBAAiB;AAAA,MAC3D,WAAW,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,MACnD,cAAc,EAAE,MAAM,OAAO;AAAA,MAC7B,mBAAmB,EAAE,MAAM,OAAO,WAAW,qBAAqB;AAAA,MAClE,kBAAkB,EAAE,MAAM,QAAQ,WAAW,oBAAoB;AAAA,MACjE,WAAW,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,aAAa;AAAA,MACnE,YAAY,EAAE,MAA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,CAAC;AAAA;AAAA;AAAA,6BAGG,KAAK,eAAe,CAAC;AAAA,UACxC,KAAK,cAAc,CAAC;AAAA;AAAA;AAAA,EAG5B;AACF;AAEA,eAAe,OAAO,kBAAkB,YAAY;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/textarea.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldControl, fieldWidths } from '../base/FieldElement';\n\n/** Several lines of text — a delivery instruction, an additional note.\n *\n * @category form\n * @icon field\n */\nexport class ImpaktTextarea extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n rows: { type: Number },\n maxlength: { type: Number },\n fillFrom: { type: String, attribute: 'fill-from' },\n placeholder: { type: String },\n };\n\n declare rows: number;\n declare maxlength: number | undefined;\n /** `estimate` starts an empty box with the estimate a cost estimator sent on, so the visitor can edit it. */\n declare fillFrom: 'none' | 'estimate';\n /** An example of what to write. The label is still the field's name; a placeholder never replaces it. */\n declare placeholder: string;\n\n /** How wide the box is, to suit the answer. Full width on a phone whatever this says. */\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n\n constructor() {\n super();\n this.width = 'full';\n this.rows = 4;\n this.maxlength = undefined;\n this.fillFrom = 'none';\n this.placeholder = '';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n fieldControl('textarea'),\n css`\n textarea {\n /* Resizing is left on deliberately. 1.4.4 and 1.4.12 both assume text\n can be made bigger, and a fixed box is where that stops working. */\n resize: vertical;\n }\n `,\n ];\n\n private filled = false;\n /** The estimate it was filled with, kept until the visitor edits it, so a binding that has not caught up yet cannot empty the box. */\n private filledText = '';\n\n /** @ignore */\n protected willUpdate(changed: Map<string, unknown>): void {\n super.willUpdate?.(changed as never);\n if (this.filledText && changed.has('value') && !this.value) this.value = this.filledText;\n }\n\n /** Fills the box once, when it is first asked to and is still empty. Props can arrive after the element joins the page. */\n private fill(): void {\n if (this.filled || this.fillFrom !== 'estimate') return;\n this.filled = true;\n if (this.value) return;\n let saved: string | null = null;\n try {\n saved = sessionStorage.getItem('impakt.estimate');\n } catch {\n saved = null;\n }\n if (saved) {\n this.filledText = saved;\n this.setFormValue(saved);\n }\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <textarea\n id=${this.controlId}\n part=\"textarea\"\n name=${this.name || nothing}\n rows=${this.rows}\n maxlength=${this.maxlength ?? nothing}\n placeholder=${this.placeholder || nothing}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n .value=${this.value}\n @input=${(e: Event) => {\n this.filledText = '';\n this.setFormValue((e.target as HTMLTextAreaElement).value);\n }}\n ></textarea>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n this.fill();\n }\n}\n\ncustomElements.define('impakt-textarea', ImpaktTextarea);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-textarea': ImpaktTextarea;\n }\n}\n"],"mappings":";;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAQjD,IAAM,iBAAN,cAA6B,aAAa;AAAA,EAoB/C,cAAc;AACZ,UAAM;AAqBR,SAAQ,SAAS;AAEjB;AAAA,SAAQ,aAAa;AAtBnB,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,WAAW;AAChB,SAAK,cAAc;AAAA,EACrB;AAAA,EA1BA;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,WAAW,EAAE,MAAM,OAAO;AAAA,MAC1B,UAAU,EAAE,MAAM,QAAQ,WAAW,YAAY;AAAA,MACjD,aAAa,EAAE,MAAM,OAAO;AAAA,IAC9B;AAAA;AAAA,EAq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