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,87 @@
|
|
|
1
|
+
# Thinking Loader
|
|
2
|
+
|
|
3
|
+
A small working chip for AI replies: eight fading rays and a shimmering label that rolls through phases, then settles on a check and how long it took.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add thinking-loader`
|
|
6
|
+
Import: `import { UiThinkingLoader } from './ui/thinking-loader';`
|
|
7
|
+
Selector: `<ui-thinking-loader>`
|
|
8
|
+
Docs: /components/thinking-loader
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Between sending a prompt and the first streamed token.
|
|
12
|
+
- Agent or pipeline steps you can name: searching, reading, calling a tool, writing.
|
|
13
|
+
- Inline in a chat bubble or next to a button.
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
- When people need every step and its sources: show the steps.
|
|
17
|
+
- Loading without phases: use Skeleton or Spinner.
|
|
18
|
+
- Waits under half a second.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { Component, input } from '@angular/core';
|
|
24
|
+
import { UiThinkingLoader } from './ui/thinking-loader';
|
|
25
|
+
|
|
26
|
+
@Component({
|
|
27
|
+
selector: 'app-assistant-pending',
|
|
28
|
+
imports: [UiThinkingLoader],
|
|
29
|
+
template: `
|
|
30
|
+
<ui-thinking-loader [phases]="phases" [interval]="2200" [done]="streaming()" />
|
|
31
|
+
`,
|
|
32
|
+
})
|
|
33
|
+
export class AssistantPending {
|
|
34
|
+
readonly streaming = input(false);
|
|
35
|
+
protected readonly phases = ['Thinking', 'Searching the web', 'Reading sources', 'Writing response'];
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Rules
|
|
40
|
+
- Drive phase from real stream events; interval is a fallback.
|
|
41
|
+
- Set done on the first token, then swap the loader for the message shortly after.
|
|
42
|
+
- Keep phases to two to four words: the chip never wraps.
|
|
43
|
+
|
|
44
|
+
## Inputs
|
|
45
|
+
|
|
46
|
+
| Name | Type | Default | Description |
|
|
47
|
+
| --- | --- | --- | --- |
|
|
48
|
+
| `phases` | `readonly string[]` | labels.phases | Labels to walk through, in order; two to four words each. |
|
|
49
|
+
| `interval` | `number` | 2200 | Milliseconds per phase while phase is unset. The timer waits while the loader is off-screen or in a hidden tab. |
|
|
50
|
+
| `phase` | `number \| undefined` | undefined | Shows this index (clamped) and stops the timer; undefined resumes from it. |
|
|
51
|
+
| `loop` | `boolean` | false | Start over after the last phase instead of holding it. |
|
|
52
|
+
| `done` | `boolean` | false | Check and doneLabel in ink; back to false starts over (from phase when set) and resets the clock. |
|
|
53
|
+
| `doneLabel` | `string \| ((seconds: number) => string)` | labels.done | Label once done; a function gets whole seconds since start. |
|
|
54
|
+
| `size` | `'sm' \| 'md'` | 'md' | 32px / 13px label or 26px / 12px; Classic 34 or 28px. |
|
|
55
|
+
| `variant` | `'pill' \| 'plain'` | 'pill' | Chip with a hairline edge, or just rays and label. |
|
|
56
|
+
| `labels` | `Partial<ThinkingLoaderLabels>` | English | Default phases and done(seconds) text, for translation. |
|
|
57
|
+
|
|
58
|
+
## ThinkingLoaderLabels
|
|
59
|
+
|
|
60
|
+
| Field | Type | Description |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| `phases` | `readonly string[]` | Used when phases is left out or empty. |
|
|
63
|
+
| `done` | `(seconds: number) => string` | Used when doneLabel is left out. |
|
|
64
|
+
|
|
65
|
+
## ThinkingLoaderSize
|
|
66
|
+
|
|
67
|
+
`type ThinkingLoaderSize = 'sm' | 'md'`
|
|
68
|
+
|
|
69
|
+
## ThinkingLoaderVariant
|
|
70
|
+
|
|
71
|
+
`type ThinkingLoaderVariant = 'pill' | 'plain'`
|
|
72
|
+
|
|
73
|
+
## CSS variables
|
|
74
|
+
|
|
75
|
+
| Variable | Default | Description |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `--ui-thinking-loader-bg` | `light-dark(var(--ui-bg-surface), var(--ui-bg-canvas))` | Chip fill. |
|
|
78
|
+
| `--ui-thinking-loader-shadow` | `hairline ring + soft drop (Classic: 1px inset ring)` | Chip edge. |
|
|
79
|
+
| `--ui-thinking-loader-radius` | `var(--ui-radius-md); Classic full` | Chip corners. |
|
|
80
|
+
| `--ui-thinking-loader-ray` | `var(--ui-hue-blue); Classic var(--ui-text)` | Rays and check. |
|
|
81
|
+
|
|
82
|
+
## Accessibility
|
|
83
|
+
- role=status with aria-live=polite: each phase and the done label read once.
|
|
84
|
+
- Leaving label aria-hidden while it rolls away; rays and check aria-hidden.
|
|
85
|
+
- Working label --ui-text-muted (4.5:1+), done label --ui-text.
|
|
86
|
+
- Forced colors: chip edge, CanvasText rays and check, no shimmer.
|
|
87
|
+
- Reduced motion: rays still at 60%, no shimmer, labels switch at once.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Time Picker
|
|
2
|
+
|
|
3
|
+
A time of day you type or pick, in a field that looks exactly like a Text Field: tolerant typing (930, 9:30 pm, 21.30), a list every few minutes with a gliding highlight, 12 or 24 hours by locale, min and max. The form gets "HH:mm" with signal forms, reactive forms, ngModel or [(value)].
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add time-picker`
|
|
6
|
+
Import: `import { UiTimePicker, UiTimeInput, UiTimePickerList } from './ui/time-picker';`
|
|
7
|
+
Selector: `<ui-time-picker>`
|
|
8
|
+
Docs: /components/time-picker
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- A time of day in a form: when a job runs, when a digest goes out, quiet hours, a reminder.
|
|
12
|
+
- Next to a date field, or alone in a settings row, with the Text Field's height, edge, label, hint and error.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- A day or a span of days: use a date picker or a date range picker.
|
|
16
|
+
- A duration or a rhythm: use Number Input or Select.
|
|
17
|
+
- Three or four fixed slots: use Segmented Control or Select.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { Component, signal } from '@angular/core';
|
|
23
|
+
import { FormField, form, required } from '@angular/forms/signals';
|
|
24
|
+
import { UiTimeInput, UiTimePicker } from './ui/time-picker';
|
|
25
|
+
|
|
26
|
+
@Component({
|
|
27
|
+
selector: 'app-digest-schedule',
|
|
28
|
+
imports: [UiTimePicker, UiTimeInput, FormField],
|
|
29
|
+
template: `
|
|
30
|
+
<ui-time-picker label="Send the digest at" hint="Weekdays only, in your time zone.">
|
|
31
|
+
<input uiTimePicker [formField]="f.sendAt" />
|
|
32
|
+
</ui-time-picker>
|
|
33
|
+
`,
|
|
34
|
+
})
|
|
35
|
+
export class DigestSchedule {
|
|
36
|
+
private readonly model = signal({ sendAt: '09:30' as string | null });
|
|
37
|
+
protected readonly f = form(this.model, (p) => required(p.sendAt));
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
- Put uiTimePicker on an <input> inside ui-time-picker; leave type and role to the directive.
|
|
43
|
+
- Bind [formField], formControl(Name), ngModel or [(value)] on the input; values are "HH:mm" strings or null.
|
|
44
|
+
- With [formField], put min and max on <ui-time-picker> (NG8022 forbids them on the input) and check them with validate() in the schema.
|
|
45
|
+
- Pass the error string you want shown; the field doesn't read form state itself.
|
|
46
|
+
- Without a label, give the input an aria-label.
|
|
47
|
+
- step is at least 5; all rows render.
|
|
48
|
+
- Needs overlay.ts next to time-picker.ts (the CLI adds it): the placement, Escape and outside-press layer shared by the floating components.
|
|
49
|
+
|
|
50
|
+
## Inputs
|
|
51
|
+
|
|
52
|
+
| Name | Type | Default | Description |
|
|
53
|
+
| --- | --- | --- | --- |
|
|
54
|
+
| `label` | `string` | none | Above the field; names the field, the list and the list button. Clicking focuses without opening. |
|
|
55
|
+
| `hint` | `string` | none | Quiet line under the field; the error replaces it. |
|
|
56
|
+
| `error` | `string \| null \| undefined` | none | Invalid state: red edge, aria-invalid, message in place of the hint. |
|
|
57
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | 'md' | 28/32/36px; Classic 32/36/40; touch 34/38/42 (Classic +2) with 16px text. |
|
|
58
|
+
| `optional` | `boolean` | false | "Optional" after the label, also spoken. |
|
|
59
|
+
| `min / max` | `string ("HH:mm")` | none | Limits used when the input has none; the way to set them with [formField]. |
|
|
60
|
+
| `labels` | `Partial<TimePickerLabels>` | English | Translations: optional, showTimes. |
|
|
61
|
+
| `value (UiTimeInput)` | `string \| null (model)` | null | "HH:mm" on a 24-hour clock; null when empty. Changes on a pick or a commit, not per keystroke. |
|
|
62
|
+
| `open (UiTimeInput)` | `boolean (model)` | false | Whether the list shows; [(open)] opens it from code. |
|
|
63
|
+
| `step (UiTimeInput)` | `number` | 15 | Minutes between listed times, counted from min; at least 5. Any minute can be typed. |
|
|
64
|
+
| `min (UiTimeInput)` | `string ("HH:mm")` | 00:00 | Earliest time; the list starts here and earlier typed times are put back. Not allowed with [formField]. |
|
|
65
|
+
| `max (UiTimeInput)` | `string ("HH:mm")` | 23:59 | Latest time; ignored when before min. Not allowed with [formField]. |
|
|
66
|
+
| `hourCycle (UiTimeInput)` | `12 \| 24` | the locale's | 9:30 PM or 21:30. |
|
|
67
|
+
| `locale (UiTimeInput)` | `string` | LOCALE_ID | Display locale; its own AM/PM words can be typed too. |
|
|
68
|
+
| `placeholder (UiTimeInput)` | `string` | 9:00 in the field's format | Shown while empty. |
|
|
69
|
+
| `name (UiTimeInput)` | `string` | none | Submits "HH:mm" through a hidden input. |
|
|
70
|
+
| `required (UiTimeInput)` | `boolean` | false | Sets aria-required; signal forms set it from the schema. |
|
|
71
|
+
| `id (UiTimeInput)` | `string` | generated | Kept; the label's for points at it. |
|
|
72
|
+
| `aria-describedby (UiTimeInput)` | `string` | none | Your own descriptions, kept alongside the hint or error. Set it as aria-describedby="…", not [attr.aria-describedby]. |
|
|
73
|
+
|
|
74
|
+
## Outputs
|
|
75
|
+
|
|
76
|
+
| Name | Payload | Description |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `valueChange (UiTimeInput)` | `string \| null` | When a time is picked or typed text is committed (Enter, Tab, leaving the field). |
|
|
79
|
+
| `openChange (UiTimeInput)` | `boolean` | When the list opens or closes. |
|
|
80
|
+
|
|
81
|
+
## TimePickerLabels
|
|
82
|
+
|
|
83
|
+
| Field | Type | Description |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| `optional` | `string` | Tag after the label. |
|
|
86
|
+
| `showTimes` | `string` | Name of the list button ("Show times"), followed by the label. |
|
|
87
|
+
|
|
88
|
+
## TimeRow
|
|
89
|
+
|
|
90
|
+
| Field | Type | Description |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| `v` | `string` | "HH:mm". |
|
|
93
|
+
| `m` | `number` | Minutes after midnight. |
|
|
94
|
+
| `label` | `string` | As shown, e.g. "9:30 AM". |
|
|
95
|
+
|
|
96
|
+
## CSS variables
|
|
97
|
+
|
|
98
|
+
| Variable | Default | Description |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `--ui-text-field-edge` | `var(--ui-hairline)` | Resting edge (shared with Text Field). |
|
|
101
|
+
| `--ui-text-field-edge-hover` | `text at 18%` | Hover edge. |
|
|
102
|
+
| `--ui-text-field-edge-focus` | `var(--ui-border-input)` | Edge while focused or open, ≥ 3:1. |
|
|
103
|
+
| `--ui-text-field-radius` | `7px` | Corners (Classic 10px). |
|
|
104
|
+
| `--ui-time-picker-list-max-height` | `264px` | Tallest the list gets before it scrolls. |
|
|
105
|
+
|
|
106
|
+
## Keyboard
|
|
107
|
+
|
|
108
|
+
| Keys | Action |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| ↓ / ↑ | Closed: open on the chosen time or the next one from now, without moving. Open: move one row, no wrap. |
|
|
111
|
+
| Page Down / Page Up | An hour later / earlier while open. |
|
|
112
|
+
| Digits and letters | Type a time; the list opens and scrolls the partial reading just into view. |
|
|
113
|
+
| Enter | Pick the highlighted row, or commit typed text; then close. Closed: commit typed text. |
|
|
114
|
+
| Esc | Close and keep the text; again: put back the last good time. |
|
|
115
|
+
| Tab | Commit typed text (or put it back) and move on; never picks the arrow-highlighted row. |
|
|
116
|
+
|
|
117
|
+
## Accessibility
|
|
118
|
+
- Editable combobox: input role=combobox aria-autocomplete=list; focus stays in the input; aria-activedescendant while open.
|
|
119
|
+
- Field and listbox named by the label; the list button is tabindex=-1 and named "Show times" + the label.
|
|
120
|
+
- Options: role=option, aria-selected only on the exact chosen time.
|
|
121
|
+
- The active row is the soft highlight, for pointer, keys and typing alike; forced colors use Highlight.
|
|
122
|
+
- Invalid or out-of-range text is put back on commit; dev warning without a name.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Tips Panel
|
|
2
|
+
|
|
3
|
+
A card with a grid of short tips, one action each. Taking a tip swaps its button for a done line and tints it, the header counts what's done, and the list scrolls past a maximum height.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add tips-panel`
|
|
6
|
+
Import: `import { UiTipsPanel, UiTip } from './ui/tips-panel';`
|
|
7
|
+
Selector: `<ui-tips-panel>`
|
|
8
|
+
Docs: /components/tips-panel
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Pointing new users at features they haven't tried, one small action each.
|
|
12
|
+
- A "What's new" or getting-started card on a dashboard or in a dialog.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- Steps that must happen in order or depend on each other: use a setup checklist.
|
|
16
|
+
- A single announcement: a banner or a toast is lighter.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Component, signal } from '@angular/core';
|
|
22
|
+
import { UiKbd } from './ui/kbd';
|
|
23
|
+
import { UiTip, UiTipsPanel } from './ui/tips-panel';
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'app-getting-started',
|
|
27
|
+
imports: [UiTipsPanel, UiTip, UiKbd],
|
|
28
|
+
template: `
|
|
29
|
+
@if (shown()) {
|
|
30
|
+
<ui-tips-panel title="Getting started" closable (closed)="shown.set(false)">
|
|
31
|
+
<ui-tip title="Jump anywhere" action="Try it" doneLabel="Got it" (taken)="openSearch()">
|
|
32
|
+
Press <kbd ui-kbd [keys]="['mod', 'k']"></kbd> to open any project, page or setting.
|
|
33
|
+
</ui-tip>
|
|
34
|
+
<ui-tip title="Move to Team" action="See plans" doneLabel="Opened" primary (taken)="openPlans()">
|
|
35
|
+
Unlimited projects, guest access and a full year of history.
|
|
36
|
+
</ui-tip>
|
|
37
|
+
</ui-tips-panel>
|
|
38
|
+
}
|
|
39
|
+
`,
|
|
40
|
+
})
|
|
41
|
+
export class GettingStarted {
|
|
42
|
+
protected readonly shown = signal(true);
|
|
43
|
+
|
|
44
|
+
protected openSearch() {
|
|
45
|
+
console.log('open the command menu');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
protected openPlans() {
|
|
49
|
+
console.log('open the pricing page');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Rules
|
|
55
|
+
- Put only ui-tip elements directly inside ui-tips-panel; each needs a title and an action.
|
|
56
|
+
- The tip's content is its description: text, a <kbd ui-kbd>, a link.
|
|
57
|
+
- Run the action in (taken); bind [(done)] if the state must survive a reload.
|
|
58
|
+
- Close hides the card itself (open = false). Remove it with @if in (closed), or bind [(open)] to show it again; either way move focus in (closed).
|
|
59
|
+
- The card is min(720px, 100%) wide; columns follow its own width (3 > 560px, 2 > 380px, then 1).
|
|
60
|
+
|
|
61
|
+
## Inputs
|
|
62
|
+
|
|
63
|
+
| Name | Type | Default | Description |
|
|
64
|
+
| --- | --- | --- | --- |
|
|
65
|
+
| `title` | `string` | 'Tips' | Heading at the top of the card; names the region. |
|
|
66
|
+
| `headingLevel` | `number` | 3 | aria-level of the heading. |
|
|
67
|
+
| `closable` | `boolean` | false | Shows a Close button in the last row. |
|
|
68
|
+
| `open` | `boolean (model)` | true | Whether the card is shown. Close sets it to false after the exit; bind [(open)] to show it again. |
|
|
69
|
+
| `labels` | `Partial<TipsPanelLabels>` | English | Word after the count, spoken count, default done line and Close text. |
|
|
70
|
+
| `title (UiTip)` | `string` | required | The tip in a few words. |
|
|
71
|
+
| `action (UiTip)` | `string` | required | Button text: a verb such as "Invite". |
|
|
72
|
+
| `doneLabel (UiTip)` | `string` | labels.defaultDone | Done line once taken, in the past tense. |
|
|
73
|
+
| `primary (UiTip)` | `boolean` | false | Solid button, for the one tip you want noticed. |
|
|
74
|
+
| `done (UiTip)` | `boolean (model)` | false | Whether the tip is taken. Bind [(done)] to keep it across visits; set from outside it shows without the pop. |
|
|
75
|
+
|
|
76
|
+
## Outputs
|
|
77
|
+
|
|
78
|
+
| Name | Payload | Description |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| `closed` | `void` | Fires once the card has faded out after Close. Move focus here: the Close button is gone. |
|
|
81
|
+
| `openChange` | `boolean` | Every change of open, including the one Close makes after the exit. |
|
|
82
|
+
| `taken (UiTip)` | `void` | Fires when the tip's button is pressed. Run the action here. |
|
|
83
|
+
| `doneChange (UiTip)` | `boolean` | Every change of done, when the tip is taken. |
|
|
84
|
+
|
|
85
|
+
## TipsPanelLabels
|
|
86
|
+
|
|
87
|
+
| Field | Type | Description |
|
|
88
|
+
| --- | --- | --- |
|
|
89
|
+
| `done` | `string` | After the count: "2/9 done". Default 'done'. |
|
|
90
|
+
| `count` | `(done: number, total: number) => string` | Spoken count. Default "2 of 9 done". |
|
|
91
|
+
| `defaultDone` | `string` | Done line of a tip without doneLabel. Default 'Done'. |
|
|
92
|
+
| `close` | `string` | Close button text. Default 'Close'. |
|
|
93
|
+
|
|
94
|
+
## CSS variables
|
|
95
|
+
|
|
96
|
+
| Variable | Default | Description |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `--ui-tips-panel-max-height` | `420px` | Most the list grows before it scrolls; header and Close row stay put. |
|
|
99
|
+
| `--ui-tips-panel-radius` | `10px; Classic 22px` | Outer corners of the card. |
|
|
100
|
+
| `--ui-tips-panel-done` | `green darkened to 4.5:1 (light); Classic blue darkened to 4.5:1 (light)` | Done line and its check. |
|
|
101
|
+
| `--ui-tips-panel-done-bg` | `a faint grey wash` | Tint of a taken tip. |
|
|
102
|
+
|
|
103
|
+
## Keyboard
|
|
104
|
+
|
|
105
|
+
| Keys | Action |
|
|
106
|
+
| --- | --- |
|
|
107
|
+
| Tab | Moves through the tips' buttons in order, then to Close. |
|
|
108
|
+
| Enter Space | Takes the focused tip, or closes the card. |
|
|
109
|
+
|
|
110
|
+
## Accessibility
|
|
111
|
+
- A region named by its heading (headingLevel); tips are a list of listitems, each action a real button.
|
|
112
|
+
- The done line is role=status; the count is a polite, atomic live region that says "2 of 9 done" while the visible "2/9 done" is hidden from screen readers.
|
|
113
|
+
- Taking a tip from the keyboard moves focus to its done line (no visible ring), so Tab continues from the same tip.
|
|
114
|
+
- Close removes the focused button: move focus in (closed), for example to the control that opens the tips again.
|
|
115
|
+
- The count and done lines read at 4.5:1 or more; forced colors give the card, tips and buttons visible edges.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Toggle Group
|
|
2
|
+
|
|
3
|
+
A row of toggle buttons with one tab stop: several on at once, or one that can be cleared. Text or icons, separate chips that wrap or a compact track that scrolls, with signal forms, reactive forms or ngModel.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add toggle-group`
|
|
6
|
+
Import: `import { UiToggleGroup, UiToggle, UiToggleIcon } from './ui/toggle-group';`
|
|
7
|
+
Selector: `<ui-toggle-group>`
|
|
8
|
+
Docs: /components/toggle-group
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Filters where several can be on at once: statuses, severities.
|
|
12
|
+
- Formatting or view toolbars: bold / italic, columns, map layers.
|
|
13
|
+
- One optional choice that can be none: type="single".
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
- Exactly one view must always be picked: use Segmented Control.
|
|
17
|
+
- One on/off setting: use Switch, or Icon Button with pressed.
|
|
18
|
+
- Many options or long labels: use Select.
|
|
19
|
+
- Choices applied on submit: use Checkbox.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Component, signal } from '@angular/core';
|
|
25
|
+
import { FormField, form } from '@angular/forms/signals';
|
|
26
|
+
import { UiToggle, UiToggleGroup } from './ui/toggle-group';
|
|
27
|
+
|
|
28
|
+
@Component({
|
|
29
|
+
selector: 'app-run-filters',
|
|
30
|
+
imports: [UiToggleGroup, UiToggle, FormField],
|
|
31
|
+
template: `
|
|
32
|
+
<span id="run-status">Show runs</span>
|
|
33
|
+
<ui-toggle-group aria-labelledby="run-status" [formField]="f.status">
|
|
34
|
+
<button uiToggle value="running">Running</button>
|
|
35
|
+
<button uiToggle value="waiting">Waiting on you</button>
|
|
36
|
+
<button uiToggle value="done">Done</button>
|
|
37
|
+
<button uiToggle value="failed">Failed</button>
|
|
38
|
+
</ui-toggle-group>
|
|
39
|
+
`,
|
|
40
|
+
})
|
|
41
|
+
export class RunFilters {
|
|
42
|
+
private readonly model = signal({ status: ['running', 'waiting'] });
|
|
43
|
+
protected readonly f = form(this.model);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Rules
|
|
48
|
+
- Put uiToggle on your own <button> elements with a value; name the group with aria-label or aria-labelledby.
|
|
49
|
+
- Bind [formField], formControl(Name), ngModel or [(value)]; multiple gives string[], single gives string | null.
|
|
50
|
+
- Icon-only items need label; put uiToggleIcon on the svg, drawn in currentColor.
|
|
51
|
+
- With [formField], disable through the schema, not the disabled attribute.
|
|
52
|
+
- Exactly one always picked? Use Segmented Control instead.
|
|
53
|
+
|
|
54
|
+
## Inputs
|
|
55
|
+
|
|
56
|
+
| Name | Type | Default | Description |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| `type` | `'multiple' \| 'single'` | 'multiple' | Any number on (a list), or one or none (a string or null). |
|
|
59
|
+
| `value` | `readonly string[] \| string \| null (model)` | null | List in item order, or string \| null. Unknown values are kept. |
|
|
60
|
+
| `variant` | `'chips' \| 'track'` | 'chips' | Separate chips that wrap, or a track that scrolls with raised pressed items. |
|
|
61
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | 'md' | 24/28/32px; Classic +2; touch ≥ 36. Clean track items 4px shorter. |
|
|
62
|
+
| `disabled` | `boolean` | false | Disables every item; no tab stop. |
|
|
63
|
+
| `value (UiToggle)` | `string` | required | What the item stands for in the group's value. |
|
|
64
|
+
| `label (UiToggle)` | `string` | none | Accessible name and tooltip; required for icon-only items. |
|
|
65
|
+
| `disabled (UiToggle)` | `boolean` | false | Disables the item; arrows skip it. |
|
|
66
|
+
|
|
67
|
+
## Outputs
|
|
68
|
+
|
|
69
|
+
| Name | Payload | Description |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `valueChange` | `readonly string[] \| string \| null` | After an item is pressed; not when a form or [value] writes the value. |
|
|
72
|
+
| `touch` | `void` | When focus leaves the group. |
|
|
73
|
+
|
|
74
|
+
## CSS variables
|
|
75
|
+
|
|
76
|
+
| Variable | Default | Description |
|
|
77
|
+
| --- | --- | --- |
|
|
78
|
+
| `--ui-toggle-group-radius` | `6px (Classic 9px chips, 7px track items)` | Item corners; the track is 2px rounder. |
|
|
79
|
+
| `--ui-toggle-group-track` | `var(--ui-bg-subtle)` | Track fill. |
|
|
80
|
+
| `--ui-toggle-group-on` | `color-mix(in srgb, var(--ui-text) 8%, transparent)` | Pressed fill of a chip. |
|
|
81
|
+
| `--ui-toggle-group-press` | `0.96` | Scale while held. |
|
|
82
|
+
|
|
83
|
+
## Keyboard
|
|
84
|
+
|
|
85
|
+
| Keys | Action |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| Tab | Enters once, on the last item used (first pressed at first); leaves in one step. |
|
|
88
|
+
| → / ↓ | Focus to the next item, wrapping. Nothing toggles. |
|
|
89
|
+
| ← / ↑ | Focus to the previous item. ← / → swap in RTL. |
|
|
90
|
+
| Home / End | First / last item. |
|
|
91
|
+
| Space / Enter | Toggles the focused item. |
|
|
92
|
+
|
|
93
|
+
## Accessibility
|
|
94
|
+
- role=group of native buttons with aria-pressed, single mode included.
|
|
95
|
+
- Roving tabindex; arrows only move focus; disabled items skipped.
|
|
96
|
+
- Icon-only items: label is aria-label and title; dev warning when the group or an item has no name.
|
|
97
|
+
- Off text uses muted text (≥ 4.5:1); focus ring on keyboard focus only, inset on the track.
|
|
98
|
+
- Forced colors: every item has an edge; pressed items use Highlight.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Tool Call Card
|
|
2
|
+
|
|
3
|
+
One line per agent tool call, with a live timer and its status, that folds open to the highlighted arguments and result with copy buttons, Retry on errors, and a group that sums up the turn.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add tool-call-card`
|
|
6
|
+
Import: `import { UiToolCallCard, UiToolCallGroup } from './ui/tool-call-card';`
|
|
7
|
+
Selector: `<ui-tool-call-card, ui-tool-call-group>`
|
|
8
|
+
Docs: /components/tool-call-card
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Tool and function calls in an agent chat or run log.
|
|
12
|
+
- Several calls in one turn: wrap them in ui-tool-call-group.
|
|
13
|
+
- Developer views where people copy the exact arguments or result.
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
- Reasoning without tool calls: use a thinking state.
|
|
17
|
+
- End users who never need JSON: one status line, details in a log.
|
|
18
|
+
- Megabyte payloads: trim or paginate first.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { Component, input, output } from '@angular/core';
|
|
24
|
+
import { ToolCallIcon, ToolCallStatus, UiToolCallCard, UiToolCallGroup } from './ui/tool-call-card';
|
|
25
|
+
|
|
26
|
+
export interface ToolCall {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
icon: ToolCallIcon;
|
|
30
|
+
summary: string;
|
|
31
|
+
status: ToolCallStatus;
|
|
32
|
+
args: unknown;
|
|
33
|
+
result?: unknown;
|
|
34
|
+
error?: string;
|
|
35
|
+
startedAt?: number;
|
|
36
|
+
durationMs?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@Component({
|
|
40
|
+
selector: 'app-agent-turn',
|
|
41
|
+
imports: [UiToolCallCard, UiToolCallGroup],
|
|
42
|
+
template: `
|
|
43
|
+
<ui-tool-call-group>
|
|
44
|
+
@for (call of calls(); track call.id) {
|
|
45
|
+
<ui-tool-call-card
|
|
46
|
+
[name]="call.name"
|
|
47
|
+
[icon]="call.icon"
|
|
48
|
+
[summary]="call.summary"
|
|
49
|
+
[status]="call.status"
|
|
50
|
+
[args]="call.args"
|
|
51
|
+
[result]="call.result"
|
|
52
|
+
[error]="call.error"
|
|
53
|
+
[startedAt]="call.startedAt"
|
|
54
|
+
[duration]="call.durationMs"
|
|
55
|
+
retryable
|
|
56
|
+
(retry)="rerun.emit(call.id)"
|
|
57
|
+
/>
|
|
58
|
+
}
|
|
59
|
+
</ui-tool-call-group>
|
|
60
|
+
`,
|
|
61
|
+
})
|
|
62
|
+
export class AgentTurn {
|
|
63
|
+
readonly calls = input.required<ToolCall[]>();
|
|
64
|
+
readonly rerun = output<string>();
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Rules
|
|
69
|
+
- Keep cards as direct children of ui-tool-call-group; it reads their status, icon and time.
|
|
70
|
+
- Set status back to running on retry; the card closes again if it opened itself.
|
|
71
|
+
- Summaries: present progressive while running, past tense when done.
|
|
72
|
+
- Redact secrets from args and result.
|
|
73
|
+
|
|
74
|
+
## Inputs
|
|
75
|
+
|
|
76
|
+
| Name | Type | Default | Description |
|
|
77
|
+
| --- | --- | --- | --- |
|
|
78
|
+
| `name` | `string` | required | Tool name, monospace. |
|
|
79
|
+
| `status` | `'running' \| 'success' \| 'error'` | 'running' | Spinner + live timer, check + duration, or Failed. |
|
|
80
|
+
| `summary` | `string` | none | Short line after the name; truncates. |
|
|
81
|
+
| `icon` | `ToolCallIcon` | 'wrench' | Built-in name (wrench, search, file, database, globe, terminal, code, mail, calendar, chart, cloud, user) or 24x24 path data. The group tiles show it too. |
|
|
82
|
+
| `args` | `unknown` | none | Arguments; objects and JSON strings are pretty-printed and highlighted. Hidden when undefined. |
|
|
83
|
+
| `result` | `unknown` | none | Result, like args; other strings are plain text. Running without it shows Waiting for result… |
|
|
84
|
+
| `error` | `string` | none | Message shown when status is error. |
|
|
85
|
+
| `startedAt` | `number` | none | Start time (ms epoch) for the live timer. |
|
|
86
|
+
| `duration` | `number` | measured | Final duration in ms. |
|
|
87
|
+
| `open` | `boolean (model)` | false | Body open; [(open)]. |
|
|
88
|
+
| `openOnError` | `boolean` | true | Opens on error, closes on rerun, unless toggled by hand. |
|
|
89
|
+
| `retryable` | `boolean` | false | Shows Retry next to the error. |
|
|
90
|
+
| `maxCodeHeight` | `number` | 220 | Cap in px before fade + Show all. |
|
|
91
|
+
| `labels` | `Partial<ToolCallLabels>` | English | Every visible and spoken string, and the duration format. |
|
|
92
|
+
| `ui-tool-call-group · label` | `string` | Used N tools | Group header once nothing runs. |
|
|
93
|
+
| `ui-tool-call-group · duration` | `number` | sum of cards | Total ms; default adds the cards up, failed attempts included. |
|
|
94
|
+
| `ui-tool-call-group · open` | `boolean (model)` | false | List open; [(open)]. |
|
|
95
|
+
| `ui-tool-call-group · labels` | `Partial<ToolCallGroupLabels>` | English | running, used(n), failed(n), duration(ms). |
|
|
96
|
+
|
|
97
|
+
## Outputs
|
|
98
|
+
|
|
99
|
+
| Name | Payload | Description |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| `retry` | `void` | Retry pressed. Set status back to running and rerun. |
|
|
102
|
+
|
|
103
|
+
## ToolCallLabels
|
|
104
|
+
|
|
105
|
+
| Field | Type | Description |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| `arguments` | `string` | Arguments |
|
|
108
|
+
| `result` | `string` | Result |
|
|
109
|
+
| `copyArguments` | `string` | Copy arguments |
|
|
110
|
+
| `copyResult` | `string` | Copy result |
|
|
111
|
+
| `copied` | `string` | Copied |
|
|
112
|
+
| `showAll` | `string` | Show all |
|
|
113
|
+
| `showLess` | `string` | Show less |
|
|
114
|
+
| `waiting` | `string` | Waiting for result… |
|
|
115
|
+
| `failed` | `string` | Failed |
|
|
116
|
+
| `retry` | `string` | Retry |
|
|
117
|
+
| `running` | `string` | Status word read and announced while running. |
|
|
118
|
+
| `finished` | `string` | Status word once it succeeded. |
|
|
119
|
+
| `failedAnnouncement` | `string` | Announced after the name on failure. |
|
|
120
|
+
| `duration` | `(ms: number) => string` | 1.5s; 1m 05s past a minute. |
|
|
121
|
+
|
|
122
|
+
## ToolCallGroupLabels
|
|
123
|
+
|
|
124
|
+
| Field | Type | Description |
|
|
125
|
+
| --- | --- | --- |
|
|
126
|
+
| `running` | `string` | Using tools… |
|
|
127
|
+
| `used` | `(count: number) => string` | Used N tools |
|
|
128
|
+
| `failed` | `(count: number) => string` | N failed |
|
|
129
|
+
| `duration` | `(ms: number) => string` | Total time format. |
|
|
130
|
+
|
|
131
|
+
## CSS variables
|
|
132
|
+
|
|
133
|
+
| Variable | Default | Description |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| `--ui-tool-call-radius` | `calc(10px + 2px * var(--ui-look-tray))` | Card corners. |
|
|
136
|
+
| `--ui-tool-call-code-string` | `darkened --ui-hue-cyan (Classic --ui-hue-teal)` | JSON strings; 4.5:1 on the well. |
|
|
137
|
+
| `--ui-tool-call-code-number` | `darkened --ui-hue-amber` | JSON numbers and literals. |
|
|
138
|
+
|
|
139
|
+
## Keyboard
|
|
140
|
+
|
|
141
|
+
| Keys | Action |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| Tab | Headers, Retry, copy buttons, Show all; closed bodies skipped. |
|
|
144
|
+
| Enter / Space | Toggles the focused card or group. |
|
|
145
|
+
|
|
146
|
+
## Accessibility
|
|
147
|
+
- Headers are buttons with aria-expanded/aria-controls; closed bodies are inert.
|
|
148
|
+
- Header name includes a status word; status never rests on colour.
|
|
149
|
+
- Polite live regions announce status changes and the group summary, not the first render.
|
|
150
|
+
- Copy buttons named Copy arguments/result, Copied for 1.4s; Show all has aria-expanded.
|
|
151
|
+
- Text and JSON colours ≥ 4.5:1; focus ring drawn whole; forced-colors borders.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
A small dark label for one control. It shows on hover after a short wait and at once under keyboard focus, neighbours follow without the wait, a shortcut can sit inside, and it flips to stay on screen.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add tooltip`
|
|
6
|
+
Import: `import { UiTooltip } from './ui/tooltip';`
|
|
7
|
+
Selector: `<[uiTooltip]>`
|
|
8
|
+
Docs: /components/tooltip
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Naming an icon-only control and showing its shortcut.
|
|
12
|
+
- Showing the whole of a cut-off label.
|
|
13
|
+
- One short line about a control that already has a name.
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
- Anything clickable, selectable or copyable: use Popover.
|
|
17
|
+
- A list of actions: use Dropdown Menu.
|
|
18
|
+
- Information needed to finish a task, or a control's only label: touch never shows tooltips.
|
|
19
|
+
- Copied/Saved after an action: use a live region or a toast.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Component, output } from '@angular/core';
|
|
25
|
+
import { UiIconButton, UiIconButtonIcon } from './ui/icon-button';
|
|
26
|
+
import { UiTooltip } from './ui/tooltip';
|
|
27
|
+
|
|
28
|
+
@Component({
|
|
29
|
+
selector: 'app-search-button',
|
|
30
|
+
imports: [UiIconButton, UiIconButtonIcon, UiTooltip],
|
|
31
|
+
template: `
|
|
32
|
+
<button type="button" uiIconButton variant="secondary" label="Search" title=""
|
|
33
|
+
uiTooltip="Search" uiTooltipShortcut="⌘K" uiTooltipSide="bottom" (click)="search.emit()">
|
|
34
|
+
<svg uiIconButtonIcon viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round">
|
|
35
|
+
<circle cx="11" cy="11" r="6.5" />
|
|
36
|
+
<path d="M20 20l-4.4-4.4" />
|
|
37
|
+
</svg>
|
|
38
|
+
</button>
|
|
39
|
+
`,
|
|
40
|
+
})
|
|
41
|
+
export class SearchButton {
|
|
42
|
+
search = output();
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Rules
|
|
47
|
+
- Put uiTooltip on the focusable control itself; wrap disabled controls in a tabindex=0 span.
|
|
48
|
+
- On uiIconButton set title="" so the native tooltip stays away.
|
|
49
|
+
- Never put the only label or needed information in a tooltip.
|
|
50
|
+
|
|
51
|
+
## Inputs
|
|
52
|
+
|
|
53
|
+
| Name | Type | Default | Description |
|
|
54
|
+
| --- | --- | --- | --- |
|
|
55
|
+
| `uiTooltip` | `string \| null` | none | The label; empty or null means no tooltip. Text only, wraps at 240px. |
|
|
56
|
+
| `uiTooltipShortcut` | `string` | none | Shortcut after the label, e.g. ⌘K; spelled out for screen readers. |
|
|
57
|
+
| `uiTooltipSide` | `'top' \| 'bottom' \| 'left' \| 'right'` | 'top' | Preferred side; flips when the other has more room. |
|
|
58
|
+
| `uiTooltipAlign` | `'start' \| 'center' \| 'end'` | 'center' | Edge alignment (start mirrors in RTL); pushed inside the window. |
|
|
59
|
+
| `uiTooltipOffset` | `number` | 6 | Gap to the control in px. |
|
|
60
|
+
| `uiTooltipDelay` | `number` | 500 | Hover rest before showing, in ms; focus and neighbours within 300ms skip it. |
|
|
61
|
+
| `uiTooltipDisabled` | `boolean` | false | Never shows. |
|
|
62
|
+
| `uiTooltipOpen` | `boolean` | unset | Controlled open state; your value decides. [(uiTooltipOpen)] also follows hover and focus. |
|
|
63
|
+
| `uiTooltipClass` | `string` | none | A class for the label. |
|
|
64
|
+
|
|
65
|
+
## Outputs
|
|
66
|
+
|
|
67
|
+
| Name | Payload | Description |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| `uiTooltipOpenChange` | `boolean` | When it wants to open or close: hover, focus, Escape or a click. |
|
|
70
|
+
|
|
71
|
+
## CSS variables
|
|
72
|
+
|
|
73
|
+
| Variable | Default | Description |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| `--ui-tooltip-bg` | `var(--ui-bg-neutral-solid)` | Fill, inverted in dark mode. |
|
|
76
|
+
| `--ui-tooltip-fg` | `var(--ui-text-on-neutral)` | Text. |
|
|
77
|
+
| `--ui-tooltip-max-width` | `240px` | Where text wraps. |
|
|
78
|
+
| `--ui-tooltip-drift` | `2px` | Glide-in distance (Classic 3px). |
|
|
79
|
+
|
|
80
|
+
## Keyboard
|
|
81
|
+
|
|
82
|
+
| Keys | Action |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| Tab | Focus shows it at once; moving on hides it. |
|
|
85
|
+
| Esc | Hides it before surrounding layers react; focus stays. |
|
|
86
|
+
| Enter or Space | Activating the control hides it. |
|
|
87
|
+
|
|
88
|
+
## Accessibility
|
|
89
|
+
- role=tooltip; the control gets aria-describedby while it shows, merged with existing ids, never as its name.
|
|
90
|
+
- Repeating the name describes only the shortcut, or nothing.
|
|
91
|
+
- Shortcut glyphs are spelled out (⇧⌘S → Shift Command S).
|
|
92
|
+
- Opens on keyboard focus, never after a click; Escape hides without moving focus.
|
|
93
|
+
- Hoverable; one at a time; never on touch.
|
|
94
|
+
- Text ≥ 4.5:1 light and dark; forced colors keep an outline.
|