@f-ewald/components 1.40.0 → 1.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +6 -0
  2. package/custom-elements.json +170 -6
  3. package/dist/breadcrumb-nav.d.ts +20 -2
  4. package/dist/breadcrumb-nav.d.ts.map +1 -1
  5. package/dist/breadcrumb-nav.js +53 -7
  6. package/dist/breadcrumb-nav.js.map +1 -1
  7. package/dist/button-group.d.ts.map +1 -1
  8. package/dist/button-group.js +9 -2
  9. package/dist/button-group.js.map +1 -1
  10. package/dist/confirm-dialog.d.ts.map +1 -1
  11. package/dist/confirm-dialog.js +11 -3
  12. package/dist/confirm-dialog.js.map +1 -1
  13. package/dist/empty-state.d.ts +16 -0
  14. package/dist/empty-state.d.ts.map +1 -1
  15. package/dist/empty-state.js +39 -8
  16. package/dist/empty-state.js.map +1 -1
  17. package/dist/pagination-nav.d.ts.map +1 -1
  18. package/dist/pagination-nav.js +9 -2
  19. package/dist/pagination-nav.js.map +1 -1
  20. package/dist/radio-cards.d.ts.map +1 -1
  21. package/dist/radio-cards.js +9 -2
  22. package/dist/radio-cards.js.map +1 -1
  23. package/dist/skip-link.d.ts +10 -2
  24. package/dist/skip-link.d.ts.map +1 -1
  25. package/dist/skip-link.js +55 -7
  26. package/dist/skip-link.js.map +1 -1
  27. package/dist/spec-list.d.ts +17 -8
  28. package/dist/spec-list.d.ts.map +1 -1
  29. package/dist/spec-list.js +103 -45
  30. package/dist/spec-list.js.map +1 -1
  31. package/dist/tokens.css +1 -1
  32. package/dist/tokens.d.ts.map +1 -1
  33. package/dist/tokens.js +8 -4
  34. package/dist/tokens.js.map +1 -1
  35. package/dist/ui-button.d.ts.map +1 -1
  36. package/dist/ui-button.js +15 -3
  37. package/dist/ui-button.js.map +1 -1
  38. package/dist/vote-control.d.ts.map +1 -1
  39. package/dist/vote-control.js +9 -2
  40. package/dist/vote-control.js.map +1 -1
  41. package/docs/breadcrumb-nav.md +1 -1
  42. package/docs/button-group.md +1 -0
  43. package/docs/design-language.md +21 -0
  44. package/docs/empty-state.md +6 -1
  45. package/docs/pagination-nav.md +1 -0
  46. package/docs/skip-link.md +10 -3
  47. package/docs/spec-list.md +18 -10
  48. package/docs/ui-button.md +1 -0
  49. package/llms.txt +26 -15
  50. package/package.json +1 -1
@@ -141,7 +141,11 @@ let ConfirmDialog = class ConfirmDialog extends LitElement {
141
141
  line-height: var(--ui-line-height-tight, 1.25);
142
142
  }
143
143
  .btn-cancel {
144
- background: var(--ui-button-secondary-background, none);
144
+ /* Opaque base under the transparent-by-default secondary token, the
145
+ same as ui-button's secondary variant — see the comment there. */
146
+ background:
147
+ var(--ui-button-secondary-background, none),
148
+ var(--ui-surface, #ffffff);
145
149
  border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));
146
150
  color: var(--ui-text, #0f172a);
147
151
  border-radius: var(--ui-radius-sm, 0.25rem);
@@ -151,11 +155,15 @@ let ConfirmDialog = class ConfirmDialog extends LitElement {
151
155
  box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
152
156
  }
153
157
  .btn-cancel:hover:not(:disabled) {
154
- background: var(--ui-button-secondary-background-hover, none);
158
+ background:
159
+ var(--ui-button-secondary-background-hover, none),
160
+ var(--ui-surface, #ffffff);
155
161
  border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));
156
162
  }
157
163
  .btn-cancel:active:not(:disabled) {
158
- background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));
164
+ background:
165
+ var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),
166
+ var(--ui-surface, #ffffff);
159
167
  box-shadow: none;
160
168
  }
161
169
  .btn-danger,
