@f-ewald/components 1.39.0 → 1.40.1
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 +48 -0
- package/custom-elements.json +1179 -100
- package/dist/address-autocomplete.js +2 -2
- package/dist/address-autocomplete.js.map +1 -1
- package/dist/app-shell.js +4 -4
- package/dist/app-shell.js.map +1 -1
- package/dist/app-sidebar.js +2 -2
- package/dist/app-sidebar.js.map +1 -1
- package/dist/audio-player.js +1 -1
- package/dist/audio-player.js.map +1 -1
- package/dist/autocomplete-input.js +2 -2
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/breadcrumb-nav.d.ts +87 -0
- package/dist/breadcrumb-nav.d.ts.map +1 -0
- package/dist/breadcrumb-nav.js +281 -0
- package/dist/breadcrumb-nav.js.map +1 -0
- package/dist/button-group.js +2 -2
- package/dist/button-group.js.map +1 -1
- package/dist/calendar-day.js +3 -3
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-month.d.ts.map +1 -1
- package/dist/calendar-month.js +4 -1
- package/dist/calendar-month.js.map +1 -1
- package/dist/calendar-week.js +4 -4
- package/dist/calendar-week.js.map +1 -1
- package/dist/chat-message.js +1 -1
- package/dist/chat-message.js.map +1 -1
- package/dist/comment-composer.js +1 -1
- package/dist/comment-composer.js.map +1 -1
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +5 -2
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/content-divider.js +1 -1
- package/dist/content-divider.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +6 -5
- package/dist/cron-schedule.js.map +1 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +3 -2
- package/dist/data-table.js.map +1 -1
- package/dist/dropdown-button.d.ts.map +1 -1
- package/dist/dropdown-button.js +4 -2
- package/dist/dropdown-button.js.map +1 -1
- package/dist/editable-text.js +1 -1
- package/dist/editable-text.js.map +1 -1
- package/dist/empty-state.d.ts +58 -0
- package/dist/empty-state.d.ts.map +1 -0
- package/dist/empty-state.js +203 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/form-field.js +1 -1
- 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/frame-box.js +1 -1
- package/dist/frame-box.js.map +1 -1
- package/dist/fullscreen-button.js +1 -1
- package/dist/fullscreen-button.js.map +1 -1
- package/dist/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/kanban-card.js +1 -1
- package/dist/kanban-card.js.map +1 -1
- package/dist/kanban-column.js +3 -3
- package/dist/kanban-column.js.map +1 -1
- package/dist/kbd-hint.d.ts.map +1 -1
- package/dist/kbd-hint.js +2 -1
- package/dist/kbd-hint.js.map +1 -1
- package/dist/link-card.js +1 -1
- package/dist/link-card.js.map +1 -1
- package/dist/markdown-view.js +3 -3
- package/dist/markdown-view.js.map +1 -1
- package/dist/modal-dialog.js +1 -1
- package/dist/modal-dialog.js.map +1 -1
- package/dist/multi-select.js +5 -5
- package/dist/multi-select.js.map +1 -1
- package/dist/pagination-nav.d.ts.map +1 -1
- package/dist/pagination-nav.js +5 -1
- package/dist/pagination-nav.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/popover-panel.d.ts.map +1 -1
- package/dist/popover-panel.js +4 -2
- package/dist/popover-panel.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +1 -0
- package/dist/progress-bar.js.map +1 -1
- package/dist/radio-cards.js +1 -1
- package/dist/radio-cards.js.map +1 -1
- package/dist/radio-pills.js +1 -1
- package/dist/radio-pills.js.map +1 -1
- package/dist/reveal-button.js +1 -1
- package/dist/reveal-button.js.map +1 -1
- package/dist/scroll-to-bottom.js +1 -1
- package/dist/scroll-to-bottom.js.map +1 -1
- package/dist/scroll-to-top.js +1 -1
- package/dist/scroll-to-top.js.map +1 -1
- package/dist/skip-link.d.ts +38 -0
- package/dist/skip-link.d.ts.map +1 -0
- package/dist/skip-link.js +184 -0
- package/dist/skip-link.js.map +1 -0
- package/dist/slide-panel.js +1 -1
- package/dist/slide-panel.js.map +1 -1
- package/dist/spec-list.d.ts +58 -0
- package/dist/spec-list.d.ts.map +1 -0
- package/dist/spec-list.js +226 -0
- package/dist/spec-list.js.map +1 -0
- package/dist/stat-meter.d.ts.map +1 -1
- package/dist/stat-meter.js +1 -0
- package/dist/stat-meter.js.map +1 -1
- package/dist/tab-bar.js +1 -1
- package/dist/tab-bar.js.map +1 -1
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/tile-grid.js +1 -1
- package/dist/tile-grid.js.map +1 -1
- package/dist/tokens.css +42 -1
- package/dist/tokens.d.ts +50 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +136 -0
- package/dist/tokens.js.map +1 -1
- package/dist/tree-view.js +2 -2
- package/dist/tree-view.js.map +1 -1
- package/dist/ui-admonition.js +1 -1
- package/dist/ui-admonition.js.map +1 -1
- package/dist/ui-button.js +1 -1
- package/dist/ui-button.js.map +1 -1
- package/dist/video-player.js +1 -1
- package/dist/video-player.js.map +1 -1
- package/dist/vote-control.d.ts +40 -0
- package/dist/vote-control.d.ts.map +1 -0
- package/dist/vote-control.js +318 -0
- package/dist/vote-control.js.map +1 -0
- package/docs/address-autocomplete.md +1 -0
- package/docs/app-shell.md +1 -0
- package/docs/app-sidebar.md +1 -0
- package/docs/audio-player.md +1 -0
- package/docs/autocomplete-input.md +1 -0
- package/docs/breadcrumb-nav.md +70 -0
- package/docs/button-group.md +1 -0
- package/docs/calendar-day.md +1 -0
- package/docs/calendar-month.md +1 -0
- package/docs/calendar-week.md +1 -0
- package/docs/chat-message.md +1 -0
- package/docs/comment-composer.md +1 -0
- package/docs/confirm-dialog.md +1 -0
- package/docs/content-divider.md +1 -0
- package/docs/cron-schedule.md +2 -0
- package/docs/data-table.md +2 -0
- package/docs/design-language.md +57 -5
- package/docs/dropdown-button.md +1 -0
- package/docs/editable-text.md +1 -0
- package/docs/empty-state.md +60 -0
- package/docs/form-field.md +1 -0
- package/docs/form-select.md +1 -0
- package/docs/frame-box.md +1 -0
- package/docs/fullscreen-button.md +1 -0
- package/docs/icons.md +1 -0
- package/docs/kanban-card.md +1 -0
- package/docs/kanban-column.md +1 -0
- package/docs/kbd-hint.md +1 -0
- package/docs/link-card.md +1 -0
- package/docs/markdown-view.md +1 -0
- package/docs/modal-dialog.md +1 -0
- package/docs/multi-select.md +1 -0
- package/docs/pagination-nav.md +2 -0
- package/docs/photo-gallery.md +1 -0
- package/docs/popover-panel.md +1 -0
- package/docs/progress-bar.md +1 -0
- package/docs/radio-cards.md +1 -0
- package/docs/radio-pills.md +1 -0
- package/docs/reveal-button.md +1 -0
- package/docs/scroll-to-bottom.md +1 -0
- package/docs/scroll-to-top.md +1 -0
- package/docs/skip-link.md +61 -0
- package/docs/slide-panel.md +1 -0
- package/docs/spec-list.md +79 -0
- package/docs/stat-meter.md +1 -0
- package/docs/tab-bar.md +1 -0
- package/docs/text-area.md +1 -0
- package/docs/tile-grid.md +1 -0
- package/docs/tree-view.md +1 -0
- package/docs/ui-admonition.md +1 -0
- package/docs/ui-button.md +1 -0
- package/docs/video-player.md +1 -0
- package/docs/vote-control.md +73 -0
- package/llms.txt +212 -49
- package/package.json +1 -1
package/docs/editable-text.md
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# `<empty-state>`
|
|
2
|
+
|
|
3
|
+
A centered placeholder for an empty list, an empty panel, or a zero-result
|
|
4
|
+
search: an optional leading glyph, a heading, a supporting line (or richer
|
|
5
|
+
slotted body), and an optional call-to-action row. Purely presentational —
|
|
6
|
+
it carries no interactive state of its own and no ARIA `role`; it is a
|
|
7
|
+
region of content, not a live status. Every optional part collapses
|
|
8
|
+
completely when absent, reserving no layout space.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
import "@f-ewald/components/empty-state.js";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<empty-state heading="No results found" description="Try adjusting your search or filters.">
|
|
20
|
+
<span slot="icon">...</span>
|
|
21
|
+
<ui-button slot="actions" variant="primary">Clear filters</ui-button>
|
|
22
|
+
</empty-state>
|
|
23
|
+
<empty-state size="sm" heading="No pinned items"></empty-state>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Attributes / properties
|
|
27
|
+
|
|
28
|
+
| Property | Attribute | Type | Default | Description |
|
|
29
|
+
| --- | --- | --- | --- | --- |
|
|
30
|
+
| `heading` | `heading` | `string` | `""` | The primary line. |
|
|
31
|
+
| `description` | `description` | `string` | `""` | The supporting line under the heading. Omitted entirely when empty. |
|
|
32
|
+
| `size` | `size` | `"sm" | "md"` | `"md"` | `sm` for a small panel/sidebar, `md` (default) for a full page region. `md` matches the pre-`size` look exactly. |
|
|
33
|
+
| `headingLevel` | `heading-level` | `number` | `2` | Heading rank the `heading` is exposed as, 1-6. An `empty-state` fills a page, a panel, or a sidebar, so no single rank is right everywhere; set this to whatever the surrounding outline needs. Applied via `aria-level` on the rendered `h2`, which overrides the element's native rank for assistive technology. |
|
|
34
|
+
|
|
35
|
+
## Events
|
|
36
|
+
|
|
37
|
+
_None._
|
|
38
|
+
|
|
39
|
+
## Slots
|
|
40
|
+
|
|
41
|
+
| Slot | Description |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `icon` | Optional leading glyph. The consumer supplies it (e.g. an inline SVG icon). |
|
|
44
|
+
| `(default)` | Optional rich body content, an alternative to `description`. |
|
|
45
|
+
| `actions` | Optional call to action, e.g. a `ui-button`. |
|
|
46
|
+
|
|
47
|
+
## CSS custom properties
|
|
48
|
+
|
|
49
|
+
| Custom property |
|
|
50
|
+
| --- |
|
|
51
|
+
| `--ui-font` |
|
|
52
|
+
| `--ui-font-size` |
|
|
53
|
+
| `--ui-font-size-lg` |
|
|
54
|
+
| `--ui-font-size-sm` |
|
|
55
|
+
| `--ui-font-weight-regular` |
|
|
56
|
+
| `--ui-font-weight-semibold` |
|
|
57
|
+
| `--ui-line-height-normal` |
|
|
58
|
+
| `--ui-line-height-tight` |
|
|
59
|
+
| `--ui-text` |
|
|
60
|
+
| `--ui-text-muted` |
|
package/docs/form-field.md
CHANGED
package/docs/form-select.md
CHANGED
package/docs/frame-box.md
CHANGED
package/docs/icons.md
CHANGED
|
@@ -40,6 +40,7 @@ const icon = iconPencil(16); // 16px, defaults shown below if omitted
|
|
|
40
40
|
| `iconCpuChip` | 18px | System, hardware, or technical/processing content. |
|
|
41
41
|
| `iconCurrencyDollar` | 16px | Monetary values, pricing, or billing-related content. |
|
|
42
42
|
| `iconDocument` | 18px | A generic file/document icon, e.g. tile-grid's default file icon. |
|
|
43
|
+
| `iconEllipsisHorizontal` | 16px | Collapsed items in an inline sequence, e.g. breadcrumb-nav's truncated middle. |
|
|
43
44
|
| `iconEllipsisVertical` | 16px | An overflow ("kebab") menu trigger, e.g. dropdown-button's icon variant. |
|
|
44
45
|
| `iconExclamationCircle` | 16px | Error states, e.g. the error variant of toast-notification. |
|
|
45
46
|
| `iconExclamationTriangle` | 16px | Warning states, e.g. the warning variant of toast-notification. |
|
package/docs/kanban-card.md
CHANGED
package/docs/kanban-column.md
CHANGED
package/docs/kbd-hint.md
CHANGED
package/docs/link-card.md
CHANGED
package/docs/markdown-view.md
CHANGED
package/docs/modal-dialog.md
CHANGED
package/docs/multi-select.md
CHANGED
package/docs/pagination-nav.md
CHANGED
|
@@ -50,6 +50,7 @@ _None._
|
|
|
50
50
|
| Custom property |
|
|
51
51
|
| --- |
|
|
52
52
|
| `--ui-border` |
|
|
53
|
+
| `--ui-border-width` |
|
|
53
54
|
| `--ui-button-highlight` |
|
|
54
55
|
| `--ui-button-secondary-` |
|
|
55
56
|
| `--ui-button-secondary-background` |
|
|
@@ -62,6 +63,7 @@ _None._
|
|
|
62
63
|
| `--ui-font-size-sm` |
|
|
63
64
|
| `--ui-font-weight-medium` |
|
|
64
65
|
| `--ui-line-height-tight` |
|
|
66
|
+
| `--ui-numeric` |
|
|
65
67
|
| `--ui-radius-sm` |
|
|
66
68
|
| `--ui-surface-muted` |
|
|
67
69
|
| `--ui-text` |
|
package/docs/photo-gallery.md
CHANGED
package/docs/popover-panel.md
CHANGED
package/docs/progress-bar.md
CHANGED
package/docs/radio-cards.md
CHANGED
package/docs/radio-pills.md
CHANGED
package/docs/reveal-button.md
CHANGED
package/docs/scroll-to-bottom.md
CHANGED
package/docs/scroll-to-top.md
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# `<skip-link>`
|
|
2
|
+
|
|
3
|
+
"Skip to main content" bypass link — the package's first pure
|
|
4
|
+
accessibility-utility component. It renders a real `<a>` that stays
|
|
5
|
+
visually hidden (but in the focus order) until it receives keyboard focus,
|
|
6
|
+
then pins itself to the top-left of the viewport as a solid, high-contrast
|
|
7
|
+
block so a keyboard or screen-reader user can jump straight past repeated
|
|
8
|
+
page chrome to the main content.
|
|
9
|
+
|
|
10
|
+
Activating it moves focus into the target as well as scrolling to it: a
|
|
11
|
+
plain fragment link only moves focus when the target is already focusable,
|
|
12
|
+
so this applies `tabindex="-1"` to the target on demand rather than making
|
|
13
|
+
every consumer remember to. Native navigation is never prevented, so the
|
|
14
|
+
hash still updates.
|
|
15
|
+
|
|
16
|
+
Place it as the very first focusable element on the page, before the app
|
|
17
|
+
chrome, and point `href` at the `id` of the main content region.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import "@f-ewald/components/skip-link.js";
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<skip-link href="#main"></skip-link>
|
|
29
|
+
<skip-link href="#results" label="Jump to results"></skip-link>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Attributes / properties
|
|
33
|
+
|
|
34
|
+
| Property | Attribute | Type | Default | Description |
|
|
35
|
+
| --- | --- | --- | --- | --- |
|
|
36
|
+
| `href` | `href` | `string` | `"#main"` | The in-page target the link jumps to (the `id` of the main content region). |
|
|
37
|
+
| `label` | `label` | `string` | `"Skip to main content"` | Fallback link wording used when nothing is slotted. |
|
|
38
|
+
|
|
39
|
+
## Events
|
|
40
|
+
|
|
41
|
+
_None._
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
| Slot | Description |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `(default)` | Optional custom link wording, overriding `label`. |
|
|
48
|
+
|
|
49
|
+
## CSS custom properties
|
|
50
|
+
|
|
51
|
+
| Custom property |
|
|
52
|
+
| --- |
|
|
53
|
+
| `--ui-focus-ring` |
|
|
54
|
+
| `--ui-font` |
|
|
55
|
+
| `--ui-font-size-sm` |
|
|
56
|
+
| `--ui-font-weight-medium` |
|
|
57
|
+
| `--ui-line-height-tight` |
|
|
58
|
+
| `--ui-on-accent` |
|
|
59
|
+
| `--ui-radius-sm` |
|
|
60
|
+
| `--ui-shadow` |
|
|
61
|
+
| `--ui-text` |
|
package/docs/slide-panel.md
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# `<spec-list>`
|
|
2
|
+
|
|
3
|
+
A key/value specification sheet — the "spec sheet" block on a product page:
|
|
4
|
+
a muted, wide-tracked key column against a value column, separated by
|
|
5
|
+
hairline rules (and uppercased under themes that set
|
|
6
|
+
`--ui-label-transform`). It describes ONE record's attributes, which is
|
|
7
|
+
what sets it apart from `data-table` (many records, many columns, sorting);
|
|
8
|
+
`spec-list` is not tabular and renders a real `<dl>`/`<dt>`/`<dd>` structure.
|
|
9
|
+
|
|
10
|
+
Feed it the `items` array for the plain data path, or slot bare `<dt>`/`<dd>`
|
|
11
|
+
pairs when a value needs a link, a `status-pill`, or other markup — slotted
|
|
12
|
+
pairs inherit the component's own key/value styling, so no page CSS is
|
|
13
|
+
needed. A `<div>` wrapping a pair is also accepted as a full-width grouping
|
|
14
|
+
row, but `::slotted()` cannot reach inside it, so those `dt`/`dd` stay the
|
|
15
|
+
consumer's to style. Slotted content takes precedence over `items`; with
|
|
16
|
+
neither, nothing is rendered.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import "@f-ewald/components/spec-list.js";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<spec-list caption="Specifications"></spec-list>
|
|
28
|
+
<script type="module">
|
|
29
|
+
document.querySelector("spec-list").items = [
|
|
30
|
+
{ label: "Material", value: "Anodized aluminum" },
|
|
31
|
+
{ label: "Weight", value: "1.2 kg" },
|
|
32
|
+
{ label: "Warranty", value: "2 years" },
|
|
33
|
+
];
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<!-- Or slot your own pairs when a value needs a link, a status-pill, or other
|
|
37
|
+
markup; slotted `dt`/`dd` pick up the component's own key/value styling.
|
|
38
|
+
`dividers` defaults to true; turn it off via the property, since a
|
|
39
|
+
`dividers="false"` attribute still parses as a truthy boolean. -->
|
|
40
|
+
<spec-list layout="stacked" id="sheet">
|
|
41
|
+
<dt>Homepage</dt>
|
|
42
|
+
<dd><a href="https://example.com">example.com</a></dd>
|
|
43
|
+
</spec-list>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Attributes / properties
|
|
47
|
+
|
|
48
|
+
| Property | Attribute | Type | Default | Description |
|
|
49
|
+
| --- | --- | --- | --- | --- |
|
|
50
|
+
| `items` | `items` | `SpecListItem[]` | `[]` | The key/value rows for the data-driven path. Ignored when the default slot has content. |
|
|
51
|
+
| `layout` | `layout` | `"auto" | "stacked"` | `"auto"` | `auto` is the two-column grid that collapses to stacked below `48rem`; `stacked` forces the stacked form at every width. |
|
|
52
|
+
| `dividers` | `dividers` | `boolean` | `true` | Whether to draw a hairline rule between rows; `false` for a dense inline listing. |
|
|
53
|
+
| `caption` | `caption` | `string` | `""` | Optional accessible caption rendered above the list; no element or reserved space when empty. |
|
|
54
|
+
|
|
55
|
+
## Events
|
|
56
|
+
|
|
57
|
+
_None._
|
|
58
|
+
|
|
59
|
+
## Slots
|
|
60
|
+
|
|
61
|
+
| Slot | Description |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `(default)` | Optional `<dt>`/`<dd>` pairs for values that need custom markup; when present, they replace the `items` path. |
|
|
64
|
+
|
|
65
|
+
## CSS custom properties
|
|
66
|
+
|
|
67
|
+
| Custom property |
|
|
68
|
+
| --- |
|
|
69
|
+
| `--ui-border` |
|
|
70
|
+
| `--ui-border-width` |
|
|
71
|
+
| `--ui-font` |
|
|
72
|
+
| `--ui-font-size` |
|
|
73
|
+
| `--ui-font-size-sm` |
|
|
74
|
+
| `--ui-font-weight-medium` |
|
|
75
|
+
| `--ui-label-transform` |
|
|
76
|
+
| `--ui-line-height-normal` |
|
|
77
|
+
| `--ui-text` |
|
|
78
|
+
| `--ui-text-muted` |
|
|
79
|
+
| `--ui-tracking-wide` |
|
package/docs/stat-meter.md
CHANGED
package/docs/tab-bar.md
CHANGED
package/docs/text-area.md
CHANGED
package/docs/tile-grid.md
CHANGED
package/docs/tree-view.md
CHANGED
package/docs/ui-admonition.md
CHANGED
package/docs/ui-button.md
CHANGED
package/docs/video-player.md
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# `<vote-control>`
|
|
2
|
+
|
|
3
|
+
An up/down vote widget with a live score readout — the "vote an entry up or
|
|
4
|
+
down toward a promotion threshold" pattern from a public register site,
|
|
5
|
+
where one member casts a single vote that can be changed or withdrawn at any
|
|
6
|
+
time. Two native `<button>`s flank a score; the button matching the user's
|
|
7
|
+
own cast `vote` reads as pressed (`aria-pressed`), and clicking it again
|
|
8
|
+
withdraws the vote. Set an optional `target` to render a thin progress meter
|
|
9
|
+
toward the promotion threshold beneath (vertical) or beside (horizontal) the
|
|
10
|
+
buttons.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import "@f-ewald/components/vote-control.js";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<vote-control value="7" target="10" label="Vote for this entry"></vote-control>
|
|
22
|
+
<vote-control orientation="horizontal" value="42" target="50"></vote-control>
|
|
23
|
+
<vote-control value="3" disabled></vote-control>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Attributes / properties
|
|
27
|
+
|
|
28
|
+
| Property | Attribute | Type | Default | Description |
|
|
29
|
+
| --- | --- | --- | --- | --- |
|
|
30
|
+
| `value` | `value` | `number` | `0` | The current net score shown between the buttons. |
|
|
31
|
+
| `vote` | `vote` | `"up" | "down" | null` | `null` | This user's own cast vote, or `null` if they have not voted. Reflected so CSS can style the pressed button. |
|
|
32
|
+
| `disabled` | `disabled` | `boolean` | `false` | Disables both buttons and dims the control. |
|
|
33
|
+
| `orientation` | `orientation` | `"vertical" | "horizontal"` | `"vertical"` | Layout — `vertical` is the compact stacked box (default); `horizontal` is the wide inline variant. |
|
|
34
|
+
| `target` | `target` | `number` | `0` | Promotion threshold. When > 0, a thin progress meter toward it renders; when 0 (default) no meter renders and no space is reserved for it. |
|
|
35
|
+
| `label` | `label` | `string` | `"Vote"` | Accessible label naming the vote group. |
|
|
36
|
+
|
|
37
|
+
## Events
|
|
38
|
+
|
|
39
|
+
| Event | Description |
|
|
40
|
+
| --- | --- |
|
|
41
|
+
| `vote-change` | The user cast, switched, or withdrew their vote; detail: { vote: "up" | "down" | null, value: number }. |
|
|
42
|
+
|
|
43
|
+
## Slots
|
|
44
|
+
|
|
45
|
+
_None._
|
|
46
|
+
|
|
47
|
+
## CSS custom properties
|
|
48
|
+
|
|
49
|
+
| Custom property |
|
|
50
|
+
| --- |
|
|
51
|
+
| `--ui-border` |
|
|
52
|
+
| `--ui-border-width` |
|
|
53
|
+
| `--ui-button-accent` |
|
|
54
|
+
| `--ui-danger` |
|
|
55
|
+
| `--ui-focus-ring` |
|
|
56
|
+
| `--ui-font` |
|
|
57
|
+
| `--ui-font-size-lg` |
|
|
58
|
+
| `--ui-font-size-xs` |
|
|
59
|
+
| `--ui-font-weight-medium` |
|
|
60
|
+
| `--ui-font-weight-semibold` |
|
|
61
|
+
| `--ui-label-transform` |
|
|
62
|
+
| `--ui-line-height-tight` |
|
|
63
|
+
| `--ui-numeric` |
|
|
64
|
+
| `--ui-primary` |
|
|
65
|
+
| `--ui-radius` |
|
|
66
|
+
| `--ui-radius-pill` |
|
|
67
|
+
| `--ui-radius-sm` |
|
|
68
|
+
| `--ui-success` |
|
|
69
|
+
| `--ui-surface` |
|
|
70
|
+
| `--ui-surface-muted` |
|
|
71
|
+
| `--ui-text` |
|
|
72
|
+
| `--ui-text-muted` |
|
|
73
|
+
| `--ui-tracking-wide` |
|