@atomic-ui/ui 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -96
- package/custom-elements.json +851 -56
- package/dist/base/FieldElement.d.ts +11 -0
- package/dist/base/scroll-lock.d.ts +2 -0
- package/dist/base/styles.d.ts +24 -5
- package/dist/chunk-2YRTFWW2.js +26 -0
- package/dist/chunk-2YRTFWW2.js.map +1 -0
- package/dist/{chunk-UNVL3CNM.js → chunk-37PA72FC.js} +4 -4
- package/dist/{chunk-UNVL3CNM.js.map → chunk-37PA72FC.js.map} +1 -1
- package/dist/{chunk-D6C7XEY4.js → chunk-3KO55PZK.js} +7 -2
- package/dist/chunk-3KO55PZK.js.map +1 -0
- package/dist/{chunk-7BSZPUE3.js → chunk-3RE4H2XO.js} +2 -2
- package/dist/{chunk-R67PDFKE.js → chunk-46BYUQ5A.js} +2 -2
- package/dist/{chunk-NCASAXQT.js → chunk-4OYHT4BN.js} +2 -2
- package/dist/{chunk-3IQ73WNW.js → chunk-55DK75QF.js} +6 -4
- package/dist/chunk-55DK75QF.js.map +1 -0
- package/dist/{chunk-TGT7J4EG.js → chunk-5QSTXIPG.js} +2 -2
- package/dist/{chunk-HYPPG4NF.js → chunk-7P4Z4CLK.js} +55 -16
- package/dist/chunk-7P4Z4CLK.js.map +1 -0
- package/dist/{chunk-26O27BQS.js → chunk-APJ5JGRW.js} +3 -3
- package/dist/{chunk-WFKSOM6O.js → chunk-AUVIOU5G.js} +38 -14
- package/dist/chunk-AUVIOU5G.js.map +1 -0
- package/dist/{chunk-FFCIY7NM.js → chunk-CUUBAETM.js} +2 -2
- package/dist/{chunk-OMJMUFOW.js → chunk-DAH7RLW3.js} +3 -3
- package/dist/{chunk-6YYAOKNI.js → chunk-DJEZW7AC.js} +2 -2
- package/dist/{chunk-E3XJK7MY.js → chunk-DKZ425AM.js} +5 -3
- package/dist/chunk-DKZ425AM.js.map +1 -0
- package/dist/{chunk-EDSZI227.js → chunk-F4YQWKK2.js} +7 -4
- package/dist/chunk-F4YQWKK2.js.map +1 -0
- package/dist/chunk-FVCM4WHD.js +328 -0
- package/dist/chunk-FVCM4WHD.js.map +1 -0
- package/dist/{chunk-7XEPNEVQ.js → chunk-GBRML4RF.js} +2 -2
- package/dist/chunk-GBRML4RF.js.map +1 -0
- package/dist/{chunk-MVEFM5QI.js → chunk-HXINWP3V.js} +42 -13
- package/dist/chunk-HXINWP3V.js.map +1 -0
- package/dist/{chunk-OB7WULFK.js → chunk-IOBSIAHB.js} +2 -2
- package/dist/{chunk-4X723QBD.js → chunk-IZOTGWWI.js} +4 -4
- package/dist/{chunk-4X723QBD.js.map → chunk-IZOTGWWI.js.map} +1 -1
- package/dist/{chunk-QB2KMV6S.js → chunk-J2FACXYI.js} +3 -3
- package/dist/{chunk-UCHJCUYI.js → chunk-KKJEEKL2.js} +33 -7
- package/dist/chunk-KKJEEKL2.js.map +1 -0
- package/dist/{chunk-7OXTZJR4.js → chunk-KMCGX76Y.js} +2 -2
- package/dist/{chunk-KFD4O7VA.js → chunk-NKMVICB5.js} +2 -2
- package/dist/{chunk-OHDPGIJ3.js → chunk-OFLMG6RN.js} +3 -3
- package/dist/chunk-OFLMG6RN.js.map +1 -0
- package/dist/{chunk-XJXCTGDR.js → chunk-P6GDMZK4.js} +3 -3
- package/dist/{chunk-FJRHZA3C.js → chunk-PO6FCAIS.js} +3 -3
- package/dist/{chunk-2CFVV2NZ.js → chunk-PWLZFGS3.js} +3 -3
- package/dist/{chunk-J4JULXUG.js → chunk-QJIB36DM.js} +3 -3
- package/dist/chunk-QJIB36DM.js.map +1 -0
- package/dist/{chunk-OLLZFNO6.js → chunk-R7FKGFW6.js} +2 -2
- package/dist/{chunk-GQDUHZE3.js → chunk-RWWRTURA.js} +3 -3
- package/dist/{chunk-NKTMMJYD.js → chunk-RYBY35QE.js} +6 -5
- package/dist/chunk-RYBY35QE.js.map +1 -0
- package/dist/{chunk-UHLRXI6J.js → chunk-S7F5VKWU.js} +2 -2
- package/dist/chunk-S7F5VKWU.js.map +1 -0
- package/dist/{chunk-YK5QI57J.js → chunk-T5W3FDSF.js} +3 -3
- package/dist/chunk-T5W3FDSF.js.map +1 -0
- package/dist/{chunk-YD6IZ2C5.js → chunk-TCXKZDMR.js} +2 -2
- package/dist/{chunk-E2VBUWJ4.js → chunk-WGPB3QQU.js} +3 -3
- package/dist/{chunk-XEJMFFIM.js → chunk-XPCU4KUY.js} +3 -3
- package/dist/{chunk-XEJMFFIM.js.map → chunk-XPCU4KUY.js.map} +1 -1
- package/dist/{chunk-RZSZQMSE.js → chunk-YRYZUYY7.js} +2 -2
- package/dist/{chunk-7AJN2TIS.js → chunk-ZOTAAYO5.js} +12 -2
- package/dist/chunk-ZOTAAYO5.js.map +1 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/alert.js +2 -2
- package/dist/components/app-ui.d.ts +28 -12
- package/dist/components/app-ui.js +5 -4
- package/dist/components/blocks.d.ts +28 -2
- package/dist/components/blocks.js +3 -3
- package/dist/components/button.js +3 -3
- package/dist/components/changelog.js +4 -4
- package/dist/components/checkbox-group.js +3 -3
- package/dist/components/checkbox.js +3 -3
- package/dist/components/date-input.js +3 -3
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.js +3 -2
- package/dist/components/estimator.d.ts +1 -1
- package/dist/components/estimator.js +5 -5
- package/dist/components/fieldset.js +2 -2
- package/dist/components/grid.js +2 -2
- package/dist/components/help.js +2 -2
- package/dist/components/icon.js +2 -2
- package/dist/components/journey.d.ts +15 -1
- package/dist/components/journey.js +3 -3
- package/dist/components/layout.js +2 -2
- package/dist/components/link.js +3 -3
- package/dist/components/list.js +2 -2
- package/dist/components/marketing.d.ts +1 -1
- package/dist/components/marketing.js +3 -3
- package/dist/components/media.js +2 -2
- package/dist/components/navigation.js +3 -3
- package/dist/components/organisms.d.ts +1 -1
- package/dist/components/organisms.js +3 -3
- package/dist/components/page.js +2 -2
- package/dist/components/price.js +2 -2
- package/dist/components/progress.js +2 -2
- package/dist/components/property.d.ts +1 -1
- package/dist/components/property.js +3 -3
- package/dist/components/radio-group.js +3 -3
- package/dist/components/scene.d.ts +1 -1
- package/dist/components/scene.js +2 -2
- package/dist/components/scrubber.js +2 -2
- package/dist/components/select.js +3 -3
- package/dist/components/selling.d.ts +2 -0
- package/dist/components/selling.js +2 -2
- package/dist/components/site.d.ts +1 -1
- package/dist/components/site.js +7 -7
- package/dist/components/summary-list.js +2 -2
- package/dist/components/table.d.ts +94 -2
- package/dist/components/table.js +4 -2
- package/dist/components/text-input.js +3 -3
- package/dist/components/textarea.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -39
- package/dist/standalone/atomic-ui.js +3134 -0
- package/dist/standalone/atomic-ui.js.map +7 -0
- package/dist/standalone/index.html +174 -0
- package/package.json +18 -6
- package/scripts/copy-to-product.mjs +52 -0
- package/specimen/index.html +174 -0
- package/dist/chunk-3IQ73WNW.js.map +0 -1
- package/dist/chunk-7AJN2TIS.js.map +0 -1
- package/dist/chunk-7XEPNEVQ.js.map +0 -1
- package/dist/chunk-D6C7XEY4.js.map +0 -1
- package/dist/chunk-E3XJK7MY.js.map +0 -1
- package/dist/chunk-EDSZI227.js.map +0 -1
- package/dist/chunk-HYPPG4NF.js.map +0 -1
- package/dist/chunk-J4JULXUG.js.map +0 -1
- package/dist/chunk-MVEFM5QI.js.map +0 -1
- package/dist/chunk-NKTMMJYD.js.map +0 -1
- package/dist/chunk-OHDPGIJ3.js.map +0 -1
- package/dist/chunk-UCHJCUYI.js.map +0 -1
- package/dist/chunk-UHLRXI6J.js.map +0 -1
- package/dist/chunk-WDDWWCHN.js +0 -104
- package/dist/chunk-WDDWWCHN.js.map +0 -1
- package/dist/chunk-WFKSOM6O.js.map +0 -1
- package/dist/chunk-YK5QI57J.js.map +0 -1
- /package/dist/{chunk-7BSZPUE3.js.map → chunk-3RE4H2XO.js.map} +0 -0
- /package/dist/{chunk-R67PDFKE.js.map → chunk-46BYUQ5A.js.map} +0 -0
- /package/dist/{chunk-NCASAXQT.js.map → chunk-4OYHT4BN.js.map} +0 -0
- /package/dist/{chunk-TGT7J4EG.js.map → chunk-5QSTXIPG.js.map} +0 -0
- /package/dist/{chunk-26O27BQS.js.map → chunk-APJ5JGRW.js.map} +0 -0
- /package/dist/{chunk-FFCIY7NM.js.map → chunk-CUUBAETM.js.map} +0 -0
- /package/dist/{chunk-OMJMUFOW.js.map → chunk-DAH7RLW3.js.map} +0 -0
- /package/dist/{chunk-6YYAOKNI.js.map → chunk-DJEZW7AC.js.map} +0 -0
- /package/dist/{chunk-OB7WULFK.js.map → chunk-IOBSIAHB.js.map} +0 -0
- /package/dist/{chunk-QB2KMV6S.js.map → chunk-J2FACXYI.js.map} +0 -0
- /package/dist/{chunk-7OXTZJR4.js.map → chunk-KMCGX76Y.js.map} +0 -0
- /package/dist/{chunk-KFD4O7VA.js.map → chunk-NKMVICB5.js.map} +0 -0
- /package/dist/{chunk-XJXCTGDR.js.map → chunk-P6GDMZK4.js.map} +0 -0
- /package/dist/{chunk-FJRHZA3C.js.map → chunk-PO6FCAIS.js.map} +0 -0
- /package/dist/{chunk-2CFVV2NZ.js.map → chunk-PWLZFGS3.js.map} +0 -0
- /package/dist/{chunk-OLLZFNO6.js.map → chunk-R7FKGFW6.js.map} +0 -0
- /package/dist/{chunk-GQDUHZE3.js.map → chunk-RWWRTURA.js.map} +0 -0
- /package/dist/{chunk-YD6IZ2C5.js.map → chunk-TCXKZDMR.js.map} +0 -0
- /package/dist/{chunk-E2VBUWJ4.js.map → chunk-WGPB3QQU.js.map} +0 -0
- /package/dist/{chunk-RZSZQMSE.js.map → chunk-YRYZUYY7.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
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;AAAA,eAG7F,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA;AAAA,mBAElB,WAAW,UAAU,CAAC;AAAA,aAC5B,EAAE,OAAO;A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O,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":[]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
say,
|
|
6
6
|
space,
|
|
7
7
|
t
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3KO55PZK.js";
|
|
9
9
|
|
|
10
10
|
// packages/ui/src/components/alert.ts
|
|
11
11
|
import { html, css, nothing } from "lit";
|
|
@@ -105,4 +105,4 @@ customElements.define("impkt-alert", ImpktAlert);
|
|
|
105
105
|
export {
|
|
106
106
|
ImpktAlert
|
|
107
107
|
};
|
|
108
|
-
//# sourceMappingURL=chunk-
|
|
108
|
+
//# sourceMappingURL=chunk-CUUBAETM.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FieldElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZOTAAYO5.js";
|
|
4
4
|
import {
|
|
5
5
|
fontSize,
|
|
6
6
|
space,
|
|
7
7
|
t,
|
|
8
8
|
targetSize
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3KO55PZK.js";
|
|
10
10
|
|
|
11
11
|
// packages/ui/src/components/radio-group.ts
|
|
12
12
|
import { html, css, nothing } from "lit";
|
|
@@ -136,4 +136,4 @@ customElements.define("impkt-radio-group", ImpktRadioGroup);
|
|
|
136
136
|
export {
|
|
137
137
|
ImpktRadioGroup
|
|
138
138
|
};
|
|
139
|
-
//# sourceMappingURL=chunk-
|
|
139
|
+
//# sourceMappingURL=chunk-DAH7RLW3.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ImpktElement,
|
|
3
3
|
spaceAround,
|
|
4
4
|
token
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3KO55PZK.js";
|
|
6
6
|
|
|
7
7
|
// packages/ui/src/components/grid.ts
|
|
8
8
|
import { css, html } from "lit";
|
|
@@ -71,4 +71,4 @@ customElements.define("impkt-grid", ImpktGrid);
|
|
|
71
71
|
export {
|
|
72
72
|
ImpktGrid
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-DJEZW7AC.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
iconSvg
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NKMVICB5.js";
|
|
4
4
|
import {
|
|
5
5
|
ImpktElement,
|
|
6
6
|
focusRing,
|
|
@@ -8,9 +8,10 @@ import {
|
|
|
8
8
|
space,
|
|
9
9
|
t,
|
|
10
10
|
targetSize,
|
|
11
|
+
touchTarget,
|
|
11
12
|
type,
|
|
12
13
|
visuallyHidden
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3KO55PZK.js";
|
|
14
15
|
|
|
15
16
|
// packages/ui/src/components/button.ts
|
|
16
17
|
import { html, css, nothing } from "lit";
|
|
@@ -59,6 +60,7 @@ var ImpktButton = class extends ImpktElement {
|
|
|
59
60
|
this.styles = [
|
|
60
61
|
...ImpktElement.styles,
|
|
61
62
|
focusRing,
|
|
63
|
+
touchTarget("button, a"),
|
|
62
64
|
css`
|
|
63
65
|
@media (max-width: 40rem) { :host([hide-on='phone']) { display: none; } }
|
|
64
66
|
:host {
|
|
@@ -189,4 +191,4 @@ customElements.define("impkt-button", ImpktButton);
|
|
|
189
191
|
export {
|
|
190
192
|
ImpktButton
|
|
191
193
|
};
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
194
|
+
//# sourceMappingURL=chunk-DKZ425AM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,S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,KAAK,SAAS,QAAS,MAAK,WAAW,MAAM,MAAM;AAAA,EACzD;AAAA,EAEA,SAAyB;AACvB,UAAM,QAAQ,OAAO,QAAQ,KAAK,UAAU,CAAC,gBAAgB,KAAK,aAAa,KAAK,cAAc,SAAS,8CAA8C,QAAQ,KAAK,SAAS,CAAC,YAAY,OAAO;AACnM,QAAI,KAAK,QAAQ,CAAC,KAAK,UAAU;AAC/B,aAAO,gBAAgB,KAAK,OAAO,SAAS,KAAK,IAAI,kBAAkB,KAAK;AAAA,IAC9E;AACA,WAAO;AAAA;AAAA,gBAEK,KAAK,OAAO;AAAA;AAAA;AAAA,oBAGR,KAAK,QAAQ;AAAA,wBACT,KAAK,OAAO,SAAS,OAAO;AAAA,oBAChC,KAAK,OAAO,SAAS,OAAO;AAAA,iBAC/B,KAAK,OAAO;AAAA;AAAA,UAEnB,KAAK;AAAA,UACL,KAAK,OAAO,6BAA6B,KAAK,SAAS,YAAY,OAAO;AAAA;AAAA;AAAA,EAGlF;AACF;AAEA,eAAe,OAAO,gBAAgB,WAAW;","names":[]}
|
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
fontSize,
|
|
5
5
|
fontWeight,
|
|
6
6
|
space,
|
|
7
|
-
t
|
|
8
|
-
|
|
7
|
+
t,
|
|
8
|
+
touchTarget
|
|
9
|
+
} from "./chunk-3KO55PZK.js";
|
|
9
10
|
|
|
10
11
|
// packages/ui/src/components/summary-list.ts
|
|
11
12
|
import { html, css, nothing } from "lit";
|
|
@@ -25,6 +26,7 @@ var ImpktSummaryList = class extends ImpktElement {
|
|
|
25
26
|
this.styles = [
|
|
26
27
|
...ImpktElement.styles,
|
|
27
28
|
focusRing,
|
|
29
|
+
touchTarget("dd a"),
|
|
28
30
|
css`
|
|
29
31
|
:host {
|
|
30
32
|
display: block;
|
|
@@ -62,7 +64,8 @@ var ImpktSummaryList = class extends ImpktElement {
|
|
|
62
64
|
color: ${t.link};
|
|
63
65
|
text-decoration: underline;
|
|
64
66
|
text-underline-offset: 0.2em;
|
|
65
|
-
display: inline-
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
align-items: center;
|
|
66
69
|
min-block-size: ${t.targetMin};
|
|
67
70
|
}
|
|
68
71
|
.sr-only {
|
|
@@ -117,4 +120,4 @@ customElements.define("impkt-summary-list", ImpktSummaryList);
|
|
|
117
120
|
export {
|
|
118
121
|
ImpktSummaryList
|
|
119
122
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
123
|
+
//# sourceMappingURL=chunk-F4YQWKK2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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,M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{
|
|
2
|
+
pageLocale
|
|
3
|
+
} from "./chunk-3IGNZTJU.js";
|
|
4
|
+
import {
|
|
5
|
+
iconSvg
|
|
6
|
+
} from "./chunk-NKMVICB5.js";
|
|
7
|
+
import {
|
|
8
|
+
ImpktElement,
|
|
9
|
+
focusRing,
|
|
10
|
+
fontSize,
|
|
11
|
+
fontWeight,
|
|
12
|
+
space,
|
|
13
|
+
t,
|
|
14
|
+
touchTarget,
|
|
15
|
+
visuallyHidden
|
|
16
|
+
} from "./chunk-3KO55PZK.js";
|
|
17
|
+
|
|
18
|
+
// packages/ui/src/components/table.ts
|
|
19
|
+
import { html, css, nothing } from "lit";
|
|
20
|
+
var ImpktTable = class extends ImpktElement {
|
|
21
|
+
static {
|
|
22
|
+
this.properties = {
|
|
23
|
+
caption: { type: String },
|
|
24
|
+
columns: { type: Array },
|
|
25
|
+
rows: { type: Array },
|
|
26
|
+
sortKey: { type: String, attribute: "sort-key", reflect: true },
|
|
27
|
+
sortDirection: { type: String, attribute: "sort-direction", reflect: true },
|
|
28
|
+
manualSort: { type: Boolean, attribute: "manual-sort" },
|
|
29
|
+
selectable: { type: Boolean, reflect: true },
|
|
30
|
+
selected: { type: Array },
|
|
31
|
+
rowKey: { type: String, attribute: "row-key" },
|
|
32
|
+
stack: { type: Boolean, reflect: true },
|
|
33
|
+
emptyText: { type: String, attribute: "empty-text" },
|
|
34
|
+
selectAllText: { type: String, attribute: "select-all-text" },
|
|
35
|
+
selectRowText: { type: String, attribute: "select-row-text" }
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
this.caption = "";
|
|
41
|
+
this.columns = [];
|
|
42
|
+
this.rows = [];
|
|
43
|
+
this.sortKey = "";
|
|
44
|
+
this.sortDirection = "ascending";
|
|
45
|
+
this.manualSort = false;
|
|
46
|
+
this.selectable = false;
|
|
47
|
+
this.selected = [];
|
|
48
|
+
this.rowKey = "id";
|
|
49
|
+
this.stack = false;
|
|
50
|
+
this.emptyText = "Nothing to show";
|
|
51
|
+
this.selectAllText = "Select all rows";
|
|
52
|
+
this.selectRowText = "Select {row}";
|
|
53
|
+
}
|
|
54
|
+
static {
|
|
55
|
+
this.styles = [
|
|
56
|
+
...ImpktElement.styles,
|
|
57
|
+
focusRing,
|
|
58
|
+
touchTarget(".sort, .pick label"),
|
|
59
|
+
css`
|
|
60
|
+
:host {
|
|
61
|
+
display: block;
|
|
62
|
+
}
|
|
63
|
+
:host([stack]) {
|
|
64
|
+
container-type: inline-size;
|
|
65
|
+
}
|
|
66
|
+
.scroller {
|
|
67
|
+
overflow-x: auto;
|
|
68
|
+
}
|
|
69
|
+
table {
|
|
70
|
+
inline-size: 100%;
|
|
71
|
+
border-collapse: collapse;
|
|
72
|
+
font-size: ${fontSize("md")};
|
|
73
|
+
}
|
|
74
|
+
caption {
|
|
75
|
+
text-align: start;
|
|
76
|
+
font-weight: ${fontWeight("semibold")};
|
|
77
|
+
padding-block-end: ${space(2)};
|
|
78
|
+
}
|
|
79
|
+
th,
|
|
80
|
+
td {
|
|
81
|
+
text-align: start;
|
|
82
|
+
padding: ${space(3)};
|
|
83
|
+
border-block-end: ${t.borderThin} solid ${t.rule};
|
|
84
|
+
}
|
|
85
|
+
thead th {
|
|
86
|
+
font-weight: ${fontWeight("semibold")};
|
|
87
|
+
background: ${t.surfaceInset};
|
|
88
|
+
}
|
|
89
|
+
tbody th {
|
|
90
|
+
font-weight: ${fontWeight("semibold")};
|
|
91
|
+
}
|
|
92
|
+
.numeric {
|
|
93
|
+
/* A figure read across a line break is a different figure. */
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
text-align: end;
|
|
96
|
+
font-variant-numeric: tabular-nums;
|
|
97
|
+
}
|
|
98
|
+
th.sortable {
|
|
99
|
+
padding: ${space(1)};
|
|
100
|
+
}
|
|
101
|
+
.sort {
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: ${space(1)};
|
|
105
|
+
min-block-size: ${t.targetMin};
|
|
106
|
+
padding: ${space(2)};
|
|
107
|
+
font: inherit;
|
|
108
|
+
color: inherit;
|
|
109
|
+
background: none;
|
|
110
|
+
border: 0;
|
|
111
|
+
border-radius: ${t.radius};
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
}
|
|
114
|
+
.sort:hover {
|
|
115
|
+
background: ${t.wash};
|
|
116
|
+
}
|
|
117
|
+
.numeric .sort {
|
|
118
|
+
flex-direction: row-reverse;
|
|
119
|
+
}
|
|
120
|
+
.arrow {
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
color: ${t.textMuted};
|
|
123
|
+
transition: transform 140ms ease-in-out;
|
|
124
|
+
}
|
|
125
|
+
[aria-sort] .arrow {
|
|
126
|
+
color: inherit;
|
|
127
|
+
}
|
|
128
|
+
[aria-sort='ascending'] .arrow {
|
|
129
|
+
transform: rotate(180deg);
|
|
130
|
+
}
|
|
131
|
+
:not([aria-sort]) > .sort .arrow {
|
|
132
|
+
opacity: 0.45;
|
|
133
|
+
}
|
|
134
|
+
.pick {
|
|
135
|
+
inline-size: 1%;
|
|
136
|
+
padding-block: 0;
|
|
137
|
+
padding-inline-end: 0;
|
|
138
|
+
}
|
|
139
|
+
.pick label {
|
|
140
|
+
display: inline-flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
justify-content: center;
|
|
143
|
+
min-block-size: ${t.targetMin};
|
|
144
|
+
min-inline-size: ${t.targetMin};
|
|
145
|
+
cursor: pointer;
|
|
146
|
+
}
|
|
147
|
+
.pick input {
|
|
148
|
+
inline-size: 20px;
|
|
149
|
+
block-size: 20px;
|
|
150
|
+
margin: 0;
|
|
151
|
+
accent-color: ${t.brand};
|
|
152
|
+
cursor: pointer;
|
|
153
|
+
}
|
|
154
|
+
tr.chosen > * {
|
|
155
|
+
background: ${t.brandSubtle};
|
|
156
|
+
}
|
|
157
|
+
.empty {
|
|
158
|
+
padding-block: ${space(6)};
|
|
159
|
+
text-align: center;
|
|
160
|
+
color: ${t.textMuted};
|
|
161
|
+
}
|
|
162
|
+
.label {
|
|
163
|
+
display: none;
|
|
164
|
+
}
|
|
165
|
+
.visually-hidden {
|
|
166
|
+
${visuallyHidden}
|
|
167
|
+
}
|
|
168
|
+
/* Stacked: each row a card, each value under its column's name. */
|
|
169
|
+
@container (max-width: 36rem) {
|
|
170
|
+
table, tbody, tr, tbody th, tbody td {
|
|
171
|
+
display: block;
|
|
172
|
+
}
|
|
173
|
+
thead tr {
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-wrap: wrap;
|
|
176
|
+
align-items: center;
|
|
177
|
+
gap: ${space(1)};
|
|
178
|
+
margin-block-end: ${space(3)};
|
|
179
|
+
}
|
|
180
|
+
thead th {
|
|
181
|
+
display: none;
|
|
182
|
+
padding: 0;
|
|
183
|
+
border: 0;
|
|
184
|
+
background: none;
|
|
185
|
+
}
|
|
186
|
+
thead th.sortable, thead th.pick {
|
|
187
|
+
display: block;
|
|
188
|
+
inline-size: auto;
|
|
189
|
+
}
|
|
190
|
+
thead .sort {
|
|
191
|
+
border: ${t.borderThin} solid ${t.rule};
|
|
192
|
+
border-radius: 999px;
|
|
193
|
+
padding-inline: ${space(3)};
|
|
194
|
+
background: ${t.surfaceCard};
|
|
195
|
+
}
|
|
196
|
+
tbody tr {
|
|
197
|
+
position: relative;
|
|
198
|
+
margin-block-end: ${space(3)};
|
|
199
|
+
padding: ${space(3)} ${space(4)};
|
|
200
|
+
border: ${t.borderThin} solid ${t.rule};
|
|
201
|
+
border-radius: ${t.radiusXl};
|
|
202
|
+
background: ${t.surfaceCard};
|
|
203
|
+
}
|
|
204
|
+
tbody tr.chosen {
|
|
205
|
+
background: ${t.brandSubtle};
|
|
206
|
+
}
|
|
207
|
+
tr.chosen > * {
|
|
208
|
+
background: none;
|
|
209
|
+
}
|
|
210
|
+
tbody th, tbody td {
|
|
211
|
+
display: grid;
|
|
212
|
+
grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr);
|
|
213
|
+
gap: ${space(3)};
|
|
214
|
+
padding: ${space(1.5)} 0;
|
|
215
|
+
border: 0;
|
|
216
|
+
text-align: start;
|
|
217
|
+
white-space: normal;
|
|
218
|
+
}
|
|
219
|
+
tbody td.numeric {
|
|
220
|
+
text-align: start;
|
|
221
|
+
}
|
|
222
|
+
tbody .pick {
|
|
223
|
+
display: block;
|
|
224
|
+
position: absolute;
|
|
225
|
+
inset-block-start: ${space(1)};
|
|
226
|
+
inset-inline-end: ${space(1)};
|
|
227
|
+
inline-size: auto;
|
|
228
|
+
padding: 0;
|
|
229
|
+
}
|
|
230
|
+
tbody tr:has(.pick) > th {
|
|
231
|
+
padding-inline-end: ${space(10)};
|
|
232
|
+
}
|
|
233
|
+
.label {
|
|
234
|
+
display: block;
|
|
235
|
+
font-size: ${fontSize("sm")};
|
|
236
|
+
font-weight: ${fontWeight("semibold")};
|
|
237
|
+
color: ${t.textMuted};
|
|
238
|
+
}
|
|
239
|
+
.empty {
|
|
240
|
+
display: block;
|
|
241
|
+
border: 0;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
`
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
keyOf(row, index) {
|
|
248
|
+
const key = row?.[this.rowKey];
|
|
249
|
+
return key === void 0 || key === null || key === "" ? String(index) : String(key);
|
|
250
|
+
}
|
|
251
|
+
/** The rows in the order they are drawn: as given, or sorted by the chosen column. */
|
|
252
|
+
ordered() {
|
|
253
|
+
const rows = (this.rows ?? []).map((row, i) => ({ row, key: this.keyOf(row, i) }));
|
|
254
|
+
const column = (this.columns ?? []).find((c) => c.key === this.sortKey && c.sortable);
|
|
255
|
+
if (!column || this.manualSort) return rows;
|
|
256
|
+
const way = this.sortDirection === "descending" ? -1 : 1;
|
|
257
|
+
const locale = pageLocale(this);
|
|
258
|
+
const figure = (v) => Number(String(v ?? "").replace(/[^\d.-]/g, "")) || 0;
|
|
259
|
+
return rows.sort((a, b) => {
|
|
260
|
+
const x = a.row[column.key] ?? "";
|
|
261
|
+
const y = b.row[column.key] ?? "";
|
|
262
|
+
const order = column.numeric ? figure(x) - figure(y) : String(x).localeCompare(String(y), locale, { numeric: true, sensitivity: "base" });
|
|
263
|
+
return order * way;
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
sortBy(key) {
|
|
267
|
+
const direction = this.sortKey === key && this.sortDirection === "ascending" ? "descending" : "ascending";
|
|
268
|
+
this.sortKey = key;
|
|
269
|
+
this.sortDirection = direction;
|
|
270
|
+
this.dispatchEvent(new CustomEvent("impkt-sort", { detail: { key, direction }, bubbles: true, composed: true }));
|
|
271
|
+
}
|
|
272
|
+
choose(keys, on) {
|
|
273
|
+
const now = new Set(this.selected ?? []);
|
|
274
|
+
for (const key of keys) {
|
|
275
|
+
if (on) now.add(key);
|
|
276
|
+
else now.delete(key);
|
|
277
|
+
}
|
|
278
|
+
this.selected = [...now];
|
|
279
|
+
this.dispatchEvent(new CustomEvent("impkt-selection", { detail: { selected: this.selected }, bubbles: true, composed: true }));
|
|
280
|
+
}
|
|
281
|
+
heading(c) {
|
|
282
|
+
const sorted = c.sortable && c.key === this.sortKey;
|
|
283
|
+
const classes = [c.numeric ? "numeric" : "", c.sortable ? "sortable" : ""].filter(Boolean).join(" ");
|
|
284
|
+
if (!c.sortable) return html`<th scope="col" role="columnheader" class=${classes}>${c.label}</th>`;
|
|
285
|
+
return html`<th scope="col" role="columnheader" class=${classes} aria-sort=${sorted ? this.sortDirection : nothing}>
|
|
286
|
+
<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>
|
|
287
|
+
</th>`;
|
|
288
|
+
}
|
|
289
|
+
render() {
|
|
290
|
+
const columns = this.columns ?? [];
|
|
291
|
+
const rows = this.ordered();
|
|
292
|
+
const chosen = new Set(this.selected ?? []);
|
|
293
|
+
const every = rows.length > 0 && rows.every((r) => chosen.has(r.key));
|
|
294
|
+
const some = !every && rows.some((r) => chosen.has(r.key));
|
|
295
|
+
return html`
|
|
296
|
+
<div class="scroller" part="scroller" tabindex="0" role="region" aria-label=${this.caption || nothing}>
|
|
297
|
+
<table part="table" role="table">
|
|
298
|
+
${this.caption ? html`<caption part="caption">${this.caption}</caption>` : nothing}
|
|
299
|
+
<thead role="rowgroup">
|
|
300
|
+
<tr role="row">
|
|
301
|
+
${this.selectable ? html`<th scope="col" role="columnheader" class="pick"><label><input type="checkbox" aria-label=${this.selectAllText} .checked=${every} .indeterminate=${some} ?disabled=${!rows.length}
|
|
302
|
+
@change=${(e) => this.choose(rows.map((r) => r.key), e.target.checked)} /></label></th>` : nothing}
|
|
303
|
+
${columns.map((c) => this.heading(c))}
|
|
304
|
+
</tr>
|
|
305
|
+
</thead>
|
|
306
|
+
<tbody role="rowgroup">
|
|
307
|
+
${rows.length ? rows.map(({ row, key }, i) => html`
|
|
308
|
+
<tr role="row" class=${chosen.has(key) ? "chosen" : ""} part="row">
|
|
309
|
+
${this.selectable ? 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)}
|
|
310
|
+
@change=${(e) => this.choose([key], e.target.checked)} /></label></td>` : nothing}
|
|
311
|
+
${columns.map((c, j) => {
|
|
312
|
+
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>`;
|
|
313
|
+
return j === 0 ? html`<th scope="row" role="rowheader" id=${`${this.uid}-r${i}`}>${value}</th>` : html`<td role="cell" class=${c.numeric ? "numeric" : ""}>${value}</td>`;
|
|
314
|
+
})}
|
|
315
|
+
</tr>
|
|
316
|
+
`) : 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>`}
|
|
317
|
+
</tbody>
|
|
318
|
+
</table>
|
|
319
|
+
</div>
|
|
320
|
+
`;
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
customElements.define("impkt-table", ImpktTable);
|
|
324
|
+
|
|
325
|
+
export {
|
|
326
|
+
ImpktTable
|
|
327
|
+
};
|
|
328
|
+
//# sourceMappingURL=chunk-FVCM4WHD.js.map
|