@atomic-ui/ui 0.12.1 → 0.13.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.
Files changed (74) hide show
  1. package/custom-elements.json +18 -1
  2. package/dist/base/FieldElement.d.ts +20 -2
  3. package/dist/{chunk-2WHOBIOY.js → chunk-2BGOBD6Y.js} +2 -2
  4. package/dist/{chunk-FLAUZU7Y.js → chunk-2RC3QKYA.js} +84 -27
  5. package/dist/chunk-2RC3QKYA.js.map +1 -0
  6. package/dist/{chunk-UYTIJCCW.js → chunk-B2GWXXIW.js} +2 -2
  7. package/dist/{chunk-CFCFKLTN.js → chunk-EA3M6KPB.js} +11 -1
  8. package/dist/chunk-EA3M6KPB.js.map +1 -0
  9. package/dist/{chunk-R6YMSJR7.js → chunk-EFP7PJ6C.js} +68 -25
  10. package/dist/chunk-EFP7PJ6C.js.map +1 -0
  11. package/dist/{chunk-5IGBH4GL.js → chunk-EUOBFMWC.js} +2 -2
  12. package/dist/{chunk-FZWUQC42.js → chunk-F2MFV7RM.js} +2 -2
  13. package/dist/{chunk-3GPGDERO.js → chunk-G7CVRNY5.js} +2 -2
  14. package/dist/{chunk-2TNF7O43.js → chunk-LSEK5MEZ.js} +2 -2
  15. package/dist/{chunk-DXLEYNID.js → chunk-LVBYNQ45.js} +5 -3
  16. package/dist/chunk-LVBYNQ45.js.map +1 -0
  17. package/dist/{chunk-BAYSDP44.js → chunk-MGDX7Z74.js} +49 -17
  18. package/dist/chunk-MGDX7Z74.js.map +1 -0
  19. package/dist/{chunk-5HCWL2YD.js → chunk-P5FAKEFK.js} +2 -2
  20. package/dist/{chunk-HSXLSJVG.js → chunk-PII4SJL5.js} +32 -16
  21. package/dist/chunk-PII4SJL5.js.map +1 -0
  22. package/dist/{chunk-ALFE35FS.js → chunk-QJBRENLI.js} +3 -3
  23. package/dist/{chunk-ALFE35FS.js.map → chunk-QJBRENLI.js.map} +1 -1
  24. package/dist/{chunk-LXVPWTSY.js → chunk-RCZPRFHQ.js} +37 -21
  25. package/dist/chunk-RCZPRFHQ.js.map +1 -0
  26. package/dist/{chunk-3KAFK24X.js → chunk-RNFGIXJ7.js} +2 -2
  27. package/dist/{chunk-SOYKSPPX.js → chunk-SY7NTW3U.js} +2 -2
  28. package/dist/{chunk-4MMRBNW7.js → chunk-WEX5RKVC.js} +10 -6
  29. package/dist/chunk-WEX5RKVC.js.map +1 -0
  30. package/dist/{chunk-CQT3VPYK.js → chunk-WT7MHYJR.js} +2 -2
  31. package/dist/components/accordion.js +1 -1
  32. package/dist/components/app-bar.js +2 -2
  33. package/dist/components/app-ui.js +2 -2
  34. package/dist/components/button.js +1 -1
  35. package/dist/components/checkbox-group.js +2 -2
  36. package/dist/components/checkbox.js +2 -2
  37. package/dist/components/chip-group.js +2 -2
  38. package/dist/components/date-input.js +2 -2
  39. package/dist/components/dialog.js +1 -1
  40. package/dist/components/journey.js +2 -2
  41. package/dist/components/layout.js +1 -1
  42. package/dist/components/navigation.js +1 -1
  43. package/dist/components/page.js +1 -1
  44. package/dist/components/radio-group.js +2 -2
  45. package/dist/components/rows.js +1 -1
  46. package/dist/components/select.js +2 -2
  47. package/dist/components/switch.js +2 -2
  48. package/dist/components/text-input.js +2 -2
  49. package/dist/components/textarea.js +2 -2
  50. package/dist/index.js +19 -19
  51. package/dist/server.d.ts +42 -0
  52. package/dist/server.js +26 -0
  53. package/dist/server.js.map +1 -0
  54. package/dist/standalone/atomic-ui.js +823 -742
  55. package/dist/standalone/atomic-ui.js.map +3 -3
  56. package/package.json +6 -2
  57. package/dist/chunk-4MMRBNW7.js.map +0 -1
  58. package/dist/chunk-BAYSDP44.js.map +0 -1
  59. package/dist/chunk-CFCFKLTN.js.map +0 -1
  60. package/dist/chunk-DXLEYNID.js.map +0 -1
  61. package/dist/chunk-FLAUZU7Y.js.map +0 -1
  62. package/dist/chunk-HSXLSJVG.js.map +0 -1
  63. package/dist/chunk-LXVPWTSY.js.map +0 -1
  64. package/dist/chunk-R6YMSJR7.js.map +0 -1
  65. /package/dist/{chunk-2WHOBIOY.js.map → chunk-2BGOBD6Y.js.map} +0 -0
  66. /package/dist/{chunk-UYTIJCCW.js.map → chunk-B2GWXXIW.js.map} +0 -0
  67. /package/dist/{chunk-5IGBH4GL.js.map → chunk-EUOBFMWC.js.map} +0 -0
  68. /package/dist/{chunk-FZWUQC42.js.map → chunk-F2MFV7RM.js.map} +0 -0
  69. /package/dist/{chunk-3GPGDERO.js.map → chunk-G7CVRNY5.js.map} +0 -0
  70. /package/dist/{chunk-2TNF7O43.js.map → chunk-LSEK5MEZ.js.map} +0 -0
  71. /package/dist/{chunk-5HCWL2YD.js.map → chunk-P5FAKEFK.js.map} +0 -0
  72. /package/dist/{chunk-3KAFK24X.js.map → chunk-RNFGIXJ7.js.map} +0 -0
  73. /package/dist/{chunk-SOYKSPPX.js.map → chunk-SY7NTW3U.js.map} +0 -0
  74. /package/dist/{chunk-CQT3VPYK.js.map → chunk-WT7MHYJR.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/page.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { onServer } from '../base/server';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { space, spaceAround, t, token } from '../base/tokens';\n\n/** The widest a line of content runs, for each choice of `width`. */\nconst widths = css`\n :host { --impakt-page-inner: ${token('layout.page-width', '1200px')}; }\n :host([width='narrow']) { --impakt-page-inner: 760px; }\n :host([width='wide']) { --impakt-page-inner: 1440px; }\n :host([width='content']) { --impakt-page-inner: 1080px; }\n`;\n\n/**\n * The side margins, from the brand's layout: narrow on a phone, wider on a\n * tablet and a desktop. Measured against the page itself, so a page drawn in a\n * narrow preview gets phone margins whatever the window is.\n */\nconst margins = css`\n :host { --impakt-page-margin: ${token('layout.margin.phone', '16px')}; }\n @container impakt-page (min-width: 40rem) { .frame { --impakt-page-margin: ${token('layout.margin.tablet', '32px')}; } }\n @container impakt-page (min-width: 64rem) { .frame { --impakt-page-margin: ${token('layout.margin.desktop', '64px')}; } }\n`;\n\n/**\n * The frame every page sits in: a header, the page's own content, and a\n * footer, each kept to the brand's page width with the brand's side margins.\n *\n * A layout puts this at its root, with the site's header and footer in their\n * slots and the page content in the middle, so an app draws the same frame the\n * CMS shows. Without it, a page runs edge to edge.\n *\n * **It gives the page its landmarks.** The header, main content and footer are\n * `header`, `main` and `footer` elements, so a screen reader can jump between\n * them (1.3.1), and the first thing in the page is a \"Skip to content\" link\n * that appears when it has focus (2.4.1).\n *\n * @category layout\n * @icon layout\n * @slot header - The site's header: its logo, navigation and a call to action.\n * @slot - The page's own content.\n * @slot footer - The site's footer.\n */\nexport class ImpaktPage extends ImpaktElement {\n static properties = {\n width: { type: String, reflect: true },\n stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },\n skipText: { type: String, attribute: 'skip-text' },\n noHeader: { type: Boolean, reflect: true, attribute: 'no-header' },\n noFooter: { type: Boolean, reflect: true, attribute: 'no-footer' },\n };\n /** How wide the content runs. Standard is the brand's page width; `content` is G2's 1080px column. */\n declare width: 'narrow' | 'standard' | 'content' | 'wide';\n /** Keep the header at the top of the screen while the page scrolls. */\n declare stickyHeader: boolean;\n /** The words of the link that skips past the header to the content. */\n declare skipText: string;\n /**\n * Leave the header landmark out. In a browser the page sees for itself whether a header was\n * given, so this is only for a page drawn on the server, where it cannot.\n */\n declare noHeader: boolean;\n /** Leave the footer landmark out, for a page drawn on the server with no footer. */\n declare noFooter: boolean;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n this.noHeader = false;\n this.noFooter = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n widths,\n margins,\n css`\n :host { display: block; container: impakt-page / inline-size; }\n .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }\n .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impakt-page-inner) + 2 * var(--impakt-page-margin)); margin-inline: auto; padding-inline: var(--impakt-page-margin); }\n header { background: ${token('color.surface.header', 'transparent')}; color: ${token('color.text.on-header', 'inherit')}; padding-block: ${space(4)}; }\n /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */\n header { --impakt-color-text-default: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-header', 'inherit')}; }\n footer { --impakt-color-text-default: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-muted: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-footer', 'inherit')}; }\n :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }\n main { flex: 1; padding-block: ${space(6)} ${space(10)}; }\n main:focus { outline: none; }\n /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */\n :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impakt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }\n :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impakt-page-margin)); max-inline-size: var(--impakt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token('color.surface.header', '#fff')}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }\n :host([floating]) main { padding-block-start: 0; }\n footer { background: ${token('color.surface.footer', 'transparent')}; color: ${token('color.text.on-footer', 'inherit')}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token('color.border.subtle', 'transparent')}; }\n .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n .empty { display: none; }\n `,\n ];\n\n /**\n * Whether something was given for a slot. An element drawn on the server cannot see its own\n * children, so there the landmark is drawn unless `no-header` or `no-footer` says to leave it out.\n */\n private hasSlot(name: 'header' | 'footer'): boolean {\n if (name === 'header' ? this.noHeader : this.noFooter) return false;\n if (onServer) return true;\n return Array.from(this.children).some((c) => c.getAttribute('slot') === name);\n }\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n // The header and footer are left out when nothing is in them, so a page\n // with no site header has no empty landmark for a screen reader to land on.\n const header = this.hasSlot('header');\n const footer = this.hasSlot('footer');\n return html`<div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n ${header ? html`<header part=\"header\"><div class=\"inner\"><slot name=\"header\"></slot></div></header>` : nothing}\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><div class=\"inner\"><slot></slot></div></main>\n ${footer ? html`<footer part=\"footer\"><div class=\"inner\"><slot name=\"footer\"></slot></div></footer>` : nothing}\n </div>`;\n }\n\n /**\n * The header floats when the page opens on a full-picture hero, sitting on the\n * picture itself, so nothing has to be set for it. It stays an ordinary bar\n * while editing, where the blocks are kept inside the page's box.\n */\n private place = (): void => {\n const hero = this.querySelector('impakt-hero[treatment=\"cover\"]');\n const editing = getComputedStyle(this).getPropertyValue('--impakt-bleed').trim() === '0';\n const floats = !!hero && !editing && this.opensOn(hero);\n this.toggleAttribute('floating', floats);\n if (!floats) return;\n const frame = this.renderRoot.querySelector('.frame');\n if (frame) this.style.setProperty('--impakt-header-top', `${Math.round(hero!.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);\n };\n\n /** Whether nothing a reader would notice comes before this block, other than an announcement. */\n private opensOn(hero: Element): boolean {\n for (const element of Array.from(this.querySelectorAll('*'))) {\n if (element === hero) return true;\n if (element.closest('[slot=\"header\"],[slot=\"footer\"]')) continue;\n if (element.tagName.startsWith('IMPAKT-') && !/^IMPAKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;\n }\n return false;\n }\n\n // A header or footer added after the first render still gets its landmark.\n connectedCallback(): void {\n super.connectedCallback();\n this.observer = new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ['slot'] });\n this.watcher = new MutationObserver(this.place);\n this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['treatment'] });\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(this.place);\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.watcher?.disconnect();\n this.resize?.disconnect();\n }\n\n protected firstUpdated(): void {\n this.place();\n }\n\n private observer?: MutationObserver;\n private watcher?: MutationObserver;\n private resize?: ResizeObserver;\n}\n\n/**\n * A band across the whole width of the page, with its own background, and its\n * content kept to the page width inside it: a coloured strip of features, a\n * quote on a tinted background, a call to action at the foot of a page.\n *\n * Inside a Page it reaches the edges of the screen whatever the page width is,\n * so a page can alternate bands without any of them knowing the frame. Set\n * `bleed` off to keep the band to the page width, as a panel.\n *\n * @category layout\n * @icon section\n * @slot - The section's content.\n */\nexport class ImpaktSection extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n width: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n pattern: { type: String, reflect: true },\n label: { type: String },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /**\n * The band's background. Text on it takes the matching colour, so it stays\n * readable. `board` is G2's blueprint grey (#E3E2DD). On `ink` the cards are\n * the raised ink (#1C1C1C) with a #2E2E2E rule, a primary button is the paper\n * with ink words and an outline button has a paper border.\n */\n declare tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent' | 'board';\n /** Space inside the band, above and below its content. `3xl` is G2's 120px on a desktop and 64px on a phone. */\n declare padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n /** How wide the content inside runs. `content` is G2's 1080px column. */\n declare width: 'narrow' | 'standard' | 'content' | 'wide';\n /** Run the background to the edges of the screen. */\n declare bleed: boolean;\n /**\n * Fine lines drawn across the band: a square grid, a closer blueprint grid,\n * upright columns or ruled lines. They are decoration, drawn in the band's\n * own text colour at a tenth of its strength, and are left out in a forced\n * colours mode.\n */\n declare pattern: 'none' | 'grid' | 'blueprint' | 'columns' | 'ruled';\n /** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */\n declare label: string;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'none';\n this.padding = 'lg';\n this.width = 'standard';\n this.bleed = true;\n this.pattern = 'none';\n this.label = '';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n widths,\n css`\n :host { display: block; --impakt-page-margin: inherit; }\n /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */\n :host([tone='brand']) { --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }\n /* --impakt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */\n :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impakt-bleed, 1) * (50% - 50vw)); padding-inline: max(${space(4)}, calc(var(--impakt-bleed, 1) * (50vw - 50%))); }\n :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }\n :host([tone='inset']) .band { background: ${t.surfaceInset}; }\n :host([tone='card']) .band { background: ${t.surfaceCard}; }\n :host([tone='board']) .band { background: var(--impakt-color-surface-board, var(--ik-surface-board, #e3e2dd)); }\n /*\n * A toned band sets what a button and a solid mark on it need, and resets what\n * an outer band set, so a band inside another one, or a banner inside a band,\n * never draws with colours meant for the band round it. --impakt-color-text-inverse\n * is the colour that reads on the band's text colour: a dark button's words.\n */\n :host(:not([tone='none'])) .band { --impakt-button-primary: initial; --impakt-button-on-primary: initial; --impakt-button-primary-hover: initial; --impakt-color-text-inverse: initial; }\n :host([tone='brand']) .band { --impakt-color-text-inverse: ${t.brand}; }\n :host([tone='accent']) .band { --impakt-color-text-inverse: var(--impakt-solid-card); }\n :host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; --impakt-color-text-link-hover: ${t.onBrand}; }\n /* Ink and accent bands take their colours from the host, because the band repaints the text colour for what is inside it. */\n :host([tone='ink']) { --impakt-band: ${t.text}; --impakt-band-on: ${t.surfaceCard}; --impakt-band-muted: color-mix(in srgb, ${t.surfaceCard} 78%, ${t.text}); --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host([tone='accent']) { --impakt-band: ${token('color.accent.default', '#ffd43b')}; --impakt-band-on: ${token('color.accent.on', '#1a1a1a')}; --impakt-band-muted: ${token('color.accent.on', '#1a1a1a')}; --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host(:is([tone='ink'], [tone='accent'])) .band { background-color: var(--impakt-band); color: var(--impakt-band-on); --impakt-eyebrow: var(--impakt-band-muted); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band-on) 10%, transparent); --impakt-color-text-heading: var(--impakt-band-on); --impakt-color-text-default: var(--impakt-band-on); --impakt-color-text-muted: var(--impakt-band-muted); --impakt-color-text-link: var(--impakt-band-on); --impakt-color-text-link-hover: var(--impakt-band-on); }\n /* On ink the cards are the raised ink with a darker rule (G2 ink-raised and line-inverse), not a wash. */\n :host([tone='ink']) .band {\n --impakt-color-text-inverse: var(--impakt-band);\n --impakt-button-primary: var(--impakt-band-on);\n --impakt-button-on-primary: var(--impakt-band);\n --impakt-button-primary-hover: color-mix(in srgb, var(--impakt-band-on) 86%, var(--impakt-band));\n /* Mixed from the band, so it is #1C1C1C on light ink and still a step off the band when dark turns the band over. */\n --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band) 95%, var(--impakt-band-on));\n --impakt-color-line-soft: color-mix(in srgb, var(--impakt-band) 87%, var(--impakt-band-on));\n /* The accent reads on light-theme ink only; the theme leaves it unset in dark, where the band turns paper. */\n --impakt-site-menu-current: var(--impakt-color-accent-on-ink, currentColor);\n --impakt-steps-current: var(--impakt-color-accent-on-ink, currentColor);\n }\n /* The lines are a tenth of the band's own text colour, so they suit any tone. They carry no meaning. */\n :host([pattern]:not([pattern='none'])) .band { --impakt-pattern-line: color-mix(in srgb, currentColor 10%, transparent); }\n :host(:is([pattern='grid'], [pattern='blueprint'])) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px), linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 7rem 7rem; }\n :host([pattern='blueprint']) .band { background-size: 1.75rem 1.75rem; }\n :host([pattern='columns']) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 5.625rem 100%; }\n :host([pattern='ruled']) .band { background-image: linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 100% 2.5rem; }\n @media (forced-colors: active) { .band { background-image: none !important; } }\n :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }\n :host([padding='sm']) .band { padding-block: ${space(4)}; }\n :host([padding='md']) .band { padding-block: ${space(8)}; }\n :host([padding='lg']) .band { padding-block: ${space(12)}; }\n :host([padding='xl']) .band { padding-block: ${space(16)}; }\n :host([padding='2xl']) .band { padding-block: clamp(${space(14)}, 8vw, ${space(28)}); }\n :host([padding='3xl']) .band { padding-block: clamp(${space(16)}, 10vw, ${space(30)}); }\n .content { max-inline-size: var(--impakt-page-inner); margin-inline: auto; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<section class=\"band\" part=\"band\" aria-label=${this.label || nothing} role=${this.label ? nothing : 'presentation'}><div class=\"content\" part=\"content\"><slot></slot></div></section>`;\n }\n}\n\ncustomElements.define('impakt-page', ImpaktPage);\ncustomElements.define('impakt-section', ImpaktSection);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-page': ImpaktPage;\n 'impakt-section': ImpaktSection;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAOxD,IAAM,SAAS;AAAA,iCACkB,MAAM,qBAAqB,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA;AAWrE,IAAM,UAAU;AAAA,kCACkB,MAAM,uBAAuB,MAAM,CAAC;AAAA,+EACS,MAAM,wBAAwB,MAAM,CAAC;AAAA,+EACrC,MAAM,yBAAyB,MAAM,CAAC;AAAA;AAsB9G,IAAM,aAAN,cAAyB,cAAc;AAAA,EAsB5C,cAAc;AACZ,UAAM;AAuER;AAAA;AAAA;AAAA;AAAA;AAAA,SAAQ,QAAQ,MAAY;AAC1B,YAAM,OAAO,KAAK,cAAc,gCAAgC;AAChE,YAAM,UAAU,iBAAiB,IAAI,EAAE,iBAAiB,gBAAgB,EAAE,KAAK,MAAM;AACrF,YAAM,SAAS,CAAC,CAAC,QAAQ,CAAC,WAAW,KAAK,QAAQ,IAAI;AAC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,wBAAwB,SAAS,CAAC,uBAAuB,MAAM,mBAAmB,SAAS,CAAC,0BAA0B,MAAM,mBAAmB,SAAS,CAAC,0BAA0B,EAAE,WAAW,0BAA0B,EAAE,IAAI,8DAA8D,EAAE,IAAI,4BAA4B,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sEAsBzT,MAAM,CAAC,CAAC;AAAA,mDAC3B,MAAM,CAAC,CAAC;AAAA,mDACR,MAAM,CAAC,CAAC;AAAA,mDACR,MAAM,EAAE,CAAC;AAAA,mDACT,MAAM,EAAE,CAAC;AAAA,0DACF,MAAM,EAAE,CAAC,UAAU,MAAM,EAAE,CAAC;AAAA,0DAC5B,MAAM,EAAE,CAAC,WAAW,MAAM,EAAE,CAAC;AAAA;AAAA;AAAA,IAGrF;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO,oDAAoD,KAAK,SAAS,OAAO,SAAS,KAAK,QAAQ,UAAU,cAAc;AAAA,EAChI;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;AAC/C,eAAe,OAAO,kBAAkB,aAAa;","names":[]}
