@aircall/ds 0.49.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-B3ahtFLP.js → data-table-AX0Mgu6K.js} +5 -0
- package/dist/{data-table-BgeS8KWP.d.ts → data-table-B5VqWPmw.d.ts} +3 -4
- package/dist/data-table.d.ts +1 -1
- package/dist/data-table.js +1 -1
- package/dist/globals.css +1 -1
- package/dist/index.d.ts +53 -16
- package/dist/index.js +113 -20
- 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,9 +2,9 @@
|
|
|
2
2
|
name: aircall-ds/migrate-tractor/sheet-vs-drawer
|
|
3
3
|
description: >
|
|
4
4
|
Migrate Tractor Drawer (desktop side panel) to @aircall/ds Sheet or Drawer.
|
|
5
|
-
Covers SheetContent side prop, DrawerPopup vs DrawerContent
|
|
6
|
-
|
|
7
|
-
from @aircall/tractor.
|
|
5
|
+
Covers SheetContent side prop, sizing the panel, DrawerPopup vs DrawerContent
|
|
6
|
+
confusion, DrawerPanel for scrolling bodies, and the render prop pattern for
|
|
7
|
+
Trigger/Close. Load when a file imports Drawer from @aircall/tractor.
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: aircall-ds
|
|
10
10
|
requires:
|
|
@@ -12,18 +12,22 @@ requires:
|
|
|
12
12
|
- aircall-ds/migrate-tractor
|
|
13
13
|
sources:
|
|
14
14
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/recipes/sheet-vs-drawer.md"
|
|
15
|
+
- "aircall/hydra:packages/ds/src/components/sheet.tsx"
|
|
16
|
+
- "aircall/hydra:packages/ds/src/components/drawer.tsx"
|
|
17
|
+
- "aircall/hydra:packages/ds/src/stories/Sheet.stories.tsx"
|
|
18
|
+
- "aircall/hydra:packages/ds/src/stories/Drawer.stories.tsx"
|
|
15
19
|
---
|
|
16
20
|
|
|
17
21
|
This skill builds on aircall-ds/migrate-tractor. Apply all cross-cutting rules from that skill (prop renames, `render` prop, data attributes) before the sheet-vs-drawer-specific steps below.
|
|
18
22
|
|
|
19
23
|
## 1. Which component to use
|
|
20
24
|
|
|
21
|
-
DS ships two distinct side-panel components. The Tractor `Drawer` maps to **`Sheet`** for desktop side panels — not to DS's `Drawer`. DS's own `Drawer` is
|
|
25
|
+
DS ships two distinct side-panel components. The Tractor `Drawer` maps to **`Sheet`** for desktop side panels — not to DS's `Drawer`. DS's own `Drawer` is for panels with swipe-to-dismiss edge gestures (typically mobile), and adds a scrollable `DrawerPanel`, nested stacking and snap points.
|
|
22
26
|
|
|
23
27
|
| Use case | DS component | Built on |
|
|
24
28
|
| --- | --- | --- |
|
|
25
29
|
| Persistent side panel (navigation, filters, settings) | `Sheet` | Base UI Dialog |
|
|
26
|
-
|
|
|
30
|
+
| Swipe-to-dismiss edge panel | `Drawer` | Base UI Drawer |
|
|
27
31
|
|
|
28
32
|
When in doubt, use `Sheet`.
|
|
29
33
|
|
|
@@ -31,12 +35,12 @@ When in doubt, use `Sheet`.
|
|
|
31
35
|
|
|
32
36
|
| Tractor | @aircall/ds |
|
|
33
37
|
| --- | --- |
|
|
34
|
-
| `Drawer` (root +
|
|
35
|
-
| `DrawerHeader` | `SheetHeader` |
|
|
38
|
+
| `Drawer` (root + panel; `show`, `onHide`, `side`, `w`, `h`) | `Sheet` (root) + `SheetContent` (panel; carries `side`) |
|
|
39
|
+
| `DrawerHeader` (with its `closeButton`) | `SheetHeader`; the "×" is `SheetContent`'s `showCloseButton` |
|
|
36
40
|
| `DrawerTitle` | `SheetTitle` |
|
|
37
|
-
| `DrawerBody` / body content | plain children inside `SheetContent` |
|
|
41
|
+
| `DrawerBody` / body content | plain children inside `SheetContent` (give them padding, see section 4) |
|
|
38
42
|
| `DrawerFooter` | `SheetFooter` |
|
|
39
|
-
|
|
|
43
|
+
| `DrawerClose` (the "×" button) | built into `SheetContent`; `SheetClose` for your own button |
|
|
40
44
|
| — | `SheetTrigger` (uncontrolled open trigger) |
|
|
41
45
|
| — | `SheetClose` (any element that closes the sheet) |
|
|
42
46
|
| — | `SheetDescription` (optional accessible subtitle) |
|
|
@@ -45,11 +49,12 @@ When in doubt, use `Sheet`.
|
|
|
45
49
|
|
|
46
50
|
| DS Drawer part | Role |
|
|
47
51
|
| --- | --- |
|
|
48
|
-
| `Drawer` | Root state owner; accepts `position` and `open`/`onOpenChange` |
|
|
49
|
-
| `DrawerPopup` | The panel surface — **use this, not `DrawerContent
|
|
52
|
+
| `Drawer` | Root state owner; accepts `position` (`'right' \| 'left' \| 'top' \| 'bottom'`, default `'bottom'`) and `open`/`onOpenChange` |
|
|
53
|
+
| `DrawerPopup` | The panel surface (backdrop + viewport + popup) — **use this, not `DrawerContent`**. Props: `position`, `variant` (`'default' \| 'straight' \| 'inset'`), `showCloseButton` (default `false`), `showBar` (grab bar, default `false`) |
|
|
50
54
|
| `DrawerHeader` | Header section inside `DrawerPopup` |
|
|
51
|
-
| `DrawerTitle` | Accessible title inside `DrawerHeader` |
|
|
52
|
-
| `
|
|
55
|
+
| `DrawerTitle` / `DrawerDescription` | Accessible title / subtitle inside `DrawerHeader` |
|
|
56
|
+
| `DrawerPanel` | Scrollable body between header and footer (`ScrollArea` with a scroll fade) |
|
|
57
|
+
| `DrawerFooter` | Footer section inside `DrawerPopup` (`variant` `'default' \| 'bare'`) |
|
|
53
58
|
| `DrawerClose` | Any element that closes the drawer |
|
|
54
59
|
| `DrawerTrigger` | Uncontrolled open trigger |
|
|
55
60
|
|
|
@@ -60,7 +65,7 @@ When in doubt, use `Sheet`.
|
|
|
60
65
|
```tsx
|
|
61
66
|
import { Drawer, DrawerHeader, DrawerTitle, DrawerBody, DrawerFooter, Button } from '@aircall/tractor';
|
|
62
67
|
|
|
63
|
-
<Drawer
|
|
68
|
+
<Drawer show={isOpen} onHide={() => setIsOpen(false)} side="right">
|
|
64
69
|
<DrawerHeader>
|
|
65
70
|
<DrawerTitle>Filters</DrawerTitle>
|
|
66
71
|
</DrawerHeader>
|
|
@@ -68,7 +73,7 @@ import { Drawer, DrawerHeader, DrawerTitle, DrawerBody, DrawerFooter, Button } f
|
|
|
68
73
|
<p>Refine the call list.</p>
|
|
69
74
|
</DrawerBody>
|
|
70
75
|
<DrawerFooter>
|
|
71
|
-
<Button variant="outline" onClick={() => setIsOpen(false)}>Cancel</Button>
|
|
76
|
+
<Button variant="secondary" mode="outline" onClick={() => setIsOpen(false)}>Cancel</Button>
|
|
72
77
|
<Button onClick={onApply}>Apply</Button>
|
|
73
78
|
</DrawerFooter>
|
|
74
79
|
</Drawer>
|
|
@@ -95,7 +100,7 @@ import {
|
|
|
95
100
|
<SheetDescription>Refine the call list.</SheetDescription>
|
|
96
101
|
</SheetHeader>
|
|
97
102
|
|
|
98
|
-
<
|
|
103
|
+
<div className="px-4 text-sm">{/* body */}</div>
|
|
99
104
|
|
|
100
105
|
<SheetFooter>
|
|
101
106
|
<SheetClose render={<Button variant="outline" size="lg" />}>
|
|
@@ -108,11 +113,24 @@ import {
|
|
|
108
113
|
```
|
|
109
114
|
|
|
110
115
|
Key changes:
|
|
111
|
-
- `
|
|
112
|
-
- Tractor `
|
|
113
|
-
- `DrawerBody` is removed — body content is plain children inside `SheetContent`
|
|
116
|
+
- `show` → `open`; `onHide()` → `onOpenChange(boolean)`
|
|
117
|
+
- Tractor `side="right"` stays `side="right"`, but it now sits on the panel part (`SheetContent`), not the root. `SheetContent` also accepts `top` (Tractor had `left` | `right` | `bottom`)
|
|
118
|
+
- `DrawerBody` is removed — body content is plain children inside `SheetContent`. `SheetContent` is a `flex flex-col gap-4` panel with **no padding of its own**: `SheetHeader` and `SheetFooter` carry `p-4`, so a body needs its own `px-4` (the stories use `px-4 py-4`)
|
|
114
119
|
- `SheetClose` wraps any button that closes the sheet; pass the DS `Button` via `render` and put the label as children of `SheetClose`
|
|
115
120
|
- `SheetContent` renders a default "×" close button; hide it with `showCloseButton={false}` when you want to force explicit footer actions
|
|
121
|
+
- `SheetFooter` is a vertical stack (`flex-col gap-2`, `mt-auto`), not a right-aligned row like Tractor's `DrawerFooter`
|
|
122
|
+
|
|
123
|
+
### Width and scrolling
|
|
124
|
+
|
|
125
|
+
Tractor `Drawer` was `w="480px"`, `h="100%"` by default. `SheetContent` on `left` / `right` is `w-3/4` capped at `sm:max-w-sm` (384px); on `top` / `bottom` it is `h-auto`. To restore 480px, override the **data-side qualified** class (a plain `sm:max-w-*` has lower specificity than the built-in `data-[side=right]:sm:max-w-sm` and is overridden by it):
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<SheetContent side="right" className="data-[side=right]:sm:max-w-[480px]">…</SheetContent>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`Sheet` has no scroll area. For a long body, make the body the scroll region: `<div className="flex-1 overflow-y-auto px-4">…</div>` between header and footer (or use `DrawerPanel` from `Drawer`, which includes a `ScrollArea`).
|
|
132
|
+
|
|
133
|
+
Other Tractor `Drawer` props: `rootClose={false}` → `disablePointerDismissal` on `Sheet`; `portalContainer` → `container` on `SheetContent`; `w` / `h` / padding props → `className`; `placement` has no equivalent; `onAnimationComplete` → `onOpenChangeComplete` on `Sheet`; `data-test` → `data-test` on `SheetContent`.
|
|
116
134
|
|
|
117
135
|
### Uncontrolled with a trigger
|
|
118
136
|
|
|
@@ -141,11 +159,12 @@ import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetFooter
|
|
|
141
159
|
import {
|
|
142
160
|
Drawer,
|
|
143
161
|
DrawerClose,
|
|
162
|
+
DrawerDescription,
|
|
144
163
|
DrawerFooter,
|
|
145
164
|
DrawerHeader,
|
|
165
|
+
DrawerPanel,
|
|
146
166
|
DrawerPopup,
|
|
147
167
|
DrawerTitle,
|
|
148
|
-
DrawerTrigger,
|
|
149
168
|
Button
|
|
150
169
|
} from '@aircall/ds';
|
|
151
170
|
|
|
@@ -153,10 +172,11 @@ import {
|
|
|
153
172
|
<DrawerPopup>
|
|
154
173
|
<DrawerHeader>
|
|
155
174
|
<DrawerTitle>Action sheet</DrawerTitle>
|
|
175
|
+
<DrawerDescription>Swipe to dismiss.</DrawerDescription>
|
|
156
176
|
</DrawerHeader>
|
|
157
|
-
<
|
|
158
|
-
<p className="text-sm">
|
|
159
|
-
</
|
|
177
|
+
<DrawerPanel>
|
|
178
|
+
<p className="text-sm">Body content scrolls inside the panel.</p>
|
|
179
|
+
</DrawerPanel>
|
|
160
180
|
<DrawerFooter>
|
|
161
181
|
<DrawerClose render={<Button size="lg" />}>Done</DrawerClose>
|
|
162
182
|
</DrawerFooter>
|
|
@@ -168,17 +188,20 @@ import {
|
|
|
168
188
|
|
|
169
189
|
## 6. Common mistakes
|
|
170
190
|
|
|
171
|
-
### Mistake 1 — Using `position` on `SheetContent`
|
|
191
|
+
### Mistake 1 — Using `position` on `SheetContent` (or `side` on the DS `Drawer`)
|
|
172
192
|
|
|
173
193
|
```tsx
|
|
174
|
-
// ❌ Wrong — position
|
|
175
|
-
<SheetContent position="
|
|
194
|
+
// ❌ Wrong — position belongs to the DS Drawer; SheetContent has no position prop
|
|
195
|
+
<SheetContent position="left">…</SheetContent>
|
|
176
196
|
|
|
177
197
|
// ✅ Correct — the edge is controlled by side on SheetContent
|
|
178
|
-
<SheetContent side="
|
|
198
|
+
<SheetContent side="left">…</SheetContent>
|
|
199
|
+
|
|
200
|
+
// ✅ Correct for the DS Drawer — position goes on the root
|
|
201
|
+
<Drawer position="left">…</Drawer>
|
|
179
202
|
```
|
|
180
203
|
|
|
181
|
-
`SheetContent` accepts `side?: 'top' | 'right' | 'bottom' | 'left'
|
|
204
|
+
`SheetContent` accepts `side?: 'top' | 'right' | 'bottom' | 'left'`; the DS `Drawer` takes `position` with the same values. Tractor's `Drawer` called it `side`, so it keeps its name when moving to `Sheet` but moves from the root to `SheetContent`. A wrong prop name is a type error; if it slips through, the sheet defaults to `side="right"`, so the bug is invisible until a non-right edge is needed.
|
|
182
205
|
|
|
183
206
|
Source: `packages/ds/src/components/sheet.tsx`
|
|
184
207
|
|
|
@@ -226,7 +249,7 @@ Source: `packages/ds/src/components/drawer.tsx`
|
|
|
226
249
|
</SheetClose>
|
|
227
250
|
```
|
|
228
251
|
|
|
229
|
-
DS is built on Base UI, which uses a `render` prop instead of Radix's `asChild`. `asChild` is
|
|
252
|
+
DS is built on Base UI, which uses a `render` prop instead of Radix's `asChild`. `asChild` is a type error; if it slips through, `SheetClose` still renders its own default `<button>` and the nested Button is rendered inside it (a button in a button) instead of replacing it.
|
|
230
253
|
|
|
231
254
|
Source: `packages/ds/src/components/sheet.tsx`
|
|
232
255
|
|
|
@@ -250,7 +273,7 @@ import { Sheet, SheetContent } from '@aircall/ds';
|
|
|
250
273
|
</Sheet>
|
|
251
274
|
```
|
|
252
275
|
|
|
253
|
-
The naming is intentionally different: Tractor's `Drawer` was a general side panel. DS splits the concept in two — `Sheet` for persistent desktop panels and `Drawer` for
|
|
276
|
+
The naming is intentionally different: Tractor's `Drawer` was a general side panel. DS splits the concept in two — `Sheet` for persistent desktop panels and `Drawer` for swipe gestures. Using DS `Drawer` for desktop panels adds drag/swipe infrastructure and a different footer and body model (`DrawerPanel`, `DrawerFooter`), and may produce unexpected dismiss behavior on touch devices.
|
|
254
277
|
|
|
255
278
|
Source: `packages/ds/src/components/sheet.tsx`
|
|
256
279
|
|
|
@@ -259,13 +282,13 @@ Source: `packages/ds/src/components/sheet.tsx`
|
|
|
259
282
|
### Mistake 5 — Using `onClose` instead of `onOpenChange`
|
|
260
283
|
|
|
261
284
|
```tsx
|
|
262
|
-
// ❌ Wrong — onClose
|
|
285
|
+
// ❌ Wrong — onClose / onHide / show are Tractor props; they are type errors on Sheet
|
|
263
286
|
<Sheet open={isOpen} onClose={() => setIsOpen(false)}>…</Sheet>
|
|
264
287
|
|
|
265
288
|
// ✅ Correct — onOpenChange receives the new boolean state
|
|
266
289
|
<Sheet open={isOpen} onOpenChange={setIsOpen}>…</Sheet>
|
|
267
290
|
```
|
|
268
291
|
|
|
269
|
-
`onOpenChange` fires with `false` when the sheet closes (backdrop click, Escape, or `SheetClose`).
|
|
292
|
+
`onOpenChange` fires with `false` when the sheet closes (backdrop click, Escape, or `SheetClose`). A controlled sheet that only passes `open` can never be closed by the user.
|
|
270
293
|
|
|
271
294
|
Source: `packages/ds/src/components/sheet.tsx`
|
|
@@ -11,13 +11,16 @@ requires:
|
|
|
11
11
|
- aircall-ds/migrate-tractor
|
|
12
12
|
sources:
|
|
13
13
|
- "aircall/hydra:packages/ds/src/components/skeleton.tsx"
|
|
14
|
+
- "aircall/hydra:packages/ds/src/stories/Skeleton.stories.tsx"
|
|
15
|
+
- "aircall/hydra:packages/ds/src/components/spinner.tsx"
|
|
16
|
+
- "aircall/hydra:packages/blocks/src/components/kpi.tsx"
|
|
14
17
|
---
|
|
15
18
|
|
|
16
19
|
This skill builds on aircall-ds/migrate-tractor.
|
|
17
20
|
|
|
18
21
|
## 1. Component mapping
|
|
19
22
|
|
|
20
|
-
Tractor `Skeleton` was a styled `Box` wrapper with `shape`, `animation`, `mode`, and `animationDelay` props. DS `Skeleton` is a plain `div`
|
|
23
|
+
Tractor `Skeleton` was a styled `Box` wrapper with `shape`, `animation`, `mode`, and `animationDelay` props. DS `Skeleton` is a plain `div` (`animate-pulse rounded-md bg-muted`) — sizing and shape are controlled entirely through `className`. It has no props of its own beyond the standard `<div>` props and a `ref`.
|
|
21
24
|
|
|
22
25
|
| Tractor part | DS replacement | Notes |
|
|
23
26
|
| --- | --- | --- |
|
|
@@ -25,12 +28,22 @@ Tractor `Skeleton` was a styled `Box` wrapper with `shape`, `animation`, `mode`,
|
|
|
25
28
|
| `shape="squareRounded"` | _(default)_ | DS always renders with `rounded-md`; no prop needed |
|
|
26
29
|
| `shape="circle"` | `className="rounded-full"` | Override the default `rounded-md` with `rounded-full` |
|
|
27
30
|
| `shape="square"` | `className="rounded-none"` | Override with `rounded-none` |
|
|
28
|
-
| `shape="squircle"` | `className="rounded-xl"` | Closest equivalent; pick visually |
|
|
29
|
-
| `animation="shimmer"` | _(
|
|
30
|
-
| `animation="wave"` | _(
|
|
31
|
-
| `animationDelay` | `className="[animation-delay:200ms]"` |
|
|
31
|
+
| `shape="squircle"` | `className="rounded-xl"` | Closest equivalent (Tractor clipped to an SVG squircle path); pick visually |
|
|
32
|
+
| `animation="shimmer"` (Tractor: opacity pulses 0.5 → 1 → 0.5) | _(default)_ | DS `animate-pulse` is the same kind of opacity pulse |
|
|
33
|
+
| `animation="wave"` (Tractor default: a gradient sweeps across) | _(not available)_ | DS has no sweep; it pulses instead. Visible difference, accept it |
|
|
34
|
+
| `animationDelay` | `className="[animation-delay:200ms]"` | Tractor used `0.2s`; use an arbitrary Tailwind value |
|
|
32
35
|
| `mode="dark"` | `className="bg-muted/60"` | DS uses `bg-muted`; adjust opacity for dark contexts |
|
|
33
|
-
| BoxProps (`w`, `h`, `width`, `height
|
|
36
|
+
| BoxProps (`w`, `h`, `width`, `height`, margins) | `className="w-… h-…"` | Pass Tailwind sizing utilities via `className` |
|
|
37
|
+
|
|
38
|
+
**Related loading placeholders already in the libraries:** do not hand-build a skeleton for these.
|
|
39
|
+
|
|
40
|
+
| Where | Use |
|
|
41
|
+
| --- | --- |
|
|
42
|
+
| A table loading its first page | `DataTable loadingState="loading"` (and `skeletonCount`) from `@aircall/ds`: it renders the skeleton rows itself |
|
|
43
|
+
| A KPI card value / comparison line | `KpiValueSkeleton` / `KpiDescriptionSkeleton` from `@aircall/blocks` |
|
|
44
|
+
| A sidebar menu row | `SidebarMenuSkeleton` from `@aircall/ds` |
|
|
45
|
+
| `SkeletonText` / `SkeletonTags` / `SkeletonNote` (`@dashboard/library`) | `Skeleton` lines (see 4e) |
|
|
46
|
+
| A blocking action or a button waiting on a request | `Spinner` (see `aircall-blocks/migrate-dashboard/loading`), not `Skeleton` |
|
|
34
47
|
|
|
35
48
|
## 2. Verified DS export (`packages/ds/src/index.ts`)
|
|
36
49
|
|
|
@@ -122,6 +135,22 @@ import { Skeleton } from '@aircall/ds';
|
|
|
122
135
|
<Skeleton className="size-16 rounded-none" />
|
|
123
136
|
```
|
|
124
137
|
|
|
138
|
+
### 4e. `SkeletonText` (`@dashboard/library`)
|
|
139
|
+
|
|
140
|
+
`SkeletonText` rendered `quantity` (default 3) 14px lines with a vertical gap of 4px, the last one at a random 15-75% width. Compose it from `Skeleton` lines:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { Skeleton } from '@aircall/ds';
|
|
144
|
+
|
|
145
|
+
<div className="flex w-full flex-col gap-1" data-test="skeleton-text">
|
|
146
|
+
<Skeleton className="h-3.5 w-full" />
|
|
147
|
+
<Skeleton className="h-3.5 w-full" />
|
|
148
|
+
<Skeleton className="h-3.5 w-1/2" />
|
|
149
|
+
</div>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
A fixed last-line width (`w-1/2`) avoids a different layout on every render. `SkeletonTags` is a wrapping row of `Skeleton className="h-[18px] w-20"` with `gap-2`; `SkeletonNote` is a header row (a `size-6` skeleton, an `h-3.5 w-20` one and an `h-3.5 w-[100px]` one, `justify-between`) above a `SkeletonText` of two lines.
|
|
153
|
+
|
|
125
154
|
## 5. Common Mistakes
|
|
126
155
|
|
|
127
156
|
### Mistake 1 — Passing `shape` as a prop to the DS Skeleton
|
|
@@ -140,7 +169,7 @@ import { Skeleton } from '@aircall/ds';
|
|
|
140
169
|
<Skeleton className="size-10 rounded-full" />
|
|
141
170
|
```
|
|
142
171
|
|
|
143
|
-
DS `Skeleton` extends `React.ComponentProps<'div'>` — it has no `shape` prop.
|
|
172
|
+
DS `Skeleton` extends `React.ComponentProps<'div'>` — it has no `shape` prop. `shape` is a type error; if it slips through, React forwards it to the DOM as an unknown attribute and the element renders as the default `rounded-md` rectangle, not a circle.
|
|
144
173
|
|
|
145
174
|
Source: `packages/ds/src/components/skeleton.tsx`
|
|
146
175
|
|
|
@@ -162,19 +191,19 @@ import { Skeleton } from '@aircall/ds';
|
|
|
162
191
|
<Skeleton className="w-[200px] h-4" />
|
|
163
192
|
```
|
|
164
193
|
|
|
165
|
-
Tractor `Skeleton` extended `BoxProps` from `@xstyled/styled-components`, so `w` and `h` were valid styled-system props. DS `Skeleton` is a plain `div` — `w` and `h` are
|
|
194
|
+
Tractor `Skeleton` extended `BoxProps` from `@xstyled/styled-components`, so `w` and `h` were valid styled-system props. DS `Skeleton` is a plain `div` — `w` and `h` are type errors; if they slip through they are forwarded as unknown HTML attributes and have no effect on sizing, so the skeleton collapses to zero height.
|
|
166
195
|
|
|
167
196
|
Source: `packages/ds/src/components/skeleton.tsx`
|
|
168
197
|
|
|
169
198
|
---
|
|
170
199
|
|
|
171
|
-
### Mistake 3 —
|
|
200
|
+
### Mistake 3 — Passing `animation` (or expecting a wave sweep)
|
|
172
201
|
|
|
173
202
|
**Wrong:**
|
|
174
203
|
```tsx
|
|
175
204
|
import { Skeleton } from '@aircall/ds';
|
|
176
205
|
|
|
177
|
-
<Skeleton animation="
|
|
206
|
+
<Skeleton animation="wave" className="w-32 h-4" />
|
|
178
207
|
```
|
|
179
208
|
|
|
180
209
|
**Correct:**
|
|
@@ -184,6 +213,6 @@ import { Skeleton } from '@aircall/ds';
|
|
|
184
213
|
<Skeleton className="w-32 h-4" />
|
|
185
214
|
```
|
|
186
215
|
|
|
187
|
-
DS `Skeleton` has exactly one animation: `animate-pulse` (a CSS opacity pulse)
|
|
216
|
+
DS `Skeleton` has exactly one animation: `animate-pulse` (a CSS opacity pulse), which is Tractor's `shimmer`. There is no `wave` sweep (Tractor's default) and no `animation` prop on the DS component — it is a type error, and if it slips through it is forwarded to the DOM as an unknown attribute. Use the single DS animation as-is, or override with an arbitrary Tailwind animation utility if a sweep is required for a specific design.
|
|
188
217
|
|
|
189
218
|
Source: `packages/ds/src/components/skeleton.tsx`
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: aircall-ds/migrate-tractor/styling
|
|
3
3
|
description: >
|
|
4
|
-
|
|
4
|
+
Tractor layout and style primitives to @aircall/ds Tailwind classes and
|
|
5
5
|
tokens. Load when a file uses Typography, Flex, Box, Grid, Spacer, or the getColor
|
|
6
|
-
/ getSpace / getRadii /
|
|
7
|
-
highest-volume Tractor usages (these are not
|
|
8
|
-
utility classes).
|
|
6
|
+
/ getSpace / getRadii / getShadow / fromTheme / defaultTheme helpers from
|
|
7
|
+
@aircall/tractor. Covers the highest-volume Tractor usages (these are not
|
|
8
|
+
components with recipes — they map to utility classes).
|
|
9
9
|
type: sub-skill
|
|
10
10
|
library: aircall-ds
|
|
11
11
|
requires:
|
|
@@ -15,6 +15,10 @@ sources:
|
|
|
15
15
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/02-design-tokens.md"
|
|
16
16
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/03-spacing.md"
|
|
17
17
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/07-typography.md"
|
|
18
|
+
- "aircall/hydra:packages/ds/src/styles/theme.css"
|
|
19
|
+
- "aircall/hydra:packages/tractor/src/styles/radii.ts"
|
|
20
|
+
- "aircall/hydra:packages/tractor/src/styles/space.ts"
|
|
21
|
+
- "aircall/hydra:packages/tractor/src/styles/typography.ts"
|
|
18
22
|
---
|
|
19
23
|
|
|
20
24
|
This skill builds on aircall-ds/migrate-tractor.
|
|
@@ -258,9 +262,9 @@ Responsive objects become breakpoint prefixes: `m={{ _: 2, md: 4 }}` → `m-2 md
|
|
|
258
262
|
|
|
259
263
|
## 4. Design tokens — colors, radius, helpers
|
|
260
264
|
|
|
261
|
-
### Replacing `getColor` / `getSpace` / `getRadii` / `getShadow` / `
|
|
265
|
+
### Replacing `getColor` / `getSpace` / `getRadii` / `getShadow` / `fromTheme` / `defaultTheme.*`
|
|
262
266
|
|
|
263
|
-
These runtime helpers do not exist in DS. They lived inside `styled()` blocks, which are removed entirely. Map each consumed value to its Tailwind equivalent — including `getShadow(...)` → a `shadow-*` class and `
|
|
267
|
+
These runtime helpers do not exist in DS. They lived inside `styled()` blocks, which are removed entirely. Map each consumed value to its Tailwind equivalent — including `getShadow(...)` → a `shadow-*` class and `fromTheme('typography.…')` → a `text-*` size class (see Typography §1):
|
|
264
268
|
|
|
265
269
|
```tsx
|
|
266
270
|
// Before
|
|
@@ -300,7 +304,7 @@ style={{ color: 'var(--primary)' }}
|
|
|
300
304
|
| --- | --- |
|
|
301
305
|
| `surface-background` | `bg-page-background` |
|
|
302
306
|
| `surface-default` | `bg-background` |
|
|
303
|
-
| `surface-overlay` | `bg-overlay` |
|
|
307
|
+
| `surface-overlay` | `bg-overlay` (⚠ no `--overlay` token ships in `@aircall/ds` today — `bg-overlay` emits nothing; verify with design, or use `bg-background` / `bg-popover`) |
|
|
304
308
|
| `surface-info` | `bg-info-background` |
|
|
305
309
|
| `surface-success` | `bg-success-background` |
|
|
306
310
|
| `surface-warning` | `bg-warning-background` |
|
|
@@ -12,21 +12,31 @@ requires:
|
|
|
12
12
|
- aircall-ds/migrate-tractor
|
|
13
13
|
sources:
|
|
14
14
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/recipes/tabs.md"
|
|
15
|
+
- "aircall/hydra:packages/ds/src/components/tabs.tsx"
|
|
16
|
+
- "aircall/hydra:packages/ds/src/components/toggle-group.tsx"
|
|
17
|
+
- "aircall/hydra:packages/ds/src/stories/Tabs.stories.tsx"
|
|
15
18
|
---
|
|
16
19
|
|
|
17
20
|
This skill builds on aircall-ds/migrate-tractor. Apply all cross-cutting rules from that skill (prop renames, `render` prop, data attributes) before the tabs-specific steps below.
|
|
18
21
|
|
|
19
22
|
## 1. Component mapping
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
Tractor ships the pieces as separate named exports (`TabContainer`, `TabMenu`, `TabMenuItem`,
|
|
25
|
+
`TabContent`, `TabItem`); the `@dashboard/library` package re-exports them under a `Tab` compound
|
|
26
|
+
(`Tab.Container`, `Tab.Menu`, `Tab.MenuItem`, `Tab.Item`). Both map to the DS `Tabs` compound.
|
|
27
|
+
|
|
28
|
+
| Tractor / @dashboard/library | @aircall/ds |
|
|
22
29
|
| --- | --- |
|
|
23
|
-
| `
|
|
24
|
-
| `Tab.
|
|
25
|
-
| `
|
|
26
|
-
| `Tab` (
|
|
30
|
+
| `TabContainer` / `Tab.Container` (state owner) | `Tabs` |
|
|
31
|
+
| `TabMenu` / `Tab.Menu` | `TabsList` |
|
|
32
|
+
| `TabMenuItem` / `Tab.MenuItem` (individual tab trigger) | `TabsTrigger` |
|
|
33
|
+
| `TabContent` / `Tab.Content` | `TabsContent` (a panel per `value`) |
|
|
34
|
+
| `TabItem` / `Tab.Item` (the panel body for one tab) | `TabsContent` (matched by `value`, not by id) |
|
|
27
35
|
| `TabToggle` (segmented control) | `ToggleGroup` — **not** Tabs (separate migration) |
|
|
28
36
|
|
|
29
|
-
Active state in Tractor was tracked by
|
|
37
|
+
Active state in Tractor was tracked by an `IDType` id (`defaultActiveTabId` / `activeTabId` /
|
|
38
|
+
`onChange(id)`). DS tracks it with a string `value` that links each `TabsTrigger` to its matching
|
|
39
|
+
`TabsContent`.
|
|
30
40
|
|
|
31
41
|
## 2. Verified DS exports (`packages/ds/src/index.ts`)
|
|
32
42
|
|
|
@@ -53,16 +63,18 @@ import { ToggleGroup, ToggleGroupItem } from '@aircall/ds';
|
|
|
53
63
|
|
|
54
64
|
**Before (Tractor):**
|
|
55
65
|
```tsx
|
|
56
|
-
import {
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
</
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
import { TabContainer, TabContent, TabItem, TabMenu, TabMenuItem } from '@aircall/tractor';
|
|
67
|
+
|
|
68
|
+
<TabContainer defaultActiveTabId="overview">
|
|
69
|
+
<TabMenu>
|
|
70
|
+
<TabMenuItem id="overview">Overview</TabMenuItem>
|
|
71
|
+
<TabMenuItem id="activity">Activity</TabMenuItem>
|
|
72
|
+
</TabMenu>
|
|
73
|
+
<TabContent>
|
|
74
|
+
<TabItem id="overview">Overview panel.</TabItem>
|
|
75
|
+
<TabItem id="activity">Activity panel.</TabItem>
|
|
76
|
+
</TabContent>
|
|
77
|
+
</TabContainer>
|
|
66
78
|
```
|
|
67
79
|
|
|
68
80
|
**After (DS):**
|
|
@@ -80,25 +92,27 @@ import { Tabs, TabsList, TabsTrigger, TabsContent } from '@aircall/ds';
|
|
|
80
92
|
```
|
|
81
93
|
|
|
82
94
|
Key changes:
|
|
83
|
-
- `
|
|
84
|
-
- `
|
|
85
|
-
- `
|
|
86
|
-
- There is no `size` prop and no `TabsList` `variant` — drop
|
|
95
|
+
- `defaultActiveTabId="overview"` → `defaultValue="overview"` (a string; Tractor's id could be a number too)
|
|
96
|
+
- `TabMenu` → `TabsList`; `TabMenuItem` → `TabsTrigger` with a `value` prop
|
|
97
|
+
- Tractor's `TabContent` + `TabItem` collapse into one `TabsContent` per value
|
|
98
|
+
- There is no `size` prop and no `TabsList` `variant` — drop Tractor's `TabMenu` `variant` (`auto` | `evenly-sized`) and `space` props
|
|
87
99
|
|
|
88
100
|
### 4b. Controlled tabs
|
|
89
101
|
|
|
90
102
|
**Before (Tractor):**
|
|
91
103
|
```tsx
|
|
92
|
-
import {
|
|
93
|
-
|
|
94
|
-
<
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
</
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
import { TabContainer, TabContent, TabItem, TabMenu, TabMenuItem } from '@aircall/tractor';
|
|
105
|
+
|
|
106
|
+
<TabContainer activeTabId={activeTab} onChange={setActiveTab}>
|
|
107
|
+
<TabMenu>
|
|
108
|
+
<TabMenuItem id="overview">Overview</TabMenuItem>
|
|
109
|
+
<TabMenuItem id="activity">Activity</TabMenuItem>
|
|
110
|
+
</TabMenu>
|
|
111
|
+
<TabContent>
|
|
112
|
+
<TabItem id="overview">Overview panel.</TabItem>
|
|
113
|
+
<TabItem id="activity">Activity panel.</TabItem>
|
|
114
|
+
</TabContent>
|
|
115
|
+
</TabContainer>
|
|
102
116
|
```
|
|
103
117
|
|
|
104
118
|
**After (DS):**
|
|
@@ -116,25 +130,13 @@ import { Tabs, TabsList, TabsTrigger, TabsContent } from '@aircall/ds';
|
|
|
116
130
|
```
|
|
117
131
|
|
|
118
132
|
Key changes:
|
|
119
|
-
- `
|
|
120
|
-
-
|
|
121
|
-
- State must be converted from a numeric index to a string key
|
|
133
|
+
- `activeTabId` → `value`, `onChange` → `onValueChange`
|
|
134
|
+
- State must be converted to a string key if it was numeric
|
|
122
135
|
|
|
123
136
|
### 4c. Vertical orientation
|
|
124
137
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
import { Tab, TabList, TabPanel } from '@aircall/tractor';
|
|
128
|
-
|
|
129
|
-
<Tab orientation="vertical" defaultIndex={0}>
|
|
130
|
-
<TabList>
|
|
131
|
-
<Tab.Item>Settings</Tab.Item>
|
|
132
|
-
<Tab.Item>Billing</Tab.Item>
|
|
133
|
-
</TabList>
|
|
134
|
-
<TabPanel>Settings panel.</TabPanel>
|
|
135
|
-
<TabPanel>Billing panel.</TabPanel>
|
|
136
|
-
</Tab>
|
|
137
|
-
```
|
|
138
|
+
Tractor's `Tab` family had no orientation prop. DS adds `orientation="vertical"` — the arrow keys
|
|
139
|
+
switch to ArrowUp / ArrowDown and the active indicator moves to the inline edge.
|
|
138
140
|
|
|
139
141
|
**After (DS):**
|
|
140
142
|
```tsx
|
|
@@ -150,23 +152,23 @@ import { Tabs, TabsList, TabsTrigger, TabsContent } from '@aircall/ds';
|
|
|
150
152
|
</Tabs>
|
|
151
153
|
```
|
|
152
154
|
|
|
153
|
-
When conditionally styling by orientation in `className`, use `data-[orientation=horizontal]:` / `data-[orientation=vertical]:` — DS emits a `data-orientation` attribute, so a bare `data-horizontal:` selector won't match.
|
|
155
|
+
When conditionally styling by orientation in `className`, use `data-[orientation=horizontal]:` / `data-[orientation=vertical]:` — DS emits a `data-orientation` attribute on both the root and the list, so a bare `data-horizontal:` selector won't match.
|
|
154
156
|
|
|
155
157
|
---
|
|
156
158
|
|
|
157
159
|
## 5. Common mistakes
|
|
158
160
|
|
|
159
|
-
### Mistake 1 —
|
|
161
|
+
### Mistake 1 — Letting the trigger value and the content value diverge
|
|
160
162
|
|
|
161
163
|
```tsx
|
|
162
|
-
// ❌ Wrong —
|
|
164
|
+
// ❌ Wrong — the trigger says 0, the panel says "overview"; nothing matches
|
|
163
165
|
const [tab, setTab] = useState(0);
|
|
164
166
|
<Tabs value={tab} onValueChange={setTab}>
|
|
165
167
|
<TabsTrigger value={0}>Overview</TabsTrigger>
|
|
166
|
-
<TabsContent value=
|
|
168
|
+
<TabsContent value="overview">Overview panel.</TabsContent>
|
|
167
169
|
</Tabs>
|
|
168
170
|
|
|
169
|
-
// ✅ Correct —
|
|
171
|
+
// ✅ Correct — one key, used by the state, the trigger and the panel
|
|
170
172
|
const [tab, setTab] = useState('overview');
|
|
171
173
|
<Tabs value={tab} onValueChange={setTab}>
|
|
172
174
|
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
@@ -174,7 +176,10 @@ const [tab, setTab] = useState('overview');
|
|
|
174
176
|
</Tabs>
|
|
175
177
|
```
|
|
176
178
|
|
|
177
|
-
DS matches the active tab by
|
|
179
|
+
DS matches the active tab by identity between `Tabs value`/`defaultValue`, `TabsTrigger value` and
|
|
180
|
+
`TabsContent value`. The value type is generic (numbers work), but the three must share it — a
|
|
181
|
+
numeric `0` never matches the string `"0"`, and the panel silently never renders. The migration
|
|
182
|
+
converts Tractor's `IDType` ids to string keys for readability and stable state types.
|
|
178
183
|
|
|
179
184
|
Source: `packages/ds/src/components/tabs.tsx`
|
|
180
185
|
|
|
@@ -218,7 +223,7 @@ Source: `packages/ds/src/components/tabs.tsx`
|
|
|
218
223
|
<TabsList>…</TabsList>
|
|
219
224
|
```
|
|
220
225
|
|
|
221
|
-
DS Tabs has exactly one visual style. There is no `size` prop on `Tabs` and no `variant` prop on `TabsList`. Tractor's `
|
|
226
|
+
DS Tabs has exactly one visual style. There is no `size` prop on `Tabs` and no `variant` prop on `TabsList`. Tractor's `TabMenu` `variant` (`auto` | `evenly-sized`) and `space` props do not map to anything — remove them without replacement.
|
|
222
227
|
|
|
223
228
|
Source: `packages/ds/src/components/tabs.tsx`
|
|
224
229
|
|
|
@@ -238,7 +243,7 @@ import { Tabs, TabsList, TabsTrigger } from '@aircall/ds';
|
|
|
238
243
|
// ✅ Correct — use ToggleGroup for segmented controls with no content panels
|
|
239
244
|
import { ToggleGroup, ToggleGroupItem } from '@aircall/ds';
|
|
240
245
|
|
|
241
|
-
<ToggleGroup
|
|
246
|
+
<ToggleGroup defaultValue={['month']}>
|
|
242
247
|
<ToggleGroupItem value="week">Week</ToggleGroupItem>
|
|
243
248
|
<ToggleGroupItem value="month">Month</ToggleGroupItem>
|
|
244
249
|
</ToggleGroup>
|
|
@@ -246,4 +251,6 @@ import { ToggleGroup, ToggleGroupItem } from '@aircall/ds';
|
|
|
246
251
|
|
|
247
252
|
`TabToggle` in Tractor is a segmented button control — it switches a value with no associated content panels. `Tabs` always expects paired `TabsContent` panels; using it for a segmented control couples content rendering to the selector unnecessarily. `ToggleGroup` is the direct DS equivalent.
|
|
248
253
|
|
|
249
|
-
|
|
254
|
+
`ToggleGroup` follows the DS convention: no `type="single" | "multiple"` string — a boolean `multiple` (default `false`, i.e. single) — and `value` / `defaultValue` / `onValueChange` always work with `string[]` (`defaultValue={['month']}`, `onValueChange={keys => …}`).
|
|
255
|
+
|
|
256
|
+
Source: `packages/ds/src/components/toggle-group.tsx`
|