@f-ewald/components 1.23.1 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/custom-elements.json +1847 -596
- package/dist/address-autocomplete.d.ts.map +1 -1
- package/dist/address-autocomplete.js +7 -3
- package/dist/address-autocomplete.js.map +1 -1
- package/dist/audio-player.d.ts +53 -0
- package/dist/audio-player.d.ts.map +1 -0
- package/dist/audio-player.js +267 -0
- package/dist/audio-player.js.map +1 -0
- package/dist/autocomplete-input.d.ts.map +1 -1
- package/dist/autocomplete-input.js +7 -3
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/button-group.d.ts +12 -1
- package/dist/button-group.d.ts.map +1 -1
- package/dist/button-group.js +35 -3
- package/dist/button-group.js.map +1 -1
- package/dist/comment-composer.d.ts +54 -0
- package/dist/comment-composer.d.ts.map +1 -0
- package/dist/comment-composer.js +244 -0
- package/dist/comment-composer.js.map +1 -0
- package/dist/confirm-dialog.d.ts +4 -1
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +47 -9
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/dropdown-button.d.ts +4 -1
- package/dist/dropdown-button.d.ts.map +1 -1
- package/dist/dropdown-button.js +29 -3
- package/dist/dropdown-button.js.map +1 -1
- package/dist/icons.d.ts +10 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +10 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/page-header.d.ts +8 -3
- package/dist/page-header.d.ts.map +1 -1
- package/dist/page-header.js +33 -12
- package/dist/page-header.js.map +1 -1
- package/dist/pagination-nav.d.ts +7 -0
- package/dist/pagination-nav.d.ts.map +1 -1
- package/dist/pagination-nav.js +19 -4
- package/dist/pagination-nav.js.map +1 -1
- package/dist/radio-cards.d.ts +6 -0
- package/dist/radio-cards.d.ts.map +1 -1
- package/dist/radio-cards.js +13 -3
- package/dist/radio-cards.js.map +1 -1
- package/dist/radio-pills.d.ts +6 -0
- package/dist/radio-pills.d.ts.map +1 -1
- package/dist/radio-pills.js +13 -3
- package/dist/radio-pills.js.map +1 -1
- package/dist/range-slider.d.ts.map +1 -1
- package/dist/range-slider.js +11 -7
- package/dist/range-slider.js.map +1 -1
- package/dist/reveal-button.d.ts +5 -1
- package/dist/reveal-button.d.ts.map +1 -1
- package/dist/reveal-button.js +26 -4
- package/dist/reveal-button.js.map +1 -1
- package/dist/tokens.css +17 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +56 -0
- package/dist/tokens.js.map +1 -1
- package/dist/ui-button.d.ts +16 -0
- package/dist/ui-button.d.ts.map +1 -1
- package/dist/ui-button.js +48 -7
- package/dist/ui-button.js.map +1 -1
- package/dist/utils/duration.d.ts +8 -0
- package/dist/utils/duration.d.ts.map +1 -1
- package/dist/utils/duration.js +18 -0
- package/dist/utils/duration.js.map +1 -1
- package/dist/utils/transport-controls.d.ts +11 -0
- package/dist/utils/transport-controls.d.ts.map +1 -0
- package/dist/utils/transport-controls.js +113 -0
- package/dist/utils/transport-controls.js.map +1 -0
- package/dist/video-player.d.ts +60 -0
- package/dist/video-player.d.ts.map +1 -0
- package/dist/video-player.js +324 -0
- package/dist/video-player.js.map +1 -0
- package/docs/audio-player.md +60 -0
- package/docs/button-group.md +18 -1
- package/docs/comment-composer.md +68 -0
- package/docs/confirm-dialog.md +19 -1
- package/docs/dropdown-button.md +10 -1
- package/docs/icons.md +5 -0
- package/docs/page-header.md +11 -4
- package/docs/pagination-nav.md +14 -0
- package/docs/radio-cards.md +9 -0
- package/docs/radio-pills.md +9 -0
- package/docs/range-slider.md +3 -0
- package/docs/reveal-button.md +11 -1
- package/docs/ui-button.md +32 -0
- package/docs/video-player.md +59 -0
- package/llms.txt +162 -23
- package/package.json +1 -1
package/dist/radio-cards.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ export interface RadioCardOption {
|
|
|
11
11
|
* a basemap style), use `radio-pills` instead. Wraps native radio inputs for
|
|
12
12
|
* keyboard/a11y and fires `change` rather than relying on form submission.
|
|
13
13
|
*
|
|
14
|
+
* The selected card's border/radio dot read `--ui-button-accent` (a solid
|
|
15
|
+
* stand-in, since `border-color`/`accent-color` can't render a gradient),
|
|
16
|
+
* and its background reads the shared `--ui-button-secondary-surface-muted`
|
|
17
|
+
* plus `--ui-button-highlight`, so a gradient theme tints it consistently
|
|
18
|
+
* with `button-group`/`pagination-nav`'s equivalents.
|
|
19
|
+
*
|
|
14
20
|
* @element radio-cards
|
|
15
21
|
* @fires change - A card was selected; detail: { value }.
|
|
16
22
|
*/
|
|
@@ -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;AAKrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID
|
|
1
|
+
{"version":3,"file":"radio-cards.d.ts","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,MAAM,KAAK,CAAC;AAKrD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;;;;;;;;;;;;;GAeG;AACH,qBACa,UAAW,SAAQ,UAAU;;IACxC,OAAgB,MAAM,4BAsFpB;IAEF,wCAAwC;IACR,OAAO,EAAE,eAAe,EAAE,CAAM;IAChE,gCAAgC;IACpB,KAAK,SAAM;IACvB,gDAAgD;IACnB,QAAQ,UAAS;IAI9C,OAAO,CAAC,SAAS;IAMR,MAAM,yCAwBd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
package/dist/radio-cards.js
CHANGED
|
@@ -16,6 +16,12 @@ let instanceCount = 0;
|
|
|
16
16
|
* a basemap style), use `radio-pills` instead. Wraps native radio inputs for
|
|
17
17
|
* keyboard/a11y and fires `change` rather than relying on form submission.
|
|
18
18
|
*
|
|
19
|
+
* The selected card's border/radio dot read `--ui-button-accent` (a solid
|
|
20
|
+
* stand-in, since `border-color`/`accent-color` can't render a gradient),
|
|
21
|
+
* and its background reads the shared `--ui-button-secondary-surface-muted`
|
|
22
|
+
* plus `--ui-button-highlight`, so a gradient theme tints it consistently
|
|
23
|
+
* with `button-group`/`pagination-nav`'s equivalents.
|
|
24
|
+
*
|
|
19
25
|
* @element radio-cards
|
|
20
26
|
* @fires change - A card was selected; detail: { value }.
|
|
21
27
|
*/
|
|
@@ -63,14 +69,15 @@ let RadioCards = class RadioCards extends LitElement {
|
|
|
63
69
|
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
64
70
|
}
|
|
65
71
|
.card:has(input:checked) {
|
|
66
|
-
border-color: var(--ui-primary, #4f46e5);
|
|
67
|
-
background: var(--ui-surface-muted, #f8fafc);
|
|
72
|
+
border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
|
|
73
|
+
background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));
|
|
74
|
+
box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
|
|
68
75
|
}
|
|
69
76
|
.card input {
|
|
70
77
|
width: 1rem;
|
|
71
78
|
height: 1rem;
|
|
72
79
|
margin-top: 0.25rem;
|
|
73
|
-
accent-color: var(--ui-primary, #4f46e5);
|
|
80
|
+
accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
|
|
74
81
|
cursor: pointer;
|
|
75
82
|
}
|
|
76
83
|
.card-label {
|
|
@@ -86,6 +93,9 @@ let RadioCards = class RadioCards extends LitElement {
|
|
|
86
93
|
outline: none;
|
|
87
94
|
box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
|
|
88
95
|
}
|
|
96
|
+
.card:has(input:checked):has(input:focus-visible) {
|
|
97
|
+
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);
|
|
98
|
+
}
|
|
89
99
|
.card:has(input:disabled) {
|
|
90
100
|
cursor: not-allowed;
|
|
91
101
|
opacity: 0.6;
|
package/dist/radio-cards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-cards.js","sourceRoot":"","sources":["../src/radio-cards.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB
|
|
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,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAA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ACF,CAAA;AAvCiC;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;AA9FnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAiItB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.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}\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 * The selected card'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-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 flex-wrap: wrap;\n }\n .card {\n flex: 1 1 11.25rem;\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border: 1px solid 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 .card: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 .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 @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 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\">\n ${repeat(\n this.options,\n (opt) => opt.value,\n (opt) => html`\n <label class=\"card\">\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>\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"]}
|
package/dist/radio-pills.d.ts
CHANGED
|
@@ -10,6 +10,12 @@ export interface RadioPillOption {
|
|
|
10
10
|
* native radio inputs for keyboard/a11y and fires `change` rather than
|
|
11
11
|
* relying on form submission.
|
|
12
12
|
*
|
|
13
|
+
* The selected pill's border/radio dot read `--ui-button-accent` (a solid
|
|
14
|
+
* stand-in, since `border-color`/`accent-color` can't render a gradient),
|
|
15
|
+
* and its background reads the shared `--ui-button-secondary-surface-muted`
|
|
16
|
+
* plus `--ui-button-highlight`, so a gradient theme tints it consistently
|
|
17
|
+
* with `button-group`/`pagination-nav`'s equivalents.
|
|
18
|
+
*
|
|
13
19
|
* @element radio-pills
|
|
14
20
|
* @fires change - A pill was selected; detail: { value }.
|
|
15
21
|
*/
|
|
@@ -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
|
|
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"}
|
package/dist/radio-pills.js
CHANGED
|
@@ -16,6 +16,12 @@ let instanceCount = 0;
|
|
|
16
16
|
* native radio inputs for keyboard/a11y and fires `change` rather than
|
|
17
17
|
* relying on form submission.
|
|
18
18
|
*
|
|
19
|
+
* The selected pill's border/radio dot read `--ui-button-accent` (a solid
|
|
20
|
+
* stand-in, since `border-color`/`accent-color` can't render a gradient),
|
|
21
|
+
* and its background reads the shared `--ui-button-secondary-surface-muted`
|
|
22
|
+
* plus `--ui-button-highlight`, so a gradient theme tints it consistently
|
|
23
|
+
* with `button-group`/`pagination-nav`'s equivalents.
|
|
24
|
+
*
|
|
19
25
|
* @element radio-pills
|
|
20
26
|
* @fires change - A pill was selected; detail: { value }.
|
|
21
27
|
*/
|
|
@@ -66,13 +72,14 @@ let RadioPills = class RadioPills extends LitElement {
|
|
|
66
72
|
color: var(--ui-text, #0f172a);
|
|
67
73
|
}
|
|
68
74
|
.pill:has(input:checked) {
|
|
69
|
-
border-color: var(--ui-primary, #4f46e5);
|
|
70
|
-
background: var(--ui-surface-muted, #f8fafc);
|
|
75
|
+
border-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
|
|
76
|
+
background: var(--ui-button-secondary-surface-muted, var(--ui-surface-muted, #f8fafc));
|
|
77
|
+
box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
|
|
71
78
|
}
|
|
72
79
|
.pill input {
|
|
73
80
|
width: 1rem;
|
|
74
81
|
height: 1rem;
|
|
75
|
-
accent-color: var(--ui-primary, #4f46e5);
|
|
82
|
+
accent-color: var(--ui-button-accent, var(--ui-primary, #4f46e5));
|
|
76
83
|
cursor: pointer;
|
|
77
84
|
margin: 0;
|
|
78
85
|
}
|
|
@@ -80,6 +87,9 @@ let RadioPills = class RadioPills extends LitElement {
|
|
|
80
87
|
outline: none;
|
|
81
88
|
box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
|
|
82
89
|
}
|
|
90
|
+
.pill:has(input:checked):has(input:focus-visible) {
|
|
91
|
+
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);
|
|
92
|
+
}
|
|
83
93
|
.pill:has(input:disabled) {
|
|
84
94
|
cursor: not-allowed;
|
|
85
95
|
opacity: 0.6;
|
package/dist/radio-pills.js.map
CHANGED
|
@@ -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
|
|
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,0BAA0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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: 1px solid var(--ui-border, #e2e8f0);\n border-radius: 999px;\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":"range-slider.d.ts","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIjE;;;;;;;;;;;;;;GAcG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"range-slider.d.ts","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIjE;;;;;;;;;;;;;;GAcG;AACH,qBACa,WAAY,SAAQ,UAAU;;IACzC,MAAM,CAAC,cAAc,UAAQ;IAE7B,OAAgB,MAAM,4BA2GpB;IAEF,qBAAqB;IACO,GAAG,SAAK;IACpC,qBAAqB;IACO,GAAG,SAAO;IACtC,sBAAsB;IACM,IAAI,SAAK;IACrC,qBAAqB;IACO,KAAK,SAAK;IACtC,2EAA2E;IAC9C,QAAQ,UAAS;IAC9C,uBAAuB;IACX,IAAI,SAAM;IAEb,OAAO,CAAC,aAAa,CAAS;IAevC,UAAmB,UAAU,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAG3D;IAED,0EAA0E;IAC1E,iBAAiB,IAAI,IAAI,CAExB;IAED,qDAAqD;IACrD,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAE5C;IAED,mEAAmE;IACnE,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,CAIrE;IAsBQ,MAAM,yCAcd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,cAAc,EAAE,WAAW,CAAC;KAC7B;CACF"}
|
package/dist/range-slider.js
CHANGED
|
@@ -65,10 +65,14 @@ let RangeSlider = class RangeSlider extends LitElement {
|
|
|
65
65
|
input[type="range"]::-webkit-slider-runnable-track {
|
|
66
66
|
height: 0.375rem;
|
|
67
67
|
border-radius: 9999px;
|
|
68
|
+
/* A hard-stop background gradient used as a two-tone fill trick —
|
|
69
|
+
its color-stops can't themselves hold a gradient value, so this
|
|
70
|
+
reads --ui-button-accent (a solid stand-in), not
|
|
71
|
+
--ui-button-background directly. */
|
|
68
72
|
background: linear-gradient(
|
|
69
73
|
to right,
|
|
70
|
-
var(--ui-primary, #4f46e5) 0%,
|
|
71
|
-
var(--ui-primary, #4f46e5) var(--range-percent, 0%),
|
|
74
|
+
var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%,
|
|
75
|
+
var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%),
|
|
72
76
|
var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),
|
|
73
77
|
var(--ui-surface-muted, #f8fafc) 100%
|
|
74
78
|
);
|
|
@@ -81,7 +85,7 @@ let RangeSlider = class RangeSlider extends LitElement {
|
|
|
81
85
|
input[type="range"]::-moz-range-progress {
|
|
82
86
|
height: 0.375rem;
|
|
83
87
|
border-radius: 9999px;
|
|
84
|
-
background: var(--ui-primary, #4f46e5);
|
|
88
|
+
background: var(--ui-button-accent, var(--ui-primary, #4f46e5));
|
|
85
89
|
}
|
|
86
90
|
/* Thumb */
|
|
87
91
|
input[type="range"]::-webkit-slider-thumb {
|
|
@@ -94,17 +98,17 @@ let RangeSlider = class RangeSlider extends LitElement {
|
|
|
94
98
|
A transform offset (not margin) so it isn't a spacing-grid value. */
|
|
95
99
|
transform: translateY(-0.3125rem);
|
|
96
100
|
border-radius: 50%;
|
|
97
|
-
background: var(--ui-primary, #4f46e5);
|
|
101
|
+
background: var(--ui-button-background, var(--ui-primary, #4f46e5));
|
|
98
102
|
border: 2px solid var(--ui-surface, #ffffff);
|
|
99
|
-
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
|
|
103
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);
|
|
100
104
|
}
|
|
101
105
|
input[type="range"]::-moz-range-thumb {
|
|
102
106
|
width: 1rem;
|
|
103
107
|
height: 1rem;
|
|
104
108
|
border-radius: 50%;
|
|
105
|
-
background: var(--ui-primary, #4f46e5);
|
|
109
|
+
background: var(--ui-button-background, var(--ui-primary, #4f46e5));
|
|
106
110
|
border: 2px solid var(--ui-surface, #ffffff);
|
|
107
|
-
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
|
|
111
|
+
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);
|
|
108
112
|
}
|
|
109
113
|
input[type="range"]:disabled::-webkit-slider-thumb {
|
|
110
114
|
background: var(--ui-text-muted, #64748b);
|
package/dist/range-slider.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;GAcG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAApC;;QA4GL,qBAAqB;QACO,QAAG,GAAG,CAAC,CAAC;QACpC,qBAAqB;QACO,QAAG,GAAG,GAAG,CAAC;QACtC,sBAAsB;QACM,SAAI,GAAG,CAAC,CAAC;QACrC,qBAAqB;QACO,UAAK,GAAG,CAAC,CAAC;QAC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,QAAQ,GAAG;cACtC,IAAI,CAAC,GAAG;cACR,IAAI,CAAC,GAAG;eACP,IAAI,CAAC,IAAI;iBACP,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,WAAW;iBACnB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;kBAC7B,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AApF6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAS;AAER;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAW;AAEV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAET;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAElC;IAAX,QAAQ,EAAE;yCAAW;AAEL;IAAhB,KAAK,EAAE;kDAA+B;AAzH5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAiMvB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A form-associated numeric range slider, usable standalone or inside a\n * native `<form>`. Wraps a native `<input type=\"range\">` (kept for its free\n * keyboard, drag, and screen-reader support) restyled to match this\n * package's track/fill visual language (`stat-meter`, `percent-bar-chart`)\n * instead of the browser-default appearance. Purely a value control — no\n * built-in label; wrap in `form-field` for a labeled field, or render a\n * value readout next to it (see the playground example), matching\n * `autocomplete-input`/`form-select`.\n *\n * @element range-slider\n * @fires input - Fires continuously while dragging/typing; detail: `{ value }`.\n * @fires change - Fires once the value is committed (drag released, arrow\n * key released); detail: `{ value }`.\n */\n@customElement(\"range-slider\")\nexport class RangeSlider extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n input[type=\"range\"] {\n -webkit-appearance: none;\n appearance: none;\n width: 100%;\n height: 2rem;\n margin: 0;\n background: transparent;\n cursor: pointer;\n }\n input[type=\"range\"]:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n /* Track */\n input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: linear-gradient(\n to right,\n var(--ui-primary, #4f46e5) 0%,\n var(--ui-primary, #4f46e5) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) 100%\n );\n }\n input[type=\"range\"]::-moz-range-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--ui-surface-muted, #f8fafc);\n }\n input[type=\"range\"]::-moz-range-progress {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--ui-primary, #4f46e5);\n }\n /* Thumb */\n input[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 1rem;\n height: 1rem;\n /* WebKit centers the thumb on the input's full 2rem box, not the\n thinner custom track — nudge it up to align with the track.\n A transform offset (not margin) so it isn't a spacing-grid value. */\n transform: translateY(-0.3125rem);\n border-radius: 50%;\n background: var(--ui-primary, #4f46e5);\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);\n }\n input[type=\"range\"]::-moz-range-thumb {\n width: 1rem;\n height: 1rem;\n border-radius: 50%;\n background: var(--ui-primary, #4f46e5);\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);\n }\n input[type=\"range\"]:disabled::-webkit-slider-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:disabled::-moz-range-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:focus-visible {\n outline: none;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input[type=\"range\"]:focus-visible::-moz-range-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: no-preference) {\n input[type=\"range\"]::-webkit-slider-thumb {\n transition: box-shadow 120ms ease;\n }\n input[type=\"range\"]::-moz-range-thumb {\n transition: box-shadow 120ms ease;\n }\n }\n @media (forced-colors: active) {\n input[type=\"range\"]::-webkit-slider-runnable-track {\n background: Canvas;\n border: 1px solid CanvasText;\n }\n input[type=\"range\"]::-webkit-slider-thumb {\n background: Highlight;\n border-color: Canvas;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Minimum value. */\n @property({ type: Number }) min = 0;\n /** Maximum value. */\n @property({ type: Number }) max = 100;\n /** Step increment. */\n @property({ type: Number }) step = 1;\n /** Current value. */\n @property({ type: Number }) value = 0;\n /** Disables interaction; merged with an ancestor `<fieldset disabled>`. */\n @property({ type: Boolean }) disabled = false;\n /** Form field name. */\n @property() name = \"\";\n\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValue = 0;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n get #percent(): number {\n const range = this.max - this.min || 1;\n return ((this.value - this.min) / range) * 100;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated) this.#defaultValue = this.value;\n if (changed.has(\"value\")) this.#internals.setFormValue(String(this.value));\n }\n\n /** Resets to the value present at first render, per the form contract. */\n formResetCallback(): void {\n this.value = this.#defaultValue;\n }\n\n /** Mirrors an ancestor fieldset's disabled state. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n }\n\n /** Restores the value from saved form state (bfcache/autofill). */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const parsed = Number(state);\n if (!Number.isNaN(parsed)) this.value = parsed;\n }\n\n // The native input's own \"input\"/\"change\" events are composed (cross the\n // shadow boundary) — stop them so only our re-dispatched CustomEvent\n // (carrying `detail.value`) reaches consumers, matching text-area.ts's fix\n // for the same issue. Otherwise the native event bubbles out afterwards\n // too, re-invoking the same listener with a plain Event whose `detail` is\n // undefined, crashing consumer code that reads `e.detail.value`.\n #onInput(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n #onChange(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <input\n type=\"range\"\n style=${`--range-percent: ${this.#percent}%`}\n min=${this.min}\n max=${this.max}\n step=${this.step}\n .value=${String(this.value)}\n ?disabled=${this.#isDisabled}\n @input=${(e: Event) => this.#onInput(e)}\n @change=${(e: Event) => this.#onChange(e)}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"range-slider\": RangeSlider;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"range-slider.js","sourceRoot":"","sources":["../src/range-slider.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;GAcG;A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,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAClH,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;;;gBAGC,oBAAoB,IAAI,CAAC,QAAQ,GAAG;cACtC,IAAI,CAAC,GAAG;cACR,IAAI,CAAC,GAAG;eACP,IAAI,CAAC,IAAI;iBACP,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;oBACf,IAAI,CAAC,WAAW;iBACnB,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;kBAC7B,CAAC,CAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;;KAE5C,CAAC;IACJ,CAAC;CACF,CAAA;AApF6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAS;AAER;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAAW;AAEV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAU;AAET;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAkB;AAElC;IAAX,QAAQ,EAAE;yCAAW;AAEL;IAAhB,KAAK,EAAE;kDAA+B;AA7H5B,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAqMvB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * A form-associated numeric range slider, usable standalone or inside a\n * native `<form>`. Wraps a native `<input type=\"range\">` (kept for its free\n * keyboard, drag, and screen-reader support) restyled to match this\n * package's track/fill visual language (`stat-meter`, `percent-bar-chart`)\n * instead of the browser-default appearance. Purely a value control — no\n * built-in label; wrap in `form-field` for a labeled field, or render a\n * value readout next to it (see the playground example), matching\n * `autocomplete-input`/`form-select`.\n *\n * @element range-slider\n * @fires input - Fires continuously while dragging/typing; detail: `{ value }`.\n * @fires change - Fires once the value is committed (drag released, arrow\n * key released); detail: `{ value }`.\n */\n@customElement(\"range-slider\")\nexport class RangeSlider extends LitElement {\n static formAssociated = true;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n input[type=\"range\"] {\n -webkit-appearance: none;\n appearance: none;\n width: 100%;\n height: 2rem;\n margin: 0;\n background: transparent;\n cursor: pointer;\n }\n input[type=\"range\"]:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n /* Track */\n input[type=\"range\"]::-webkit-slider-runnable-track {\n height: 0.375rem;\n border-radius: 9999px;\n /* A hard-stop background gradient used as a two-tone fill trick —\n its color-stops can't themselves hold a gradient value, so this\n reads --ui-button-accent (a solid stand-in), not\n --ui-button-background directly. */\n background: linear-gradient(\n to right,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) 0%,\n var(--ui-button-accent, var(--ui-primary, #4f46e5)) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) var(--range-percent, 0%),\n var(--ui-surface-muted, #f8fafc) 100%\n );\n }\n input[type=\"range\"]::-moz-range-track {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--ui-surface-muted, #f8fafc);\n }\n input[type=\"range\"]::-moz-range-progress {\n height: 0.375rem;\n border-radius: 9999px;\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n }\n /* Thumb */\n input[type=\"range\"]::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 1rem;\n height: 1rem;\n /* WebKit centers the thumb on the input's full 2rem box, not the\n thinner custom track — nudge it up to align with the track.\n A transform offset (not margin) so it isn't a spacing-grid value. */\n transform: translateY(-0.3125rem);\n border-radius: 50%;\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]::-moz-range-thumb {\n width: 1rem;\n height: 1rem;\n border-radius: 50%;\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n border: 2px solid var(--ui-surface, #ffffff);\n box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), var(--ui-button-highlight, 0 0 0 0 transparent);\n }\n input[type=\"range\"]:disabled::-webkit-slider-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:disabled::-moz-range-thumb {\n background: var(--ui-text-muted, #64748b);\n }\n input[type=\"range\"]:focus-visible {\n outline: none;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n input[type=\"range\"]:focus-visible::-moz-range-thumb {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (prefers-reduced-motion: no-preference) {\n input[type=\"range\"]::-webkit-slider-thumb {\n transition: box-shadow 120ms ease;\n }\n input[type=\"range\"]::-moz-range-thumb {\n transition: box-shadow 120ms ease;\n }\n }\n @media (forced-colors: active) {\n input[type=\"range\"]::-webkit-slider-runnable-track {\n background: Canvas;\n border: 1px solid CanvasText;\n }\n input[type=\"range\"]::-webkit-slider-thumb {\n background: Highlight;\n border-color: Canvas;\n }\n input[type=\"range\"]:focus-visible::-webkit-slider-thumb {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n }\n `,\n ];\n\n /** Minimum value. */\n @property({ type: Number }) min = 0;\n /** Maximum value. */\n @property({ type: Number }) max = 100;\n /** Step increment. */\n @property({ type: Number }) step = 1;\n /** Current value. */\n @property({ type: Number }) value = 0;\n /** Disables interaction; merged with an ancestor `<fieldset disabled>`. */\n @property({ type: Boolean }) disabled = false;\n /** Form field name. */\n @property() name = \"\";\n\n @state() private _formDisabled = false;\n\n #internals = this.attachInternals();\n #defaultValue = 0;\n\n /** Whether the host or an ancestor fieldset currently disables the control. */\n get #isDisabled(): boolean {\n return this.disabled || this._formDisabled;\n }\n\n get #percent(): number {\n const range = this.max - this.min || 1;\n return ((this.value - this.min) / range) * 100;\n }\n\n protected override willUpdate(changed: PropertyValues): void {\n if (!this.hasUpdated) this.#defaultValue = this.value;\n if (changed.has(\"value\")) this.#internals.setFormValue(String(this.value));\n }\n\n /** Resets to the value present at first render, per the form contract. */\n formResetCallback(): void {\n this.value = this.#defaultValue;\n }\n\n /** Mirrors an ancestor fieldset's disabled state. */\n formDisabledCallback(disabled: boolean): void {\n this._formDisabled = disabled;\n }\n\n /** Restores the value from saved form state (bfcache/autofill). */\n formStateRestoreCallback(state: string | File | FormData | null): void {\n if (typeof state !== \"string\") return;\n const parsed = Number(state);\n if (!Number.isNaN(parsed)) this.value = parsed;\n }\n\n // The native input's own \"input\"/\"change\" events are composed (cross the\n // shadow boundary) — stop them so only our re-dispatched CustomEvent\n // (carrying `detail.value`) reaches consumers, matching text-area.ts's fix\n // for the same issue. Otherwise the native event bubbles out afterwards\n // too, re-invoking the same listener with a plain Event whose `detail` is\n // undefined, crashing consumer code that reads `e.detail.value`.\n #onInput(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n #onChange(e: Event): void {\n e.stopPropagation();\n const input = e.target as HTMLInputElement;\n this.value = Number(input.value);\n this.dispatchEvent(new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }));\n }\n\n override render() {\n return html`\n <input\n type=\"range\"\n style=${`--range-percent: ${this.#percent}%`}\n min=${this.min}\n max=${this.max}\n step=${this.step}\n .value=${String(this.value)}\n ?disabled=${this.#isDisabled}\n @input=${(e: Event) => this.#onInput(e)}\n @change=${(e: Event) => this.#onChange(e)}\n />\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"range-slider\": RangeSlider;\n }\n}\n"]}
|
package/dist/reveal-button.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
/**
|
|
3
|
-
* Button that reveals hidden slotted content when clicked.
|
|
3
|
+
* Button that reveals hidden slotted content when clicked. Set `size="sm"`
|
|
4
|
+
* for a compact button one step below the default, matching `ui-button`'s
|
|
5
|
+
* `sm` size.
|
|
4
6
|
*
|
|
5
7
|
* @element reveal-button
|
|
6
8
|
*/
|
|
@@ -10,6 +12,8 @@ export declare class RevealButton extends LitElement {
|
|
|
10
12
|
label: string;
|
|
11
13
|
/** Disables revealing the slotted content. */
|
|
12
14
|
disabled: boolean;
|
|
15
|
+
/** Size — `sm` reduces the button's height/padding/font-size one step below the default. */
|
|
16
|
+
size: "sm" | "md";
|
|
13
17
|
private _reveal;
|
|
14
18
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
15
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reveal-button.d.ts","sourceRoot":"","sources":["../src/reveal-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C
|
|
1
|
+
{"version":3,"file":"reveal-button.d.ts","sourceRoot":"","sources":["../src/reveal-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAI5C;;;;;;GAMG;AACH,qBACa,YAAa,SAAQ,UAAU;IAC1C,OAAgB,MAAM,4BAkEpB;IAEF,qDAAqD;IAErD,KAAK,EAAE,MAAM,CAA2B;IACxC,8CAA8C;IACjB,QAAQ,UAAS;IAC9C,4FAA4F;IAC/D,IAAI,EAAE,IAAI,GAAG,IAAI,CAAQ;IAEtD,OAAO,CAAC,OAAO;IAQf,UAAmB,MAAM,yCAOxB;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|
package/dist/reveal-button.js
CHANGED
|
@@ -8,7 +8,9 @@ import { LitElement, css, html } from "lit";
|
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
9
|
import { tokens } from "./tokens.js";
|
|
10
10
|
/**
|
|
11
|
-
* Button that reveals hidden slotted content when clicked.
|
|
11
|
+
* Button that reveals hidden slotted content when clicked. Set `size="sm"`
|
|
12
|
+
* for a compact button one step below the default, matching `ui-button`'s
|
|
13
|
+
* `sm` size.
|
|
12
14
|
*
|
|
13
15
|
* @element reveal-button
|
|
14
16
|
*/
|
|
@@ -19,6 +21,8 @@ let RevealButton = class RevealButton extends LitElement {
|
|
|
19
21
|
this.label = "Reveal hidden content";
|
|
20
22
|
/** Disables revealing the slotted content. */
|
|
21
23
|
this.disabled = false;
|
|
24
|
+
/** Size — `sm` reduces the button's height/padding/font-size one step below the default. */
|
|
25
|
+
this.size = "md";
|
|
22
26
|
}
|
|
23
27
|
static { this.styles = [
|
|
24
28
|
tokens,
|
|
@@ -41,15 +45,22 @@ let RevealButton = class RevealButton extends LitElement {
|
|
|
41
45
|
font-weight: var(--ui-font-weight-medium, 500);
|
|
42
46
|
line-height: var(--ui-line-height-tight, 1.25);
|
|
43
47
|
height: 2rem;
|
|
44
|
-
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
background: var(--ui-button-background, var(--ui-primary, #4f46e5));
|
|
45
50
|
color: var(--ui-on-accent, #ffffff);
|
|
46
|
-
border:
|
|
51
|
+
border: 1px solid var(--ui-button-border, transparent);
|
|
47
52
|
border-radius: var(--ui-radius-sm, 0.25rem);
|
|
48
53
|
padding: 0.5rem 1rem;
|
|
49
54
|
cursor: pointer;
|
|
55
|
+
box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);
|
|
56
|
+
text-shadow: var(--ui-button-text-shadow, none);
|
|
50
57
|
}
|
|
51
58
|
button:hover:not(:disabled) {
|
|
52
|
-
background: var(--ui-primary-hover, #4338ca);
|
|
59
|
+
background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));
|
|
60
|
+
}
|
|
61
|
+
button:active:not(:disabled) {
|
|
62
|
+
background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));
|
|
63
|
+
box-shadow: none;
|
|
53
64
|
}
|
|
54
65
|
button:disabled {
|
|
55
66
|
cursor: not-allowed;
|
|
@@ -59,6 +70,14 @@ let RevealButton = class RevealButton extends LitElement {
|
|
|
59
70
|
outline: none;
|
|
60
71
|
box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
|
|
61
72
|
}
|
|
73
|
+
button:focus-visible:not(:active) {
|
|
74
|
+
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);
|
|
75
|
+
}
|
|
76
|
+
:host([size="sm"]) button {
|
|
77
|
+
height: 1.5rem;
|
|
78
|
+
padding: 0.25rem 0.5rem;
|
|
79
|
+
font-size: var(--ui-font-size-xs, 0.6875rem);
|
|
80
|
+
}
|
|
62
81
|
@media (forced-colors: active) {
|
|
63
82
|
button:focus-visible {
|
|
64
83
|
outline: 2px solid CanvasText;
|
|
@@ -95,6 +114,9 @@ __decorate([
|
|
|
95
114
|
__decorate([
|
|
96
115
|
property({ type: Boolean })
|
|
97
116
|
], RevealButton.prototype, "disabled", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
property({ reflect: true })
|
|
119
|
+
], RevealButton.prototype, "size", void 0);
|
|
98
120
|
RevealButton = __decorate([
|
|
99
121
|
customElement("reveal-button")
|
|
100
122
|
], RevealButton);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reveal-button.js","sourceRoot":"","sources":["../src/reveal-button.ts"],"names":[],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O,IAAI,CAAA;;wCAEyB,IAAI,CAAC,QAAQ,WAAW,IAAI,CAAC,OAAO;UAClE,IAAI,CAAC,KAAK;;KAEf,CAAC;IACJ,CAAC;CACF,CAAA;AAtBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACa;AAEX;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAA0B;AA3E3C,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA6FxB","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Button that reveals hidden slotted content when clicked. Set `size=\"sm\"`\n * for a compact button one step below the default, matching `ui-button`'s\n * `sm` size.\n *\n * @element reveal-button\n */\n@customElement(\"reveal-button\")\nexport class RevealButton extends LitElement {\n static override styles = [\n tokens,\n css`\n .hidden {\n display: none;\n }\n button {\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 font-weight: var(--ui-font-weight-medium, 500);\n line-height: var(--ui-line-height-tight, 1.25);\n height: 2rem;\n box-sizing: border-box;\n background: var(--ui-button-background, var(--ui-primary, #4f46e5));\n color: var(--ui-on-accent, #ffffff);\n border: 1px solid var(--ui-button-border, transparent);\n border-radius: var(--ui-radius-sm, 0.25rem);\n padding: 0.5rem 1rem;\n cursor: pointer;\n box-shadow: var(--ui-button-highlight, 0 0 0 0 transparent);\n text-shadow: var(--ui-button-text-shadow, none);\n }\n button:hover:not(:disabled) {\n background: var(--ui-button-background-hover, var(--ui-primary-hover, #4338ca));\n }\n button:active:not(:disabled) {\n background: var(--ui-button-background-active, var(--ui-button-background, var(--ui-primary, #4f46e5)));\n box-shadow: none;\n }\n button:disabled {\n cursor: not-allowed;\n opacity: 0.6;\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 :host([size=\"sm\"]) button {\n height: 1.5rem;\n padding: 0.25rem 0.5rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\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 opacity: 1;\n }\n }\n `,\n ];\n\n /** Label shown on the button before it's clicked. */\n @property({ type: String })\n label: string = \"Reveal hidden content\";\n /** Disables revealing the slotted content. */\n @property({ type: Boolean }) disabled = false;\n /** Size — `sm` reduces the button's height/padding/font-size one step below the default. */\n @property({ reflect: true }) size: \"sm\" | \"md\" = \"md\";\n\n private _reveal() {\n if (this.disabled) return;\n const div = this.shadowRoot!.querySelector(\"div\");\n const button = this.shadowRoot!.querySelector(\"button\");\n div?.classList.toggle(\"hidden\");\n button?.classList.toggle(\"hidden\");\n }\n\n protected override render() {\n return html`\n <div class=\"hidden\"><slot></slot></div>\n <button type=\"button\" ?disabled=${this.disabled} @click=${this._reveal}>\n ${this.label}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"reveal-button\": RevealButton;\n }\n}\n"]}
|
package/dist/tokens.css
CHANGED
|
@@ -2,10 +2,27 @@
|
|
|
2
2
|
color-scheme: light;
|
|
3
3
|
--ui-primary: #4f46e5;
|
|
4
4
|
--ui-primary-hover: #4338ca;
|
|
5
|
+
--ui-button-background: var(--ui-primary, #4f46e5);
|
|
6
|
+
--ui-button-background-hover: var(--ui-primary-hover, #4338ca);
|
|
7
|
+
--ui-button-background-active: var(--ui-button-background, var(--ui-primary, #4f46e5));
|
|
8
|
+
--ui-button-border: transparent;
|
|
9
|
+
--ui-button-secondary-background: none;
|
|
10
|
+
--ui-button-secondary-background-hover: none;
|
|
11
|
+
--ui-button-secondary-background-active: var(--ui-button-secondary-background, none);
|
|
12
|
+
--ui-button-secondary-border: var(--ui-border, #e2e8f0);
|
|
13
|
+
--ui-button-secondary-border-hover: var(--ui-text-muted, #64748b);
|
|
14
|
+
--ui-button-secondary-surface-muted: var(--ui-surface-muted, #f8fafc);
|
|
15
|
+
--ui-button-highlight: 0 0 0 0 transparent;
|
|
16
|
+
--ui-button-text-shadow: none;
|
|
17
|
+
--ui-button-accent: var(--ui-primary, #4f46e5);
|
|
5
18
|
--ui-info: #0ea5e9;
|
|
6
19
|
--ui-info-hover: #0284c7;
|
|
7
20
|
--ui-danger: #dc2626;
|
|
8
21
|
--ui-danger-hover: #b91c1c;
|
|
22
|
+
--ui-button-danger-background: var(--ui-danger, #dc2626);
|
|
23
|
+
--ui-button-danger-background-hover: var(--ui-danger-hover, #b91c1c);
|
|
24
|
+
--ui-button-danger-background-active: var(--ui-button-danger-background, var(--ui-danger, #dc2626));
|
|
25
|
+
--ui-button-danger-border: transparent;
|
|
9
26
|
--ui-success: #16a34a;
|
|
10
27
|
--ui-warning: #d97706;
|
|
11
28
|
--ui-warning-hover: #b45309;
|
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgH9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBlD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,MAAM,yBAAQ,CAAC"}
|
package/dist/tokens.js
CHANGED
|
@@ -11,10 +11,66 @@ export const tokenValues = {
|
|
|
11
11
|
// Colors
|
|
12
12
|
"--ui-primary": "#4f46e5", // indigo-600
|
|
13
13
|
"--ui-primary-hover": "#4338ca", // indigo-700
|
|
14
|
+
// Button-specific background/border hooks: default to the flat --ui-primary
|
|
15
|
+
// / --ui-danger tokens above unchanged, so those stay the single source of
|
|
16
|
+
// truth for every other component. Overriding just these lets a theme opt
|
|
17
|
+
// ui-button into a gradient (or any other) background without touching
|
|
18
|
+
// component markup; --ui-button-border/--ui-button-danger-border default
|
|
19
|
+
// to transparent (today's look) and are meant to be paired with a shade
|
|
20
|
+
// darker than the gradient's dark stop when one is set. The `-active`
|
|
21
|
+
// variants default to whatever `-background` already resolved to (so a
|
|
22
|
+
// solid override still applies while pressed) — a gradient theme should
|
|
23
|
+
// set them to the same stops in reverse, for a pressed/"indented" look.
|
|
24
|
+
"--ui-button-background": "var(--ui-primary, #4f46e5)",
|
|
25
|
+
"--ui-button-background-hover": "var(--ui-primary-hover, #4338ca)",
|
|
26
|
+
"--ui-button-background-active": "var(--ui-button-background, var(--ui-primary, #4f46e5))",
|
|
27
|
+
"--ui-button-border": "transparent",
|
|
28
|
+
// The bordered, transparent-background secondary variant's equivalents —
|
|
29
|
+
// shared with confirm-dialog's Cancel button, which is the same visual
|
|
30
|
+
// pattern. Defaults reproduce today's literal secondary styling exactly
|
|
31
|
+
// (no background at any state, border colors matching --ui-border /
|
|
32
|
+
// --ui-text-muted), so a theme only needs to override these to make
|
|
33
|
+
// secondary/Cancel buttons match a primary/danger gradient theme.
|
|
34
|
+
"--ui-button-secondary-background": "none",
|
|
35
|
+
"--ui-button-secondary-background-hover": "none",
|
|
36
|
+
"--ui-button-secondary-background-active": "var(--ui-button-secondary-background, none)",
|
|
37
|
+
"--ui-button-secondary-border": "var(--ui-border, #e2e8f0)",
|
|
38
|
+
"--ui-button-secondary-border-hover": "var(--ui-text-muted, #64748b)",
|
|
39
|
+
// A muted-gray surface used wherever something already paints
|
|
40
|
+
// --ui-surface-muted as a state indicator in flat mode — button-group's
|
|
41
|
+
// unchecked-segment hover, pagination-nav's button hover, and
|
|
42
|
+
// radio-cards/radio-pills' checked background — which is a genuinely
|
|
43
|
+
// different default than secondary's borderless flat hover, so it can't
|
|
44
|
+
// reuse --ui-button-secondary-background-hover's "none" default.
|
|
45
|
+
"--ui-button-secondary-surface-muted": "var(--ui-surface-muted, #f8fafc)",
|
|
46
|
+
// Shared by both primary/danger — a purely cosmetic gloss/legibility pair,
|
|
47
|
+
// not color-specific, so one token covers both variants. `-highlight` is a
|
|
48
|
+
// full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for
|
|
49
|
+
// a glossy top edge, defaulting to a fully transparent (so invisible)
|
|
50
|
+
// shadow rather than the keyword `none` — some usages combine it with
|
|
51
|
+
// another literal shadow in a comma-separated list, where a bare `none`
|
|
52
|
+
// item is invalid CSS and would zero out the *whole* declaration.
|
|
53
|
+
// `-text-shadow` is a full text-shadow value for label legibility against
|
|
54
|
+
// a gradient's lighter stop, always used standalone, so it keeps `none`.
|
|
55
|
+
"--ui-button-highlight": "0 0 0 0 transparent",
|
|
56
|
+
"--ui-button-text-shadow": "none",
|
|
57
|
+
// A solid stand-in for the same accent, for spots that can't render a
|
|
58
|
+
// background gradient at all — a native <input>'s accent-color only
|
|
59
|
+
// accepts a plain color, and a hard-stop background gradient (e.g.
|
|
60
|
+
// range-slider's filled track) can't nest another gradient inside its own
|
|
61
|
+
// color-stop list. Consumers that theme the buttons into a gradient should
|
|
62
|
+
// set this to the gradient's dark stop, so these non-button accents (radio
|
|
63
|
+
// selection indicators, the range-slider track/thumb) stay visually
|
|
64
|
+
// coordinated with it even though they can't literally paint a gradient.
|
|
65
|
+
"--ui-button-accent": "var(--ui-primary, #4f46e5)",
|
|
14
66
|
"--ui-info": "#0ea5e9", // sky-500
|
|
15
67
|
"--ui-info-hover": "#0284c7", // sky-600
|
|
16
68
|
"--ui-danger": "#dc2626", // red-600
|
|
17
69
|
"--ui-danger-hover": "#b91c1c", // red-700
|
|
70
|
+
"--ui-button-danger-background": "var(--ui-danger, #dc2626)",
|
|
71
|
+
"--ui-button-danger-background-hover": "var(--ui-danger-hover, #b91c1c)",
|
|
72
|
+
"--ui-button-danger-background-active": "var(--ui-button-danger-background, var(--ui-danger, #dc2626))",
|
|
73
|
+
"--ui-button-danger-border": "transparent",
|
|
18
74
|
"--ui-success": "#16a34a", // green-600
|
|
19
75
|
"--ui-warning": "#d97706", // amber-600
|
|
20
76
|
"--ui-warning-hover": "#b45309", // amber-700
|
package/dist/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,SAAS;IACT,cAAc,EAAE,SAAS,EAAE,aAAa;IACxC,oBAAoB,EAAE,SAAS,EAAE,aAAa;IAC9C,WAAW,EAAE,SAAS,EAAE,UAAU;IAClC,iBAAiB,EAAE,SAAS,EAAE,UAAU;IACxC,aAAa,EAAE,SAAS,EAAE,UAAU;IACpC,mBAAmB,EAAE,SAAS,EAAE,UAAU;IAC1C,cAAc,EAAE,SAAS,EAAE,YAAY;IACvC,cAAc,EAAE,SAAS,EAAE,YAAY;IACvC,oBAAoB,EAAE,SAAS,EAAE,YAAY;IAC7C,gBAAgB,EAAE,SAAS;IAC3B,WAAW,EAAE,SAAS,EAAE,YAAY;IACpC,iBAAiB,EAAE,SAAS,EAAE,YAAY;IAC1C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S,EAAE,UAAU;IAC1C,cAAc,EAAE,SAAS,EAAE,YAAY;IACvC,cAAc,EAAE,SAAS,EAAE,YAAY;IACvC,oBAAoB,EAAE,SAAS,EAAE,YAAY;IAC7C,gBAAgB,EAAE,SAAS;IAC3B,WAAW,EAAE,SAAS,EAAE,YAAY;IACpC,iBAAiB,EAAE,SAAS,EAAE,YAAY;IAC1C,aAAa,EAAE,SAAS,EAAE,YAAY;IACtC,cAAc,EAAE,SAAS,EAAE,YAAY;IACvC,oBAAoB,EAAE,SAAS,EAAE,YAAY;IAC7C,gBAAgB,EAAE,SAAS,EAAE,qDAAqD;IAClF,cAAc,EAAE,SAAS,EAAE,YAAY;IACvC,oBAAoB,EAAE,yBAAyB;IAC/C,cAAc,EAAE,mBAAmB,EAAE,kBAAkB;IACvD,iBAAiB,EAAE,kCAAkC;CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,EAAE,CAAC","sourcesContent":["import { css } from \"lit\";\n\n/**\n * Design token values, sourced from Tailwind v4's default theme palette.\n * Each entry maps a `--ui-*` custom property name to its default value.\n * These are the same values baked in as `var(--ui-*, <fallback>)` fallbacks\n * throughout component styles, so components render correctly with zero\n * external CSS. Consumers may override any of these by setting the custom\n * property on `:root` or an ancestor element (see `tokens.css`).\n */\nexport const tokenValues: Record<string, string> = {\n // Colors\n \"--ui-primary\": \"#4f46e5\", // indigo-600\n \"--ui-primary-hover\": \"#4338ca\", // indigo-700\n \"--ui-info\": \"#0ea5e9\", // sky-500\n \"--ui-info-hover\": \"#0284c7\", // sky-600\n \"--ui-danger\": \"#dc2626\", // red-600\n \"--ui-danger-hover\": \"#b91c1c\", // red-700\n \"--ui-success\": \"#16a34a\", // green-600\n \"--ui-warning\": \"#d97706\", // amber-600\n \"--ui-warning-hover\": \"#b45309\", // amber-700\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#0f172a\", // slate-900\n \"--ui-text-muted\": \"#64748b\", // slate-500\n \"--ui-border\": \"#e2e8f0\", // slate-200\n \"--ui-surface\": \"#ffffff\", // white\n \"--ui-surface-muted\": \"#f8fafc\", // slate-50\n \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash\n \"--ui-tooltip\": \"#0f172a\", // slate-900\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\",\n \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45%\n\n // Shape / depth\n \"--ui-radius\": \"0.5rem\", // rounded-lg\n \"--ui-radius-sm\": \"0.25rem\", // rounded\n \"--ui-shadow\":\n \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md\n \"--ui-shadow-lg\":\n \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl\n \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\",\n\n // Type\n \"--ui-font\":\n 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"',\n \"--ui-font-mono\":\n \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\",\n \"--ui-font-size-lg\": \"1rem\", // text-base\n \"--ui-font-size\": \"0.875rem\", // text-sm\n \"--ui-font-size-sm\": \"0.75rem\", // text-xs\n \"--ui-font-size-xs\": \"0.6875rem\",\n\n // Font weights — the only four weights the system uses.\n \"--ui-font-weight-regular\": \"400\",\n \"--ui-font-weight-medium\": \"500\",\n \"--ui-font-weight-semibold\": \"600\",\n \"--ui-font-weight-bold\": \"700\",\n\n // Line heights — glyph (icon/marker box), tight (headings), normal (body).\n \"--ui-line-height-glyph\": \"1\",\n \"--ui-line-height-tight\": \"1.25\",\n \"--ui-line-height-normal\": \"1.5\",\n\n // Letter spacing / tracking — default and the single widened step.\n \"--ui-tracking-normal\": \"0\",\n \"--ui-tracking-wide\": \"0.04em\",\n};\n\n/**\n * Dark-mode overrides for the same `--ui-*` custom properties, applied by\n * `tokens.css` via `@media (prefers-color-scheme: dark)` and `[data-theme]`\n * (see generate-tokens-css.mjs). Same Tailwind slate scale as the light\n * palette, inverted, with primary/danger/success lightened one step (500\n * instead of 600) for sufficient contrast against dark surfaces. Shape/type\n * tokens are theme-independent and not repeated here.\n */\nexport const darkTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#6366f1\", // indigo-500\n \"--ui-primary-hover\": \"#818cf8\", // indigo-400\n \"--ui-info\": \"#38bdf8\", // sky-400\n \"--ui-info-hover\": \"#7dd3fc\", // sky-300\n \"--ui-danger\": \"#ef4444\", // red-500\n \"--ui-danger-hover\": \"#f87171\", // red-400\n \"--ui-success\": \"#22c55e\", // green-500\n \"--ui-warning\": \"#f59e0b\", // amber-500\n \"--ui-warning-hover\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#f1f5f9\", // slate-100\n \"--ui-text-muted\": \"#94a3b8\", // slate-400\n \"--ui-border\": \"#334155\", // slate-700\n \"--ui-surface\": \"#0f172a\", // slate-900\n \"--ui-surface-muted\": \"#1e293b\", // slate-800\n \"--ui-highlight\": \"#854d0e\", // amber-800 — transient \"just changed\" flash on dark\n \"--ui-tooltip\": \"#020617\", // slate-950\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.12)\",\n \"--ui-overlay\": \"rgb(2 6 23 / 0.6)\", // slate-950 / 60%\n \"--ui-focus-ring\": \"0 0 0 3px rgb(99 102 241 / 0.45)\",\n};\n\n/**\n * Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,\n * re-declaring every token on each component's own host element as a\n * \"materialize the inherited value, or this fallback\" trick. That pattern\n * turned out to be a genuine bug, not a working default: browsers treat\n * `--ui-x: var(--ui-x, ...)` on `:host` as a self-referencing declaration\n * that computes to the guaranteed-invalid value REGARDLESS of what an\n * ancestor (e.g. `:root`) set — the host's own `:host` rule wins the cascade\n * over the ancestor's, so this dropped whatever the app actually set and\n * silently substituted the component's own fallback everywhere. It went\n * unnoticed because every component's fallback happened to equal the\n * intended light-mode value — dark mode (a real, different value at\n * `:root`) exposed it immediately (colors rendering as if no theme were\n * applied at all). Fix: don't redeclare tokens on `:host` — plain\n * inheritance already carries `:root`'s values into every shadow root\n * correctly, and every component already has its own `var(--ui-x, fallback)`\n * at each point of use, so nothing here is needed for the \"zero external\n * CSS\" default to keep working. Kept as an empty export so the existing\n * `static override styles = [tokens, css\\`...\\`]` import in every component\n * keeps compiling.\n */\nexport const tokens = css``;\n"]}
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAA2B;IACjD,SAAS;IACT,cAAc,EAAE,SAAS,EAAE,aAAa;IACxC,oBAAoB,EAAE,SAAS,EAAE,aAAa;IAC9C,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,uEAAuE;IACvE,yEAAyE;IACzE,wEAAwE;IACxE,sEAAsE;IACtE,uEAAuE;IACvE,wEAAwE;IACxE,wEAAwE;IACxE,wBAAwB,EAAE,4BAA4B;IACtD,8BAA8B,EAAE,kCAAkC;IAClE,+BAA+B,EAAE,yDAAyD;IAC1F,oBAAoB,EAAE,aAAa;IACnC,yEAAyE;IACzE,uEAAuE;IACvE,wEAAwE;IACxE,oEAAoE;IACpE,oEAAoE;IACpE,kEAAkE;IAClE,kCAAkC,EAAE,MAAM;IAC1C,wCAAwC,EAAE,MAAM;IAChD,yCAAyC,EAAE,6CAA6C;IACxF,8BAA8B,EAAE,2BAA2B;IAC3D,oCAAoC,EAAE,+BAA+B;IACrE,8DAA8D;IAC9D,wEAAwE;IACxE,8DAA8D;IAC9D,qEAAqE;IACrE,wEAAw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E,SAAS,EAAE,qDAAqD;IAClF,cAAc,EAAE,SAAS,EAAE,YAAY;IACvC,oBAAoB,EAAE,yBAAyB;IAC/C,cAAc,EAAE,mBAAmB,EAAE,kBAAkB;IACvD,iBAAiB,EAAE,kCAAkC;CACtD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,EAAE,CAAC","sourcesContent":["import { css } from \"lit\";\n\n/**\n * Design token values, sourced from Tailwind v4's default theme palette.\n * Each entry maps a `--ui-*` custom property name to its default value.\n * These are the same values baked in as `var(--ui-*, <fallback>)` fallbacks\n * throughout component styles, so components render correctly with zero\n * external CSS. Consumers may override any of these by setting the custom\n * property on `:root` or an ancestor element (see `tokens.css`).\n */\nexport const tokenValues: Record<string, string> = {\n // Colors\n \"--ui-primary\": \"#4f46e5\", // indigo-600\n \"--ui-primary-hover\": \"#4338ca\", // indigo-700\n // Button-specific background/border hooks: default to the flat --ui-primary\n // / --ui-danger tokens above unchanged, so those stay the single source of\n // truth for every other component. Overriding just these lets a theme opt\n // ui-button into a gradient (or any other) background without touching\n // component markup; --ui-button-border/--ui-button-danger-border default\n // to transparent (today's look) and are meant to be paired with a shade\n // darker than the gradient's dark stop when one is set. The `-active`\n // variants default to whatever `-background` already resolved to (so a\n // solid override still applies while pressed) — a gradient theme should\n // set them to the same stops in reverse, for a pressed/\"indented\" look.\n \"--ui-button-background\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-button-background-hover\": \"var(--ui-primary-hover, #4338ca)\",\n \"--ui-button-background-active\": \"var(--ui-button-background, var(--ui-primary, #4f46e5))\",\n \"--ui-button-border\": \"transparent\",\n // The bordered, transparent-background secondary variant's equivalents —\n // shared with confirm-dialog's Cancel button, which is the same visual\n // pattern. Defaults reproduce today's literal secondary styling exactly\n // (no background at any state, border colors matching --ui-border /\n // --ui-text-muted), so a theme only needs to override these to make\n // secondary/Cancel buttons match a primary/danger gradient theme.\n \"--ui-button-secondary-background\": \"none\",\n \"--ui-button-secondary-background-hover\": \"none\",\n \"--ui-button-secondary-background-active\": \"var(--ui-button-secondary-background, none)\",\n \"--ui-button-secondary-border\": \"var(--ui-border, #e2e8f0)\",\n \"--ui-button-secondary-border-hover\": \"var(--ui-text-muted, #64748b)\",\n // A muted-gray surface used wherever something already paints\n // --ui-surface-muted as a state indicator in flat mode — button-group's\n // unchecked-segment hover, pagination-nav's button hover, and\n // radio-cards/radio-pills' checked background — which is a genuinely\n // different default than secondary's borderless flat hover, so it can't\n // reuse --ui-button-secondary-background-hover's \"none\" default.\n \"--ui-button-secondary-surface-muted\": \"var(--ui-surface-muted, #f8fafc)\",\n // Shared by both primary/danger — a purely cosmetic gloss/legibility pair,\n // not color-specific, so one token covers both variants. `-highlight` is a\n // full box-shadow value (e.g. `inset 0 1px 0 rgb(255 255 255 / 0.35)`) for\n // a glossy top edge, defaulting to a fully transparent (so invisible)\n // shadow rather than the keyword `none` — some usages combine it with\n // another literal shadow in a comma-separated list, where a bare `none`\n // item is invalid CSS and would zero out the *whole* declaration.\n // `-text-shadow` is a full text-shadow value for label legibility against\n // a gradient's lighter stop, always used standalone, so it keeps `none`.\n \"--ui-button-highlight\": \"0 0 0 0 transparent\",\n \"--ui-button-text-shadow\": \"none\",\n // A solid stand-in for the same accent, for spots that can't render a\n // background gradient at all — a native <input>'s accent-color only\n // accepts a plain color, and a hard-stop background gradient (e.g.\n // range-slider's filled track) can't nest another gradient inside its own\n // color-stop list. Consumers that theme the buttons into a gradient should\n // set this to the gradient's dark stop, so these non-button accents (radio\n // selection indicators, the range-slider track/thumb) stay visually\n // coordinated with it even though they can't literally paint a gradient.\n \"--ui-button-accent\": \"var(--ui-primary, #4f46e5)\",\n \"--ui-info\": \"#0ea5e9\", // sky-500\n \"--ui-info-hover\": \"#0284c7\", // sky-600\n \"--ui-danger\": \"#dc2626\", // red-600\n \"--ui-danger-hover\": \"#b91c1c\", // red-700\n \"--ui-button-danger-background\": \"var(--ui-danger, #dc2626)\",\n \"--ui-button-danger-background-hover\": \"var(--ui-danger-hover, #b91c1c)\",\n \"--ui-button-danger-background-active\":\n \"var(--ui-button-danger-background, var(--ui-danger, #dc2626))\",\n \"--ui-button-danger-border\": \"transparent\",\n \"--ui-success\": \"#16a34a\", // green-600\n \"--ui-warning\": \"#d97706\", // amber-600\n \"--ui-warning-hover\": \"#b45309\", // amber-700\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#0f172a\", // slate-900\n \"--ui-text-muted\": \"#64748b\", // slate-500\n \"--ui-border\": \"#e2e8f0\", // slate-200\n \"--ui-surface\": \"#ffffff\", // white\n \"--ui-surface-muted\": \"#f8fafc\", // slate-50\n \"--ui-highlight\": \"#fde68a\", // amber-200 — transient \"just changed\" flash\n \"--ui-tooltip\": \"#0f172a\", // slate-900\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.32)\",\n \"--ui-overlay\": \"rgb(15 23 42 / 0.45)\", // slate-900 / 45%\n\n // Shape / depth\n \"--ui-radius\": \"0.5rem\", // rounded-lg\n \"--ui-radius-sm\": \"0.25rem\", // rounded\n \"--ui-shadow\":\n \"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)\", // shadow-md\n \"--ui-shadow-lg\":\n \"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)\", // shadow-xl\n \"--ui-focus-ring\": \"0 0 0 3px rgb(79 70 229 / 0.35)\",\n\n // Type\n \"--ui-font\":\n 'ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"',\n \"--ui-font-mono\":\n \"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace\",\n \"--ui-font-size-lg\": \"1rem\", // text-base\n \"--ui-font-size\": \"0.875rem\", // text-sm\n \"--ui-font-size-sm\": \"0.75rem\", // text-xs\n \"--ui-font-size-xs\": \"0.6875rem\",\n\n // Font weights — the only four weights the system uses.\n \"--ui-font-weight-regular\": \"400\",\n \"--ui-font-weight-medium\": \"500\",\n \"--ui-font-weight-semibold\": \"600\",\n \"--ui-font-weight-bold\": \"700\",\n\n // Line heights — glyph (icon/marker box), tight (headings), normal (body).\n \"--ui-line-height-glyph\": \"1\",\n \"--ui-line-height-tight\": \"1.25\",\n \"--ui-line-height-normal\": \"1.5\",\n\n // Letter spacing / tracking — default and the single widened step.\n \"--ui-tracking-normal\": \"0\",\n \"--ui-tracking-wide\": \"0.04em\",\n};\n\n/**\n * Dark-mode overrides for the same `--ui-*` custom properties, applied by\n * `tokens.css` via `@media (prefers-color-scheme: dark)` and `[data-theme]`\n * (see generate-tokens-css.mjs). Same Tailwind slate scale as the light\n * palette, inverted, with primary/danger/success lightened one step (500\n * instead of 600) for sufficient contrast against dark surfaces. Shape/type\n * tokens are theme-independent and not repeated here.\n */\nexport const darkTokenValues: Record<string, string> = {\n \"--ui-primary\": \"#6366f1\", // indigo-500\n \"--ui-primary-hover\": \"#818cf8\", // indigo-400\n \"--ui-info\": \"#38bdf8\", // sky-400\n \"--ui-info-hover\": \"#7dd3fc\", // sky-300\n \"--ui-danger\": \"#ef4444\", // red-500\n \"--ui-danger-hover\": \"#f87171\", // red-400\n \"--ui-success\": \"#22c55e\", // green-500\n \"--ui-warning\": \"#f59e0b\", // amber-500\n \"--ui-warning-hover\": \"#fbbf24\", // amber-400\n \"--ui-on-accent\": \"#ffffff\",\n \"--ui-text\": \"#f1f5f9\", // slate-100\n \"--ui-text-muted\": \"#94a3b8\", // slate-400\n \"--ui-border\": \"#334155\", // slate-700\n \"--ui-surface\": \"#0f172a\", // slate-900\n \"--ui-surface-muted\": \"#1e293b\", // slate-800\n \"--ui-highlight\": \"#854d0e\", // amber-800 — transient \"just changed\" flash on dark\n \"--ui-tooltip\": \"#020617\", // slate-950\n \"--ui-hover-overlay\": \"rgb(255 255 255 / 0.12)\",\n \"--ui-overlay\": \"rgb(2 6 23 / 0.6)\", // slate-950 / 60%\n \"--ui-focus-ring\": \"0 0 0 3px rgb(99 102 241 / 0.45)\",\n};\n\n/**\n * Historically a shared `:host { --ui-x: var(--ui-x, fallback); } ` block,\n * re-declaring every token on each component's own host element as a\n * \"materialize the inherited value, or this fallback\" trick. That pattern\n * turned out to be a genuine bug, not a working default: browsers treat\n * `--ui-x: var(--ui-x, ...)` on `:host` as a self-referencing declaration\n * that computes to the guaranteed-invalid value REGARDLESS of what an\n * ancestor (e.g. `:root`) set — the host's own `:host` rule wins the cascade\n * over the ancestor's, so this dropped whatever the app actually set and\n * silently substituted the component's own fallback everywhere. It went\n * unnoticed because every component's fallback happened to equal the\n * intended light-mode value — dark mode (a real, different value at\n * `:root`) exposed it immediately (colors rendering as if no theme were\n * applied at all). Fix: don't redeclare tokens on `:host` — plain\n * inheritance already carries `:root`'s values into every shadow root\n * correctly, and every component already has its own `var(--ui-x, fallback)`\n * at each point of use, so nothing here is needed for the \"zero external\n * CSS\" default to keep working. Kept as an empty export so the existing\n * `static override styles = [tokens, css\\`...\\`]` import in every component\n * keeps compiling.\n */\nexport const tokens = css``;\n"]}
|
package/dist/ui-button.d.ts
CHANGED
|
@@ -14,6 +14,22 @@ export type ButtonVariant = "primary" | "secondary" | "danger";
|
|
|
14
14
|
* is instead wired through `ElementInternals.form` — the same mechanism
|
|
15
15
|
* `address-autocomplete` uses to associate with an ancestor form.
|
|
16
16
|
*
|
|
17
|
+
* `primary`/`danger` backgrounds read `--ui-button-background`/
|
|
18
|
+
* `--ui-button-danger-background` (and their `-hover`/`-active`
|
|
19
|
+
* counterparts), which default to the flat `--ui-primary`/`--ui-danger`
|
|
20
|
+
* tokens unchanged — so `--ui-primary`/`--ui-danger` stay the single source
|
|
21
|
+
* of truth for every other component. A consumer can override just these
|
|
22
|
+
* button-specific tokens with a `linear-gradient(...)` to opt every
|
|
23
|
+
* `ui-button` into a gradient look without touching component markup,
|
|
24
|
+
* pairing it with `--ui-button-border`/`--ui-button-danger-border` (default
|
|
25
|
+
* `transparent`) for a defining edge a shade darker than the gradient's dark
|
|
26
|
+
* stop, and setting the `-active` variant's stops in reverse for a
|
|
27
|
+
* pressed/"indented" look while the button is held down. `secondary`'s
|
|
28
|
+
* background/border read the equivalent `--ui-button-secondary-*` tokens
|
|
29
|
+
* (shared with `confirm-dialog`'s Cancel button), defaulting to today's
|
|
30
|
+
* transparent/bordered look, so it can be themed into a matching (e.g.
|
|
31
|
+
* white-to-gray) gradient too.
|
|
32
|
+
*
|
|
17
33
|
* @element ui-button
|
|
18
34
|
* @slot icon - Optional leading icon (e.g. an inline SVG).
|
|
19
35
|
* @slot - Button label.
|