@atomic-ui/ui 0.3.0 → 0.5.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 (213) hide show
  1. package/README.md +31 -33
  2. package/custom-elements.json +5986 -15880
  3. package/dist/base/FieldElement.d.ts +4 -4
  4. package/dist/base/{ImpktElement.d.ts → ImpaktElement.d.ts} +2 -2
  5. package/dist/base/styles.d.ts +7 -0
  6. package/dist/base/tokens.d.ts +1 -1
  7. package/dist/base/tone.d.ts +20 -0
  8. package/dist/{chunk-3RE4H2XO.js → chunk-3EF4T242.js} +7 -7
  9. package/dist/chunk-3EF4T242.js.map +1 -0
  10. package/dist/{chunk-NKMVICB5.js → chunk-5Y3HYRCU.js} +7 -7
  11. package/dist/chunk-5Y3HYRCU.js.map +1 -0
  12. package/dist/{chunk-ZOTAAYO5.js → chunk-5ZQVL3V2.js} +19 -12
  13. package/dist/chunk-5ZQVL3V2.js.map +1 -0
  14. package/dist/{chunk-4OYHT4BN.js → chunk-A7YBFS4H.js} +15 -15
  15. package/dist/chunk-A7YBFS4H.js.map +1 -0
  16. package/dist/{chunk-WGPB3QQU.js → chunk-ACQ4KYPR.js} +9 -9
  17. package/dist/chunk-ACQ4KYPR.js.map +1 -0
  18. package/dist/{chunk-DAH7RLW3.js → chunk-DE3INTHZ.js} +6 -6
  19. package/dist/chunk-DE3INTHZ.js.map +1 -0
  20. package/dist/{chunk-HXINWP3V.js → chunk-EJD6LT7E.js} +20 -83
  21. package/dist/chunk-EJD6LT7E.js.map +1 -0
  22. package/dist/{chunk-P6GDMZK4.js → chunk-EJSX4WCD.js} +9 -9
  23. package/dist/chunk-EJSX4WCD.js.map +1 -0
  24. package/dist/chunk-FMSC7J7J.js +76 -0
  25. package/dist/chunk-FMSC7J7J.js.map +1 -0
  26. package/dist/{chunk-46BYUQ5A.js → chunk-FWR6SEIA.js} +33 -33
  27. package/dist/chunk-FWR6SEIA.js.map +1 -0
  28. package/dist/{chunk-CUUBAETM.js → chunk-GJPHQLLN.js} +8 -8
  29. package/dist/chunk-GJPHQLLN.js.map +1 -0
  30. package/dist/{chunk-R7FKGFW6.js → chunk-HNBG2POR.js} +7 -7
  31. package/dist/chunk-HNBG2POR.js.map +1 -0
  32. package/dist/{chunk-DKZ425AM.js → chunk-HNZQ7LM4.js} +11 -11
  33. package/dist/chunk-HNZQ7LM4.js.map +1 -0
  34. package/dist/{chunk-55DK75QF.js → chunk-I54DOEZB.js} +6 -6
  35. package/dist/chunk-I54DOEZB.js.map +1 -0
  36. package/dist/{chunk-J2FACXYI.js → chunk-PANH23MF.js} +12 -12
  37. package/dist/chunk-PANH23MF.js.map +1 -0
  38. package/dist/{chunk-KKJEEKL2.js → chunk-PYVUQNFQ.js} +8 -8
  39. package/dist/chunk-PYVUQNFQ.js.map +1 -0
  40. package/dist/{chunk-RWWRTURA.js → chunk-Q54FX3SY.js} +8 -8
  41. package/dist/chunk-Q54FX3SY.js.map +1 -0
  42. package/dist/{chunk-AUVIOU5G.js → chunk-QBORJTS4.js} +36 -36
  43. package/dist/chunk-QBORJTS4.js.map +1 -0
  44. package/dist/{chunk-5QSTXIPG.js → chunk-RXX4CN5J.js} +7 -7
  45. package/dist/chunk-RXX4CN5J.js.map +1 -0
  46. package/dist/{chunk-XPCU4KUY.js → chunk-SV77SN6P.js} +7 -7
  47. package/dist/chunk-SV77SN6P.js.map +1 -0
  48. package/dist/{chunk-FVCM4WHD.js → chunk-TAZZLOUY.js} +10 -10
  49. package/dist/chunk-TAZZLOUY.js.map +1 -0
  50. package/dist/{chunk-KMCGX76Y.js → chunk-TRZO5CHU.js} +7 -7
  51. package/dist/chunk-TRZO5CHU.js.map +1 -0
  52. package/dist/{chunk-F4YQWKK2.js → chunk-UPOTBKKK.js} +7 -7
  53. package/dist/chunk-UPOTBKKK.js.map +1 -0
  54. package/dist/{chunk-APJ5JGRW.js → chunk-WP5WJ4V5.js} +6 -6
  55. package/dist/chunk-WP5WJ4V5.js.map +1 -0
  56. package/dist/{chunk-TCXKZDMR.js → chunk-WS5AUJ35.js} +7 -7
  57. package/dist/chunk-WS5AUJ35.js.map +1 -0
  58. package/dist/{chunk-7P4Z4CLK.js → chunk-WWYYNR3Z.js} +50 -49
  59. package/dist/chunk-WWYYNR3Z.js.map +1 -0
  60. package/dist/{chunk-RYBY35QE.js → chunk-XU2XODVH.js} +6 -6
  61. package/dist/chunk-XU2XODVH.js.map +1 -0
  62. package/dist/{chunk-3KO55PZK.js → chunk-YR6T73GY.js} +18 -11
  63. package/dist/chunk-YR6T73GY.js.map +1 -0
  64. package/dist/{chunk-IOBSIAHB.js → chunk-YYYQPKQ7.js} +24 -24
  65. package/dist/chunk-YYYQPKQ7.js.map +1 -0
  66. package/dist/{chunk-PO6FCAIS.js → chunk-Z45LY6BT.js} +9 -9
  67. package/dist/chunk-Z45LY6BT.js.map +1 -0
  68. package/dist/{chunk-DJEZW7AC.js → chunk-ZQBEFP2O.js} +7 -7
  69. package/dist/chunk-ZQBEFP2O.js.map +1 -0
  70. package/dist/chunk-ZS7RPXCT.js +47 -0
  71. package/dist/chunk-ZS7RPXCT.js.map +1 -0
  72. package/dist/components/accordion.d.ts +3 -3
  73. package/dist/components/accordion.js +4 -4
  74. package/dist/components/alert.d.ts +3 -3
  75. package/dist/components/alert.js +4 -4
  76. package/dist/components/app-ui.d.ts +25 -25
  77. package/dist/components/app-ui.js +21 -21
  78. package/dist/components/badge.d.ts +37 -0
  79. package/dist/components/badge.js +9 -0
  80. package/dist/components/blocks.d.ts +10 -73
  81. package/dist/components/blocks.js +10 -13
  82. package/dist/components/button.d.ts +3 -3
  83. package/dist/components/button.js +5 -5
  84. package/dist/components/checkbox-group.d.ts +2 -2
  85. package/dist/components/checkbox-group.js +5 -5
  86. package/dist/components/checkbox.d.ts +2 -2
  87. package/dist/components/checkbox.js +5 -5
  88. package/dist/components/chip.d.ts +58 -0
  89. package/dist/components/chip.js +8 -0
  90. package/dist/components/date-input.d.ts +2 -2
  91. package/dist/components/date-input.js +5 -5
  92. package/dist/components/dialog.d.ts +4 -4
  93. package/dist/components/dialog.js +4 -4
  94. package/dist/components/fieldset.d.ts +3 -3
  95. package/dist/components/fieldset.js +4 -4
  96. package/dist/components/grid.d.ts +3 -3
  97. package/dist/components/grid.js +4 -4
  98. package/dist/components/help.d.ts +3 -3
  99. package/dist/components/help.js +4 -4
  100. package/dist/components/icon.d.ts +3 -3
  101. package/dist/components/icon.js +4 -4
  102. package/dist/components/journey.d.ts +18 -18
  103. package/dist/components/journey.js +15 -15
  104. package/dist/components/layout.d.ts +9 -9
  105. package/dist/components/layout.js +10 -10
  106. package/dist/components/link.d.ts +3 -3
  107. package/dist/components/link.js +5 -5
  108. package/dist/components/list.d.ts +3 -3
  109. package/dist/components/list.js +4 -4
  110. package/dist/components/media.d.ts +8 -8
  111. package/dist/components/media.js +8 -8
  112. package/dist/components/navigation.d.ts +5 -5
  113. package/dist/components/navigation.js +7 -7
  114. package/dist/components/page.d.ts +5 -5
  115. package/dist/components/page.js +6 -6
  116. package/dist/components/price.d.ts +3 -3
  117. package/dist/components/price.js +4 -4
  118. package/dist/components/progress.d.ts +3 -3
  119. package/dist/components/progress.js +4 -4
  120. package/dist/components/radio-group.d.ts +2 -2
  121. package/dist/components/radio-group.js +5 -5
  122. package/dist/components/select.d.ts +2 -2
  123. package/dist/components/select.js +5 -5
  124. package/dist/components/summary-list.d.ts +3 -3
  125. package/dist/components/summary-list.js +4 -4
  126. package/dist/components/table.d.ts +6 -6
  127. package/dist/components/table.js +5 -5
  128. package/dist/components/text-input.d.ts +2 -2
  129. package/dist/components/text-input.js +5 -5
  130. package/dist/components/textarea.d.ts +2 -2
  131. package/dist/components/textarea.js +5 -5
  132. package/dist/index.d.ts +47 -40
  133. package/dist/index.js +206 -270
  134. package/dist/standalone/atomic-ui.js +796 -2002
  135. package/dist/standalone/atomic-ui.js.map +4 -4
  136. package/dist/standalone/index.html +51 -52
  137. package/package.json +4 -4
  138. package/specimen/index.html +51 -52
  139. package/dist/chunk-37PA72FC.js +0 -725
  140. package/dist/chunk-37PA72FC.js.map +0 -1
  141. package/dist/chunk-3KO55PZK.js.map +0 -1
  142. package/dist/chunk-3RE4H2XO.js.map +0 -1
  143. package/dist/chunk-46BYUQ5A.js.map +0 -1
  144. package/dist/chunk-4OYHT4BN.js.map +0 -1
  145. package/dist/chunk-55DK75QF.js.map +0 -1
  146. package/dist/chunk-5QSTXIPG.js.map +0 -1
  147. package/dist/chunk-7P4Z4CLK.js.map +0 -1
  148. package/dist/chunk-APJ5JGRW.js.map +0 -1
  149. package/dist/chunk-AUVIOU5G.js.map +0 -1
  150. package/dist/chunk-CUUBAETM.js.map +0 -1
  151. package/dist/chunk-DAH7RLW3.js.map +0 -1
  152. package/dist/chunk-DJEZW7AC.js.map +0 -1
  153. package/dist/chunk-DKZ425AM.js.map +0 -1
  154. package/dist/chunk-F4YQWKK2.js.map +0 -1
  155. package/dist/chunk-FVCM4WHD.js.map +0 -1
  156. package/dist/chunk-GBRML4RF.js +0 -264
  157. package/dist/chunk-GBRML4RF.js.map +0 -1
  158. package/dist/chunk-HXINWP3V.js.map +0 -1
  159. package/dist/chunk-IOBSIAHB.js.map +0 -1
  160. package/dist/chunk-IZOTGWWI.js +0 -361
  161. package/dist/chunk-IZOTGWWI.js.map +0 -1
  162. package/dist/chunk-J2FACXYI.js.map +0 -1
  163. package/dist/chunk-KKJEEKL2.js.map +0 -1
  164. package/dist/chunk-KMCGX76Y.js.map +0 -1
  165. package/dist/chunk-NKMVICB5.js.map +0 -1
  166. package/dist/chunk-OFLMG6RN.js +0 -428
  167. package/dist/chunk-OFLMG6RN.js.map +0 -1
  168. package/dist/chunk-P6GDMZK4.js.map +0 -1
  169. package/dist/chunk-PO6FCAIS.js.map +0 -1
  170. package/dist/chunk-PWLZFGS3.js +0 -494
  171. package/dist/chunk-PWLZFGS3.js.map +0 -1
  172. package/dist/chunk-QJIB36DM.js +0 -249
  173. package/dist/chunk-QJIB36DM.js.map +0 -1
  174. package/dist/chunk-R7FKGFW6.js.map +0 -1
  175. package/dist/chunk-RWWRTURA.js.map +0 -1
  176. package/dist/chunk-RYBY35QE.js.map +0 -1
  177. package/dist/chunk-S7F5VKWU.js +0 -453
  178. package/dist/chunk-S7F5VKWU.js.map +0 -1
  179. package/dist/chunk-T5W3FDSF.js +0 -396
  180. package/dist/chunk-T5W3FDSF.js.map +0 -1
  181. package/dist/chunk-TCXKZDMR.js.map +0 -1
  182. package/dist/chunk-WGPB3QQU.js.map +0 -1
  183. package/dist/chunk-XPCU4KUY.js.map +0 -1
  184. package/dist/chunk-YRYZUYY7.js +0 -236
  185. package/dist/chunk-YRYZUYY7.js.map +0 -1
  186. package/dist/chunk-ZOTAAYO5.js.map +0 -1
  187. package/dist/components/changelog.d.ts +0 -386
  188. package/dist/components/changelog.js +0 -25
  189. package/dist/components/estimator.d.ts +0 -246
  190. package/dist/components/estimator.js +0 -16
  191. package/dist/components/marketing.d.ts +0 -370
  192. package/dist/components/marketing.js +0 -21
  193. package/dist/components/marketing.js.map +0 -1
  194. package/dist/components/organisms.d.ts +0 -559
  195. package/dist/components/organisms.js +0 -25
  196. package/dist/components/organisms.js.map +0 -1
  197. package/dist/components/property.d.ts +0 -389
  198. package/dist/components/property.js +0 -20
  199. package/dist/components/property.js.map +0 -1
  200. package/dist/components/scene.d.ts +0 -138
  201. package/dist/components/scene.js +0 -8
  202. package/dist/components/scene.js.map +0 -1
  203. package/dist/components/scrubber.d.ts +0 -86
  204. package/dist/components/scrubber.js +0 -8
  205. package/dist/components/scrubber.js.map +0 -1
  206. package/dist/components/selling.d.ts +0 -409
  207. package/dist/components/selling.js +0 -25
  208. package/dist/components/selling.js.map +0 -1
  209. package/dist/components/site.d.ts +0 -283
  210. package/dist/components/site.js +0 -20
  211. package/dist/components/site.js.map +0 -1
  212. /package/dist/components/{changelog.js.map → badge.js.map} +0 -0
  213. /package/dist/components/{estimator.js.map → chip.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/journey.ts"],"sourcesContent":["import { css, html, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { pageLocale } from '../base/locale';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { FieldElement, fieldWidths } from '../base/FieldElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, spaceAround, t, type } from '../base/tokens';\n\n/** One address a postcode search found. */\nexport interface AddressItem {\n id: string;\n /** The address on one line, as the customer will recognise it. */\n line: string;\n}\n\n/** One mistake on the page, and the field it is about. */\nexport interface ErrorItem {\n id: string;\n text: string;\n /** The field to go to, such as `#postcode`. */\n href: string;\n}\n\n/** One part of a long application. */\nexport interface TaskItem {\n id: string;\n title: string;\n /** Where the part is filled in. Left out while it cannot be started. */\n href?: string;\n status: 'done' | 'in-progress' | 'not-started' | 'cannot-start';\n /** A line under the title, such as how long it takes. */\n hint?: string;\n}\n\nconst inputStyles = css`\n input, select {\n box-sizing: border-box;\n inline-size: min(100%, var(--impkt-field-width));\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(3)};\n font: inherit;\n /* 16px whatever the page around it sets, so a phone does not zoom in on focus. */\n font-size: max(${fontSize('md')}, 16px);\n color: ${t.text};\n background: ${t.surfaceCard};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radiusLg};\n }\n input:focus-visible, select:focus-visible { border-color: ${t.brand}; box-shadow: ${t.focusShadow}, 0 0 0 6px ${t.brandHalo}; outline: none; }\n :host([invalid]) input, :host([invalid]) select { border-color: ${t.danger}; border-width: ${t.borderThick}; }\n .btn {\n min-block-size: 44px;\n padding: ${space(2.5)} ${space(4)};\n font: inherit;\n font-weight: ${fontWeight('semibold')};\n color: ${t.onBrand};\n background: ${t.brand};\n border: 0;\n border-radius: ${t.radiusLg};\n cursor: pointer;\n }\n .btn:hover { background: ${t.brandHover}; }\n .quiet { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; padding: 0; font: inherit; color: ${t.link}; text-decoration: underline; text-underline-offset: 0.2em; background: none; border: 0; cursor: pointer; }\n .visually-hidden { ${visuallyHidden} }\n`;\n\n/**\n * Find an address from a postcode, then pick it from a list.\n *\n * The addresses come from the app. With `lookup-url` set, the component asks\n * that address itself (`?postcode=…`, answering `[{ id, line }]`); otherwise\n * it fires `impkt-lookup` with the postcode and the app sets `addresses`.\n * There is always a way to type the address in, because no list is complete.\n *\n * @fires {CustomEvent<{ postcode: string }>} impkt-lookup - When a postcode is searched for. The postcode is in detail.postcode.\n * @category form\n * @icon home\n */\nexport class ImpktAddressLookup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n postcodeLabel: { type: String, attribute: 'postcode-label' },\n findText: { type: String, attribute: 'find-text' },\n chooseLabel: { type: String, attribute: 'choose-label' },\n manualText: { type: String, attribute: 'manual-text' },\n notFoundText: { type: String, attribute: 'not-found-text' },\n lookupUrl: { type: String, attribute: 'lookup-url' },\n addresses: { type: Array },\n };\n declare postcodeLabel: string;\n declare findText: string;\n declare chooseLabel: string;\n declare manualText: string;\n declare notFoundText: string;\n /** An address that returns `[{ id, line }]` for `?postcode=`. Optional. */\n declare lookupUrl: string;\n declare addresses: AddressItem[];\n declare manual: boolean;\n declare postcode: string;\n declare searched: boolean;\n declare busy: boolean;\n\n constructor() {\n super();\n this.label = 'Your address';\n this.postcodeLabel = 'Postcode';\n this.findText = 'Find address';\n this.chooseLabel = 'Choose your address';\n this.manualText = 'Enter the address yourself';\n this.notFoundText = 'No addresses found for that postcode. Check it, or enter the address yourself.';\n this.lookupUrl = '';\n this.addresses = [];\n this.manual = false;\n this.postcode = '';\n this.searched = false;\n this.busy = false;\n }\n\n static styles = [...FieldElement.styles, fieldWidths, inputStyles, css`\n .row { display: flex; flex-wrap: wrap; gap: ${space(2)}; align-items: flex-end; }\n .row label { display: block; ${type('sm')} font-weight: ${fontWeight('semibold')}; margin-block-end: ${space(1)}; }\n .postcode input { inline-size: 12ch; text-transform: uppercase; }\n .choose { margin-block-start: ${space(4)}; }\n .choose select { inline-size: 100%; }\n .manual { display: grid; gap: ${space(3)}; margin-block-start: ${space(3)}; }\n .manual label { display: block; ${type('sm')} margin-block-end: ${space(1)}; }\n .manual input { inline-size: 100%; }\n .note { ${type('sm')} color: ${t.textMuted}; margin: ${space(2)} 0 0; }\n .switch { margin-block-start: ${space(3)}; }\n `];\n\n private async find(): Promise<void> {\n const postcode = this.postcode.trim().toUpperCase();\n if (!postcode) return;\n this.dispatchEvent(new CustomEvent('impkt-lookup', { detail: { postcode }, bubbles: true, composed: true }));\n if (!this.lookupUrl) { this.searched = true; return; }\n this.busy = true;\n try {\n const url = new URL(this.lookupUrl, globalThis.location?.href);\n url.searchParams.set('postcode', postcode);\n const found = await (await fetch(url)).json();\n this.addresses = Array.isArray(found) ? found : [];\n } catch {\n this.addresses = [];\n } finally {\n this.busy = false;\n this.searched = true;\n }\n }\n\n private manualLine(): string {\n const parts = ['line1', 'line2', 'town', 'mpostcode'].map((p) => (this.renderRoot.querySelector<HTMLInputElement>(`#${this.id_(p)}`)?.value ?? '').trim());\n return parts.filter(Boolean).join(', ');\n }\n\n protected renderControl(): TemplateResult {\n if (this.manual) {\n const field = (key: string, label: string, autocomplete: string) => html`<div><label for=${this.id_(key)}>${label}</label><input id=${this.id_(key)} autocomplete=${autocomplete} @input=${() => this.setFormValue(this.manualLine())} /></div>`;\n return html`<div class=\"manual\" role=\"group\" aria-label=${this.label}>\n ${field('line1', say('Building and street'), 'address-line1')}\n ${field('line2', say('Second line (optional)'), 'address-line2')}\n ${field('town', say('Town or city'), 'address-level2')}\n ${field('mpostcode', say('Postcode'), 'postal-code')}\n <button class=\"quiet switch\" type=\"button\" @click=${() => { this.manual = false; }}>${say('Find the address from the postcode')}</button>\n </div>`;\n }\n return html`\n <div class=\"row\">\n <div class=\"postcode\"><label for=${this.controlId}>${this.postcodeLabel}</label>\n <input id=${this.controlId} autocomplete=\"postal-code\" .value=${this.postcode} aria-describedby=${this.describedBy}\n @input=${(e: Event) => { this.postcode = (e.target as HTMLInputElement).value; }}\n @keydown=${(e: KeyboardEvent) => { if (e.key === 'Enter') { e.preventDefault(); void this.find(); } }} /></div>\n <button class=\"btn\" type=\"button\" ?disabled=${this.busy} @click=${() => this.find()}>${this.busy ? 'Finding…' : this.findText}</button>\n </div>\n ${this.addresses.length ? html`<div class=\"choose\"><label class=\"label\" for=${this.id_('choose')}>${this.chooseLabel}</label>\n <select id=${this.id_('choose')} @change=${(e: Event) => this.setFormValue((e.target as HTMLSelectElement).value)}>\n <option value=\"\">${this.addresses.length} ${this.addresses.length === 1 ? 'address' : 'addresses'} found</option>\n ${this.addresses.map((a) => html`<option value=${a.line} ?selected=${a.line === this.value}>${a.line}</option>`)}\n </select></div>`\n : this.searched && !this.busy ? html`<p class=\"note\" role=\"status\">${this.notFoundText}</p>` : nothing}\n <button class=\"quiet switch\" type=\"button\" @click=${() => { this.manual = true; }}>${this.manualText}</button>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\n/**\n * Every mistake on the page, listed at the top, each linking to its field.\n *\n * It takes focus when it appears, so someone using a screen reader hears what\n * is wrong straight away rather than finding out field by field. It draws\n * nothing while there are no mistakes. Each link moves focus to its field, which\n * may be a field inside another component, such as `#postcode` for an\n * `impkt-text-input` with that id.\n *\n * @category feedback\n * @icon alert\n */\nexport class ImpktErrorSummary extends ImpktElement {\n static properties = {\n heading: { type: String },\n items: { type: Array },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare heading: string;\n declare items: ErrorItem[];\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.heading = 'There is a problem';\n this.items = [];\n this.spaceAbove = 'none';\n this.spaceBelow = 'md';\n }\n\n static styles = [...ImpktElement.styles, focusRing, spaceAround, touchTarget('a'), css`\n :host { display: block; }\n .box { padding: ${space(5)}; border: ${t.borderThick} solid ${t.danger}; border-inline-start-width: 6px; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }\n .box:focus { outline: 3px solid ${t.danger}; outline-offset: 2px; }\n h2 { margin: 0 0 ${space(3)}; ${type('lg')} font-weight: ${fontWeight('bold')}; color: ${t.text}; }\n ul { margin: 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }\n a { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; color: ${t.dangerText}; font-weight: ${fontWeight('semibold')}; text-underline-offset: 0.2em; }\n `];\n\n private go(event: Event, href: string): void {\n const id = href.replace(/^#/, '');\n const root = this.getRootNode() as Document | ShadowRoot;\n const target = (root.querySelector?.(`#${CSS.escape(id)}`) ?? document.getElementById(id)) as HTMLElement | null;\n if (!target) return;\n event.preventDefault();\n target.scrollIntoView({ block: 'center' });\n (target as HTMLElement & { focus: () => void }).focus();\n }\n\n updated(changed: Map<string, unknown>): void {\n const before = changed.get('items') as ErrorItem[] | undefined;\n if (changed.has('items') && this.items.length && !before?.length) this.renderRoot.querySelector<HTMLElement>('.box')?.focus();\n }\n\n render(): TemplateResult | typeof nothing {\n if (!this.items.length) return nothing;\n return html`<div class=\"box\" role=\"alert\" tabindex=\"-1\" aria-labelledby=${this.id_('h')} part=\"box\">\n <h2 id=${this.id_('h')}>${this.heading}</h2>\n <ul>${this.items.map((i) => html`<li><a href=${i.href} @click=${(e: Event) => this.go(e, i.href)}>${i.text}</a></li>`)}</ul>\n </div>`;\n }\n}\n\nconst fileSize = (bytes: number) => (bytes >= 1048576 ? say('{size} MB', { size: (bytes / 1048576).toFixed(1) }) : say('{size} KB', { size: Math.max(1, Math.round(bytes / 1024)) }));\n\n/**\n * Add one or more files, such as proof of identity or photos for a claim.\n *\n * A file can be chosen or dropped on the box. Each one is checked for type and\n * size here and listed with a Remove button; the upload itself is the app's,\n * which gets the files on `impkt-files`. The answer is the file names.\n *\n * The file input itself takes focus, so Tab reaches it and Enter or Space opens\n * the file chooser; the visible button is its label and draws its focus ring.\n * A file that is added or removed is said to a screen reader, and a file that\n * does not fit marks the box and says why.\n *\n * @fires {CustomEvent<{ files: File[] }>} impkt-files - When the files change. The files are in detail.files.\n *\n * @category form\n * @icon upload\n */\nexport class ImpktFileUpload extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n accept: { type: String },\n manyFiles: { type: Boolean, attribute: 'many-files' },\n maxSizeMb: { type: Number, attribute: 'max-size-mb' },\n chooseText: { type: String, attribute: 'choose-text' },\n dropText: { type: String, attribute: 'drop-text' },\n };\n /** File types allowed, such as `.pdf,.jpg,.png`. Empty allows any. */\n declare accept: string;\n /** Let more than one file be added. */\n declare manyFiles: boolean;\n declare maxSizeMb: number;\n declare chooseText: string;\n declare dropText: string;\n declare files: File[];\n declare over: boolean;\n protected declare said: string;\n\n constructor() {\n super();\n this.label = 'Upload a file';\n this.accept = '.pdf,.jpg,.jpeg,.png';\n this.manyFiles = false;\n this.maxSizeMb = 10;\n this.chooseText = 'Choose file';\n this.dropText = 'or drop it here';\n this.files = [];\n this.over = false;\n this.said = '';\n }\n\n static styles = [...FieldElement.styles, inputStyles, targetSize, touchTarget('label.btn, .quiet'), css`\n .zone { display: flex; flex-wrap: wrap; align-items: center; gap: ${space(3)}; padding: ${space(5)}; border: 2px dashed ${t.border}; border-radius: ${t.radiusLg}; background: ${t.surfaceCard}; }\n .zone.over { border-color: ${t.brand}; background: ${t.brandSubtle}; }\n :host([invalid]) .zone { border-color: ${t.danger}; border-style: solid; }\n :host([disabled]) label.btn { cursor: not-allowed; }\n .drop { color: ${t.textMuted}; }\n input[type='file'] { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }\n label.btn { display: inline-flex; align-items: center; }\n input[type='file']:focus-visible + label.btn { box-shadow: ${t.focusShadow}; }\n ul { margin: ${space(3)} 0 0; padding: 0; list-style: none; display: grid; gap: ${space(2)}; }\n li { display: flex; justify-content: space-between; gap: ${space(3)}; align-items: center; padding: ${space(2)} ${space(3)}; border-radius: ${t.radius}; background: ${t.surfaceInset}; }\n .size { color: ${t.textMuted}; ${type('sm')} }\n `];\n\n private fits(file: File): string | null {\n if (this.maxSizeMb && file.size > this.maxSizeMb * 1048576) return say('{file} is bigger than {size} MB', { file: file.name, size: this.maxSizeMb });\n const kinds = this.accept.split(',').map((k) => k.trim().toLowerCase()).filter(Boolean);\n if (kinds.length && !kinds.some((k) => (k.startsWith('.') ? file.name.toLowerCase().endsWith(k) : file.type === k || (k.endsWith('/*') && file.type.startsWith(k.slice(0, -1)))))) {\n return say('{file} must be {kinds}', { file: file.name, kinds: kinds.map((k) => k.replace('.', '').toUpperCase()).join(', ') });\n }\n return null;\n }\n\n /** Adds files, keeping only those that pass, and says why any did not. */\n add(list: FileList | File[]): void {\n const chosen = Array.from(list);\n const problems = chosen.map((f) => this.fits(f)).filter((p): p is string => Boolean(p));\n const good = chosen.filter((f) => !this.fits(f));\n const kept = this.manyFiles ? good : good.slice(0, 1);\n this.files = this.manyFiles ? [...this.files, ...good] : kept.length ? kept : this.files;\n this.error = problems.join('. ');\n this.said = kept.map((f) => say('{file} added', { file: f.name })).join('. ');\n this.sync();\n }\n\n private removeFile(index: number): void {\n const gone = this.files[index];\n this.files = this.files.filter((_, i) => i !== index);\n this.said = gone ? say('{file} removed', { file: gone.name }) : '';\n this.sync();\n // The button that was pressed has gone, so focus goes back to the file input rather than to the top of the page.\n void this.updateComplete.then(() => this.renderRoot.querySelector<HTMLElement>('input[type=\"file\"]')?.focus());\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n\n private sync(): void {\n this.setFormValue(this.files.map((f) => f.name).join(', '));\n this.dispatchEvent(new CustomEvent('impkt-files', { detail: { files: this.files }, bubbles: true, composed: true }));\n }\n\n protected renderControl(): TemplateResult {\n return html`\n <div class=\"zone ${this.over ? 'over' : ''}\"\n @dragover=${(e: DragEvent) => { e.preventDefault(); this.over = true; }}\n @dragleave=${() => { this.over = false; }}\n @drop=${(e: DragEvent) => { e.preventDefault(); this.over = false; if (e.dataTransfer?.files) this.add(e.dataTransfer.files); }}>\n <input id=${this.controlId} type=\"file\" accept=${this.accept || nothing} ?multiple=${this.manyFiles} ?disabled=${this.disabled} ?required=${this.required} aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}\n @change=${(e: Event) => { const f = (e.target as HTMLInputElement).files; if (f) this.add(f); (e.target as HTMLInputElement).value = ''; }} />\n <label class=\"btn\" for=${this.controlId}>${this.chooseText}</label>\n <span class=\"drop\">${this.dropText}</span>\n </div>\n <p class=\"visually-hidden\" role=\"status\">${this.said}</p>\n ${this.files.length ? html`<ul aria-label=${say('Files added')}>${this.files.map((f, i) => html`<li><span>${f.name} <span class=\"size\">${fileSize(f.size)}</span></span><button class=\"quiet\" type=\"button\" @click=${() => this.removeFile(i)}>${say('Remove')}<span class=\"visually-hidden\"> ${f.name}</span></button></li>`)}</ul>` : nothing}\n `;\n }\n}\n\n/** The currency's symbol, such as £ for GBP. */\nfunction symbolOf(currency: string): string {\n try {\n return new Intl.NumberFormat(pageLocale(), { style: 'currency', currency, maximumFractionDigits: 0 }).formatToParts(0).find((p) => p.type === 'currency')?.value ?? '';\n } catch {\n return '';\n }\n}\n\n/** \"250000\" → \"250,000\". Anything not a number is left as typed. */\nexport function groupDigits(value: string): string {\n const digits = value.replace(/[^\\d.]/g, '');\n if (!digits) return '';\n const [whole, part] = digits.split('.');\n return `${Number(whole).toLocaleString('en-GB')}${part !== undefined ? `.${part.slice(0, 2)}` : ''}`;\n}\n\n/**\n * An amount of money, with the currency sign in front and commas as it is\n * read back, so £250,000 is not mistaken for £25,000.\n *\n * The answer is the plain number, such as `250000`.\n *\n * @category form\n * @icon pound\n */\nexport class ImpktMoneyInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n currency: { type: String },\n lowest: { type: Number },\n highest: { type: Number },\n pence: { type: Boolean },\n width: { type: String, reflect: true },\n };\n declare currency: string;\n declare lowest: number | undefined;\n declare highest: number | undefined;\n /** Allow pence. Off for amounts like a house price. */\n declare pence: boolean;\n declare width: 'full' | 'lg' | 'md' | 'sm' | 'xs';\n declare shown: string;\n\n constructor() {\n super();\n this.currency = 'GBP';\n this.lowest = undefined;\n this.highest = undefined;\n this.pence = false;\n this.width = 'md';\n this.shown = '';\n }\n\n static styles = [...FieldElement.styles, fieldWidths, inputStyles, css`\n .wrap { display: flex; align-items: stretch; inline-size: min(100%, var(--impkt-field-width)); }\n .sign { display: flex; align-items: center; padding: 0 ${space(3)}; font-weight: ${fontWeight('semibold')}; background: ${t.surfaceInset}; border: ${t.borderThin} solid ${t.border}; border-inline-end: 0; border-radius: ${t.radiusLg} 0 0 ${t.radiusLg}; }\n .wrap input { inline-size: 100%; border-radius: 0 ${t.radiusLg} ${t.radiusLg} 0; }\n `];\n\n willUpdate(changed: Map<string, unknown>): void {\n if (changed.has('value') && this.value !== this.shown.replace(/,/g, '')) this.shown = groupDigits(this.value);\n }\n\n private typed(raw: string): void {\n const clean = raw.replace(/[^\\d.]/g, '');\n const value = this.pence ? clean : clean.split('.')[0]!;\n this.shown = raw;\n this.setFormValue(value);\n }\n\n private check(): void {\n this.shown = groupDigits(this.value);\n const n = Number(this.value);\n if (!this.value) return;\n const money = (x: number) => `${symbolOf(this.currency)}${x.toLocaleString('en-GB')}`;\n if (this.lowest !== undefined && n < this.lowest) this.error = say('Enter an amount of {amount} or more', { amount: money(this.lowest) });\n else if (this.highest !== undefined && n > this.highest) this.error = say('Enter an amount of {amount} or less', { amount: money(this.highest) });\n else if (this.error === say('Enter an amount of {amount} or more', { amount: money(this.lowest ?? 0) }) || this.error === say('Enter an amount of {amount} or less', { amount: money(this.highest ?? 0) })) this.error = '';\n }\n\n /** The currency sign describes the field too, so a screen reader hears that the amount is in pounds. */\n protected get describedBy(): string | typeof nothing {\n const ids = [symbolOf(this.currency) ? this.id_('sign') : '', super.describedBy === nothing ? '' : String(super.describedBy)].filter(Boolean);\n return ids.length ? ids.join(' ') : nothing;\n }\n\n protected renderControl(): TemplateResult {\n return html`<div class=\"wrap\">\n <span class=\"sign\" id=${this.id_('sign')}>${symbolOf(this.currency)}</span>\n <input id=${this.controlId} inputmode=${this.pence ? 'decimal' : 'numeric'} .value=${this.shown} ?disabled=${this.disabled} ?readonly=${this.readonly} ?required=${this.required}\n aria-describedby=${this.describedBy} aria-invalid=${this.error ? 'true' : nothing}\n @input=${(e: Event) => this.typed((e.target as HTMLInputElement).value)} @blur=${() => this.check()} />\n </div>`;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\n/**\n * Choose a number by sliding, with the value read out beside the label, such\n * as a deposit or how many years. It is a native range control, so arrow keys,\n * a finger and a screen reader all work.\n *\n * @category form\n * @icon sliders\n */\nexport class ImpktRangeInput extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n lowest: { type: Number },\n highest: { type: Number },\n step: { type: Number },\n currency: { type: String },\n unit: { type: String },\n };\n declare lowest: number;\n declare highest: number;\n declare step: number;\n /** Show the value as money in this currency, such as GBP. Empty shows a plain number. */\n declare currency: string;\n /** A word after the value, such as `years`. */\n declare unit: string;\n\n constructor() {\n super();\n this.label = 'How much';\n this.lowest = 0;\n this.highest = 100;\n this.step = 1;\n this.currency = '';\n this.unit = '';\n this.value = '50';\n }\n\n static styles = [...FieldElement.styles, css`\n .top { display: flex; justify-content: space-between; gap: ${space(3)}; }\n output { font-weight: ${fontWeight('semibold')}; color: ${t.text}; }\n input { inline-size: 100%; min-block-size: 32px; margin: 0; accent-color: ${t.brand}; }\n .ends { display: flex; justify-content: space-between; ${type('sm')} color: ${t.textMuted}; }\n `];\n\n /** The value as the customer reads it, such as £25,000 or 25 years. */\n shownAs(n: number): string {\n const locale = pageLocale(this);\n let s = n.toLocaleString(locale);\n if (this.currency) { try { s = new Intl.NumberFormat(locale, { style: 'currency', currency: this.currency, maximumFractionDigits: 0 }).format(n); } catch { /* keep the number */ } }\n return this.unit ? `${s} ${this.unit}` : s;\n }\n\n render(): TemplateResult {\n const n = Number(this.value) || 0;\n return html`\n <div class=\"top\"><label class=\"label\" for=${this.controlId}>${this.label}${this.required ? html` <span class=\"required\">(${this.requiredText})</span>` : nothing}</label>\n <output for=${this.controlId}>${this.shownAs(n)}</output></div>\n ${this.description ? html`<div class=\"description\" id=${this.id_('description')}>${this.description}</div>` : nothing}\n ${this.renderControl()}\n <div class=\"ends\" aria-hidden=\"true\"><span>${this.shownAs(this.lowest)}</span><span>${this.shownAs(this.highest)}</span></div>\n <div class=\"error\" id=${this.id_('error')} aria-live=\"polite\">${this.error || nothing}</div>\n `;\n }\n\n protected renderControl(): TemplateResult {\n return html`<input id=${this.controlId} type=\"range\" min=${this.lowest} max=${this.highest} step=${this.step} .value=${this.value} ?disabled=${this.disabled}\n aria-valuetext=${this.shownAs(Number(this.value) || 0)} aria-describedby=${this.describedBy}\n @input=${(e: Event) => this.setFormValue((e.target as HTMLInputElement).value)} />`;\n }\n}\n\nconst TASK_WORDS: Record<TaskItem['status'], string> = {\n done: 'Completed',\n 'in-progress': 'In progress',\n 'not-started': 'Not started',\n 'cannot-start': 'Cannot start yet',\n};\n\n/**\n * The parts of a long application, each with whether it is done, so someone\n * can leave and come back to where they were.\n *\n * @category content\n * @icon list\n */\nexport class ImpktTaskList extends ImpktElement {\n static properties = {\n heading: { type: String },\n items: { type: Array },\n headingLevel: { type: Number, attribute: 'heading-level' },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare heading: string;\n declare items: TaskItem[];\n declare headingLevel: 2 | 3;\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.heading = 'Your application';\n this.items = [];\n this.headingLevel = 2;\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n\n static styles = [...ImpktElement.styles, focusRing, spaceAround, touchTarget('a'), css`\n :host { display: block; }\n .h { margin: 0 0 ${space(2)}; ${type('xl')} font-weight: ${fontWeight('bold')}; color: ${t.textHeading}; }\n .count { margin: 0 0 ${space(4)}; color: ${t.textMuted}; }\n ul { margin: 0; padding: 0; list-style: none; border-block-start: 1px solid ${t.rule}; }\n li { display: flex; justify-content: space-between; align-items: center; gap: ${space(4)}; padding: ${space(4)} 0; border-block-end: 1px solid ${t.rule}; }\n a { display: inline-flex; align-items: center; min-block-size: ${t.targetMin}; color: ${t.link}; font-weight: ${fontWeight('semibold')}; text-underline-offset: 0.2em; }\n .title { font-weight: ${fontWeight('semibold')}; }\n .hint { display: block; ${type('sm')} color: ${t.textMuted}; }\n .tag { flex-shrink: 0; padding: ${space(1)} ${space(2.5)}; border-radius: 999px; ${type('sm')} font-weight: ${fontWeight('semibold')}; background: ${t.surfaceInset}; color: ${t.text}; }\n .tag[data-status='done'] { background: ${t.successSubtle}; color: ${t.successText}; }\n .tag[data-status='in-progress'] { background: ${t.brandSubtle}; color: ${t.link}; }\n .tag[data-status='cannot-start'] { background: transparent; color: ${t.textMuted}; }\n `];\n\n render(): TemplateResult {\n const done = this.items.filter((i) => i.status === 'done').length;\n return html`\n ${this.heading ? html`<div class=\"h\" role=\"heading\" aria-level=${this.headingLevel}>${this.heading}</div>` : nothing}\n ${this.items.length ? html`<p class=\"count\">${say(this.items.length === 1 ? 'You have completed {done} of {total} part.' : 'You have completed {done} of {total} parts.', { done, total: this.items.length })}</p>` : nothing}\n <ul>${this.items.map((i) => html`<li>\n <span>${i.href && i.status !== 'cannot-start' ? html`<a href=${i.href} aria-describedby=${this.id_(`s-${i.id}`)}>${i.title}</a>` : html`<span class=\"title\">${i.title}</span>`}\n ${i.hint ? html`<span class=\"hint\">${i.hint}</span>` : nothing}</span>\n <span class=\"tag\" data-status=${i.status} id=${this.id_(`s-${i.id}`)}>${TASK_WORDS[i.status] ? say(TASK_WORDS[i.status]) : i.status}</span>\n </li>`)}</ul>`;\n }\n}\n\n// Working values, not settings: kept out of `properties` so the page designer does not offer them.\nImpktAddressLookup.createProperty('manual', { state: true });\nImpktAddressLookup.createProperty('postcode', { state: true });\nImpktAddressLookup.createProperty('searched', { state: true });\nImpktAddressLookup.createProperty('busy', { state: true });\nImpktFileUpload.createProperty('files', { state: true });\nImpktFileUpload.createProperty('over', { state: true });\nImpktFileUpload.createProperty('said', { state: true });\nImpktMoneyInput.createProperty('shown', { state: true });\n\ncustomElements.define('impkt-address-lookup', ImpktAddressLookup);\ncustomElements.define('impkt-error-summary', ImpktErrorSummary);\ncustomElements.define('impkt-file-upload', ImpktFileUpload);\ncustomElements.define('impkt-money-input', ImpktMoneyInput);\ncustomElements.define('impkt-range-input', ImpktRangeInput);\ncustomElements.define('impkt-task-list', ImpktTaskList);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-address-lookup': ImpktAddressLookup;\n 'impkt-error-summary': ImpktErrorSummary;\n 'impkt-file-upload': ImpktFileUpload;\n 'impkt-money-input': ImpktMoneyInput;\n 'impkt-range-input': ImpktRangeInput;\n 'impkt-task-list': ImpktTaskList;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,eAAoC;AAkCxD,IAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,eAKL,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,qBAGhB,SAAS,IAAI,CAAC;AAAA,aACtB,EAAE,IAAI;AAAA,kBACD,EAAE,WAAW;AAAA,cACjB,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,qBACvB,EAAE,QAAQ;AAAA;AAAA,8DAE+B,EAAE,KAAK,iBAAiB,EAAE,WAAW,eAAe,EAAE,SAAS;AAAA,oEACzD,EAAE,MAAM,mBAAmB,EAAE,WAAW;AAAA;AAAA;AA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AQ,EAAE,OAAO,KAAK,CAAC;AACzD,gBAAgB,eAAe,SAAS,EAAE,OAAO,KAAK,CAAC;AACvD,gBAAgB,eAAe,QAAQ,EAAE,OAAO,KAAK,CAAC;AACtD,gBAAgB,eAAe,QAAQ,EAAE,OAAO,KAAK,CAAC;AACtD,gBAAgB,eAAe,SAAS,EAAE,OAAO,KAAK,CAAC;AAEvD,eAAe,OAAO,wBAAwB,kBAAkB;AAChE,eAAe,OAAO,uBAAuB,iBAAiB;AAC9D,eAAe,OAAO,qBAAqB,eAAe;AAC1D,eAAe,OAAO,qBAAqB,eAAe;AAC1D,eAAe,OAAO,qBAAqB,eAAe;AAC1D,eAAe,OAAO,mBAAmB,aAAa;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/alert.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { say } from '../base/say';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * A notice.\n *\n * **The role depends on the tone, and that is a real distinction.** `alert`\n * interrupts whatever a screen reader is saying; `status` waits for a pause.\n * A failed payment earns the interruption. \"Your basket has been saved\" does\n * not, and using `alert` for it is how users learn to tune the live region\n * out — at which point the one that mattered is also lost.\n *\n * **The tone is never carried by colour alone.** Each tone ships a word, in\n * the accessible name, because 1.4.1 Use of Colour says a red border is not a\n * message and because a red border is invisible in forced-colours mode.\n\n *\n * @category feedback\n * @icon alert\n * @slot - The body of the notice.\n */\nexport class ImpktAlert extends ImpktElement {\n static properties = {\n tone: { type: String, reflect: true },\n heading: { type: String },\n toneLabel: { type: String, attribute: 'tone-label' },\n };\n\n declare tone: AlertTone;\n declare heading: string;\n /** Overrides the default word for the tone, for translation. */\n declare toneLabel: string;\n\n constructor() {\n super();\n this.tone = 'info';\n this.heading = '';\n this.toneLabel = '';\n }\n\n private static readonly TONE_WORDS: Record<AlertTone, string> = {\n info: 'Information',\n success: 'Success',\n warning: 'Warning',\n danger: 'Error',\n };\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n margin-block-end: ${space(4)};\n }\n .alert {\n padding: ${space(4)} ${space(5)};\n border-radius: ${t.radiusLg};\n border-inline-start: 4px solid;\n box-shadow: inset 0 0 0 1px ${t.hairline};\n font-size: ${fontSize('sm')};\n line-height: 1.5;\n }\n .heading {\n font-weight: ${fontWeight('semibold')};\n margin-block-end: ${space(1)};\n }\n :host([tone='info']) .alert {\n background: ${t.infoSubtle};\n border-color: ${t.info};\n color: ${t.text};\n }\n :host([tone='success']) .alert {\n background: ${t.successSubtle};\n border-color: ${t.success};\n color: ${t.text};\n }\n :host([tone='warning']) .alert {\n background: ${t.warningSubtle};\n border-color: ${t.warning};\n color: ${t.text};\n }\n :host([tone='danger']) .alert {\n background: ${t.dangerSubtle};\n border-color: ${t.danger};\n color: ${t.text};\n }\n /* Colour is the only signal left in forced-colours mode, and it is gone.\n The border keeps the boundary; the tone word in the label carries the\n meaning. */\n @media (forced-colors: active) {\n .alert {\n border: 1px solid CanvasText;\n border-inline-start-width: 4px;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n const word = this.toneLabel || say(ImpktAlert.TONE_WORDS[this.tone]);\n return html`\n <div\n class=\"alert\"\n part=\"alert\"\n role=${this.tone === 'danger' ? 'alert' : 'status'}\n aria-label=${this.heading ? nothing : word}\n >\n ${this.heading\n ? html`<div class=\"heading\" part=\"heading\">\n <span class=\"tone-word\">${word}:</span> ${this.heading}\n </div>`\n : nothing}\n <slot></slot>\n </div>\n `;\n }\n}\n\ncustomElements.define('impkt-alert', ImpktAlert);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-alert': ImpktAlert;\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAyBjD,IAAM,aAAN,MAAM,oBAAmB,aAAa;AAAA,EAC3C;AAAA,SAAO,aAAa;AAA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nE,WAAO;AAAA;AAAA;AAAA;AAAA,eAII,KAAK,SAAS,WAAW,UAAU,QAAQ;AAAA,qBACrC,KAAK,UAAU,UAAU,IAAI;AAAA;AAAA,UAExC,KAAK,UACH;AAAA,wCAC4B,IAAI,YAAY,KAAK,OAAO;AAAA,sBAExD,OAAO;AAAA;AAAA;AAAA;AAAA,EAIjB;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/radio-group.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { FieldElement } from '../base/FieldElement';\nimport { targetSize } from '../base/styles';\nimport { fontSize, space, t } from '../base/tokens';\n\nexport interface RadioOption {\n value: string;\n label: string;\n description?: string;\n}\n\n/**\n * A choose-one group.\n *\n * **It renders native radios, and that is the whole design.** A group of\n * `<input type=\"radio\">` sharing a name already has roving tabindex, arrow-key\n * navigation that wraps, Home and End, selection-follows-focus, and the right\n * announcement in every screen reader — all of it, correctly, with no\n * JavaScript. Hand-rolling that is the single most commonly attempted and most\n * commonly botched widget in any design system, and every version of it is a\n * worse version of what the platform ships.\n *\n * Because the radios share one shadow root, their `name` scopes to this\n * component and cannot collide with another group on the page.\n *\n * The label is a `<legend>` inside a `<fieldset>`, not a `<label for>`:\n * `for` names one control, and the question here is asked of the set.\n\n *\n * @category form\n * @icon radio\n */\nexport class ImpktRadioGroup extends FieldElement {\n static properties = {\n ...FieldElement.properties,\n options: { type: Array },\n };\n\n declare options: RadioOption[];\n\n constructor() {\n super();\n this.options = [];\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 .option {\n display: flex;\n align-items: flex-start;\n gap: ${space(3)};\n padding: ${space(3)};\n border: ${t.borderThin} solid ${t.border};\n border-radius: ${t.radius};\n margin-block-end: ${space(2)};\n cursor: pointer;\n }\n .option:hover {\n background: ${t.surfaceSubtle};\n }\n /* The whole row is the target, not the 20px dot — 2.5.8 is a floor and\n a comfortable target is the actual goal. */\n .option input {\n ${targetSize}\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n flex: none;\n accent-color: ${t.brand};\n }\n .option-text {\n display: block;\n font-size: ${fontSize('md')};\n }\n .option-description {\n display: block;\n font-size: ${fontSize('sm')};\n color: ${t.textMuted};\n margin-block-start: ${space(1)};\n }\n :host([invalid]) .option {\n border-color: ${t.danger};\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 protected renderControl(): TemplateResult {\n return html`\n ${this.options.map((option, i) => {\n const id = this.id_(`opt-${i}`);\n const descId = option.description ? this.id_(`opt-${i}-desc`) : undefined;\n return html`\n <label class=\"option\" part=\"option\" for=${id}>\n <input\n type=\"radio\"\n id=${id}\n name=${this.uid}\n value=${option.value}\n .checked=${this.value === option.value}\n ?disabled=${this.disabled}\n ?required=${this.required && i === 0}\n aria-describedby=${descId ?? nothing}\n @change=${() => this.setFormValue(option.value)}\n />\n <span>\n <span class=\"option-text\">${option.label}</span>\n ${option.description\n ? html`<span class=\"option-description\" id=${descId!}>${option.description}</span>`\n : nothing}\n </span>\n </label>\n `;\n })}\n `;\n }\n\n /**\n * The fieldset wraps everything, so the whole field is rebuilt here rather\n * than relying on the base class's flat order.\n */\n render(): TemplateResult {\n return html`\n <fieldset\n part=\"fieldset\"\n aria-describedby=${this.describedBy}\n aria-invalid=${this.error ? 'true' : nothing}\n >\n ${this.renderLabel()}\n ${this.description\n ? html`<div class=\"description\" id=${this.id_('description')} part=\"description\">\n ${this.description}\n </div>`\n : nothing}\n ${this.renderControl()}\n <div class=\"error\" id=${this.id_('error')} part=\"error\" aria-live=\"polite\">\n ${this.error || nothing}\n </div>\n </fieldset>\n `;\n }\n\n updated(changed: Map<string, unknown>): void {\n if (changed.has('error')) this.toggleAttribute('invalid', Boolean(this.error));\n }\n}\n\ncustomElements.define('impkt-radio-group', ImpktRadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-radio-group': ImpktRadioGroup;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAgCjD,IAAM,kBAAN,cAA8B,aAAa;AAAA,EAChD;AAAA,SAAO,aAAa;AAAA,MAClB,GAAG,aAAa;AAAA,MAChB,SAAS,EAAE,MAAM,MAAM;AAAA,IACzB;AAAA;AAAA,EAIA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU,CAAC;AAAA,EAClB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAaW,MAAM,CAAC,CAAC;AAAA,mBACJ,MAAM,CAAC,CAAC;AAAA,kBACT,EAAE,UAAU,UAAU,EAAE,MAAM;AAAA,yBACvB,EAAE,MAAM;AAAA,4BACL,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,sBAId,EAAE,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,UAK3B,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKI,EAAE,KAAK;AAAA;AAAA;AAAA;AAAA,qBAIV,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA,qBAId,SAAS,IAAI,CAAC;AAAA,iBAClB,EAAE,SAAS;AAAA,8BACE,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA,wBAGd,EAAE,MAAM;AAAA;AAAA;AAAA,IAG9B;AAAA;AAAA,EAEU,cAA8B;AACtC,WAAO;AAAA,QACH,KAAK,KAAK,GAAG,KAAK,WAAW,gCAAgC,KAAK,YAAY,aAAa,OAAO;AAAA;AAAA,EAExG;AAAA,EAEU,gBAAgC;AACxC,WAAO;AAAA,QACH,KAAK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css, html } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { spaceAround, token } from '../base/tokens';\n\n/** Column widths as fractions, for each choice of `widths`. */\nconst WIDTHS: Record<string, string> = {\n '2:1': '2fr 1fr', '1:2': '1fr 2fr', '3:1': '3fr 1fr', '1:3': '1fr 3fr',\n '1:2:1': '1fr 2fr 1fr', '2:1:1': '2fr 1fr 1fr', '1:1:2': '1fr 1fr 2fr',\n};\n\n/**\n * A responsive row with named column slots. Child order stays inside each\n * column; changing a page's visual grid never reorders its reading sequence.\n *\n * Gutters come from the brand's layout, so every grid for a partner keeps the\n * same rhythm. Where the columns stack is a choice, because a three-column\n * row of cards may work on a tablet where two columns of long text do not.\n *\n * @category layout\n * @icon columns\n * @slot column-1 - First column.\n * @slot column-2 - Second column.\n * @slot column-3 - Third column.\n * @slot column-4 - Fourth column.\n */\nexport class ImpktGrid extends ImpktElement {\n static properties = {\n columns: { type: String, reflect: true },\n widths: { type: String, reflect: true },\n gap: { type: String, reflect: true },\n stackOn: { type: String, reflect: true, attribute: 'stack-on' },\n align: { type: String, reflect: true },\n spaceAbove: { type: String, reflect: true, attribute: 'space-above' },\n spaceBelow: { type: String, reflect: true, attribute: 'space-below' },\n };\n declare columns: 'one' | 'two' | 'three' | 'four' | 'sidebar-left' | 'sidebar-right';\n /** How wide each column is against the others. Applies when it has as many parts as there are columns. */\n declare widths: 'equal' | '2:1' | '1:2' | '3:1' | '1:3' | '1:2:1' | '2:1:1' | '1:1:2';\n /** The space between columns, from the brand's gutters. */\n declare gap: 'none' | 'sm' | 'md' | 'lg' | 'xl';\n /** The screens on which the columns stack, one above another, in column order. */\n declare stackOn: 'phone' | 'tablet' | 'never';\n /** How columns of different heights line up. */\n declare align: 'stretch' | 'start' | 'center' | 'end';\n /** Space before the grid, from the spacing scale. */\n declare spaceAbove: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n /** Space after the grid, from the spacing scale. */\n declare spaceBelow: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n constructor() {\n super();\n this.columns = 'two';\n this.widths = 'equal';\n this.gap = 'md';\n this.stackOn = 'phone';\n this.align = 'stretch';\n this.spaceAbove = 'none';\n this.spaceBelow = 'none';\n }\n static styles = [...ImpktElement.styles, spaceAround, css`\n :host { display: block; min-inline-size: 0; container-type: inline-size; }\n .columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: ${token('layout.gutter.md', '16px')}; align-items: stretch; }\n :host([gap='none']) .columns { gap: 0; }\n :host([gap='sm']) .columns { gap: ${token('layout.gutter.sm', '8px')}; }\n :host([gap='lg']) .columns { gap: ${token('layout.gutter.lg', '32px')}; }\n :host([gap='xl']) .columns { gap: ${token('layout.gutter.xl', '48px')}; }\n :host([align='start']) .columns { align-items: start; }\n :host([align='center']) .columns { align-items: center; }\n :host([align='end']) .columns { align-items: end; }\n :host([columns='one']) .columns { grid-template-columns: minmax(0, 1fr); }\n :host([columns='three']) .columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }\n :host([columns='four']) .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }\n :host([columns='sidebar-left']) .columns { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }\n :host([columns='sidebar-right']) .columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }\n .column { min-inline-size: 0; overflow-wrap: anywhere; }\n ::slotted(*) { max-inline-size: 100%; }\n @container (max-width: 40rem) { :host(:not([stack-on='never'])) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n @container (max-width: 64rem) { :host([stack-on='tablet']) .columns { grid-template-columns: minmax(0, 1fr) !important; } }\n `];\n render() {\n const count = this.columns === 'one' ? 1 : this.columns === 'three' ? 3 : this.columns === 'four' ? 4 : 2;\n const fractions = WIDTHS[this.widths]?.split(' ');\n // A width split for a different number of columns would leave a column out, so it is ignored.\n const template = fractions && fractions.length === count ? fractions.map((f) => `minmax(0, ${f})`).join(' ') : '';\n return html`<div class=\"columns\" part=\"row\" style=${template ? `grid-template-columns: ${template}` : ''}>${Array.from({ length: count }, (_, i) => html`<div class=\"column\" part=\"column\"><slot name=${`column-${i + 1}`}></slot></div>`)}</div>`;\n }\n}\ncustomElements.define('impkt-grid', ImpktGrid);\ndeclare global { interface HTMLElementTagNameMap { 'impkt-grid': ImpktGrid } }\n"],"mappings":";;;;;;;AAAA,SAAS,KAAK,YAAY;AAK1B,IAAM,SAAiC;AAAA,EACrC,OAAO;AAAA,EAAW,OAAO;AAAA,EAAW,OAAO;AAAA,EAAW,OAAO;AAAA,EAC7D,SAAS;AAAA,EAAe,SAAS;AAAA,EAAe,SAAS;AAC3D;AAiBO,IAAM,YAAN,cAAwB,aAAa;AAAA,EAC1C;AAAA,SAAO,aAAa;AAAA,MAClB,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,QAAQ,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACtC,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACnC,SAAS,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,WAAW;AAAA,MAC9D,OAAO,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACrC,YAAY,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,cAAc;AAAA,MACpE,YAAY,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,cAAc;AAAA,IACtE;AAAA;AAAA,EAcA,cAAc;AACZ,UAAM;AACN,SAAK,UAAU;AACf,SAAK,SAAS;AACd,SAAK,MAAM;AACX,SAAK,UAAU;AACf,SAAK,QAAQ;AACb,SAAK,aAAa;AAClB,SAAK,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,SAAO,SAAS,CAAC,GAAG,aAAa,QAAQ,aAAa;AAAA;AAAA,uFAE+B,MAAM,oBAAoB,MAAM,CAAC;AAAA;AAAA,wCAEhF,MAAM,oBAAoB,KAAK,CAAC;AAAA,wCAChC,MAAM,oBAAoB,MAAM,CAAC;AAAA,wCACjC,MAAM,oBAAoB,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GAatE;AAAA;AAAA,EACD,SAAS;AACP,UAAM,QAAQ,KAAK,YAAY,QAAQ,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,SAAS,IAAI;AACxG,UAAM,YAAY,OAAO,KAAK,MAAM,GAAG,MAAM,GAAG;AAEhD,UAAM,WAAW,aAAa,UAAU,WAAW,QAAQ,UAAU,IAAI,CAAC,MAAM,aAAa,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI;AAC/G,WAAO,6CAA6C,WAAW,0BAA0B,QAAQ,KAAK,EAAE,IAAI,MAAM,KAAK,EAAE,QAAQ,MAAM,GAAG,CAAC,GAAG,MAAM,oDAAoD,UAAU,IAAI,CAAC,EAAE,gBAAgB,CAAC;AAAA,EAC5O;AACF;AACA,eAAe,OAAO,cAAc,SAAS;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/button.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing, targetSize, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontWeight, space, t, type } from '../base/tokens';\nimport { iconSvg } from './icon';\n\n/**\n * A button.\n *\n * Two decisions carry the accessibility weight here.\n *\n * **A busy button is not a disabled button.** While an action is in flight the\n * control keeps its place in the tab order and reports `aria-disabled`, rather\n * than taking the native `disabled` attribute. A natively disabled element is\n * removed from the tab order, so a keyboard user who had just activated it\n * loses their focus position to the top of the document — at precisely the\n * moment something is happening that they need to be told about. Activation is\n * blocked in the handler instead.\n *\n * **It renders a real `<button>`.** A `<div role=\"button\">` needs Enter and\n * Space handling, a tabindex, and a disabled story, and it will still not\n * submit a form. The native element already has all of that, correctly, in\n * every browser and every assistive technology.\n\n *\n * **A button that goes somewhere is a link.** With `href` set it renders an\n * `<a>` styled as a button, so it opens in a new tab, shows its address and is\n * announced as a link, which is what it is.\n *\n * @category action\n * @icon button\n * @slot - The button label.\n * @fires click - When the button is pressed. Not while it is busy or disabled.\n */\nexport class ImpktButton extends ImpktElement {\n static formAssociated = true;\n\n static properties = {\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n variant: { type: String, reflect: true },\n type: { type: String },\n disabled: { type: Boolean, reflect: true },\n busy: { type: Boolean, reflect: true },\n busyLabel: { type: String, attribute: 'busy-label' },\n full: { type: Boolean, reflect: true },\n fullOnPhone: { type: Boolean, attribute: 'full-on-phone', reflect: true },\n size: { type: String, reflect: true },\n iconBefore: { type: String, attribute: 'icon-before' },\n iconAfter: { type: String, attribute: 'icon-after' },\n href: { type: String },\n };\n\n /** Leave it out on a phone, where a header has no room for it. */\n declare hideOn: 'never' | 'phone';\n declare variant: 'primary' | 'secondary' | 'ghost';\n declare type: 'button' | 'submit' | 'reset';\n declare disabled: boolean;\n declare busy: boolean;\n /** Announced when the button becomes busy. Says what is happening, not that something is. */\n declare busyLabel: string;\n declare full: boolean;\n /** As wide as its space on a phone only, such as a form's send button. */\n declare fullOnPhone: boolean;\n declare size: 'sm' | 'md' | 'lg';\n /** An icon before the words, such as phone or calendar. */\n declare iconBefore: 'none' | 'arrow-right' | 'arrow-left' | 'chevron-right' | 'chevron-down' | 'check' | 'close' | 'menu' | 'plus' | 'minus' | 'search' | 'external' | 'download' | 'home' | 'phone' | 'mail' | 'map-pin' | 'calendar' | 'clock' | 'user' | 'star' | 'heart' | 'shield' | 'leaf' | 'sun' | 'bolt' | 'key' | 'info' | 'warning' | 'document' | 'pound' | 'chat';\n /** An icon after the words, such as arrow-right. */\n declare iconAfter: 'none' | 'arrow-right' | 'arrow-left' | 'chevron-right' | 'chevron-down' | 'check' | 'close' | 'menu' | 'plus' | 'minus' | 'search' | 'external' | 'download' | 'home' | 'phone' | 'mail' | 'map-pin' | 'calendar' | 'clock' | 'user' | 'star' | 'heart' | 'shield' | 'leaf' | 'sun' | 'bolt' | 'key' | 'info' | 'warning' | 'document' | 'pound' | 'chat';\n /** Where the button goes, when it opens a page rather than doing something here. */\n declare href: string;\n\n private internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this.hideOn = 'never';\n this.variant = 'primary';\n this.type = 'button';\n this.disabled = false;\n this.busy = false;\n this.busyLabel = 'Working';\n this.full = false;\n this.fullOnPhone = false;\n this.size = 'md';\n this.iconBefore = 'none';\n this.iconAfter = 'none';\n this.href = '';\n try {\n this.internals = this.attachInternals();\n } catch {\n this.internals = null;\n }\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n touchTarget('button, a'),\n css`\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n :host {\n display: inline-block;\n }\n :host([full]) {\n display: block;\n }\n @media (max-width: 40rem) { :host([full-on-phone]) { display: block; } }\n button, a {\n ${targetSize}\n box-sizing: border-box;\n text-decoration: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: ${space(2)};\n inline-size: 100%;\n min-block-size: 40px;\n padding: ${space(2)} ${space(4)};\n font-family: inherit;\n ${type('sm')}\n font-weight: ${fontWeight('semibold')};\n border-radius: ${t.radiusLg};\n border: ${t.borderThin} solid transparent;\n cursor: pointer;\n transition: background-color 120ms ease-in-out, border-color 120ms ease-in-out, box-shadow 120ms ease-in-out;\n }\n :host([size='sm']) :is(button, a) { min-block-size: 32px; padding: ${space(1)} ${space(3)}; ${type('sm')} gap: ${space(1.5)}; }\n :host([size='lg']) :is(button, a) { min-block-size: 48px; padding: ${space(3)} ${space(6)}; ${type('md')} }\n .icon { flex: none; inline-size: 1.15em; block-size: 1.15em; }\n /* The cursor is the only thing that changes while busy. Moving or\n recolouring a control the moment it is pressed is how a user loses it. */\n button[aria-disabled='true'] {\n cursor: progress;\n }\n :host([disabled]) button {\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n /* Solid: the brand, with a hairline highlight along the top edge. */\n .primary {\n background: ${t.brand};\n color: ${t.onBrand};\n box-shadow: ${t.shadowXs}, inset 0 1px 0 0 rgb(255 255 255 / 0.12);\n }\n .primary:hover:not([aria-disabled='true']) {\n background: var(--impkt-color-action-hover, ${t.brandHover});\n color: var(--impkt-color-action-on-hover, ${t.onBrand});\n }\n /* A brand whose buttons turn on hover lifts the trailing arrow a quarter-turn. */\n .after { transition: transform 160ms ease-out; }\n :is(button, a):hover:not([aria-disabled='true']) .after { transform: rotate(var(--impkt-motion-button-turn, 0deg)); }\n @media (prefers-reduced-motion: reduce) { .after { transition: none; } }\n .primary:active:not([aria-disabled='true']) {\n background: ${t.brandActive};\n }\n\n /* Outline: the card, a hairline border and the text colour, for the second choice. */\n .secondary {\n background: ${t.surfaceCard};\n color: ${t.text};\n border-color: ${t.rule};\n box-shadow: ${t.shadowXs};\n }\n .secondary:hover:not([aria-disabled='true']) {\n background: color-mix(in srgb, ${t.surfaceCard}, ${t.text} 4%);\n border-color: color-mix(in srgb, ${t.text} 25%, transparent);\n }\n\n /* Plain: words only until it is pointed at. */\n .ghost {\n background: transparent;\n color: ${t.link};\n }\n .ghost:hover:not([aria-disabled='true']) {\n background: ${t.wash};\n }\n\n .sr-only {\n ${visuallyHidden}\n }\n\n /* Windows High Contrast Mode drops background and border colours, so a\n button styled only by background becomes invisible. A forced-colors\n border puts the boundary back. */\n @media (forced-colors: active) {\n button, a {\n border-color: ButtonBorder;\n }\n }\n `,\n ];\n\n private onClick(event: MouseEvent): void {\n if (this.disabled || this.busy) {\n event.preventDefault();\n event.stopImmediatePropagation();\n return;\n }\n // A shadow-rooted button does not submit the outer form by itself, because\n // the click never reaches it. `requestSubmit` rather than `submit` so that\n // native validation and the submit event both still run.\n if (this.type === 'submit') this.internals?.form?.requestSubmit();\n if (this.type === 'reset') this.internals?.form?.reset();\n }\n\n render(): TemplateResult {\n const words = html`${iconSvg(this.iconBefore)}<slot></slot>${this.iconAfter && this.iconAfter !== 'none' ? html`<span class=\"after\" aria-hidden=\"true\">${iconSvg(this.iconAfter)}</span>` : nothing}`;\n if (this.href && !this.disabled) {\n return html`<a class=${this.variant} href=${this.href} part=\"button\">${words}</a>`;\n }\n return html`\n <button\n class=${this.variant}\n type=\"button\"\n part=\"button\"\n ?disabled=${this.disabled}\n aria-disabled=${this.busy ? 'true' : nothing}\n aria-busy=${this.busy ? 'true' : nothing}\n @click=${this.onClick}\n >\n ${words}\n ${this.busy ? html`<span class=\"sr-only\">${this.busyLabel}</span>` : nothing}\n </button>\n `;\n }\n}\n\ncustomElements.define('impkt-button', ImpktButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'impkt-button': ImpktButton;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AAkCjD,IAAM,cAAN,cAA0B,aAAa;AAAA,EAuC5C,cAAc;AACZ,UAAM;AAHR,SAAQ,YAAqC;AAI3C,SAAK,SAAS;AACd,SAAK,UAAU;AACf,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,OAAO;AACZ,SAAK,YAAY;AACjB,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,YAAY;AACjB,SAAK,OAAO;AACZ,QAAI;AACF,WAAK,YAAY,KAAK,gBAAgB;AAAA,IACxC,QAAQ;AACN,WAAK,YAAY;AAAA,IACnB;AAAA,EACF;AAAA,EAzDA;AAAA,SAAO,iBAAiB;AAAA;AAAA,EAExB;AAAA,SAAO,aAAa;AAAA,MAClB,QAAQ,EAAE,MAAM,QAAQ,SAAS,MAAM,WAAW,UAAU;AAAA,MAC5D,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK;AAAA,MACvC,MAAM,EAAE,MAAM,OAAO;AAAA,MACrB,UAAU,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MACzC,MAAM,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MACrC,WAAW,EAAE,MAAM,QAAQ,WAAW,aAAa;AAAA,MACnD,MAAM,EAAE,MAAM,SAAS,SAAS,K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- {"version":3,"sources":["../src/components/summary-list.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { focusRing, touchTarget } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\n\nexport interface SummaryRow {\n key: string;\n value: string;\n /** Where \"Change\" goes. Omitted rows show no action. */\n changeHref?: string;\n}\n\n/**\n * Key and value pairs — an order summary, a confirmation, a check-your-answers\n * screen.\n *\n * **It is a description list.** `<dl>` with `<dt>` and `<dd>` says these are\n * pairs; a stack of divs says nothing, and a table claims a grid that a\n * two-column list does not have.\n *\n * **Every \"Change\" names what it changes.** The visible text stays short, and\n * the accessible name is completed with visually hidden words, so a reader\n * tabbing through hears \"Change date of birth\" rather than six links all called\n * \"Change\". This is 2.4.4 Link Purpose, and it is the single most common\n * failure on a check-your-answers page.\n\n *\n * @category content\n * @icon list\n */\nexport class ImpktSummaryList extends ImpktElement {\n static properties = {\n rows: { type: Array },\n changeText: { type: String, attribute: 'change-text' },\n };\n\n declare rows: SummaryRow[];\n declare changeText: string;\n\n constructor() {\n super();\n this.rows = [];\n this.changeText = 'Change';\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n touchTarget('dd a'),\n css`\n :host {\n display: block;\n }\n dl {\n margin: 0;\n display: grid;\n grid-template-columns: minmax(8rem, 1fr) 2fr;\n }\n /* A <dl> group may hold only dt and dd — not a third sibling — so the\n action lives inside the value it changes, which is also where it\n belongs semantically. The row uses display:contents so both cells stay\n in the parent grid. */\n .row {\n display: contents;\n }\n dt,\n dd {\n padding: ${space(3)} 0;\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n dt {\n font-weight: ${fontWeight('semibold')};\n font-size: ${fontSize('sm')};\n }\n dd {\n margin: 0;\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: ${space(3)};\n }\n dd a {\n flex: none;\n color: ${t.link};\n text-decoration: underline;\n text-underline-offset: 0.2em;\n display: inline-flex;\n align-items: center;\n min-block-size: ${t.targetMin};\n }\n .sr-only {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n }\n /* One column on a narrow screen. 1.4.10 Reflow: two columns at 320px\n forces horizontal scrolling, and a summary is read, not scanned\n across. */\n @media (max-width: 30rem) {\n dl {\n grid-template-columns: 1fr;\n }\n dt {\n border-block-end: 0;\n padding-block-end: 0;\n }\n dd {\n padding-block-start: 0;\n }\n }\n `,\n ];\n\n render(): TemplateResult {\n return html`\n <dl part=\"list\">\n ${this.rows.map(\n (row) => html`\n <div class=\"row\" part=\"row\">\n <dt part=\"key\">${row.key}</dt>\n <dd part=\"value\">\n <span>${row.value}</span>\n ${row.changeHref\n ? html`<a href=${row.changeHref} part=\"action\"\n >${this.changeText}<span class=\"sr-only\"> ${row.key}</span></a\n >`\n : nothing}\n </dd>\n </div>\n `,\n )}\n </dl>\n `;\n }\n}\n\ncustomElements.define('impkt-summary-list', ImpktSummaryList);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-summary-list': ImpktSummaryList }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA8BjD,IAAM,mBAAN,cAA+B,aAAa;AAAA,EACjD;AAAA,SAAO,aAAa;AAAA,MAClB,MAAM,EAAE,MAAM,MAAM;AAAA,MACpB,YAAY,EAAE,MAAM,QAAQ,WAAW,cAAc;AAAA,IACvD;AAAA;AAAA,EAKA,cAAc;AACZ,UAAM;AACN,SAAK,OAAO,CAAC;AACb,SAAK,aAAa;AAAA,EACpB;AAAA,EAEA;AAAA,SAAO,SAAS;AAAA,MACd,GAAG,aAAa;AAAA,MAChB;AAAA,MACA,YAAY,MAAM;AAAA,MAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAkBe,MAAM,CAAC,CAAC;AAAA,4BACC,EAAE,UAAU,UAAU,EAAE,IAAI;AAAA;AAAA;AAAA,uBAGjC,WAAW,UAAU,CAAC;AAAA,qBACxB,SAAS,IAAI,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAOpB,MAAM,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,iBAIN,EAAE,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,0BAKG,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IA2BnC;AAAA;AAAA,EAEA,SAAyB;AACvB,WAAO;AAAA;AAAA,UAED,KAAK,KAAK;AAAA,MACV,CAAC,QAAQ;AAAA;AAAA,+BAEY,IAAI,GAAG;AAAA;AAAA,wBAEd,IAAI,KAAK;AAAA,kBACf,IAAI,aACF,eAAe,IAAI,UAAU;AAAA,yBACxB,KAAK,UAAU,0BAA0B,IAAI,GAAG;AAAA,yBAErD,OAAO;AAAA;AAAA;AAAA;AAAA,IAInB,CAAC;AAAA;AAAA;AAAA,EAGP;AACF;AAEA,eAAe,OAAO,sBAAsB,gBAAgB;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/table.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult } from 'lit';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { pageLocale } from '../base/locale';\nimport { focusRing, touchTarget, visuallyHidden } from '../base/styles';\nimport { fontSize, fontWeight, space, t } from '../base/tokens';\nimport { iconSvg } from './icon';\n\nexport interface TableColumn {\n key: string;\n label: string;\n numeric?: boolean;\n /** Let the rows be sorted by this column. Its heading becomes a button. */\n sortable?: boolean;\n}\n\n/** Which way a sorted column runs, in the words `aria-sort` uses. */\nexport type SortDirection = 'ascending' | 'descending';\n\n/**\n * A data table — a plan comparison, a payment schedule, a list of cases.\n *\n * **The caption is required.** It is the table's name, and a page with three\n * unnamed tables is a page a screen-reader user has to read in full to tell\n * apart. Visually it can be the heading they would have written anyway.\n *\n * **It scrolls, and the scroller is focusable.** A wide table cannot reflow to\n * 320px without becoming unreadable, so it scrolls horizontally — and a region\n * that scrolls must be reachable by keyboard, or a keyboard user simply cannot\n * see the right-hand columns. `tabindex=\"0\"` with a role and a name is the\n * established fix, and the name is why the role is there: a bare focusable div\n * announces nothing.\n *\n * **Or it stacks.** With `stack`, a narrow table turns each row into a card,\n * with each value under the name of its column, so a phone reads a list of\n * cases rather than scrolling a grid. The table keeps its roles written out,\n * because some browsers drop a table's meaning once it is no longer drawn as one.\n *\n * **Sorting is announced.** A sortable column's heading is a button, and the\n * column the rows are sorted by carries `aria-sort`, so a screen reader says\n * \"Opened, sorted descending\" rather than leaving the order to be guessed. The\n * table sorts its own rows unless `manual-sort` says the app does it, as an app\n * that pages its rows on the server must.\n *\n * **Rows can be chosen.** With `selectable`, each row has a checkbox named by\n * the row's first cell, and the heading has one for every row. A row is known by\n * its `id`, or by the key `row-key` names.\n *\n * A cell can hold more than words: give the table a child with\n * `slot=\"cell:{row id}:{column key}\"`, such as a badge, and it is drawn in that\n * cell. With no rows the table says `empty-text`, or shows a child with\n * `slot=\"empty\"`.\n *\n * @category content\n * @icon table\n * @slot empty - What to show when there are no rows, in place of the empty text.\n * @fires {CustomEvent<{ key: string; direction: SortDirection }>} impkt-sort - When a column heading is pressed to sort the rows.\n * @fires {CustomEvent<{ selected: string[] }>} impkt-selection - When rows are chosen or let go. The ids are in detail.selected.\n */\nexport class ImpktTable extends ImpktElement {\n static properties = {\n caption: { type: String },\n columns: { type: Array },\n rows: { type: Array },\n sortKey: { type: String, attribute: 'sort-key', reflect: true },\n sortDirection: { type: String, attribute: 'sort-direction', reflect: true },\n manualSort: { type: Boolean, attribute: 'manual-sort' },\n selectable: { type: Boolean, reflect: true },\n selected: { type: Array },\n rowKey: { type: String, attribute: 'row-key' },\n stack: { type: Boolean, reflect: true },\n emptyText: { type: String, attribute: 'empty-text' },\n selectAllText: { type: String, attribute: 'select-all-text' },\n selectRowText: { type: String, attribute: 'select-row-text' },\n };\n\n declare caption: string;\n declare columns: TableColumn[];\n declare rows: Array<Record<string, string>>;\n /** The key of the column the rows are sorted by. Empty leaves them in the order given. */\n declare sortKey: string;\n declare sortDirection: SortDirection;\n /** The app sorts the rows itself, on `impkt-sort`. The table only shows which column and which way. */\n declare manualSort: boolean;\n /** Each row has a checkbox, and the heading one for every row. */\n declare selectable: boolean;\n /** The ids of the chosen rows. */\n declare selected: string[];\n /** The key in each row that tells rows apart. */\n declare rowKey: string;\n /** On a narrow screen, draw each row as a card rather than scroll the table sideways. */\n declare stack: boolean;\n /** What the table says when it has no rows. */\n declare emptyText: string;\n /** The name of the checkbox that chooses every row. */\n declare selectAllText: string;\n /** The name of each row's checkbox, with `{row}` for the row's first cell. */\n declare selectRowText: string;\n\n constructor() {\n super();\n this.caption = '';\n this.columns = [];\n this.rows = [];\n this.sortKey = '';\n this.sortDirection = 'ascending';\n this.manualSort = false;\n this.selectable = false;\n this.selected = [];\n this.rowKey = 'id';\n this.stack = false;\n this.emptyText = 'Nothing to show';\n this.selectAllText = 'Select all rows';\n this.selectRowText = 'Select {row}';\n }\n\n static styles = [\n ...ImpktElement.styles,\n focusRing,\n touchTarget('.sort, .pick label'),\n css`\n :host {\n display: block;\n }\n :host([stack]) {\n container-type: inline-size;\n }\n .scroller {\n overflow-x: auto;\n }\n table {\n inline-size: 100%;\n border-collapse: collapse;\n font-size: ${fontSize('md')};\n }\n caption {\n text-align: start;\n font-weight: ${fontWeight('semibold')};\n padding-block-end: ${space(2)};\n }\n th,\n td {\n text-align: start;\n padding: ${space(3)};\n border-block-end: ${t.borderThin} solid ${t.rule};\n }\n thead th {\n font-weight: ${fontWeight('semibold')};\n background: ${t.surfaceInset};\n }\n tbody th {\n font-weight: ${fontWeight('semibold')};\n }\n .numeric {\n /* A figure read across a line break is a different figure. */\n white-space: nowrap;\n text-align: end;\n font-variant-numeric: tabular-nums;\n }\n th.sortable {\n padding: ${space(1)};\n }\n .sort {\n display: inline-flex;\n align-items: center;\n gap: ${space(1)};\n min-block-size: ${t.targetMin};\n padding: ${space(2)};\n font: inherit;\n color: inherit;\n background: none;\n border: 0;\n border-radius: ${t.radius};\n cursor: pointer;\n }\n .sort:hover {\n background: ${t.wash};\n }\n .numeric .sort {\n flex-direction: row-reverse;\n }\n .arrow {\n display: inline-flex;\n color: ${t.textMuted};\n transition: transform 140ms ease-in-out;\n }\n [aria-sort] .arrow {\n color: inherit;\n }\n [aria-sort='ascending'] .arrow {\n transform: rotate(180deg);\n }\n :not([aria-sort]) > .sort .arrow {\n opacity: 0.45;\n }\n .pick {\n inline-size: 1%;\n padding-block: 0;\n padding-inline-end: 0;\n }\n .pick label {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-block-size: ${t.targetMin};\n min-inline-size: ${t.targetMin};\n cursor: pointer;\n }\n .pick input {\n inline-size: 20px;\n block-size: 20px;\n margin: 0;\n accent-color: ${t.brand};\n cursor: pointer;\n }\n tr.chosen > * {\n background: ${t.brandSubtle};\n }\n .empty {\n padding-block: ${space(6)};\n text-align: center;\n color: ${t.textMuted};\n }\n .label {\n display: none;\n }\n .visually-hidden {\n ${visuallyHidden}\n }\n /* Stacked: each row a card, each value under its column's name. */\n @container (max-width: 36rem) {\n table, tbody, tr, tbody th, tbody td {\n display: block;\n }\n thead tr {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: ${space(1)};\n margin-block-end: ${space(3)};\n }\n thead th {\n display: none;\n padding: 0;\n border: 0;\n background: none;\n }\n thead th.sortable, thead th.pick {\n display: block;\n inline-size: auto;\n }\n thead .sort {\n border: ${t.borderThin} solid ${t.rule};\n border-radius: 999px;\n padding-inline: ${space(3)};\n background: ${t.surfaceCard};\n }\n tbody tr {\n position: relative;\n margin-block-end: ${space(3)};\n padding: ${space(3)} ${space(4)};\n border: ${t.borderThin} solid ${t.rule};\n border-radius: ${t.radiusXl};\n background: ${t.surfaceCard};\n }\n tbody tr.chosen {\n background: ${t.brandSubtle};\n }\n tr.chosen > * {\n background: none;\n }\n tbody th, tbody td {\n display: grid;\n grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr);\n gap: ${space(3)};\n padding: ${space(1.5)} 0;\n border: 0;\n text-align: start;\n white-space: normal;\n }\n tbody td.numeric {\n text-align: start;\n }\n tbody .pick {\n display: block;\n position: absolute;\n inset-block-start: ${space(1)};\n inset-inline-end: ${space(1)};\n inline-size: auto;\n padding: 0;\n }\n tbody tr:has(.pick) > th {\n padding-inline-end: ${space(10)};\n }\n .label {\n display: block;\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('semibold')};\n color: ${t.textMuted};\n }\n .empty {\n display: block;\n border: 0;\n }\n }\n `,\n ];\n\n private keyOf(row: Record<string, string>, index: number): string {\n const key = row?.[this.rowKey];\n return key === undefined || key === null || key === '' ? String(index) : String(key);\n }\n\n /** The rows in the order they are drawn: as given, or sorted by the chosen column. */\n private ordered(): Array<{ row: Record<string, string>; key: string }> {\n const rows = (this.rows ?? []).map((row, i) => ({ row, key: this.keyOf(row, i) }));\n const column = (this.columns ?? []).find((c) => c.key === this.sortKey && c.sortable);\n if (!column || this.manualSort) return rows;\n const way = this.sortDirection === 'descending' ? -1 : 1;\n const locale = pageLocale(this);\n const figure = (v: unknown) => Number(String(v ?? '').replace(/[^\\d.-]/g, '')) || 0;\n return rows.sort((a, b) => {\n const x = a.row[column.key] ?? '';\n const y = b.row[column.key] ?? '';\n const order = column.numeric ? figure(x) - figure(y) : String(x).localeCompare(String(y), locale, { numeric: true, sensitivity: 'base' });\n return order * way;\n });\n }\n\n private sortBy(key: string): void {\n const direction: SortDirection = this.sortKey === key && this.sortDirection === 'ascending' ? 'descending' : 'ascending';\n this.sortKey = key;\n this.sortDirection = direction;\n this.dispatchEvent(new CustomEvent('impkt-sort', { detail: { key, direction }, bubbles: true, composed: true }));\n }\n\n private choose(keys: string[], on: boolean): void {\n const now = new Set(this.selected ?? []);\n for (const key of keys) {\n if (on) now.add(key);\n else now.delete(key);\n }\n this.selected = [...now];\n this.dispatchEvent(new CustomEvent('impkt-selection', { detail: { selected: this.selected }, bubbles: true, composed: true }));\n }\n\n private heading(c: TableColumn): TemplateResult {\n const sorted = c.sortable && c.key === this.sortKey;\n const classes = [c.numeric ? 'numeric' : '', c.sortable ? 'sortable' : ''].filter(Boolean).join(' ');\n if (!c.sortable) return html`<th scope=\"col\" role=\"columnheader\" class=${classes}>${c.label}</th>`;\n return html`<th scope=\"col\" role=\"columnheader\" class=${classes} aria-sort=${sorted ? this.sortDirection : nothing}>\n <button class=\"sort\" type=\"button\" part=\"sort\" @click=${() => this.sortBy(c.key)}>${c.label}<span class=\"arrow\" aria-hidden=\"true\">${iconSvg('chevron-down', '16px')}</span></button>\n </th>`;\n }\n\n render(): TemplateResult {\n const columns = this.columns ?? [];\n const rows = this.ordered();\n const chosen = new Set(this.selected ?? []);\n const every = rows.length > 0 && rows.every((r) => chosen.has(r.key));\n const some = !every && rows.some((r) => chosen.has(r.key));\n return html`\n <div class=\"scroller\" part=\"scroller\" tabindex=\"0\" role=\"region\" aria-label=${this.caption || nothing}>\n <table part=\"table\" role=\"table\">\n ${this.caption ? html`<caption part=\"caption\">${this.caption}</caption>` : nothing}\n <thead role=\"rowgroup\">\n <tr role=\"row\">\n ${this.selectable\n ? html`<th scope=\"col\" role=\"columnheader\" class=\"pick\"><label><input type=\"checkbox\" aria-label=${this.selectAllText} .checked=${every} .indeterminate=${some} ?disabled=${!rows.length}\n @change=${(e: Event) => this.choose(rows.map((r) => r.key), (e.target as HTMLInputElement).checked)} /></label></th>`\n : nothing}\n ${columns.map((c) => this.heading(c))}\n </tr>\n </thead>\n <tbody role=\"rowgroup\">\n ${rows.length\n ? rows.map(({ row, key }, i) => html`\n <tr role=\"row\" class=${chosen.has(key) ? 'chosen' : ''} part=\"row\">\n ${this.selectable\n ? html`<td role=\"cell\" class=\"pick\"><label><input type=\"checkbox\" aria-label=${this.selectRowText.replace('{row}', String(row[columns[0]?.key ?? ''] ?? key))} .checked=${chosen.has(key)}\n @change=${(e: Event) => this.choose([key], (e.target as HTMLInputElement).checked)} /></label></td>`\n : nothing}\n ${columns.map((c, j) => {\n const value = html`<span class=\"label\" aria-hidden=\"true\">${c.label}</span><span class=\"value\"><slot name=${`cell:${key}:${c.key}`}>${row[c.key] ?? ''}</slot></span>`;\n // The first cell of each row is a row header, so a screen\n // reader announces \"Delivery charge, £250\" rather than\n // reading a bare number with no idea what it belongs to.\n return j === 0\n ? html`<th scope=\"row\" role=\"rowheader\" id=${`${this.uid}-r${i}`}>${value}</th>`\n : html`<td role=\"cell\" class=${c.numeric ? 'numeric' : ''}>${value}</td>`;\n })}\n </tr>\n `)\n : html`<tr role=\"row\"><td role=\"cell\" class=\"empty\" colspan=${columns.length + (this.selectable ? 1 : 0) || 1}><slot name=\"empty\">${this.emptyText}</slot></td></tr>`}\n </tbody>\n </table>\n </div>\n `;\n }\n}\n\ncustomElements.define('impkt-table', ImpktTable);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-table': ImpktTable }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAoC;AA0DjD,IAAM,aAAN,cAAyB,aAAa;AAAA,EAC3C;AAAA,SAAO,aAAa;AAAA,MAClB,SAAS,EAAE,MAAM,OAAO;AAAA,MACxB,SAAS,EAAE,MAAM,MAAM;AAAA,MACvB,MAAM,EAAE,MAAM,MAAM;AAAA,MACpB,SAAS,EAAE,MAAM,QAAQ,WAAW,YAAY,SAAS,KAAK;AAAA,MAC9D,eAAe,EAAE,MAAM,QAAQ,WAAW,kBAAkB,SAAS,KAAK;AAAA,MAC1E,YAAY,EAAE,MAAM,SAAS,WAAW,cAAc;AAAA,MACtD,YAAY,EAAE,MAAM,SAAS,SAAS,KAAK;AAAA,MAC3C,UAAU,EAAE,MAAM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EAAE,IAAI,KAAK,UACvE,6BAA6B,EAAE,UAAU,YAAY,EAAE,IAAI,KAAK;AAAA,IACtE,CAAC,CAAC;AAAA;AAAA,eAEL,IACC,4DAA4D,QAAQ,UAAU,KAAK,aAAa,IAAI,MAAM,CAAC,uBAAuB,KAAK,SAAS,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjL;AACF;AAEA,eAAe,OAAO,eAAe,UAAU;","names":[]}
@@ -1,264 +0,0 @@
1
- import {
2
- ImpktElement,
3
- fontSize,
4
- fontWeight,
5
- say,
6
- space,
7
- t,
8
- token
9
- } from "./chunk-3KO55PZK.js";
10
-
11
- // packages/ui/src/components/scene.ts
12
- import { html, css, nothing } from "lit";
13
- var clamp = (n) => Math.min(1, Math.max(0, n));
14
- var ImpktScene = class extends ImpktElement {
15
- constructor() {
16
- super();
17
- /**
18
- * Whether a loop is paused: the scene's own state, set by its pause button
19
- * or by `pause()`. A plain field rather than a property, so it is never one
20
- * of the settings an author is offered.
21
- */
22
- this.paused = false;
23
- this.frame = 0;
24
- this.started = 0;
25
- this.reduced = false;
26
- this.seekFrom = 0;
27
- this.seekTo = 0;
28
- this.seekStart = 0;
29
- this.seekMs = 0;
30
- this.onScroll = () => {
31
- if (this.drive === "view" || this.drive === "page") this.schedule();
32
- };
33
- this.tick = (now) => {
34
- this.frame = 0;
35
- if (this.seekMs) {
36
- if (!this.seekStart) this.seekStart = now;
37
- const p = Math.min(1, (now - this.seekStart) / this.seekMs);
38
- const e = p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2;
39
- this.progress = this.seekFrom + (this.seekTo - this.seekFrom) * e;
40
- if (p < 1) this.schedule();
41
- else this.seekMs = 0;
42
- return;
43
- }
44
- if (this.drive === "view") {
45
- const r = this.getBoundingClientRect();
46
- const vh = window.innerHeight || 1;
47
- this.progress = clamp(-r.top / Math.max(1, r.height - vh));
48
- } else if (this.drive === "page") {
49
- const doc = document.documentElement;
50
- this.progress = clamp(window.scrollY / Math.max(1, doc.scrollHeight - (window.innerHeight || 0)));
51
- } else if (this.drive === "loop" && !this.paused && !this.reduced) {
52
- if (!this.started) this.started = now - this.progress * this.duration * 1e3;
53
- this.progress = (now - this.started) / (this.duration * 1e3) % 1;
54
- this.schedule();
55
- }
56
- };
57
- this.togglePause = () => this.setPaused(!this.paused);
58
- this.drive = "view";
59
- this.layout = "stage";
60
- this.length = 3;
61
- this.duration = 8;
62
- this.label = "Animation";
63
- this.progress = 0;
64
- this.controls = "below";
65
- this.bleed = false;
66
- this.hideOn = "never";
67
- }
68
- static {
69
- this.properties = {
70
- drive: { type: String, reflect: true },
71
- layout: { type: String, reflect: true },
72
- length: { type: Number },
73
- duration: { type: Number },
74
- label: { type: String },
75
- progress: { type: Number },
76
- controls: { type: String, reflect: true },
77
- bleed: { type: Boolean, reflect: true },
78
- hideOn: { type: String, reflect: true, attribute: "hide-on" }
79
- };
80
- }
81
- static {
82
- this.styles = [
83
- ...ImpktElement.styles,
84
- css`
85
- :host {
86
- display: block;
87
- position: relative;
88
- }
89
- :host([drive='view'][layout='stage']) {
90
- min-height: calc(var(--impkt-scene-length, 3) * 100svh);
91
- }
92
- .frame {
93
- display: grid;
94
- grid-template-columns: minmax(0, 1fr);
95
- }
96
- :host([layout='split']) .frame {
97
- grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
98
- gap: ${space(8)};
99
- }
100
- .stage {
101
- position: sticky;
102
- top: 0;
103
- height: 100svh;
104
- display: grid;
105
- place-items: center;
106
- overflow: clip;
107
- }
108
- /* What is on the stage is layered, as in a motion tool: each thing sits
109
- over the one before, so a later layer's timeline can reveal it over an
110
- earlier one. */
111
- .stage ::slotted(*) {
112
- grid-area: 1 / 1;
113
- max-width: 100%;
114
- }
115
- :host([drive='loop']) .stage,
116
- :host([drive='scrubber']) .stage {
117
- position: relative;
118
- height: auto;
119
- min-height: 60svh;
120
- }
121
- .controls {
122
- display: flex;
123
- gap: ${space(3)};
124
- align-items: center;
125
- justify-content: center;
126
- padding-block: ${space(3)};
127
- }
128
- :host([bleed]) { margin-inline: calc(50% - 50vw); }
129
- @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }
130
- @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none; } }
131
- /* Over the stage, the controls float at its foot, above the layers and clear of its edges. */
132
- .stage > .controls { position: absolute; inset-inline: ${space(6)}; inset-block-end: ${space(6)}; z-index: 2; padding: 0; }
133
- .stage > .controls ::slotted(*) { box-shadow: 0 12px 32px rgb(16 19 23 / 14%); border-radius: 16px; background: var(--impkt-color-surface-card, #fff); }
134
- /* A control takes the row, so a graph scrubber spans the stage; a narrower one centres itself. */
135
- .controls ::slotted(*) { flex: 1 1 auto; min-width: 0; }
136
- .pause {
137
- min-width: ${token("target.min", "24px")};
138
- min-height: ${token("target.min", "24px")};
139
- padding: ${space(2)} ${space(4)};
140
- border-radius: ${token("radius.full", "9999px")};
141
- border: 1px solid ${t.border};
142
- background: ${t.surfaceCard};
143
- color: ${t.text};
144
- font-size: ${fontSize("sm")};
145
- font-weight: ${fontWeight("medium")};
146
- cursor: pointer;
147
- }
148
- .pause:focus-visible {
149
- outline: none;
150
- box-shadow: ${token("focus.ring.shadow", "0 0 0 2px #fff, 0 0 0 4px #1a1a1a")};
151
- }
152
- @media (max-width: 48rem) {
153
- :host([layout='split']) .frame {
154
- grid-template-columns: minmax(0, 1fr);
155
- }
156
- :host([layout='split']) .stage {
157
- height: 50svh;
158
- z-index: 1;
159
- }
160
- }
161
- @media (prefers-reduced-motion: reduce) {
162
- :host {
163
- min-height: 0 !important;
164
- }
165
- .stage {
166
- position: relative;
167
- height: auto;
168
- gap: ${space(6)};
169
- }
170
- /* With less motion the layers are shown one after another, so every
171
- state the scene would have moved through can still be seen. */
172
- .stage ::slotted(*) {
173
- grid-area: auto;
174
- }
175
- }
176
- `
177
- ];
178
- }
179
- /** @ignore */
180
- connectedCallback() {
181
- super.connectedCallback();
182
- try {
183
- this.reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
184
- } catch {
185
- this.reduced = false;
186
- }
187
- window.addEventListener("scroll", this.onScroll, { passive: true, capture: true });
188
- window.addEventListener("resize", this.onScroll);
189
- this.schedule();
190
- }
191
- /** @ignore */
192
- disconnectedCallback() {
193
- super.disconnectedCallback();
194
- window.removeEventListener("scroll", this.onScroll, { capture: true });
195
- window.removeEventListener("resize", this.onScroll);
196
- if (this.frame) cancelAnimationFrame(this.frame);
197
- this.frame = 0;
198
- }
199
- /** @ignore */
200
- updated(changed) {
201
- if (changed.has("length")) this.style.setProperty("--impkt-scene-length", String(this.length));
202
- if (changed.has("progress")) this.publish();
203
- if (changed.has("drive")) {
204
- this.started = 0;
205
- this.schedule();
206
- }
207
- }
208
- /**
209
- * Move to a progress. With `ms`, ease there; without, jump. A scrubber seeks
210
- * a scene to a named stop this way.
211
- */
212
- seek(to, ms = 0) {
213
- if (ms <= 0 || this.reduced) {
214
- this.progress = clamp(to);
215
- return;
216
- }
217
- this.seekFrom = this.progress;
218
- this.seekTo = clamp(to);
219
- this.seekStart = 0;
220
- this.seekMs = ms;
221
- this.schedule();
222
- }
223
- schedule() {
224
- if (!this.frame && typeof requestAnimationFrame === "function") this.frame = requestAnimationFrame(this.tick);
225
- }
226
- publish() {
227
- this.style.setProperty("--impkt-scene-progress", this.progress.toFixed(4));
228
- this.dispatchEvent(new CustomEvent("impkt-scene-progress", { detail: { progress: this.progress }, bubbles: true, composed: true }));
229
- }
230
- setPaused(paused) {
231
- if (this.paused === paused) return;
232
- this.paused = paused;
233
- this.started = 0;
234
- this.schedule();
235
- this.requestUpdate();
236
- }
237
- /** Stop a loop where it is, as its pause button does. An editor scrubbing the scene calls it. */
238
- pause() {
239
- this.setPaused(true);
240
- }
241
- render() {
242
- const loop = this.drive === "loop";
243
- const over = this.controls === "over" && !this.reduced;
244
- const controls = html`<div class="controls" part="controls">
245
- <slot name="controls"></slot>
246
- ${loop && !this.reduced ? html`<button class="pause" type="button" aria-pressed=${this.paused ? "true" : "false"} @click=${this.togglePause}>
247
- ${this.paused ? say("Play {name}", { name: this.label }) : say("Pause {name}", { name: this.label })}
248
- </button>` : nothing}
249
- </div>`;
250
- const stage = html`<div class="stage" part="stage"><slot name="stage"></slot>${over ? controls : nothing}</div>`;
251
- return html`
252
- <div class="frame" part="frame" role="region" aria-label=${this.label}>
253
- ${this.layout === "split" ? html`<div class="content" part="content"><slot></slot></div>${stage}` : html`${stage}<div class="content" part="content"><slot></slot></div>`}
254
- </div>
255
- ${over ? nothing : controls}
256
- `;
257
- }
258
- };
259
- customElements.define("impkt-scene", ImpktScene);
260
-
261
- export {
262
- ImpktScene
263
- };
264
- //# sourceMappingURL=chunk-GBRML4RF.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/scene.ts"],"sourcesContent":["import { html, css, nothing, type TemplateResult, type PropertyValues } from 'lit';\nimport { say } from '../base/say';\nimport { ImpktElement } from '../base/ImpktElement';\nimport { fontSize, fontWeight, space, t, token } from '../base/tokens';\n\nexport type SceneDrive = 'view' | 'page' | 'loop' | 'scrubber';\nexport type SceneLayout = 'stage' | 'split';\n\nconst clamp = (n: number) => Math.min(1, Math.max(0, n));\n\n/**\n * A scene: a stage whose children move along a progress from 0 to 1.\n *\n * The children declare timelines in their `motion` block, and `@atomic-ui/motion`\n * compiles them to keyframes. This element owns only the progress, and where it\n * comes from is the `drive` (ADR 0027):\n *\n * - `view` — the scene's own passage through the viewport. The stage pins\n * while the scene scrolls past, for `length` screens, or beside the content\n * in the default slot when `layout` is `split`.\n * - `page` — the scroll position of the whole page.\n * - `loop` — time, over `duration` seconds, repeating. **It always shows a\n * pause button**, because anything that moves on its own for more than five\n * seconds must be pausable (WCAG 2.2.2), and a scene that could forget that\n * is one the gate would have to catch on every page.\n * - `scrubber` — an `impkt-scrubber` placed in the `controls` slot.\n *\n * Progress is published three ways: the `progress` property, the\n * `--impkt-scene-progress` custom property on the host, and an\n * `impkt-scene-progress` event. Engines with scroll-driven animations run `view`\n * and `page` scenes natively, and the runtime ignores the event for them.\n *\n * Under reduced motion a `loop` does not start, and nothing pins: the stage\n * and the content stack, so every state of the scene can be read in order.\n *\n * @category layout\n * @icon layers\n * @slot stage - What moves, layered one over another. Pinned while the scene plays,\n * beside the content in `split` layout, after it, so the words are read first.\n * @slot - Content that scrolls past the stage, such as chapters.\n * @slot controls - An `impkt-scrubber`, for a scene driven by one.\n * @fires {CustomEvent<{ progress: number }>} impkt-scene-progress - `{ progress }` whenever the progress changes.\n */\nexport class ImpktScene extends ImpktElement {\n static properties = {\n drive: { type: String, reflect: true },\n layout: { type: String, reflect: true },\n length: { type: Number },\n duration: { type: Number },\n label: { type: String },\n progress: { type: Number },\n controls: { type: String, reflect: true },\n bleed: { type: Boolean, reflect: true },\n hideOn: { type: String, reflect: true, attribute: 'hide-on' },\n };\n\n /** Where the progress comes from. */\n declare drive: 'view' | 'page' | 'loop' | 'scrubber';\n /** `stage` pins one full-width stage; `split` pins it beside the content. */\n declare layout: 'stage' | 'split';\n /** How many screens of scrolling a `view` scene lasts, in `stage` layout. */\n declare length: number;\n /** Seconds per cycle of a `loop` scene. */\n declare duration: number;\n /** The scene's accessible name. Also names its pause button. */\n declare label: string;\n /** From 0 to 1. Set it to seek a `scrubber` scene, or where one starts. */\n declare progress: number;\n /**\n * Where the controls sit: `below` the stage, or `over` its foot, floating\n * on what it shows, as a video's do. Under reduced motion they sit below.\n */\n declare controls: 'below' | 'over';\n /** Run the stage to the window's edges, past the page's margins, as a hero drawn edge to edge does. */\n declare bleed: boolean;\n /**\n * Leave it out on a phone, or on anything wider, for a picture drawn twice:\n * once for a wide screen and once for a narrow one. Never both.\n */\n declare hideOn: 'never' | 'phone' | 'wide';\n /**\n * Whether a loop is paused: the scene's own state, set by its pause button\n * or by `pause()`. A plain field rather than a property, so it is never one\n * of the settings an author is offered.\n */\n private paused = false;\n\n private frame = 0;\n private started = 0;\n private reduced = false;\n private seekFrom = 0;\n private seekTo = 0;\n private seekStart = 0;\n private seekMs = 0;\n\n constructor() {\n super();\n this.drive = 'view';\n this.layout = 'stage';\n this.length = 3;\n this.duration = 8;\n this.label = 'Animation';\n this.progress = 0;\n this.controls = 'below';\n this.bleed = false;\n this.hideOn = 'never';\n }\n\n static styles = [\n ...ImpktElement.styles,\n css`\n :host {\n display: block;\n position: relative;\n }\n :host([drive='view'][layout='stage']) {\n min-height: calc(var(--impkt-scene-length, 3) * 100svh);\n }\n .frame {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n }\n :host([layout='split']) .frame {\n grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);\n gap: ${space(8)};\n }\n .stage {\n position: sticky;\n top: 0;\n height: 100svh;\n display: grid;\n place-items: center;\n overflow: clip;\n }\n /* What is on the stage is layered, as in a motion tool: each thing sits\n over the one before, so a later layer's timeline can reveal it over an\n earlier one. */\n .stage ::slotted(*) {\n grid-area: 1 / 1;\n max-width: 100%;\n }\n :host([drive='loop']) .stage,\n :host([drive='scrubber']) .stage {\n position: relative;\n height: auto;\n min-height: 60svh;\n }\n .controls {\n display: flex;\n gap: ${space(3)};\n align-items: center;\n justify-content: center;\n padding-block: ${space(3)};\n }\n :host([bleed]) { margin-inline: calc(50% - 50vw); }\n @media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }\n @media (min-width: 40.0625rem) { :host([hide-on='wide']) { display: none; } }\n /* Over the stage, the controls float at its foot, above the layers and clear of its edges. */\n .stage > .controls { position: absolute; inset-inline: ${space(6)}; inset-block-end: ${space(6)}; z-index: 2; padding: 0; }\n .stage > .controls ::slotted(*) { box-shadow: 0 12px 32px rgb(16 19 23 / 14%); border-radius: 16px; background: var(--impkt-color-surface-card, #fff); }\n /* A control takes the row, so a graph scrubber spans the stage; a narrower one centres itself. */\n .controls ::slotted(*) { flex: 1 1 auto; min-width: 0; }\n .pause {\n min-width: ${token('target.min', '24px')};\n min-height: ${token('target.min', '24px')};\n padding: ${space(2)} ${space(4)};\n border-radius: ${token('radius.full', '9999px')};\n border: 1px solid ${t.border};\n background: ${t.surfaceCard};\n color: ${t.text};\n font-size: ${fontSize('sm')};\n font-weight: ${fontWeight('medium')};\n cursor: pointer;\n }\n .pause:focus-visible {\n outline: none;\n box-shadow: ${token('focus.ring.shadow', '0 0 0 2px #fff, 0 0 0 4px #1a1a1a')};\n }\n @media (max-width: 48rem) {\n :host([layout='split']) .frame {\n grid-template-columns: minmax(0, 1fr);\n }\n :host([layout='split']) .stage {\n height: 50svh;\n z-index: 1;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n :host {\n min-height: 0 !important;\n }\n .stage {\n position: relative;\n height: auto;\n gap: ${space(6)};\n }\n /* With less motion the layers are shown one after another, so every\n state the scene would have moved through can still be seen. */\n .stage ::slotted(*) {\n grid-area: auto;\n }\n }\n `,\n ];\n\n /** @ignore */\n connectedCallback(): void {\n super.connectedCallback();\n try {\n this.reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n } catch {\n this.reduced = false;\n }\n window.addEventListener('scroll', this.onScroll, { passive: true, capture: true });\n window.addEventListener('resize', this.onScroll);\n this.schedule();\n }\n\n /** @ignore */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n window.removeEventListener('scroll', this.onScroll, { capture: true });\n window.removeEventListener('resize', this.onScroll);\n if (this.frame) cancelAnimationFrame(this.frame);\n this.frame = 0;\n }\n\n /** @ignore */\n protected updated(changed: PropertyValues<this>): void {\n if (changed.has('length')) this.style.setProperty('--impkt-scene-length', String(this.length));\n if (changed.has('progress')) this.publish();\n if (changed.has('drive')) {\n this.started = 0;\n this.schedule();\n }\n }\n\n /**\n * Move to a progress. With `ms`, ease there; without, jump. A scrubber seeks\n * a scene to a named stop this way.\n */\n seek(to: number, ms = 0): void {\n if (ms <= 0 || this.reduced) {\n this.progress = clamp(to);\n return;\n }\n this.seekFrom = this.progress;\n this.seekTo = clamp(to);\n this.seekStart = 0;\n this.seekMs = ms;\n this.schedule();\n }\n\n private onScroll = () => {\n if (this.drive === 'view' || this.drive === 'page') this.schedule();\n };\n\n private schedule(): void {\n if (!this.frame && typeof requestAnimationFrame === 'function') this.frame = requestAnimationFrame(this.tick);\n }\n\n private tick = (now: number) => {\n this.frame = 0;\n if (this.seekMs) {\n if (!this.seekStart) this.seekStart = now;\n const p = Math.min(1, (now - this.seekStart) / this.seekMs);\n // ease-in-out, so a jump between stops reads as travel rather than a cut\n const e = p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2;\n this.progress = this.seekFrom + (this.seekTo - this.seekFrom) * e;\n if (p < 1) this.schedule();\n else this.seekMs = 0;\n return;\n }\n if (this.drive === 'view') {\n const r = this.getBoundingClientRect();\n const vh = window.innerHeight || 1;\n this.progress = clamp(-r.top / Math.max(1, r.height - vh));\n } else if (this.drive === 'page') {\n const doc = document.documentElement;\n this.progress = clamp(window.scrollY / Math.max(1, doc.scrollHeight - (window.innerHeight || 0)));\n } else if (this.drive === 'loop' && !this.paused && !this.reduced) {\n if (!this.started) this.started = now - this.progress * this.duration * 1000;\n this.progress = ((now - this.started) / (this.duration * 1000)) % 1;\n this.schedule();\n }\n };\n\n private publish(): void {\n this.style.setProperty('--impkt-scene-progress', this.progress.toFixed(4));\n this.dispatchEvent(new CustomEvent('impkt-scene-progress', { detail: { progress: this.progress }, bubbles: true, composed: true }));\n }\n\n private setPaused(paused: boolean): void {\n if (this.paused === paused) return;\n this.paused = paused;\n this.started = 0;\n this.schedule();\n this.requestUpdate();\n }\n\n private togglePause = () => this.setPaused(!this.paused);\n\n /** Stop a loop where it is, as its pause button does. An editor scrubbing the scene calls it. */\n pause(): void {\n this.setPaused(true);\n }\n\n render(): TemplateResult {\n const loop = this.drive === 'loop';\n const over = this.controls === 'over' && !this.reduced;\n const controls = html`<div class=\"controls\" part=\"controls\">\n <slot name=\"controls\"></slot>\n ${loop && !this.reduced\n ? html`<button class=\"pause\" type=\"button\" aria-pressed=${this.paused ? 'true' : 'false'} @click=${this.togglePause}>\n ${this.paused ? say('Play {name}', { name: this.label }) : say('Pause {name}', { name: this.label })}\n </button>`\n : nothing}\n </div>`;\n const stage = html`<div class=\"stage\" part=\"stage\"><slot name=\"stage\"></slot>${over ? controls : nothing}</div>`;\n return html`\n <div class=\"frame\" part=\"frame\" role=\"region\" aria-label=${this.label}>\n ${this.layout === 'split'\n ? html`<div class=\"content\" part=\"content\"><slot></slot></div>${stage}`\n : html`${stage}<div class=\"content\" part=\"content\"><slot></slot></div>`}\n </div>\n ${over ? nothing : controls}\n `;\n }\n}\n\ncustomElements.define('impkt-scene', ImpktScene);\n\ndeclare global {\n interface HTMLElementTagNameMap { 'impkt-scene': ImpktScene }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,KAAK,eAAyD;AAQ7E,IAAM,QAAQ,CAAC,MAAc,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,CAAC,CAAC;AAmChD,IAAM,aAAN,cAAyB,aAAa;AAAA,EAoD3C,cAAc;AACZ,UAAM;AAXR;AAAA;AAAA;AAAA;AAAA;AAAA,SAAQ,SAAS;AAEjB,SAAQ,QAAQ;AAChB,SAAQ,UAAU;AAClB,SAAQ,UAAU;AAClB,SAAQ,WAAW;AACnB,SAAQ,SAAS;AACjB,SAAQ,YAAY;AACpB,SAAQ,SAAS;AAgKjB,SAAQ,WAAW,MAAM;AACvB,UAAI,KAAK,UAAU,UAAU,KAAK,UAAU,OAAQ,MAAK,SAAS;AAAA,IACpE;AAMA,SAAQ,OAAO,CAAC,QAAgB;AAC9B,WAAK,QAAQ;AACb,UAAI,KAAK,QAAQ;AACf,YAAI,CAAC,KAAK,UAAW,MAAK,YAAY;AACtC,cAAM,IAAI,KAAK,IAAI,IAAI,MAAM,KAAK,aAAa,KAAK,MAAM;AAE1D,cAAM,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,KAAK,IAAI,GAAG,CAAC,IAAI;AAClE,aAAK,WAAW,KAAK,YAAY,KAAK,SAAS,KAAK,YAAY;AAChE,YAAI,IAAI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