@f-ewald/components 1.30.1 → 1.32.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 +2 -0
- package/custom-elements.json +275 -1
- package/dist/address-autocomplete.js +1 -1
- package/dist/address-autocomplete.js.map +1 -1
- package/dist/autocomplete-input.js +1 -1
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/form-field.d.ts.map +1 -1
- package/dist/form-field.js +81 -13
- package/dist/form-field.js.map +1 -1
- package/dist/form-select.js +3 -3
- package/dist/form-select.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/multi-select.js +3 -3
- package/dist/multi-select.js.map +1 -1
- package/dist/progress-bar.d.ts +31 -0
- package/dist/progress-bar.d.ts.map +1 -0
- package/dist/progress-bar.js +128 -0
- package/dist/progress-bar.js.map +1 -0
- package/dist/radio-cards.d.ts +19 -0
- package/dist/radio-cards.d.ts.map +1 -1
- package/dist/radio-cards.js +62 -4
- package/dist/radio-cards.js.map +1 -1
- package/dist/text-area.js +3 -3
- package/dist/text-area.js.map +1 -1
- package/dist/ui-admonition.d.ts +33 -0
- package/dist/ui-admonition.d.ts.map +1 -0
- package/dist/ui-admonition.js +147 -0
- package/dist/ui-admonition.js.map +1 -0
- package/docs/address-autocomplete.md +1 -0
- package/docs/autocomplete-input.md +1 -0
- package/docs/form-field.md +2 -0
- package/docs/form-select.md +1 -1
- package/docs/multi-select.md +1 -0
- package/docs/progress-bar.md +51 -0
- package/docs/radio-cards.md +9 -0
- package/docs/text-area.md +1 -0
- package/docs/ui-admonition.md +55 -0
- package/llms.txt +59 -7
- package/package.json +1 -1
package/dist/radio-cards.js
CHANGED
|
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { LitElement, css, html, nothing } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
9
10
|
import { repeat } from "lit/directives/repeat.js";
|
|
10
11
|
import { tokens } from "./tokens.js";
|
|
11
12
|
let instanceCount = 0;
|
|
@@ -26,6 +27,13 @@ let instanceCount = 0;
|
|
|
26
27
|
* the same hue and gradient, just lighter on light themes (and
|
|
27
28
|
* correspondingly deeper on dark ones) than on a button.
|
|
28
29
|
*
|
|
30
|
+
* `layout` controls how cards flow ("mixed" wraps with per-option
|
|
31
|
+
* `fullWidth` rows, "vertical" stacks one per row, "horizontal" stays
|
|
32
|
+
* side-by-side at every width). `hideInput` visually hides the radio dot via
|
|
33
|
+
* the same `sr-only` clip pattern as `ui-checkbox` — the native input stays
|
|
34
|
+
* in the DOM for keyboard/a11y, and the card's own border/tint carries the
|
|
35
|
+
* selected state instead.
|
|
36
|
+
*
|
|
29
37
|
* @element radio-cards
|
|
30
38
|
* @fires change - A card was selected; detail: { value }.
|
|
31
39
|
*/
|
|
@@ -38,6 +46,16 @@ let RadioCards = class RadioCards extends LitElement {
|
|
|
38
46
|
this.value = "";
|
|
39
47
|
/** Disables every native radio in the group. */
|
|
40
48
|
this.disabled = false;
|
|
49
|
+
/**
|
|
50
|
+
* How the cards flow.
|
|
51
|
+
* - "mixed" (default): cards wrap onto as many rows as fit; options marked
|
|
52
|
+
* `fullWidth` take a row of their own.
|
|
53
|
+
* - "vertical": one full-width card per row, never side by side.
|
|
54
|
+
* - "horizontal": every card on one row, equal widths, no wrapping.
|
|
55
|
+
*/
|
|
56
|
+
this.layout = "mixed";
|
|
57
|
+
/** Visually hides the radio dot; the card's own border/tint carries the selected state. */
|
|
58
|
+
this.hideInput = false;
|
|
41
59
|
this.#name = `radio-cards-${++instanceCount}`;
|
|
42
60
|
}
|
|
43
61
|
static { this.styles = [
|
|
@@ -49,13 +67,34 @@ let RadioCards = class RadioCards extends LitElement {
|
|
|
49
67
|
.options {
|
|
50
68
|
display: flex;
|
|
51
69
|
gap: 0.5rem;
|
|
70
|
+
}
|
|
71
|
+
.options.mixed {
|
|
52
72
|
flex-wrap: wrap;
|
|
53
73
|
}
|
|
54
|
-
.card {
|
|
74
|
+
.options.mixed .card {
|
|
55
75
|
flex: 1 1 11.25rem;
|
|
76
|
+
}
|
|
77
|
+
.options.mixed .card.full {
|
|
78
|
+
flex: 1 0 100%;
|
|
79
|
+
}
|
|
80
|
+
.options.vertical {
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
}
|
|
83
|
+
.options.vertical .card {
|
|
84
|
+
flex: 0 0 auto;
|
|
85
|
+
}
|
|
86
|
+
.options.horizontal {
|
|
87
|
+
flex-wrap: nowrap;
|
|
88
|
+
}
|
|
89
|
+
.options.horizontal .card {
|
|
90
|
+
flex: 1 1 0;
|
|
91
|
+
min-width: 0;
|
|
92
|
+
}
|
|
93
|
+
.card {
|
|
56
94
|
display: flex;
|
|
57
95
|
align-items: flex-start;
|
|
58
96
|
gap: 0.5rem;
|
|
97
|
+
box-sizing: border-box;
|
|
59
98
|
border: 1px solid var(--ui-border, #e2e8f0);
|
|
60
99
|
border-radius: var(--ui-radius-sm, 0.25rem);
|
|
61
100
|
padding: 0.5rem 0.75rem;
|
|
@@ -120,6 +159,18 @@ let RadioCards = class RadioCards extends LitElement {
|
|
|
120
159
|
.card:has(input:disabled) input {
|
|
121
160
|
cursor: not-allowed;
|
|
122
161
|
}
|
|
162
|
+
.card input.sr-only {
|
|
163
|
+
position: absolute;
|
|
164
|
+
width: 1px;
|
|
165
|
+
height: 1px;
|
|
166
|
+
margin: -1px;
|
|
167
|
+
padding: 0;
|
|
168
|
+
overflow: hidden;
|
|
169
|
+
clip: rect(0 0 0 0);
|
|
170
|
+
clip-path: inset(50%);
|
|
171
|
+
white-space: nowrap;
|
|
172
|
+
border: 0;
|
|
173
|
+
}
|
|
123
174
|
@media (forced-colors: active) {
|
|
124
175
|
.card:has(input:focus-visible) {
|
|
125
176
|
outline: 2px solid CanvasText;
|
|
@@ -149,13 +200,14 @@ let RadioCards = class RadioCards extends LitElement {
|
|
|
149
200
|
}
|
|
150
201
|
render() {
|
|
151
202
|
return html `
|
|
152
|
-
<div class="options">
|
|
203
|
+
<div class="options ${this.layout}">
|
|
153
204
|
${repeat(this.options, (opt) => opt.value, (opt) => html `
|
|
154
|
-
<label class
|
|
205
|
+
<label class=${classMap({ card: true, full: this.layout === "mixed" && !!opt.fullWidth })}>
|
|
155
206
|
<input
|
|
156
207
|
type="radio"
|
|
208
|
+
class=${classMap({ "sr-only": this.hideInput })}
|
|
157
209
|
name=${this.#name}
|
|
158
|
-
|
|
210
|
+
.checked=${this.value === opt.value}
|
|
159
211
|
?disabled=${this.disabled}
|
|
160
212
|
@change=${() => this._onChange(opt.value)}
|
|
161
213
|
/>
|
|
@@ -178,6 +230,12 @@ __decorate([
|
|
|
178
230
|
__decorate([
|
|
179
231
|
property({ type: Boolean })
|
|
180
232
|
], RadioCards.prototype, "disabled", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
property()
|
|
235
|
+
], RadioCards.prototype, "layout", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
property({ type: Boolean, attribute: "hide-input" })
|
|
238
|
+
], RadioCards.prototype, "hideInput", void 0);
|
|
181
239
|
RadioCards = __decorate([
|
|
182
240
|
customElement("radio-cards")
|
|
183
241
|
], RadioCards);
|
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,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,CAAC,CAAC,IAAI,CAAA,kCAAkC,GAAG,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;WAGjG,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,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;AA3GnC,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA8ItB","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. That shared value is\n * tuned for small controls, so a card — with far more area — blends it 45%\n * toward `--ui-surface` rather than taking a second token: the tint stays\n * the same hue and gradient, just lighter on light themes (and\n * correspondingly deeper on dark ones) than on a button.\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 /* 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 @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"]}
|
|
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,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AI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;;;wBAG7E,QAAQ,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;uBACxC,IAAI,CAAC,KAAK;2BACN,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK;4BACvB,IAAI,CAAC,QAAQ;0BACf,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC;;;2CAGd,GAAG,CAAC,KAAK;kBAClC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA,kCAAkC,GAAG,CAAC,WAAW,SAAS,CAAC,CAAC,CAAC,OAAO;;;WAGjG,CACF;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAlDiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2CAAiC;AAEpD;IAAX,QAAQ,EAAE;yCAAY;AAEM;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAkB;AAQlC;IAAX,QAAQ,EAAE;0CAAuD;AAEZ;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;6CAAmB;AAtJ7D,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CA0LtB","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 * 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. That shared value is\n * tuned for small controls, so a card — with far more area — blends it 45%\n * toward `--ui-surface` rather than taking a second token: the tint stays\n * the same hue and gradient, just lighter on light themes (and\n * correspondingly 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 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 /* 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"]}
|
package/dist/text-area.js
CHANGED
|
@@ -68,7 +68,7 @@ let TextArea = class TextArea extends LitElement {
|
|
|
68
68
|
"Segoe UI Symbol",
|
|
69
69
|
"Noto Color Emoji"
|
|
70
70
|
);
|
|
71
|
-
font-size: var(--ui-font-size
|
|
71
|
+
font-size: var(--ui-font-size, 0.875rem);
|
|
72
72
|
line-height: var(--ui-line-height-normal, 1.5);
|
|
73
73
|
color: var(--ui-text, #0f172a);
|
|
74
74
|
background: var(--ui-surface, #ffffff);
|
|
@@ -79,7 +79,7 @@ let TextArea = class TextArea extends LitElement {
|
|
|
79
79
|
}
|
|
80
80
|
.floating-label {
|
|
81
81
|
position: absolute;
|
|
82
|
-
top: 0.
|
|
82
|
+
top: 0.25rem;
|
|
83
83
|
left: 0.75rem;
|
|
84
84
|
right: 0.75rem;
|
|
85
85
|
z-index: 1;
|
|
@@ -110,7 +110,7 @@ let TextArea = class TextArea extends LitElement {
|
|
|
110
110
|
}
|
|
111
111
|
.field-shell.floating textarea {
|
|
112
112
|
min-height: 3rem;
|
|
113
|
-
padding-top: 1.
|
|
113
|
+
padding-top: 1.5rem;
|
|
114
114
|
}
|
|
115
115
|
.field-shell.floating.has-value .floating-label,
|
|
116
116
|
.field-shell.floating:focus-within .floating-label {
|
package/dist/text-area.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-area.js","sourceRoot":"","sources":["../src/text-area.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AAEvC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;GAWG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,4B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AC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAE7B;IAAhB,KAAK,EAAE;kDAAgE;AAZ7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkNpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n type FormFieldControlConfig,\n} from \"./utils/form-field-control.js\";\n\nlet instanceCount = 0;\n\n/**\n * Plain multi-line text field — a thin, tokenized wrapper around a native\n * `<textarea>`, styled to match the other value-entry form fields\n * (autocomplete-input, form-select, ...). Not a rich editor; use `readonly`\n * to display pre-formatted text (e.g. an error message) that the user can\n * still select and copy, typically paired with `<copy-link-button>`.\n * Supports `form-field`'s opt-in floating-label mode when slotted inside it.\n *\n * @element text-area\n * @fires input - Fires on every keystroke; detail: { value: string }.\n * @fires change - Native change semantics (on blur, if the value changed); detail: { value: string }.\n */\n@customElement(\"text-area\")\nexport class TextArea extends LitElement {\n /** Current text content. */\n @property() value = \"\";\n /** Visible row count (native `<textarea rows>`). */\n @property({ type: Number }) rows = 4;\n /** Placeholder text shown when empty. */\n @property() placeholder = \"\";\n /** When true, the value can be selected/copied but not edited. */\n @property({ type: Boolean }) readonly = false;\n /** Disables the field entirely (no interaction, dimmed). */\n @property({ type: Boolean }) disabled = false;\n\n @state() private _formFieldConfig: FormFieldControlConfig | null = null;\n\n readonly #textareaId = `text-area-field-${++instanceCount}`;\n\n /**\n * Applies or clears label configuration supplied by a wrapping `form-field`.\n * @private\n */\n [formFieldControl](config: FormFieldControlConfig | null): void {\n this._formFieldConfig = config;\n }\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .field-shell {\n position: relative;\n }\n textarea {\n display: block;\n box-sizing: border-box;\n width: 100%;\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-normal, 1.5);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n resize: vertical;\n }\n .floating-label {\n position: absolute;\n top: 0.5rem;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n overflow: hidden;\n color: var(--ui-text-muted, #64748b);\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-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n font-size 150ms ease;\n }\n .field-shell.floating textarea {\n min-height: 3rem;\n padding-top: 1.25rem;\n }\n .field-shell.floating.has-value .floating-label,\n .field-shell.floating:focus-within .floating-label {\n top: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .field-shell.floating:not(.has-value):not(:focus-within) textarea::placeholder {\n opacity: 0;\n }\n .field-shell.disabled .floating-label {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .required-mark {\n flex: 0 0 auto;\n color: var(--ui-danger, #dc2626);\n }\n .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 textarea:read-only {\n background: var(--ui-surface-muted, #f8fafc);\n }\n textarea:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n textarea:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (forced-colors: active) {\n textarea:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n textarea:disabled {\n color: GrayText;\n opacity: 1;\n }\n .field-shell.disabled .floating-label {\n color: GrayText;\n opacity: 1;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .floating-label {\n transition: none;\n }\n }\n `,\n ];\n\n private _onInput(e: Event): void {\n // The native textarea's own \"input\" event is composed (crosses the shadow\n // boundary) — stop it so only our re-dispatched CustomEvent (carrying\n // `detail.value`) reaches consumers. Otherwise the native event bubbles\n // out afterwards too, re-invoking the same \"input\" listener with a plain\n // UIEvent whose `detail` defaults to 0, clobbering consumer state.\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n private _onChange(e: Event): void {\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n override render() {\n const floating =\n Boolean(this._formFieldConfig?.floating) && Boolean(this._formFieldConfig?.label);\n return html`\n <div\n class=\"field-shell ${floating ? \"floating\" : \"\"} ${this.value\n ? \"has-value\"\n : \"\"} ${this.disabled ? \"disabled\" : \"\"}\"\n >\n ${floating\n ? html`\n <label class=\"floating-label\" for=${this.#textareaId}>\n <span>${this._formFieldConfig!.label}</span>\n ${this._formFieldConfig!.required\n ? html`\n <span class=\"required-mark\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\"> (required)</span>\n `\n : nothing}\n </label>\n `\n : nothing}\n <textarea\n id=${this.#textareaId}\n .value=${this.value}\n rows=${this.rows}\n placeholder=${this.placeholder}\n ?readonly=${this.readonly}\n ?disabled=${this.disabled}\n @input=${this._onInput}\n @change=${this._onChange}\n ></textarea>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"text-area\": TextArea;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"text-area.js","sourceRoot":"","sources":["../src/text-area.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AAEvC,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;GAWG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,UAAU;IAAjC;;QACL,4BAA4B;QAChB,UAAK,GAAG,EAAE,CAAC;QACvB,oDAAoD;QACxB,SAAI,GAAG,CAAC,CAAC;QACrC,yCAAyC;QAC7B,gBAAW,GAAG,EAAE,CAAC;QAC7B,kEAAkE;QACrC,aAAQ,GAAG,KAAK,CAAC;QAC9C,4DAA4D;QAC/B,aAAQ,GAAG,KAAK,CAAC;QAE7B,qBAAgB,GAAkC,IAAI,CAAC;QAE/D,gBAAW,GAAG,mBAAmB,EAAE,aAAa,EAAE,CAAC;IAoM9D,CAAC;IApMU,WAAW,CAAwC;IAE5D;;;OAGG;IACH,CAAC,gBAAgB,CAAC,CAAC,MAAqC;QACtD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC;IACjC,CAAC;aAEe,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;YACR,CAAC,CAAC,IAAI,CAAA;kDACkC,IAAI,CAAC,WAAW;wBAC1C,IAAI,CAAC,gBAAiB,CAAC,KAAK;kBAClC,IAAI,CAAC,gBAAiB,CAAC,QAAQ;gBAC/B,CAAC,CAAC,IAAI,CAAA;;;qBAGH;gBACH,CAAC,CAAC,OAAO;;aAEd;YACH,CAAC,CAAC,OAAO;;eAEJ,IAAI,CAAC,WAAW;mBACZ,IAAI,CAAC,KAAK;iBACZ,IAAI,CAAC,IAAI;wBACF,IAAI,CAAC,WAAW;sBAClB,IAAI,CAAC,QAAQ;sBACb,IAAI,CAAC,QAAQ;mBAChB,IAAI,CAAC,QAAQ;oBACZ,IAAI,CAAC,SAAS;;;KAG7B,CAAC;IACJ,CAAC;CACF,CAAA;AAhNa;IAAX,QAAQ,EAAE;uCAAY;AAEK;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sCAAU;AAEzB;IAAX,QAAQ,EAAE;6CAAkB;AAEA;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAEjB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;0CAAkB;AAE7B;IAAhB,KAAK,EAAE;kDAAgE;AAZ7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkNpB","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\nimport {\n formFieldControl,\n type FormFieldControlConfig,\n} from \"./utils/form-field-control.js\";\n\nlet instanceCount = 0;\n\n/**\n * Plain multi-line text field — a thin, tokenized wrapper around a native\n * `<textarea>`, styled to match the other value-entry form fields\n * (autocomplete-input, form-select, ...). Not a rich editor; use `readonly`\n * to display pre-formatted text (e.g. an error message) that the user can\n * still select and copy, typically paired with `<copy-link-button>`.\n * Supports `form-field`'s opt-in floating-label mode when slotted inside it.\n *\n * @element text-area\n * @fires input - Fires on every keystroke; detail: { value: string }.\n * @fires change - Native change semantics (on blur, if the value changed); detail: { value: string }.\n */\n@customElement(\"text-area\")\nexport class TextArea extends LitElement {\n /** Current text content. */\n @property() value = \"\";\n /** Visible row count (native `<textarea rows>`). */\n @property({ type: Number }) rows = 4;\n /** Placeholder text shown when empty. */\n @property() placeholder = \"\";\n /** When true, the value can be selected/copied but not edited. */\n @property({ type: Boolean }) readonly = false;\n /** Disables the field entirely (no interaction, dimmed). */\n @property({ type: Boolean }) disabled = false;\n\n @state() private _formFieldConfig: FormFieldControlConfig | null = null;\n\n readonly #textareaId = `text-area-field-${++instanceCount}`;\n\n /**\n * Applies or clears label configuration supplied by a wrapping `form-field`.\n * @private\n */\n [formFieldControl](config: FormFieldControlConfig | null): void {\n this._formFieldConfig = config;\n }\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .field-shell {\n position: relative;\n }\n textarea {\n display: block;\n box-sizing: border-box;\n width: 100%;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size, 0.875rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n background: var(--ui-surface, #ffffff);\n padding: 0.5rem 0.75rem;\n border: 1px solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius-sm, 0.25rem);\n resize: vertical;\n }\n .floating-label {\n position: absolute;\n top: 0.25rem;\n left: 0.75rem;\n right: 0.75rem;\n z-index: 1;\n display: flex;\n align-items: baseline;\n gap: 0.25rem;\n overflow: hidden;\n color: var(--ui-text-muted, #64748b);\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-regular, 400);\n line-height: var(--ui-line-height-tight, 1.25);\n white-space: nowrap;\n text-overflow: ellipsis;\n cursor: text;\n transition:\n top 150ms ease,\n font-size 150ms ease;\n }\n .field-shell.floating textarea {\n min-height: 3rem;\n padding-top: 1.5rem;\n }\n .field-shell.floating.has-value .floating-label,\n .field-shell.floating:focus-within .floating-label {\n top: 0.25rem;\n font-size: var(--ui-font-size-xs, 0.6875rem);\n }\n .field-shell.floating:not(.has-value):not(:focus-within) textarea::placeholder {\n opacity: 0;\n }\n .field-shell.disabled .floating-label {\n cursor: not-allowed;\n opacity: 0.6;\n }\n .required-mark {\n flex: 0 0 auto;\n color: var(--ui-danger, #dc2626);\n }\n .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 textarea:read-only {\n background: var(--ui-surface-muted, #f8fafc);\n }\n textarea:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n textarea:focus-visible {\n outline: none;\n border-color: var(--ui-primary, #4f46e5);\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (forced-colors: active) {\n textarea:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n textarea:disabled {\n color: GrayText;\n opacity: 1;\n }\n .field-shell.disabled .floating-label {\n color: GrayText;\n opacity: 1;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .floating-label {\n transition: none;\n }\n }\n `,\n ];\n\n private _onInput(e: Event): void {\n // The native textarea's own \"input\" event is composed (crosses the shadow\n // boundary) — stop it so only our re-dispatched CustomEvent (carrying\n // `detail.value`) reaches consumers. Otherwise the native event bubbles\n // out afterwards too, re-invoking the same \"input\" listener with a plain\n // UIEvent whose `detail` defaults to 0, clobbering consumer state.\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"input\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n private _onChange(e: Event): void {\n e.stopPropagation();\n this.value = (e.target as HTMLTextAreaElement).value;\n this.dispatchEvent(\n new CustomEvent(\"change\", { detail: { value: this.value }, bubbles: true, composed: true }),\n );\n }\n\n override render() {\n const floating =\n Boolean(this._formFieldConfig?.floating) && Boolean(this._formFieldConfig?.label);\n return html`\n <div\n class=\"field-shell ${floating ? \"floating\" : \"\"} ${this.value\n ? \"has-value\"\n : \"\"} ${this.disabled ? \"disabled\" : \"\"}\"\n >\n ${floating\n ? html`\n <label class=\"floating-label\" for=${this.#textareaId}>\n <span>${this._formFieldConfig!.label}</span>\n ${this._formFieldConfig!.required\n ? html`\n <span class=\"required-mark\" aria-hidden=\"true\">*</span>\n <span class=\"sr-only\"> (required)</span>\n `\n : nothing}\n </label>\n `\n : nothing}\n <textarea\n id=${this.#textareaId}\n .value=${this.value}\n rows=${this.rows}\n placeholder=${this.placeholder}\n ?readonly=${this.readonly}\n ?disabled=${this.disabled}\n @input=${this._onInput}\n @change=${this._onChange}\n ></textarea>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"text-area\": TextArea;\n }\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from "lit";
|
|
2
|
+
export type AdmonitionVariant = "neutral" | "info" | "success" | "warning" | "danger";
|
|
3
|
+
/**
|
|
4
|
+
* Bordered, rounded callout card for an inline notice with an optional call
|
|
5
|
+
* to action — "take the quiz to personalize your weights", "this feature is
|
|
6
|
+
* in beta", etc. Unlike `status-banner` (a borderless, non-rounded
|
|
7
|
+
* full-width bar for a persistent app-level condition), this is meant to sit
|
|
8
|
+
* inline within a page's content column, so it always has a visible border
|
|
9
|
+
* and radius. Colors follow the same tinted-background + accent-color
|
|
10
|
+
* scheme as `status-banner`/`status-pill`.
|
|
11
|
+
*
|
|
12
|
+
* @element ui-admonition
|
|
13
|
+
* @slot - The message text.
|
|
14
|
+
* @slot actions - Optional call-to-action controls, e.g. a primary `<ui-button>`.
|
|
15
|
+
*/
|
|
16
|
+
export declare class UiAdmonition extends LitElement {
|
|
17
|
+
static styles: import("lit").CSSResult[];
|
|
18
|
+
/** Visual style; also selects the accent color for the icon/border/tint. */
|
|
19
|
+
variant: AdmonitionVariant;
|
|
20
|
+
/**
|
|
21
|
+
* Optional leading icon, pre-rendered by the consumer (e.g. `iconInfo(18)`),
|
|
22
|
+
* matching `status-banner`/`nav-item`/`icon-button` — icons are passed in,
|
|
23
|
+
* not named, so the component never has to know the icon catalog.
|
|
24
|
+
*/
|
|
25
|
+
icon: TemplateResult | null;
|
|
26
|
+
render(): TemplateResult<1>;
|
|
27
|
+
}
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
"ui-admonition": UiAdmonition;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ui-admonition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-admonition.d.ts","sourceRoot":"","sources":["../src/ui-admonition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAsB,MAAM,KAAK,CAAC;AAI1E,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEtF;;;;;;;;;;;;GAYG;AACH,qBACa,YAAa,SAAQ,UAAU;IAC1C,OAAgB,MAAM,4BAyFpB;IAEF,4EAA4E;IAC/C,OAAO,EAAE,iBAAiB,CAAU;IAEjE;;;;OAIG;IAC6B,IAAI,EAAE,cAAc,GAAG,IAAI,CAAQ;IAE1D,MAAM,sBAUd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,YAAY,CAAC;KAC/B;CACF"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { tokens } from "./tokens.js";
|
|
10
|
+
/**
|
|
11
|
+
* Bordered, rounded callout card for an inline notice with an optional call
|
|
12
|
+
* to action — "take the quiz to personalize your weights", "this feature is
|
|
13
|
+
* in beta", etc. Unlike `status-banner` (a borderless, non-rounded
|
|
14
|
+
* full-width bar for a persistent app-level condition), this is meant to sit
|
|
15
|
+
* inline within a page's content column, so it always has a visible border
|
|
16
|
+
* and radius. Colors follow the same tinted-background + accent-color
|
|
17
|
+
* scheme as `status-banner`/`status-pill`.
|
|
18
|
+
*
|
|
19
|
+
* @element ui-admonition
|
|
20
|
+
* @slot - The message text.
|
|
21
|
+
* @slot actions - Optional call-to-action controls, e.g. a primary `<ui-button>`.
|
|
22
|
+
*/
|
|
23
|
+
let UiAdmonition = class UiAdmonition extends LitElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
/** Visual style; also selects the accent color for the icon/border/tint. */
|
|
27
|
+
this.variant = "info";
|
|
28
|
+
/**
|
|
29
|
+
* Optional leading icon, pre-rendered by the consumer (e.g. `iconInfo(18)`),
|
|
30
|
+
* matching `status-banner`/`nav-item`/`icon-button` — icons are passed in,
|
|
31
|
+
* not named, so the component never has to know the icon catalog.
|
|
32
|
+
*/
|
|
33
|
+
this.icon = null;
|
|
34
|
+
}
|
|
35
|
+
static { this.styles = [
|
|
36
|
+
tokens,
|
|
37
|
+
css `
|
|
38
|
+
:host {
|
|
39
|
+
display: block;
|
|
40
|
+
}
|
|
41
|
+
.box {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
gap: 0.5rem;
|
|
45
|
+
border-radius: var(--ui-radius, 0.5rem);
|
|
46
|
+
border: 1px solid;
|
|
47
|
+
padding: 0.75rem 1rem;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
font-family: var(
|
|
50
|
+
--ui-font,
|
|
51
|
+
ui-sans-serif,
|
|
52
|
+
system-ui,
|
|
53
|
+
sans-serif,
|
|
54
|
+
"Apple Color Emoji",
|
|
55
|
+
"Segoe UI Emoji",
|
|
56
|
+
"Segoe UI Symbol",
|
|
57
|
+
"Noto Color Emoji"
|
|
58
|
+
);
|
|
59
|
+
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
60
|
+
line-height: var(--ui-line-height-normal, 1.5);
|
|
61
|
+
color: var(--ui-text, #0f172a);
|
|
62
|
+
}
|
|
63
|
+
.icon {
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
line-height: 0;
|
|
66
|
+
flex: 0 0 auto;
|
|
67
|
+
margin-top: 0.125rem;
|
|
68
|
+
}
|
|
69
|
+
.body {
|
|
70
|
+
flex: 1 1 auto;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
}
|
|
73
|
+
.actions {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
flex-wrap: wrap;
|
|
77
|
+
gap: 0.5rem;
|
|
78
|
+
margin-top: 0.75rem;
|
|
79
|
+
}
|
|
80
|
+
.actions:empty {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
.box.neutral {
|
|
84
|
+
background: color-mix(in srgb, var(--ui-text-muted, #64748b) 8%, var(--ui-surface, #ffffff));
|
|
85
|
+
border-color: color-mix(in srgb, var(--ui-text-muted, #64748b) 30%, transparent);
|
|
86
|
+
}
|
|
87
|
+
.box.neutral .icon {
|
|
88
|
+
color: var(--ui-text-muted, #64748b);
|
|
89
|
+
}
|
|
90
|
+
.box.info {
|
|
91
|
+
background: color-mix(in srgb, var(--ui-info, #0ea5e9) 8%, var(--ui-surface, #ffffff));
|
|
92
|
+
border-color: color-mix(in srgb, var(--ui-info, #0ea5e9) 30%, transparent);
|
|
93
|
+
}
|
|
94
|
+
.box.info .icon {
|
|
95
|
+
color: var(--ui-info, #0ea5e9);
|
|
96
|
+
}
|
|
97
|
+
.box.success {
|
|
98
|
+
background: color-mix(in srgb, var(--ui-success, #16a34a) 8%, var(--ui-surface, #ffffff));
|
|
99
|
+
border-color: color-mix(in srgb, var(--ui-success, #16a34a) 30%, transparent);
|
|
100
|
+
}
|
|
101
|
+
.box.success .icon {
|
|
102
|
+
color: var(--ui-success, #16a34a);
|
|
103
|
+
}
|
|
104
|
+
.box.warning {
|
|
105
|
+
background: color-mix(in srgb, var(--ui-warning, #d97706) 8%, var(--ui-surface, #ffffff));
|
|
106
|
+
border-color: color-mix(in srgb, var(--ui-warning, #d97706) 30%, transparent);
|
|
107
|
+
}
|
|
108
|
+
.box.warning .icon {
|
|
109
|
+
color: var(--ui-warning, #d97706);
|
|
110
|
+
}
|
|
111
|
+
.box.danger {
|
|
112
|
+
background: color-mix(in srgb, var(--ui-danger, #dc2626) 8%, var(--ui-surface, #ffffff));
|
|
113
|
+
border-color: color-mix(in srgb, var(--ui-danger, #dc2626) 30%, transparent);
|
|
114
|
+
}
|
|
115
|
+
.box.danger .icon {
|
|
116
|
+
color: var(--ui-danger, #dc2626);
|
|
117
|
+
}
|
|
118
|
+
@media (forced-colors: active) {
|
|
119
|
+
.box {
|
|
120
|
+
border-color: CanvasText;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
`,
|
|
124
|
+
]; }
|
|
125
|
+
render() {
|
|
126
|
+
return html `
|
|
127
|
+
<div class="box ${this.variant}" role=${this.variant === "danger" ? "alert" : "status"}>
|
|
128
|
+
${this.icon ? html `<span class="icon">${this.icon}</span>` : nothing}
|
|
129
|
+
<div class="body">
|
|
130
|
+
<div class="text"><slot></slot></div>
|
|
131
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
__decorate([
|
|
138
|
+
property({ reflect: true })
|
|
139
|
+
], UiAdmonition.prototype, "variant", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
property({ attribute: false })
|
|
142
|
+
], UiAdmonition.prototype, "icon", void 0);
|
|
143
|
+
UiAdmonition = __decorate([
|
|
144
|
+
customElement("ui-admonition")
|
|
145
|
+
], UiAdmonition);
|
|
146
|
+
export { UiAdmonition };
|
|
147
|
+
//# sourceMappingURL=ui-admonition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-admonition.js","sourceRoot":"","sources":["../src/ui-admonition.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAuB,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC;;;;;;;;;;;;GAYG;AAEI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QA4FL,4EAA4E;QAC/C,YAAO,GAAsB,MAAM,CAAC;QAEjE;;;;WAIG;QAC6B,SAAI,GAA0B,IAAI,CAAC;IAarE,CAAC;aAhHiB,WAAM,GAAG;QACvB,MAAM;QACN,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsFF;KACF,AAzFqB,CAyFpB;IAYO,MAAM;QACb,OAAO,IAAI,CAAA;wBACS,IAAI,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ;UAClF,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA,sBAAsB,IAAI,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO;;;;;;KAMvE,CAAC;IACJ,CAAC;CACF,CAAA;AApB8B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;6CAAqC;AAOjC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;0CAAoC;AApGxD,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAiHxB","sourcesContent":["import { LitElement, type TemplateResult, css, html, nothing } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { tokens } from \"./tokens.js\";\n\nexport type AdmonitionVariant = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\";\n\n/**\n * Bordered, rounded callout card for an inline notice with an optional call\n * to action — \"take the quiz to personalize your weights\", \"this feature is\n * in beta\", etc. Unlike `status-banner` (a borderless, non-rounded\n * full-width bar for a persistent app-level condition), this is meant to sit\n * inline within a page's content column, so it always has a visible border\n * and radius. Colors follow the same tinted-background + accent-color\n * scheme as `status-banner`/`status-pill`.\n *\n * @element ui-admonition\n * @slot - The message text.\n * @slot actions - Optional call-to-action controls, e.g. a primary `<ui-button>`.\n */\n@customElement(\"ui-admonition\")\nexport class UiAdmonition extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n }\n .box {\n display: flex;\n align-items: flex-start;\n gap: 0.5rem;\n border-radius: var(--ui-radius, 0.5rem);\n border: 1px solid;\n padding: 0.75rem 1rem;\n box-sizing: border-box;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-normal, 1.5);\n color: var(--ui-text, #0f172a);\n }\n .icon {\n display: inline-flex;\n line-height: 0;\n flex: 0 0 auto;\n margin-top: 0.125rem;\n }\n .body {\n flex: 1 1 auto;\n min-width: 0;\n }\n .actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 0.5rem;\n margin-top: 0.75rem;\n }\n .actions:empty {\n display: none;\n }\n .box.neutral {\n background: color-mix(in srgb, var(--ui-text-muted, #64748b) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-text-muted, #64748b) 30%, transparent);\n }\n .box.neutral .icon {\n color: var(--ui-text-muted, #64748b);\n }\n .box.info {\n background: color-mix(in srgb, var(--ui-info, #0ea5e9) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-info, #0ea5e9) 30%, transparent);\n }\n .box.info .icon {\n color: var(--ui-info, #0ea5e9);\n }\n .box.success {\n background: color-mix(in srgb, var(--ui-success, #16a34a) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-success, #16a34a) 30%, transparent);\n }\n .box.success .icon {\n color: var(--ui-success, #16a34a);\n }\n .box.warning {\n background: color-mix(in srgb, var(--ui-warning, #d97706) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-warning, #d97706) 30%, transparent);\n }\n .box.warning .icon {\n color: var(--ui-warning, #d97706);\n }\n .box.danger {\n background: color-mix(in srgb, var(--ui-danger, #dc2626) 8%, var(--ui-surface, #ffffff));\n border-color: color-mix(in srgb, var(--ui-danger, #dc2626) 30%, transparent);\n }\n .box.danger .icon {\n color: var(--ui-danger, #dc2626);\n }\n @media (forced-colors: active) {\n .box {\n border-color: CanvasText;\n }\n }\n `,\n ];\n\n /** Visual style; also selects the accent color for the icon/border/tint. */\n @property({ reflect: true }) variant: AdmonitionVariant = \"info\";\n\n /**\n * Optional leading icon, pre-rendered by the consumer (e.g. `iconInfo(18)`),\n * matching `status-banner`/`nav-item`/`icon-button` — icons are passed in,\n * not named, so the component never has to know the icon catalog.\n */\n @property({ attribute: false }) icon: TemplateResult | null = null;\n\n override render() {\n return html`\n <div class=\"box ${this.variant}\" role=${this.variant === \"danger\" ? \"alert\" : \"status\"}>\n ${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : nothing}\n <div class=\"body\">\n <div class=\"text\"><slot></slot></div>\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ui-admonition\": UiAdmonition;\n }\n}\n"]}
|
package/docs/form-field.md
CHANGED
|
@@ -69,10 +69,12 @@ _None._
|
|
|
69
69
|
| `--ui-danger` |
|
|
70
70
|
| `--ui-focus-ring` |
|
|
71
71
|
| `--ui-font` |
|
|
72
|
+
| `--ui-font-size` |
|
|
72
73
|
| `--ui-font-size-sm` |
|
|
73
74
|
| `--ui-font-size-xs` |
|
|
74
75
|
| `--ui-font-weight-medium` |
|
|
75
76
|
| `--ui-font-weight-regular` |
|
|
77
|
+
| `--ui-line-height-normal` |
|
|
76
78
|
| `--ui-line-height-tight` |
|
|
77
79
|
| `--ui-primary` |
|
|
78
80
|
| `--ui-radius-sm` |
|
package/docs/form-select.md
CHANGED
package/docs/multi-select.md
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# `<progress-bar>`
|
|
2
|
+
|
|
3
|
+
A determinate horizontal progress indicator — a page-level "step 3 of 14"
|
|
4
|
+
bar. `stat-meter` is the closest existing thing but is an inline
|
|
5
|
+
CPU-gauge-style meter with a leading label and a computed percent value;
|
|
6
|
+
`progress-bar` instead takes a raw `value`/`max` pair and renders an
|
|
7
|
+
optional plain-text `label` to the right of the bar rather than a percent
|
|
8
|
+
inside it.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import "@f-ewald/components/progress-bar.js";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<progress-bar value="3" max="14" label="Question 3 out of 14"></progress-bar>
|
|
20
|
+
<progress-bar value="7" max="10" color="#dc2626" track-color="#fecaca"></progress-bar>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Attributes / properties
|
|
24
|
+
|
|
25
|
+
| Property | Attribute | Type | Default | Description |
|
|
26
|
+
| --- | --- | --- | --- | --- |
|
|
27
|
+
| `value` | `value` | `number` | `0` | Current progress. Clamped into [0, max]. |
|
|
28
|
+
| `max` | `max` | `number` | `100` | Value representing a full bar. |
|
|
29
|
+
| `label` | `label` | `string` | `""` | Optional text rendered to the right of the bar (e.g. "Question 3 out of 14"). |
|
|
30
|
+
| `color` | `color` | `string` | `""` | Fill color; defaults to the themed accent. |
|
|
31
|
+
| `trackColor` | `track-color` | `string` | `""` | Track color behind the fill. |
|
|
32
|
+
|
|
33
|
+
## Events
|
|
34
|
+
|
|
35
|
+
_None._
|
|
36
|
+
|
|
37
|
+
## Slots
|
|
38
|
+
|
|
39
|
+
_None._
|
|
40
|
+
|
|
41
|
+
## CSS custom properties
|
|
42
|
+
|
|
43
|
+
| Custom property |
|
|
44
|
+
| --- |
|
|
45
|
+
| `--ui-button-accent` |
|
|
46
|
+
| `--ui-font` |
|
|
47
|
+
| `--ui-font-size-sm` |
|
|
48
|
+
| `--ui-primary` |
|
|
49
|
+
| `--ui-radius-sm` |
|
|
50
|
+
| `--ui-surface-muted` |
|
|
51
|
+
| `--ui-text-muted` |
|
package/docs/radio-cards.md
CHANGED
|
@@ -16,6 +16,13 @@ toward `--ui-surface` rather than taking a second token: the tint stays
|
|
|
16
16
|
the same hue and gradient, just lighter on light themes (and
|
|
17
17
|
correspondingly deeper on dark ones) than on a button.
|
|
18
18
|
|
|
19
|
+
`layout` controls how cards flow ("mixed" wraps with per-option
|
|
20
|
+
`fullWidth` rows, "vertical" stacks one per row, "horizontal" stays
|
|
21
|
+
side-by-side at every width). `hideInput` visually hides the radio dot via
|
|
22
|
+
the same `sr-only` clip pattern as `ui-checkbox` — the native input stays
|
|
23
|
+
in the DOM for keyboard/a11y, and the card's own border/tint carries the
|
|
24
|
+
selected state instead.
|
|
25
|
+
|
|
19
26
|
## Install
|
|
20
27
|
|
|
21
28
|
```js
|
|
@@ -44,6 +51,8 @@ import "@f-ewald/components/radio-cards.js";
|
|
|
44
51
|
| `options` | _(JS property only)_ | `RadioCardOption[]` | `[]` | Options to render, one card each. |
|
|
45
52
|
| `value` | `value` | `string` | `""` | Currently selected value. |
|
|
46
53
|
| `disabled` | `disabled` | `boolean` | `false` | Disables every native radio in the group. |
|
|
54
|
+
| `layout` | `layout` | `"vertical" | "horizontal" | "mixed"` | `"mixed"` | How the cards flow. - "mixed" (default): cards wrap onto as many rows as fit; options marked `fullWidth` take a row of their own. - "vertical": one full-width card per row, never side by side. - "horizontal": every card on one row, equal widths, no wrapping. |
|
|
55
|
+
| `hideInput` | `hide-input` | `boolean` | `false` | Visually hides the radio dot; the card's own border/tint carries the selected state. |
|
|
47
56
|
|
|
48
57
|
## Events
|
|
49
58
|
|
package/docs/text-area.md
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# `<ui-admonition>`
|
|
2
|
+
|
|
3
|
+
Bordered, rounded callout card for an inline notice with an optional call
|
|
4
|
+
to action — "take the quiz to personalize your weights", "this feature is
|
|
5
|
+
in beta", etc. Unlike `status-banner` (a borderless, non-rounded
|
|
6
|
+
full-width bar for a persistent app-level condition), this is meant to sit
|
|
7
|
+
inline within a page's content column, so it always has a visible border
|
|
8
|
+
and radius. Colors follow the same tinted-background + accent-color
|
|
9
|
+
scheme as `status-banner`/`status-pill`.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import "@f-ewald/components/ui-admonition.js";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<ui-admonition variant="info">
|
|
21
|
+
These are balanced defaults — take the quiz to personalize them.
|
|
22
|
+
<ui-button slot="actions" variant="primary">Take the quiz</ui-button>
|
|
23
|
+
</ui-admonition>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Attributes / properties
|
|
27
|
+
|
|
28
|
+
| Property | Attribute | Type | Default | Description |
|
|
29
|
+
| --- | --- | --- | --- | --- |
|
|
30
|
+
| `variant` | `variant` | `AdmonitionVariant` | `"info"` | Visual style; also selects the accent color for the icon/border/tint. |
|
|
31
|
+
| `icon` | _(JS property only)_ | `TemplateResult | null` | `null` | Optional leading icon, pre-rendered by the consumer (e.g. `iconInfo(18)`), matching `status-banner`/`nav-item`/`icon-button` — icons are passed in, not named, so the component never has to know the icon catalog. |
|
|
32
|
+
|
|
33
|
+
## Events
|
|
34
|
+
|
|
35
|
+
_None._
|
|
36
|
+
|
|
37
|
+
## Slots
|
|
38
|
+
|
|
39
|
+
_None._
|
|
40
|
+
|
|
41
|
+
## CSS custom properties
|
|
42
|
+
|
|
43
|
+
| Custom property |
|
|
44
|
+
| --- |
|
|
45
|
+
| `--ui-danger` |
|
|
46
|
+
| `--ui-font` |
|
|
47
|
+
| `--ui-font-size-sm` |
|
|
48
|
+
| `--ui-info` |
|
|
49
|
+
| `--ui-line-height-normal` |
|
|
50
|
+
| `--ui-radius` |
|
|
51
|
+
| `--ui-success` |
|
|
52
|
+
| `--ui-surface` |
|
|
53
|
+
| `--ui-text` |
|
|
54
|
+
| `--ui-text-muted` |
|
|
55
|
+
| `--ui-warning` |
|