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,84 @@
|
|
|
1
|
+
# Model Wheel
|
|
2
|
+
|
|
3
|
+
Model names on a turning drum: the middle row sits on a soft fill, the rows above and below bend away and fade, and every hold the next one rolls in from above on a spring. Drag or flick it; hovering holds it.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add model-wheel`
|
|
6
|
+
Import: `import { UiModelWheel } from './ui/model-wheel';`
|
|
7
|
+
Selector: `<ui-model-wheel>`
|
|
8
|
+
Docs: /components/model-wheel
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Feature cards about picking or routing between models, or bringing your own.
|
|
12
|
+
- Landing pages showing the supported models in a calm, moving way.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- A real model picker: it reports no choice. Use Select or Segmented Control.
|
|
16
|
+
- Long lists: about seven rows show at a time.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Component } from '@angular/core';
|
|
22
|
+
import { UiModelWheel } from './ui/model-wheel';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'app-models-card',
|
|
26
|
+
imports: [UiModelWheel],
|
|
27
|
+
template: `
|
|
28
|
+
<article class="card">
|
|
29
|
+
<ui-model-wheel />
|
|
30
|
+
<h3>Every model, one dashboard</h3>
|
|
31
|
+
<p>Switch per task, compare answers side by side, and keep one bill.</p>
|
|
32
|
+
</article>
|
|
33
|
+
`,
|
|
34
|
+
styles: `
|
|
35
|
+
.card {
|
|
36
|
+
box-sizing: border-box; inline-size: min(360px, 100%); padding: 0 0 20px;
|
|
37
|
+
border-radius: 16px; background: var(--ui-bg-surface); box-shadow: inset 0 0 0 1px var(--ui-hairline);
|
|
38
|
+
}
|
|
39
|
+
ui-model-wheel { inline-size: 100%; }
|
|
40
|
+
h3 { margin: 0 20px; color: var(--ui-text); font-size: 15px; line-height: 22px; font-weight: 600; }
|
|
41
|
+
p { margin: 4px 20px 0; color: var(--ui-text-muted); font-size: 13px; line-height: 20px; }
|
|
42
|
+
`,
|
|
43
|
+
})
|
|
44
|
+
export class ModelsCard {}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Rules
|
|
48
|
+
- inline-size min(360px, 100%), block-size 308px: 7 rows of 44px, 20 degrees apart on a 124.76px radius, perspective 560px, opacity cos(angle)^1.6.
|
|
49
|
+
- Turns one row down every hold ms on a spring (damping 0.69, 8 rad/s); the fill eases to the new name width over 420 ms.
|
|
50
|
+
- Drag: 44px per row with a magnetic detent; release projects 0.14 s of velocity and springs (0.7, 13 rad/s) to the nearest row.
|
|
51
|
+
- Pauses off-screen and in hidden tabs; a fresh hold on return.
|
|
52
|
+
- Reduced motion or --ui-motion-scale: 0: no auto turn, release lands at once, fill instant.
|
|
53
|
+
- Fewer than 8 models: rows fade out before the wrap at n x 10 degrees.
|
|
54
|
+
|
|
55
|
+
## Inputs
|
|
56
|
+
|
|
57
|
+
| Name | Type | Default | Description |
|
|
58
|
+
| --- | --- | --- | --- |
|
|
59
|
+
| `models` | `readonly ModelWheelItem[]` | MODEL_WHEEL_DEFAULTS (8 sample models) | Rows from the top: { name, path, color?, darkColor?, viewBox? = '0 0 24 24' }, one path per mark; without a colour the mark follows the text. Use at least seven. |
|
|
60
|
+
| `hold` | `number` | 1500 | Milliseconds a model rests in the middle. |
|
|
61
|
+
| `label` | `string` | 'Model names rolling past on a drum, each one landing in the middle' | Accessible name (role=img). Empty hides it from assistive tech. |
|
|
62
|
+
|
|
63
|
+
## ModelWheelItem
|
|
64
|
+
|
|
65
|
+
| Field | Type | Description |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `name` | `string` | Row text. |
|
|
68
|
+
| `path` | `string` | One SVG path for the mark. |
|
|
69
|
+
| `color` | `string (optional)` | Mark fill: any CSS colour. Left out, the mark follows the row's text colour. |
|
|
70
|
+
| `darkColor` | `string (optional)` | Mark fill in dark mode. Default: color. |
|
|
71
|
+
| `viewBox` | `string (optional)` | The mark's SVG viewBox. Default: '0 0 24 24'. |
|
|
72
|
+
|
|
73
|
+
## CSS variables
|
|
74
|
+
|
|
75
|
+
| Variable | Default | Description |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `--ui-model-wheel-fill` | `light-dark(var(--ui-bg-muted), color-mix(in srgb, var(--ui-bg-muted) 62%, var(--ui-bg-canvas)))` | Fill behind the middle row. |
|
|
78
|
+
| `--ui-model-wheel-radius` | `var(--ui-radius-lg)` | Corners of the fill. |
|
|
79
|
+
|
|
80
|
+
## Accessibility
|
|
81
|
+
- Host role=img with aria-label from label; fill and drum aria-hidden, mark SVGs not focusable.
|
|
82
|
+
- Empty label: aria-hidden host, no role.
|
|
83
|
+
- Side rows use --ui-text-muted before the fade; sample marks are at least 3:1 on the page in both themes.
|
|
84
|
+
- Mouse hover holds it; forced colors outline the fill.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Notification Stack
|
|
2
|
+
|
|
3
|
+
A small deck of notice cards: only the front one is readable, two blank edges peek out below it, and its × flicks it aside while the next card settles forward. Badge, title, text, one action and a faint corner drawing per card.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add notification-stack`
|
|
6
|
+
Import: `import { UiNotificationStack, UiNotice, UiNoticeAction } from './ui/notification-stack';`
|
|
7
|
+
Selector: `<ui-notification-stack>`
|
|
8
|
+
Docs: /components/notification-stack
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- A few announcements in one spot: releases, maintenance windows, invitations.
|
|
12
|
+
- Toast-like messages that stay until closed.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- Messages that need an answer first: use Dialog.
|
|
16
|
+
- Many notifications at once: past three or four, use an inbox or activity list.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Component, signal } from '@angular/core';
|
|
22
|
+
import { UiNotice, UiNotificationStack } from './ui/notification-stack';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'app-whats-new',
|
|
26
|
+
imports: [UiNotificationStack],
|
|
27
|
+
template: `
|
|
28
|
+
<ui-notification-stack [(notices)]="notices" (dismissed)="markRead($event)" (action)="open($event)" />
|
|
29
|
+
`,
|
|
30
|
+
})
|
|
31
|
+
export class WhatsNew {
|
|
32
|
+
protected readonly notices = signal<readonly UiNotice[]>([
|
|
33
|
+
{
|
|
34
|
+
id: 'maintenance',
|
|
35
|
+
badge: 'Notice',
|
|
36
|
+
title: 'Planned maintenance',
|
|
37
|
+
text: 'Sync pauses on Saturday from 01:00 to 01:30 UTC. Nothing is lost.',
|
|
38
|
+
action: { label: 'Status page', href: 'https://status.example.com', external: true },
|
|
39
|
+
pattern: 'grid',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
id: 'shortcuts',
|
|
43
|
+
badge: 'New',
|
|
44
|
+
title: 'Keyboard shortcuts everywhere',
|
|
45
|
+
text: 'Press ? on any page to see what you can do without the mouse.',
|
|
46
|
+
action: { label: 'Show shortcuts' },
|
|
47
|
+
pattern: 'rings',
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
protected markRead(notice: UiNotice) {
|
|
52
|
+
console.log('read', notice.id);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
protected open(notice: UiNotice) {
|
|
56
|
+
console.log('open', notice.id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Rules
|
|
62
|
+
- Give every notice a unique id and a title.
|
|
63
|
+
- Bind [(notices)] to keep your list in sync; with [notices] alone dismissed cards still leave the stack.
|
|
64
|
+
- Only three cards render; keep the list short.
|
|
65
|
+
- An action never dismisses; remove the notice yourself if it should.
|
|
66
|
+
- Host width, colour and font are inline: set width with --ui-notification-stack-width, not CSS width on the element.
|
|
67
|
+
|
|
68
|
+
## Inputs
|
|
69
|
+
|
|
70
|
+
| Name | Type | Default | Description |
|
|
71
|
+
| --- | --- | --- | --- |
|
|
72
|
+
| `notices` | `readonly UiNotice[] (model)` | [] | Cards, front first; [(notices)] gets the list back without a dismissed notice after its exit. |
|
|
73
|
+
| `labels` | `Partial<NotificationStackLabels>` | English | Translations: region(count), dismiss(title), newTab, empty. |
|
|
74
|
+
|
|
75
|
+
## Outputs
|
|
76
|
+
|
|
77
|
+
| Name | Payload | Description |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| `dismissed` | `UiNotice` | The × was used; fires at the click, before the exit ends. |
|
|
80
|
+
| `action` | `UiNotice` | The action was clicked (button or link); does not dismiss. |
|
|
81
|
+
| `noticesChange` | `readonly UiNotice[]` | The list without the dismissed notice, about 350ms after the click. |
|
|
82
|
+
|
|
83
|
+
## UiNotice
|
|
84
|
+
|
|
85
|
+
| Field | Type | Description |
|
|
86
|
+
| --- | --- | --- |
|
|
87
|
+
| `id` | `string` | Unique within the stack. |
|
|
88
|
+
| `title` | `string` | Heading; names the card and its × button. |
|
|
89
|
+
| `badge` | `string` | Short small-caps word above the title. |
|
|
90
|
+
| `text` | `string` | A line or two; line breaks kept. |
|
|
91
|
+
| `action` | `UiNoticeAction` | One button, or a link with href. |
|
|
92
|
+
| `pattern` | `NoticePattern` | Faint corner drawing; none by default. |
|
|
93
|
+
|
|
94
|
+
## UiNoticeAction
|
|
95
|
+
|
|
96
|
+
| Field | Type | Description |
|
|
97
|
+
| --- | --- | --- |
|
|
98
|
+
| `label` | `string` | Button or link text. |
|
|
99
|
+
| `href` | `string` | Makes it a link; without it a button that emits (action). |
|
|
100
|
+
| `external` | `boolean` | New tab, trailing arrow and a spoken new-tab hint. |
|
|
101
|
+
|
|
102
|
+
## NoticePattern
|
|
103
|
+
|
|
104
|
+
| Field | Type | Description |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| `value` | `'rings' \| 'grid' \| 'rays' \| 'none'` | Concentric rings, a grid with one tinted cell, or rays from the corner. |
|
|
107
|
+
|
|
108
|
+
## NotificationStackLabels
|
|
109
|
+
|
|
110
|
+
| Field | Type | Description |
|
|
111
|
+
| --- | --- | --- |
|
|
112
|
+
| `region` | `(count: number) => string` | Region name; default "Notifications, 3". |
|
|
113
|
+
| `dismiss` | `(title: string) => string` | × button name; default "Dismiss {title}". |
|
|
114
|
+
| `newTab` | `string` | Hidden hint after external links. |
|
|
115
|
+
| `empty` | `string` | Announced when the last notice goes. |
|
|
116
|
+
|
|
117
|
+
## CSS variables
|
|
118
|
+
|
|
119
|
+
| Variable | Default | Description |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `--ui-notification-stack-width` | `380px` | Widest the stack gets; shrinks to its container. |
|
|
122
|
+
| `--ui-notification-stack-radius` | `calc(var(--ui-radius-md) + 2px + 10px * tray)` | Card corners: 10, Classic 20. |
|
|
123
|
+
| `--ui-notification-stack-peek` | `12px` | How far each back card shows below the one in front. |
|
|
124
|
+
| `--ui-notification-stack-scale` | `0.05` | How much narrower each back card is per layer. |
|
|
125
|
+
|
|
126
|
+
## Keyboard
|
|
127
|
+
|
|
128
|
+
| Keys | Action |
|
|
129
|
+
| --- | --- |
|
|
130
|
+
| Tab / Shift+Tab | Front card: × then action; back cards skipped. |
|
|
131
|
+
| Enter / Space | Dismisses, or runs the action. |
|
|
132
|
+
|
|
133
|
+
## Accessibility
|
|
134
|
+
- Region named with the count ("Notifications, 3"); each card an article named by its title.
|
|
135
|
+
- Back and leaving cards are aria-hidden and inert.
|
|
136
|
+
- After a dismiss focus moves to the next card's ×; when empty, to the stack, with a polite "No more notifications".
|
|
137
|
+
- External links carry a hidden new-tab hint and rel=noopener noreferrer.
|
|
138
|
+
- Forced colors: cards and badges keep an outline; drawings hidden.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Number Input
|
|
2
|
+
|
|
3
|
+
One number with − and + that repeat while held, arrow and Page keys, bounds and a step, a unit, and locale formatting. It shows "32,000" while your form gets 32000, with signal forms, reactive forms or ngModel.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add number-input`
|
|
6
|
+
Import: `import { UiNumberInput, UiNumber, UiNumberInputPrefix } from './ui/number-input';`
|
|
7
|
+
Selector: `<ui-number-input>`
|
|
8
|
+
Docs: /components/number-input
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Counts and amounts that change in steps: replicas, seats, limits, budgets.
|
|
12
|
+
- Bounded settings where − / + beat typing.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- Phone or card numbers: use Text Field.
|
|
16
|
+
- A few fixed values: use Segmented Control or Select.
|
|
17
|
+
- A rough value on a range: use Slider.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { Component, signal } from '@angular/core';
|
|
23
|
+
import { FormField, form, max, min } from '@angular/forms/signals';
|
|
24
|
+
import { UiNumber, UiNumberInput } from './ui/number-input';
|
|
25
|
+
|
|
26
|
+
@Component({
|
|
27
|
+
selector: 'app-run-limits',
|
|
28
|
+
imports: [UiNumberInput, UiNumber, FormField],
|
|
29
|
+
template: `
|
|
30
|
+
<ui-number-input label="Max tokens per run" unit="tokens" hint="The answer stops here.">
|
|
31
|
+
<input uiNumberInput [formField]="f.maxTokens" step="1000" />
|
|
32
|
+
</ui-number-input>
|
|
33
|
+
<ui-number-input label="Budget per run" prefix="$">
|
|
34
|
+
<input uiNumberInput [formField]="f.budget" step="5" [format]="money" />
|
|
35
|
+
</ui-number-input>
|
|
36
|
+
`,
|
|
37
|
+
})
|
|
38
|
+
export class RunLimits {
|
|
39
|
+
protected readonly money: Intl.NumberFormatOptions = { minimumFractionDigits: 2, maximumFractionDigits: 2 };
|
|
40
|
+
private readonly model = signal({ maxTokens: 32000, budget: 25 });
|
|
41
|
+
protected readonly f = form(this.model, (p) => {
|
|
42
|
+
min(p.maxTokens, 1000);
|
|
43
|
+
max(p.maxTokens, 200000);
|
|
44
|
+
min(p.budget, 0);
|
|
45
|
+
max(p.budget, 100);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Rules
|
|
51
|
+
- Put uiNumberInput on your own <input> inside ui-number-input; bind [formField], formControl, ngModel or [(value)].
|
|
52
|
+
- With [formField], set bounds in the schema (min(), max()), not as attributes.
|
|
53
|
+
- The form value is a number or null; the input shows it formatted.
|
|
54
|
+
- Use name for native form submission; the visible input submits nothing.
|
|
55
|
+
- Pass the error string you want shown; the field doesn't read form state itself.
|
|
56
|
+
- With [formField], don't set name: signal forms set it from the field.
|
|
57
|
+
|
|
58
|
+
## Inputs
|
|
59
|
+
|
|
60
|
+
| Name | Type | Default | Description |
|
|
61
|
+
| --- | --- | --- | --- |
|
|
62
|
+
| `label` | `string` | none | Above the input; clicking focuses it. |
|
|
63
|
+
| `hint` | `string` | none | Quiet line under the input; the error replaces it. |
|
|
64
|
+
| `error` | `string \| null \| undefined` | none | Invalid state: red edge, aria-invalid, message in place of the hint. |
|
|
65
|
+
| `prefix` | `string` | none | Quiet text before the value ($). Icons: uiNumberInputPrefix. |
|
|
66
|
+
| `unit` | `string` | none | Quiet text after the value (tokens); part of the value text. |
|
|
67
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | 'md' | 28/32/36px; Classic 32/36/40; touch 36/40/44 with 16px text. |
|
|
68
|
+
| `optional` | `boolean` | false | "Optional" after the label, also spoken. |
|
|
69
|
+
| `labels` | `Partial<NumberInputLabels>` | English | Translations: optional, decrease, increase. |
|
|
70
|
+
| `value (UiNumber)` | `number \| null (model)` | null | The number; [(value)], [value] with (valueChange), or a form binding. |
|
|
71
|
+
| `min / max (UiNumber)` | `number` | none | Bounds; typed values are clamped on commit. Signal forms: schema min()/max(). |
|
|
72
|
+
| `step (UiNumber)` | `number` | 1 | Step size; steps land on multiples counted from min. |
|
|
73
|
+
| `largeStep (UiNumber)` | `number` | step × 10 | Page Up / Page Down step. |
|
|
74
|
+
| `format (UiNumber)` | `Intl.NumberFormatOptions` | up to 3 decimals | Display format; the value is rounded to what is shown. percent: 0.25 shows 25%. For money use prefix="$" with fixed decimals, not style: 'currency'. |
|
|
75
|
+
| `locale (UiNumber)` | `string` | LOCALE_ID | Display and typing locale. |
|
|
76
|
+
| `name (UiNumber)` | `string` | none | Submits the plain number through a hidden input. |
|
|
77
|
+
|
|
78
|
+
## Outputs
|
|
79
|
+
|
|
80
|
+
| Name | Payload | Description |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| `valueChange (UiNumber)` | `number \| null` | After a step, a commit (Enter, blur) or a native form reset; not when a form or [value] writes the number. |
|
|
83
|
+
|
|
84
|
+
## NumberInputLabels
|
|
85
|
+
|
|
86
|
+
| Field | Type | Description |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| `optional` | `string` | Tag after the label. |
|
|
89
|
+
| `decrease` | `string` | − button. |
|
|
90
|
+
| `increase` | `string` | + button. |
|
|
91
|
+
|
|
92
|
+
## CSS variables
|
|
93
|
+
|
|
94
|
+
| Variable | Default | Description |
|
|
95
|
+
| --- | --- | --- |
|
|
96
|
+
| `--ui-text-field-edge` | `var(--ui-hairline)` | Resting edge (shared with Text Field). |
|
|
97
|
+
| `--ui-text-field-edge-hover` | `text at 18%` | Hover edge. |
|
|
98
|
+
| `--ui-text-field-edge-focus` | `var(--ui-border-input)` | Focused edge, ≥ 3:1. |
|
|
99
|
+
| `--ui-text-field-radius` | `7px` | Corners (Classic 10px). |
|
|
100
|
+
|
|
101
|
+
## Keyboard
|
|
102
|
+
|
|
103
|
+
| Keys | Action |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| ↑ / ↓ | One step, onto the step grid. |
|
|
106
|
+
| Page Up / Page Down | Large step. |
|
|
107
|
+
| Home / End | Min / max when set. |
|
|
108
|
+
| Enter | Commit: parse, clamp, format. |
|
|
109
|
+
| Esc | Undo an uncommitted edit; stops there. |
|
|
110
|
+
| Tab | Commit and move on; − and + are skipped. |
|
|
111
|
+
|
|
112
|
+
## Accessibility
|
|
113
|
+
- role=spinbutton with aria-valuenow/min/max and a value text with prefix and unit.
|
|
114
|
+
- − / + named Decrease / Increase, aria-controls the input, aria-disabled at limits, tabindex -1.
|
|
115
|
+
- inputmode numeric or decimal.
|
|
116
|
+
- Hint/error in aria-describedby (merged with yours); error sets aria-invalid and is announced.
|
|
117
|
+
- Text ≥ 4.5:1, focus edge ≥ 3:1; forced colors keep edge and focus outline.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Number Ticker
|
|
2
|
+
|
|
3
|
+
Odometer numbers: every digit rolls to its new value, up or down, and the figure counts in from zero the first time it scrolls into view. Formatted with Intl.NumberFormat; size, weight and colour come from the text around it.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add number-ticker`
|
|
6
|
+
Import: `import { UiNumberTicker } from './ui/number-ticker';`
|
|
7
|
+
Selector: `<ui-number-ticker>`
|
|
8
|
+
Docs: /components/number-ticker
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- KPIs, prices and counters that change while people watch: dashboards, live stats.
|
|
12
|
+
- Headline figures that should count in as they scroll into view.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- Dense tables of numbers: rolling digits everywhere is noise.
|
|
16
|
+
- Values that change several times a second: the roll never settles.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Component, input } from '@angular/core';
|
|
22
|
+
import { UiNumberTicker } from './ui/number-ticker';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'app-revenue-kpi',
|
|
26
|
+
imports: [UiNumberTicker],
|
|
27
|
+
template: `
|
|
28
|
+
<p class="label">Net revenue</p>
|
|
29
|
+
<p class="kpi">
|
|
30
|
+
<ui-number-ticker [value]="revenue()" [format]="{ style: 'currency', currency: 'USD', maximumFractionDigits: 0 }" />
|
|
31
|
+
</p>
|
|
32
|
+
`,
|
|
33
|
+
styles: `
|
|
34
|
+
.label { margin: 0; color: var(--ui-text-muted); font-size: 13px; }
|
|
35
|
+
.kpi { margin: 4px 0 0; font-size: 36px; font-weight: 600; letter-spacing: -0.03em; }
|
|
36
|
+
`,
|
|
37
|
+
})
|
|
38
|
+
export class RevenueKpi {
|
|
39
|
+
readonly revenue = input.required<number>();
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
- Size, weight and colour come from the parent: style the element around it.
|
|
45
|
+
- Use live="off" when many tickers update together.
|
|
46
|
+
- Not a form control: bind value with a plain input.
|
|
47
|
+
|
|
48
|
+
## Inputs
|
|
49
|
+
|
|
50
|
+
| Name | Type | Default | Description |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| `value` | `number` | required | The number shown; changes roll to the new value. |
|
|
53
|
+
| `format` | `Intl.NumberFormatOptions` | {} | Currency, percent, compact, fraction digits, sign display. |
|
|
54
|
+
| `locale` | `string` | LOCALE_ID | Locale for Intl.NumberFormat, e.g. en-US or de-DE. |
|
|
55
|
+
| `duration` | `number` | 900 | Length of one roll in ms. |
|
|
56
|
+
| `delay` | `number` | 0 | Wait before the first count-in in ms. |
|
|
57
|
+
| `live` | `'polite' \| 'off'` | 'polite' | Announce the final value once per change, or stay quiet (dashboards). |
|
|
58
|
+
|
|
59
|
+
## NumberTickerLive
|
|
60
|
+
|
|
61
|
+
`type NumberTickerLive = 'polite' | 'off'`
|
|
62
|
+
|
|
63
|
+
## CSS variables
|
|
64
|
+
|
|
65
|
+
| Variable | Default | Description |
|
|
66
|
+
| --- | --- | --- |
|
|
67
|
+
| `--ui-number-ticker-fade` | `20%` | Soft fade at the top and bottom of each digit window. |
|
|
68
|
+
|
|
69
|
+
## Accessibility
|
|
70
|
+
- Hidden text with the formatted value in a polite live region, announced once per change.
|
|
71
|
+
- The digit columns are aria-hidden.
|
|
72
|
+
- Digits stay left to right in RTL pages; right-to-left formatted output falls back to plain text.
|
|
73
|
+
- Inherits the text colour, also in forced colors.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# OTP Input
|
|
2
|
+
|
|
3
|
+
A verification code drawn as a row of boxes over one real input, so paste and SMS autofill fill it at once. A focus ring glides between the boxes; verifying shimmers, an error shakes and clears, and success turns into a Verified chip. A resend countdown is built in.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add otp-input`
|
|
6
|
+
Import: `import { UiOtpInput, UiOtp, UiOtpBoxes } from './ui/otp-input';`
|
|
7
|
+
Selector: `<ui-otp-input>`
|
|
8
|
+
Docs: /components/otp-input
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Two-step sign-in, email or phone verification, confirming a sensitive change.
|
|
12
|
+
- Short codes copied from an email or SMS: paste and autofill fill every box.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
- Codes over about 8 characters, or free text: use Text Field.
|
|
16
|
+
- Secrets that must stay hidden: the boxes show what is typed.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Component, inject, signal } from '@angular/core';
|
|
22
|
+
import { HttpClient } from '@angular/common/http';
|
|
23
|
+
import { Router } from '@angular/router';
|
|
24
|
+
import { FormField, form } from '@angular/forms/signals';
|
|
25
|
+
import { OtpStatus, UiOtp, UiOtpInput } from './ui/otp-input';
|
|
26
|
+
|
|
27
|
+
@Component({
|
|
28
|
+
selector: 'app-verify-email',
|
|
29
|
+
imports: [UiOtpInput, UiOtp, FormField],
|
|
30
|
+
template: `
|
|
31
|
+
<h2>Check your inbox</h2>
|
|
32
|
+
<p>We sent a six-digit code to {{ email }}.</p>
|
|
33
|
+
<ui-otp-input separator align="center" [status]="status()" [error]="error()" [resendIn]="30"
|
|
34
|
+
(completed)="verify($event)" (resend)="sendCode()">
|
|
35
|
+
<input uiOtp [formField]="f.code" autofocus />
|
|
36
|
+
</ui-otp-input>
|
|
37
|
+
`,
|
|
38
|
+
})
|
|
39
|
+
export class VerifyEmail {
|
|
40
|
+
private readonly http = inject(HttpClient);
|
|
41
|
+
private readonly router = inject(Router);
|
|
42
|
+
protected readonly email = 'jo@fernhill.studio';
|
|
43
|
+
protected readonly status = signal<OtpStatus>('idle');
|
|
44
|
+
protected readonly error = signal('');
|
|
45
|
+
private readonly model = signal({ code: '' });
|
|
46
|
+
protected readonly f = form(this.model);
|
|
47
|
+
private triesLeft = 3;
|
|
48
|
+
|
|
49
|
+
protected verify(code: string) {
|
|
50
|
+
this.status.set('verifying');
|
|
51
|
+
this.http.post('/api/verify-email', { code }).subscribe({
|
|
52
|
+
next: () => {
|
|
53
|
+
this.status.set('success');
|
|
54
|
+
setTimeout(() => this.router.navigate(['/welcome']), 1200);
|
|
55
|
+
},
|
|
56
|
+
error: () => {
|
|
57
|
+
this.triesLeft--;
|
|
58
|
+
this.error.set(this.triesLeft > 0 ? `That code didn't work. ${this.triesLeft} left.` : 'Request a new code.');
|
|
59
|
+
this.status.set('error');
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected sendCode() {
|
|
65
|
+
this.triesLeft = 3;
|
|
66
|
+
this.http.post('/api/send-email-code', {}).subscribe();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Rules
|
|
72
|
+
- Put <input uiOtp> inside <ui-otp-input>; bind it with [formField], formControl, formControlName or ngModel.
|
|
73
|
+
- The app owns status: on (completed) set verifying, then success or error. The field goes quiet on the next keystroke by itself.
|
|
74
|
+
- Set resendIn to show the resend line; (resend) fires when the button is pressed.
|
|
75
|
+
- Without label, the input is named by labels.name plus the count; or set aria-label on the input.
|
|
76
|
+
|
|
77
|
+
## Inputs
|
|
78
|
+
|
|
79
|
+
| Name | Type | Default | Description |
|
|
80
|
+
| --- | --- | --- | --- |
|
|
81
|
+
| `length` | `number` | 6 | How many boxes. |
|
|
82
|
+
| `mode` | `'numeric' \| 'alphanumeric'` | 'numeric' | Digits with the number pad, or letters and digits stored in capitals. |
|
|
83
|
+
| `separator` | `boolean \| number` | false | A dash between groups: bare = middle, a number = after that many boxes. |
|
|
84
|
+
| `status` | `'idle' \| 'verifying' \| 'error' \| 'success'` | 'idle' | Set by the app. verifying locks and shimmers; error shakes and shows the message; success morphs into the Verified chip. |
|
|
85
|
+
| `error` | `string \| null \| undefined` | labels.error | Message while status is error, until the user types. |
|
|
86
|
+
| `clearOnError` | `boolean` | true | Empties the boxes about 1 s after an error; typing cancels it. |
|
|
87
|
+
| `resendIn` | `number` | none | Seconds before resend. Set it to show the countdown and the Resend button. |
|
|
88
|
+
| `align` | `'start' \| 'center'` | 'start' | Where the boxes and the lines under them sit. |
|
|
89
|
+
| `label` | `string` | none | Visible label above the boxes; otherwise the input is named "Verification code, 6 digits". |
|
|
90
|
+
| `hint` | `string` | none | Quiet line under the boxes; the error replaces it. |
|
|
91
|
+
| `labels` | `Partial<OtpInputLabels>` | English | Translations: name, digits, characters, verifying, verified, error, noCode, resendIn, resend, canResend, resent. |
|
|
92
|
+
|
|
93
|
+
## Outputs
|
|
94
|
+
|
|
95
|
+
| Name | Payload | Description |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| `completed` | `string` | The user filled the last box (typing, paste or autofill). Not for values written by code. |
|
|
98
|
+
| `resend` | `void` | Resend pressed; the countdown restarted and focus is back on the input. |
|
|
99
|
+
|
|
100
|
+
## OtpInputLabels
|
|
101
|
+
|
|
102
|
+
| Field | Type | Description |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| `name` | `string` | Accessible name without a label. Default "Verification code". |
|
|
105
|
+
| `digits` | `(n: number) => string` | Count added to the name in numeric mode: "6 digits". |
|
|
106
|
+
| `characters` | `(n: number) => string` | Count in alphanumeric mode: "8 characters". |
|
|
107
|
+
| `verifying` | `string` | Announced while verifying. |
|
|
108
|
+
| `verified` | `string` | Success chip text, also announced. |
|
|
109
|
+
| `error` | `string` | Default error message. |
|
|
110
|
+
| `noCode` | `string` | Start of the resend line. |
|
|
111
|
+
| `resendIn` | `string` | Before the countdown: "Resend in". |
|
|
112
|
+
| `resend` | `string` | Resend button. |
|
|
113
|
+
| `canResend` | `string` | Announced when the countdown ends. |
|
|
114
|
+
| `resent` | `string` | Announced after Resend. |
|
|
115
|
+
|
|
116
|
+
## CSS variables
|
|
117
|
+
|
|
118
|
+
| Variable | Default | Description |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| `--ui-otp-input-box` | `40px (Classic 48px)` | Widest box; boxes shrink to fit, digits stay ≥ 12px. |
|
|
121
|
+
| `--ui-otp-input-radius` | `box width / 5` | Box corners. |
|
|
122
|
+
| `--ui-otp-input-ring` | `var(--ui-focus-ring)` | Focus ring and caret, ≥ 3:1. |
|
|
123
|
+
| `--ui-text-field-edge` | `var(--ui-hairline)` | Resting box edge, shared with Text Field. |
|
|
124
|
+
|
|
125
|
+
## Keyboard
|
|
126
|
+
|
|
127
|
+
| Keys | Action |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| 0–9 | Fills the active box and moves on; replaces a filled box. Other keys ignored. |
|
|
130
|
+
| Backspace | Empty box: deletes the previous one and moves back. Filled box: deletes it, later characters shift left. |
|
|
131
|
+
| Delete | Deletes the active character; later ones shift left. |
|
|
132
|
+
| ← → | Between filled boxes and the first empty one. |
|
|
133
|
+
| Home / End | First box / first empty box. |
|
|
134
|
+
| ⌘V or Ctrl+V | Pastes from the active box; spaces, dashes and overflow dropped. |
|
|
135
|
+
| Tab | One stop for the whole field; then Resend when shown. |
|
|
136
|
+
|
|
137
|
+
## Accessibility
|
|
138
|
+
- One real input, one name ("Verification code, 6 digits"); the boxes are aria-hidden.
|
|
139
|
+
- autocomplete="one-time-code" and the number pad for SMS autofill.
|
|
140
|
+
- One polite live region: verifying, the error, success, can resend, resent. Countdown ticks are silent.
|
|
141
|
+
- Error: aria-invalid and aria-describedby to the message. Read-only while verifying and on success; focus stays on the input, also after Resend.
|
|
142
|
+
- Ring and caret ≥ 3:1, text ≥ 4.5:1; forced colors keep box edges and the ring.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
Pages of a long list: Rows per page, the range ("1–25 of 1,146"), Previous and Next, and page numbers with … between them. Tabular numbers in fixed slots keep the row still from page 1 to 10,000.
|
|
4
|
+
|
|
5
|
+
Add: `npx ochreui@latest add pagination`
|
|
6
|
+
Import: `import { UiPagination } from './ui/pagination';`
|
|
7
|
+
Selector: `<ui-pagination>`
|
|
8
|
+
Docs: /components/pagination
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Under a table or list that loads a page at a time: deploys, logs, eval cases, invoices.
|
|
12
|
+
- When people want the size of the list and a jump to the first, last or a nearby page.
|
|
13
|
+
- With pageSizes, when some people want more rows at once.
|
|
14
|
+
|
|
15
|
+
## When not to use
|
|
16
|
+
- A feed read top to bottom: load more on scroll.
|
|
17
|
+
- Where a page sits in a hierarchy: use Breadcrumb.
|
|
18
|
+
- A few views of the same thing: use Segmented Control.
|
|
19
|
+
- A handful of rows: show them all.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Component, input, signal } from '@angular/core';
|
|
25
|
+
import { UiPagination } from './ui/pagination';
|
|
26
|
+
|
|
27
|
+
@Component({
|
|
28
|
+
selector: 'app-invoices-footer',
|
|
29
|
+
imports: [UiPagination],
|
|
30
|
+
template: `
|
|
31
|
+
<ui-pagination
|
|
32
|
+
aria-label="Invoice pages"
|
|
33
|
+
[(page)]="page"
|
|
34
|
+
[(pageSize)]="pageSize"
|
|
35
|
+
[total]="total()"
|
|
36
|
+
[pageSizes]="[25, 50, 100]"
|
|
37
|
+
/>
|
|
38
|
+
`,
|
|
39
|
+
})
|
|
40
|
+
export class InvoicesFooter {
|
|
41
|
+
readonly total = input.required<number>();
|
|
42
|
+
protected readonly page = signal(1);
|
|
43
|
+
protected readonly pageSize = signal(25);
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Rules
|
|
48
|
+
- Bind [(page)]; set total (or pageCount when the row count is unknown).
|
|
49
|
+
- Two paginations for one list: give each its own aria-label and set [announce]="false" on one.
|
|
50
|
+
- page is shown clamped but never written back; fix out-of-range pages yourself if you need to.
|
|
51
|
+
- It needs its container's width: inside a shrink-to-fit parent, give it a width.
|
|
52
|
+
- It is navigation, not a form control: no formField, formControl or ngModel.
|
|
53
|
+
|
|
54
|
+
## Inputs
|
|
55
|
+
|
|
56
|
+
| Name | Type | Default | Description |
|
|
57
|
+
| --- | --- | --- | --- |
|
|
58
|
+
| `page` | `number (model, required)` | none | Page shown, from 1; shown clamped, written only when someone picks a page. |
|
|
59
|
+
| `pageSize` | `number (model)` | 20 | Rows per page; a new size moves page to the page holding the first row on screen. |
|
|
60
|
+
| `total` | `number` | none | All rows; drives the range ("0 of 0" when empty) and the page count. |
|
|
61
|
+
| `pageCount` | `number` | none | Page count when the row count is unknown; range reads "Page 3 of 12". total wins. |
|
|
62
|
+
| `pageSizes` | `number[]` | [] | Shows Rows per page, sorted, current size added. Needs total. |
|
|
63
|
+
| `siblings` | `number` | 1 | Numbers each side of the current one; at most 2 × siblings + 5 slots. |
|
|
64
|
+
| `compact` | `boolean` | false | Only the range and the arrows. |
|
|
65
|
+
| `disabled` | `boolean` | false | While rows load: stays in place, dimmed, nothing pressable. |
|
|
66
|
+
| `announce` | `boolean` | true | Polite live range. Turn off on the second pagination of one list. |
|
|
67
|
+
| `locale` | `string` | LOCALE_ID | Number locale (grouping). |
|
|
68
|
+
| `aria-label` | `string` | 'Pagination' | Names the landmark; say which list when a screen has two. |
|
|
69
|
+
| `labels` | `Partial<PaginationLabels>` | English | Translations; {page} {from} {to} {total} {count} are filled in. |
|
|
70
|
+
|
|
71
|
+
## Outputs
|
|
72
|
+
|
|
73
|
+
| Name | Payload | Description |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| `pageChange` | `number` | From an arrow, a number or a size change; never for the current page, a dimmed arrow or while disabled. |
|
|
76
|
+
| `pageSizeChange` | `number` | A size was picked; pageChange follows when the page moves. |
|
|
77
|
+
|
|
78
|
+
## PaginationLabels
|
|
79
|
+
|
|
80
|
+
| Field | Type | Description |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| `landmark` | `string` | Landmark name without aria-label. 'Pagination'. |
|
|
83
|
+
| `rowsPerPage` | `string` | 'Rows per page'. |
|
|
84
|
+
| `previous` | `string` | 'Previous page'. |
|
|
85
|
+
| `next` | `string` | 'Next page'. |
|
|
86
|
+
| `page` | `string` | Number names. 'Page {page}'. |
|
|
87
|
+
| `range` | `string` | With total. '{from}–{to} of {total}'. |
|
|
88
|
+
| `pageOf` | `string` | With pageCount only. 'Page {page} of {count}'. |
|
|
89
|
+
| `empty` | `string` | Total of 0. '{total} of {total}'. |
|
|
90
|
+
|
|
91
|
+
## CSS variables
|
|
92
|
+
|
|
93
|
+
| Variable | Default | Description |
|
|
94
|
+
| --- | --- | --- |
|
|
95
|
+
| `--ui-pagination-current-bg` | `rgb(from var(--ui-text) r g b / ≈7%, ≈10% dark)` | The current page's pill. |
|
|
96
|
+
| `--ui-text-field-edge` | `var(--ui-hairline)` | Rows per page edge (shared with Text Field). |
|
|
97
|
+
| `--ui-text-field-edge-hover` | `text at 18%` | That edge on hover. |
|
|
98
|
+
|
|
99
|
+
## Keyboard
|
|
100
|
+
|
|
101
|
+
| Keys | Action |
|
|
102
|
+
| --- | --- |
|
|
103
|
+
| Tab | Rows per page, the arrows, the numbers; gaps skipped. |
|
|
104
|
+
| Enter / Space | Goes to that page; focus follows its number. Nothing on the current page or a dimmed arrow. |
|
|
105
|
+
|
|
106
|
+
## Accessibility
|
|
107
|
+
- The host has role=navigation and is named by aria-label (default 'Pagination').
|
|
108
|
+
- A list of real buttons: Previous page, Page N, Next page; aria-current=page on the current one.
|
|
109
|
+
- End arrows are aria-disabled (still focusable), not disabled.
|
|
110
|
+
- The range is aria-live=polite, aria-atomic; the … gaps are aria-hidden.
|
|
111
|
+
- Rows per page is a native select inside its label.
|
|
112
|
+
- Focus ring only on :focus-visible, 2px outside; forced colors outline the current page and edge the select.
|