1
+ {"version":3,"sources":["../src/components/page.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { onServer } from '../base/server';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing } from '../base/styles';\nimport { space, spaceAround, t, token } from '../base/tokens';\n\n/** The widest a line of content runs, for each choice of `width`. */\nconst widths = css`\n :host { --impakt-page-inner: ${token('layout.page-width', '1200px')}; }\n :host([width='narrow']) { --impakt-page-inner: 760px; }\n :host([width='wide']) { --impakt-page-inner: 1440px; }\n :host([width='content']) { --impakt-page-inner: 1080px; }\n`;\n\n/**\n * The side margins, from the brand's layout: narrow on a phone, wider on a\n * tablet and a desktop. Measured against the page itself, so a page drawn in a\n * narrow preview gets phone margins whatever the window is.\n */\nconst margins = css`\n :host { --impakt-page-margin: ${token('layout.margin.phone', '16px')}; }\n @container impakt-page (min-width: 40rem) { .frame { --impakt-page-margin: ${token('layout.margin.tablet', '32px')}; } }\n @container impakt-page (min-width: 64rem) { .frame { --impakt-page-margin: ${token('layout.margin.desktop', '64px')}; } }\n`;\n\n/**\n * The frame every page sits in: a header, the page's own content, and a\n * footer, each kept to the brand's page width with the brand's side margins.\n *\n * A layout puts this at its root, with the site's header and footer in their\n * slots and the page content in the middle, so an app draws the same frame the\n * CMS shows. Without it, a page runs edge to edge.\n *\n * **It gives the page its landmarks.** The header, main content and footer are\n * `header`, `main` and `footer` elements, so a screen reader can jump between\n * them (1.3.1), and the first thing in the page is a \"Skip to content\" link\n * that appears when it has focus (2.4.1).\n *\n * @category layout\n * @icon layout\n * @slot header - The site's header: its logo, navigation and a call to action.\n * @slot - The page's own content.\n * @slot footer - The site's footer.\n */\nexport class ImpaktPage extends ImpaktElement {\n static properties = {\n width: { type: String, reflect: true },\n stickyHeader: { type: Boolean, reflect: true, attribute: 'sticky-header' },\n skipText: { type: String, attribute: 'skip-text' },\n noHeader: { type: Boolean, reflect: true, attribute: 'no-header' },\n noFooter: { type: Boolean, reflect: true, attribute: 'no-footer' },\n };\n /** How wide the content runs. Standard is the brand's page width; `content` is G2's 1080px column. */\n declare width: 'narrow' | 'standard' | 'content' | 'wide';\n /** Keep the header at the top of the screen while the page scrolls. */\n declare stickyHeader: boolean;\n /** The words of the link that skips past the header to the content. */\n declare skipText: string;\n /**\n * Leave the header landmark out. In a browser the page sees for itself whether a header was\n * given, so this is only for a page drawn on the server, where it cannot.\n */\n declare noHeader: boolean;\n /** Leave the footer landmark out, for a page drawn on the server with no footer. */\n declare noFooter: boolean;\n\n constructor() {\n super();\n this.width = 'standard';\n this.stickyHeader = false;\n this.skipText = 'Skip to content';\n this.noHeader = false;\n this.noFooter = false;\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n widths,\n margins,\n css`\n :host { display: block; container: impakt-page / inline-size; }\n .frame { position: relative; display: flex; flex-direction: column; min-block-size: 100%; overflow-x: clip; }\n .inner { box-sizing: border-box; inline-size: 100%; max-inline-size: calc(var(--impakt-page-inner) + 2 * var(--impakt-page-margin)); margin-inline: auto; padding-inline: var(--impakt-page-margin); }\n header { background: ${token('color.surface.header', 'transparent')}; color: ${token('color.text.on-header', 'inherit')}; padding-block: ${space(4)}; }\n /* What sits in the header and footer takes their text colour, so words on a dark footer stay readable. */\n header { --impakt-color-text-default: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-header', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-header', 'inherit')}; }\n footer { --impakt-color-text-default: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-heading: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-muted: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link: ${token('color.text.on-footer', 'inherit')}; --impakt-color-text-link-hover: ${token('color.text.on-footer', 'inherit')}; }\n :host([sticky-header]) header { position: sticky; inset-block-start: 0; z-index: 10; }\n main { flex: 1; padding-block: ${space(6)} ${space(10)}; }\n main:focus { outline: none; }\n /* A page that opens on a full-picture hero: the header floats over it as a rounded bar. */\n :host([floating]) header { position: absolute; z-index: 20; inset-inline: 0; inset-block-start: var(--impakt-header-top, 0px); padding-block: ${space(6)} 0; background: transparent; border: 0; }\n :host([floating]) header .inner { inline-size: calc(100% - 2 * var(--impakt-page-margin)); max-inline-size: var(--impakt-page-inner); padding: ${space(3)} ${space(4)} ${space(3)} ${space(6)}; background: ${token('color.surface.header', '#fff')}; border-radius: ${t.radius2xl}; box-shadow: ${t.shadowLg}; }\n :host([floating]) main { padding-block-start: 0; }\n footer { background: ${token('color.surface.footer', 'transparent')}; color: ${token('color.text.on-footer', 'inherit')}; padding-block: ${space(8)}; border-block-start: ${t.borderThin} solid ${token('color.border.subtle', 'transparent')}; }\n .skip { position: absolute; inset-inline-start: ${space(2)}; inset-block-start: ${space(2)}; z-index: 20; padding: ${space(2)} ${space(4)}; background: ${t.surfaceCard}; color: ${t.link}; border-radius: ${t.radius}; transform: translateY(-200%); }\n .skip:not(:focus) { clip-path: inset(50%); }\n .skip:focus { transform: none; }\n .empty { display: none; }\n `,\n ];\n\n /**\n * Whether something was given for a slot. An element drawn on the server cannot see its own\n * children, so there the landmark is drawn unless `no-header` or `no-footer` says to leave it out.\n */\n private hasSlot(name: 'header' | 'footer'): boolean {\n if (name === 'header' ? this.noHeader : this.noFooter) return false;\n if (onServer) return true;\n return Array.from(this.children).some((c) => c.getAttribute('slot') === name);\n }\n\n private skip(event: Event): void {\n event.preventDefault();\n const main = this.renderRoot.querySelector('main');\n main?.focus();\n main?.scrollIntoView();\n }\n\n render(): TemplateResult {\n // The header and footer are left out when nothing is in them, so a page\n // with no site header has no empty landmark for a screen reader to land on.\n const header = this.hasSlot('header');\n const footer = this.hasSlot('footer');\n return html`<div class=\"frame\" part=\"frame\">\n <a class=\"skip\" href=\"#content\" part=\"skip\" @click=${this.skip}>${this.skipText}</a>\n ${header ? html`<header part=\"header\"><div class=\"inner\"><slot name=\"header\"></slot></div></header>` : nothing}\n <main id=\"content\" tabindex=\"-1\" part=\"main\"><div class=\"inner\"><slot></slot></div></main>\n ${footer ? html`<footer part=\"footer\"><div class=\"inner\"><slot name=\"footer\"></slot></div></footer>` : nothing}\n </div>`;\n }\n\n /**\n * The header floats when the page opens on a full-picture hero, sitting on the\n * picture itself, so nothing has to be set for it. It stays an ordinary bar\n * while editing, where the blocks are kept inside the page's box.\n */\n private place = (): void => {\n const hero = this.querySelector('impakt-hero[treatment=\"cover\"]');\n const editing = getComputedStyle(this).getPropertyValue('--impakt-bleed').trim() === '0';\n const floats = !!hero && !editing && this.opensOn(hero);\n this.toggleAttribute('floating', floats);\n if (!floats) return;\n const frame = this.renderRoot.querySelector('.frame');\n if (frame) this.style.setProperty('--impakt-header-top', `${Math.round(hero!.getBoundingClientRect().top - frame.getBoundingClientRect().top)}px`);\n };\n\n /** Whether nothing a reader would notice comes before this block, other than an announcement. */\n private opensOn(hero: Element): boolean {\n for (const element of Array.from(this.querySelectorAll('*'))) {\n if (element === hero) return true;\n if (element.closest('[slot=\"header\"],[slot=\"footer\"]')) continue;\n if (element.tagName.startsWith('IMPAKT-') && !/^IMPAKT-(STACK|SECTION|GRID|ANNOUNCEMENT)$/.test(element.tagName)) return false;\n }\n return false;\n }\n\n // A header or footer added after the first render still gets its landmark.\n connectedCallback(): void {\n super.connectedCallback();\n this.observer = new MutationObserver(() => this.requestUpdate());\n this.observer.observe(this, { childList: true, attributes: true, subtree: false, attributeFilter: ['slot'] });\n this.watcher = new MutationObserver(this.place);\n this.watcher.observe(this, { childList: true, subtree: true, attributes: true, attributeFilter: ['treatment'] });\n if (typeof ResizeObserver === 'function') {\n this.resize = new ResizeObserver(this.place);\n this.resize.observe(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.observer?.disconnect();\n this.watcher?.disconnect();\n this.resize?.disconnect();\n }\n\n protected firstUpdated(): void {\n this.place();\n }\n\n private observer?: MutationObserver;\n private watcher?: MutationObserver;\n private resize?: ResizeObserver;\n}\n\n/**\n * A band across the whole width of the page, with its own background, and its\n * content kept to the page width inside it: a coloured strip of features, a\n * quote on a tinted background, a call to action at the foot of a page.\n *\n * Inside a Page it reaches the edges of the screen whatever the page width is,\n * so a page can alternate bands without any of them knowing the frame. Set\n * `bleed` off to keep the band to the page width, as a panel.\n *\n * @category layout\n * @icon section\n * @slot - The section's content.\n */\nexport class ImpaktSection extends ImpaktElement {\n static properties = {\n tone: { type: String, reflect: true },\n padding: { type: String, reflect: true },\n width: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n pattern: { type: String, reflect: true },\n label: { type: String },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n /**\n * The band's background. Text on it takes the matching colour, so it stays\n * readable. `board` is G2's blueprint grey (#E3E2DD). On `ink` the cards are\n * the raised ink (#1C1C1C) with a #2E2E2E rule, a primary button is the paper\n * with ink words and an outline button has a paper border.\n */\n declare tone: 'none' | 'subtle' | 'inset' | 'brand' | 'card' | 'ink' | 'accent' | 'board';\n /** Space inside the band, above and below its content. `3xl` is G2's 120px on a desktop and 64px on a phone. */\n declare padding: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';\n /** How wide the content inside runs. `content` is G2's 1080px column. */\n declare width: 'narrow' | 'standard' | 'content' | 'wide';\n /** Run the background to the edges of the screen. */\n declare bleed: boolean;\n /**\n * Fine lines drawn across the band: a square grid, a closer blueprint grid,\n * upright columns or ruled lines. They are decoration, drawn in the band's\n * own text colour at a tenth of its strength, and are left out in a forced\n * colours mode.\n */\n declare pattern: 'none' | 'grid' | 'blueprint' | 'columns' | 'ruled';\n /** A name for the section, so a screen reader can find it in the page's regions. Leave empty for none. */\n declare label: string;\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n constructor() {\n super();\n this.tone = 'none';\n this.padding = 'lg';\n this.width = 'standard';\n this.bleed = true;\n this.pattern = 'none';\n this.label = '';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n spaceAround,\n widths,\n css`\n :host { display: block; --impakt-page-margin: inherit; }\n /* What a solid card on a brand band goes back to, since the band repaints these for its own text. */\n :host([tone='brand']) { --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n .band { box-sizing: border-box; border-radius: ${t.radiusLg}; }\n /* --impakt-bleed is 0 while editing, so a full-width block stays inside the box it is being edited in. */\n :host([bleed]) .band { border-radius: 0; margin-inline: calc(var(--impakt-bleed, 1) * (50% - 50vw)); padding-inline: max(${token('section.gutter', '16px')}, calc(var(--impakt-bleed, 1) * (50vw - 50%))); }\n :host([tone='subtle']) .band { background: ${t.surfaceSubtle}; }\n :host([tone='inset']) .band { background: ${t.surfaceInset}; }\n :host([tone='card']) .band { background: ${t.surfaceCard}; }\n :host([tone='board']) .band { background: var(--impakt-color-surface-board, var(--ik-surface-board, #e3e2dd)); }\n /*\n * A toned band sets what a button and a solid mark on it need, and resets what\n * an outer band set, so a band inside another one, or a banner inside a band,\n * never draws with colours meant for the band round it. --impakt-color-text-inverse\n * is the colour that reads on the band's text colour: a dark button's words.\n */\n :host(:not([tone='none'])) .band { --impakt-button-primary: initial; --impakt-button-on-primary: initial; --impakt-button-primary-hover: initial; --impakt-color-text-inverse: initial; }\n :host([tone='brand']) .band { --impakt-color-text-inverse: ${t.brand}; }\n :host([tone='accent']) .band { --impakt-color-text-inverse: var(--impakt-solid-card); }\n :host([tone='brand']) .band { background: ${t.brand}; color: ${t.onBrand}; --impakt-eyebrow: ${t.onBrand}; --impakt-color-surface-card: color-mix(in srgb, ${t.onBrand} 10%, transparent); --impakt-color-text-heading: ${t.onBrand}; --impakt-color-text-default: ${t.onBrand}; --impakt-color-text-muted: ${t.onBrand}; --impakt-color-text-link: ${t.onBrand}; --impakt-color-text-link-hover: ${t.onBrand}; }\n /* Ink and accent bands take their colours from the host, because the band repaints the text colour for what is inside it. */\n :host([tone='ink']) { --impakt-band: ${t.text}; --impakt-band-on: ${t.surfaceCard}; --impakt-band-muted: color-mix(in srgb, ${t.surfaceCard} 78%, ${t.text}); --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host([tone='accent']) { --impakt-band: ${token('color.accent.default', '#ffd43b')}; --impakt-band-on: ${token('color.accent.on', '#1a1a1a')}; --impakt-band-muted: ${token('color.accent.on', '#1a1a1a')}; --impakt-solid-card: ${t.surfaceCard}; --impakt-solid-text: ${t.text}; --impakt-solid-heading: var(--impakt-color-text-heading, ${t.text}); --impakt-solid-muted: ${t.textMuted}; }\n :host(:is([tone='ink'], [tone='accent'])) .band { background-color: var(--impakt-band); color: var(--impakt-band-on); --impakt-eyebrow: var(--impakt-band-muted); --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band-on) 10%, transparent); --impakt-color-text-heading: var(--impakt-band-on); --impakt-color-text-default: var(--impakt-band-on); --impakt-color-text-muted: var(--impakt-band-muted); --impakt-color-text-link: var(--impakt-band-on); --impakt-color-text-link-hover: var(--impakt-band-on); }\n /* On ink the cards are the raised ink with a darker rule (G2 ink-raised and line-inverse), not a wash. */\n :host([tone='ink']) .band {\n --impakt-color-text-inverse: var(--impakt-band);\n --impakt-button-primary: var(--impakt-band-on);\n --impakt-button-on-primary: var(--impakt-band);\n --impakt-button-primary-hover: color-mix(in srgb, var(--impakt-band-on) 86%, var(--impakt-band));\n /* Mixed from the band, so it is #1C1C1C on light ink and still a step off the band when dark turns the band over. */\n --impakt-color-surface-card: color-mix(in srgb, var(--impakt-band) 95%, var(--impakt-band-on));\n --impakt-color-line-soft: color-mix(in srgb, var(--impakt-band) 87%, var(--impakt-band-on));\n /* The accent reads on light-theme ink only; the theme leaves it unset in dark, where the band turns paper. */\n --impakt-site-menu-current: var(--impakt-color-accent-on-ink, currentColor);\n --impakt-steps-current: var(--impakt-color-accent-on-ink, currentColor);\n }\n /* The lines are a tenth of the band's own text colour, so they suit any tone. They carry no meaning. */\n :host([pattern]:not([pattern='none'])) .band { --impakt-pattern-line: color-mix(in srgb, currentColor 10%, transparent); }\n :host(:is([pattern='grid'], [pattern='blueprint'])) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px), linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 7rem 7rem; }\n :host([pattern='blueprint']) .band { background-size: 1.75rem 1.75rem; }\n :host([pattern='columns']) .band { background-image: linear-gradient(to right, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 5.625rem 100%; }\n :host([pattern='ruled']) .band { background-image: linear-gradient(to bottom, var(--impakt-pattern-line) 1px, transparent 1px); background-size: 100% 2.5rem; }\n @media (forced-colors: active) { .band { background-image: none !important; } }\n :host(:not([bleed]):not([tone='none'])) .band { padding-inline: ${space(6)}; }\n :host([padding='sm']) .band { padding-block: ${space(4)}; }\n :host([padding='md']) .band { padding-block: ${space(8)}; }\n :host([padding='lg']) .band { padding-block: ${space(12)}; }\n :host([padding='xl']) .band { padding-block: ${space(16)}; }\n :host([padding='2xl']) .band { padding-block: ${token('section.padding-2xl', 'clamp(56px, 8vw, 112px)')}; }\n :host([padding='3xl']) .band { padding-block: clamp(${space(16)}, 10vw, ${space(30)}); }\n .content { max-inline-size: var(--impakt-page-inner); margin-inline: auto; }\n `,\n ];\n\n render(): TemplateResult {\n return html`<section class=\"band\" part=\"band\" aria-label=${this.label || nothing} role=${this.label ? nothing : 'presentation'}><div class=\"content\" part=\"content\"><slot></slot></div></section>`;\n }\n}\n\ncustomElements.define('impakt-page', ImpaktPage);\ncustomElements.define('impakt-section', ImpaktSection);\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-page': ImpaktPage;\n 'impakt-section': ImpaktSection;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAOxD,IAAM,SAAS;AAAA,iCACkB,MAAM,qBAAqB,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA;AAWrE,IAAM,UAAU;AAAA,kCACkB,MAAM,uBAAuB,MAAM,CAAC;AAAA,+EACS,MAAM,wBAAwB,MAAM,CAAC;AAAA,+EACrC,MAAM,yBAAyB,MAAM,CAAC;AAAA;AAsB9G,IAAM,aAAN,cAAyB,cAAc;AAAA,EAsB5C,cAAc;AACZ,UAAM;AAuER;AAAA;AAAA;AAAA;AAAA;AAAA,SAAQ,QAAQ,MAAY;AAC1B,YAAM,OAAO,KA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,EAAE,IAAI,uBAAuB,EAAE,WAAW,6CAA6C,EAAE,WAAW,SAAS,EAAE,IAAI,2BAA2B,EAAE,WAAW,0BAA0B,EAAE,IAAI,8DAA8D,EAAE,IAAI,4BAA4B,EAAE,SAAS;AAAA,8CACnS,MAAM,wBAAwB,SAAS,CAAC,uBAAuB,MAAM,mBAAmB,SAAS,CAAC,0BAA0B,MAAM,mBAAmB,SAAS,CAAC,0BAA0B,EAAE,WAAW,0BAA0B,EAAE,IAAI,8DAA8D,EAAE,IAAI,4BAA4B,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sEAsBzT,MAAM,CAAC,CAAC;AAAA,mDAC3B,MAAM,CAAC,CAAC;AAAA,mDACR,MAAM,CAAC,CAAC;AAAA,mDACR,MAAM,EAAE,CAAC;AAAA,mDACT,MAAM,EAAE,CAAC;AAAA,oDACR,MAAM,uBAAuB,yBAAyB,CAAC;AAAA,0DACjD,MAAM,EAAE,CAAC,WAAW,MAAM,EAAE,CAAC;AAAA;AAAA;AAAA,IAGrF;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO,oDAAoD,KAAK,SAAS,OAAO,SAAS,KAAK,QAAQ,UAAU,cAAc;AAAA,EAChI;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;AAC/C,eAAe,OAAO,kBAAkB,aAAa;","names":[]}
@@ -10,13 +10,25 @@ import {
10
10
  } from "./chunk-72WNCCDC.js";
11
11
  import {
12
12
  fontSize,
13
- fontWeight,
14
13
  space,
15
- t
14
+ t,
15
+ token
16
16
  } from "./chunk-JTCTQBAX.js";
17
17
 
18
18
  // packages/ui/src/components/dialog.ts
19
- import { html, css, nothing } from "lit";
19
+ import { html, css, nothing, unsafeCSS } from "lit";
20
+ var D = {
21
+ edgeWidth: token("dialog.edge-width", "0px"),
22
+ backdrop: token("dialog.backdrop", "color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 30%, transparent)"),
23
+ backdropBlur: token("dialog.backdrop-blur", "2px"),
24
+ padding: token("dialog.padding", "20px"),
25
+ /** On a phone the dialog keeps no more than 20px round its content. */
26
+ phonePadding: unsafeCSS(`min(${token("dialog.padding", "20px")}, 20px)`),
27
+ headingSize: token("dialog.heading.size", "1.25rem"),
28
+ headingLineHeight: token("dialog.heading.line-height", "normal"),
29
+ headingTracking: token("dialog.heading.tracking", "0em"),
30
+ headingWeight: token("dialog.heading.weight", "700")
31
+ };
20
32
  var ImpaktDialog = class extends ImpaktElement {
21
33
  constructor() {
22
34
  super();
@@ -48,20 +60,22 @@ var ImpaktDialog = class extends ImpaktElement {
48
60
  css`
49
61
  dialog {
50
62
  padding: 0;
51
- border: ${t.borderThin} solid ${t.text};
63
+ /* No edge and a lifted shadow, or under Noire an ink edge and no shadow (dialog.edge-width, shadow.dialog). */
64
+ border: ${D.edgeWidth} solid ${t.text};
52
65
  border-radius: ${t.radius2xl};
53
66
  background: ${t.surfaceCard};
54
67
  color: ${t.text};
55
- box-shadow: var(--impakt-shadow-dialog, none);
68
+ box-shadow: var(--impakt-shadow-dialog, ${t.shadowXl}, 0 0 0 1px ${t.hairline});
56
69
  max-inline-size: min(32rem, calc(100vw - 2rem));
57
70
  /* 1.4.10 Reflow: a dialog taller than the viewport must scroll inside
58
71
  itself rather than clipping, at 320px and at 400% zoom alike. */
59
72
  max-block-size: calc(100vh - 2rem);
60
73
  overflow: auto;
61
74
  }
75
+ /* The page behind, dimmed with the text colour and blurred, or under Noire the ink at half strength (dialog.backdrop). */
62
76
  dialog::backdrop {
63
- /* The ink at half strength. The text colour is the paper in dark, so the backdrop is the ink there too. */
64
- background: rgb(17 17 17 / 0.5);
77
+ background: ${D.backdrop};
78
+ backdrop-filter: blur(${D.backdropBlur});
65
79
  }
66
80
  :host([size='lg']) dialog {
67
81
  inline-size: 720px;
@@ -84,7 +98,6 @@ var ImpaktDialog = class extends ImpaktElement {
84
98
  flex-wrap: wrap;
85
99
  justify-content: flex-end;
86
100
  gap: ${space(3)};
87
- padding: ${space(5)} ${space(6)};
88
101
  border-block-start: ${t.borderThin} solid var(--impakt-color-line-soft, #dcdcd8);
89
102
  }
90
103
  .foot.empty {
@@ -95,26 +108,29 @@ var ImpaktDialog = class extends ImpaktElement {
95
108
  align-items: flex-start;
96
109
  justify-content: space-between;
97
110
  gap: ${space(3)};
98
- padding: ${space(6)} ${space(6)} 0;
111
+ padding: ${D.padding} ${D.padding} 0;
99
112
  }
100
- /* G2: about 32px, semibold, tight. */
113
+ /* The heading: bold in the xl size, or under Noire (G2) about 32px, semibold and tight (dialog.heading.*). */
101
114
  .heading {
102
115
  margin: 0;
103
116
  font-family: ${t.fontHeading};
104
- font-size: var(--impakt-type-heading-m-size, 2rem);
105
- line-height: 1.1;
106
- letter-spacing: -0.03em;
107
- font-weight: ${fontWeight("semibold")};
117
+ font-size: ${D.headingSize};
118
+ line-height: ${D.headingLineHeight};
119
+ letter-spacing: ${D.headingTracking};
120
+ font-weight: ${D.headingWeight};
108
121
  color: ${t.textHeading};
109
122
  }
110
123
  .body {
111
- padding: ${space(4)} ${space(6)} ${space(6)};
124
+ padding: ${space(4)} ${D.padding} ${D.padding};
125
+ }
126
+ .foot {
127
+ padding: ${space(5)} ${D.padding};
112
128
  }
113
129
  @media (max-width: 40rem) {
114
- .heading { font-size: 1.5rem; }
115
- .head { padding: ${space(5)} ${space(5)} 0; }
116
- .body { padding: ${space(4)} ${space(5)} ${space(5)}; }
117
- .foot { padding: ${space(4)} ${space(5)}; }
130
+ .heading { font-size: min(${D.headingSize}, 1.5rem); }
131
+ .head { padding: ${D.phonePadding} ${D.phonePadding} 0; }
132
+ .body { padding: ${space(4)} ${D.phonePadding} ${D.phonePadding}; }
133
+ .foot { padding: ${space(4)} ${D.phonePadding}; }
118
134
  }
119
135
  @media (max-width: 40rem) {
120
136
  :host([phone-full-screen]) dialog {
@@ -189,7 +205,7 @@ var ImpaktDialog = class extends ImpaktElement {
189
205
  if (this.open) this.close();
190
206
  }}
191
207
  >
192
- <div class="head">
208
+ <div class="head" part="head">
193
209
  <div class="titles">
194
210
  ${this.eyebrow ? html`<p class="eyebrow" part="eyebrow">${this.eyebrow}</p>` : nothing}
195
211
  ${this.heading ? html`<h2 class="heading" id=${this.id_("heading")} part="heading">${this.heading}</h2>` : nothing}
@@ -212,4 +228,4 @@ customElements.define("impakt-dialog", ImpaktDialog);
212
228
  export {
213
229
  ImpaktDialog
214
230
  };
215
- //# sourceMappingURL=chunk-LXVPWTSY.js.map
231
+ //# sourceMappingURL=chunk-RCZPRFHQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/dialog.ts"],"sourcesContent":["import { html, css, nothing, unsafeCSS, type TemplateResult } from 'lit';\nimport { ImpaktElement } from '../base/ImpaktElement';\nimport { focusRing, targetSize, touchTarget } from '../base/styles';\nimport { lockScroll, unlockScroll } from '../base/scroll-lock';\nimport { fontSize, space, t, token } from '../base/tokens';\n\n/**\n * The dialog's shape, from the brand (`dialog.*` in `@atomic-ui/design-tokens`). Each fallback is\n * the dialog every brand derives: no edge, a lifted shadow, the page dimmed and blurred behind and\n * a bold heading, with 20px round its content. The Impakt theme sets the G2 dialog over it.\n */\nconst D = {\n edgeWidth: token('dialog.edge-width', '0px'),\n backdrop: token('dialog.backdrop', 'color-mix(in srgb, var(--impakt-color-text-default, #1a1a1a) 30%, transparent)'),\n backdropBlur: token('dialog.backdrop-blur', '2px'),\n padding: token('dialog.padding', '20px'),\n /** On a phone the dialog keeps no more than 20px round its content. */\n phonePadding: unsafeCSS(`min(${token('dialog.padding', '20px')}, 20px)`),\n headingSize: token('dialog.heading.size', '1.25rem'),\n headingLineHeight: token('dialog.heading.line-height', 'normal'),\n headingTracking: token('dialog.heading.tracking', '0em'),\n headingWeight: token('dialog.heading.weight', '700'),\n};\n\n/**\n * A modal dialog — \"are you sure you want to leave this order?\".\n *\n * **It is a native `<dialog>` opened with `showModal()`, and that is the whole\n * design.** The platform then provides, correctly and in every browser: a\n * focus trap, Escape to close, the rest of the page made inert so a screen\n * reader cannot wander out of the dialog, rendering in the top layer so no\n * `z-index` can cover it, and focus returned to whatever opened it when it\n * closes.\n *\n * Every one of those is a thing hand-rolled modals get wrong. The focus trap\n * is the famous one, but inertness is the worse failure: a dialog that traps\n * the Tab key but leaves the background in the accessibility tree lets a\n * screen-reader user read straight past it into a page they cannot interact\n * with, and nothing on screen tells them that is what happened.\n *\n * What is left to get right is the labelling. `aria-labelledby` points at the\n * dialog's own heading, so it is announced by name on open rather than as\n * \"dialog\".\n *\n * Two things the platform leaves out are added. The page behind does not scroll\n * while the dialog is open, so a finger on the backdrop does not move the page\n * out from under it. And with `phone-full-screen` the dialog fills a phone's\n * screen, which suits a dialog holding a form; a short question is better left\n * as a box in the middle, which is the default.\n\n *\n * @category feedback\n * @icon dialog\n * @fires {CustomEvent<null>} impakt-close - When the dialog is closed.\n * @slot - The body of the dialog.\n * @slot footer - The dialog's actions, set at the end of a row along its foot, such as \"Cancel\" and \"Send\".\n * @slot actions - The same as `footer`, for a page that names it so.\n */\nexport class ImpaktDialog extends ImpaktElement {\n static properties = {\n open: { type: Boolean, reflect: true },\n heading: { type: String },\n closeLabel: { type: String, attribute: 'close-label' },\n dismissible: { type: Boolean },\n phoneFullScreen: { type: Boolean, reflect: true, attribute: 'phone-full-screen' },\n size: { type: String, reflect: true },\n eyebrow: { type: String },\n };\n\n declare open: boolean;\n declare heading: string;\n declare closeLabel: string;\n /** When false, Escape and the backdrop do not close it — a decision must be made. */\n declare dismissible: boolean;\n /** Fill the screen on a phone, for a dialog that holds a form or a long text. */\n declare phoneFullScreen: boolean;\n /** `md` is a short question, 32rem wide. `lg` is 720px, for a dialog that holds a form or a review (G2 frame 45:653). */\n declare size: 'md' | 'lg';\n /** A short line above the heading in the code face, such as \"Step 2 of 3\". It is read before the heading but is not part of the dialog's name. */\n declare eyebrow: string;\n\n constructor() {\n super();\n this.open = false;\n this.heading = '';\n this.closeLabel = 'Close';\n this.dismissible = true;\n this.phoneFullScreen = false;\n this.size = 'md';\n this.eyebrow = '';\n }\n\n static styles = [\n ...ImpaktElement.styles,\n focusRing,\n touchTarget('.close'),\n css`\n dialog {\n padding: 0;\n /* No edge and a lifted shadow, or under Noire an ink edge and no shadow (dialog.edge-width, shadow.dialog). */\n border: ${D.edgeWidth} solid ${t.text};\n border-radius: ${t.radius2xl};\n background: ${t.surfaceCard};\n color: ${t.text};\n box-shadow: var(--impakt-shadow-dialog, ${t.shadowXl}, 0 0 0 1px ${t.hairline});\n max-inline-size: min(32rem, calc(100vw - 2rem));\n /* 1.4.10 Reflow: a dialog taller than the viewport must scroll inside\n itself rather than clipping, at 320px and at 400% zoom alike. */\n max-block-size: calc(100vh - 2rem);\n overflow: auto;\n }\n /* The page behind, dimmed with the text colour and blurred, or under Noire the ink at half strength (dialog.backdrop). */\n dialog::backdrop {\n background: ${D.backdrop};\n backdrop-filter: blur(${D.backdropBlur});\n }\n :host([size='lg']) dialog {\n inline-size: 720px;\n max-inline-size: calc(100vw - 2rem);\n }\n .titles {\n display: flex;\n flex-direction: column;\n gap: ${space(2)};\n min-inline-size: 0;\n }\n .eyebrow {\n margin: 0;\n font-family: ${t.fontMono};\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n }\n .foot {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: ${space(3)};\n border-block-start: ${t.borderThin} solid var(--impakt-color-line-soft, #dcdcd8);\n }\n .foot.empty {\n display: none;\n }\n .head {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n gap: ${space(3)};\n padding: ${D.padding} ${D.padding} 0;\n }\n /* The heading: bold in the xl size, or under Noire (G2) about 32px, semibold and tight (dialog.heading.*). */\n .heading {\n margin: 0;\n font-family: ${t.fontHeading};\n font-size: ${D.headingSize};\n line-height: ${D.headingLineHeight};\n letter-spacing: ${D.headingTracking};\n font-weight: ${D.headingWeight};\n color: ${t.textHeading};\n }\n .body {\n padding: ${space(4)} ${D.padding} ${D.padding};\n }\n .foot {\n padding: ${space(5)} ${D.padding};\n }\n @media (max-width: 40rem) {\n .heading { font-size: min(${D.headingSize}, 1.5rem); }\n .head { padding: ${D.phonePadding} ${D.phonePadding} 0; }\n .body { padding: ${space(4)} ${D.phonePadding} ${D.phonePadding}; }\n .foot { padding: ${space(4)} ${D.phonePadding}; }\n }\n @media (max-width: 40rem) {\n :host([phone-full-screen]) dialog {\n inline-size: 100vw;\n max-inline-size: 100vw;\n block-size: 100dvh;\n max-block-size: 100dvh;\n margin: 0;\n border-radius: 0;\n }\n }\n .close {\n ${targetSize}\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: none;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n font: inherit;\n font-size: ${fontSize('lg')};\n color: ${t.text};\n cursor: pointer;\n }\n `,\n ];\n\n private get dialog(): HTMLDialogElement | null {\n return this.renderRoot.querySelector('dialog');\n }\n\n updated(changed: Map<string, unknown>): void {\n if (!changed.has('open')) return;\n const dialog = this.dialog;\n if (!dialog) return;\n // happy-dom and older engines do not implement showModal. Falling back to\n // the `open` attribute renders a NON-modal dialog — no focus trap, no\n // inert background — so it is used only to keep tests and ancient browsers\n // from throwing, never as an equivalent.\n if (this.open) {\n if (typeof dialog.showModal === 'function') dialog.showModal();\n else dialog.setAttribute('open', '');\n lockScroll(this);\n } else {\n if (typeof dialog.close === 'function' && dialog.open) dialog.close();\n else dialog.removeAttribute('open');\n unlockScroll(this);\n }\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n unlockScroll(this);\n }\n\n private hasFooter = false;\n\n private onFooter(): void {\n const slots = Array.from(this.renderRoot.querySelectorAll<HTMLSlotElement>('slot[name=\"footer\"], slot[name=\"actions\"]'));\n const next = slots.some((slot) => slot.assignedElements({ flatten: true }).length > 0);\n if (next !== this.hasFooter) {\n this.hasFooter = next;\n this.requestUpdate();\n }\n }\n\n private close(): void {\n this.open = false;\n this.dispatchEvent(new CustomEvent('impakt-close', { bubbles: true, composed: true }));\n }\n\n render(): TemplateResult {\n return html`\n <dialog\n part=\"dialog\"\n aria-labelledby=${this.heading ? this.id_('heading') : nothing}\n @cancel=${(e: Event) => {\n // `cancel` fires on Escape. Blocking it is what makes a dialog\n // non-dismissible, and it is why `dismissible` exists rather than\n // leaving a caller to re-open on close.\n if (!this.dismissible) e.preventDefault();\n else this.close();\n }}\n @close=${() => {\n if (this.open) this.close();\n }}\n >\n <div class=\"head\" part=\"head\">\n <div class=\"titles\">\n ${this.eyebrow ? html`<p class=\"eyebrow\" part=\"eyebrow\">${this.eyebrow}</p>` : nothing}\n ${this.heading ? html`<h2 class=\"heading\" id=${this.id_('heading')} part=\"heading\">${this.heading}</h2>` : nothing}\n </div>\n ${\n this.dismissible\n ? html`<button class=\"close\" part=\"close\" type=\"button\" @click=${this.close}>\n <span aria-hidden=\"true\">×</span>\n <span class=\"sr-only\" style=\"position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)\">${this.closeLabel}</span>\n </button>`\n : nothing\n }\n </div>\n <div class=\"body\" part=\"body\"><slot></slot></div>\n <div class=\"foot ${this.hasFooter ? '' : 'empty'}\" part=\"footer\">\n <slot name=\"footer\" @slotchange=${this.onFooter}></slot><slot name=\"actions\" @slotchange=${this.onFooter}></slot>\n </div>\n </dialog>\n `;\n }\n}\n\ncustomElements.define('impakt-dialog', ImpaktDialog);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-dialog': ImpaktDialog;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,SAAS,iBAAsC;AAWnE,IAAM,IAAI;AAAA,EACR,WAAW,MAAM,qBAAqB,KAAK;AAAA,EAC3C,UAAU,MAAM,mBAAmB,gFAAgF;AAAA,EACnH,cAAc,MAAM,wBAAwB,KAAK;AAAA,EACjD,SAAS,MAAM,kBAAkB,MAAM;AAAA;AAAA,EAEvC,cAAc,UAAU,OA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AA8B,KAAK,IAAI,SAAS,CAAC,mBAAmB,KAAK,OAAO,UAAU,OAAO;AAAA;AAAA,YAGlH,KAAK,cACD,+DAA+D,KAAK,KAAK;AAAA;AAAA,4HAEmC,KAAK,UAAU;AAAA,2BAE3H,OACN;AAAA;AAAA;AAAA,2BAGiB,KAAK,YAAY,KAAK,OAAO;AAAA,4CACZ,KAAK,QAAQ,4CAA4C,KAAK,QAAQ;AAAA;AAAA;AAAA;AAAA,EAIhH;AACF;AAEA,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  FieldElement
3
- } from "./chunk-HSXLSJVG.js";
3
+ } from "./chunk-PII4SJL5.js";
4
4
  import {
5
5
  targetSize,
6
6
  touchTarget,
@@ -310,4 +310,4 @@ export {
310
310
  ImpaktSwitch,
311
311
  ImpaktSegmentedControl
312
312
  };
313
- //# sourceMappingURL=chunk-3KAFK24X.js.map
313
+ //# sourceMappingURL=chunk-RNFGIXJ7.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-UNGAG44M.js";
4
4
  import {
5
5
  FieldElement
6
- } from "./chunk-HSXLSJVG.js";
6
+ } from "./chunk-PII4SJL5.js";
7
7
  import {
8
8
  lockScroll,
9
9
  unlockScroll
@@ -687,4 +687,4 @@ export {
687
687
  ImpaktEmptyState,
688
688
  ImpaktSlotPicker
689
689
  };
690
- //# sourceMappingURL=chunk-SOYKSPPX.js.map
690
+ //# sourceMappingURL=chunk-SY7NTW3U.js.map
@@ -2,7 +2,7 @@ import {
2
2
  FieldElement,
3
3
  fieldControl,
4
4
  fieldWidths
5
- } from "./chunk-HSXLSJVG.js";
5
+ } from "./chunk-PII4SJL5.js";
6
6
  import {
7
7
  visuallyHidden
8
8
  } from "./chunk-72WNCCDC.js";
@@ -66,10 +66,14 @@ var ImpaktSelect = class extends FieldElement {
66
66
  inset-inline-end: 10px;
67
67
  font-size: 12px;
68
68
  }
69
- /* The browser's own arrow is replaced by a small "▾", drawn beside the box's end and hidden from screen readers. */
69
+ /*
70
+ * The marker. Most brands keep the browser's own arrow. Where the brand says so, as Noire does
71
+ * (select.appearance and select.caret), it is replaced by a small "▾", drawn beside the box's
72
+ * end and hidden from screen readers.
73
+ */
70
74
  .box { position: relative; display: block; inline-size: min(100%, var(--impakt-field-width)); }
71
- select { inline-size: 100%; appearance: none; -webkit-appearance: none; padding-inline-end: ${space(9)}; cursor: pointer; }
72
- .caret { position: absolute; inset-inline-end: ${space(3.5)}; inset-block-start: 50%; transform: translateY(-50%); font-size: ${fontSize("sm")}; line-height: 1; color: ${t.text}; pointer-events: none; }
75
+ select { inline-size: 100%; appearance: var(--impakt-select-appearance, auto); -webkit-appearance: var(--impakt-select-appearance, auto); padding-inline-end: var(--impakt-select-padding-end, ${space(3)}); cursor: pointer; }
76
+ .caret { display: var(--impakt-select-caret, none); position: absolute; inset-inline-end: ${space(3.5)}; inset-block-start: 50%; transform: translateY(-50%); font-size: ${fontSize("sm")}; line-height: 1; color: ${t.text}; pointer-events: none; }
73
77
  /* A forced colours mode draws the box in the system colours; the caret takes the text colour. */
74
78
  @media (forced-colors: active) { .caret { color: CanvasText; } }
75
79
  `
@@ -89,7 +93,7 @@ var ImpaktSelect = class extends FieldElement {
89
93
  >
90
94
  <option value="" ?selected=${!this.value}>${this.placeholder}</option>
91
95
  ${this.options.map((o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`)}
92
- </select><span class="caret" aria-hidden="true">▾</span></span>
96
+ </select><span class="caret" part="caret" aria-hidden="true">▾</span></span>
93
97
  `;
94
98
  }
95
99
  updated(changed) {
@@ -101,4 +105,4 @@ customElements.define("impakt-select", ImpaktSelect);
101
105
  export {
102
106
  ImpaktSelect
103
107
  };
104
- //# sourceMappingURL=chunk-4MMRBNW7.js.map
108
+ //# sourceMappingURL=chunk-WEX5RKVC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/select.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement, fieldControl, fieldWidths } from '../base/FieldElement';\nimport { visuallyHidden } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface SelectOption {\n value: string;\n label: string;\n}\n\n/**\n * A dropdown.\n *\n * A native `<select>`, because the alternative is a listbox widget that has to\n * reimplement type-ahead, keyboard selection, and the platform's own picker on\n * touch — and whose main advantage is that the arrow can be restyled. On a\n * phone, native wins outright: it opens the system control that the user\n * already knows how to drive.\n *\n * The empty first option carries a real label rather than being blank, so a\n * screen reader announces a choice to make rather than silence.\n\n *\n * @category form\n * @icon select\n */\nexport class ImpaktSelect extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n width: { type: String, reflect: true },\n options: { type: Array },\n placeholder: { type: String },\n hideLabel: { type: Boolean, attribute: 'hide-label', reflect: true },\n size: { type: String, reflect: true },\n };\n\n declare options: SelectOption[];\n /**\n * Keep the label for screen readers only, for a picker whose purpose is\n * plain from where it sits, such as a filter above a table or a role in a\n * team row. The label stays its accessible name.\n */\n declare hideLabel: boolean;\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 /** `sm` is a compact 32px box for a filter in a toolbar, such as \"Page: All pages\" above a list. It still meets the 24px target size. */\n declare size: 'md' | 'sm';\n\n constructor() {\n super();\n this.width = 'full';\n this.options = [];\n this.placeholder = 'Choose an option';\n this.hideLabel = false;\n this.size = 'md';\n }\n\n static styles = [\n ...FieldElement.styles,\n fieldWidths,\n fieldControl('select'),\n css`\n :host([hide-label]) .label {\n ${visuallyHidden}\n }\n /* A compact box sits inline, in a toolbar, so it has none of a form field's spacing under it. */\n :host([size='sm']) {\n margin-block-end: 0;\n }\n /* A compact box is as wide as its longest option, as a filter in a toolbar is. */\n :host([size='sm']) .box {\n inline-size: max-content;\n max-inline-size: 100%;\n }\n :host([size='sm']) select {\n inline-size: auto;\n min-block-size: 32px;\n padding-block: 4px;\n padding-inline-start: 10px;\n font-size: 14px;\n }\n /* Nothing under a compact box until there is an error to show, so it lines up with the chips beside it. */\n :host([size='sm']) .error:empty {\n margin: 0;\n }\n :host([size='sm']) .caret {\n inset-inline-end: 10px;\n font-size: 12px;\n }\n /*\n * The marker. Most brands keep the browser's own arrow. Where the brand says so, as Noire does\n * (select.appearance and select.caret), it is replaced by a small \"▾\", drawn beside the box's\n * end and hidden from screen readers.\n */\n .box { position: relative; display: block; inline-size: min(100%, var(--impakt-field-width)); }\n select { inline-size: 100%; appearance: var(--impakt-select-appearance, auto); -webkit-appearance: var(--impakt-select-appearance, auto); padding-inline-end: var(--impakt-select-padding-end, ${space(3)}); cursor: pointer; }\n .caret { display: var(--impakt-select-caret, none); position: absolute; inset-inline-end: ${space(3.5)}; inset-block-start: 50%; transform: translateY(-50%); font-size: ${fontSize('sm')}; line-height: 1; color: ${t.text}; pointer-events: none; }\n /* A forced colours mode draws the box in the system colours; the caret takes the text colour. */\n @media (forced-colors: active) { .caret { color: CanvasText; } }\n `,\n ];\n\n protected renderControl(): TemplateResult {\n return html`\n <span class=\"box\" part=\"box\"><select\n id=${this.controlId}\n part=\"select\"\n name=${this.name || nothing}\n ?disabled=${this.disabled}\n ?required=${this.required}\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}\n >\n <option value=\"\" ?selected=${!this.value}>${this.placeholder}</option>\n ${this.options.map((o) => html`<option value=${o.value} ?selected=${this.value === o.value}>${o.label}</option>`)}\n </select><span class=\"caret\" part=\"caret\" aria-hidden=\"true\">▾</span></span>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impakt-select', ImpaktSelect);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impakt-select': ImpaktSelect;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,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K,CAAC;AAAA;AAAA,qCAEnD,CAAC,KAAK,KAAK,IAAI,KAAK,WAAW;AAAA,UAC1D,KAAK,QAAQ,IAAI,CAAC,MAAM,qBAAqB,EAAE,KAAK,cAAc,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,KAAK,WAAW,CAAC;AAAA;AAAA;AAAA,EAGvH;AAAA,EAEA,QAAQ,SAAqC;AAC3C,QAAI,QAAQ,IAAI,OAAO,EAAG,MAAK,gBAAgB,WAAW,QAAQ,KAAK,KAAK,CAAC;AAAA,EAC/E;AACF;AAEA,eAAe,OAAO,iBAAiB,YAAY;","names":[]}
@@ -2,7 +2,7 @@ import {
2
2
  FieldElement,
3
3
  fieldControl,
4
4
  fieldWidths
5
- } from "./chunk-HSXLSJVG.js";
5
+ } from "./chunk-PII4SJL5.js";
6
6
 