@@ -1 +1 @@
1
- {"version":3,"file":"confirm-dialog.js","sourceRoot":"","sources":["../src/confirm-dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,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I,EAAE,CAAC;2CAA0B;AA1M3C,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA6TzB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n activateLayer,\n claimEscape,\n deactivateLayer,\n isTopLayer,\n} from \"./utils/layer-stack.js\";\n\n/**\n * Reusable confirmation dialog: overlay + centered card with a slotted body,\n * an optional error line, and Cancel/Confirm actions. Instant `display:none`\n * → `display:flex` toggle (no transitions). Fires `confirm`/`cancel`\n * (bubbling, composed) instead of owning any deletion logic itself —\n * callers stay in charge of the request. Set `size=\"sm\"` for compact\n * actions one step below the default, matching `ui-button`'s `sm` size.\n *\n * @element confirm-dialog\n * @fires confirm - User clicked the confirm button.\n * @fires cancel - User clicked the cancel button.\n */\n@customElement(\"confirm-dialog\")\nexport class ConfirmDialog extends LitElement {\n static override styles = [\n tokens,\n css`\n .overlay {\n position: fixed;\n inset: 0;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n z-index: var(--component-layer-z, 50);\n display: none;\n align-items: flex-start;\n justify-content: center;\n padding: 10vh 1.25rem 1.25rem;\n box-sizing: border-box;\n }\n .overlay.open {\n display: flex;\n }\n .dialog {\n background: var(--ui-surface, #ffffff);\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n width: 100%;\n max-width: min(25rem, calc(100vw - 2rem));\n padding: 1rem;\n box-sizing: border-box;\n outline: none;\n }\n .dialog-text {\n margin: 0 0 1rem;\n color: var(--ui-text, #0f172a);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n }\n .dialog-actions {\n display: flex;\n justify-content: flex-end;\n gap: 0.5rem;\n }\n .btn-cancel,\n .btn-danger,\n .btn-primary {\n height: 2rem;\n box-sizing: border-box;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .btn-cancel {\n background: var(--ui-button-secondary-background, none);\n border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n color: var(--ui-text, #0f172a);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 1rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n cursor: pointer;\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn-cancel:hover:not(:disabled) {\n background: var(--ui-button-secondary-background-hover, none);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n .btn-cancel:active:not(:disabled) {\n background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));\n box-shadow: none;\n }\n .btn-danger,\n .btn-primary {\n border: var(--ui-border-width, 1px) solid transparent;\n border-radius: var(--ui-radius-sm, 0.25rem);\n /* The border width is themeable, so it has to stay inside the fixed\n height the sm size sets below. */\n box-sizing: border-box;\n padding: 0.5rem 1rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n }\n .btn-danger {\n background: var(--ui-button-danger-background, var(--ui-danger, #dc2626));\n border-color: var(--ui-button-danger-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn-danger:hover:not(:disabled) {\n background: var(--ui-button-danger-background-hover, var(--ui-danger-hover, #b91c1c));\n }\n .btn-danger:active:not(:disabled) {\n background: var(--ui-button-danger-background-active, var(--ui-button-danger-background, var(--ui-danger, #dc2626)));\n box-shadow: none;\n }\n .btn-primary {\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn-primary:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n .btn-primary:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n button:disabled {\n opacity: 0.6;\n cursor: default;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .btn-primary:focus-visible:not(:active),\n .btn-danger:focus-visible:not(:active),\n .btn-cancel:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n :host([size=\"sm\"]) .btn-cancel,\n :host([size=\"sm\"]) .btn-danger,\n :host([size=\"sm\"]) .btn-primary {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .error-text {\n color: var(--ui-danger, #dc2626);\n font-size: var(--ui-font-size-sm, 0.75rem);\n margin: 0.5rem 0 0.75rem;\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spin {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .overlay {\n padding: 0.75rem;\n overflow-y: auto;\n }\n .dialog {\n padding: 0.75rem;\n }\n }\n `,\n ];\n\n /** Whether the dialog is visible. */\n @property({ type: Boolean }) open = false;\n /** Label for the confirm button. */\n @property({ attribute: \"confirm-label\" }) confirmLabel = \"Delete\";\n /** Label for the cancel button. */\n @property({ attribute: \"cancel-label\" }) cancelLabel = \"Cancel\";\n /** Danger (red) vs. primary (indigo) styling for the confirm button. */\n @property({ type: Boolean }) danger = true;\n /** Shows a spinner and disables both buttons while a request is in flight. */\n @property({ type: Boolean }) busy = false;\n /** Inline error line shown below the body, or null for none. */\n @property() error: string | null = null;\n /** Size — `sm` reduces both action buttons' height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n private _previousFocus: HTMLElement | null = null;\n\n private _confirm() {\n this.dispatchEvent(new CustomEvent(\"confirm\", { bubbles: true, composed: true }));\n }\n\n private _cancel() {\n this.dispatchEvent(new CustomEvent(\"cancel\", { bubbles: true, composed: true }));\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const selector =\n \"a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])\";\n const slotted = Array.from(this.querySelectorAll<HTMLElement>(selector));\n const internal = Array.from(\n this.shadowRoot?.querySelectorAll<HTMLElement>(selector) ?? [],\n ).filter((element) => element.closest(\".dialog\") !== null);\n return [...slotted, ...internal].filter((element) => !element.hasAttribute(\"hidden\"));\n }\n\n private _focusInitial(): void {\n const autofocus = this.querySelector<HTMLElement>(\"[autofocus]\");\n const cancel = this.shadowRoot?.querySelector<HTMLElement>(\".btn-cancel:not(:disabled)\");\n const dialog = this.shadowRoot?.querySelector<HTMLElement>(\".dialog\");\n (autofocus ?? cancel ?? this._getFocusableElements()[0] ?? dialog)?.focus();\n }\n\n private _onDocumentFocusIn = (event: FocusEvent): void => {\n if (!this.open || !isTopLayer(this) || event.composedPath().includes(this)) return;\n this._focusInitial();\n };\n\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (!this.open || !isTopLayer(this)) return;\n if (claimEscape(this, event) && !this.busy) {\n this._cancel();\n return;\n }\n if (event.key !== \"Tab\") return;\n\n const focusable = this._getFocusableElements();\n if (focusable.length === 0) {\n event.preventDefault();\n this._focusInitial();\n return;\n }\n const active = (this.shadowRoot?.activeElement ?? document.activeElement) as HTMLElement | null;\n const index = focusable.indexOf(active as HTMLElement);\n if (event.shiftKey && index <= 0) {\n event.preventDefault();\n focusable.at(-1)?.focus();\n } else if (!event.shiftKey && index === focusable.length - 1) {\n event.preventDefault();\n focusable[0]?.focus();\n }\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n this._previousFocus = document.activeElement as HTMLElement | null;\n document.addEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.addEventListener(\"keydown\", this._onWindowKeydown, true);\n this._focusInitial();\n return;\n }\n deactivateLayer(this);\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n deactivateLayer(this);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n this.open = false;\n }\n\n override render() {\n const accessibleName = this.getAttribute(\"aria-label\") ?? \"Confirmation\";\n return html`\n <div class=\"overlay ${this.open ? \"open\" : \"\"}\">\n <div\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=${accessibleName}\n aria-describedby=${this.error ? \"dialog-text dialog-error\" : \"dialog-text\"}\n tabindex=\"-1\"\n >\n <p id=\"dialog-text\" class=\"dialog-text\"><slot></slot></p>\n ${this.error\n ? html`<p id=\"dialog-error\" class=\"error-text\" role=\"alert\">${this.error}</p>`\n : nothing}\n <div class=\"dialog-actions\">\n <button class=\"btn-cancel\" ?disabled=${this.busy} @click=${this._cancel}>${this.cancelLabel}</button>\n <button class=${this.danger ? \"btn-danger\" : \"btn-primary\"} ?disabled=${this.busy} @click=${this._confirm}>\n ${this.busy\n ? html`<span class=\"spin\" aria-hidden=\"true\">${iconArrowPath(14)}</span>`\n : nothing}\n ${this.confirmLabel}\n </button>\n </div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"confirm-dialog\": ConfirmDialog;\n }\n}\n"]}
1
+ {"version":3,"file":"confirm-dialog.js","sourceRoot":"","sources":["../src/confirm-dialog.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,UAAU,GACX,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAqML,qCAAqC;QACR,SAAI,GAAG,KAAK,CAAC;QAC1C,oCAAoC;QACM,iBAAY,GAAG,QAAQ,CAAC;QAClE,mCAAmC;QACM,gBAAW,GAAG,QAAQ,CAAC;QAChE,wEAAwE;QAC3C,WAAM,GAAG,IAAI,CAAC;QAC3C,8EAA8E;QACjD,SAAI,GAAG,KAAK,CAAC;QAC1C,gEAAgE;QACpD,UAAK,GAAkB,IAAI,CAAC;QACxC,oGAAoG;QACvE,SAAI,GAAgB,IAAI,CAAC;QAE9C,m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AAE,CAAC,SAAS;YACzE,CAAC,CAAC,OAAO;gBACT,IAAI,CAAC,YAAY;;;;;KAK5B,CAAC;IACJ,CAAC;CACF,CAAA;AA/H8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAc;AAEA;IAAzC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;mDAAyB;AAEzB;IAAxC,QAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;kDAAwB;AAEnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAe;AAEd;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAc;AAE9B;IAAX,QAAQ,EAAE;4CAA6B;AAEX;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;2CAA0B;AAlN3C,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAqUzB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n activateLayer,\n claimEscape,\n deactivateLayer,\n isTopLayer,\n} from \"./utils/layer-stack.js\";\n\n/**\n * Reusable confirmation dialog: overlay + centered card with a slotted body,\n * an optional error line, and Cancel/Confirm actions. Instant `display:none`\n * → `display:flex` toggle (no transitions). Fires `confirm`/`cancel`\n * (bubbling, composed) instead of owning any deletion logic itself —\n * callers stay in charge of the request. Set `size=\"sm\"` for compact\n * actions one step below the default, matching `ui-button`'s `sm` size.\n *\n * @element confirm-dialog\n * @fires confirm - User clicked the confirm button.\n * @fires cancel - User clicked the cancel button.\n */\n@customElement(\"confirm-dialog\")\nexport class ConfirmDialog extends LitElement {\n static override styles = [\n tokens,\n css`\n .overlay {\n position: fixed;\n inset: 0;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n z-index: var(--component-layer-z, 50);\n display: none;\n align-items: flex-start;\n justify-content: center;\n padding: 10vh 1.25rem 1.25rem;\n box-sizing: border-box;\n }\n .overlay.open {\n display: flex;\n }\n .dialog {\n background: var(--ui-surface, #ffffff);\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n width: 100%;\n max-width: min(25rem, calc(100vw - 2rem));\n padding: 1rem;\n box-sizing: border-box;\n outline: none;\n }\n .dialog-text {\n margin: 0 0 1rem;\n color: var(--ui-text, #0f172a);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n }\n .dialog-actions {\n display: flex;\n justify-content: flex-end;\n gap: 0.5rem;\n }\n .btn-cancel,\n .btn-danger,\n .btn-primary {\n height: 2rem;\n box-sizing: border-box;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n line-height: var(--ui-line-height-tight, 1.25);\n }\n .btn-cancel {\n /* Opaque base under the transparent-by-default secondary token, the\n same as ui-button's secondary variant — see the comment there. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n color: var(--ui-text, #0f172a);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 1rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n cursor: pointer;\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn-cancel:hover:not(:disabled) {\n background:\n var(--ui-button-secondary-background-hover, none),\n var(--ui-surface, #ffffff);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n .btn-cancel:active:not(:disabled) {\n background:\n var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),\n var(--ui-surface, #ffffff);\n box-shadow: none;\n }\n .btn-danger,\n .btn-primary {\n border: var(--ui-border-width, 1px) solid transparent;\n border-radius: var(--ui-radius-sm, 0.25rem);\n /* The border width is themeable, so it has to stay inside the fixed\n height the sm size sets below. */\n box-sizing: border-box;\n padding: 0.5rem 1rem;\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n cursor: pointer;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n }\n .btn-danger {\n background: var(--ui-button-danger-background, var(--ui-danger, #dc2626));\n border-color: var(--ui-button-danger-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn-danger:hover:not(:disabled) {\n background: var(--ui-button-danger-background-hover, var(--ui-danger-hover, #b91c1c));\n }\n .btn-danger:active:not(:disabled) {\n background: var(--ui-button-danger-background-active, var(--ui-button-danger-background, var(--ui-danger, #dc2626)));\n box-shadow: none;\n }\n .btn-primary {\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border-color: var(--ui-button-border, transparent);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n .btn-primary:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n .btn-primary:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n button:disabled {\n opacity: 0.6;\n cursor: default;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .btn-primary:focus-visible:not(:active),\n .btn-danger:focus-visible:not(:active),\n .btn-cancel:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n :host([size=\"sm\"]) .btn-cancel,\n :host([size=\"sm\"]) .btn-danger,\n :host([size=\"sm\"]) .btn-primary {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .error-text {\n color: var(--ui-danger, #dc2626);\n font-size: var(--ui-font-size-sm, 0.75rem);\n margin: 0.5rem 0 0.75rem;\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n @keyframes spin {\n to {\n transform: rotate(360deg);\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .spin {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n @media (max-width: 48rem) {\n .overlay {\n padding: 0.75rem;\n overflow-y: auto;\n }\n .dialog {\n padding: 0.75rem;\n }\n }\n `,\n ];\n\n /** Whether the dialog is visible. */\n @property({ type: Boolean }) open = false;\n /** Label for the confirm button. */\n @property({ attribute: \"confirm-label\" }) confirmLabel = \"Delete\";\n /** Label for the cancel button. */\n @property({ attribute: \"cancel-label\" }) cancelLabel = \"Cancel\";\n /** Danger (red) vs. primary (indigo) styling for the confirm button. */\n @property({ type: Boolean }) danger = true;\n /** Shows a spinner and disables both buttons while a request is in flight. */\n @property({ type: Boolean }) busy = false;\n /** Inline error line shown below the body, or null for none. */\n @property() error: string | null = null;\n /** Size — `sm` reduces both action buttons' height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n private _previousFocus: HTMLElement | null = null;\n\n private _confirm() {\n this.dispatchEvent(new CustomEvent(\"confirm\", { bubbles: true, composed: true }));\n }\n\n private _cancel() {\n this.dispatchEvent(new CustomEvent(\"cancel\", { bubbles: true, composed: true }));\n }\n\n private _getFocusableElements(): HTMLElement[] {\n const selector =\n \"a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex='-1'])\";\n const slotted = Array.from(this.querySelectorAll<HTMLElement>(selector));\n const internal = Array.from(\n this.shadowRoot?.querySelectorAll<HTMLElement>(selector) ?? [],\n ).filter((element) => element.closest(\".dialog\") !== null);\n return [...slotted, ...internal].filter((element) => !element.hasAttribute(\"hidden\"));\n }\n\n private _focusInitial(): void {\n const autofocus = this.querySelector<HTMLElement>(\"[autofocus]\");\n const cancel = this.shadowRoot?.querySelector<HTMLElement>(\".btn-cancel:not(:disabled)\");\n const dialog = this.shadowRoot?.querySelector<HTMLElement>(\".dialog\");\n (autofocus ?? cancel ?? this._getFocusableElements()[0] ?? dialog)?.focus();\n }\n\n private _onDocumentFocusIn = (event: FocusEvent): void => {\n if (!this.open || !isTopLayer(this) || event.composedPath().includes(this)) return;\n this._focusInitial();\n };\n\n private _onWindowKeydown = (event: KeyboardEvent): void => {\n if (!this.open || !isTopLayer(this)) return;\n if (claimEscape(this, event) && !this.busy) {\n this._cancel();\n return;\n }\n if (event.key !== \"Tab\") return;\n\n const focusable = this._getFocusableElements();\n if (focusable.length === 0) {\n event.preventDefault();\n this._focusInitial();\n return;\n }\n const active = (this.shadowRoot?.activeElement ?? document.activeElement) as HTMLElement | null;\n const index = focusable.indexOf(active as HTMLElement);\n if (event.shiftKey && index <= 0) {\n event.preventDefault();\n focusable.at(-1)?.focus();\n } else if (!event.shiftKey && index === focusable.length - 1) {\n event.preventDefault();\n focusable[0]?.focus();\n }\n };\n\n protected override updated(changed: PropertyValues): void {\n if (!changed.has(\"open\")) return;\n if (this.open) {\n activateLayer(this);\n this._previousFocus = document.activeElement as HTMLElement | null;\n document.addEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.addEventListener(\"keydown\", this._onWindowKeydown, true);\n this._focusInitial();\n return;\n }\n deactivateLayer(this);\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n document.removeEventListener(\"focusin\", this._onDocumentFocusIn, true);\n window.removeEventListener(\"keydown\", this._onWindowKeydown, true);\n deactivateLayer(this);\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n this.open = false;\n }\n\n override render() {\n const accessibleName = this.getAttribute(\"aria-label\") ?? \"Confirmation\";\n return html`\n <div class=\"overlay ${this.open ? \"open\" : \"\"}\">\n <div\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=${accessibleName}\n aria-describedby=${this.error ? \"dialog-text dialog-error\" : \"dialog-text\"}\n tabindex=\"-1\"\n >\n <p id=\"dialog-text\" class=\"dialog-text\"><slot></slot></p>\n ${this.error\n ? html`<p id=\"dialog-error\" class=\"error-text\" role=\"alert\">${this.error}</p>`\n : nothing}\n <div class=\"dialog-actions\">\n <button class=\"btn-cancel\" ?disabled=${this.busy} @click=${this._cancel}>${this.cancelLabel}</button>\n <button class=${this.danger ? \"btn-danger\" : \"btn-primary\"} ?disabled=${this.busy} @click=${this._confirm}>\n ${this.busy\n ? html`<span class=\"spin\" aria-hidden=\"true\">${iconArrowPath(14)}</span>`\n : nothing}\n ${this.confirmLabel}\n </button>\n </div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"confirm-dialog\": ConfirmDialog;\n }\n}\n"]}
@@ -13,12 +13,21 @@ import { LitElement } from "lit";
13
13
  * @slot actions - Optional call to action, e.g. a `ui-button`.
