ochreui 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +153 -2
- package/cli/ochreui.mjs +601 -0
- package/mcp/core.mjs +126 -0
- package/mcp/docs.json +906 -0
- package/mcp/server.mjs +23 -0
- package/package.json +393 -3
- package/registry/agent-team.ts +350 -0
- package/registry/avatar.ts +300 -0
- package/registry/badge.ts +207 -0
- package/registry/breadcrumb.ts +435 -0
- package/registry/button.ts +238 -0
- package/registry/card.ts +221 -0
- package/registry/change-summary.ts +200 -0
- package/registry/checkbox.ts +204 -0
- package/registry/code-block.ts +332 -0
- package/registry/color-picker.ts +720 -0
- package/registry/comment-thread.ts +503 -0
- package/registry/context-menu.ts +281 -0
- package/registry/cover-flow.ts +623 -0
- package/registry/date-picker.ts +799 -0
- package/registry/decision-inbox.ts +340 -0
- package/registry/dialog.ts +577 -0
- package/registry/dropdown-menu.ts +864 -0
- package/registry/email-draft.ts +916 -0
- package/registry/empty-calendar.ts +199 -0
- package/registry/empty-state.ts +164 -0
- package/registry/enrichment-orbit.ts +164 -0
- package/registry/filter-menu.ts +541 -0
- package/registry/form-field.ts +308 -0
- package/registry/frost-cloud.ts +381 -0
- package/registry/ghosted-chat.ts +210 -0
- package/registry/glow-cloud.ts +402 -0
- package/registry/grid-background.ts +164 -0
- package/registry/hover-card.ts +401 -0
- package/registry/icon-button.ts +133 -0
- package/registry/index.json +2124 -0
- package/registry/integration-beam.ts +588 -0
- package/registry/integration-grid.ts +209 -0
- package/registry/kbd.ts +176 -0
- package/registry/layer-stack.ts +351 -0
- package/registry/lead-sourcing.ts +285 -0
- package/registry/logo-cluster.ts +239 -0
- package/registry/logo-marquee.ts +505 -0
- package/registry/message-actions.ts +833 -0
- package/registry/model-orbit.ts +583 -0
- package/registry/model-wheel.ts +372 -0
- package/registry/notification-stack.ts +301 -0
- package/registry/number-input.ts +552 -0
- package/registry/number-ticker.ts +261 -0
- package/registry/ochre.css +917 -0
- package/registry/otp-input.ts +704 -0
- package/registry/overlay.ts +312 -0
- package/registry/pagination.ts +362 -0
- package/registry/popover.ts +296 -0
- package/registry/profile-menu.ts +332 -0
- package/registry/progress-tracker.ts +291 -0
- package/registry/rating.ts +461 -0
- package/registry/reaction-bar.ts +322 -0
- package/registry/region-map.ts +537 -0
- package/registry/resizable.ts +489 -0
- package/registry/scroll-area.ts +271 -0
- package/registry/segmented-control.ts +433 -0
- package/registry/select.ts +769 -0
- package/registry/separator.ts +97 -0
- package/registry/shimmer-loader.ts +211 -0
- package/registry/side-folder.ts +152 -0
- package/registry/skeleton.ts +136 -0
- package/registry/skill/INSTRUCTIONS.md +11 -0
- package/registry/skill/SKILL.md +65 -0
- package/registry/skill/checklist.md +45 -0
- package/registry/skill/references/agent-team.md +105 -0
- package/registry/skill/references/avatar.md +88 -0
- package/registry/skill/references/badge.md +92 -0
- package/registry/skill/references/breadcrumb.md +99 -0
- package/registry/skill/references/button.md +82 -0
- package/registry/skill/references/card.md +111 -0
- package/registry/skill/references/catalog.md +114 -0
- package/registry/skill/references/change-summary.md +103 -0
- package/registry/skill/references/checkbox.md +105 -0
- package/registry/skill/references/code-block.md +109 -0
- package/registry/skill/references/color-picker.md +138 -0
- package/registry/skill/references/comment-thread.md +164 -0
- package/registry/skill/references/context-menu.md +205 -0
- package/registry/skill/references/cover-flow.md +128 -0
- package/registry/skill/references/date-picker.md +154 -0
- package/registry/skill/references/decision-inbox.md +126 -0
- package/registry/skill/references/dialog.md +155 -0
- package/registry/skill/references/dropdown-menu.md +144 -0
- package/registry/skill/references/email-draft.md +182 -0
- package/registry/skill/references/empty-calendar.md +74 -0
- package/registry/skill/references/empty-state.md +118 -0
- package/registry/skill/references/enrichment-orbit.md +71 -0
- package/registry/skill/references/filter-menu.md +143 -0
- package/registry/skill/references/form-field.md +118 -0
- package/registry/skill/references/frost-cloud.md +80 -0
- package/registry/skill/references/ghosted-chat.md +75 -0
- package/registry/skill/references/glow-cloud.md +84 -0
- package/registry/skill/references/grid-background.md +76 -0
- package/registry/skill/references/hover-card.md +125 -0
- package/registry/skill/references/icon-button.md +99 -0
- package/registry/skill/references/integration-beam.md +107 -0
- package/registry/skill/references/integration-grid.md +100 -0
- package/registry/skill/references/kbd.md +65 -0
- package/registry/skill/references/layer-stack.md +115 -0
- package/registry/skill/references/lead-sourcing.md +92 -0
- package/registry/skill/references/logo-cluster.md +92 -0
- package/registry/skill/references/logo-marquee.md +123 -0
- package/registry/skill/references/message-actions.md +146 -0
- package/registry/skill/references/model-orbit.md +106 -0
- package/registry/skill/references/model-wheel.md +84 -0
- package/registry/skill/references/notification-stack.md +138 -0
- package/registry/skill/references/number-input.md +117 -0
- package/registry/skill/references/number-ticker.md +73 -0
- package/registry/skill/references/otp-input.md +142 -0
- package/registry/skill/references/pagination.md +112 -0
- package/registry/skill/references/popover.md +143 -0
- package/registry/skill/references/profile-menu.md +123 -0
- package/registry/skill/references/progress-tracker.md +122 -0
- package/registry/skill/references/rating.md +111 -0
- package/registry/skill/references/reaction-bar.md +128 -0
- package/registry/skill/references/region-map.md +109 -0
- package/registry/skill/references/resizable.md +127 -0
- package/registry/skill/references/scroll-area.md +113 -0
- package/registry/skill/references/segmented-control.md +96 -0
- package/registry/skill/references/select.md +122 -0
- package/registry/skill/references/separator.md +69 -0
- package/registry/skill/references/shimmer-loader.md +83 -0
- package/registry/skill/references/side-folder.md +75 -0
- package/registry/skill/references/skeleton.md +95 -0
- package/registry/skill/references/smart-recommendation.md +132 -0
- package/registry/skill/references/spinner.md +84 -0
- package/registry/skill/references/switch.md +79 -0
- package/registry/skill/references/tab-overload.md +70 -0
- package/registry/skill/references/tag-input.md +126 -0
- package/registry/skill/references/team-invite.md +94 -0
- package/registry/skill/references/testimonial-wall.md +110 -0
- package/registry/skill/references/text-area.md +115 -0
- package/registry/skill/references/text-field.md +126 -0
- package/registry/skill/references/text-reveal.md +71 -0
- package/registry/skill/references/thinking-loader.md +87 -0
- package/registry/skill/references/time-picker.md +122 -0
- package/registry/skill/references/tips-panel.md +115 -0
- package/registry/skill/references/toggle-group.md +98 -0
- package/registry/skill/references/tool-call-card.md +151 -0
- package/registry/skill/references/tooltip.md +94 -0
- package/registry/skill/references/tree-view.md +172 -0
- package/registry/skill/theming.md +57 -0
- package/registry/smart-recommendation.ts +415 -0
- package/registry/spinner.ts +67 -0
- package/registry/switch.ts +146 -0
- package/registry/tab-overload.ts +211 -0
- package/registry/tag-input.ts +620 -0
- package/registry/team-invite.ts +248 -0
- package/registry/testimonial-wall.ts +521 -0
- package/registry/text-area.ts +432 -0
- package/registry/text-field.ts +415 -0
- package/registry/text-reveal.ts +175 -0
- package/registry/theme.ts +68 -0
- package/registry/thinking-loader.ts +302 -0
- package/registry/time-picker.ts +828 -0
- package/registry/tips-panel.ts +312 -0
- package/registry/toggle-group.ts +357 -0
- package/registry/tool-call-card.ts +578 -0
- package/registry/tooltip.ts +486 -0
- package/registry/tree-view.ts +454 -0
- package/styles/base.css +500 -0
- package/styles/tokens.css +415 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Popover
|
|
2
|
+
|
|
3
|
+
A small card attached to its trigger: a title, a quiet line and any content, such as a short form. It flips and shortens to stay on screen, closes on a press outside, Escape or Tab, and gives focus back to the trigger.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add popover`
|
|
6
|
+
Import: `import { UiPopover, UiPopoverTrigger, UiPopoverContent } from './ui/popover';`
|
|
7
|
+
Selector: `<ui-popover>`
|
|
8
|
+
Docs: /components/popover
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- A short form next to the button that asks for it: a schedule, an invite, a rename.
|
|
12
|
+
- A few settings or an explanation that stays close to what it is about.
|
|
13
|
+
- The base for your own floating panels (unstyled).
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
- A list of actions: use Dropdown Menu.
|
|
17
|
+
- Picking a value for a form field: use Select.
|
|
18
|
+
- Something that needs a decision first: use a dialog.
|
|
19
|
+
- A status after an action: use a toast.
|
|
20
|
+
- A short label on hover: use Tooltip.
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { Component, signal } from '@angular/core';
|
|
26
|
+
import { FormField, email, form, required } from '@angular/forms/signals';
|
|
27
|
+
import { UiButton } from './ui/button';
|
|
28
|
+
import { UiPopover, UiPopoverTrigger } from './ui/popover';
|
|
29
|
+
import { UiInput, UiTextField } from './ui/text-field';
|
|
30
|
+
|
|
31
|
+
@Component({
|
|
32
|
+
selector: 'app-share-report',
|
|
33
|
+
imports: [UiButton, UiPopover, UiPopoverTrigger, UiTextField, UiInput, FormField],
|
|
34
|
+
template: `
|
|
35
|
+
<span class="anchor">
|
|
36
|
+
<button type="button" uiButton variant="secondary" [uiPopoverTrigger]="share">Share</button>
|
|
37
|
+
<ui-popover #share [(open)]="open" align="end" [width]="300"
|
|
38
|
+
title="Share the report" description="They get an email with a link to this report.">
|
|
39
|
+
<form class="invite" (submit)="send($event)">
|
|
40
|
+
<ui-text-field>
|
|
41
|
+
<input uiInput type="email" aria-label="Email address" placeholder="name@company.com" [formField]="f.email" />
|
|
42
|
+
</ui-text-field>
|
|
43
|
+
<button type="submit" uiButton>Send</button>
|
|
44
|
+
</form>
|
|
45
|
+
</ui-popover>
|
|
46
|
+
</span>
|
|
47
|
+
`,
|
|
48
|
+
styles: `
|
|
49
|
+
.anchor { display: inline-flex; }
|
|
50
|
+
.invite { display: flex; gap: 8px; }
|
|
51
|
+
.invite ui-text-field { flex: 1; }
|
|
52
|
+
`,
|
|
53
|
+
})
|
|
54
|
+
export class ShareReport {
|
|
55
|
+
protected readonly open = signal(false);
|
|
56
|
+
private readonly model = signal({ email: '' });
|
|
57
|
+
protected readonly f = form(this.model, (p) => {
|
|
58
|
+
required(p.email);
|
|
59
|
+
email(p.email);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
protected send(event: Event) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
if (this.f().invalid()) return;
|
|
65
|
+
this.model.set({ email: '' });
|
|
66
|
+
this.open.set(false);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Rules
|
|
72
|
+
- Write <ui-popover> right after its trigger, inside an inline-flex wrapper, so Tab order and the default anchor work.
|
|
73
|
+
- Bind [(open)]; set it false yourself when a form inside is done. Focus returns to the trigger.
|
|
74
|
+
- Without a title, give it aria-label or aria-labelledby.
|
|
75
|
+
- Use <ng-template uiPopoverContent> for content created only while open.
|
|
76
|
+
- Needs overlay.ts next to popover.ts (the CLI adds it): the placement, Escape and outside-press layer shared by the floating components.
|
|
77
|
+
|
|
78
|
+
## Inputs
|
|
79
|
+
|
|
80
|
+
| Name | Type | Default | Description |
|
|
81
|
+
| --- | --- | --- | --- |
|
|
82
|
+
| `open` | `boolean` | false | Shows it. Two-way [(open)]; turns false by itself when dismissed. |
|
|
83
|
+
| `side` | `'bottom' \| 'top' \| 'right' \| 'left'` | 'bottom' | Preferred side; flips to the side with more room. |
|
|
84
|
+
| `align` | `'start' \| 'center' \| 'end'` | 'start' | Edges that line up (logical in RTL); switches when it would stick out. |
|
|
85
|
+
| `offset` | `number` | 6 | Gap to the anchor in px. |
|
|
86
|
+
| `anchor` | `HTMLElement \| ElementRef<HTMLElement> \| null` | null | What it attaches to. Default: the uiPopoverTrigger, else the parent element. |
|
|
87
|
+
| `title` | `string` | none | Heading and accessible name (aria-labelledby). |
|
|
88
|
+
| `description` | `string` | none | Quiet line under the title (aria-describedby). |
|
|
89
|
+
| `width` | `number \| string` | none | Card width (number = px). Default fits the content, never wider than the window. |
|
|
90
|
+
| `focusOnOpen` | `boolean` | true | Focuses [autofocus], the first control or the card on open; never when open from the first render. |
|
|
91
|
+
| `unstyled` | `boolean` | false | Placement, motion and closing only; your class draws it. |
|
|
92
|
+
| `role` | `string` | 'dialog' | Card role; the trigger's aria-haspopup follows it. |
|
|
93
|
+
| `id` | `string` | generated | Card id, used by aria-controls. |
|
|
94
|
+
| `aria-labelledby` | `string` | none | Your own label when there is no title. |
|
|
95
|
+
| `aria-describedby` | `string` | none | Your own descriptions, kept with the description. |
|
|
96
|
+
| `uiPopoverTrigger (UiPopoverTrigger)` | `UiPopover` | required | On the button: toggles on click, sets aria-haspopup, aria-expanded and aria-controls. |
|
|
97
|
+
|
|
98
|
+
## Outputs
|
|
99
|
+
|
|
100
|
+
| Name | Payload | Description |
|
|
101
|
+
| --- | --- | --- |
|
|
102
|
+
| `openChange` | `boolean` | Every change of open. |
|
|
103
|
+
| `dismissed` | `'escape' \| 'outside' \| 'focus-out' \| 'trigger'` | Why it closed by itself, before open turns false. |
|
|
104
|
+
|
|
105
|
+
## Template: uiPopoverContent
|
|
106
|
+
|
|
107
|
+
Lazy content: created on open, destroyed on close. Context: `none`.
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<ui-popover #pop [(open)]="open" title="Rename agent">
|
|
111
|
+
<ng-template uiPopoverContent>
|
|
112
|
+
<form>…</form>
|
|
113
|
+
</ng-template>
|
|
114
|
+
</ui-popover>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## CSS variables
|
|
118
|
+
|
|
119
|
+
| Variable | Default | Description |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `--ui-popover-bg` | `var(--ui-bg-overlay)` | Fill. |
|
|
122
|
+
| `--ui-popover-fg` | `var(--ui-text)` | Text. |
|
|
123
|
+
| `--ui-popover-radius` | `12px (Classic 16px)` | Corners. |
|
|
124
|
+
| `--ui-popover-padding` | `14px (Classic 16px)` | Inner space. |
|
|
125
|
+
| `--ui-popover-shadow` | `var(--ui-shadow-md)` | Ring and drop shadow. |
|
|
126
|
+
| `--ui-popover-width` | `max-content` | Width when the width input is unset. |
|
|
127
|
+
| `--ui-popover-drift` | `4px` | Glide distance on enter. |
|
|
128
|
+
| `--ui-popover-from` | `0.96` | Starting scale on enter. |
|
|
129
|
+
|
|
130
|
+
## Keyboard
|
|
131
|
+
|
|
132
|
+
| Keys | Action |
|
|
133
|
+
| --- | --- |
|
|
134
|
+
| Enter / Space | On the trigger: opens and focuses the first control; again closes. |
|
|
135
|
+
| Tab / Shift+Tab | Through the controls inside; leaving trigger and card closes it. |
|
|
136
|
+
| Escape | Closes the innermost popover and returns focus to its trigger. |
|
|
137
|
+
|
|
138
|
+
## Accessibility
|
|
139
|
+
- Non-modal role=dialog named by the title, described by the description.
|
|
140
|
+
- Trigger gets aria-haspopup, aria-expanded and aria-controls (while open).
|
|
141
|
+
- Focus returns to the trigger on every close while focus was inside, also when a button inside closes it.
|
|
142
|
+
- Without title or controls, the card takes focus and its body is the description.
|
|
143
|
+
- Description ≥ 4.5:1; forced colors keep a card edge.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Profile Menu
|
|
2
|
+
|
|
3
|
+
The account card behind the avatar in an app header: who is signed in, the account actions as a keyboard-friendly menu, and an optional profile-setup bar with the next step.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add profile-menu`
|
|
6
|
+
Import: `import { UiProfileMenu, UiProfileMenuItem } from './ui/profile-menu';`
|
|
7
|
+
Selector: `<ui-profile-menu>`
|
|
8
|
+
Docs: /components/profile-menu
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- The panel behind the avatar in an app header.
|
|
12
|
+
- Nudging people to finish their profile next to their account actions.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- Long menus, submenus or checkable items: use a dropdown menu.
|
|
16
|
+
- Onboarding with many explained steps: use a step checklist.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Component, inject, signal } from '@angular/core';
|
|
22
|
+
import { Router } from '@angular/router';
|
|
23
|
+
import { UiAvatar } from './ui/avatar';
|
|
24
|
+
import { UiProfileMenu, UiProfileMenuItem } from './ui/profile-menu';
|
|
25
|
+
|
|
26
|
+
@Component({
|
|
27
|
+
selector: 'app-account-card',
|
|
28
|
+
imports: [UiProfileMenu, UiProfileMenuItem, UiAvatar],
|
|
29
|
+
template: `
|
|
30
|
+
<ui-profile-menu name="Noor Aziz" email="noor.aziz@northwind.dev" [setup]="setup()" (continue)="openProfile()">
|
|
31
|
+
<ui-avatar uiProfileAvatar name="Noor Aziz" src="/avatars/noor.jpg" aria-hidden="true" />
|
|
32
|
+
<button uiProfileMenuItem (click)="router.navigate(['/settings'])">
|
|
33
|
+
<svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="2.5" /><circle cx="12" cy="12" r="6" /><path d="M12 3v3M12 18v3M3 12h3M18 12h3" /></svg>
|
|
34
|
+
<span>Settings</span>
|
|
35
|
+
</button>
|
|
36
|
+
<button uiProfileMenuItem (click)="signOut()">
|
|
37
|
+
<svg class="ui-icon" viewBox="0 0 24 24" aria-hidden="true"><path d="M10 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h4M15 8l4 4-4 4M19 12H9" /></svg>
|
|
38
|
+
<span>Log out</span>
|
|
39
|
+
</button>
|
|
40
|
+
</ui-profile-menu>
|
|
41
|
+
`,
|
|
42
|
+
})
|
|
43
|
+
export class AccountCard {
|
|
44
|
+
protected readonly router = inject(Router);
|
|
45
|
+
protected readonly setup = signal({ done: 3, total: 5, next: 'Add a profile photo' });
|
|
46
|
+
|
|
47
|
+
protected openProfile() {
|
|
48
|
+
this.router.navigate(['/profile']);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected signOut() {
|
|
52
|
+
this.router.navigate(['/sign-in']);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Rules
|
|
58
|
+
- Put uiProfileMenuItem on your own <button> or <a>, with an <svg> icon and a <span> label.
|
|
59
|
+
- A trailing <span class="ui-badge"> is info-toned unless it has a tone class.
|
|
60
|
+
- Mark the avatar uiProfileAvatar and aria-hidden="true"; do not wrap it in @if.
|
|
61
|
+
- In a dropdown: call focusFirst() on open, close on (itemSelect) and Escape, return focus to the trigger.
|
|
62
|
+
|
|
63
|
+
## Inputs
|
|
64
|
+
|
|
65
|
+
| Name | Type | Default | Description |
|
|
66
|
+
| --- | --- | --- | --- |
|
|
67
|
+
| `name` | `string` | required | Signed-in person; one line, ellipsis. |
|
|
68
|
+
| `email` | `string` | none | Under the name; one line, ellipsis. |
|
|
69
|
+
| `setup` | `ProfileSetup \| null` | null | Setup progress; null or total 0 hides the block. |
|
|
70
|
+
| `labels` | `Partial<ProfileMenuLabels>` | {} | Every visible and spoken string. |
|
|
71
|
+
| `disabled (UiProfileMenuItem)` | `boolean` | false | Skipped by arrows and typeahead; aria-disabled on links. |
|
|
72
|
+
|
|
73
|
+
## Outputs
|
|
74
|
+
|
|
75
|
+
| Name | Payload | Description |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `continue` | `void` | The next-step button was pressed. |
|
|
78
|
+
| `itemSelect` | `HTMLElement` | An action was activated, after its own (click). Close a dropdown here. |
|
|
79
|
+
|
|
80
|
+
## ProfileSetup
|
|
81
|
+
|
|
82
|
+
| Field | Type | Description |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| `done` | `number` | Steps finished; clamped to 0…total. |
|
|
85
|
+
| `total` | `number` | All steps; 0 hides the block. |
|
|
86
|
+
| `next` | `string?` | The next step, on the button under the bar. Omit it to hide the button. |
|
|
87
|
+
|
|
88
|
+
## ProfileMenuLabels
|
|
89
|
+
|
|
90
|
+
| Field | Type | Description |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `menu` | `string` | The menu name (default Account). |
|
|
93
|
+
| `setup` | `string` | Setup title and progress bar name (default Profile setup). |
|
|
94
|
+
| `next` | `string` | Before the next step (default Next:). |
|
|
95
|
+
| `progress` | `(done: number, total: number) => string` | Spoken value of the bar (default "3 of 5 steps done"). |
|
|
96
|
+
|
|
97
|
+
## CSS variables
|
|
98
|
+
|
|
99
|
+
| Variable | Default | Description |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| `--ui-profile-menu-width` | `260px (Classic 320px)` | Card width; shrinks with its container. |
|
|
102
|
+
| `--ui-profile-menu-avatar` | `32px (Classic 40px)` | Avatar size. |
|
|
103
|
+
| `--ui-profile-menu-bg` | `var(--ui-bg-surface)` | Card fill. |
|
|
104
|
+
| `--ui-profile-menu-track` | `var(--ui-bg-muted)` | Progress track. |
|
|
105
|
+
| `--ui-profile-menu-fill` | `var(--ui-accent)` | Progress fill, ≥ 3:1 on the track. |
|
|
106
|
+
|
|
107
|
+
## Keyboard
|
|
108
|
+
|
|
109
|
+
| Keys | Action |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| Tab | Into the menu on the last-used action; then the next-step button. |
|
|
112
|
+
| ↓ / ↑ | Next / previous action, wrapping; disabled skipped. |
|
|
113
|
+
| Home / End | First / last action. |
|
|
114
|
+
| Letters | Next action whose label starts with them. |
|
|
115
|
+
| Enter / Space | Activates the action, links included. |
|
|
116
|
+
| Esc | Closes the enclosing dropdown, if it handles it. |
|
|
117
|
+
|
|
118
|
+
## Accessibility
|
|
119
|
+
- Actions are role=menu named Account, one Tab stop, visible focus ring.
|
|
120
|
+
- Avatar hidden; name and email are plain text.
|
|
121
|
+
- Progressbar in steps with aria-valuetext; visual count aria-hidden.
|
|
122
|
+
- Touch: actions and next-step button ≥ 44px.
|
|
123
|
+
- Forced colors: card edge, bar track and fill kept.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Progress Tracker
|
|
2
|
+
|
|
3
|
+
An onboarding checklist card with a title, a done/total count and a thin progress bar. Ticking a step pops its dot, draws the tick, strikes the label and fills the bar; auto play can run the list by itself.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add progress-tracker`
|
|
6
|
+
Import: `import { UiProgressTracker, UiProgressStepIcon } from './ui/progress-tracker';`
|
|
7
|
+
Selector: `<ui-progress-tracker>`
|
|
8
|
+
Docs: /components/progress-tracker
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Onboarding checklists for someone's first steps.
|
|
12
|
+
- Short task lists where finishing one should feel rewarding.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- More than about eight steps: the card gets hard to scan.
|
|
16
|
+
- Long step names: each step is one line with an ellipsis.
|
|
17
|
+
- Steps that must happen in order: use a stepper.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { Component, signal } from '@angular/core';
|
|
23
|
+
import { ProgressStep, ProgressStepToggle, UiProgressTracker } from './ui/progress-tracker';
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'app-onboarding',
|
|
27
|
+
imports: [UiProgressTracker],
|
|
28
|
+
template: `
|
|
29
|
+
<ui-progress-tracker title="Set up your workspace" [(steps)]="steps" (stepToggle)="save($event)" />
|
|
30
|
+
`,
|
|
31
|
+
})
|
|
32
|
+
export class Onboarding {
|
|
33
|
+
protected readonly steps = signal<ProgressStep[]>([
|
|
34
|
+
{ id: 'repo', label: 'Connect a repository' },
|
|
35
|
+
{ id: 'alerts', label: 'Turn on build alerts' },
|
|
36
|
+
{ id: 'project', label: 'Create a first project', done: true },
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
protected save({ step, done }: ProgressStepToggle) {
|
|
40
|
+
fetch(`/api/onboarding/${step.id}`, { method: 'PUT', body: JSON.stringify({ done }) });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Rules
|
|
46
|
+
- Give every step a unique id and a non-empty label.
|
|
47
|
+
- Bind [(steps)] to a signal to keep the state; with one-way [steps] the card keeps its own copy.
|
|
48
|
+
- Use autoPlay only for decorative or marketing cards, not for real task lists.
|
|
49
|
+
|
|
50
|
+
## Inputs
|
|
51
|
+
|
|
52
|
+
| Name | Type | Default | Description |
|
|
53
|
+
| --- | --- | --- | --- |
|
|
54
|
+
| `steps` | `ProgressStep[]` | required | The steps, in order. Two-way with [(steps)]; each toggle writes a new array with a new object for that step. |
|
|
55
|
+
| `title` | `string` | 'Getting started' | The heading above the bar. |
|
|
56
|
+
| `level` | `number` | 3 | The title's heading level. |
|
|
57
|
+
| `autoPlay` | `boolean` | false | Ticks open steps one by one, holds two intervals, resets to the starting state. Waits while off-screen or in a hidden tab. A click, key or focus inside stops it for good. |
|
|
58
|
+
| `interval` | `number` | 2200 | Milliseconds between automatic ticks. |
|
|
59
|
+
| `labels` | `Partial<ProgressTrackerLabels>` | English | The bar's spoken name (progress) and value (valueText, with {done} and {total}). |
|
|
60
|
+
|
|
61
|
+
## Outputs
|
|
62
|
+
|
|
63
|
+
| Name | Payload | Description |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `stepsChange` | `ProgressStep[]` | Every change, from a person or auto play. The other half of [(steps)]. |
|
|
66
|
+
| `stepToggle` | `ProgressStepToggle` | { step, done } after someone ticks or unticks a step. Not emitted by auto play. |
|
|
67
|
+
|
|
68
|
+
## ProgressStep
|
|
69
|
+
|
|
70
|
+
| Field | Type | Description |
|
|
71
|
+
| --- | --- | --- |
|
|
72
|
+
| `id` | `string` | Unique; keeps the row in place when the array is replaced. |
|
|
73
|
+
| `label` | `string` | One line, cut off with an ellipsis. The checkbox's name. |
|
|
74
|
+
| `done` | `boolean?` | Ticked. |
|
|
75
|
+
|
|
76
|
+
## ProgressStepToggle
|
|
77
|
+
|
|
78
|
+
| Field | Type | Description |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| `step` | `ProgressStep` | The step as it now is. |
|
|
81
|
+
| `done` | `boolean` | Its new state. |
|
|
82
|
+
|
|
83
|
+
## ProgressTrackerLabels
|
|
84
|
+
|
|
85
|
+
| Field | Type | Description |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `progress` | `string` | The bar's spoken name. Default 'Progress'. |
|
|
88
|
+
| `valueText` | `string` | The bar's spoken value. Default '{done} of {total} done'. |
|
|
89
|
+
|
|
90
|
+
## Template: uiProgressStepIcon
|
|
91
|
+
|
|
92
|
+
An icon between the dot and the label, 18px square. Context: `ProgressStep`.
|
|
93
|
+
|
|
94
|
+
```html
|
|
95
|
+
<ui-progress-tracker [(steps)]="steps">
|
|
96
|
+
<ng-template uiProgressStepIcon let-step>
|
|
97
|
+
<img [src]="'/icons/' + step.id + '.svg'" alt="" />
|
|
98
|
+
</ng-template>
|
|
99
|
+
</ui-progress-tracker>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## CSS variables
|
|
103
|
+
|
|
104
|
+
| Variable | Default | Description |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| `--ui-progress-tracker-fill` | `blue (var(--ui-hue-blue), sky in dark); var(--ui-bg-neutral-solid) in Classic` | Bar fill and done dots. |
|
|
107
|
+
| `--ui-progress-tracker-tick` | `var(--ui-bg-knob); var(--ui-text-on-neutral) in Classic` | The tick on a done dot. |
|
|
108
|
+
| `--ui-progress-tracker-track` | `color-mix(in srgb, var(--ui-text) 6.5%, var(--ui-bg-surface)); 8% text in dark mode, 11% in dark Classic` | The bar's groove. |
|
|
109
|
+
| `--ui-progress-tracker-ring` | `var(--ui-border-strong); var(--ui-border-input) in Classic` | An open dot's edge. |
|
|
110
|
+
|
|
111
|
+
## Keyboard
|
|
112
|
+
|
|
113
|
+
| Keys | Action |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| Tab | Next step; every step is a stop. |
|
|
116
|
+
| Space / Enter | Ticks or unticks the focused step. |
|
|
117
|
+
|
|
118
|
+
## Accessibility
|
|
119
|
+
- Each step is a button with role=checkbox and aria-checked, named by its label.
|
|
120
|
+
- The bar is a progressbar named 'Progress' with aria-valuetext '2 of 5 done'; the visible count is aria-hidden, so the title is read once.
|
|
121
|
+
- Any pointer press, key press or focus inside stops auto play for good.
|
|
122
|
+
- Forced colors: dots, ticks, bar and strike stay visible in system colours; done labels use GrayText.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Rating
|
|
2
|
+
|
|
3
|
+
Stars from 1 to any count, or a thumbs up / down pair for AI answers. Hover previews, a press sets and a second press clears, arrows move in one tab stop, and read-only stars show averages with halves. Works with signal forms, reactive forms and ngModel.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add rating`
|
|
6
|
+
Import: `import { UiRating, UiRatingThumbs } from './ui/rating';`
|
|
7
|
+
Selector: `<ui-rating, ui-rating-thumbs>`
|
|
8
|
+
Docs: /components/rating
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Thumbs up/down under an AI answer (ui-rating-thumbs).
|
|
12
|
+
- Scoring a run, agent, template or reply with 1 to N stars.
|
|
13
|
+
- Showing an average in a list: readonly, with half stars.
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
- Feedback next to copy/retry/share under a chat message: use Message Actions.
|
|
17
|
+
- Named steps (Low/Medium/High): use Segmented Control or Toggle Group.
|
|
18
|
+
- On/off: use Switch or Checkbox.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { Component, signal } from '@angular/core';
|
|
24
|
+
import { FormField, form, required } from '@angular/forms/signals';
|
|
25
|
+
import { UiRating } from './ui/rating';
|
|
26
|
+
|
|
27
|
+
@Component({
|
|
28
|
+
selector: 'app-run-review',
|
|
29
|
+
imports: [UiRating, FormField],
|
|
30
|
+
template: `
|
|
31
|
+
<span id="run-score">Rate this run</span>
|
|
32
|
+
<ui-rating aria-labelledby="run-score" [formField]="f.score" />
|
|
33
|
+
`,
|
|
34
|
+
})
|
|
35
|
+
export class RunReview {
|
|
36
|
+
private readonly model = signal({ score: null as number | null });
|
|
37
|
+
protected readonly f = form(this.model, (p) => required(p.score));
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
- Bind value with [formField], formControl, ngModel or [(value)].
|
|
43
|
+
- With [formField], set the star count with the schema max(), not the max attribute; don't set name or disabled.
|
|
44
|
+
- Interactive values are whole numbers 1..max or null; use readonly for fractional averages.
|
|
45
|
+
- Always name an interactive group with aria-label or aria-labelledby.
|
|
46
|
+
- Translate with valueLabel (stars) and labels.
|
|
47
|
+
|
|
48
|
+
## Inputs
|
|
49
|
+
|
|
50
|
+
| Name | Type | Default | Description |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| `value` | `number \| null (model)` | null | 1 to max, or null. Read-only: any number, drawn to the nearest half. |
|
|
53
|
+
| `max` | `number` | 5 | Star count, 1 to 50, always on one line (never wraps). Signal forms: schema max(). |
|
|
54
|
+
| `readonly` | `boolean` | false | Display only: role=img named by the value, halves, not focusable. |
|
|
55
|
+
| `disabled` | `boolean` | false | --ui-disabled-opacity on the whole group, keeps its value, not focusable. Forms set it. |
|
|
56
|
+
| `allowClear` | `boolean` | true | Pressing the chosen one again, or Delete, clears to null. |
|
|
57
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | 'md' (read-only stars: 'sm') | Stars 14/18/24px on 24/24/30px buttons (24px targets), gap 2; read-only no button, gap 1 (Classic +2); touch hit 32px. Thumbs 24/28/32px (Classic +4). |
|
|
58
|
+
| `valueLabel` | `(value: number, max: number) => string` | "{v} out of {max}" | Stars only: each star's name and the read-only label. |
|
|
59
|
+
| `labels` | `Partial<RatingLabels> \| Partial<RatingThumbsLabels>` | English | Stars: group, none. Thumbs: up, down, group. |
|
|
60
|
+
| `name` | `string` | none | Submits the value through a hidden input, empty when none; a native form reset restores the first value. Signal forms set it. |
|
|
61
|
+
| `required / invalid` | `boolean` | false | aria-required / aria-invalid on the group. Signal forms set them. |
|
|
62
|
+
| `value (UiRatingThumbs)` | `'up' \| 'down' \| null (model)` | null | The vote. |
|
|
63
|
+
| `readonly (UiRatingThumbs)` | `boolean` | false | Shows the vote, focusable, can't change (aria-readonly). |
|
|
64
|
+
|
|
65
|
+
## Outputs
|
|
66
|
+
|
|
67
|
+
| Name | Payload | Description |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| `valueChange` | `number \| null, or ThumbsValue` | New value, or null when cleared: after a press, a key or a native reset; not on form or [value] writes. |
|
|
70
|
+
| `touch` | `void` | Focus left the group. |
|
|
71
|
+
|
|
72
|
+
## RatingLabels
|
|
73
|
+
|
|
74
|
+
| Field | Type | Description |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| `group` | `string` | Default group name ("Rating"). |
|
|
77
|
+
| `none` | `string` | Read-only with no value ("No rating"). |
|
|
78
|
+
|
|
79
|
+
## RatingThumbsLabels
|
|
80
|
+
|
|
81
|
+
| Field | Type | Description |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `up` | `string` | "Good response". |
|
|
84
|
+
| `down` | `string` | "Bad response". |
|
|
85
|
+
| `group` | `string` | Default group name ("Rate this response"). |
|
|
86
|
+
|
|
87
|
+
## CSS variables
|
|
88
|
+
|
|
89
|
+
| Variable | Default | Description |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| `--ui-rating-fill` | `var(--ui-hue-amber)` | Filled star, one solid fill, no rim. |
|
|
92
|
+
| `--ui-rating-empty` | `color-mix(in srgb, var(--ui-text) 15%, transparent)` | Empty star, a quiet solid fill; prefers-contrast: more uses --ui-border-input. |
|
|
93
|
+
|
|
94
|
+
## Keyboard
|
|
95
|
+
|
|
96
|
+
| Keys | Action |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| Tab | Into the chosen star/thumb (or the first), then out. |
|
|
99
|
+
| → / ↑ | Stars: value + 1, up to max; from none, 1. |
|
|
100
|
+
| ← / ↓ | Stars: value − 1, down to 1; from none, 1. RTL swaps ← and →. |
|
|
101
|
+
| Home / End | 1 / max; thumbs: up / down. |
|
|
102
|
+
| Arrows (thumbs) | The other thumb. |
|
|
103
|
+
| Space / Enter | Choose the focused one; on the chosen one, clear. |
|
|
104
|
+
| Delete / Backspace | Clear. |
|
|
105
|
+
|
|
106
|
+
## Accessibility
|
|
107
|
+
- role=radiogroup of role=radio buttons, one tab stop; stars named "3 out of 5", thumbs "Good response" / "Bad response".
|
|
108
|
+
- Default group names "Rating" / "Rate this response"; give aria-label or aria-labelledby.
|
|
109
|
+
- Read-only stars: one role=img named by the value (one decimal), not focusable.
|
|
110
|
+
- Empty stars are a quiet solid fill; the value is always in the accessible name, hover darkens the hovered star and focus shows a ring.
|
|
111
|
+
- aria-required / aria-invalid / aria-disabled on the group; forced colors: CanvasText outline, Highlight fill.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Reaction Bar
|
|
2
|
+
|
|
3
|
+
Like, comment, repost and share under a post, each a toggle with a public count. Icons pop and fill, only the digits that changed roll in, and the count glides to its new width.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add reaction-bar`
|
|
6
|
+
Import: `import { UiReactionBar, UiReaction } from './ui/reaction-bar';`
|
|
7
|
+
Selector: `<ui-reaction-bar>`
|
|
8
|
+
Docs: /components/reaction-bar
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Reactions under posts, comments or updates in a feed.
|
|
12
|
+
- Any toggle with a public count: saves, upvotes.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- Actions that need a confirmation: a toggle flips on the first click.
|
|
16
|
+
- One on/off setting with no count: use Switch or a toggle button.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { HttpClient } from '@angular/common/http';
|
|
22
|
+
import { Component, inject, input, linkedSignal } from '@angular/core';
|
|
23
|
+
import { ReactionKind, ReactionToggle, UiReaction, UiReactionBar } from './ui/reaction-bar';
|
|
24
|
+
|
|
25
|
+
export interface Post {
|
|
26
|
+
id: string;
|
|
27
|
+
likes: number;
|
|
28
|
+
liked: boolean;
|
|
29
|
+
comments: number;
|
|
30
|
+
reposts: number;
|
|
31
|
+
reposted: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Component({
|
|
35
|
+
selector: 'app-post-actions',
|
|
36
|
+
imports: [UiReactionBar, UiReaction],
|
|
37
|
+
template: `
|
|
38
|
+
<ui-reaction-bar>
|
|
39
|
+
<button uiReaction="like" [(pressed)]="liked" [(count)]="likes" (toggled)="react('like', $event)"></button>
|
|
40
|
+
<button uiReaction="comment" [count]="post().comments"></button>
|
|
41
|
+
<button uiReaction="repost" [(pressed)]="reposted" [(count)]="reposts" (toggled)="react('repost', $event)"></button>
|
|
42
|
+
<button uiReaction="share" [count]="0"></button>
|
|
43
|
+
</ui-reaction-bar>
|
|
44
|
+
`,
|
|
45
|
+
})
|
|
46
|
+
export class PostActions {
|
|
47
|
+
readonly post = input.required<Post>();
|
|
48
|
+
private readonly http = inject(HttpClient);
|
|
49
|
+
protected readonly liked = linkedSignal(() => this.post().liked);
|
|
50
|
+
protected readonly likes = linkedSignal<number | null>(() => this.post().likes);
|
|
51
|
+
protected readonly reposted = linkedSignal(() => this.post().reposted);
|
|
52
|
+
protected readonly reposts = linkedSignal<number | null>(() => this.post().reposts);
|
|
53
|
+
|
|
54
|
+
protected react(kind: ReactionKind, e: ReactionToggle) {
|
|
55
|
+
this.http.put(`/api/posts/${this.post().id}/reactions/${kind}`, { on: e.pressed }).subscribe();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Rules
|
|
61
|
+
- Put uiReaction on a native <button> inside <ui-reaction-bar>.
|
|
62
|
+
- Bind [(pressed)] and [(count)]; save in (toggled). Use [count]="0" for a count that starts hidden.
|
|
63
|
+
- Custom kinds need label and their own <svg>; add a noun in labels.units.
|
|
64
|
+
- Pop only on clicks; outside count changes roll without it.
|
|
65
|
+
- Set optimistic="false" when the server decides the state.
|
|
66
|
+
|
|
67
|
+
## Inputs
|
|
68
|
+
|
|
69
|
+
| Name | Type | Default | Description |
|
|
70
|
+
| --- | --- | --- | --- |
|
|
71
|
+
| `aria-label (UiReactionBar)` | `string` | 'Reactions' | Group name. |
|
|
72
|
+
| `labels (UiReactionBar)` | `Partial<ReactionLabels>` | English | Group name, action names, count nouns, spoken pattern; merged over the defaults. |
|
|
73
|
+
| `format (UiReactionBar)` | `(n: number) => string` | locale grouping | Count text for every action, e.g. compact. |
|
|
74
|
+
| `uiReaction` | `ReactionKind` | required | like \| comment \| repost \| share draw their icon; other kinds show the projected <svg>. |
|
|
75
|
+
| `pressed` | `boolean` | false | On/off as aria-pressed. Two-way [(pressed)]. |
|
|
76
|
+
| `count` | `number \| null` | null | Public count. 0 hides the number until a reaction; null = toggle without a count. Two-way [(count)]. |
|
|
77
|
+
| `label` | `string` | the kind's name | Action name; needed for custom kinds. |
|
|
78
|
+
| `format` | `(n: number) => string` | the bar's | Count text for this action. |
|
|
79
|
+
| `optimistic` | `boolean` | true | Click flips pressed and ±1 count itself; false = only emits toggled. |
|
|
80
|
+
|
|
81
|
+
## Outputs
|
|
82
|
+
|
|
83
|
+
| Name | Payload | Description |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `toggled (UiReaction)` | `ReactionToggle` | After a click, with the new pressed and count. |
|
|
86
|
+
| `pressedChange (UiReaction)` | `boolean` | Two-way half of pressed. |
|
|
87
|
+
| `countChange (UiReaction)` | `number \| null` | Two-way half of count. |
|
|
88
|
+
|
|
89
|
+
## ReactionLabels
|
|
90
|
+
|
|
91
|
+
| Field | Type | Description |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `group` | `string` | Group name; default 'Reactions'. |
|
|
94
|
+
| `names` | `Record<string, string>` | Action names by kind: Like, Comment, Repost, Share. |
|
|
95
|
+
| `units` | `Record<string, Partial<Record<Intl.LDMLPluralRule, string>>>` | Count nouns by kind and plural category: { one: 'like', other: 'likes' }. |
|
|
96
|
+
| `withCount` | `string` | Spoken name with a count; default '{name}, {count} {unit}'. |
|
|
97
|
+
|
|
98
|
+
## ReactionToggle
|
|
99
|
+
|
|
100
|
+
| Field | Type | Description |
|
|
101
|
+
| --- | --- | --- |
|
|
102
|
+
| `pressed` | `boolean` | New state. |
|
|
103
|
+
| `count` | `number \| null` | New count; null for a toggle without a count. |
|
|
104
|
+
|
|
105
|
+
## CSS variables
|
|
106
|
+
|
|
107
|
+
| Variable | Default | Description |
|
|
108
|
+
| --- | --- | --- |
|
|
109
|
+
| `--ui-reaction-bar-on` | `light-dark(var(--ui-hue-blue), sky blue)` | Pressed colour of every action, Clean look. |
|
|
110
|
+
| `--ui-reaction-bar-like` | `var(--ui-hue-pink)` | Pressed like, Classic look. |
|
|
111
|
+
| `--ui-reaction-bar-comment` | `color-mix(in srgb, var(--ui-hue-cyan) 70%, var(--ui-hue-blue))` | Pressed comment, Classic look. |
|
|
112
|
+
| `--ui-reaction-bar-repost` | `var(--ui-hue-purple)` | Pressed repost, Classic look. |
|
|
113
|
+
| `--ui-reaction-bar-share` | `var(--ui-text)` | Pressed share and custom kinds, Classic look. |
|
|
114
|
+
|
|
115
|
+
## Keyboard
|
|
116
|
+
|
|
117
|
+
| Keys | Action |
|
|
118
|
+
| --- | --- |
|
|
119
|
+
| Tab / Shift+Tab | Next / previous action; each is a tab stop. |
|
|
120
|
+
| Enter or Space | Toggles the focused action, same pop and roll as a click. |
|
|
121
|
+
|
|
122
|
+
## Accessibility
|
|
123
|
+
- Named role=group of native buttons with aria-pressed.
|
|
124
|
+
- Each name carries the pluralised count: 'Like, 128 likes', 'Share, 1 share'.
|
|
125
|
+
- Icons and rolling digits are aria-hidden: nothing read twice.
|
|
126
|
+
- Digits stay left to right in RTL pages.
|
|
127
|
+
- Forced colors: every action keeps an edge; pressed ones use Highlight.
|
|
128
|
+
- Dev-mode warning when a custom kind has no label.
|