7
7
  // packages/ui/src/components/textarea.ts
8
8
  import { html, css, nothing } from "lit";
@@ -95,4 +95,4 @@ customElements.define("impakt-textarea", ImpaktTextarea);
95
95
  export {
96
96
  ImpaktTextarea
97
97
  };
98
- //# sourceMappingURL=chunk-CQT3VPYK.js.map
98
+ //# sourceMappingURL=chunk-WT7MHYJR.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ImpaktAccordion
3
- } from "../chunk-FLAUZU7Y.js";
3
+ } from "../chunk-2RC3QKYA.js";
4
4
  import "../chunk-6CDQSHVW.js";
5
5
  import "../chunk-ZUQ3DOG2.js";
6
6
  import "../chunk-6WVL3HOC.js";
@@ -2,9 +2,9 @@ import {
2
2
  ImpaktAppBar
3
3
  } from "../chunk-UBNCJROR.js";
4
4
  import "../chunk-XX6JZW5N.js";
5
- import "../chunk-SOYKSPPX.js";
5
+ import "../chunk-SY7NTW3U.js";
6
6
  import "../chunk-UNGAG44M.js";
7
- import "../chunk-HSXLSJVG.js";
7
+ import "../chunk-PII4SJL5.js";
8
8
  import "../chunk-2YRTFWW2.js";
