@aircall/ds 0.50.0 → 0.51.0
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 +20 -12
- package/dist/index.js +14 -10
- 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
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as OnChangeFn, i as DataTableLoadingState, n as ColumnPinningState, o as SortingState, r as DataTable, s as VisibilityState, t as ColumnDef } from "./data-table-
|
|
1
|
+
import { a as OnChangeFn, i as DataTableLoadingState, n as ColumnPinningState, o as SortingState, r as DataTable, s as VisibilityState, t as ColumnDef } from "./data-table-B5VqWPmw.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
4
4
|
import { ClassValue } from "clsx";
|
|
@@ -98,7 +98,7 @@ declare namespace AccordionContent {
|
|
|
98
98
|
/** `cva` variant definitions for {@link Button} — resolves `variant`, `size`, and `block` into class names. */
|
|
99
99
|
declare const buttonVariants: (props?: ({
|
|
100
100
|
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
101
|
-
size?: "default" | "sm" | "
|
|
101
|
+
size?: "default" | "sm" | "icon" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
102
102
|
block?: boolean | null | undefined;
|
|
103
103
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
104
104
|
/**
|
|
@@ -405,7 +405,7 @@ declare function AudioPlayerBar({ className, step, playheadHeight, ...props }: A
|
|
|
405
405
|
type AudioPlayerCurrentTimeProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
406
406
|
/**
|
|
407
407
|
* Dumb span that always renders the current playback position as a formatted
|
|
408
|
-
* time string (e.g. `1:23`). Reads from the nearest `
|
|
408
|
+
* time string (e.g. `1:23`). Reads from the nearest `Audio`.
|
|
409
409
|
*
|
|
410
410
|
* @example
|
|
411
411
|
* ```tsx
|
|
@@ -438,7 +438,7 @@ declare function AudioPlayerTime({ mode, className, ...props }: AudioPlayerTimeP
|
|
|
438
438
|
type AudioPlayerDurationProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
439
439
|
/**
|
|
440
440
|
* Dumb span that always renders the total audio duration as a formatted time
|
|
441
|
-
* string (e.g. `3:45`). Reads from the nearest `
|
|
441
|
+
* string (e.g. `3:45`). Reads from the nearest `Audio`.
|
|
442
442
|
*
|
|
443
443
|
* @example
|
|
444
444
|
* ```tsx
|
|
@@ -659,7 +659,7 @@ declare namespace AlertDialogCancel {
|
|
|
659
659
|
* the icon level with the first line when the title wraps.
|
|
660
660
|
*/
|
|
661
661
|
declare const alertVariants: (props?: ({
|
|
662
|
-
variant?: "default" | "
|
|
662
|
+
variant?: "default" | "info" | "success" | "warning" | "error" | null | undefined;
|
|
663
663
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
664
664
|
/**
|
|
665
665
|
* Callout that draws attention to an important, contextual message.
|
|
@@ -995,8 +995,8 @@ declare namespace CounterBadge {
|
|
|
995
995
|
/** `cva` recipe for the Badge/Chip container — drives the `size`, `color`, and `tone` classes. */
|
|
996
996
|
declare const badgeVariants: (props?: ({
|
|
997
997
|
size?: "default" | "lg" | null | undefined;
|
|
998
|
-
color?: "
|
|
999
|
-
tone?: "dark" | "
|
|
998
|
+
color?: "blue" | "green" | "pink" | "purple" | "red" | "yellow" | "charcoal" | null | undefined;
|
|
999
|
+
tone?: "dark" | "light" | "medium-dark" | "medium-light" | null | undefined;
|
|
1000
1000
|
overflowMode?: "none" | "truncate" | null | undefined;
|
|
1001
1001
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
1002
1002
|
type BadgeVariants = VariantProps<typeof badgeVariants>;
|
|
@@ -1010,7 +1010,7 @@ type BadgeTone = NonNullable<BadgeVariants['tone']>;
|
|
|
1010
1010
|
* removable token inside an input/combobox, use `Chip`.
|
|
1011
1011
|
*
|
|
1012
1012
|
* Pick a constrained DS `color` + `tone` (no freeform hex) — defaults to
|
|
1013
|
-
* `charcoal` / `
|
|
1013
|
+
* `charcoal` / `dark` — or pass any stored hex via `customColor`. Icons are
|
|
1014
1014
|
* composed as children (auto-sized per `size`).
|
|
1015
1015
|
*
|
|
1016
1016
|
* `overflowMode` controls how content wider than the badge is handled:
|
|
@@ -1074,8 +1074,8 @@ declare namespace BadgeGroupCount {
|
|
|
1074
1074
|
* edge gets the accent border.
|
|
1075
1075
|
*/
|
|
1076
1076
|
declare const bannerVariants: (props?: ({
|
|
1077
|
-
variant?: "default" | "
|
|
1078
|
-
borderDirection?: "
|
|
1077
|
+
variant?: "default" | "info" | "success" | "warning" | "error" | null | undefined;
|
|
1078
|
+
borderDirection?: "bottom" | "top" | null | undefined;
|
|
1079
1079
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
1080
1080
|
/**
|
|
1081
1081
|
* Full-width contextual message, typically pinned to the top or bottom of a
|
|
@@ -4132,7 +4132,9 @@ declare namespace FieldLabel {
|
|
|
4132
4132
|
* ```tsx
|
|
4133
4133
|
* <FieldLabelRow>
|
|
4134
4134
|
* <FieldLabel htmlFor="taxid">Tax ID Number</FieldLabel>
|
|
4135
|
-
* <FieldLabelAside
|
|
4135
|
+
* <FieldLabelAside>
|
|
4136
|
+
* <Anchor href="/help/tax-id">Where do I find this?</Anchor>
|
|
4137
|
+
* </FieldLabelAside>
|
|
4136
4138
|
* </FieldLabelRow>
|
|
4137
4139
|
* ```
|
|
4138
4140
|
*/
|
|
@@ -6093,6 +6095,11 @@ interface SheetContentProps extends Dialog$1.Popup.Props, Pick<Dialog$1.Portal.P
|
|
|
6093
6095
|
* @default true
|
|
6094
6096
|
*/
|
|
6095
6097
|
showCloseButton?: boolean;
|
|
6098
|
+
/**
|
|
6099
|
+
* Dim and blur the backdrop behind the sheet. Set to `false` for a clear background.
|
|
6100
|
+
* @default true
|
|
6101
|
+
*/
|
|
6102
|
+
showOverlay?: boolean;
|
|
6096
6103
|
}
|
|
6097
6104
|
declare namespace SheetContent {
|
|
6098
6105
|
type Props = SheetContentProps;
|
|
@@ -6719,7 +6726,8 @@ declare namespace StepperContent {
|
|
|
6719
6726
|
//#region src/components/switch.d.ts
|
|
6720
6727
|
/**
|
|
6721
6728
|
* A toggle switch for an on/off setting, wrapping Base UI's `Switch.Root`.
|
|
6722
|
-
* Renders a `<
|
|
6729
|
+
* Renders a `<span role="switch">` containing a sliding thumb, plus a hidden
|
|
6730
|
+
* `<input type="checkbox">` beside it for form participation.
|
|
6723
6731
|
*
|
|
6724
6732
|
* @example
|
|
6725
6733
|
* ```tsx
|
package/dist/index.js
CHANGED
|
@@ -246,7 +246,7 @@ const AudioPlayerManagerContext = React.createContext(null);
|
|
|
246
246
|
*/
|
|
247
247
|
function useAudioPlayer() {
|
|
248
248
|
const ctx = React.useContext(AudioPlayerContext);
|
|
249
|
-
if (!ctx) throw new Error("AudioPlayer sub-components must be rendered inside <
|
|
249
|
+
if (!ctx) throw new Error("AudioPlayer sub-components must be rendered inside <Audio>.");
|
|
250
250
|
return ctx;
|
|
251
251
|
}
|
|
252
252
|
/**
|
|
@@ -262,7 +262,7 @@ function useAudioPlayer() {
|
|
|
262
262
|
*/
|
|
263
263
|
function useAudioPlayerTime() {
|
|
264
264
|
const time = React.useContext(AudioPlayerTimeContext);
|
|
265
|
-
if (time === null) throw new Error("useAudioPlayerTime must be called inside <
|
|
265
|
+
if (time === null) throw new Error("useAudioPlayerTime must be called inside <Audio>.");
|
|
266
266
|
return time;
|
|
267
267
|
}
|
|
268
268
|
function useAnimationFrameLoop(callback) {
|
|
@@ -610,7 +610,7 @@ function AudioPlayerBar(_ref7) {
|
|
|
610
610
|
}
|
|
611
611
|
/**
|
|
612
612
|
* Dumb span that always renders the current playback position as a formatted
|
|
613
|
-
* time string (e.g. `1:23`). Reads from the nearest `
|
|
613
|
+
* time string (e.g. `1:23`). Reads from the nearest `Audio`.
|
|
614
614
|
*
|
|
615
615
|
* @example
|
|
616
616
|
* ```tsx
|
|
@@ -660,7 +660,7 @@ function AudioPlayerTime(_ref9) {
|
|
|
660
660
|
}
|
|
661
661
|
/**
|
|
662
662
|
* Dumb span that always renders the total audio duration as a formatted time
|
|
663
|
-
* string (e.g. `3:45`). Reads from the nearest `
|
|
663
|
+
* string (e.g. `3:45`). Reads from the nearest `Audio`.
|
|
664
664
|
*
|
|
665
665
|
* @example
|
|
666
666
|
* ```tsx
|
|
@@ -1739,7 +1739,7 @@ const badgeVariants = cva("group/badge inline-flex w-fit shrink-0 items-center j
|
|
|
1739
1739
|
* removable token inside an input/combobox, use `Chip`.
|
|
1740
1740
|
*
|
|
1741
1741
|
* Pick a constrained DS `color` + `tone` (no freeform hex) — defaults to
|
|
1742
|
-
* `charcoal` / `
|
|
1742
|
+
* `charcoal` / `dark` — or pass any stored hex via `customColor`. Icons are
|
|
1743
1743
|
* composed as children (auto-sized per `size`).
|
|
1744
1744
|
*
|
|
1745
1745
|
* `overflowMode` controls how content wider than the badge is handled:
|
|
@@ -4498,7 +4498,7 @@ const ComboboxContent = React.forwardRef((componentProps, forwardRef) => {
|
|
|
4498
4498
|
anchor,
|
|
4499
4499
|
positionMethod: "fixed",
|
|
4500
4500
|
"data-slot": "combobox-positioner",
|
|
4501
|
-
className: "isolate z-popup",
|
|
4501
|
+
className: "isolate z-popup [--available-height:100dvh]",
|
|
4502
4502
|
children: /* @__PURE__ */ jsx(Combobox$1.Popup, _objectSpread2({
|
|
4503
4503
|
ref: forwardRef,
|
|
4504
4504
|
"data-slot": "combobox-content",
|
|
@@ -6102,7 +6102,9 @@ FieldLabel.displayName = "FieldLabel";
|
|
|
6102
6102
|
* ```tsx
|
|
6103
6103
|
* <FieldLabelRow>
|
|
6104
6104
|
* <FieldLabel htmlFor="taxid">Tax ID Number</FieldLabel>
|
|
6105
|
-
* <FieldLabelAside
|
|
6105
|
+
* <FieldLabelAside>
|
|
6106
|
+
* <Anchor href="/help/tax-id">Where do I find this?</Anchor>
|
|
6107
|
+
* </FieldLabelAside>
|
|
6106
6108
|
* </FieldLabelRow>
|
|
6107
6109
|
* ```
|
|
6108
6110
|
*/
|
|
@@ -13005,6 +13007,7 @@ const _excluded2$3 = [
|
|
|
13005
13007
|
"children",
|
|
13006
13008
|
"side",
|
|
13007
13009
|
"showCloseButton",
|
|
13010
|
+
"showOverlay",
|
|
13008
13011
|
"container"
|
|
13009
13012
|
];
|
|
13010
13013
|
const _excluded3$3 = ["className"];
|
|
@@ -13072,10 +13075,10 @@ SheetOverlay.displayName = "SheetOverlay";
|
|
|
13072
13075
|
* `<div>` popup fixed to the chosen screen edge, optionally with a close button.
|
|
13073
13076
|
*/
|
|
13074
13077
|
const SheetContent = React.forwardRef((componentProps, forwardRef) => {
|
|
13075
|
-
const { className, children, side = "right", showCloseButton = true, container } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$3);
|
|
13078
|
+
const { className, children, side = "right", showCloseButton = true, showOverlay = true, container } = componentProps, props = _objectWithoutProperties(componentProps, _excluded2$3);
|
|
13076
13079
|
return /* @__PURE__ */ jsxs(SheetPortal, {
|
|
13077
13080
|
container,
|
|
13078
|
-
children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsxs(Dialog$1.Popup, _objectSpread2(_objectSpread2({
|
|
13081
|
+
children: [/* @__PURE__ */ jsx(SheetOverlay, { className: showOverlay ? void 0 : "bg-transparent supports-backdrop-filter:backdrop-blur-none" }), /* @__PURE__ */ jsxs(Dialog$1.Popup, _objectSpread2(_objectSpread2({
|
|
13079
13082
|
ref: forwardRef,
|
|
13080
13083
|
"data-slot": "sheet-content",
|
|
13081
13084
|
"data-side": side,
|
|
@@ -14062,7 +14065,8 @@ StepperContent.displayName = "StepperContent";
|
|
|
14062
14065
|
const _excluded$1 = ["className"];
|
|
14063
14066
|
/**
|
|
14064
14067
|
* A toggle switch for an on/off setting, wrapping Base UI's `Switch.Root`.
|
|
14065
|
-
* Renders a `<
|
|
14068
|
+
* Renders a `<span role="switch">` containing a sliding thumb, plus a hidden
|
|
14069
|
+
* `<input type="checkbox">` beside it for form participation.
|
|
14066
14070
|
*
|
|
14067
14071
|
* @example
|
|
14068
14072
|
* ```tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aircall/ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": [
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"sb:test": "vitest --project=storybook",
|
|
145
145
|
"sb:build:chromatic": "storybook build --test --stats-json",
|
|
146
146
|
"chromatic": "chromatic --storybook-build-dir=./storybook-static",
|
|
147
|
-
"typecheck": "tsc --noEmit
|
|
147
|
+
"typecheck": "tsc --noEmit",
|
|
148
148
|
"snapshot:budget": "node scripts/snapshot-budget.mjs"
|
|
149
149
|
},
|
|
150
150
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@ requires:
|
|
|
13
13
|
- aircall-ds/setup
|
|
14
14
|
sources:
|
|
15
15
|
- "aircall/hydra:packages/ds/src/components/audio-player.tsx"
|
|
16
|
-
- "aircall/hydra:
|
|
16
|
+
- "aircall/hydra:packages/ds/src/stories/AudioPlayer.stories.tsx"
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
# Migrating to @aircall/ds AudioPlayer
|
|
@@ -80,9 +80,11 @@ The manager hooks in transparently — no changes to the `<Audio>` children or
|
|
|
80
80
|
|
|
81
81
|
| Tractor / custom | DS replacement | Notes |
|
|
82
82
|
|---|---|---|
|
|
83
|
-
| `<QuickAudioPlayer src>` | `<Audio src><AudioPlayerRow>…</AudioPlayerRow></Audio>` | Drop-in; see §
|
|
83
|
+
| `<QuickAudioPlayer src>` | `<Audio src><AudioPlayerRow>…</AudioPlayerRow></Audio>` | Drop-in; see §1.1 for the layout note |
|
|
84
84
|
| `<Audio src>` | `<Audio src>` | Same name; drop `initialDuration` |
|
|
85
|
-
| `<
|
|
85
|
+
| `<Audio sinkId>` | _(removed)_ | No prop — call `audioRef.current.setSinkId(id)` from `useAudioPlayer()` (Chromium-only, as before) |
|
|
86
|
+
| `<Audio onError>` | `useAudioPlayer().error` | No `onError` prop — watch `error` in a child `useEffect` to handle expired URLs |
|
|
87
|
+
| `<PlayButton>` | `<AudioPlayerButton>` | No required props — state comes from the `<Audio>` context |
|
|
86
88
|
| `<PlayButton color="green">` | `<AudioPlayerButton>` (default) | Green filled 32 px button |
|
|
87
89
|
| `<PlayButton color="default" mode="icon">` | `<AudioPlayerButton variant="ghost">` | Secondary transparent 24 px button |
|
|
88
90
|
| `<AudioBar>` | `<AudioPlayerBar>` | Inside `<AudioPlayerRow>`, `flex-1` is automatic |
|
|
@@ -95,6 +97,13 @@ The manager hooks in transparently — no changes to the `<Audio>` children or
|
|
|
95
97
|
| `useAudioManager()` | _(removed)_ | Manager is fully transparent — no consumer hook |
|
|
96
98
|
| `<Flex>` / `<Grid>` layout wrappers | `<AudioPlayerRow>` or plain `<div>` with Tailwind | Drop styled-components layout primitives |
|
|
97
99
|
|
|
100
|
+
DS-only extras on `<Audio>`: `defaultPlaybackRate` (default `1`), `preload`
|
|
101
|
+
(`'none' | 'metadata' | 'auto'`, default `'metadata'`), `crossOrigin` (unset by default; set
|
|
102
|
+
`"anonymous"` for Web Audio access). `<AudioPlayerBar>` also takes `playheadHeight` — replaces the
|
|
103
|
+
circular thumb with a thin vertical playhead that extends downward, for a bar overlaying a
|
|
104
|
+
multi-row timeline. Omitting `src` on `<Audio>` gives a multi-item player driven imperatively with
|
|
105
|
+
`player.play({ src })` (the `MultiItemOnePlayer` Storybook story shows the full pattern).
|
|
106
|
+
|
|
98
107
|
---
|
|
99
108
|
|
|
100
109
|
## 4. Hook rename table
|
|
@@ -419,6 +428,8 @@ Each player is self-contained. `AudioPlayerManager` ensures only one plays at a
|
|
|
419
428
|
| Tractor prop | Action |
|
|
420
429
|
|---|---|
|
|
421
430
|
| `initialDuration` on `<Audio>` / `<QuickAudioPlayer>` | Drop — DS loads metadata via `preload="metadata"` |
|
|
431
|
+
| `sinkId` on `<Audio>` | Drop the prop — reach the element via `useAudioPlayer().audioRef` and call `setSinkId()` yourself |
|
|
432
|
+
| `onError` on `<Audio>` | Drop the prop — read `useAudioPlayer().error` (`MediaError \| null`) instead |
|
|
422
433
|
| `color` on `<PlayButton>` | Map: `color="green"` → default, `color="default" mode="icon"` → `variant="ghost"`, `color="yellow"` → no direct equivalent (use `className`) |
|
|
423
434
|
| `mode` on `<PlayButton>` | Drop — `<AudioPlayerButton>` is always icon-only |
|
|
424
435
|
| `className="flex-1"` on `<AudioBar>` inside `<AudioPlayerRow>` | Drop — automatic via `[data-slot]` selector |
|
|
@@ -11,6 +11,9 @@ requires:
|
|
|
11
11
|
- aircall-ds/setup
|
|
12
12
|
sources:
|
|
13
13
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/06-react-icons.md"
|
|
14
|
+
- "aircall/hydra:packages/react-icons/src/index.ts"
|
|
15
|
+
- "aircall/hydra:packages/react-icons/src/generated/custom/index.ts"
|
|
16
|
+
- "aircall/hydra:packages/react-icons/src/generated/colored/index.ts"
|
|
14
17
|
---
|
|
15
18
|
|
|
16
19
|
Migrate icons from `@aircall/icons` to `@aircall/react-icons`. This is **independent of
|
|
@@ -55,6 +58,11 @@ wrapper; when it was wrapped in Tractor's `<Icon>`, also remove that wrapper (se
|
|
|
55
58
|
| `20` | `size-5` | 20px |
|
|
56
59
|
| `24` | `size-6` | 24px |
|
|
57
60
|
|
|
61
|
+
Prefer the Tailwind class (`size-4`, `size-5`, `size-6`). The icons also accept a numeric `size`
|
|
62
|
+
prop (lucide's API: `size?: string | number`, applied as `width`/`height`), so `<Mic size={24} />`
|
|
63
|
+
still works — but inside DS components keep your hands off size: `Button`, `Badge`, `Attachment`,
|
|
64
|
+
etc. already size their `svg` children, and an explicit class or `size` prop overrides that.
|
|
65
|
+
|
|
58
66
|
## 4. Icon name mapping (complete)
|
|
59
67
|
|
|
60
68
|
Many old `*Filled` / `*Outlined` variants collapse into one new name — this is intentional consolidation. Rows marked ⚠️ need visual validation before the consumer migration is locked.
|
|
@@ -370,7 +378,11 @@ Many old `*Filled` / `*Outlined` variants collapse into one new name — this is
|
|
|
370
378
|
|
|
371
379
|
### Flags
|
|
372
380
|
|
|
373
|
-
Colored country flags ship as `Flag*` exports
|
|
381
|
+
Colored country flags ship as `Flag*` exports named by ISO 3166-1 **alpha-2** code — `FlagFr`,
|
|
382
|
+
`FlagUs`, `FlagGbEng`, … (the alpha-3 names from `@aircall/icons`, e.g. `FlagFra`/`FlagDeu`, were
|
|
383
|
+
dropped). A slug-keyed `FLAGS` map (`{ fr: FlagFr, 'gb-eng': FlagGbEng, … }`) is exported for
|
|
384
|
+
dynamic lookup — use it instead of `import * as Icons`, which would pull every lucide icon into
|
|
385
|
+
the bundle.
|
|
374
386
|
|
|
375
387
|
## 5. Icons with no equivalent
|
|
376
388
|
|
|
@@ -387,15 +399,25 @@ Pairs where the placeholder mapping doesn't convincingly match the old icon. Con
|
|
|
387
399
|
|
|
388
400
|
_None open — `IntegrationsOutlined` / `Integrations1Outlined` resolved to `Unplug` (lucide)._
|
|
389
401
|
|
|
390
|
-
## 6. Brand / platform icons
|
|
402
|
+
## 6. Brand / platform icons
|
|
403
|
+
|
|
404
|
+
Some brands moved into `@aircall/react-icons` as Aircall custom or colored exports; the rest stay
|
|
405
|
+
as separate inline SVGs or local wrappers.
|
|
406
|
+
|
|
407
|
+
**Shipped by the package — import them, don't hand-roll:**
|
|
408
|
+
|
|
409
|
+
- **Aircall brand**: `AircallLogo` (badge-with-mark) and `AircallMark` (bare "A" glyph, for the
|
|
410
|
+
chatbot empty state / a coloured surface). Older brand variants (`AircallIcon`,
|
|
411
|
+
`AircallLogoFull`, `LogoMarkMono`, `LogoMarkColor`, …) have no equivalent.
|
|
412
|
+
- **Social / platform logos**: the colored `Social<Name>Neutral` / `Social<Name>Original` pairs —
|
|
413
|
+
e.g. `SocialAppleOriginal`, `SocialAndroidOriginal`, `SocialWhatsappOriginal`,
|
|
414
|
+
`SocialMicrosoftteamsOriginal`. `Original` keeps the brand colors, `Neutral` is the monochrome
|
|
415
|
+
cut.
|
|
391
416
|
|
|
392
|
-
|
|
417
|
+
**Still not in the package — keep as separate assets:**
|
|
393
418
|
|
|
394
|
-
- **
|
|
395
|
-
- **
|
|
396
|
-
- **Browsers**: `ChromeFilled`, `EdgeFilled`, `FirefoxFilled`
|
|
397
|
-
- **Messaging**: `WhatsappFilled`, `WhatsappOutlined` — use the existing `WhatsAppIcon.tsx` in `packages/aw-ui`
|
|
398
|
-
- **Text badges**: `BetaOutlined` — keep as a custom SVG or badge component
|
|
419
|
+
- **Browsers**: `ChromeFilled`, `EdgeFilled`, `FirefoxFilled` — no colored-logo equivalent.
|
|
420
|
+
- **Text badges**: `BetaOutlined` — keep as a custom SVG or badge component.
|
|
399
421
|
|
|
400
422
|
## 7. Before / After examples
|
|
401
423
|
|
|
@@ -518,23 +540,30 @@ Source: `@aircall/react-icons` re-exports lucide + Aircall icons; custom icons l
|
|
|
518
540
|
|
|
519
541
|
---
|
|
520
542
|
|
|
521
|
-
### Mistake 3:
|
|
543
|
+
### Mistake 3: Passing a Tractor token to the `color` prop
|
|
522
544
|
|
|
523
545
|
```tsx
|
|
524
|
-
// WRONG —
|
|
546
|
+
// WRONG — "primary.500" is a Tractor token, not a CSS colour; the SVG ignores it
|
|
525
547
|
import { Mic } from '@aircall/react-icons';
|
|
526
548
|
|
|
527
|
-
<Mic
|
|
528
|
-
|
|
529
|
-
// CORRECT — use Tailwind utility classes
|
|
530
|
-
import { Mic } from '@aircall/react-icons';
|
|
549
|
+
<Mic color="primary.500" />
|
|
531
550
|
|
|
551
|
+
// CORRECT — use the Tailwind text-* class (or a real CSS colour / currentColor)
|
|
532
552
|
<Mic className="size-6 text-primary" />
|
|
533
553
|
```
|
|
534
554
|
|
|
535
|
-
**Mechanism:**
|
|
555
|
+
**Mechanism:** the icon's `color` prop is a plain SVG attribute, so it only accepts a valid CSS
|
|
556
|
+
colour — a Tractor token like `"primary.500"` is an invalid value the browser ignores, and the icon
|
|
557
|
+
inherits its surrounding colour instead of the intended one. The Tailwind `text-*` class is the
|
|
558
|
+
authoritative colour system in `@aircall/ds`.
|
|
559
|
+
|
|
560
|
+
Note the `size` prop is **different**: it is a real lucide prop (`size?: string | number`) and works.
|
|
561
|
+
Prefer `className="size-6"` only for consistency with the rest of the DS — and omit both inside a DS
|
|
562
|
+
`Button`, which sizes its own icons.
|
|
536
563
|
|
|
537
|
-
Source: `@aircall/react-icons` re-exports lucide
|
|
564
|
+
Source: `@aircall/react-icons` re-exports lucide icon components (`LucideProps` has `size`; `color`
|
|
565
|
+
is standard `SVGAttributes`); Tailwind design tokens (`text-primary`, `text-destructive`, …) are the
|
|
566
|
+
authoritative colour system in `@aircall/ds`.
|
|
538
567
|
|
|
539
568
|
---
|
|
540
569
|
|
|
@@ -103,7 +103,8 @@ Affected: Trigger/Close on Dialog, Sheet, Popover, Tooltip, DropdownMenu, Collap
|
|
|
103
103
|
Drawer, plus `Button`, `Badge`, `Item`, `PaginationLink`, and Sidebar subcomponents.
|
|
104
104
|
|
|
105
105
|
Drawer is Base UI (via Coss UI) - same `render` rule applies. Its body wrapper is
|
|
106
|
-
`DrawerPopup` (not `DrawerContent`)
|
|
106
|
+
`DrawerPopup` (not `DrawerContent`). For a desktop side panel use `Sheet` instead (see
|
|
107
|
+
`sheet-vs-drawer`).
|
|
107
108
|
|
|
108
109
|
## 5. Labels live inside Groups
|
|
109
110
|
|
|
@@ -200,12 +201,13 @@ import { AddOutlined, Icon } from '@aircall/tractor';
|
|
|
200
201
|
<Icon component={AddOutlined} mr={2} />
|
|
201
202
|
|
|
202
203
|
// After
|
|
203
|
-
import {
|
|
204
|
-
<
|
|
204
|
+
import { Plus } from '@aircall/react-icons';
|
|
205
|
+
<Plus className="mr-2 size-4" />
|
|
205
206
|
```
|
|
206
207
|
|
|
207
|
-
Some names differ significantly (e.g. `InfoCircleFilled` -> `
|
|
208
|
-
`PlayFilled` -> `
|
|
208
|
+
Some names differ significantly (e.g. `InfoCircleFilled` -> `Info`,
|
|
209
|
+
`PlayFilled` -> `Play`). `@aircall/react-icons` is lucide plus Aircall custom icons; check
|
|
210
|
+
`@aircall/ds#aircall-ds/migrate-icons` before guessing a name.
|
|
209
211
|
|
|
210
212
|
## 10. Forms & validation
|
|
211
213
|
|
|
@@ -237,20 +239,20 @@ Then load the listed recipe skill (if `available`) for the detailed swap.
|
|
|
237
239
|
| `Audio` / `AudioPlayer` / `AudioManager` / `useAudio` | `Audio` + `AudioPlayerRow` + `AudioPlayerButton` + `AudioPlayerBar` + `AudioPlayerTime` + `AudioPlayerSpeed` + `AudioPlayerSkip` + `AudioPlayerManager` | `@aircall/ds#aircall-ds/migrate-audio-player` | available |
|
|
238
240
|
| `Avatar` (+ `QuickAvatar`) | `Avatar` + `AvatarImage` + `AvatarFallback` | `@aircall/ds#aircall-ds/migrate-tractor/avatar` | available |
|
|
239
241
|
| `Badge` | `AvatarBadge` (status dot on avatar); `Badge` (label/tag style) | `@aircall/ds#aircall-ds/migrate-tractor/badge` | available |
|
|
240
|
-
| `Banner` (+ `BannerHeading`/`BannerIcon`/`BannerSuffix`) | `Alert` (
|
|
242
|
+
| `Banner` (+ `BannerHeading`/`BannerIcon`/`BannerSuffix`), `BannerManager`/`useBanner`/`banners.showBanner` | `Alert` (`inline` / in-content) / `Banner` (full-width); programmatic banners -> `NotificationQueueProvider` + `NotificationSlot` + `useNotification`/`useNotificationQueue` | `@aircall/ds#aircall-ds/migrate-tractor/alert` | available |
|
|
241
243
|
| `BannerButton` | `Button` inside `BannerAction` | `@aircall/ds#aircall-ds/migrate-tractor/alert` | available |
|
|
242
244
|
| `Box` | native `<div>` + Tailwind classes | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
|
|
243
245
|
| `Button` | `Button` | `@aircall/ds#aircall-ds/migrate-tractor/button` | available |
|
|
244
246
|
| hand-rolled card (`div`/`Box` with border + shadow + padding) | `Card` + `CardHeader` + `CardTitle` + `CardDescription` + `CardAction` + `CardContent` + `CardFooter` | `@aircall/ds#aircall-ds/migrate-tractor/card` | available |
|
|
245
247
|
| `Checkbox` | `Checkbox` + `<Label>` | - | not-yet |
|
|
246
|
-
| `ComboBox` | `Combobox` (compound) | `@aircall/ds#aircall-ds/migrate-tractor/combobox` | available |
|
|
248
|
+
| `ComboBox` | `Combobox` (compound) / `DataCombobox` (data-driven) | `@aircall/ds#aircall-ds/migrate-tractor/combobox` | available |
|
|
247
249
|
| `CounterBadge` | `CounterBadge` | `@aircall/ds#aircall-ds/migrate-tractor/badge` | available |
|
|
248
|
-
| `DatePicker` | `DatePicker` (
|
|
249
|
-
| `DateSelect` (
|
|
250
|
+
| `DatePicker` (Tractor, inline `{ startDate, endDate }` calendar) | `Calendar` (inline) or `DatePicker` (field; defaults to `mode="single"`, so set `mode="range"` explicitly) | `@aircall/ds#aircall-ds/migrate-tractor/date-picker` | available |
|
|
251
|
+
| `DateSelect` (`@dashboard/library`) | `DatePicker` (single, or `mode="range"` + `predefinedRanges` + `onRangeChange`); dashboard filter chips -> `DateRangeCalendar` (@aircall/blocks) | `@aircall/ds#aircall-ds/migrate-tractor/date-picker` | available |
|
|
250
252
|
| `Divider` | `Separator` | `@aircall/ds#aircall-ds/migrate-tractor/divider` | available |
|
|
251
253
|
| `DragAndDrop` / `ConversationDragAndDrop` / react-dropzone (`useDropzone`) + project wrappers (`Dropzone`/`DropzoneV2`) | `Dropzone` | `@aircall/ds#aircall-ds/migrate-tractor/dropzone` | available |
|
|
252
|
-
| `Drawer` | `Drawer`
|
|
253
|
-
| `Dropdown` | `DropdownMenu` (compound) | `@aircall/ds#aircall-ds/migrate-tractor/dropdown-menu` | available |
|
|
254
|
+
| `Drawer` | `Sheet` + `SheetContent side` for a desktop side panel; `Drawer` + `DrawerPopup` only for swipe-to-dismiss | `@aircall/ds#aircall-ds/migrate-tractor/sheet-vs-drawer` | available |
|
|
255
|
+
| `Dropdown` | `DropdownMenu` (compound); non-menu content -> `Popover` | `@aircall/ds#aircall-ds/migrate-tractor/dropdown-menu` | available |
|
|
254
256
|
| `Flex` | native `<div className="flex ...">` + Tailwind | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
|
|
255
257
|
| `FlagIcon` | `CountryFlag` (prop: `countryIsoCode`) | - | not-yet |
|
|
256
258
|
| `Form` | native `<form>` + `Field` per row | `@aircall/ds#aircall-ds/migrate-tractor/form-and-field` | available |
|
|
@@ -259,36 +261,37 @@ Then load the listed recipe skill (if `available`) for the detailed swap.
|
|
|
259
261
|
| `Grid` | native `<div className="grid ...">` + Tailwind | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
|
|
260
262
|
| `Icon` | direct icon import from `@aircall/react-icons` | `@aircall/ds#aircall-ds/migrate-icons` | available |
|
|
261
263
|
| `IconButton` | `Button` with `size` `icon` / `icon-sm` / `icon-lg` | `@aircall/ds#aircall-ds/migrate-tractor/button` | available |
|
|
262
|
-
| `Link` | `
|
|
263
|
-
| `List` (+ `ListItem`) | `ItemGroup` + `Item` + `
|
|
264
|
-
| `Menu` (+ `MenuItem`) | standalone list -> `ItemGroup` + `Item
|
|
265
|
-
| `Modal` | `Dialog` (compound) | `@aircall/ds#aircall-ds/migrate-tractor/dialog` | available |
|
|
264
|
+
| `Link` | `Anchor` (navigation) / `Button variant="ghost"` (click-only action) | `@aircall/ds#aircall-ds/migrate-tractor/link` | available |
|
|
265
|
+
| `List` (+ `ListItem`, `ListView`, `ListFooter`) | `ItemGroup` + `Item` + `ItemContent`/`ItemActions` (+ `ItemMedia variant="icon"` for icons; a DS `Avatar` directly in `Item` for people; `ScrollArea` for `ListView maxH`; `ItemSeparator` for dividers) | `@aircall/ds#aircall-ds/migrate-tractor/item` | available |
|
|
266
|
+
| `Menu` (+ `MenuItem`) | standalone list -> `ItemGroup` + `Item` (no selection state: selectable menus use `DropdownMenu` checkbox/radio items); **inside a `Dropdown`/`ActionMenu`** -> `DropdownMenuContent` + `DropdownMenuItem` | `@aircall/ds#aircall-ds/migrate-tractor/item` (standalone) or `@aircall/ds#aircall-ds/migrate-tractor/dropdown-menu` (in a Dropdown) | available |
|
|
267
|
+
| `Modal` / `ModalDialog` | `Dialog` (compound); confirm prompts -> `AlertDialog` | `@aircall/ds#aircall-ds/migrate-tractor/dialog` | available |
|
|
268
|
+
| `NumberInput` (`@dashboard/library`) | `NumericInput` (`suffix`/`prefix`, `onValueChange(number \| null)`) | `@aircall/ds#aircall-ds/migrate-tractor/input` | available |
|
|
266
269
|
| `PasswordInput` | `InputGroup` recipe | `@aircall/ds#aircall-ds/migrate-tractor/input` | available |
|
|
267
270
|
| `Popover` | `Popover` + `PopoverTrigger` + `PopoverContent` | `@aircall/ds#aircall-ds/migrate-tractor/popover` | available |
|
|
268
271
|
| `Progress` | `Progress` (compound: `ProgressTrack` + `ProgressIndicator`) | - | not-yet |
|
|
269
272
|
| `QuickAvatar` | `Avatar` (same as Avatar row) | `@aircall/ds#aircall-ds/migrate-tractor/avatar` | available |
|
|
270
273
|
| `Radio` + `RadioGroup` | `RadioGroup` + `RadioGroupItem` | - | not-yet |
|
|
271
274
|
| `SegmentedControl` | `Tabs` (with panel) or `ToggleGroup` (visual only) | `@aircall/ds#aircall-ds/migrate-tractor/tabs` | available |
|
|
272
|
-
| `Select`
|
|
275
|
+
| `Select` (options-array API; no `SelectOption` component) | `Select` compound: `items` + `SelectTrigger` + `SelectValue` + `SelectContent` + `SelectItem` (+ `SelectGroup`/`SelectLabel`/`SelectSeparator`) | `@aircall/ds#aircall-ds/migrate-tractor/select` | available |
|
|
273
276
|
| `SidenavDropdown` | `Sidebar` + `Collapsible` (compose) | - | not-yet |
|
|
274
277
|
| `SidenavItem` | `Sidebar*` family | - | not-yet |
|
|
275
278
|
| `Skeleton` | `Skeleton` - size via Tailwind (`className="h-4 w-32"`) | `@aircall/ds#aircall-ds/migrate-tractor/skeleton` | available |
|
|
276
279
|
| `Slider` | `Slider` (`onValueChange`, value is `number[]`, no `size`) | - | not-yet |
|
|
277
280
|
| `Spacer` | `<div className="flex flex-col gap-*">` or `FieldGroup` | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
|
|
278
|
-
| `SpinnerOutlined` | `Spinner` (
|
|
279
|
-
| `Tab` (+ `Tab.
|
|
280
|
-
| `Table` (+ `ActionBar`) | `DataTable` (data-driven) or `Table` primitive (static) | `@aircall/ds#aircall-ds/migrate-tractor/data-table` | available |
|
|
281
|
-
| `Tag` | `Badge` (`color` + `tone`
|
|
281
|
+
| `SpinnerOutlined` | `Spinner` (`sm`/`default`/`lg`/`xl`, always animated) | `@aircall/blocks#aircall-blocks/migrate-dashboard/loading` | available |
|
|
282
|
+
| `Tab` (+ `TabContainer`/`TabMenu`/`TabMenuItem`/`TabItem`/`TabContent`, and the @dashboard/library `Tab.Container`/`Tab.Menu`/`Tab.MenuItem`/`Tab.Item` compound) | `Tabs` + `TabsList` + `TabsTrigger` + `TabsContent` | `@aircall/ds#aircall-ds/migrate-tractor/tabs` | available |
|
|
283
|
+
| `Table` (+ `ActionBar`) | `DataTable` (data-driven; pinning via `columnPinning`, ActionBar via the `actionBar` prop) or `Table` primitive (static) | `@aircall/ds#aircall-ds/migrate-tractor/data-table` | available |
|
|
284
|
+
| `Tag` | `Badge` (`color` + `tone`; `customColor` for an arbitrary hex; `legacyColor` is deprecated); removable `Tag` -> `Chip` + `ChipRemove` | `@aircall/ds#aircall-ds/migrate-tractor/badge` | available |
|
|
282
285
|
| `Textarea` | `Textarea` (no `size`, use `aria-invalid`) | - | not-yet |
|
|
283
|
-
| `TextFieldInput` | `Input` (no `
|
|
286
|
+
| `TextInput` (older `@aircall/tractor` 1.x: `TextFieldInput`) | `Input` (no `size`, 40px fixed, use `aria-invalid`; icon/suffix/`onClear` -> `InputGroup`) | `@aircall/ds#aircall-ds/migrate-tractor/input` | available |
|
|
284
287
|
| `Toggle` | `Switch` (`onCheckedChange`, no `size`) | - | not-yet |
|
|
285
|
-
| `ToggleGroup` / `TabToggle` | `ToggleGroup` (`multiple` boolean; value always `string[]`) | - |
|
|
286
|
-
| Day-of-week toggle row (custom) | `DaysPicker`
|
|
287
|
-
| `Tooltip` | `Tooltip` (compound)
|
|
288
|
+
| `ToggleGroup` / `TabToggle` | `ToggleGroup` (`multiple` boolean; value always `string[]`) | `@aircall/ds#aircall-ds/migrate-tractor/tabs` | available |
|
|
289
|
+
| Day-of-week toggle row (custom) | `DaysPicker` from `@aircall/blocks` (`value: DayOfWeek[]`, `onValueChange`, `labelFormat`; no `labels` prop) | `@aircall/ds#aircall-ds/migrate-tractor/date-picker` | available |
|
|
290
|
+
| `Tooltip` | `Tooltip` (compound); `TooltipProvider` at app root is optional (shared delay) | `@aircall/ds#aircall-ds/migrate-tractor/tooltip` | available |
|
|
288
291
|
| `Tree` | `DataTree` (data-driven) or `Tree` primitive | `@aircall/ds#aircall-ds/migrate-tractor/tree` | available |
|
|
289
292
|
| `TreeSelect` | no turn-key equivalent - `DataTree` inside a `Popover` | `@aircall/ds#aircall-ds/migrate-tractor/tree` | available |
|
|
290
293
|
| `Typography` | native HTML + Tailwind text classes | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
|
|
291
|
-
| `useToast` | `toast` from `
|
|
294
|
+
| `useToast` / `toasts` / `ToastManager` | `toast` from `@aircall/ds` + `<Toaster />` at app root | `@aircall/ds#aircall-ds/migrate-tractor/toast` | available |
|
|
292
295
|
| `WhatsAppTemplatePreview` | - (no DS equivalent) | - | not-yet |
|
|
293
296
|
|
|
294
297
|
---
|
|
@@ -304,14 +307,14 @@ These APIs do not exist in DS. Do not propose them.
|
|
|
304
307
|
- `<RadioGroup size="..." />` - no size prop.
|
|
305
308
|
- `<Slider size="..." />` - no size prop.
|
|
306
309
|
- `<Tabs size="..." />` / `<TabsList variant="..." />` - no such props.
|
|
307
|
-
- `<Badge variant="destructive" | "success" | "warning" | "info" />` - Badge has
|
|
308
|
-
`
|
|
309
|
-
|
|
310
|
+
- `<Badge variant="destructive" | "success" | "warning" | "info" />` - Badge has no
|
|
311
|
+
`variant`; colour is `color` + `tone` (+ `customColor` for a stored hex). For alerts
|
|
312
|
+
use `Alert`.
|
|
310
313
|
- `<Alert variant="destructive" />` - Alert's error variant is `error`, not
|
|
311
314
|
`destructive`. Full set: `default` / `info` / `success` / `warning` / `error`.
|
|
312
|
-
- `<CounterBadge count={...}
|
|
313
|
-
capped value as children. Variants: `default` / `secondary` / `ghost`.
|
|
315
|
+
- `<CounterBadge count={...} maxCount={...} />` - those were Tractor props. Pass the
|
|
316
|
+
already-capped value as children. Variants: `default` / `secondary` / `ghost`.
|
|
314
317
|
- `<TooltipProvider delayDuration={...} />` - Base UI prop is `delay`, default `0`.
|
|
315
|
-
`delayDuration` is
|
|
318
|
+
`delayDuration` is not a prop (type error).
|
|
316
319
|
- Subpath imports like `@aircall/ds/components/<name>` - never propose. Always use
|
|
317
320
|
`import { X } from '@aircall/ds'`.
|
|
@@ -11,6 +11,8 @@ requires:
|
|
|
11
11
|
- aircall-ds/migrate-tractor
|
|
12
12
|
sources:
|
|
13
13
|
- "aircall/hydra:docs/migration-guides/tractor-to-ds/recipes/accordion.md"
|
|
14
|
+
- "aircall/hydra:packages/ds/src/components/accordion.tsx"
|
|
15
|
+
- "aircall/hydra:packages/ds/src/stories/Accordion.stories.tsx"
|
|
14
16
|
---
|
|
15
17
|
|
|
16
18
|
This skill builds on aircall-ds/migrate-tractor. Apply all cross-cutting rules from that skill (prop renames, `render` prop, data attributes) before the accordion-specific steps below.
|
|
@@ -51,7 +53,7 @@ import {
|
|
|
51
53
|
| --- | --- | --- |
|
|
52
54
|
| _(implicit — one open at a time)_ | default (no extra prop needed) | Single-open is the DS default |
|
|
53
55
|
| _(allowMultiple or equivalent)_ | `multiple` on `<Accordion>` | Boolean — allows multiple items open simultaneously |
|
|
54
|
-
| _(section key)_ | `value` on `<AccordionItem>` |
|
|
56
|
+
| _(section key)_ | `value` on `<AccordionItem>` | `number` or `string`; the array index works for static lists. Base UI auto-generates an id when omitted, but an explicit `value` is what lets the item match `defaultValue` / `value` on the root |
|
|
55
57
|
| _(section disabled)_ | `disabled` on `<AccordionItem>` | Disables the trigger and keeps the panel closed |
|
|
56
58
|
| `defaultExpanded` / open sections | `defaultValue` on `<Accordion>` | Always an array, even in single-open mode: `defaultValue={[0]}` |
|
|
57
59
|
| controlled open | `value` + `onValueChange` on `<Accordion>` | `value` is an array; `onValueChange` receives `(number \| string)[]` |
|
|
@@ -234,25 +236,33 @@ Source: `packages/ds/src/components/accordion.tsx`
|
|
|
234
236
|
|
|
235
237
|
---
|
|
236
238
|
|
|
237
|
-
### Mistake 3 — Omitting the `value` prop on `AccordionItem`
|
|
239
|
+
### Mistake 3 — Omitting the `value` prop on `AccordionItem` (uncontrolled panel never matches)
|
|
238
240
|
|
|
239
241
|
```tsx
|
|
240
|
-
// Wrong —
|
|
241
|
-
<
|
|
242
|
-
<
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
242
|
+
// Wrong — no value: the item cannot be matched against the root's defaultValue/value
|
|
243
|
+
<Accordion defaultValue={[0]}>
|
|
244
|
+
<AccordionItem>
|
|
245
|
+
<AccordionTrigger>General</AccordionTrigger>
|
|
246
|
+
<AccordionContent>General settings content.</AccordionContent>
|
|
247
|
+
</AccordionItem>
|
|
248
|
+
</Accordion>
|
|
249
|
+
|
|
250
|
+
// Correct — every AccordionItem needs a value that matches the root state
|
|
251
|
+
<Accordion defaultValue={[0]}>
|
|
252
|
+
<AccordionItem value={0}>
|
|
253
|
+
<AccordionTrigger>General</AccordionTrigger>
|
|
254
|
+
<AccordionContent>General settings content.</AccordionContent>
|
|
255
|
+
</AccordionItem>
|
|
256
|
+
</Accordion>
|
|
251
257
|
```
|
|
252
258
|
|
|
253
|
-
|
|
259
|
+
Base UI's `Accordion.Item` types `value` as optional and generates a unique id when it is
|
|
260
|
+
absent, so the item still toggles on its own — but that generated id can never appear in the
|
|
261
|
+
root's `defaultValue` / `value` array, so an explicitly-opened panel (and any controlled
|
|
262
|
+
`value`/`onValueChange` state) never lines up with it. Always pass an explicit `value` so the
|
|
263
|
+
item and the root speak the same identity.
|
|
254
264
|
|
|
255
|
-
Source: `packages/ds/src/components/accordion.tsx`
|
|
265
|
+
Source: `packages/ds/src/components/accordion.tsx` — `AccordionItemProps extends AccordionPrimitive.Item.Props`.
|
|
256
266
|
|
|
257
267
|
---
|
|
258
268
|
|