@f-ewald/components 1.40.1 → 1.40.3

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.
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0EF;KACF,AA7EqB,CA6EpB;IAEF,uFAAuF;IAC/E,GAAG,CAAC,IAAY;QACtB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9D,IAAI,MAAM,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO;QACxC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAmB,aAAa,EAAE;YAC/C,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACxB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;IAEQ,MAAM;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAA;;;;oBAIK,OAAO,IAAI,CAAC;iBACf,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,eAAe,CAAC,EAAE,CAAC;;qDAEwB,OAAO,OAAO,KAAK;;;;oBAIpD,OAAO,IAAI,KAAK;iBACnB,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,gBAAgB,CAAC,EAAE,CAAC;;KAEzB,CAAC;IACJ,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 HTML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AAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;IAEQ,MAAM;QACb,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QACvD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAA;;;;oBAIK,OAAO,IAAI,CAAC;iBACf,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,eAAe,CAAC,EAAE,CAAC;;qDAEwB,OAAO,OAAO,KAAK;;;;oBAIpD,OAAO,IAAI,KAAK;iBACnB,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC;;UAElC,gBAAgB,CAAC,EAAE,CAAC;;KAEzB,CAAC;IACJ,CAAC;CACF,CAAA;AA/HwD;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,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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MtB","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,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;;QAsJL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAA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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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"radio-pills.d.ts","sourceRoot":"","sources":["../src/radio-pills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BA4EpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAqBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
1
+ {"version":3,"file":"radio-pills.d.ts","sourceRoot":"","sources":["../src/radio-pills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BA+EpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAqBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
@@ -56,6 +56,9 @@ let RadioPills = class RadioPills extends LitElement {
56
56
  padding: 0.25rem 0.5rem;
57
57
  border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
58
58
  border-radius: var(--ui-radius-pill, 9999px);
59
+ /* An unchecked pill only gained a background when checked, so it was
60
+ see-through over anything but a plain --ui-surface page. */
61
+ background: var(--ui-surface, #ffffff);
59
62
  cursor: pointer;
60
63
  font-family: var(
61
64
  --ui-font,
@@ -1 +1 @@
1
- {"version":3,"file":"radio-pills.js","sourceRoot":"","sources":["../src/radio-pills.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,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QA+EL,wCAAwC;QACR,YAAO,GAAsB,EAAE,CAAC;QAChE,gCAAgC;QACpB,UAAK,GAAG,EAAE,CAAC;QACvB,gDAAgD;QACnB,aAAQ,GAAG,KAAK,CAAC;QAErC,UAAK,GAAG,eAAe,EAAE,aAAa,EAAE,CAAC;IA8BpD,CAAC;aAnHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyEF;KACF,AA5EqB,CA4EpB;IASO,KAAK,CAAoC;IAE1C,SAAS,CAAC,KAAa;QAC7B,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACtG,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;UAEL,MAAM,CACN,IAAI,CAAC,OAAO,EACZ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,EAClB,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAA;;;;uBAIA,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;;sBAEnC,GAAG,CAAC,KAAK;;WAEpB,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AApCiC;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;AApFnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAoHtB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioPillOption {\n value: string;\n label: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of compact pill-shaped options — for many short,\n * same-shaped choices (a basemap style, a unit toggle). For a handful of\n * choices where a description matters, use `radio-cards` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission.\n *\n * The selected pill's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents.\n *\n * @element radio-pills\n * @fires change - A pill was selected; detail: { value }.\n */\n@customElement(\"radio-pills\")\nexport class RadioPills extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n }\n .pill {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-pill, 9999px);\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 line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .pill:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background: 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 .pill input {\n width: 1rem;\n height: 1rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n margin: 0;\n }\n .pill: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 .pill: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 .pill:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .pill:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .pill:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .pill:has(input:checked) {\n border-color: Highlight;\n }\n .pill:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Options to render, one pill each. */\n @property({ attribute: false }) options: RadioPillOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-pills-${++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\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"pill\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>${opt.label}</span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-pills\": RadioPills;\n }\n}\n"]}
1
+ {"version":3,"file":"radio-pills.js","sourceRoot":"","sources":["../src/radio-pills.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,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAOrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UA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;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AAvFnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAuHtB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport interface RadioPillOption {\n value: string;\n label: string;\n}\n\nlet instanceCount = 0;\n\n/**\n * Single-select group of compact pill-shaped options — for many short,\n * same-shaped choices (a basemap style, a unit toggle). For a handful of\n * choices where a description matters, use `radio-cards` instead. Wraps\n * native radio inputs for keyboard/a11y and fires `change` rather than\n * relying on form submission.\n *\n * The selected pill's border/radio dot read `--ui-button-accent` (a solid\n * stand-in, since `border-color`/`accent-color` can't render a gradient),\n * and its background reads the shared `--ui-button-secondary-surface-muted`\n * plus `--ui-button-highlight`, so a gradient theme tints it consistently\n * with `button-group`/`pagination-nav`'s equivalents.\n *\n * @element radio-pills\n * @fires change - A pill was selected; detail: { value }.\n */\n@customElement(\"radio-pills\")\nexport class RadioPills extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .options {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n }\n .pill {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: 2rem;\n box-sizing: border-box;\n padding: 0.25rem 0.5rem;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-pill, 9999px);\n /* An unchecked pill only gained a background when checked, so it was\n see-through over anything but a plain --ui-surface page. */\n background: var(--ui-surface, #ffffff);\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 line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n }\n .pill:has(input:checked) {\n border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n background: 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 .pill input {\n width: 1rem;\n height: 1rem;\n accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n cursor: pointer;\n margin: 0;\n }\n .pill: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 .pill: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 .pill:has(input:disabled) {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .pill:has(input:disabled) input {\n cursor: not-allowed;\n }\n @media (forced-colors: active) {\n .pill:has(input:focus-visible) {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .pill:has(input:checked) {\n border-color: Highlight;\n }\n .pill:has(input:disabled) {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Options to render, one pill each. */\n @property({ attribute: false }) options: RadioPillOption[] = [];\n /** Currently selected value. */\n @property() value = \"\";\n /** Disables every native radio in the group. */\n @property({ type: Boolean }) disabled = false;\n\n readonly #name = `radio-pills-${++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\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"pill\">\n <input\n type=\"radio\"\n name=${this.#name}\n ?checked=${this.value === opt.value}\n ?disabled=${this.disabled}\n @change=${() => this._onChange(opt.value)}\n />\n <span>${opt.label}</span>\n </label>\n `,\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"radio-pills\": RadioPills;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tile-grid.d.ts","sourceRoot":"","sources":["../src/tile-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAMrD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,QAAS,SAAQ,UAAU;;IACtC,OAAgB,MAAM,4BA6DpB;IAEF,iFAAiF;IACjD,KAAK,EAAE,OAAO,EAAE,CAAM;IACtD,sGAAsG;IACtE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAG/E;IACX,yEAAyE;IACzC,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAA0B;IAChG,yFAAyF;IACzD,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAQ;IAC3F,0GAA0G;IACrD,QAAQ,UAAS;IAyB7D,MAAM,yCA8Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"tile-grid.d.ts","sourceRoot":"","sources":["../src/tile-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAMrD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBACa,QAAS,SAAQ,UAAU;;IACtC,OAAgB,MAAM,4BAgEpB;IAEF,iFAAiF;IACjD,KAAK,EAAE,OAAO,EAAE,CAAM;IACtD,sGAAsG;IACtE,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAG/E;IACX,yEAAyE;IACzC,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAA0B;IAChG,yFAAyF;IACzD,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI,CAAQ;IAC3F,0GAA0G;IACrD,QAAQ,UAAS;IAyB7D,MAAM,yCA8Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
package/dist/tile-grid.js CHANGED
@@ -66,6 +66,9 @@ let TileGrid = class TileGrid extends LitElement {
66
66
  .tile {
67
67
  border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
68
68
  border-radius: var(--ui-radius, 0.5rem);
69
+ /* A resting tile only painted on hover, so it was see-through over
70
+ anything but a plain --ui-surface page. */
71
+ background: var(--ui-surface, #ffffff);
69
72
  padding: 0.75rem;
70
73
  color: var(--ui-text, #0f172a);
71
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tile-grid.js","sourceRoot":"","sources":["../src/tile-grid.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,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAgEL,iFAAiF;QACjD,UAAK,GAAc,EAAE,CAAC;QACtD,sGAAsG;QACtE,YAAO,GAAsD,CAC3F,KAAK,EACL,KAAK,EACL,EAAE,CAAC,KAAK,CAAC;QACX,yEAAyE;QACzC,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S,EAAE,KAAK,EAAE,CAAC;0CAA4D;AAEtC;IAApD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAkB;AA5E3D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAoIpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { iconDocument } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A generic, presentational grid shell: renders one bordered card per entry\n * in `items`, with each tile's content produced by `renderTile` (default:\n * stringify). Knows nothing about what an \"item\" means — callers own the\n * data shape entirely. Modeled directly on `data-table`'s headless pattern.\n *\n * Optional `itemHref` makes whole tiles clickable (navigating via\n * `location.hash`), without hijacking clicks on nested interactive elements\n * (links/buttons) a tile's rendered content might contain.\n *\n * Optional `fileIcon` prefixes each tile with a decorative Heroicons\n * \"document\" glyph, for grids whose items represent files — the icon never\n * carries its own accessible name since the rendered tile content (e.g. a\n * filename) already identifies the item. Off by default, so it consumes no\n * layout space or markup for grids of non-file items.\n *\n * @element tile-grid\n */\n@customElement(\"tile-grid\")\nexport class TileGrid extends LitElement {\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 font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));\n gap: 0.75rem;\n }\n .tile {\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n padding: 0.75rem;\n color: var(--ui-text, #0f172a);\n }\n .tile.clickable {\n cursor: pointer;\n }\n .tile.clickable:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .tile.clickable:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .tile-body {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n }\n .tile-icon {\n display: inline-flex;\n flex-shrink: 0;\n margin-top: 0.125rem;\n color: var(--ui-text-muted, #64748b);\n }\n .tile-content {\n min-width: 0;\n flex: 1;\n }\n @media (forced-colors: active) {\n .tile.clickable:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Tile data; opaque to this component beyond what `renderTile` does with it. */\n @property({ attribute: false }) items: unknown[] = [];\n /** Stable identity for `items[i]`, used as the repeat-directive key. Defaults to the item's index. */\n @property({ attribute: false }) itemKey: (item: unknown, index: number) => string | number = (\n _item,\n index,\n ) => index;\n /** Produces a tile's rendered content for `item`. Default: stringify. */\n @property({ attribute: false }) renderTile: (item: unknown) => unknown = (item) => String(item);\n /** When set, clicking a tile (outside any nested link/button) navigates to this hash. */\n @property({ attribute: false }) itemHref: ((item: unknown) => string | null) | null = null;\n /** Prefixes each tile with a decorative \"document\" icon, for grids of file-like items. Off by default. */\n @property({ type: Boolean, attribute: \"file-icon\" }) fileIcon = false;\n\n #onTileClick(item: unknown, e: MouseEvent): void {\n if (!this.itemHref) return;\n if (this.#isNestedInteractive(e.composedPath(), e.currentTarget)) return;\n const href = this.itemHref(item);\n if (href) location.hash = href;\n }\n\n #onTileKeydown(href: string, e: KeyboardEvent): void {\n if (e.key !== \"Enter\" || e.target !== e.currentTarget) return;\n e.preventDefault();\n location.hash = href;\n }\n\n #isNestedInteractive(path: EventTarget[], tile: EventTarget | null): boolean {\n const selector =\n \"a, button, input, select, textarea, summary, [contenteditable], [role='button'], [role='link'], [tabindex]\";\n for (const target of path) {\n if (target === tile) return false;\n if (target instanceof HTMLElement && target.matches(selector)) return true;\n }\n return false;\n }\n\n override render() {\n return html`\n <div class=\"grid\">\n ${repeat(\n this.items,\n (item, i) => this.itemKey(item, i),\n (item) => {\n const href = this.itemHref?.(item) ?? null;\n return html`\n <div\n class=${href ? \"tile clickable\" : \"tile\"}\n role=${href ? \"link\" : nothing}\n tabindex=${href ? \"0\" : nothing}\n @click=${(e: MouseEvent) => this.#onTileClick(item, e)}\n @keydown=${href ? (e: KeyboardEvent) => this.#onTileKeydown(href, e) : nothing}\n >\n ${this.fileIcon\n ? html`\n <div class=\"tile-body\">\n <span class=\"tile-icon\" aria-hidden=\"true\">${iconDocument(14)}</span>\n <div class=\"tile-content\">${this.renderTile(item)}</div>\n </div>\n `\n : this.renderTile(item)}\n </div>\n `;\n },\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tile-grid\": TileGrid;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-grid.js","sourceRoot":"","sources":["../src/tile-grid.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,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAmEL,iFAAiF;QACjD,UAAK,GAAc,EAAE,CAAC;QACtD,sGAAsG;QACtE,YAAO,GAAsD,CAC3F,KAAK,EACL,KAAK,EACL,EAAE,CAAC,KAAK,CAAC;QACX,yEAAyE;QACzC,eAAU,GAA+B,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChG,yFAAyF;QACzD,aAAQ,GAA8C,I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AW,EAAE,CAAC;0CAAkB;AA/E3D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAuIpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { repeat } from \"lit/directives/repeat.js\";\nimport { iconDocument } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A generic, presentational grid shell: renders one bordered card per entry\n * in `items`, with each tile's content produced by `renderTile` (default:\n * stringify). Knows nothing about what an \"item\" means — callers own the\n * data shape entirely. Modeled directly on `data-table`'s headless pattern.\n *\n * Optional `itemHref` makes whole tiles clickable (navigating via\n * `location.hash`), without hijacking clicks on nested interactive elements\n * (links/buttons) a tile's rendered content might contain.\n *\n * Optional `fileIcon` prefixes each tile with a decorative Heroicons\n * \"document\" glyph, for grids whose items represent files — the icon never\n * carries its own accessible name since the rendered tile content (e.g. a\n * filename) already identifies the item. Off by default, so it consumes no\n * layout space or markup for grids of non-file items.\n *\n * @element tile-grid\n */\n@customElement(\"tile-grid\")\nexport class TileGrid extends LitElement {\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 font-size: var(--ui-font-size-sm, 0.75rem);\n }\n .grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr));\n gap: 0.75rem;\n }\n .tile {\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n /* A resting tile only painted on hover, so it was see-through over\n anything but a plain --ui-surface page. */\n background: var(--ui-surface, #ffffff);\n padding: 0.75rem;\n color: var(--ui-text, #0f172a);\n }\n .tile.clickable {\n cursor: pointer;\n }\n .tile.clickable:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .tile.clickable:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .tile-body {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n }\n .tile-icon {\n display: inline-flex;\n flex-shrink: 0;\n margin-top: 0.125rem;\n color: var(--ui-text-muted, #64748b);\n }\n .tile-content {\n min-width: 0;\n flex: 1;\n }\n @media (forced-colors: active) {\n .tile.clickable:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Tile data; opaque to this component beyond what `renderTile` does with it. */\n @property({ attribute: false }) items: unknown[] = [];\n /** Stable identity for `items[i]`, used as the repeat-directive key. Defaults to the item's index. */\n @property({ attribute: false }) itemKey: (item: unknown, index: number) => string | number = (\n _item,\n index,\n ) => index;\n /** Produces a tile's rendered content for `item`. Default: stringify. */\n @property({ attribute: false }) renderTile: (item: unknown) => unknown = (item) => String(item);\n /** When set, clicking a tile (outside any nested link/button) navigates to this hash. */\n @property({ attribute: false }) itemHref: ((item: unknown) => string | null) | null = null;\n /** Prefixes each tile with a decorative \"document\" icon, for grids of file-like items. Off by default. */\n @property({ type: Boolean, attribute: \"file-icon\" }) fileIcon = false;\n\n #onTileClick(item: unknown, e: MouseEvent): void {\n if (!this.itemHref) return;\n if (this.#isNestedInteractive(e.composedPath(), e.currentTarget)) return;\n const href = this.itemHref(item);\n if (href) location.hash = href;\n }\n\n #onTileKeydown(href: string, e: KeyboardEvent): void {\n if (e.key !== \"Enter\" || e.target !== e.currentTarget) return;\n e.preventDefault();\n location.hash = href;\n }\n\n #isNestedInteractive(path: EventTarget[], tile: EventTarget | null): boolean {\n const selector =\n \"a, button, input, select, textarea, summary, [contenteditable], [role='button'], [role='link'], [tabindex]\";\n for (const target of path) {\n if (target === tile) return false;\n if (target instanceof HTMLElement && target.matches(selector)) return true;\n }\n return false;\n }\n\n override render() {\n return html`\n <div class=\"grid\">\n ${repeat(\n this.items,\n (item, i) => this.itemKey(item, i),\n (item) => {\n const href = this.itemHref?.(item) ?? null;\n return html`\n <div\n class=${href ? \"tile clickable\" : \"tile\"}\n role=${href ? \"link\" : nothing}\n tabindex=${href ? \"0\" : nothing}\n @click=${(e: MouseEvent) => this.#onTileClick(item, e)}\n @keydown=${href ? (e: KeyboardEvent) => this.#onTileKeydown(href, e) : nothing}\n >\n ${this.fileIcon\n ? html`\n <div class=\"tile-body\">\n <span class=\"tile-icon\" aria-hidden=\"true\">${iconDocument(14)}</span>\n <div class=\"tile-content\">${this.renderTile(item)}</div>\n </div>\n `\n : this.renderTile(item)}\n </div>\n `;\n },\n )}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"tile-grid\": TileGrid;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ui-button.d.ts","sourceRoot":"","sources":["../src/ui-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,qBACa,QAAS,SAAQ,UAAU;;IACtC,MAAM,CAAC,cAAc,UAAQ;IAG7B,OAAgB,MAAM,4BA+NpB;IAEF,qBAAqB;IACT,OAAO,EAAE,aAAa,CAAa;IAC/C,+EAA+E;IACnE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IACrC,2FAA2F;IAC9D,IAAI,UAAS;IAC1C,sKAAsK;IAC1H,EAAE,UAAS;IACvD,oEAAoE;IACxD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAQ;IACvC,wDAAwD;IAC5C,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAC3D,wCAAwC;IACX,QAAQ,UAAS;IAC9C,0EAA0E;IAC7C,IAAI,UAAS;IAE1C,qHAAqH;IACrH,OAAO,CAAC,QAAQ;IAKhB,4EAA4E;IAC5E,OAAO,CAAC,YAAY;IAKX,MAAM,yCA+Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"ui-button.d.ts","sourceRoot":"","sources":["../src/ui-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAK5C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,qBACa,QAAS,SAAQ,UAAU;;IACtC,MAAM,CAAC,cAAc,UAAQ;IAG7B,OAAgB,MAAM,4BA2OpB;IAEF,qBAAqB;IACT,OAAO,EAAE,aAAa,CAAa;IAC/C,+EAA+E;IACnE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IACrC,2FAA2F;IAC9D,IAAI,UAAS;IAC1C,sKAAsK;IAC1H,EAAE,UAAS;IACvD,oEAAoE;IACxD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAQ;IACvC,wDAAwD;IAC5C,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAY;IAC3D,wCAAwC;IACX,QAAQ,UAAS;IAC9C,0EAA0E;IAC7C,IAAI,UAAS;IAE1C,qHAAqH;IACrH,OAAO,CAAC,QAAQ;IAKhB,4EAA4E;IAC5E,OAAO,CAAC,YAAY;IAKX,MAAM,yCA+Bd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
package/dist/ui-button.js CHANGED
@@ -137,17 +137,29 @@ let UiButton = class UiButton extends LitElement {
137
137
  box-shadow: none;
138
138
  }
139
139
  .btn.secondary {
140
- background: var(--ui-button-secondary-background, none);
140
+ /* Layered over an opaque --ui-surface base rather than left flat: the
141
+ secondary background token is transparent by default, and a bordered
142
+ button that lets the page show through reads as broken on any
143
+ surface that isn't plain --ui-surface (a textured or tinted page, an
144
+ image). A themed gradient still paints over the base, so this only
145
+ changes what shows when the token contributes nothing. */
146
+ background:
147
+ var(--ui-button-secondary-background, none),
148
+ var(--ui-surface, #ffffff);
141
149
  border-color: var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));
142
150
  color: var(--ui-text, #0f172a);
143
151
  box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
144
152
  }
145
153
  .btn.secondary:hover:not(:disabled) {
146
- background: var(--ui-button-secondary-background-hover, none);
154
+ background:
155
+ var(--ui-button-secondary-background-hover, none),
156
+ var(--ui-surface, #ffffff);
147
157
  border-color: var(--ui-button-secondary-border-hover, var(--ui-text-muted, #64748b));
148
158
  }
149
159
  .btn.secondary:active:not(:disabled) {
150
- background: var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none));
160
+ background:
161
+ var(--ui-button-secondary-background-active, var(--ui-button-secondary-background, none)),
162
+ var(--ui-surface, #ffffff);
151
163
  box-shadow: none;
152
164
  }
153
165
  .btn.danger {
@@ -1 +1 @@
1
- {"version":3,"file":"ui-button.js","sourceRoot":"","sources":["../src/ui-button.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,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAGL,eAAU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,EAAE;sCAA4B;AAE3B;IAAX,QAAQ,EAAE;sCAAgD;AAE9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCAAc;AApP/B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkSpB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"danger\";\n\n/**\n * Button (or link styled as one) with an optional leading icon, in three\n * visual weights. Set `href` to render an `<a>` instead of a `<button>` —\n * same styling either way — for cross-page navigation that should look like\n * an action button; a disabled/busy link stays a real `<a>` with\n * `aria-disabled` + `pointer-events: none` rather than losing its href.\n * Put the icon in the `icon` slot and the label in the default slot.\n *\n * Form-associated (`type=\"submit\"`/`\"reset\"`): the actual `<button>` lives in\n * this element's shadow root, which native HTML form association does not\n * cross into from an ancestor light-DOM `<form>`. `type=\"submit\"`/`\"reset\"`\n * is instead wired through `ElementInternals.form` — the same mechanism\n * `address-autocomplete` uses to associate with an ancestor form.\n *\n * `primary`/`danger` backgrounds read `--ui-button-background`/\n * `--ui-button-danger-background` (and their `-hover`/`-active`\n * counterparts), which default to the flat `--ui-primary`/`--ui-danger`\n * tokens unchanged — so `--ui-primary`/`--ui-danger` stay the single source\n * of truth for every other component. A consumer can override just these\n * button-specific tokens with a `linear-gradient(...)` to opt every\n * `ui-button` into a gradient look without touching component markup —\n * `gradientTokenValues` in `tokens.ts` ships exactly this, wired up via\n * `data-theme=\"gradient\"` (see `tokens.css`'s \"Gradient theme\" section) —\n * pairing it with `--ui-button-border`/`--ui-button-danger-border` (default\n * `transparent`) for a defining edge a shade darker than the gradient's dark\n * stop, and setting the `-active` variant's stops in reverse for a\n * pressed/\"indented\" look while the button is held down. `secondary`'s\n * background/border read the equivalent `--ui-button-secondary-*` tokens\n * (shared with `confirm-dialog`'s Cancel button), defaulting to today's\n * transparent/bordered look, so it can be themed into a matching (e.g.\n * white-to-gray) gradient too.\n *\n * `ai` is an orthogonal modifier rather than a fourth variant: it leaves the\n * variant's fill (flat or gradient-themed) untouched and only adds an\n * animated multi-hue ring *outside* the button box — a crisp masked edge\n * plus a blurred bloom behind it that fades out to transparent, so the ring\n * melts into the page instead of ending on a hard line. Both layers are\n * masked into a donut, so nothing is ever painted over the background or\n * label. The ring's four stops are the `--ui-ai-1`…`--ui-ai-4` tokens. It\n * sweeps slowly at rest, faster on hover and while `busy`, holds still while\n * disabled or under `prefers-reduced-motion`, and drops the bloom for a\n * solid `CanvasText` ring in forced-colors mode. The bloom reaches about\n * `0.5rem` past the control, so give an AI button that much clearance from\n * its neighbors and avoid `overflow: hidden` ancestors that would clip it.\n *\n * Do not combine `ai` with `pill` under the gradient theme\n * (`data-theme=\"gradient\"`). That theme defines a button through a darker\n * `--ui-button-border` edge plus a glossy top highlight; a pill's\n * fully-rounded silhouette runs flush against the ring around its entire\n * outline, so that border and gloss read as the inner edge of the rainbow\n * rather than as the button's own shape, and the vertical gradient fill\n * stops reading as a gradient at all. Use `ai` with the default\n * `--ui-radius-sm` corners there, and keep `ai` + `pill` for the flat theme.\n *\n * @element ui-button\n * @slot icon - Optional leading icon (e.g. an inline SVG).\n * @slot - Button label.\n */\n@customElement(\"ui-button\")\nexport class UiButton extends LitElement {\n static formAssociated = true;\n\n #internals = this.attachInternals();\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n }\n .btn {\n display: inline-flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\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 font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\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 cursor: pointer;\n border: var(--ui-border-width, 1px) solid transparent;\n text-decoration: none;\n box-sizing: border-box;\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 .btn.secondary {\n background: var(--ui-button-secondary-background, none);\n border-color: var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n color: var(--ui-text, #0f172a);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn.secondary: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.secondary: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 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:disabled,\n .btn[aria-disabled=\"true\"] {\n opacity: 0.6;\n cursor: default;\n pointer-events: none;\n }\n .btn: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.secondary: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 .btn.sm {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .btn.pill {\n border-radius: var(--ui-radius-pill, 9999px);\n }\n .btn.ai {\n position: relative;\n --ai-sweep: linear-gradient(\n 90deg,\n var(--ui-ai-1, #38bdf8),\n var(--ui-ai-2, #6366f1),\n var(--ui-ai-3, #d946ef),\n var(--ui-ai-4, #fbbf24),\n var(--ui-ai-1, #38bdf8)\n );\n }\n /* Two layers, both masked into a donut (everything except the content\n box) so the fill underneath — flat, gradient-themed, or transparent\n secondary — is never painted over: ::before is a blurred bloom that\n fades out to transparent, ::after the crisp edge on top of it. The\n gradient tile is 1.5x the box so most of the hue range is visible at\n once, and one cycle shifts it by exactly one tile, for a seamless\n loop. */\n .btn.ai::before,\n .btn.ai::after {\n content: \"\";\n position: absolute;\n background: var(--ai-sweep);\n background-size: 150% 100%;\n -webkit-mask:\n linear-gradient(#000 0 0) content-box,\n linear-gradient(#000 0 0);\n -webkit-mask-composite: xor;\n mask:\n linear-gradient(#000 0 0) content-box,\n linear-gradient(#000 0 0);\n mask-composite: exclude;\n animation: ai-sweep 4s linear infinite;\n pointer-events: none;\n }\n /* The transparent border is headroom: a mask layer is clipped to the\n border box, so without it the blur's outward spread — the fade —\n would be cut off square again. */\n .btn.ai::before {\n inset: -1rem;\n border: 0.75rem solid transparent;\n padding: 0.25rem;\n border-radius: calc(var(--ui-radius-sm, 0.25rem) + 1rem);\n background-clip: padding-box;\n filter: blur(0.3125rem);\n opacity: 0.6;\n }\n .btn.ai::after {\n inset: -0.125rem;\n padding: 0.125rem;\n border-radius: calc(var(--ui-radius-sm, 0.25rem) + 0.125rem);\n }\n .btn.ai.pill::before,\n .btn.ai.pill::after {\n border-radius: var(--ui-radius-pill, 9999px);\n }\n .btn.ai:hover::before,\n .btn.ai:hover::after {\n animation-duration: 1.5s;\n }\n /* A busy AI button keeps sweeping (and speeds up) — the ring reads as\n \"working\"; a plainly disabled one holds still. */\n .btn.ai[aria-busy=\"true\"]::before,\n .btn.ai[aria-busy=\"true\"]::after {\n animation-duration: 1.5s;\n }\n .btn.ai:disabled:not([aria-busy=\"true\"])::before,\n .btn.ai:disabled:not([aria-busy=\"true\"])::after,\n .btn.ai[aria-disabled=\"true\"]:not([aria-busy=\"true\"])::before,\n .btn.ai[aria-disabled=\"true\"]:not([aria-busy=\"true\"])::after {\n animation: none;\n }\n @keyframes ai-sweep {\n to {\n background-position: 300% 0;\n }\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n .spin[hidden] {\n display: none;\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 .btn.ai::before,\n .btn.ai::after,\n .btn.ai:hover::before,\n .btn.ai:hover::after,\n .btn.ai[aria-busy=\"true\"]::before,\n .btn.ai[aria-busy=\"true\"]::after {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n /* Gradients carry no meaning once colors are forced — drop the bloom\n and keep a solid system-colored ring so the AI affordance survives. */\n .btn.ai::before {\n display: none;\n }\n .btn.ai::after {\n background: CanvasText;\n animation: none;\n }\n .btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .btn:disabled,\n .btn[aria-disabled=\"true\"] {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Visual weight. */\n @property() variant: ButtonVariant = \"primary\";\n /** Size — `sm` reduces height/padding/font-size one step below the default. */\n @property() size: \"sm\" | \"md\" = \"md\";\n /** Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. */\n @property({ type: Boolean }) pill = false;\n /** Draws the animated multi-hue \"AI\" ring (crisp edge plus a bloom fading out to transparent) around the button, on top of whatever variant/theme it already uses. */\n @property({ type: Boolean, reflect: true }) ai = false;\n /** Renders an `<a href=\"...\">` instead of a `<button>` when set. */\n @property() href: string | null = null;\n /** Native button `type`. Ignored when `href` is set. */\n @property() type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /** Disables the control and dims it. */\n @property({ type: Boolean }) disabled = false;\n /** Shows a spinner in place of the icon slot and disables the control. */\n @property({ type: Boolean }) busy = false;\n\n /** Drives submit/reset on the ancestor form via ElementInternals, since a shadow-DOM button can't do it natively. */\n private _onClick() {\n if (this.type === \"submit\") this.#internals.form?.requestSubmit();\n else if (this.type === \"reset\") this.#internals.form?.reset();\n }\n\n /** Suppresses navigation while a link-styled button is disabled or busy. */\n private _onLinkClick(e: MouseEvent) {\n if (!this.disabled && !this.busy) return;\n e.preventDefault();\n }\n\n override render() {\n const classes = `btn ${this.variant} ${this.size}${this.pill ? \" pill\" : \"\"}${this.ai ? \" ai\" : \"\"}`;\n const isDisabled = this.disabled || this.busy;\n if (this.href) {\n return html`\n <a\n class=${classes}\n href=${this.href}\n aria-disabled=${isDisabled ? \"true\" : \"false\"}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onLinkClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </a>\n `;\n }\n return html`\n <button\n class=${classes}\n type=\"button\"\n ?disabled=${isDisabled}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-button\": UiButton;\n }\n}\n"]}
1
+ {"version":3,"file":"ui-button.js","sourceRoot":"","sources":["../src/ui-button.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,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QAGL,eAAU,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QA8OpC,qBAAqB;QACT,YAAO,GAAkB,SAAS,CAAC;QAC/C,+EAA+E;QACnE,SAAI,GAAgB,IAAI,CAAC;QACrC,2FAA2F;QAC9D,SAAI,GAAG,KAAK,CAAC;QAC1C,sKAAsK;QAC1H,OAAE,GAAG,KAAK,CAAC;QACvD,oEAAoE;QACxD,SAAI,GAAkB,IAAI,CAAC;QACvC,wDAAwD;QAC5C,SAAI,GAAkC,QAAQ,CAAC;QAC3D,wCAAwC;QACX,aAAQ,GAAG,KAAK,CAAC;QAC9C,0EAA0E;QAC7C,SAAI,GAAG,KAAK,CAAC;IA8C5C,CAAC;aA7SQ,mBAAc,GAAG,IAAI,AAAP,CAAQ;IAE7B,UAAU,CAA0B;aACpB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAAC,IAAI;;;OAGxC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAA;;gBAEC,OAAO;;oBAEH,UAAU;oBACV,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;iBAC/B,IAAI,CAAC,QAAQ;;wDAE0B,CAAC,IAAI,CAAC,IAAI,IAAI,aAAa,CAAC,EAAE,CAAC;oCACnD,IAAI,CAAC,IAAI;;;KAGxC,CAAC;IACJ,CAAC;CACF,CAAA;AA5Da;IAAX,QAAQ,EAAE;yCAAoC;AAEnC;IAAX,QAAQ,EAAE;sCAA0B;AAER;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCAAc;AAEE;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCAAY;AAE3C;IAAX,QAAQ,EAAE;sCAA4B;AAE3B;IAAX,QAAQ,EAAE;sCAAgD;AAE9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCAAc;AAhQ/B,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA8SpB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconArrowPath } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"danger\";\n\n/**\n * Button (or link styled as one) with an optional leading icon, in three\n * visual weights. Set `href` to render an `<a>` instead of a `<button>` —\n * same styling either way — for cross-page navigation that should look like\n * an action button; a disabled/busy link stays a real `<a>` with\n * `aria-disabled` + `pointer-events: none` rather than losing its href.\n * Put the icon in the `icon` slot and the label in the default slot.\n *\n * Form-associated (`type=\"submit\"`/`\"reset\"`): the actual `<button>` lives in\n * this element's shadow root, which native HTML form association does not\n * cross into from an ancestor light-DOM `<form>`. `type=\"submit\"`/`\"reset\"`\n * is instead wired through `ElementInternals.form` — the same mechanism\n * `address-autocomplete` uses to associate with an ancestor form.\n *\n * `primary`/`danger` backgrounds read `--ui-button-background`/\n * `--ui-button-danger-background` (and their `-hover`/`-active`\n * counterparts), which default to the flat `--ui-primary`/`--ui-danger`\n * tokens unchanged — so `--ui-primary`/`--ui-danger` stay the single source\n * of truth for every other component. A consumer can override just these\n * button-specific tokens with a `linear-gradient(...)` to opt every\n * `ui-button` into a gradient look without touching component markup —\n * `gradientTokenValues` in `tokens.ts` ships exactly this, wired up via\n * `data-theme=\"gradient\"` (see `tokens.css`'s \"Gradient theme\" section) —\n * pairing it with `--ui-button-border`/`--ui-button-danger-border` (default\n * `transparent`) for a defining edge a shade darker than the gradient's dark\n * stop, and setting the `-active` variant's stops in reverse for a\n * pressed/\"indented\" look while the button is held down. `secondary`'s\n * background/border read the equivalent `--ui-button-secondary-*` tokens\n * (shared with `confirm-dialog`'s Cancel button), defaulting to today's\n * transparent/bordered look, so it can be themed into a matching (e.g.\n * white-to-gray) gradient too.\n *\n * `ai` is an orthogonal modifier rather than a fourth variant: it leaves the\n * variant's fill (flat or gradient-themed) untouched and only adds an\n * animated multi-hue ring *outside* the button box — a crisp masked edge\n * plus a blurred bloom behind it that fades out to transparent, so the ring\n * melts into the page instead of ending on a hard line. Both layers are\n * masked into a donut, so nothing is ever painted over the background or\n * label. The ring's four stops are the `--ui-ai-1`…`--ui-ai-4` tokens. It\n * sweeps slowly at rest, faster on hover and while `busy`, holds still while\n * disabled or under `prefers-reduced-motion`, and drops the bloom for a\n * solid `CanvasText` ring in forced-colors mode. The bloom reaches about\n * `0.5rem` past the control, so give an AI button that much clearance from\n * its neighbors and avoid `overflow: hidden` ancestors that would clip it.\n *\n * Do not combine `ai` with `pill` under the gradient theme\n * (`data-theme=\"gradient\"`). That theme defines a button through a darker\n * `--ui-button-border` edge plus a glossy top highlight; a pill's\n * fully-rounded silhouette runs flush against the ring around its entire\n * outline, so that border and gloss read as the inner edge of the rainbow\n * rather than as the button's own shape, and the vertical gradient fill\n * stops reading as a gradient at all. Use `ai` with the default\n * `--ui-radius-sm` corners there, and keep `ai` + `pill` for the flat theme.\n *\n * @element ui-button\n * @slot icon - Optional leading icon (e.g. an inline SVG).\n * @slot - Button label.\n */\n@customElement(\"ui-button\")\nexport class UiButton extends LitElement {\n static formAssociated = true;\n\n #internals = this.attachInternals();\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n }\n .btn {\n display: inline-flex;\n width: 100%;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n height: 2rem;\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 font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\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 cursor: pointer;\n border: var(--ui-border-width, 1px) solid transparent;\n text-decoration: none;\n box-sizing: border-box;\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 .btn.secondary {\n /* Layered over an opaque --ui-surface base rather than left flat: the\n secondary background token is transparent by default, and a bordered\n button that lets the page show through reads as broken on any\n surface that isn't plain --ui-surface (a textured or tinted page, an\n image). A themed gradient still paints over the base, so this only\n changes what shows when the token contributes nothing. */\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n border-color: var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n color: var(--ui-text, #0f172a);\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n .btn.secondary: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.secondary: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 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:disabled,\n .btn[aria-disabled=\"true\"] {\n opacity: 0.6;\n cursor: default;\n pointer-events: none;\n }\n .btn: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.secondary: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 .btn.sm {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .btn.pill {\n border-radius: var(--ui-radius-pill, 9999px);\n }\n .btn.ai {\n position: relative;\n --ai-sweep: linear-gradient(\n 90deg,\n var(--ui-ai-1, #38bdf8),\n var(--ui-ai-2, #6366f1),\n var(--ui-ai-3, #d946ef),\n var(--ui-ai-4, #fbbf24),\n var(--ui-ai-1, #38bdf8)\n );\n }\n /* Two layers, both masked into a donut (everything except the content\n box) so the fill underneath — flat, gradient-themed, or transparent\n secondary — is never painted over: ::before is a blurred bloom that\n fades out to transparent, ::after the crisp edge on top of it. The\n gradient tile is 1.5x the box so most of the hue range is visible at\n once, and one cycle shifts it by exactly one tile, for a seamless\n loop. */\n .btn.ai::before,\n .btn.ai::after {\n content: \"\";\n position: absolute;\n background: var(--ai-sweep);\n background-size: 150% 100%;\n -webkit-mask:\n linear-gradient(#000 0 0) content-box,\n linear-gradient(#000 0 0);\n -webkit-mask-composite: xor;\n mask:\n linear-gradient(#000 0 0) content-box,\n linear-gradient(#000 0 0);\n mask-composite: exclude;\n animation: ai-sweep 4s linear infinite;\n pointer-events: none;\n }\n /* The transparent border is headroom: a mask layer is clipped to the\n border box, so without it the blur's outward spread — the fade —\n would be cut off square again. */\n .btn.ai::before {\n inset: -1rem;\n border: 0.75rem solid transparent;\n padding: 0.25rem;\n border-radius: calc(var(--ui-radius-sm, 0.25rem) + 1rem);\n background-clip: padding-box;\n filter: blur(0.3125rem);\n opacity: 0.6;\n }\n .btn.ai::after {\n inset: -0.125rem;\n padding: 0.125rem;\n border-radius: calc(var(--ui-radius-sm, 0.25rem) + 0.125rem);\n }\n .btn.ai.pill::before,\n .btn.ai.pill::after {\n border-radius: var(--ui-radius-pill, 9999px);\n }\n .btn.ai:hover::before,\n .btn.ai:hover::after {\n animation-duration: 1.5s;\n }\n /* A busy AI button keeps sweeping (and speeds up) — the ring reads as\n \"working\"; a plainly disabled one holds still. */\n .btn.ai[aria-busy=\"true\"]::before,\n .btn.ai[aria-busy=\"true\"]::after {\n animation-duration: 1.5s;\n }\n .btn.ai:disabled:not([aria-busy=\"true\"])::before,\n .btn.ai:disabled:not([aria-busy=\"true\"])::after,\n .btn.ai[aria-disabled=\"true\"]:not([aria-busy=\"true\"])::before,\n .btn.ai[aria-disabled=\"true\"]:not([aria-busy=\"true\"])::after {\n animation: none;\n }\n @keyframes ai-sweep {\n to {\n background-position: 300% 0;\n }\n }\n .spin {\n display: inline-flex;\n animation: spin 0.8s linear infinite;\n }\n .spin[hidden] {\n display: none;\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 .btn.ai::before,\n .btn.ai::after,\n .btn.ai:hover::before,\n .btn.ai:hover::after,\n .btn.ai[aria-busy=\"true\"]::before,\n .btn.ai[aria-busy=\"true\"]::after {\n animation: none;\n }\n }\n @media (forced-colors: active) {\n /* Gradients carry no meaning once colors are forced — drop the bloom\n and keep a solid system-colored ring so the AI affordance survives. */\n .btn.ai::before {\n display: none;\n }\n .btn.ai::after {\n background: CanvasText;\n animation: none;\n }\n .btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .btn:disabled,\n .btn[aria-disabled=\"true\"] {\n color: GrayText;\n border-color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n /** Visual weight. */\n @property() variant: ButtonVariant = \"primary\";\n /** Size — `sm` reduces height/padding/font-size one step below the default. */\n @property() size: \"sm\" | \"md\" = \"md\";\n /** Renders fully rounded (pill-shaped) corners instead of the default `--ui-radius-sm`. */\n @property({ type: Boolean }) pill = false;\n /** Draws the animated multi-hue \"AI\" ring (crisp edge plus a bloom fading out to transparent) around the button, on top of whatever variant/theme it already uses. */\n @property({ type: Boolean, reflect: true }) ai = false;\n /** Renders an `<a href=\"...\">` instead of a `<button>` when set. */\n @property() href: string | null = null;\n /** Native button `type`. Ignored when `href` is set. */\n @property() type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /** Disables the control and dims it. */\n @property({ type: Boolean }) disabled = false;\n /** Shows a spinner in place of the icon slot and disables the control. */\n @property({ type: Boolean }) busy = false;\n\n /** Drives submit/reset on the ancestor form via ElementInternals, since a shadow-DOM button can't do it natively. */\n private _onClick() {\n if (this.type === \"submit\") this.#internals.form?.requestSubmit();\n else if (this.type === \"reset\") this.#internals.form?.reset();\n }\n\n /** Suppresses navigation while a link-styled button is disabled or busy. */\n private _onLinkClick(e: MouseEvent) {\n if (!this.disabled && !this.busy) return;\n e.preventDefault();\n }\n\n override render() {\n const classes = `btn ${this.variant} ${this.size}${this.pill ? \" pill\" : \"\"}${this.ai ? \" ai\" : \"\"}`;\n const isDisabled = this.disabled || this.busy;\n if (this.href) {\n return html`\n <a\n class=${classes}\n href=${this.href}\n aria-disabled=${isDisabled ? \"true\" : \"false\"}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onLinkClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </a>\n `;\n }\n return html`\n <button\n class=${classes}\n type=\"button\"\n ?disabled=${isDisabled}\n aria-busy=${this.busy ? \"true\" : \"false\"}\n @click=${this._onClick}\n >\n <span class=\"spin\" aria-hidden=\"true\" ?hidden=${!this.busy}>${iconArrowPath(14)}</span>\n <slot name=\"icon\" ?hidden=${this.busy}></slot>\n <slot></slot>\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-button\": UiButton;\n }\n}\n"]}
@@ -79,5 +79,6 @@ _None._
79
79
  | `--ui-on-accent` |
80
80
  | `--ui-primary` |
81
81
  | `--ui-radius-sm` |
82
+ | `--ui-surface` |
82
83
  | `--ui-surface-muted` |
83
84
  | `--ui-text` |
@@ -66,6 +66,51 @@ defines the details used when creating or reviewing components.
66
66
  the active tab's `--ui-primary` line drawn on top of it) rather than
67
67
  introducing a new token — the same precedent as `ui-button`'s `secondary`
68
68
  variant, which is realized via `--ui-border`/`--ui-text-muted`, not a hue.
69
+ - **A bordered surface paints an opaque base.** A component that draws a border
70
+ but leaves its background unset is invisible on a plain `--ui-surface` page
71
+ and obviously broken on a tinted, textured, or image-backed one — and it is
72
+ inconsistent with text fields, which are already opaque. Anything that reads
73
+ as a panel, card, control, or canvas therefore declares a background, even
74
+ when that background is just the page's own paper:
75
+
76
+ ```css
77
+ background: var(--ui-surface, #ffffff);
78
+ ```
79
+
80
+ This reaches surfaces that never painted at all — `radio-pills`' unchecked
81
+ pill, `tile-grid`'s resting tile, `frame-box`'s frame (whose legend already
82
+ painted `--ui-surface` to notch the border, so a see-through body left the
83
+ notch reading as a stray white patch), `button-group`'s strip behind its
84
+ segments, and `calendar-day`/`calendar-week`'s hour grid, where only the
85
+ weekend and today columns had a fill. A translucent state tint such as
86
+ `calendar-day`'s `.today` then composites over that paper rather than over
87
+ the page, which is what it was always meant to do.
88
+
89
+ The `--ui-button-secondary-*` family is the same rule with an extra step: it
90
+ defaults to `none`, so a control using it directly would still be
91
+ see-through. Those layer the token over the base rather than declaring it
92
+ alone:
93
+
94
+ ```css
95
+ background:
96
+ var(--ui-button-secondary-background, none),
97
+ var(--ui-surface, #ffffff);
98
+ ```
99
+
100
+ A themed gradient still paints over that base, so a theme overriding the
101
+ token behaves exactly as before; only the "token contributes nothing" case
102
+ changes. The layered form applies to `ui-button`'s `secondary` variant,
103
+ `confirm-dialog`'s Cancel, `button-group`'s unchecked segments,
104
+ `pagination-nav`'s buttons, `radio-cards`' unchecked cards, and the floating
105
+ `scroll-to-top`/`scroll-to-bottom`/`fullscreen-button` controls. Neither form
106
+ applies to states that already resolve to an opaque value
107
+ (`--ui-button-secondary-surface-muted`, `--ui-surface-muted`), nor to
108
+ elements that draw a *line* or a *mark* rather than a surface —
109
+ `content-divider`'s rule, `calendar-month`'s entry underline, and
110
+ `app-sidebar`'s footer, which sits on the sidebar's own paper. Those three
111
+ are the allowlist in `design-tests/opaque-surfaces.spec.ts`, which walks
112
+ every shadow root under the blueprint theme and fails on any bordered,
113
+ see-through surface that is not one of them.
69
114
  - `--ui-ai-1`…`--ui-ai-4` are the one multi-hue family: the stops of
70
115
  `ui-button[ai]`'s animated ring, where the rainbow itself is the meaning
71
116
  ("this action is AI-powered") rather than a semantic state. They are only
@@ -381,6 +426,15 @@ recipe and, ideally, a matching full-page demo under `demo/layouts/`.
381
426
  linked parent section.
382
427
  - Public API changes update JSDoc, generated docs, `llms.txt`, README when
383
428
  relevant, and the changelog.
429
+ - Every example container in `index.html` carries the `demo-example` class.
430
+ The playground chrome is Tailwind slate, which is transparent by default, so
431
+ without it a theme that repaints the page (blueprint draws a dot grid and a
432
+ grain wash) shows straight through the example — the same rule the components
433
+ follow, applied to the demo's own boxes. `demo/demo.css` maps that class, the
434
+ demo's bordered native controls, and the slate values that have a token
435
+ counterpart onto `--ui-surface`/`--ui-surface-muted`/`--ui-border`/
436
+ `--ui-text`/`--ui-text-muted`; slate steps with no counterpart stay literal
437
+ rather than being approximated.
384
438
 
385
439
  ## Measurement contracts
386
440
 
@@ -65,6 +65,7 @@ _None._
65
65
  | `--ui-line-height-tight` |
66
66
  | `--ui-numeric` |
67
67
  | `--ui-radius-sm` |
68
+ | `--ui-surface` |
68
69
  | `--ui-surface-muted` |
69
70
  | `--ui-text` |
70
71
  | `--ui-text-muted` |
@@ -66,5 +66,6 @@ _None._
66
66
  | `--ui-line-height-tight` |
67
67
  | `--ui-primary` |
68
68
  | `--ui-radius-pill` |
69
+ | `--ui-surface` |
69
70
  | `--ui-surface-muted` |
70
71
  | `--ui-text` |
package/docs/tile-grid.md CHANGED
@@ -63,6 +63,7 @@ _None._
63
63
  | `--ui-font` |
64
64
  | `--ui-font-size-sm` |
65
65
  | `--ui-radius` |
66
+ | `--ui-surface` |
66
67
  | `--ui-surface-muted` |
67
68
  | `--ui-text` |
68
69
  | `--ui-text-muted` |
package/docs/ui-button.md CHANGED
@@ -134,5 +134,6 @@ _None._
134
134
  | `--ui-primary-hover` |
135
135
  | `--ui-radius-pill` |
136
136
  | `--ui-radius-sm` |
137
+ | `--ui-surface` |
137
138
  | `--ui-text` |
138
139
  | `--ui-text-muted` |
package/llms.txt CHANGED
@@ -447,7 +447,7 @@ Import: `import "@f-ewald/components/button-group.js";`
447
447
 
448
448
  Properties: `options` (JS property only) : ButtonGroupOption[], default []; `value` (attribute `value`) : string, default ""; `disabled` (attribute `disabled`) : boolean, default false; `iconOnly` (attribute `icon-only`) : boolean, default false; `size` (attribute `size`) : "sm" | "md", default "md"
449
449
  Events: `change`
450
- CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-button-background`, `--ui-button-highlight`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-surface-muted`, `--ui-button-text-shadow`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`
450
+ CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-button-background`, `--ui-button-highlight`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-surface-muted`, `--ui-button-text-shadow`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-radius-sm`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`
451
451
 
452
452
  Example:
453
453
  ```html
@@ -1799,7 +1799,7 @@ Import: `import "@f-ewald/components/pagination-nav.js";`
1799
1799
 
1800
1800
  Properties: `currentPage` (attribute `current-page`) : number, default 1; `totalPages` (attribute `total-pages`) : number, default 1
1801
1801
  Events: `page-change`
1802
- CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-button-secondary-surface-muted`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-numeric`, `--ui-radius-sm`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
1802
+ CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-button-secondary-surface-muted`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-numeric`, `--ui-radius-sm`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
1803
1803
 
1804
1804
  Example:
1805
1805
  ```html
@@ -2020,7 +2020,7 @@ Import: `import "@f-ewald/components/radio-pills.js";`
2020
2020
 
2021
2021
  Properties: `options` (JS property only) : RadioPillOption[], default []; `value` (attribute `value`) : string, default ""; `disabled` (attribute `disabled`) : boolean, default false
2022
2022
  Events: `change`
2023
- CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-button-accent`, `--ui-button-highlight`, `--ui-button-secondary-surface-muted`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-line-height-tight`, `--ui-primary`, `--ui-radius-pill`, `--ui-surface-muted`, `--ui-text`
2023
+ CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-button-accent`, `--ui-button-highlight`, `--ui-button-secondary-surface-muted`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-line-height-tight`, `--ui-primary`, `--ui-radius-pill`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`
2024
2024
 
2025
2025
  Example:
2026
2026
  ```html
@@ -2507,7 +2507,7 @@ Import: `import "@f-ewald/components/tile-grid.js";`
2507
2507
 
2508
2508
  Properties: `items` (JS property only) : unknown[], default []; `itemKey` (JS property only) : (item: unknown, index: number) => string | number, default —; `renderTile` (JS property only) : (item: unknown) => unknown, default —; `itemHref` (JS property only) : ((item: unknown) => string | null) | null, default null; `fileIcon` (attribute `file-icon`) : boolean, default false
2509
2509
  Events: none
2510
- CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-radius`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
2510
+ CSS custom properties: `--ui-border`, `--ui-border-width`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-radius`, `--ui-surface`, `--ui-surface-muted`, `--ui-text`, `--ui-text-muted`
2511
2511
 
2512
2512
  Example:
2513
2513
  ```html
@@ -2807,7 +2807,7 @@ Import: `import "@f-ewald/components/ui-button.js";`
2807
2807
 
2808
2808
  Properties: `variant` (attribute `variant`) : ButtonVariant, default "primary"; `size` (attribute `size`) : "sm" | "md", default "md"; `pill` (attribute `pill`) : boolean, default false; `ai` (attribute `ai`) : boolean, default false; `href` (attribute `href`) : string | null, default null; `type` (attribute `type`) : "button" | "submit" | "reset", default "button"; `disabled` (attribute `disabled`) : boolean, default false; `busy` (attribute `busy`) : boolean, default false
2809
2809
  Events: none
2810
- CSS custom properties: `--ui-ai-1`, `--ui-ai-2`, `--ui-ai-3`, `--ui-ai-4`, `--ui-border`, `--ui-border-width`, `--ui-button-background`, `--ui-button-background-active`, `--ui-button-background-hover`, `--ui-button-border`, `--ui-button-danger-background`, `--ui-button-danger-background-active`, `--ui-button-danger-background-hover`, `--ui-button-danger-border`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-background-hover`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-button-text-shadow`, `--ui-danger`, `--ui-danger-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-pill`, `--ui-radius-sm`, `--ui-text`, `--ui-text-muted`
2810
+ CSS custom properties: `--ui-ai-1`, `--ui-ai-2`, `--ui-ai-3`, `--ui-ai-4`, `--ui-border`, `--ui-border-width`, `--ui-button-background`, `--ui-button-background-active`, `--ui-button-background-hover`, `--ui-button-border`, `--ui-button-danger-background`, `--ui-button-danger-background-active`, `--ui-button-danger-background-hover`, `--ui-button-danger-border`, `--ui-button-highlight`, `--ui-button-secondary-`, `--ui-button-secondary-background`, `--ui-button-secondary-background-active`, `--ui-button-secondary-background-hover`, `--ui-button-secondary-border`, `--ui-button-secondary-border-hover`, `--ui-button-text-shadow`, `--ui-danger`, `--ui-danger-hover`, `--ui-focus-ring`, `--ui-font`, `--ui-font-size-sm`, `--ui-font-size-xs`, `--ui-font-weight-medium`, `--ui-line-height-tight`, `--ui-on-accent`, `--ui-primary`, `--ui-primary-hover`, `--ui-radius-pill`, `--ui-radius-sm`, `--ui-surface`, `--ui-text`, `--ui-text-muted`
2811
2811
 
2812
2812
  Example:
2813
2813
  ```html
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@f-ewald/components",
3
3
  "private": false,
4
- "version": "1.40.1",
4
+ "version": "1.40.3",
5
5
  "description": "A collection of universally usable web components for various tasks.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",