9
9
  import "../chunk-5OYQZWP2.js";
10
10
  import "../chunk-72WNCCDC.js";
@@ -8,9 +8,9 @@ import {
8
8
  ImpaktSlotPicker,
9
9
  ImpaktToast,
10
10
  pageWindow
11
- } from "../chunk-SOYKSPPX.js";
11
+ } from "../chunk-SY7NTW3U.js";
12
12
  import "../chunk-UNGAG44M.js";
13
- import "../chunk-HSXLSJVG.js";
13
+ import "../chunk-PII4SJL5.js";
14
14
  import "../chunk-2YRTFWW2.js";
15
15
  import "../chunk-5OYQZWP2.js";
16
16
  import "../chunk-72WNCCDC.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ImpaktButton
3
- } from "../chunk-R6YMSJR7.js";
3
+ } from "../chunk-EFP7PJ6C.js";
4
4
  import "../chunk-5OYQZWP2.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktCheckboxGroup
3
- } from "../chunk-FZWUQC42.js";
4
- import "../chunk-HSXLSJVG.js";
3
+ } from "../chunk-F2MFV7RM.js";
4
+ import "../chunk-PII4SJL5.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktCheckbox
3
- } from "../chunk-5IGBH4GL.js";
4
- import "../chunk-HSXLSJVG.js";
3
+ } from "../chunk-EUOBFMWC.js";
4
+ import "../chunk-PII4SJL5.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ImpaktChipGroup
3
- } from "../chunk-3GPGDERO.js";
3
+ } from "../chunk-G7CVRNY5.js";
4
4
  import "../chunk-XX6JZW5N.js";
