@aircall/ds 0.50.0 → 0.50.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/dist/{data-table-BgeS8KWP.d.ts → data-table-B5VqWPmw.d.ts} +3 -4
- package/dist/data-table.d.ts +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.d.ts +12 -9
- package/dist/index.js +11 -8
- package/package.json +2 -2
- package/skills/aircall-ds/migrate-audio-player/SKILL.md +14 -3
- package/skills/aircall-ds/migrate-icons/SKILL.md +45 -16
- package/skills/aircall-ds/migrate-tractor/SKILL.md +34 -31
- package/skills/aircall-ds/migrate-tractor/accordion/SKILL.md +25 -15
- package/skills/aircall-ds/migrate-tractor/alert/SKILL.md +107 -20
- package/skills/aircall-ds/migrate-tractor/avatar/SKILL.md +57 -26
- package/skills/aircall-ds/migrate-tractor/badge/SKILL.md +71 -25
- package/skills/aircall-ds/migrate-tractor/button/SKILL.md +68 -32
- package/skills/aircall-ds/migrate-tractor/card/SKILL.md +62 -42
- package/skills/aircall-ds/migrate-tractor/combobox/SKILL.md +233 -149
- package/skills/aircall-ds/migrate-tractor/data-table/SKILL.md +102 -108
- package/skills/aircall-ds/migrate-tractor/data-table/references/column-widths-and-pinning.md +50 -0
- package/skills/aircall-ds/migrate-tractor/data-table/references/infinite-scroll.md +51 -0
- package/skills/aircall-ds/migrate-tractor/data-table/references/row-actions.md +34 -0
- package/skills/aircall-ds/migrate-tractor/date-picker/SKILL.md +100 -47
- package/skills/aircall-ds/migrate-tractor/dialog/SKILL.md +115 -20
- package/skills/aircall-ds/migrate-tractor/dropdown-menu/SKILL.md +135 -57
- package/skills/aircall-ds/migrate-tractor/dropzone/SKILL.md +2 -0
- package/skills/aircall-ds/migrate-tractor/form-and-field/SKILL.md +111 -49
- package/skills/aircall-ds/migrate-tractor/gauge/SKILL.md +6 -4
- package/skills/aircall-ds/migrate-tractor/input/SKILL.md +165 -59
- package/skills/aircall-ds/migrate-tractor/item/SKILL.md +85 -63
- package/skills/aircall-ds/migrate-tractor/link/SKILL.md +85 -68
- package/skills/aircall-ds/migrate-tractor/popover/SKILL.md +115 -74
- package/skills/aircall-ds/migrate-tractor/select/SKILL.md +117 -64
- package/skills/aircall-ds/migrate-tractor/sheet-vs-drawer/SKILL.md +55 -32
- package/skills/aircall-ds/migrate-tractor/skeleton/SKILL.md +40 -11
- package/skills/aircall-ds/migrate-tractor/styling/SKILL.md +11 -7
- package/skills/aircall-ds/migrate-tractor/tabs/SKILL.md +62 -55
- package/skills/aircall-ds/migrate-tractor/toast/SKILL.md +58 -12
- package/skills/aircall-ds/migrate-tractor/tooltip/SKILL.md +65 -40
- package/skills/aircall-ds/migrate-tractor/tree/SKILL.md +23 -6
- package/skills/aircall-ds/setup/SKILL.md +53 -8
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
name: aircall-ds/migrate-tractor/alert
|
|
3
3
|
description: >
|
|
4
4
|
Migrate Tractor Banner (Banner, BannerHeading, BannerIcon, BannerParagraph) to
|
|
5
|
-
@aircall/ds Alert (rounded) vs Banner (inline)
|
|
6
|
-
|
|
5
|
+
@aircall/ds Alert (rounded) vs Banner (inline), and the Tractor BannerManager /
|
|
6
|
+
useBanner / banners.showBanner API to the NotificationQueue. Load when a file
|
|
7
|
+
imports Banner*, BannerManager or useBanner from @aircall/tractor.
|
|
7
8
|
type: sub-skill
|
|
8
9
|
library: aircall-ds
|
|
9
10
|
requires:
|
|
@@ -11,6 +12,12 @@ requires:
|
|
|
11
12
|
- aircall-ds/migrate-tractor
|
|
12
13
|
sources:
|
|
13
14
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/recipes/alert-and-banner.md"
|
|
15
|
+
- "aircall/hydra:packages/ds/src/components/alert.tsx"
|
|
16
|
+
- "aircall/hydra:packages/ds/src/components/banner.tsx"
|
|
17
|
+
- "aircall/hydra:packages/ds/src/components/notification-queue.tsx"
|
|
18
|
+
- "aircall/hydra:packages/ds/src/stories/Alert.stories.tsx"
|
|
19
|
+
- "aircall/hydra:packages/ds/src/stories/Banner.stories.tsx"
|
|
20
|
+
- "aircall/hydra:packages/ds/src/stories/NotificationQueue.stories.tsx"
|
|
14
21
|
---
|
|
15
22
|
|
|
16
23
|
This skill builds on aircall-ds/migrate-tractor. Apply all cross-cutting rules from that skill (prop renames, `render` prop, data attributes) before the alert-specific steps below.
|
|
@@ -21,8 +28,10 @@ Tractor `Banner` maps to **two** DS components. Choose based on visual shape:
|
|
|
21
28
|
|
|
22
29
|
| If the Tractor `Banner` looks like… | Use DS component |
|
|
23
30
|
| --- | --- |
|
|
24
|
-
|
|
|
25
|
-
| Full-width
|
|
31
|
+
| `<Banner inline …>` or any rounded callout placed inside page/card content (`rounded-3xl`, full border) | `Alert` |
|
|
32
|
+
| Full-width strip without `inline` (square corners), e.g. at the top of a page or screen (border on one side) | `Banner` |
|
|
33
|
+
|
|
34
|
+
Tractor `Banner` is square-cornered by default and only gets a rounded corner with `inline`. Banners shown through `BannerManager` / `useBanner().showBanner` / `banners.showBanner` are the full-width kind; see section 8 for how they migrate.
|
|
26
35
|
|
|
27
36
|
`Banner` re-exports the `Alert*` sub-parts under `Banner*` aliases — the children grammar is identical. Pick the container; the parts follow.
|
|
28
37
|
|
|
@@ -36,6 +45,8 @@ Tractor `Banner` maps to **two** DS components. Choose based on visual shape:
|
|
|
36
45
|
| `BannerParagraph` (body text) | `AlertDescription` | `BannerDescription` |
|
|
37
46
|
|
|
38
47
|
> **Icon is a direct child, not a part.** `Alert`/`Banner` detect a leading icon via `has-[>svg]` CSS. Render the icon as the **first child** — never wrap it. There is no `AlertIcon` or `BannerIcon` component in DS.
|
|
48
|
+
>
|
|
49
|
+
> **No automatic icon.** Tractor `BannerIcon` rendered a default icon per variant (or the node passed as its `icon` prop; `icon={false}` hid it). DS renders only the icon you give it, so pick one per variant. The stories use `InfoIcon` (info), `CircleCheck` (success), `AlertTriangle` (warning), `CircleX` (error) and `LightbulbIcon` (default), all from `@aircall/react-icons`. `AlertDescription` is optional: a title on its own is a valid `Alert`/`Banner`.
|
|
39
50
|
|
|
40
51
|
## 3. Verified DS exports (`packages/ds/src/index.ts`)
|
|
41
52
|
|
|
@@ -65,16 +76,16 @@ import { Info, AlertTriangle, X } from '@aircall/react-icons';
|
|
|
65
76
|
import { Banner, BannerHeading, BannerIcon, BannerParagraph, BannerSuffix } from '@aircall/tractor';
|
|
66
77
|
|
|
67
78
|
// Rounded callout
|
|
68
|
-
<Banner variant="
|
|
69
|
-
<BannerIcon
|
|
79
|
+
<Banner inline variant="info">
|
|
80
|
+
<BannerIcon />
|
|
70
81
|
<BannerHeading>Heads up</BannerHeading>
|
|
71
82
|
<BannerParagraph>Your trial ends in 3 days.</BannerParagraph>
|
|
72
83
|
<BannerSuffix><button onClick={onDismiss}>✕</button></BannerSuffix>
|
|
73
84
|
</Banner>
|
|
74
85
|
|
|
75
|
-
// Full-width
|
|
86
|
+
// Full-width strip
|
|
76
87
|
<Banner variant="critical">
|
|
77
|
-
<BannerIcon
|
|
88
|
+
<BannerIcon />
|
|
78
89
|
<BannerHeading>Limited connectivity</BannerHeading>
|
|
79
90
|
<BannerParagraph>Some calls may not connect.</BannerParagraph>
|
|
80
91
|
<BannerSuffix><button onClick={onRetry}>Retry</button></BannerSuffix>
|
|
@@ -93,7 +104,7 @@ import { Info, AlertTriangle, X } from '@aircall/react-icons';
|
|
|
93
104
|
|
|
94
105
|
// Rounded callout → Alert
|
|
95
106
|
<Alert variant="info">
|
|
96
|
-
<Info /> {/* BannerIcon → first <svg> child, no wrapper */}
|
|
107
|
+
<Info /> {/* BannerIcon (default icon per variant) → first <svg> child, no wrapper */}
|
|
97
108
|
<AlertTitle>Heads up</AlertTitle>
|
|
98
109
|
<AlertDescription>Your trial ends in 3 days.</AlertDescription>
|
|
99
110
|
<AlertAction>
|
|
@@ -101,8 +112,8 @@ import { Info, AlertTriangle, X } from '@aircall/react-icons';
|
|
|
101
112
|
</AlertAction>
|
|
102
113
|
</Alert>
|
|
103
114
|
|
|
104
|
-
// Full-width
|
|
105
|
-
<Banner variant="error" borderDirection="
|
|
115
|
+
// Full-width strip → Banner
|
|
116
|
+
<Banner variant="error" borderDirection="bottom">
|
|
106
117
|
<AlertTriangle />
|
|
107
118
|
<BannerTitle>Limited connectivity</BannerTitle>
|
|
108
119
|
<BannerDescription>Some calls may not connect.</BannerDescription>
|
|
@@ -114,21 +125,97 @@ import { Info, AlertTriangle, X } from '@aircall/react-icons';
|
|
|
114
125
|
|
|
115
126
|
## 6. Variant mapping
|
|
116
127
|
|
|
117
|
-
| Tractor variant | DS variant |
|
|
128
|
+
| Tractor `Banner` variant (`success` / `info` / `warning` / `critical`) | DS variant |
|
|
118
129
|
| --- | --- |
|
|
119
|
-
| `
|
|
130
|
+
| `info` | `info` |
|
|
120
131
|
| `critical` | `error` |
|
|
121
132
|
| `warning` | `warning` |
|
|
122
|
-
| `
|
|
123
|
-
| (
|
|
133
|
+
| `success` | `success` |
|
|
134
|
+
| (no neutral variant in Tractor) | `default` |
|
|
124
135
|
|
|
125
136
|
Both `Alert` and `Banner` share the same set: `default` / `info` / `success` / `warning` / `error`.
|
|
126
137
|
|
|
127
138
|
## 7. `Banner`-only prop: `borderDirection`
|
|
128
139
|
|
|
129
|
-
`Banner` accepts `borderDirection="top" | "bottom"` to place the accent border. `Alert` has no border-side prop — it is fully bordered and rounded.
|
|
140
|
+
`Banner` accepts `borderDirection="top" | "bottom"` to place the accent border (no default: without it the strip has no border). `Alert` has no border-side prop — it is fully bordered and rounded.
|
|
141
|
+
|
|
142
|
+
## 8. Programmatic banners (`BannerManager`, `useBanner`, `banners.showBanner`) → `NotificationQueue`
|
|
143
|
+
|
|
144
|
+
Tractor can also show banners from code: `BannerManager` (mounted once, portals a `BannerList` into `document.body`), `useBanner()` returning `{ banners, showBanner, removeBanner }`, and the `banners.showBanner` / `banners.removeBanner` pub-sub helpers for code outside React. A `BannerItem` is `{ id?, variant, heading, paragraph?, actions?, icon? }` where each action is `{ children, variant?, mode?, onClick(dismiss) }`.
|
|
145
|
+
|
|
146
|
+
DS has no manager component. It has a priority queue, `NotificationQueueProvider` + `NotificationSlot` + `useNotification` / `useNotificationQueue` (see `aircall-ds/setup` for the provider and the slot). You render the `Banner` yourself inside the `render` function.
|
|
147
|
+
|
|
148
|
+
| Tractor | DS |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| `<BannerManager>` | `<NotificationQueueProvider>` once at the root, plus `<NotificationSlot slot="page" />` where the banner should appear (top of the page) |
|
|
151
|
+
| `showBanner(item)` from a React event handler | `useNotificationQueue().push({ id, slot, priority, render })`, called from a component under the provider |
|
|
152
|
+
| `banners.showBanner(item)` from code outside React (services, sockets, plain modules) | no direct equivalent: `useNotificationQueue` is a hook. Have the service emit an event and a small component under the provider subscribe to it and call `push` (see below) |
|
|
153
|
+
| A banner shown for as long as a condition holds | `useNotification({ id, slot, priority, render })` in a small component you mount while the condition is true |
|
|
154
|
+
| The cleanup function returned by `showBanner`, `removeBanner(id)` | the `{ dismiss }` handle returned by `push` / `useNotification`, or `dismiss(id, slot)` from `useNotificationQueue()` |
|
|
155
|
+
| `variant` `success` / `info` / `warning` / `critical` | `priority` `success` / `info` / `warning` / `error`, and the same value as the `Banner` `variant` |
|
|
156
|
+
| `heading` / `paragraph` / `icon` | `BannerTitle` / `BannerDescription` / leading icon, inside `render` |
|
|
157
|
+
| `actions[].onClick(dismiss)` | `BannerAction` > `Button onClick={dismiss}`, where `dismiss` comes from `render({ dismiss })` |
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import {
|
|
161
|
+
Banner, BannerAction, BannerDescription, BannerTitle, Button,
|
|
162
|
+
NotificationQueueProvider, NotificationSlot, useNotificationQueue,
|
|
163
|
+
} from '@aircall/ds';
|
|
164
|
+
import { AlertTriangle } from '@aircall/react-icons';
|
|
165
|
+
import { useEffect } from 'react';
|
|
166
|
+
|
|
167
|
+
// Once, at the root:
|
|
168
|
+
<NotificationQueueProvider>
|
|
169
|
+
<NotificationSlot slot="page" />
|
|
170
|
+
<App />
|
|
171
|
+
</NotificationQueueProvider>
|
|
172
|
+
|
|
173
|
+
// Event-driven (was showBanner / banners.showBanner). `connectivity` stands for whatever
|
|
174
|
+
// non-React service used to call banners.showBanner: it now only emits, and this component,
|
|
175
|
+
// mounted once under the provider, turns the event into a push.
|
|
176
|
+
function ConnectivityBanner() {
|
|
177
|
+
const { push } = useNotificationQueue();
|
|
178
|
+
|
|
179
|
+
useEffect(
|
|
180
|
+
() =>
|
|
181
|
+
connectivity.onLost(() => {
|
|
182
|
+
push({
|
|
183
|
+
id: 'connectivity',
|
|
184
|
+
slot: 'page',
|
|
185
|
+
priority: 'warning',
|
|
186
|
+
render: ({ dismiss }) => (
|
|
187
|
+
<Banner variant="warning" borderDirection="bottom">
|
|
188
|
+
<AlertTriangle />
|
|
189
|
+
<BannerTitle>Limited connectivity</BannerTitle>
|
|
190
|
+
<BannerDescription>Some calls may not connect.</BannerDescription>
|
|
191
|
+
<BannerAction>
|
|
192
|
+
<Button variant="outline" size="sm" onClick={dismiss}>Dismiss</Button>
|
|
193
|
+
</BannerAction>
|
|
194
|
+
</Banner>
|
|
195
|
+
)
|
|
196
|
+
});
|
|
197
|
+
}), // onLost returns its unsubscribe, which is the effect cleanup
|
|
198
|
+
[push]
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// From a React event handler, call push directly: onClick={() => push({ ... })}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Behavioural differences to account for:
|
|
208
|
+
|
|
209
|
+
- A slot shows **one** notification at a time, the highest-priority one (`error` > `warning` > `success` > `info` > `promotional`, then the most recently pushed). Tractor stacked every banner. The others wait and show once the top one is dismissed.
|
|
210
|
+
- `push` evaluates `render` once, when it is called. For content that must follow state, use `useNotification` (it keeps the latest `render`).
|
|
211
|
+
- `useNotification` unregisters on unmount, and a remount shows the notice again even if the user dismissed it. Keep "dismissed for the session" in your own storage and skip mounting the component.
|
|
212
|
+
- Re-pushing the same `id` + `slot` updates the existing notification instead of adding a second one.
|
|
213
|
+
- `error` notices have no special behaviour in the API: `dismiss` always works. "Not dismissible by users" means you do not render a dismiss button for them.
|
|
214
|
+
- The slot is presentation-agnostic: the same queue with a `NotificationSlot` inside a card and an `Alert` in `render` gives an inline alert.
|
|
215
|
+
|
|
216
|
+
Source: `packages/ds/src/components/notification-queue.tsx`, `packages/ds/src/stories/NotificationQueue.stories.tsx`
|
|
130
217
|
|
|
131
|
-
##
|
|
218
|
+
## 9. Common Mistakes
|
|
132
219
|
|
|
133
220
|
### Mistake 1 — Wrapping the icon in a part component
|
|
134
221
|
|
|
@@ -161,7 +248,7 @@ Source: `packages/ds/src/components/alert.tsx`
|
|
|
161
248
|
<Alert variant="error">...</Alert> {/* maps Tractor critical */}
|
|
162
249
|
```
|
|
163
250
|
|
|
164
|
-
`destructive` is a `Button` variant. `Alert`/`Banner` only accept `default | info | success | warning | error`.
|
|
251
|
+
`destructive` is a `Button` variant. `Alert`/`Banner` only accept `default | info | success | warning | error`. An unknown variant is a type error and gets none of the variant classes (no background, border or icon colour).
|
|
165
252
|
Source: `packages/ds/src/components/alert.tsx`
|
|
166
253
|
|
|
167
254
|
---
|
|
@@ -215,10 +302,10 @@ Source: `packages/ds/src/components/alert.tsx`
|
|
|
215
302
|
<Alert variant="warning" borderDirection="top">...</Alert> {/* prop not supported on Alert */}
|
|
216
303
|
|
|
217
304
|
// Correct
|
|
218
|
-
<Banner variant="warning" borderDirection="top"> {/* Banner is the
|
|
305
|
+
<Banner variant="warning" borderDirection="top"> {/* Banner is the full-width strip */}
|
|
219
306
|
...
|
|
220
307
|
</Banner>
|
|
221
308
|
```
|
|
222
309
|
|
|
223
|
-
`borderDirection` is a `Banner`-only prop (
|
|
310
|
+
`borderDirection` is a `Banner`-only prop (full-width strip component). `Alert` is always fully bordered and rounded; it has no border-side prop. On `Alert` it is a type error and the value is spread onto the `<div>` as an unknown DOM attribute.
|
|
224
311
|
Source: `packages/ds/src/components/banner.tsx`
|
|
@@ -11,6 +11,10 @@ requires:
|
|
|
11
11
|
- aircall-ds/migrate-tractor
|
|
12
12
|
sources:
|
|
13
13
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/recipes/avatar.md"
|
|
14
|
+
- "aircall/hydra:packages/ds/src/components/avatar.tsx"
|
|
15
|
+
- "aircall/hydra:packages/ds/src/stories/Avatar.stories.tsx"
|
|
16
|
+
- "aircall/hydra:packages/blocks/src/components/entity-avatar.tsx"
|
|
17
|
+
- "aircall/hydra:packages/blocks/src/components/entity-group.tsx"
|
|
14
18
|
---
|
|
15
19
|
|
|
16
20
|
This skill builds on aircall-ds/migrate-tractor.
|
|
@@ -19,13 +23,19 @@ This skill builds on aircall-ds/migrate-tractor.
|
|
|
19
23
|
|
|
20
24
|
| Tractor part | DS replacement | Notes |
|
|
21
25
|
| --- | --- | --- |
|
|
22
|
-
| `<Avatar src
|
|
23
|
-
| `<QuickAvatar>` | `<Avatar>`
|
|
24
|
-
| `name="Jane Doe"` prop | `<AvatarFallback>JD</AvatarFallback>` | Derive initials yourself; DS has no auto-initials prop |
|
|
25
|
-
|
|
|
26
|
-
|
|
|
26
|
+
| `<Avatar>` + `<AvatarImg src>` + `<AvatarFallback>` (`AvatarText` / `AvatarIcon`) | `<Avatar size><AvatarImage /><AvatarFallback /></Avatar>` | Compound — image and fallback are explicit children |
|
|
27
|
+
| `<QuickAvatar src name initials icon size>` | `<Avatar>` + `<AvatarImage>` + `<AvatarFallback>` | `QuickAvatar` built the image, initials and icon children from props. In DS you write them as children (see 5b) |
|
|
28
|
+
| `name="Jane Doe"` / `initials` prop (`QuickAvatar`, `AvatarText`) | `<AvatarFallback>JD</AvatarFallback>` | Derive initials yourself; DS has no auto-initials prop. `getEntityInitials(name)` from `@aircall/blocks` does it (up to two uppercase letters) |
|
|
29
|
+
| `icon={SomeIcon}` (`QuickAvatar`) / `<AvatarIcon>` | `<AvatarFallback><UserRound /></AvatarFallback>` | A direct `<svg>` child of `AvatarFallback` is sized from the avatar `size`; no `size-*` class needed |
|
|
30
|
+
| `variant="green" \| "blue" \| …` (fallback tint) | `className` on `AvatarFallback` (e.g. `bg-primary/10 text-primary`) | DS has no `variant` prop; the fallback is `bg-muted text-muted-foreground` |
|
|
31
|
+
| `shape="rounded"` | — | No `shape` prop; DS avatars are always circular |
|
|
32
|
+
| `disabled` | `className="opacity-50 grayscale"` on `Avatar` | No `disabled` prop |
|
|
33
|
+
| Tractor `Badge` wrapped around an avatar | `<AvatarBadge className="bg-…" />` | Child of `Avatar`; color set via `className` |
|
|
34
|
+
| Hand-rolled overlapping stack (Tractor has no avatar group) | `<AvatarGroup>` | Wraps `Avatar` children with overlap ring |
|
|
27
35
|
| Overflow chip `+N` | `<AvatarGroupCount>+3</AvatarGroupCount>` | Last child inside `AvatarGroup` |
|
|
28
36
|
|
|
37
|
+
**Entity avatars (users, contacts, teams, AI agents).** For an avatar that stands for a product entity, `@aircall/blocks` has purpose-built wrappers that already decide the media (picture, then emoji or icon, then initials), the 20/24px sizes, the accessible name and the presence dot: `UserAvatar` (`name`, `src`, `presence`), `ContactAvatar`, `TeamAvatar`, `AiAgentAvatar`, `IntegrationAvatar`, `AddonAvatar`, plus `EntityGroup` for a capped stack with a "+N" counter (`max` default 3, `overflowCount`). Prefer them over hand-building `Avatar` + `AvatarFallback` for those objects. They are marked `@experimental`. Source: `packages/blocks/src/components/entity-avatar.tsx`, `entity-user.tsx`, `entity-group.tsx`.
|
|
38
|
+
|
|
29
39
|
## 2. Verified DS exports (`packages/ds/src/index.ts`)
|
|
30
40
|
|
|
31
41
|
```
|
|
@@ -49,12 +59,12 @@ import {
|
|
|
49
59
|
|
|
50
60
|
| Tractor `size` | DS `size` | Rendered px |
|
|
51
61
|
| --- | --- | --- |
|
|
52
|
-
| `small` | `sm` | 24 px |
|
|
53
|
-
| `regular` (default) | `default` | 32 px |
|
|
54
|
-
| `large` | `xl` | 48 px |
|
|
55
|
-
| `xLarge` | `xl` | 48 px |
|
|
56
|
-
| _(
|
|
57
|
-
| _(
|
|
62
|
+
| `small` (24 px) | `sm` | 24 px |
|
|
63
|
+
| `regular` (default, 32 px) | `default` | 32 px |
|
|
64
|
+
| `large` (48 px) | `xl` | 48 px |
|
|
65
|
+
| `xLarge` (64 px) | `xl` | 48 px |
|
|
66
|
+
| _(custom string, e.g. 20 px)_ | `xs` | 20 px |
|
|
67
|
+
| _(custom string, e.g. 40 px)_ | `lg` | 40 px |
|
|
58
68
|
|
|
59
69
|
There is no 64 px size in DS. Map Tractor `xLarge` (64 px) to `xl` (48 px) — the closest available size.
|
|
60
70
|
|
|
@@ -64,15 +74,26 @@ There is no 64 px size in DS. Map Tractor `xLarge` (64 px) to `xl` (48 px) — t
|
|
|
64
74
|
|
|
65
75
|
**Before (Tractor):**
|
|
66
76
|
```tsx
|
|
67
|
-
import {
|
|
77
|
+
import { QuickAvatar } from '@aircall/tractor';
|
|
68
78
|
|
|
69
|
-
<
|
|
79
|
+
<QuickAvatar
|
|
70
80
|
src="https://example.com/photo.jpg"
|
|
71
81
|
name="Jane Doe"
|
|
72
82
|
size="regular"
|
|
73
83
|
/>
|
|
74
84
|
```
|
|
75
85
|
|
|
86
|
+
Or the composed form, which maps to the same DS compound:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
import { Avatar, AvatarFallback, AvatarImg, AvatarText } from '@aircall/tractor';
|
|
90
|
+
|
|
91
|
+
<Avatar size="regular">
|
|
92
|
+
<AvatarImg src="https://example.com/photo.jpg" />
|
|
93
|
+
<AvatarFallback><AvatarText name="Jane Doe" /></AvatarFallback>
|
|
94
|
+
</Avatar>
|
|
95
|
+
```
|
|
96
|
+
|
|
76
97
|
**After (DS):**
|
|
77
98
|
```tsx
|
|
78
99
|
import { Avatar, AvatarFallback, AvatarImage } from '@aircall/ds';
|
|
@@ -98,7 +119,7 @@ import { Avatar, AvatarFallback, AvatarImage } from '@aircall/ds';
|
|
|
98
119
|
|
|
99
120
|
<Avatar size="xl">
|
|
100
121
|
<AvatarImage src={photoUrl} alt="" />
|
|
101
|
-
<AvatarFallback
|
|
122
|
+
<AvatarFallback>{initials}</AvatarFallback>
|
|
102
123
|
</Avatar>
|
|
103
124
|
```
|
|
104
125
|
|
|
@@ -106,9 +127,13 @@ import { Avatar, AvatarFallback, AvatarImage } from '@aircall/ds';
|
|
|
106
127
|
|
|
107
128
|
**Before (Tractor):**
|
|
108
129
|
```tsx
|
|
109
|
-
import { Avatar } from '@aircall/tractor';
|
|
130
|
+
import { Avatar, AvatarText, Badge } from '@aircall/tractor';
|
|
110
131
|
|
|
111
|
-
<
|
|
132
|
+
<Badge variant="primary" offsetRight="3px" offsetTop="3px">
|
|
133
|
+
<Avatar>
|
|
134
|
+
<AvatarText name="Jane Doe" />
|
|
135
|
+
</Avatar>
|
|
136
|
+
</Badge>
|
|
112
137
|
```
|
|
113
138
|
|
|
114
139
|
**After (DS):**
|
|
@@ -122,15 +147,21 @@ import { Avatar, AvatarBadge, AvatarFallback, AvatarImage } from '@aircall/ds';
|
|
|
122
147
|
</Avatar>
|
|
123
148
|
```
|
|
124
149
|
|
|
125
|
-
`AvatarBadge` auto-positions at bottom-right and sizes itself from the parent `Avatar`'s `size`
|
|
150
|
+
`AvatarBadge` auto-positions at bottom-right (with a 2px ring in the background colour) and sizes itself from the parent `Avatar`'s `size`: 8px at `xs`/`sm`, 10px at `default`, 12px at `lg`/`xl`. It ships without a colour: pass a Tailwind background utility via `className` (`bg-success`, or `bg-green-500` as the stories do). An `<svg>` child is hidden at `xs`/`sm` and drawn at 8px from `default` up. For user presence (available, in-call, wrap-up, ringing, unavailable, offline) use `UserAvatar presence` from `@aircall/blocks` instead of colouring the badge by hand.
|
|
126
151
|
|
|
127
152
|
### 5d. Overlapping avatar group with overflow count
|
|
128
153
|
|
|
129
|
-
**Before (Tractor):**
|
|
154
|
+
**Before (Tractor has no avatar group; this was typically hand-rolled):**
|
|
130
155
|
```tsx
|
|
131
|
-
import { Avatar,
|
|
132
|
-
|
|
133
|
-
<
|
|
156
|
+
import { Avatar, AvatarImg, Flex } from '@aircall/tractor';
|
|
157
|
+
|
|
158
|
+
<Flex>
|
|
159
|
+
{users.slice(0, 3).map((user, index) => (
|
|
160
|
+
<Avatar key={user.id} style={{ marginLeft: index === 0 ? 0 : -8 }}>
|
|
161
|
+
<AvatarImg src={user.photo} />
|
|
162
|
+
</Avatar>
|
|
163
|
+
))}
|
|
164
|
+
</Flex>
|
|
134
165
|
```
|
|
135
166
|
|
|
136
167
|
**After (DS):**
|
|
@@ -156,7 +187,7 @@ import {
|
|
|
156
187
|
</AvatarGroup>
|
|
157
188
|
```
|
|
158
189
|
|
|
159
|
-
DS has no built-in `max` or `users` props — slice the array yourself before rendering and compute the overflow count explicitly.
|
|
190
|
+
DS has no built-in `max` or `users` props — slice the array yourself before rendering and compute the overflow count explicitly. `AvatarGroupCount` sizes itself from the avatars in the group (`xs`/`sm`/`lg`/`xl`; 32px otherwise). For entity avatars, `EntityGroup` from `@aircall/blocks` does the slicing and the "+N" counter for you.
|
|
160
191
|
|
|
161
192
|
## 6. Common mistakes
|
|
162
193
|
|
|
@@ -179,9 +210,9 @@ import { Avatar, AvatarFallback, AvatarImage } from '@aircall/ds';
|
|
|
179
210
|
</Avatar>
|
|
180
211
|
```
|
|
181
212
|
|
|
182
|
-
DS `Avatar` has no `name` prop.
|
|
213
|
+
DS `Avatar` has no `name` prop. It is a type error, and the value is passed to the Base UI root `<div>` as a stray attribute; nothing renders, so the avatar is a blank circle instead of initials.
|
|
183
214
|
|
|
184
|
-
Source: packages/ds/src/components/avatar.tsx — `AvatarProps`
|
|
215
|
+
Source: packages/ds/src/components/avatar.tsx — `AvatarProps` is `AvatarPrimitive.Root.Props & VariantProps<typeof avatarVariants>`, which has no `name` field.
|
|
185
216
|
|
|
186
217
|
---
|
|
187
218
|
|
|
@@ -266,6 +297,6 @@ import { Avatar, AvatarFallback, AvatarImage } from '@aircall/ds';
|
|
|
266
297
|
</Avatar>
|
|
267
298
|
```
|
|
268
299
|
|
|
269
|
-
DS has no `"large"` size token and no 64 px size.
|
|
300
|
+
DS has no `"large"` size token and no 64 px size. `size` is typed `'xs' | 'sm' | 'default' | 'lg' | 'xl'`, so `"large"` is a type error. If it slips through, none of the `size-*` classes apply (the `default` size is only the fallback when `size` is undefined), so the avatar has no width or height of its own and `AvatarBadge` / `AvatarGroupCount` scale to nothing. Tractor `large` (48 px) maps to `xl`; the closest DS size to Tractor `xLarge` (64 px) is `xl` (48 px).
|
|
270
301
|
|
|
271
|
-
Source: packages/ds/src/components/avatar.tsx — `
|
|
302
|
+
Source: packages/ds/src/components/avatar.tsx — `avatarVariants` size keys are `xs | sm | default | lg | xl` (`size-5`, `size-6`, `size-8`, `size-10`, `size-12`).
|
|
@@ -4,7 +4,8 @@ description: >
|
|
|
4
4
|
Migrate Tractor Tag and CounterBadge to @aircall/ds Badge, CounterBadge, BadgeGroup,
|
|
5
5
|
and BadgeGroupCount. Load when a file imports Tag or CounterBadge from @aircall/tractor.
|
|
6
6
|
Maps Tractor variant (grey/primary/blue/red/yellow/green/purple/pink/dark* prefixes)
|
|
7
|
-
to the DS color + tone two-axis model,
|
|
7
|
+
to the DS color + tone two-axis model, Tractor status Badge (dot) to AvatarBadge,
|
|
8
|
+
and removable Tag (TagDeleteIcon) to Chip + ChipRemove.
|
|
8
9
|
type: sub-skill
|
|
9
10
|
library: aircall-ds
|
|
10
11
|
requires:
|
|
@@ -12,6 +13,11 @@ requires:
|
|
|
12
13
|
- aircall-ds/migrate-tractor
|
|
13
14
|
sources:
|
|
14
15
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/recipes/badge.md"
|
|
16
|
+
- "aircall/hydra:packages/ds/src/components/badge.tsx"
|
|
17
|
+
- "aircall/hydra:packages/ds/src/components/counter-badge.tsx"
|
|
18
|
+
- "aircall/hydra:packages/ds/src/components/chip.tsx"
|
|
19
|
+
- "aircall/hydra:packages/ds/src/stories/Badge.stories.tsx"
|
|
20
|
+
- "aircall/hydra:packages/ds/src/stories/CounterBadge.stories.tsx"
|
|
15
21
|
---
|
|
16
22
|
|
|
17
23
|
This skill builds on aircall-ds/migrate-tractor.
|
|
@@ -22,8 +28,11 @@ Tractor's badge surface had three distinct concepts that map to different DS com
|
|
|
22
28
|
|
|
23
29
|
| Tractor component | DS replacement | Notes |
|
|
24
30
|
| --- | --- | --- |
|
|
25
|
-
| `<Tag>` | `<Badge>` | Color model changes from single `variant` to `color` + `tone` |
|
|
26
|
-
| `<
|
|
31
|
+
| `<Tag>` | `<Badge>` | Color model changes from single `variant` to `color` + `tone`. Tag was fully rounded (`rounded-full`), `Badge` is `rounded-md` |
|
|
32
|
+
| `<Tag onClick>` | `<Badge render={<button type="button" onClick={…} />}>` | `Badge` is read-only; `render` makes it a button or link without changing its look |
|
|
33
|
+
| `<Tag>` + `<TagDeleteIcon onClick>` (removable) | `<Chip>` + `<ChipRemove onClick>` | `Badge` is never removable; `Chip` is the removable token (fixed 24px, `overflowMode="truncate"`) |
|
|
34
|
+
| `<Tag maxWidth>` / long labels | `<Badge overflowMode="truncate">` | Caps the width at `max-w-36` and ellipsizes text |
|
|
35
|
+
| `<CounterBadge count maxCount>` | `<CounterBadge>` | No `count`/`maxCount` props — cap the value yourself and pass it as children |
|
|
27
36
|
| `<Badge>` (status dot) | `<AvatarBadge>` | Tractor's dot-indicator badge is unrelated to DS `Badge`; see the avatar skill |
|
|
28
37
|
| _(grouping)_ | `<BadgeGroup>` + `<BadgeGroupCount>` | Wraps multiple badges; `BadgeGroupCount` renders the overflow "+N" chip |
|
|
29
38
|
|
|
@@ -49,7 +58,9 @@ Icons inside badges import from `@aircall/react-icons` — never from `lucide-re
|
|
|
49
58
|
DS Badge uses two orthogonal props instead of Tractor's single `variant`:
|
|
50
59
|
|
|
51
60
|
- `color`: `charcoal` (default) · `red` · `green` · `blue` · `purple` · `yellow` · `pink`
|
|
52
|
-
- `tone`: `dark` · `medium-dark` · `medium-light` · `light`
|
|
61
|
+
- `tone`: `dark` (default) · `medium-dark` · `medium-light` · `light`
|
|
62
|
+
|
|
63
|
+
`Badge` with no `color` / `tone` renders `charcoal` / `dark`: a solid dark chip (`bg-secondary`), not a light one. Always pass a `tone` when migrating a `Tag`.
|
|
53
64
|
|
|
54
65
|
| Tractor `variant` | DS `color` | DS `tone` |
|
|
55
66
|
| --- | --- | --- |
|
|
@@ -57,6 +68,7 @@ DS Badge uses two orthogonal props instead of Tractor's single `variant`:
|
|
|
57
68
|
| `secondary` | `charcoal` | `medium-light` |
|
|
58
69
|
| `lightSecondary` | `charcoal` | `light` |
|
|
59
70
|
| `darkSecondary` | `charcoal` | `medium-dark` |
|
|
71
|
+
| `darkGrey` | `charcoal` | `dark` |
|
|
60
72
|
| `primary` | `green` | `medium-light` |
|
|
61
73
|
| `lightPrimary` | `green` | `light` |
|
|
62
74
|
| `darkPrimary` | `green` | `dark` |
|
|
@@ -76,42 +88,52 @@ DS Badge uses two orthogonal props instead of Tractor's single `variant`:
|
|
|
76
88
|
|
|
77
89
|
### Hard-coded hex colors (`bg` prop)
|
|
78
90
|
|
|
79
|
-
When Tractor used a hard-coded hex (e.g. `bg="#0761B5"
|
|
91
|
+
When Tractor used a hard-coded hex (e.g. `bg="#0761B5"`, or a colour stored with the tag), pass it via `customColor`. It paints the hex as the fill and picks a black or white foreground by WCAG contrast, so any colour stays legible. A value that is not a hex is ignored. It is not theme-aware, so prefer `color` + `tone` whenever the colour comes from a fixed set.
|
|
80
92
|
|
|
81
93
|
```tsx
|
|
82
|
-
<Badge
|
|
94
|
+
<Badge customColor="#0761B5">Sales</Badge>
|
|
83
95
|
```
|
|
84
96
|
|
|
97
|
+
`legacyColor` is **deprecated**: it resolves only the 13 hexes of the old `TagColorPicker` palette to a `color` + `tone` and silently turns every other hex into `charcoal` / `dark` (it covers about 54% of production tag data). Existing call sites keep working; do not add new ones. `customColor` also works on `Chip`.
|
|
98
|
+
|
|
85
99
|
## 5. Size mapping
|
|
86
100
|
|
|
87
101
|
| Tractor `size` | DS `size` |
|
|
88
102
|
| --- | --- |
|
|
89
|
-
| `xSmall` | `default` (20px) |
|
|
90
|
-
| `small` | `default` (20px) |
|
|
91
|
-
| `regular` (default) | `default` (20px) |
|
|
92
|
-
| `large` | `lg` (24px) |
|
|
103
|
+
| `xSmall` (16px) | `default` (20px) |
|
|
104
|
+
| `small` (24px) | `default` (20px) |
|
|
105
|
+
| `regular` (default, 26px) | `default` (20px) |
|
|
106
|
+
| `large` (34px) | `lg` (24px) |
|
|
93
107
|
|
|
94
108
|
DS has no `mode` prop (`outline` / `fill`). Use a lighter `tone` (e.g. `light`) to approximate the old outline look.
|
|
95
109
|
|
|
96
110
|
## 6. CounterBadge
|
|
97
111
|
|
|
98
|
-
DS `CounterBadge`
|
|
112
|
+
Tractor's `CounterBadge` took `count`, `maxCount` (default 99, shows `99+`), `showEmptyBubble`, `offsetTop` / `offsetRight`, and wrapped its children: it overlaid the pill on them and rendered nothing but the children when `count` was 0. DS `CounterBadge` is a plain pill (`<span>`) with no `count`, `maxCount`, `showEmptyBubble` or offset props. Hide it at 0 and cap the displayed value yourself, then pass it as children:
|
|
99
113
|
|
|
100
114
|
```tsx
|
|
101
|
-
<CounterBadge>{count > 99 ? '99+' : count}</CounterBadge>
|
|
115
|
+
{count > 0 && <CounterBadge>{count > 99 ? '99+' : count}</CounterBadge>}
|
|
102
116
|
```
|
|
103
117
|
|
|
104
118
|
Available `variant` values: `default` (destructive background) · `secondary` · `ghost`.
|
|
105
119
|
|
|
120
|
+
| Tractor `variant` | DS |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| `red` (default) | `variant="default"` (destructive red) |
|
|
123
|
+
| `black` | `variant="secondary"` |
|
|
124
|
+
| `primary` | no variant — `className="bg-primary text-primary-foreground"` |
|
|
125
|
+
|
|
126
|
+
The pill is always 20px tall (`h-5 min-w-5`). Tractor `small` (16px) / `large` (24px) need a `className` override (`h-4 min-w-4`, `h-6 min-w-6`). To overlay it on another element (the old wrapping behaviour), position it yourself: `relative` on the wrapper and `className="absolute -top-1 -right-1"` on the badge. A `CounterBadge` in a `render` slot can be made a link or button.
|
|
127
|
+
|
|
106
128
|
## 7. Grouping badges
|
|
107
129
|
|
|
108
|
-
Use `BadgeGroup` to wrap a set of badges
|
|
130
|
+
Use `BadgeGroup` to wrap a set of badges in a wrapping row (`flex flex-wrap items-center gap-2`), and `BadgeGroupCount` for the trailing overflow chip. `BadgeGroupCount` is a 20px (or 24px with `size="lg"`) square ghost `CounterBadge`: give it the same `size` as the badges and children such as `+3`:
|
|
109
131
|
|
|
110
132
|
```tsx
|
|
111
133
|
<BadgeGroup>
|
|
112
134
|
<Badge color="blue" tone="medium-light">Support</Badge>
|
|
113
135
|
<Badge color="green" tone="medium-light">Active</Badge>
|
|
114
|
-
<BadgeGroupCount
|
|
136
|
+
<BadgeGroupCount>+{overflow}</BadgeGroupCount>
|
|
115
137
|
</BadgeGroup>
|
|
116
138
|
```
|
|
117
139
|
|
|
@@ -164,7 +186,7 @@ import { Tag } from '@aircall/tractor';
|
|
|
164
186
|
```tsx
|
|
165
187
|
import { Badge } from '@aircall/ds';
|
|
166
188
|
|
|
167
|
-
<Badge
|
|
189
|
+
<Badge customColor="#0761B5">Sales</Badge>
|
|
168
190
|
```
|
|
169
191
|
|
|
170
192
|
### 8d. CounterBadge with max cap
|
|
@@ -173,14 +195,14 @@ import { Badge } from '@aircall/ds';
|
|
|
173
195
|
```tsx
|
|
174
196
|
import { CounterBadge } from '@aircall/tractor';
|
|
175
197
|
|
|
176
|
-
<CounterBadge count={count}
|
|
198
|
+
<CounterBadge count={count} maxCount={99} />
|
|
177
199
|
```
|
|
178
200
|
|
|
179
201
|
**After (DS):**
|
|
180
202
|
```tsx
|
|
181
203
|
import { CounterBadge } from '@aircall/ds';
|
|
182
204
|
|
|
183
|
-
<CounterBadge>{count > 99 ? '99+' : count}</CounterBadge>
|
|
205
|
+
{count > 0 && <CounterBadge>{count > 99 ? '99+' : count}</CounterBadge>}
|
|
184
206
|
```
|
|
185
207
|
|
|
186
208
|
### 8e. Icon inside a Badge
|
|
@@ -203,19 +225,43 @@ import { CheckCircle } from '@aircall/react-icons';
|
|
|
203
225
|
|
|
204
226
|
> DS auto-sizes SVG children via `[&>svg]:size-3!` (default) or `[&>svg]:size-4!` (lg). Do not pass a `size` prop to the icon.
|
|
205
227
|
|
|
228
|
+
### 8f. Removable Tag → Chip
|
|
229
|
+
|
|
230
|
+
**Before (Tractor):**
|
|
231
|
+
```tsx
|
|
232
|
+
import { Tag, TagDeleteIcon } from '@aircall/tractor';
|
|
233
|
+
|
|
234
|
+
<Tag variant="blue">
|
|
235
|
+
Support
|
|
236
|
+
<TagDeleteIcon aria-label="Remove Support" onClick={onRemove} />
|
|
237
|
+
</Tag>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**After (DS):**
|
|
241
|
+
```tsx
|
|
242
|
+
import { Chip, ChipRemove } from '@aircall/ds';
|
|
243
|
+
|
|
244
|
+
<Chip color="blue">
|
|
245
|
+
Support
|
|
246
|
+
<ChipRemove aria-label="Remove Support" onClick={onRemove} />
|
|
247
|
+
</Chip>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
`Chip` defaults to `tone="medium-light"` and `overflowMode="truncate"`, is always `size="lg"` (24px) and cannot be rendered as another element (`render` is omitted from its props). For chips bound to a combobox selection, see the combobox skill.
|
|
251
|
+
|
|
206
252
|
## 9. Common mistakes
|
|
207
253
|
|
|
208
254
|
### Mistake 1: Using `variant` instead of `color` + `tone`
|
|
209
255
|
|
|
210
256
|
```tsx
|
|
211
|
-
// Wrong — DS Badge has no `variant` prop
|
|
257
|
+
// Wrong — DS Badge has no `variant` prop (type error)
|
|
212
258
|
<Badge variant="primary">Active</Badge>
|
|
213
259
|
|
|
214
260
|
// Correct — map to the two-axis color + tone model
|
|
215
261
|
<Badge color="green" tone="medium-light">Active</Badge>
|
|
216
262
|
```
|
|
217
263
|
|
|
218
|
-
**Mechanism:** DS Badge replaced Tractor's single `variant` string with two orthogonal props `color` and `tone`. Passing `variant` goes to the underlying `span` as an unknown HTML attribute and has no visual effect — the badge renders with the default charcoal/
|
|
264
|
+
**Mechanism:** DS Badge replaced Tractor's single `variant` string with two orthogonal props `color` and `tone`. Passing `variant` goes to the underlying `span` as an unknown HTML attribute and has no visual effect — the badge renders with the default charcoal/dark appearance instead of the intended color.
|
|
219
265
|
|
|
220
266
|
Source: `packages/ds/src/components/badge.tsx` — `badgeVariants` has `color` and `tone` keys, no `variant` key.
|
|
221
267
|
|
|
@@ -245,23 +291,23 @@ Source: `packages/ds/src/components/badge.tsx` — `Badge` is a label chip; `pac
|
|
|
245
291
|
### Mistake 3: Relying on DS `CounterBadge` to cap overflow automatically
|
|
246
292
|
|
|
247
293
|
```tsx
|
|
248
|
-
// Wrong — DS CounterBadge has no `
|
|
249
|
-
<CounterBadge
|
|
294
|
+
// Wrong — DS CounterBadge has no `maxCount` / `count` props; it renders its children
|
|
295
|
+
<CounterBadge maxCount={99} count={count} />
|
|
250
296
|
|
|
251
297
|
// Correct — cap the value yourself before passing as children
|
|
252
298
|
<CounterBadge>{count > 99 ? '99+' : count}</CounterBadge>
|
|
253
299
|
```
|
|
254
300
|
|
|
255
|
-
**Mechanism:** Tractor's `CounterBadge` accepted
|
|
301
|
+
**Mechanism:** Tractor's `CounterBadge` accepted `count` and `maxCount` and formatted "99+" internally. DS `CounterBadge` is a presentational span that renders whatever children it receives — the cap logic is the caller's responsibility. Passing `maxCount` and `count` as props results in an empty badge with two unknown HTML attributes instead of the formatted string.
|
|
256
302
|
|
|
257
|
-
Source: `packages/ds/src/components/counter-badge.tsx` — `CounterBadge.Props` extends `useRender.ComponentProps<'span'>` with only a `variant` prop; no `
|
|
303
|
+
Source: `packages/ds/src/components/counter-badge.tsx` — `CounterBadge.Props` extends `useRender.ComponentProps<'span'>` with only a `variant` prop; no `maxCount` or `count` keys.
|
|
258
304
|
|
|
259
305
|
---
|
|
260
306
|
|
|
261
307
|
### Mistake 4: Using `outline` / `fill` mode to style a badge
|
|
262
308
|
|
|
263
309
|
```tsx
|
|
264
|
-
// Wrong — DS Badge has no `mode` prop
|
|
310
|
+
// Wrong — DS Badge has no `mode` prop (type error)
|
|
265
311
|
<Badge color="blue" mode="outline">Beta</Badge>
|
|
266
312
|
|
|
267
313
|
// Correct — reach for a lighter tone to approximate the outline look
|
|
@@ -270,4 +316,4 @@ Source: `packages/ds/src/components/counter-badge.tsx` — `CounterBadge.Props`
|
|
|
270
316
|
|
|
271
317
|
**Mechanism:** Tractor's `Tag` supported a `mode` prop (`outline` / `fill`) that toggled between a bordered and a filled appearance. DS Badge has no `mode` prop — the visual weight is controlled entirely by `tone`. A lighter tone (`light` or `medium-light`) produces a softer background that approximates the old outline look.
|
|
272
318
|
|
|
273
|
-
Source: `packages/ds/src/components/badge.tsx` — `badgeVariants` has `size`, `color`, and `
|
|
319
|
+
Source: `packages/ds/src/components/badge.tsx` — `badgeVariants` has `size`, `color`, `tone` and `overflowMode` variants; no `mode` variant.
|