14
14
  */
15
15
  export declare class EmptyState extends LitElement {
16
+ #private;
16
17
  /** The primary line. */
17
18
  heading: string;
18
19
  /** The supporting line under the heading. Omitted entirely when empty. */
19
20
  description: string;
20
21
  /** `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. */
21
22
  size: "sm" | "md";
23
+ /**
24
+ * Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a
25
+ * page, a panel, or a sidebar, so no single rank is right everywhere; set
26
+ * this to whatever the surrounding outline needs. Applied via `aria-level`
27
+ * on the rendered `h2`, which overrides the element's native rank for
28
+ * assistive technology.
29
+ */
30
+ headingLevel: number;
22
31
  /** Whether the icon slot currently has assigned content. */
23
32
  private _hasIcon;
24
33
  /** Whether the default (body) slot currently has assigned content. */
@@ -26,6 +35,13 @@ export declare class EmptyState extends LitElement {
26
35
  /** Whether the actions slot currently has assigned content. */
27
36
  private _hasActions;
28
37
  static styles: import("lit").CSSResult[];
38
+ /**
39
+ * Whether a slot holds real content. Whitespace-only text nodes don't count:
40
+ * ordinary indented markup puts a newline between every child, which would
41
+ * otherwise mark every slot as filled and reserve space for rows that are
42
+ * visually empty.
43
+ */
44
+ private static _slotHasContent;
29
45
  /** Tracks whether the icon slot has content so its row can collapse when empty. */
30
46
  private _onIconSlotChange;
31
47
  /** Tracks whether the default body slot has content so its row can collapse when empty. */
@@ -1 +1 @@
1
- {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../src/empty-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;;;;GAYG;AACH,qBACa,UAAW,SAAQ,UAAU;IACxC,wBAAwB;IACZ,OAAO,SAAM;IAEzB,0EAA0E;IAC9D,WAAW,SAAM;IAE7B,uHAAuH;IAC1F,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEtD,4DAA4D;IACnD,OAAO,CAAC,QAAQ,CAAS;IAElC,sEAAsE;IAC7D,OAAO,CAAC,QAAQ,CAAS;IAElC,+DAA+D;IACtD,OAAO,CAAC,WAAW,CAAS;IAErC,OAAgB,MAAM,4BA6EpB;IAEF,mFAAmF;IACnF,OAAO,CAAC,iBAAiB;IAKzB,2FAA2F;IAC3F,OAAO,CAAC,iBAAiB;IAKzB,sFAAsF;IACtF,OAAO,CAAC,oBAAoB;IAKnB,MAAM,yCAgBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../src/empty-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;;;;GAYG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,wBAAwB;IACZ,OAAO,SAAM;IAEzB,0EAA0E;IAC9D,WAAW,SAAM;IAE7B,uHAAuH;IAC1F,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEtD;;;;;;OAMG;IACqD,YAAY,SAAK;IAEzE,4DAA4D;IACnD,OAAO,CAAC,QAAQ,CAAS;IAElC,sEAAsE;IAC7D,OAAO,CAAC,QAAQ,CAAS;IAElC,+DAA+D;IACtD,OAAO,CAAC,WAAW,CAAS;IAErC,OAAgB,MAAM,4BA6EpB;IAEF;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAO9B,mFAAmF;IACnF,OAAO,CAAC,iBAAiB;IAIzB,2FAA2F;IAC3F,OAAO,CAAC,iBAAiB;IAIzB,sFAAsF;IACtF,OAAO,CAAC,oBAAoB;IAWnB,MAAM,yCAkBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -4,6 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var EmptyState_1;
7
8
  import { LitElement, css, html, nothing } from "lit";
8
9
  import { customElement, property, state } from "lit/decorators.js";
9
10
  import { tokens } from "./tokens.js";
@@ -29,6 +30,14 @@ let EmptyState = class EmptyState extends LitElement {
29
30
  this.description = "";
30
31
  /** `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. */
31
32
  this.size = "md";
33
+ /**
34
+ * Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a
35
+ * page, a panel, or a sidebar, so no single rank is right everywhere; set
36
+ * this to whatever the surrounding outline needs. Applied via `aria-level`
37
+ * on the rendered `h2`, which overrides the element's native rank for
38
+ * assistive technology.
39
+ */
40
+ this.headingLevel = 2;
32
41
  /** Whether the icon slot currently has assigned content. */
33
42
  this._hasIcon = false;
34
43
  /** Whether the default (body) slot currently has assigned content. */
@@ -36,6 +45,7 @@ let EmptyState = class EmptyState extends LitElement {
36
45
  /** Whether the actions slot currently has assigned content. */
37
46
  this._hasActions = false;
38
47
  }
48
+ static { EmptyState_1 = this; }
39
49
  static { this.styles = [
40
50
  tokens,
41
51
  css `
@@ -114,20 +124,36 @@ let EmptyState = class EmptyState extends LitElement {
114
124
  }
115
125
  `,
116
126
  ]; }
127
+ /**
128
+ * Whether a slot holds real content. Whitespace-only text nodes don't count:
129
+ * ordinary indented markup puts a newline between every child, which would
130
+ * otherwise mark every slot as filled and reserve space for rows that are
131
+ * visually empty.
132
+ */
133
+ static _slotHasContent(event) {
134
+ const slot = event.target;
135
+ return slot
136
+ .assignedNodes({ flatten: true })
137
+ .some((node) => node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? "").trim().length > 0);
138
+ }
117
139
  /** Tracks whether the icon slot has content so its row can collapse when empty. */
118
140
  _onIconSlotChange(event) {
119
- const slot = event.target;
120
- this._hasIcon = slot.assignedNodes({ flatten: true }).length > 0;
141
+ this._hasIcon = EmptyState_1._slotHasContent(event);
121
142
  }
122
143
  /** Tracks whether the default body slot has content so its row can collapse when empty. */
123
144
  _onBodySlotChange(event) {
124
- const slot = event.target;
125
- this._hasBody = slot.assignedNodes({ flatten: true }).length > 0;
145
+ this._hasBody = EmptyState_1._slotHasContent(event);
126
146
  }
127
147
  /** Tracks whether the actions slot has content so its row can collapse when empty. */
128
148
  _onActionsSlotChange(event) {
129
- const slot = event.target;
130
- this._hasActions = slot.assignedNodes({ flatten: true }).length > 0;
149
+ this._hasActions = EmptyState_1._slotHasContent(event);
150
+ }
151
+ /** Clamps `headingLevel` into the valid 1-6 heading range, falling back to 2 for a non-numeric value. */
152
+ #level() {
153
+ const level = Math.trunc(Number(this.headingLevel));
154
+ if (!Number.isFinite(level))
155
+ return 2;
156
+ return Math.min(6, Math.max(1, level));
131
157
  }
132
158
  render() {
133
159
  return html `
@@ -135,7 +161,9 @@ let EmptyState = class EmptyState extends LitElement {
135
161
  <span class="icon ${this._hasIcon ? "" : "empty"}">
136
162
  <slot name="icon" @slotchange=${this._onIconSlotChange}></slot>
137
163
  </span>
138
- ${this.heading ? html `<h2 class="heading">${this.heading}</h2>` : nothing}
164
+ ${this.heading
165
+ ? html `<h2 class="heading" aria-level=${this.#level()}>${this.heading}</h2>`
166
+ : nothing}
139
167
  ${this.description ? html `<p class="description">${this.description}</p>` : nothing}
140
168
  <div class="body ${this._hasBody ? "" : "empty"}">
141
169
  <slot @slotchange=${this._onBodySlotChange}></slot>
@@ -156,6 +184,9 @@ __decorate([
156
184
  __decorate([
157
185
  property({ reflect: true })
158
186
  ], EmptyState.prototype, "size", void 0);
187
+ __decorate([
188
+ property({ type: Number, attribute: "heading-level" })
189
+ ], EmptyState.prototype, "headingLevel", void 0);
159
190
  __decorate([
160
191
  state()
161
192
  ], EmptyState.prototype, "_hasIcon", void 0);
@@ -165,7 +196,7 @@ __decorate([
165
196
  __decorate([
166
197
  state()
167
198
  ], EmptyState.prototype, "_hasActions", void 0);
168
- EmptyState = __decorate([
199
+ EmptyState = EmptyState_1 = __decorate([
169
200
  customElement("empty-state")
170
201
  ], EmptyState);
171
202
  export { EmptyState };
@@ -1 +1 @@
1
- {"version":3,"file":"empty-state.js","sourceRoot":"","sources":["../src/empty-state.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;GAYG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,wBAAwB;QACZ,YAAO,GAAG,EAAE,CAAC;QAEzB,0EAA0E;QAC9D,gBAAW,GAAG,EAAE,CAAC;QAE7B,uHAAuH;QAC1F,SAAI,GAAgB,IAAI,CAAC;QAEtD,4DAA4D;QAC3C,aAAQ,GAAG,KAAK,CAAC;QAElC,sEAAsE;QACrD,aAAQ,GAAG,KAAK,CAAC;QAElC,+DAA+D;QAC9C,gBAAW,GAAG,KAAK,CAAC;IAoHvC,CAAC;aAlHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0EF;KACF,AA7EqB,CA6EpB;IAEF,mFAAmF;IAC3E,iBAAiB,CAAC,KAAY;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAyB,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACnE,CAAC;IAED,2FAA2F;IACnF,iBAAiB,CAAC,KAAY;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAyB,CAAC;QAC7C,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,aAAa,CAAC;GAChB,UAAU,CAqItB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A centered placeholder for an empty list, an empty panel, or a zero-result\n * search: an optional leading glyph, a heading, a supporting line (or richer\n * slotted body), and an optional call-to-action row. Purely presentational —\n * it carries no interactive state of its own and no ARIA `role`; it is a\n * region of content, not a live status. Every optional part collapses\n * completely when absent, reserving no layout space.\n *\n * @element empty-state\n * @slot icon - Optional leading glyph. The consumer supplies it (e.g. an inline SVG icon).\n * @slot - Optional rich body content, an alternative to `description`.\n * @slot actions - Optional call to action, e.g. a `ui-button`.\n */\n@customElement(\"empty-state\")\nexport class EmptyState extends LitElement {\n /** The primary line. */\n @property() heading = \"\";\n\n /** The supporting line under the heading. Omitted entirely when empty. */\n @property() description = \"\";\n\n /** `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n /** Whether the icon slot currently has assigned content. */\n @state() private _hasIcon = false;\n\n /** Whether the default (body) slot currently has assigned content. */\n @state() private _hasBody = false;\n\n /** Whether the actions slot currently has assigned content. */\n @state() private _hasActions = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .state {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: 2rem 1rem;\n }\n :host([size=\"sm\"]) .state {\n padding: 1rem 0.75rem;\n }\n .icon {\n display: inline-flex;\n margin-bottom: 0.75rem;\n color: var(--ui-text-muted, #64748b);\n }\n :host([size=\"sm\"]) .icon {\n margin-bottom: 0.5rem;\n }\n .heading {\n margin: 0;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n :host([size=\"sm\"]) .heading {\n font-size: var(--ui-font-size, 0.875rem);\n }\n .description {\n margin: 0.5rem 0 0;\n max-width: 32rem;\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n :host([size=\"sm\"]) .description {\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .body {\n margin-top: 0.5rem;\n color: var(--ui-text-muted, #64748b);\n }\n .body.empty {\n display: none;\n }\n .actions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n margin-top: 1rem;\n }\n .actions.empty {\n display: none;\n }\n .icon.empty {\n display: none;\n }\n `,\n ];\n\n /** Tracks whether the icon slot has content so its row can collapse when empty. */\n private _onIconSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasIcon = slot.assignedNodes({ flatten: true }).length > 0;\n }\n\n /** Tracks whether the default body slot has content so its row can collapse when empty. */\n private _onBodySlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasBody = slot.assignedNodes({ flatten: true }).length > 0;\n }\n\n /** Tracks whether the actions slot has content so its row can collapse when empty. */\n private _onActionsSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._hasActions = slot.assignedNodes({ flatten: true }).length > 0;\n }\n\n override render() {\n return html`\n <div class=\"state\">\n <span class=\"icon ${this._hasIcon ? \"\" : \"empty\"}\">\n <slot name=\"icon\" @slotchange=${this._onIconSlotChange}></slot>\n </span>\n ${this.heading ? html`<h2 class=\"heading\">${this.heading}</h2>` : nothing}\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n <div class=\"body ${this._hasBody ? \"\" : \"empty\"}\">\n <slot @slotchange=${this._onBodySlotChange}></slot>\n </div>\n <div class=\"actions ${this._hasActions ? \"\" : \"empty\"}\">\n <slot name=\"actions\" @slotchange=${this._onActionsSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"empty-state\": EmptyState;\n }\n}\n"]}
1
+ {"version":3,"file":"empty-state.js","sourceRoot":"","sources":["../src/empty-state.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;GAYG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QACL,wBAAwB;QACZ,YAAO,GAAG,EAAE,CAAC;QAEzB,0EAA0E;QAC9D,gBAAW,GAAG,EAAE,CAAC;QAE7B,uHAAuH;QAC1F,SAAI,GAAgB,IAAI,CAAC;QAEtD;;;;;;WAMG;QACqD,iBAAY,GAAG,CAAC,CAAC;QAEzE,4DAA4D;QAC3C,aAAQ,GAAG,KAAK,CAAC;QAElC,sEAAsE;QACrD,aAAQ,GAAG,KAAK,CAAC;QAElC,+DAA+D;QAC9C,gBAAW,GAAG,KAAK,CAAC;IAuIvC,CAAC;;aArIiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0EF;KACF,AA7EqB,CA6EpB;IAEF;;;;;OAKG;IACK,MAAM,CAAC,eAAe,CAAC,KAAY;QACzC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAyB,CAAC;QAC7C,OAAO,IAAI;aACR,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;aAChC,IAAI,CAAC,CA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,CAAC,CAAC,CAAC,OAAO;2BAChE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;8BACzB,IAAI,CAAC,iBAAiB;;8BAEtB,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO;6CAChB,IAAI,CAAC,oBAAoB;;;KAGjE,CAAC;IACJ,CAAC;CACF,CAAA;AA/Ja;IAAX,QAAQ,EAAE;2CAAc;AAGb;IAAX,QAAQ,EAAE;+CAAkB;AAGA;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wCAA0B;AASE;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;gDAAkB;AAGxD;IAAhB,KAAK,EAAE;4CAA0B;AAGjB;IAAhB,KAAK,EAAE;4CAA0B;AAGjB;IAAhB,KAAK,EAAE;+CAA6B;AA1B1B,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAiKtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A centered placeholder for an empty list, an empty panel, or a zero-result\n * search: an optional leading glyph, a heading, a supporting line (or richer\n * slotted body), and an optional call-to-action row. Purely presentational —\n * it carries no interactive state of its own and no ARIA `role`; it is a\n * region of content, not a live status. Every optional part collapses\n * completely when absent, reserving no layout space.\n *\n * @element empty-state\n * @slot icon - Optional leading glyph. The consumer supplies it (e.g. an inline SVG icon).\n * @slot - Optional rich body content, an alternative to `description`.\n * @slot actions - Optional call to action, e.g. a `ui-button`.\n */\n@customElement(\"empty-state\")\nexport class EmptyState extends LitElement {\n /** The primary line. */\n @property() heading = \"\";\n\n /** The supporting line under the heading. Omitted entirely when empty. */\n @property() description = \"\";\n\n /** `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n /**\n * Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a\n * page, a panel, or a sidebar, so no single rank is right everywhere; set\n * this to whatever the surrounding outline needs. Applied via `aria-level`\n * on the rendered `h2`, which overrides the element's native rank for\n * assistive technology.\n */\n @property({ type: Number, attribute: \"heading-level\" }) headingLevel = 2;\n\n /** Whether the icon slot currently has assigned content. */\n @state() private _hasIcon = false;\n\n /** Whether the default (body) slot currently has assigned content. */\n @state() private _hasBody = false;\n\n /** Whether the actions slot currently has assigned content. */\n @state() private _hasActions = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .state {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: 2rem 1rem;\n }\n :host([size=\"sm\"]) .state {\n padding: 1rem 0.75rem;\n }\n .icon {\n display: inline-flex;\n margin-bottom: 0.75rem;\n color: var(--ui-text-muted, #64748b);\n }\n :host([size=\"sm\"]) .icon {\n margin-bottom: 0.5rem;\n }\n .heading {\n margin: 0;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n :host([size=\"sm\"]) .heading {\n font-size: var(--ui-font-size, 0.875rem);\n }\n .description {\n margin: 0.5rem 0 0;\n max-width: 32rem;\n font-size: var(--ui-font-size, 0.875rem);\n font-weight: var(--ui-font-weight-regular, 400);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text-muted, #64748b);\n }\n :host([size=\"sm\"]) .description {\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .body {\n margin-top: 0.5rem;\n color: var(--ui-text-muted, #64748b);\n }\n .body.empty {\n display: none;\n }\n .actions {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n margin-top: 1rem;\n }\n .actions.empty {\n display: none;\n }\n .icon.empty {\n display: none;\n }\n `,\n ];\n\n /**\n * Whether a slot holds real content. Whitespace-only text nodes don't count:\n * ordinary indented markup puts a newline between every child, which would\n * otherwise mark every slot as filled and reserve space for rows that are\n * visually empty.\n */\n private static _slotHasContent(event: Event): boolean {\n const slot = event.target as HTMLSlotElement;\n return slot\n .assignedNodes({ flatten: true })\n .some((node) => node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? \"\").trim().length > 0);\n }\n\n /** Tracks whether the icon slot has content so its row can collapse when empty. */\n private _onIconSlotChange(event: Event): void {\n this._hasIcon = EmptyState._slotHasContent(event);\n }\n\n /** Tracks whether the default body slot has content so its row can collapse when empty. */\n private _onBodySlotChange(event: Event): void {\n this._hasBody = EmptyState._slotHasContent(event);\n }\n\n /** Tracks whether the actions slot has content so its row can collapse when empty. */\n private _onActionsSlotChange(event: Event): void {\n this._hasActions = EmptyState._slotHasContent(event);\n }\n\n /** Clamps `headingLevel` into the valid 1-6 heading range, falling back to 2 for a non-numeric value. */\n #level(): number {\n const level = Math.trunc(Number(this.headingLevel));\n if (!Number.isFinite(level)) return 2;\n return Math.min(6, Math.max(1, level));\n }\n\n override render() {\n return html`\n <div class=\"state\">\n <span class=\"icon ${this._hasIcon ? \"\" : \"empty\"}\">\n <slot name=\"icon\" @slotchange=${this._onIconSlotChange}></slot>\n </span>\n ${this.heading\n ? html`<h2 class=\"heading\" aria-level=${this.#level()}>${this.heading}</h2>`\n : nothing}\n ${this.description ? html`<p class=\"description\">${this.description}</p>` : nothing}\n <div class=\"body ${this._hasBody ? \"\" : \"empty\"}\">\n <slot @slotchange=${this._onBodySlotChange}></slot>\n </div>\n <div class=\"actions ${this._hasActions ? \"\" : \"empty\"}\">\n <slot name=\"actions\" @slotchange=${this._onActionsSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"empty-state\": EmptyState;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"pagination-nav.d.ts","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,gCAAgC;IACuB,WAAW,SAAK;IACvE,6CAA6C;IACS,UAAU,SAAK;IAErE,OAAgB,MAAM,4BA6EpB;IAEF,uFAAuF;IACvF,OAAO,CAAC,GAAG;IAaF,MAAM,yCAsBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
1
+ {"version":3,"file":"pagination-nav.d.ts","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,+FAA+F;AAC/F,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,aAAc,SAAQ,UAAU;IAC3C,gCAAgC;IACuB,WAAW,SAAK;IACvE,6CAA6C;IACS,UAAU,SAAK;IAErE,OAAgB,MAAM,4BAoFpB;IAEF,uFAAuF;IACvF,OAAO,CAAC,GAAG;IAaF,MAAM,yCAsBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,aAAa,CAAC;KACjC;CACF"}
@@ -62,7 +62,12 @@ let PaginationNav = class PaginationNav extends LitElement {
62
62
  width: 2rem;
63
63
  height: 2rem;
64
64
  padding: 0;
65
- background: var(--ui-button-secondary-background, none);
65
+ /* Opaque base under the transparent-by-default secondary token — a
66
+ pager button is a solid control, not a window onto the page behind
67
+ it. See ui-button's secondary variant. */
68
+ background:
69
+ var(--ui-button-secondary-background, none),
70
+ var(--ui-surface, #ffffff);
66
71
  border: var(--ui-border-width, 1px) solid
67
72
  var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));
68
73
  border-radius: var(--ui-radius-sm, 0.25rem);
@@ -77,7 +82,9 @@ let PaginationNav = class PaginationNav extends LitElement {
77
82
  border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));
78
83
  }
79
84
  button:active:not(:disabled) {
80
- background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));
85
+ background:
86
+ var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),
87
+ var(--ui-surface, #ffffff);
81
88
  box-shadow: none;
82
89
  }
83
90
  button:disabled {
@@ -1 +1 @@
1
- {"version":3,"file":"pagination-nav.js","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACL,gCAAgC;QACuB,gBAAW,GAAG,CAAC,CAAC;QACvE,6CAA6C;QACS,eAAU,GAAG,CAAC,CAAC;IAsHvE,CAAC;aApHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACJ,CAAC;CACF,CAAA;AAxHwD;IAAtD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;kDAAiB;AAEjB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;iDAAgB;AAJ1D,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CA0HzB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the user requests a different page. `detail.page` is the 1-based target page. */\nexport interface PageChangeDetail {\n page: number;\n}\n\n/**\n * Minimal, controlled pager for list/table views: a previous/next control pair\n * around a \"Page N of M\" status. It owns no data — the consumer sets\n * `current-page` / `total-pages` and moves the page in response to the\n * `page-change` event (typically alongside its own data fetch), exactly like\n * `data-table` leaves the row data to the caller.\n *\n * Previous is disabled on the first page and next on the last; neither fires an\n * event when there is nowhere to go.\n *\n * The prev/next buttons are treated as `ui-button`'s `secondary` variant:\n * they read the same shared `--ui-button-secondary-*`/`--ui-button-highlight`\n * tokens (and `--ui-button-secondary-surface-muted` for hover, since — like\n * `button-group`'s unchecked segments — they already paint\n * `--ui-surface-muted` on hover by default), so a gradient theme applies\n * consistently here too.\n *\n * @element pagination-nav\n * @fires page-change - The user picked a new page (`detail: { page }`).\n */\n@customElement(\"pagination-nav\")\nexport class PaginationNav extends LitElement {\n /** The 1-based current page. */\n @property({ type: Number, attribute: \"current-page\" }) currentPage = 1;\n /** The total number of pages (minimum 1). */\n @property({ type: Number, attribute: \"total-pages\" }) totalPages = 1;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: var(--ui-button-secondary-background, none);\n border: var(--ui-border-width, 1px) solid\n var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n border-radius: var(--ui-radius-sm, 0.25rem);\n /* The border is themeable, so it has to stay inside the 2rem target. */\n box-sizing: border-box;\n color: var(--ui-text, #0f172a);\n cursor: pointer;\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n button:hover:not(:disabled) {\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n button:active:not(:disabled) {\n background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));\n box-shadow: none;\n }\n button:disabled {\n opacity: 0.5;\n cursor: default;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n button:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .status {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: var(--ui-numeric, normal);\n min-width: 6rem;\n text-align: center;\n }\n @media (forced-colors: active) {\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button:disabled {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Clamps `page` to the valid range and fires `page-change` when it actually moves. */\n private _go(page: number): void {\n const total = Math.max(1, Math.floor(this.totalPages));\n const target = Math.min(total, Math.max(1, Math.floor(page)));\n if (target === this.currentPage) return;\n this.dispatchEvent(\n new CustomEvent<PageChangeDetail>(\"page-change\", {\n detail: { page: target },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n const total = Math.max(1, Math.floor(this.totalPages));\n const current = Math.min(total, Math.max(1, Math.floor(this.currentPage)));\n return html`\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n ?disabled=${current <= 1}\n @click=${() => this._go(current - 1)}\n >\n ${iconChevronLeft(18)}\n </button>\n <span class=\"status\" aria-live=\"polite\">Page ${current} of ${total}</span>\n <button\n type=\"button\"\n aria-label=\"Next page\"\n ?disabled=${current >= total}\n @click=${() => this._go(current + 1)}\n >\n ${iconChevronRight(18)}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pagination-nav\": PaginationNav;\n }\n}\n"]}
1
+ {"version":3,"file":"pagination-nav.js","sourceRoot":"","sources":["../src/pagination-nav.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QACL,gCAAgC;QACuB,gBAAW,GAAG,CAAC,CAAC;QACvE,6CAA6C;QACS,eAAU,GAAG,CAAC,CAAC;IA6HvE,CAAC;aA3HiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiFF;KACF,AApFqB,CAoFpB;IAEF,uFAAuF;IAC/E,GAAG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,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;kDAAiB;AAEjB;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;iDAAgB;AAJ1D,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAiIzB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconChevronLeft, iconChevronRight } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the user requests a different page. `detail.page` is the 1-based target page. */\nexport interface PageChangeDetail {\n page: number;\n}\n\n/**\n * Minimal, controlled pager for list/table views: a previous/next control pair\n * around a \"Page N of M\" status. It owns no data — the consumer sets\n * `current-page` / `total-pages` and moves the page in response to the\n * `page-change` event (typically alongside its own data fetch), exactly like\n * `data-table` leaves the row data to the caller.\n *\n * Previous is disabled on the first page and next on the last; neither fires an\n * event when there is nowhere to go.\n *\n * The prev/next buttons are treated as `ui-button`'s `secondary` variant:\n * they read the same shared `--ui-button-secondary-*`/`--ui-button-highlight`\n * tokens (and `--ui-button-secondary-surface-muted` for hover, since — like\n * `button-group`'s unchecked segments — they already paint\n * `--ui-surface-muted` on hover by default), so a gradient theme applies\n * consistently here too.\n *\n * @element pagination-nav\n * @fires page-change - The user picked a new page (`detail: { page }`).\n */\n@customElement(\"pagination-nav\")\nexport class PaginationNav extends LitElement {\n /** The 1-based current page. */\n @property({ type: Number, attribute: \"current-page\" }) currentPage = 1;\n /** The total number of pages (minimum 1). */\n @property({ type: Number, attribute: \"total-pages\" }) totalPages = 1;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n /* Opaque base under the transparent-by-default secondary token — a\n pager button is a solid control, not a window onto the page behind\n it. See ui-button's secondary variant. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid\n var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n border-radius: var(--ui-radius-sm, 0.25rem);\n /* The border is themeable, so it has to stay inside the 2rem target. */\n box-sizing: border-box;\n color: var(--ui-text, #0f172a);\n cursor: pointer;\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n button:hover:not(:disabled) {\n background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n button:active:not(:disabled) {\n background:\n var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),\n var(--ui-surface, #ffffff);\n box-shadow: none;\n }\n button:disabled {\n opacity: 0.5;\n cursor: default;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n button:focus-visible:not(:active) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .status {\n font-size: var(--ui-font-size-sm, 0.75rem);\n font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: var(--ui-numeric, normal);\n min-width: 6rem;\n text-align: center;\n }\n @media (forced-colors: active) {\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button:disabled {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Clamps `page` to the valid range and fires `page-change` when it actually moves. */\n private _go(page: number): void {\n const total = Math.max(1, Math.floor(this.totalPages));\n const target = Math.min(total, Math.max(1, Math.floor(page)));\n if (target === this.currentPage) return;\n this.dispatchEvent(\n new CustomEvent<PageChangeDetail>(\"page-change\", {\n detail: { page: target },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n const total = Math.max(1, Math.floor(this.totalPages));\n const current = Math.min(total, Math.max(1, Math.floor(this.currentPage)));\n return html`\n <button\n type=\"button\"\n aria-label=\"Previous page\"\n ?disabled=${current <= 1}\n @click=${() => this._go(current - 1)}\n >\n ${iconChevronLeft(18)}\n </button>\n <span class=\"status\" aria-live=\"polite\">Page ${current} of ${total}</span>\n <button\n type=\"button\"\n aria-label=\"Next page\"\n ?disabled=${current >= total}\n @click=${() => this._go(current + 1)}\n >\n ${iconChevronRight(18)}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"pagination-nav\": PaginationNav;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAMrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BA4IpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAC9C;;;;;;OAMG;IACS,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,CAAW;IAClE,2FAA2F;IACrC,SAAS,UAAS;IAIxE,OAAO,CAAC,SAAS;IAMR,MAAM,yCAyBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAMrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BAmJpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAC9C;;;;;;OAMG;IACS,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,OAAO,CAAW;IAClE,2FAA2F;IACrC,SAAS,UAAS;IAIxE,OAAO,CAAC,SAAS;IAMR,MAAM,yCAyBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -99,7 +99,12 @@ let RadioCards = class RadioCards extends LitElement {
99
99
  align-items: flex-start;
100
100
  gap: 0.5rem;
101
101
  box-sizing: border-box;
102
- background: var(--ui-button-secondary-background, none);
102
+ /* Opaque base under the transparent-by-default secondary token, so an
103
+ unchecked card is a solid card rather than a bordered hole in the
104
+ page. See ui-button's secondary variant. */
105
+ background:
106
+ var(--ui-button-secondary-background, none),
107
+ var(--ui-surface, #ffffff);
103
108
  border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));
104
109
  border-radius: var(--ui-radius-sm, 0.25rem);
105
110
  padding: 0.5rem 0.75rem;
@@ -120,7 +125,9 @@ let RadioCards = class RadioCards extends LitElement {
120
125
  resting/hover gradient tokens), so a gradient theme applies here the
121
126
  same way it does to every button — a card is not a special case. */
122
127
  .card:hover:not(:has(input:disabled)):not(:has(input:checked)) {
123
- background: var(--ui-button-secondary-background-hover, none);
128
+ background:
129
+ var(--ui-button-secondary-background-hover, none),
130
+ var(--ui-surface, #ffffff);
124
131
  border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));
125
132
  }
126
133
  /* Same single muted-surface variable as button-group/pagination-nav,
@@ -1 +1 @@
1
- {"version":3,"file":"radio-cards.js","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAUrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QA+IL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAC9C;;;;;;WAMG;QACS,WAAM,GAAwC,OAAO,CAAC;QAClE,2FAA2F;QACrC,cAAS,GAAG,KAAK,CAAC;QAE/D,UAAK,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC;IAkCpD,CAAC;aAjMiB,WA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,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;WAGjG,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAlDiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AAQlC;IAAX,QAAQ,EAAE;0CAAuD;AAEZ;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CAAmB;AA9J7D,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAkMtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioCardOption {\n value: string;\n label: string;\n description?: string;\n /** In `layout=\"mixed\"`, forces this card onto its own full-width row. */\n fullWidth?: boolean;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of full-width cards, each with a label and optional\n * description — for a handful of meaningfully different choices where the\n * description matters. For many short, same-shaped options (a color swatch,\n * a basemap style), use `radio-pills` instead. Wraps native radio inputs for\n * keyboard/a11y and fires `change` rather than relying on form submission.\n *\n * An unchecked card is treated as `ui-button`'s secondary variant: it reads\n * the same `--ui-button-secondary-background`/`-hover` and\n * `-border`/`-hover` tokens, so a gradient theme applies to a card exactly\n * like it does to any button. The selected card's border/radio dot instead\n * read `--ui-button-accent` (a solid stand-in, since `border-color`/\n * `accent-color` can't render a gradient), and its background reads the\n * shared `--ui-button-secondary-surface-muted` plus `--ui-button-highlight`,\n * so a gradient theme tints it consistently with `button-group`/\n * `pagination-nav`'s equivalents. That shared value is tuned for small\n * controls, so a card — with far more area — blends it 45% toward\n * `--ui-surface` rather than taking a second token: the tint stays the same\n * hue and gradient, just lighter on light themes (and correspondingly\n * deeper on dark ones) than on a button.\n *\n * `layout` controls how cards flow (\"mixed\" wraps with per-option\n * `fullWidth` rows, \"vertical\" stacks one per row, \"horizontal\" stays\n * side-by-side at every width). `hideInput` visually hides the radio dot via\n * the same `sr-only` clip pattern as `ui-checkbox` — the native input stays\n * in the DOM for keyboard/a11y, and the card's own border/tint carries the\n * selected state instead.\n *\n * @element radio-cards\n * @fires change - A card was selected; detail: { value }.\n */\n@customElement(\"radio-cards\")\nexport class RadioCards extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n gap: 0.5rem;\n }\n .options.mixed {\n flex-wrap: wrap;\n }\n .options.mixed .card {\n flex: 1 1 11.25rem;\n }\n .options.mixed .card.full {\n flex: 1 0 100%;\n }\n .options.vertical {\n flex-direction: column;\n }\n .options.vertical .card {\n flex: 0 0 auto;\n }\n .options.horizontal {\n flex-wrap: nowrap;\n }\n .options.horizontal .card {\n flex: 1 1 0;\n min-width: 0;\n }\n .card {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n box-sizing: border-box;\n background: var(--ui-button-secondary-background, none);\n border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n /* Unchecked cards are treated as ui-button's secondary variant (same\n resting/hover gradient tokens), so a gradient theme applies here the\n same way it does to every button — a card is not a special case. */\n .card:hover:not(:has(input:disabled)):not(:has(input:checked)) {\n background: var(--ui-button-secondary-background-hover, none);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n /* Same single muted-surface variable as button-group/pagination-nav,\n but blended toward the card's own surface: that value is tuned for a\n small control, and across a card's much larger area it reads too\n heavy. Mixing with --ui-surface (rather than plain white) keeps the\n adjustment theme-correct — it lightens on light themes and deepens\n on dark ones. Written with the background shorthand (not\n background-image) so it stays valid whether the variable resolves to\n a gradient or a flat color. */\n .card:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background:\n linear-gradient(\n color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent),\n color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent)\n ),\n var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card input {\n width: 1rem;\n height: 1rem;\n margin-top: 0.25rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n }\n .card-label {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-text, #0f172a);\n }\n .card-description {\n display: block;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n }\n .card:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .card:has(input:checked):has(input:focus-visible) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .card:has(input:disabled) input {\n cursor: not-allowed;\n }\n .card input.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (forced-colors: active) {\n .card:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .card:has(input:checked) {\n border-color: Highlight;\n }\n .card:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n .card:has(input:disabled) .card-label,\n .card:has(input:disabled) .card-description {\n color: GrayText;\n }\n }\n `,\n ];\n\n /** Options to render, one card each. */\n @property({ attribute: false }) options: RadioCardOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n /**\n * How the cards flow.\n * - \"mixed\" (default): cards wrap onto as many rows as fit; options marked\n * `fullWidth` take a row of their own.\n * - \"vertical\": one full-width card per row, never side by side.\n * - \"horizontal\": every card on one row, equal widths, no wrapping.\n */\n @property() layout: \"vertical\" | \"horizontal\" | \"mixed\" = \"mixed\";\n /** Visually hides the radio dot; the card's own border/tint carries the selected state. */\n @property({ type: Boolean, attribute: \"hide-input\" }) hideInput = false;\n\n readonly #name = `radio-cards-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options ${this.layout}\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=${classMap({ card: true, full: this.layout === \"mixed\" && !!opt.fullWidth })}>\n <input\n type=\"radio\"\n class=${classMap({ \"sr-only\": this.hideInput })}\n name=${this.#name}\n .checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>\n <span class=\"card-label\">${opt.label}</span>\n ${opt.description ? html`<span class=\"card-description\">${opt.description}</span>` : nothing}\n </span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-cards\": RadioCards;\n }\n}\n"]}
1
+ {"version":3,"file":"radio-cards.js","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAA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AC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;4BACa,IAAI,CAAC,MAAM;UAC7B,MAAM,CACN,IAAI,CAAC,OAAO,EACZ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAClB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;2BACI,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;;;wBAG7E,QAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;uBACxC,IAAI,CAAC,KAAK;2BACN,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK;4BACvB,IAAI,CAAC,QAAQ;0BACf,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;;;2CAGd,GAAG,CAAC,KAAK;kBAClC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,kCAAkC,GAAG,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;WAGjG,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAlDiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AAQlC;IAAX,QAAQ,EAAE;0CAAuD;AAEZ;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CAAmB;AArK7D,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAyMtB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioCardOption {\n value: string;\n label: string;\n description?: string;\n /** In `layout=\"mixed\"`, forces this card onto its own full-width row. */\n fullWidth?: boolean;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of full-width cards, each with a label and optional\n * description — for a handful of meaningfully different choices where the\n * description matters. For many short, same-shaped options (a color swatch,\n * a basemap style), use `radio-pills` instead. Wraps native radio inputs for\n * keyboard/a11y and fires `change` rather than relying on form submission.\n *\n * An unchecked card is treated as `ui-button`'s secondary variant: it reads\n * the same `--ui-button-secondary-background`/`-hover` and\n * `-border`/`-hover` tokens, so a gradient theme applies to a card exactly\n * like it does to any button. The selected card's border/radio dot instead\n * read `--ui-button-accent` (a solid stand-in, since `border-color`/\n * `accent-color` can't render a gradient), and its background reads the\n * shared `--ui-button-secondary-surface-muted` plus `--ui-button-highlight`,\n * so a gradient theme tints it consistently with `button-group`/\n * `pagination-nav`'s equivalents. That shared value is tuned for small\n * controls, so a card — with far more area — blends it 45% toward\n * `--ui-surface` rather than taking a second token: the tint stays the same\n * hue and gradient, just lighter on light themes (and correspondingly\n * deeper on dark ones) than on a button.\n *\n * `layout` controls how cards flow (\"mixed\" wraps with per-option\n * `fullWidth` rows, \"vertical\" stacks one per row, \"horizontal\" stays\n * side-by-side at every width). `hideInput` visually hides the radio dot via\n * the same `sr-only` clip pattern as `ui-checkbox` — the native input stays\n * in the DOM for keyboard/a11y, and the card's own border/tint carries the\n * selected state instead.\n *\n * @element radio-cards\n * @fires change - A card was selected; detail: { value }.\n */\n@customElement(\"radio-cards\")\nexport class RadioCards extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n gap: 0.5rem;\n }\n .options.mixed {\n flex-wrap: wrap;\n }\n .options.mixed .card {\n flex: 1 1 11.25rem;\n }\n .options.mixed .card.full {\n flex: 1 0 100%;\n }\n .options.vertical {\n flex-direction: column;\n }\n .options.vertical .card {\n flex: 0 0 auto;\n }\n .options.horizontal {\n flex-wrap: nowrap;\n }\n .options.horizontal .card {\n flex: 1 1 0;\n min-width: 0;\n }\n .card {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n box-sizing: border-box;\n /* Opaque base under the transparent-by-default secondary token, so an\n unchecked card is a solid card rather than a bordered hole in the\n page. See ui-button's secondary variant. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 0.75rem;\n cursor: pointer;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n }\n /* Unchecked cards are treated as ui-button's secondary variant (same\n resting/hover gradient tokens), so a gradient theme applies here the\n same way it does to every button — a card is not a special case. */\n .card:hover:not(:has(input:disabled)):not(:has(input:checked)) {\n background:\n var(--ui-button-secondary-background-hover, none),\n var(--ui-surface, #ffffff);\n border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));\n }\n /* Same single muted-surface variable as button-group/pagination-nav,\n but blended toward the card's own surface: that value is tuned for a\n small control, and across a card's much larger area it reads too\n heavy. Mixing with --ui-surface (rather than plain white) keeps the\n adjustment theme-correct — it lightens on light themes and deepens\n on dark ones. Written with the background shorthand (not\n background-image) so it stays valid whether the variable resolves to\n a gradient or a flat color. */\n .card:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background:\n linear-gradient(\n color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent),\n color-mix(in srgb, var(--ui-surface, #ffffff) 45%, transparent)\n ),\n var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card input {\n width: 1rem;\n height: 1rem;\n margin-top: 0.25rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n }\n .card-label {\n font-weight: var(--ui-font-weight-semibold, 600);\n color: var(--ui-text, #0f172a);\n }\n .card-description {\n display: block;\n color: var(--ui-text-muted, #64748b);\n font-weight: var(--ui-font-weight-regular, 400);\n }\n .card:has(input:focus-visible) {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .card:has(input:checked):has(input:focus-visible) {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35)), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .card:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .card:has(input:disabled) input {\n cursor: not-allowed;\n }\n .card input.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n @media (forced-colors: active) {\n .card:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .card:has(input:checked) {\n border-color: Highlight;\n }\n .card:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n .card:has(input:disabled) .card-label,\n .card:has(input:disabled) .card-description {\n color: GrayText;\n }\n }\n `,\n ];\n\n /** Options to render, one card each. */\n @property({ attribute: false }) options: RadioCardOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n /**\n * How the cards flow.\n * - \"mixed\" (default): cards wrap onto as many rows as fit; options marked\n * `fullWidth` take a row of their own.\n * - \"vertical\": one full-width card per row, never side by side.\n * - \"horizontal\": every card on one row, equal widths, no wrapping.\n */\n @property() layout: \"vertical\" | \"horizontal\" | \"mixed\" = \"mixed\";\n /** Visually hides the radio dot; the card's own border/tint carries the selected state. */\n @property({ type: Boolean, attribute: \"hide-input\" }) hideInput = false;\n\n readonly #name = `radio-cards-${++instanceCount}`;\n\n private _onChange(value: string) {\n if (this.disabled) return;\n this.value = value;\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <div class=\"options ${this.layout}\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=${classMap({ card: true, full: this.layout === \"mixed\" && !!opt.fullWidth })}>\n <input\n type=\"radio\"\n class=${classMap({ \"sr-only\": this.hideInput })}\n name=${this.#name}\n .checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>\n <span class=\"card-label\">${opt.label}</span>\n ${opt.description ? html`<span class=\"card-description\">${opt.description}</span>` : nothing}\n </span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-cards\": RadioCards;\n }\n}\n"]}
@@ -5,8 +5,13 @@ import { LitElement } from "lit";
5
5
  * visually hidden (but in the focus order) until it receives keyboard focus,
6
6
  * then pins itself to the top-left of the viewport as a solid, high-contrast
7
7
  * block so a keyboard or screen-reader user can jump straight past repeated
8
- * page chrome to the main content. It needs no JavaScript beyond the element
9
- * upgrade — the anchor's native in-page navigation does the rest.
8
+ * page chrome to the main content.
9
+ *
10
+ * Activating it moves focus into the target as well as scrolling to it: a
11
+ * plain fragment link only moves focus when the target is already focusable,
12
+ * so this applies `tabindex="-1"` to the target on demand rather than making
13
+ * every consumer remember to. Native navigation is never prevented, so the
14
+ * hash still updates.
10
15
  *
11
16
  * Place it as the very first focusable element on the page, before the app
12
17
  * chrome, and point `href` at the `id` of the main content region.
@@ -15,11 +20,14 @@ import { LitElement } from "lit";
15
20
  * @slot - Optional custom link wording, overriding `label`.
16
21
  */
17
22
  export declare class SkipLink extends LitElement {
23
+ #private;
18
24
  static styles: import("lit").CSSResult[];
19
25
  /** The in-page target the link jumps to (the `id` of the main content region). */
20
26
  href: string;
21
27
  /** Fallback link wording used when nothing is slotted. */
22
28
  label: string;
29
+ /** Whether the default slot holds real wording, as opposed to the whitespace ordinary formatting leaves behind. */
30
+ private _hasSlotted;
23
31
  render(): import("lit-html").TemplateResult<1>;
24
32
  }
25
33
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"skip-link.d.ts","sourceRoot":"","sources":["../src/skip-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;;;;;;;;;GAcG;AACH,qBACa,QAAS,SAAQ,UAAU;IACtC,OAAgB,MAAM,4BAwFpB;IAEF,kFAAkF;IACtE,IAAI,SAAW;IAE3B,0DAA0D;IAC9C,KAAK,SAA0B;IAElC,MAAM,yCAEd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"skip-link.d.ts","sourceRoot":"","sources":["../src/skip-link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBACa,QAAS,SAAQ,UAAU;;IACtC,OAAgB,MAAM,4BA+FpB;IAEF,kFAAkF;IACtE,IAAI,SAAW;IAE3B,0DAA0D;IAC9C,KAAK,SAA0B;IAE3C,mHAAmH;IAC1G,OAAO,CAAC,WAAW,CAAS;IA8B5B,MAAM,yCAId;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}