5
- import "../chunk-HSXLSJVG.js";
5
+ import "../chunk-PII4SJL5.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktDateInput
3
- } from "../chunk-5HCWL2YD.js";
4
- import "../chunk-HSXLSJVG.js";
3
+ } from "../chunk-P5FAKEFK.js";
4
+ import "../chunk-PII4SJL5.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ImpaktDialog
3
- } from "../chunk-LXVPWTSY.js";
3
+ } from "../chunk-RCZPRFHQ.js";
4
4
  import "../chunk-2YRTFWW2.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
@@ -6,9 +6,9 @@ import {
6
6
  ImpaktRangeInput,
7
7
  ImpaktTaskList,
8
8
  groupDigits
9
- } from "../chunk-2WHOBIOY.js";
9
+ } from "../chunk-2BGOBD6Y.js";
10
10
  import "../chunk-UNGAG44M.js";
11
- import "../chunk-HSXLSJVG.js";
11
+ import "../chunk-PII4SJL5.js";
12
12
  import "../chunk-72WNCCDC.js";
13
13
  import "../chunk-JTCTQBAX.js";
14
14
  export {
@@ -3,7 +3,7 @@ import {
3
3
  ImpaktHeading,
4
4
  ImpaktStack,
5
5
  ImpaktText
6
- } from "../chunk-DXLEYNID.js";
6
+ } from "../chunk-LVBYNQ45.js";
7
7
  import "../chunk-72WNCCDC.js";
8
8
  import "../chunk-JTCTQBAX.js";
9
9
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktBreadcrumbs,
3
3
  ImpaktNav
4
- } from "../chunk-CFCFKLTN.js";
4
+ } from "../chunk-EA3M6KPB.js";
5
5
  import "../chunk-5OYQZWP2.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktPage,
3
3
  ImpaktSection
4
- } from "../chunk-ALFE35FS.js";
4
+ } from "../chunk-QJBRENLI.js";
5
5
  import "../chunk-6WVL3HOC.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktRadioGroup
3
- } from "../chunk-2TNF7O43.js";
4
- import "../chunk-HSXLSJVG.js";
3
+ } from "../chunk-LSEK5MEZ.js";
4
+ import "../chunk-PII4SJL5.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -3,7 +3,7 @@ import {
3
3
  ImpaktFilterChip,
4
4
  ImpaktRow,
5
5
  ImpaktStatTile
6
- } from "../chunk-BAYSDP44.js";
6
+ } from "../chunk-MGDX7Z74.js";
7
7
  import "../chunk-6CDQSHVW.js";
8
8
  import "../chunk-ZUQ3DOG2.js";
9
9
  import "../chunk-XX6JZW5N.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktSelect
3
- } from "../chunk-4MMRBNW7.js";
4
- import "../chunk-HSXLSJVG.js";
3
+ } from "../chunk-WEX5RKVC.js";
4
+ import "../chunk-PII4SJL5.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ImpaktSegmentedControl,
3
3
  ImpaktSwitch
4
- } from "../chunk-3KAFK24X.js";
5
- import "../chunk-HSXLSJVG.js";
4
+ } from "../chunk-RNFGIXJ7.js";
5
+ import "../chunk-PII4SJL5.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktTextInput
3
- } from "../chunk-UYTIJCCW.js";
4
- import "../chunk-HSXLSJVG.js";
3
+ } from "../chunk-B2GWXXIW.js";
4
+ import "../chunk-PII4SJL5.js";
5
5
  import "../chunk-5OYQZWP2.js";
6
6
  import "../chunk-72WNCCDC.js";
7
7
  import "../chunk-JTCTQBAX.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ImpaktTextarea
3
- } from "../chunk-CQT3VPYK.js";
4
- import "../chunk-HSXLSJVG.js";
3
+ } from "../chunk-WT7MHYJR.js";
4
+ import "../chunk-PII4SJL5.js";
5
5
  import "../chunk-72WNCCDC.js";
6
6
  import "../chunk-JTCTQBAX.js";
7
7
  export {