@aircall/ds 0.26.0 → 0.28.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/globals.css +1 -1
- package/dist/index.d.ts +2488 -54
- package/dist/index.js +2274 -35
- package/dist/theme.css +30 -0
- package/package.json +1 -1
- package/skills/aircall-ds/adopt-attachment/SKILL.md +5 -6
- package/skills/aircall-ds/migrate-audio-player/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-icons/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/SKILL.md +2 -1
- package/skills/aircall-ds/migrate-tractor/accordion/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/alert/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/avatar/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/badge/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/button/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/card/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/combobox/SKILL.md +42 -4
- package/skills/aircall-ds/migrate-tractor/data-table/SKILL.md +2 -1
- package/skills/aircall-ds/migrate-tractor/dialog/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/divider/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/dropdown-menu/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/dropzone/SKILL.md +30 -1
- package/skills/aircall-ds/migrate-tractor/form-and-field/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/gauge/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/input/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/item/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/link/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/popover/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/select/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/sheet-vs-drawer/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/skeleton/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/styling/SKILL.md +138 -3
- package/skills/aircall-ds/migrate-tractor/tabs/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/toast/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/tooltip/SKILL.md +0 -1
- package/skills/aircall-ds/migrate-tractor/tree/SKILL.md +0 -1
- package/skills/aircall-ds/setup/SKILL.md +33 -1
package/dist/theme.css
CHANGED
|
@@ -967,4 +967,34 @@
|
|
|
967
967
|
[data-theme='dark'] {
|
|
968
968
|
@apply bg-background text-foreground;
|
|
969
969
|
}
|
|
970
|
+
|
|
971
|
+
/*
|
|
972
|
+
* Apply cursor: pointer to all non-disabled interactive elements.
|
|
973
|
+
*
|
|
974
|
+
* Browsers default <button> to cursor: default, not cursor: pointer.
|
|
975
|
+
* Rather than adding cursor-pointer to every component individually, a single
|
|
976
|
+
* base rule handles it globally for all interactive roles.
|
|
977
|
+
*
|
|
978
|
+
* Selectors:
|
|
979
|
+
* - button, [role="button"] — native buttons and Dropzone (<div role="button">)
|
|
980
|
+
* - [role="checkbox"] — Checkbox (Base UI renders a <span role="checkbox">)
|
|
981
|
+
* - [role="radio"] — RadioGroupItem (Base UI renders a <span role="radio">)
|
|
982
|
+
* - [role="switch"] — Switch (Base UI renders a <span role="switch">)
|
|
983
|
+
*
|
|
984
|
+
* Disabled exclusions per selector type:
|
|
985
|
+
* - button / [role="button"]: three :not() needed because Base UI uses
|
|
986
|
+
* aria-disabled (AccordionTrigger) and data-disabled (Toggle) on <button>
|
|
987
|
+
* elements to keep pointer-events alive for tooltips. Without these exclusions
|
|
988
|
+
* this rule's specificity (0,3,1) beats Tailwind's aria-disabled:cursor-not-allowed
|
|
989
|
+
* (0,2,0) and cursor: pointer wins on disabled elements.
|
|
990
|
+
* - [role="checkbox/radio/switch"]: only :not([data-disabled]) needed — Base UI
|
|
991
|
+
* sets data-disabled on these span elements (never aria-disabled or :disabled).
|
|
992
|
+
*/
|
|
993
|
+
button:not(:disabled):not([aria-disabled='true']):not([data-disabled]),
|
|
994
|
+
[role='button']:not(:disabled):not([aria-disabled='true']):not([data-disabled]),
|
|
995
|
+
[role='checkbox']:not([data-disabled]),
|
|
996
|
+
[role='radio']:not([data-disabled]),
|
|
997
|
+
[role='switch']:not([data-disabled]) {
|
|
998
|
+
cursor: pointer;
|
|
999
|
+
}
|
|
970
1000
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,6 @@ description: >
|
|
|
11
11
|
Attachment renders them).
|
|
12
12
|
type: sub-skill
|
|
13
13
|
library: aircall-ds
|
|
14
|
-
library_version: "0.20.0"
|
|
15
14
|
requires:
|
|
16
15
|
- aircall-ds/setup
|
|
17
16
|
sources:
|
|
@@ -64,7 +63,7 @@ AttachmentGroup // optional: scrollable, snapping row of cards
|
|
|
64
63
|
|
|
65
64
|
| Part | Renders | Key props |
|
|
66
65
|
|---|---|---|
|
|
67
|
-
| `Attachment` | `div` | `state` (`idle`/`uploading`/`processing`/`error`/`done`, default `done`), `size` (`default`/`sm`/`xs`), `orientation` (`horizontal`/`vertical`) |
|
|
66
|
+
| `Attachment` | `div` | `state` (`idle`/`uploading`/`processing`/`error`/`done`, default `done`), `size` (`default`/`sm`/`xs`), `orientation` (`horizontal`/`vertical`), `block` (expand to 100% width) |
|
|
68
67
|
| `AttachmentMedia` | `div` | `variant` (`icon` default / `image`) |
|
|
69
68
|
| `AttachmentContent` | `div` | — |
|
|
70
69
|
| `AttachmentTitle` | `span` | — |
|
|
@@ -97,7 +96,7 @@ You don't toggle child classes — only `state` on the root.
|
|
|
97
96
|
| Need | Use |
|
|
98
97
|
|---|---|
|
|
99
98
|
| One file row with a remove button | `Attachment` (horizontal) + `AttachmentAction` |
|
|
100
|
-
| Uniform-width rows in a list |
|
|
99
|
+
| Uniform-width rows in a list | use `block` on each `Attachment` inside a fixed-width column |
|
|
101
100
|
| A scrollable strip of thumbnails | `AttachmentGroup` + `Attachment orientation="vertical"` |
|
|
102
101
|
| Whole card opens a preview/link | add `AttachmentTrigger render={<a … />}` |
|
|
103
102
|
| Compact chips (e.g. in a composer) | `Attachment size="xs"` inside an `AttachmentGroup` |
|
|
@@ -128,7 +127,7 @@ remove button. Map it straight onto the anatomy.
|
|
|
128
127
|
```tsx
|
|
129
128
|
import { FileText, X } from '@aircall/react-icons';
|
|
130
129
|
|
|
131
|
-
<Attachment
|
|
130
|
+
<Attachment block>
|
|
132
131
|
<AttachmentMedia>
|
|
133
132
|
<FileText />
|
|
134
133
|
</AttachmentMedia>
|
|
@@ -146,12 +145,12 @@ import { FileText, X } from '@aircall/react-icons';
|
|
|
146
145
|
|
|
147
146
|
- Icons come from `@aircall/react-icons`, never `lucide-react` directly.
|
|
148
147
|
- Sizing/padding is owned by `size` — drop the `p-3`/`gap-3`/`text-xs` classes.
|
|
149
|
-
- `
|
|
148
|
+
- `block` makes cards fill their container's full width (the root defaults to `w-fit`).
|
|
150
149
|
|
|
151
150
|
### Upload progress
|
|
152
151
|
|
|
153
152
|
```tsx
|
|
154
|
-
<Attachment state={isUploading ? 'uploading' : error ? 'error' : 'done'}
|
|
153
|
+
<Attachment state={isUploading ? 'uploading' : error ? 'error' : 'done'} block>
|
|
155
154
|
<AttachmentMedia>{isUploading ? <Spinner /> : error ? <FileWarning /> : <FileText />}</AttachmentMedia>
|
|
156
155
|
<AttachmentContent>
|
|
157
156
|
<AttachmentTitle>{file.name}</AttachmentTitle>
|
|
@@ -8,7 +8,6 @@ description: >
|
|
|
8
8
|
each Tractor component to its @aircall/ds target and the recipe skill to load next.
|
|
9
9
|
type: core
|
|
10
10
|
library: aircall-ds
|
|
11
|
-
library_version: "0.13.0"
|
|
12
11
|
requires:
|
|
13
12
|
- aircall-ds/setup
|
|
14
13
|
sources:
|
|
@@ -242,11 +241,13 @@ Then load the listed recipe skill (if `available`) for the detailed swap.
|
|
|
242
241
|
| `BannerButton` | `Button` inside `BannerAction` | `@aircall/ds#aircall-ds/migrate-tractor/alert` | available |
|
|
243
242
|
| `Box` | native `<div>` + Tailwind classes | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
|
|
244
243
|
| `Button` | `Button` | `@aircall/ds#aircall-ds/migrate-tractor/button` | available |
|
|
244
|
+
| 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
245
|
| `Checkbox` | `Checkbox` + `<Label>` | — | not-yet |
|
|
246
246
|
| `ComboBox` | `Combobox` (compound) | `@aircall/ds#aircall-ds/migrate-tractor/combobox` | available |
|
|
247
247
|
| `CounterBadge` | `CounterBadge` | `@aircall/ds#aircall-ds/migrate-tractor/badge` | available |
|
|
248
248
|
| `DatePicker` | `Calendar` + your own `Popover` trigger | — | not-yet |
|
|
249
249
|
| `Divider` | `Separator` | `@aircall/ds#aircall-ds/migrate-tractor/divider` | available |
|
|
250
|
+
| `DragAndDrop` / `ConversationDragAndDrop` / react-dropzone (`useDropzone`) + project wrappers (`Dropzone`/`DropzoneV2`) | `Dropzone` | `@aircall/ds#aircall-ds/migrate-tractor/dropzone` | available |
|
|
250
251
|
| `Drawer` | `Drawer` (compound, `DrawerPopup` body) | `@aircall/ds#aircall-ds/migrate-tractor/sheet-vs-drawer` | available |
|
|
251
252
|
| `Dropdown` | `DropdownMenu` (compound) | `@aircall/ds#aircall-ds/migrate-tractor/dropdown-menu` | available |
|
|
252
253
|
| `Flex` | native `<div className="flex …">` + Tailwind | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
|
|
@@ -6,7 +6,6 @@ description: >
|
|
|
6
6
|
Command+Popover search combo from @aircall/tractor.
|
|
7
7
|
type: sub-skill
|
|
8
8
|
library: aircall-ds
|
|
9
|
-
library_version: "0.13.0"
|
|
10
9
|
requires:
|
|
11
10
|
- aircall-ds/setup
|
|
12
11
|
- aircall-ds/migrate-tractor
|
|
@@ -20,6 +19,11 @@ This skill builds on aircall-ds/migrate-tractor. Apply all cross-cutting rules f
|
|
|
20
19
|
|
|
21
20
|
Use `Combobox` when the user needs to **search or filter** options. For a short, fixed-enum list with no search, use `Select` instead (`aircall-ds/migrate-tractor/select`).
|
|
22
21
|
|
|
22
|
+
**Two tiers** (same split as `Table`/`DataTable`):
|
|
23
|
+
|
|
24
|
+
- **`DataCombobox`** — batteries-included, data-driven. Give it an `items` array plus `getItemValue`/`getItemLabel` accessors and it owns selection state, search, infinite scroll, and loading states. **Prefer it** for anything async (search-as-you-type, paginated, loading) — see §5c.
|
|
25
|
+
- **`Combobox` primitives** (compound) — full markup control for static/bespoke cases. Covered by the mapping and examples §2–§5b, and the full-control async fallback §5d.
|
|
26
|
+
|
|
23
27
|
## 2. Component mapping
|
|
24
28
|
|
|
25
29
|
Tractor `ComboBox` was a single self-contained component. DS uses a compound structure where every visual slot is a named part. The old "Command + Popover" search recipe is fully replaced by this same compound.
|
|
@@ -47,7 +51,8 @@ Combobox, ComboboxChip, ComboboxChips, ComboboxChipsInput,
|
|
|
47
51
|
ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup,
|
|
48
52
|
ComboboxInput, ComboboxItem, ComboboxLabel, ComboboxList,
|
|
49
53
|
ComboboxSeparator, ComboboxTrigger, ComboboxValue,
|
|
50
|
-
useComboboxAnchor
|
|
54
|
+
useComboboxAnchor,
|
|
55
|
+
DataCombobox
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
All names used in the Before/After examples below exist in the published public API.
|
|
@@ -176,9 +181,42 @@ function TagPicker() {
|
|
|
176
181
|
}
|
|
177
182
|
```
|
|
178
183
|
|
|
179
|
-
### 5c. Async /
|
|
184
|
+
### 5c. Async / paginated — prefer `DataCombobox`
|
|
185
|
+
|
|
186
|
+
For search-as-you-type, paginated (infinite-scroll), or loading-state options, use the batteries-included **`DataCombobox`** instead of hand-rolling the compound parts. It is the combobox analogue of `DataTable` and mirrors its API (`selectionMode` / `selectedKeys` / `loadingState` / `onFetchMore`).
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import { DataCombobox } from '@aircall/ds';
|
|
190
|
+
|
|
191
|
+
<DataCombobox
|
|
192
|
+
items={results} // the current page you fetched
|
|
193
|
+
getItemValue={r => r.id}
|
|
194
|
+
getItemLabel={r => r.name}
|
|
195
|
+
selectionMode="single"
|
|
196
|
+
selectedKeys={selected}
|
|
197
|
+
onSelectionChange={setSelected}
|
|
198
|
+
onSearch={debouncedFetch} // typing -> fetch; no internal filtering. '' = initial list
|
|
199
|
+
loadingState={loading ? 'filtering' : 'idle'}
|
|
200
|
+
onFetchMore={fetchNextPage}
|
|
201
|
+
hasMore={hasMore}
|
|
202
|
+
emptyState="No matches."
|
|
203
|
+
/>;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
- **`loadingState`**: `'loading'` (skeleton rows on first open), `'filtering'` (current results stay under a dimmed spinner overlay while re-querying), `'loadingMore'` (spinner row at the list bottom while paginating). The `'filtering'` overlay dims the **current rows** — keep the previous `items` during the re-query if you want that context (a `keepPreviousData`/`placeholderData` fetch does this for free). With no rows to dim, the spinner shows in a stable min-height box and the "No results" text is hidden until the query settles. The list stays mounted throughout (only initial `'loading'` shows skeletons), so the search input keeps focus.
|
|
207
|
+
- **`onSearch('')`** — called whenever the query is **cleared** (including Base UI's automatic clear after a selection in multi/overlay layout, and the input's clear (x) button). **Treat `''` as "no query": return the initial, unfiltered list**, not `[]` — returning `[]` blanks the list and strands the user on the last search. Single-select fills the input with the picked label and does not clear, so it never re-fetches on select; only multi/overlay clears on pick.
|
|
208
|
+
- **`onFetchMore` + `hasMore`** drive infinite scroll (an IntersectionObserver sentinel at the list bottom). While paginating, the built-in **client filter is disabled** (it only sees loaded pages and would hide the sentinel, wedging scroll) — so a **searchable paginated list must use `onSearch`** (server-side); don't rely on typeahead.
|
|
209
|
+
- **`selectedItems`** seeds labels for a saved value not yet in `items` (edit forms) — otherwise a selected key with no loaded item can't render its label/chip.
|
|
210
|
+
- **`renderItem`** renders rich rows (avatar/flag + title + description) — compose the `Item` primitives at `size="xs"`.
|
|
211
|
+
- **`renderChip`** (multiple mode) customises the whole selected chip — return a `ComboboxChip` so you can set its `color`/`tone`, e.g. `item => <ComboboxChip color="blue" tone="light">{item.label}</ComboboxChip>`.
|
|
212
|
+
- **`getGroupKey`** (+ optional `getGroupLabel`) groups the flat `items` into labelled sections (first-seen order); selection, keyboard nav, and the async states all work across groups. For arbitrary section markup drop to the compound `ComboboxGroup`/`ComboboxLabel`/`ComboboxSeparator`.
|
|
213
|
+
- **`trigger`** swaps the inline field for a custom trigger button and moves search into the overlay (the "Created by" table-filter pattern). **`searchable={false}`** drops the overlay search input for a short pick-list (e.g. a "Status" filter); keyboard nav + selection still work.
|
|
214
|
+
- **`contentClassName`** sets the dropdown width — default `min-w-50` (200px); use `min-w-0` to hug the anchor or `min-w-80` (320px) for a wider menu.
|
|
215
|
+
- **`onOpenChange(open)`** fires on open/close. For a filter that should apply only once the user is **done** (not on every checkbox toggle), keep the live selection in `onSelectionChange` and commit it in `onOpenChange` on the `false` edge (fires exactly once — prefer over blur).
|
|
216
|
+
|
|
217
|
+
### 5d. Async with full markup control (compound)
|
|
180
218
|
|
|
181
|
-
Control the input value yourself and disable the built-in filter by rendering only the results you fetch.
|
|
219
|
+
Only drop to the compound parts when you need markup `DataCombobox` doesn't expose. Control the input value yourself and disable the built-in filter by rendering only the results you fetch.
|
|
182
220
|
|
|
183
221
|
```tsx
|
|
184
222
|
import {
|
|
@@ -6,7 +6,6 @@ description: >
|
|
|
6
6
|
Covers column definitions, sorting, row selection, loading states, and empty states.
|
|
7
7
|
type: sub-skill
|
|
8
8
|
library: aircall-ds
|
|
9
|
-
library_version: "0.13.0"
|
|
10
9
|
requires:
|
|
11
10
|
- aircall-ds/setup
|
|
12
11
|
- aircall-ds/migrate-tractor
|
|
@@ -341,6 +340,8 @@ Source: `packages/ds/src/components/data-table.tsx`
|
|
|
341
340
|
|
|
342
341
|
Use `virtualizeRows` on any table with 1 000+ rows: infinite-scroll tables that accumulate pages, or static datasets loaded all at once.
|
|
343
342
|
|
|
343
|
+
`virtualizeRows` **implies `fixedLayout`** (`table-layout: fixed`) — the virtualizer needs stable column widths, so every column takes its `size` instead of sizing to content. **Columns without a `size` fall back to TanStack's 150px default.** This is a visible tradeoff: a table that relied on content-based auto widths (e.g. a narrow icon column) will snap to 150px columns the moment you enable virtualization. Give each column def an explicit `size` (`minSize`/`maxSize` optional) that matches the intended width. Verify column widths in the browser — `tsc`/tests won't catch this.
|
|
344
|
+
|
|
344
345
|
```tsx
|
|
345
346
|
// Infinite scroll with virtualization
|
|
346
347
|
function CallsTable() {
|
|
@@ -6,7 +6,6 @@ description: >
|
|
|
6
6
|
when a file imports from react-dropzone or uses DragAndDrop from @aircall/tractor.
|
|
7
7
|
type: sub-skill
|
|
8
8
|
library: aircall-ds
|
|
9
|
-
library_version: "0.13.0"
|
|
10
9
|
requires:
|
|
11
10
|
- aircall-ds/setup
|
|
12
11
|
- aircall-ds/migrate-tractor
|
|
@@ -245,6 +244,36 @@ const [error, setError] = useState<string | null>(null);
|
|
|
245
244
|
|
|
246
245
|
`errorText` / `customError` collapse into consumer state + `<FieldError>`. Pass `error={!!error}` to `<DropzoneContent>` for the destructive red border. `variant` is dropped — use `className` if a custom border color is needed.
|
|
247
246
|
|
|
247
|
+
## 4b. Displaying the dropped files (`Attachment`)
|
|
248
|
+
|
|
249
|
+
`Dropzone` only handles selection — it does **not** render the resulting file list. Render the files collected by `onFiles` as DS `Attachment` items (one `Attachment` per file, wrapped in an `AttachmentGroup`), each with a title, optional size/preview, upload `state`, and a remove action:
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
import {
|
|
253
|
+
Dropzone, AttachmentGroup, Attachment, AttachmentContent,
|
|
254
|
+
AttachmentTitle, AttachmentActions, AttachmentAction,
|
|
255
|
+
} from '@aircall/ds';
|
|
256
|
+
import { X } from '@aircall/react-icons';
|
|
257
|
+
|
|
258
|
+
<Dropzone onFiles={files => setFiles(prev => [...prev, ...files])} />
|
|
259
|
+
<AttachmentGroup>
|
|
260
|
+
{files.map(file => (
|
|
261
|
+
<Attachment key={file.name} block>
|
|
262
|
+
<AttachmentContent>
|
|
263
|
+
<AttachmentTitle>{file.name}</AttachmentTitle>
|
|
264
|
+
</AttachmentContent>
|
|
265
|
+
<AttachmentActions>
|
|
266
|
+
<AttachmentAction aria-label={`Remove ${file.name}`} onClick={() => remove(file)}>
|
|
267
|
+
<X />
|
|
268
|
+
</AttachmentAction>
|
|
269
|
+
</AttachmentActions>
|
|
270
|
+
</Attachment>
|
|
271
|
+
))}
|
|
272
|
+
</AttachmentGroup>;
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Full component map, upload/error `state`, sizes, thumbnails, and the scrollable strip: **`@aircall/ds#aircall-ds/adopt-attachment`**.
|
|
276
|
+
|
|
248
277
|
## 5. Common mistakes
|
|
249
278
|
|
|
250
279
|
### Mistake 1 — Using `onDrop` / `onDropAccepted` instead of `onFiles`
|
|
@@ -8,7 +8,6 @@ description: >
|
|
|
8
8
|
utility classes).
|
|
9
9
|
type: sub-skill
|
|
10
10
|
library: aircall-ds
|
|
11
|
-
library_version: "0.13.0"
|
|
12
11
|
requires:
|
|
13
12
|
- aircall-ds/setup
|
|
14
13
|
- aircall-ds/migrate-tractor
|
|
@@ -259,9 +258,9 @@ Responsive objects become breakpoint prefixes: `m={{ _: 2, md: 4 }}` → `m-2 md
|
|
|
259
258
|
|
|
260
259
|
## 4. Design tokens — colors, radius, helpers
|
|
261
260
|
|
|
262
|
-
### Replacing `getColor` / `getSpace` / `getRadii` / `defaultTheme.*`
|
|
261
|
+
### Replacing `getColor` / `getSpace` / `getRadii` / `getShadow` / `getFontSize` / `defaultTheme.*`
|
|
263
262
|
|
|
264
|
-
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:
|
|
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 `getFontSize(...)` → a `text-*` size class (see Typography §1):
|
|
265
264
|
|
|
266
265
|
```tsx
|
|
267
266
|
// Before
|
|
@@ -324,8 +323,131 @@ Icon color tokens share the text semantic layer — apply `text-*` to the icon's
|
|
|
324
323
|
| `icon-warning` | `text-warning` |
|
|
325
324
|
| `icon-info` | `text-info` |
|
|
326
325
|
|
|
326
|
+
> **High-contrast legend** (referenced below): high-contrast tokens (`*-contrast-*`) do **not** flip light/dark. Two options — (op1) force the section to always dark-mode, or (op2) use the palette color directly. Flag for designer.
|
|
327
|
+
|
|
328
|
+
### Graphic tokens (illustration / SVG fill)
|
|
329
|
+
|
|
330
|
+
`graphic-*` tokens color illustration and SVG fill areas — they map to `fill-*` classes. Alpha variants and a few edge cases need designer sign-off.
|
|
331
|
+
|
|
332
|
+
| Tractor token | Tailwind class | Notes |
|
|
333
|
+
| --- | --- | --- |
|
|
334
|
+
| `graphic-default` | `fill-border` | |
|
|
335
|
+
| `graphic-primary` | — | ⚠ designer decision |
|
|
336
|
+
| `graphic-primary-strong` | `fill-primary` | |
|
|
337
|
+
| `graphic-success` | `fill-success/35` | ⚠ designer decision |
|
|
338
|
+
| `graphic-success-strong` | `fill-success` | |
|
|
339
|
+
| `graphic-critical` | `fill-destructive/35` | ⚠ designer decision |
|
|
340
|
+
| `graphic-critical-strong` | `fill-destructive` | |
|
|
341
|
+
| `graphic-warning` | `fill-warning/35` | ⚠ designer decision |
|
|
342
|
+
| `graphic-warning-strong` | `fill-warning` | |
|
|
343
|
+
| `graphic-info` | `fill-info/35` | ⚠ designer decision |
|
|
344
|
+
| `graphic-info-strong` | `fill-info` | |
|
|
345
|
+
| `graphic-neutral` | `fill-ring` | |
|
|
346
|
+
| `graphic-disabled` | `fill-muted` | |
|
|
347
|
+
| `graphic-disabled-strong` | `fill-muted-foreground` | |
|
|
348
|
+
| `graphic-contrast-dark` | `fill-black` | high-contrast — see legend |
|
|
349
|
+
| `graphic-contrast-light` | `fill-white` | high-contrast — see legend |
|
|
350
|
+
| `graphic-inverted` | — | high-contrast — see legend |
|
|
351
|
+
|
|
352
|
+
For inline SVG where Tailwind classes can't be applied, use the CSS variable directly: `style={{ fill: 'var(--primary)' }}`.
|
|
353
|
+
|
|
354
|
+
### Call type colors
|
|
355
|
+
|
|
356
|
+
`call-*` tokens (`call-answered`, `call-missed`, `call-callback`, `call-voicemail`, `call-abandoned`, `call-assigned`) will be handled by a dedicated call-status DS component. **Do not map them manually** — flag any `call-*` token for designer review.
|
|
357
|
+
|
|
358
|
+
### Interactive tokens (audit reference — all require designer sign-off)
|
|
359
|
+
|
|
360
|
+
> The interaction model changed significantly between Tractor and DS. These tables are a **migration-audit reference**; the final token for each interactive component/page must be confirmed by a designer. DS components (`Button`, `Badge`, `Link`, …) own their interaction states internally — never apply these tokens to them directly.
|
|
361
|
+
|
|
362
|
+
**Alpha notation:** `--token/50` = the colour at 50% **transparency** (the background shows through); `--token + alpha/50` = the colour with a 50% **alpha overlay** (white in light, black in dark) — a solid-looking approximation without blending artefacts.
|
|
363
|
+
|
|
364
|
+
**Interaction principles:**
|
|
365
|
+
1. Most interactive elements signal state through a **background** colour change.
|
|
366
|
+
2. Ghost interactions for Primary/Secondary/Info/Warning are unified into one shared set (`--accent/50` hover, `--accent/80` active).
|
|
367
|
+
3. Only **links** change text colour on interaction; all other text stays at its rest value.
|
|
368
|
+
4. Only **input** field borders change on interaction; other borders do not.
|
|
369
|
+
5. No dedicated "interactive disabled" token — disabled elements get `opacity-50` on the element.
|
|
370
|
+
6. DS components own all their states internally.
|
|
371
|
+
|
|
372
|
+
#### text-interactive-* & icon-interactive-*
|
|
373
|
+
|
|
374
|
+
Only links change text colour on interaction; all other text/icon tokens stay at rest (hover/active handled at the surface layer). Rows marked `text & icon` share the same mapping across both layers.
|
|
375
|
+
|
|
376
|
+
| Tractor | DS token | Notes |
|
|
377
|
+
| --- | --- | --- |
|
|
378
|
+
| `text & icon — interactive-primary` | `--link` | ⚠ pending tech validation |
|
|
379
|
+
| `text & icon — interactive-primary-hover` | `--link-hover` | ⚠ pending tech validation |
|
|
380
|
+
| `text & icon — interactive-primary-active` | `--link-active` | ⚠ pending tech validation |
|
|
381
|
+
| `text-interactive-primary-ghost` | `--primary` | text only · ⚠ designer decision |
|
|
382
|
+
| `text-interactive-secondary` / `icon-interactive-secondary` | `--secondary` | rest · ⚠ designer decision |
|
|
383
|
+
| `*-interactive-secondary-hover` / `-active` | — | ⚠ designer decision |
|
|
384
|
+
| `text-interactive-secondary-ghost` | `--secondary` | text only · ⚠ designer decision |
|
|
385
|
+
| `text & icon — interactive-informative` | `--info` | ⚠ designer decision |
|
|
386
|
+
| `*-interactive-informative-hover` / `-active` | — | ⚠ designer decision |
|
|
387
|
+
| `text-interactive-informative-ghost` | `--info` | text only · ⚠ designer decision |
|
|
388
|
+
| `text-interactive-critical` / `icon-interactive-critical` | `--destructive` | rest · ⚠ designer decision |
|
|
389
|
+
| `*-interactive-critical-hover` / `-active` | — | ⚠ designer decision |
|
|
390
|
+
| `text-interactive-critical-ghost` | `--destructive` | text only · ⚠ designer decision |
|
|
391
|
+
| `text & icon — interactive-warning` | `--warning` | ⚠ designer decision |
|
|
392
|
+
| `*-interactive-warning-hover` / `-active` | — | ⚠ designer decision |
|
|
393
|
+
| `text-interactive-warning-ghost` | `--warning` | text only · ⚠ designer decision |
|
|
394
|
+
| `text-interactive-neutral` / `icon-interactive-default` | `--muted-foreground` | rest · ⚠ designer decision |
|
|
395
|
+
| `text & icon — neutral/default-hover` | `--foreground` | ⚠ designer decision |
|
|
396
|
+
| `text & icon — neutral/default-active` | `--accent-foreground` | ⚠ designer decision |
|
|
397
|
+
| `text & icon — interactive-contrast` (+hover/active) | — | high-contrast — see legend |
|
|
398
|
+
|
|
399
|
+
#### surface-interactive-*
|
|
400
|
+
|
|
401
|
+
Ghost interactions for Primary/Secondary/Info/Warning are unified: ghost hover → `--accent/50`, ghost active → `--accent/80`. Critical ghost keeps its own values. Disabled → `opacity-50` on the element (no background token).
|
|
402
|
+
|
|
403
|
+
| Tractor | DS token | Notes |
|
|
404
|
+
| --- | --- | --- |
|
|
405
|
+
| `surface-interactive-default` | `--background` | rest |
|
|
406
|
+
| `surface-interactive-default-hover` | `--accent + alpha/50` | hover |
|
|
407
|
+
| `surface-interactive-default-active` | `--accent` | active |
|
|
408
|
+
| `surface-interactive-primary` | `--primary` | ⚠ designer decision |
|
|
409
|
+
| `surface-interactive-primary-hover` | `--primary + alpha/90` | ⚠ designer decision |
|
|
410
|
+
| `surface-interactive-primary-active` | `--primary + alpha/60` | ⚠ designer decision |
|
|
411
|
+
| `surface-interactive-secondary` | `--secondary` | ⚠ designer decision |
|
|
412
|
+
| `surface-interactive-secondary-hover` | `--secondary + alpha/80` | ⚠ designer decision |
|
|
413
|
+
| `surface-interactive-secondary-active` | `--secondary + alpha/60` | ⚠ designer decision |
|
|
414
|
+
| `surface-interactive-neutral` | `--accent` | ⚠ designer decision |
|
|
415
|
+
| `surface-interactive-neutral-hover` | `--accent + alpha/50` | ⚠ designer decision |
|
|
416
|
+
| `surface-interactive-neutral-active` | `--accent + alpha/20` | ⚠ designer decision |
|
|
417
|
+
| `surface-interactive-informative` | `--info` | ⚠ designer decision |
|
|
418
|
+
| `surface-interactive-warning` | `--warning` | ⚠ designer decision |
|
|
419
|
+
| `surface-interactive-critical` | `--destructive` | ⚠ designer decision |
|
|
420
|
+
| `surface-interactive-critical-hover` | `--destructive + alpha/90` | ⚠ designer decision |
|
|
421
|
+
| `surface-interactive-critical-active` | `--destructive + alpha/60` | ⚠ designer decision |
|
|
422
|
+
| `*-ghost` (primary/secondary/info/warning) | `transparent` rest, `--accent/50` hover, `--accent/80` active | unified ghost set |
|
|
423
|
+
| `surface-interactive-critical-ghost` (+hover/active) | `--destructive` / `+ alpha/90` / `+ alpha/80` | critical keeps its own |
|
|
424
|
+
| `surface-interactive-disabled` | `opacity-50` | apply on the element |
|
|
425
|
+
| `surface-interactive-contrast-light-alpha` (+hover/active) | `--white/20` → `/40` → `transparent` | high-contrast — see legend |
|
|
426
|
+
|
|
427
|
+
#### graphic-interactive-*
|
|
428
|
+
|
|
429
|
+
All ⚠ designer decisions. Hover/active reuse the rest token (no opacity modifier) — interaction feedback comes from the surrounding surface change instead.
|
|
430
|
+
|
|
431
|
+
| Tractor | DS token | Notes |
|
|
432
|
+
| --- | --- | --- |
|
|
433
|
+
| `graphic-interactive-default` (rest) | `--input` | ⚠ designer decision |
|
|
434
|
+
| `graphic-interactive-default-hover` / `-active` | `--ring` | ⚠ designer decision |
|
|
435
|
+
| `graphic-interactive-primary` (+hover/active) | `--primary` | ⚠ designer decision |
|
|
436
|
+
| `graphic-interactive-informative` (+hover/active) | `--info` | ⚠ designer decision |
|
|
437
|
+
| `graphic-interactive-secondary` (+hover/active) | `--secondary` | ⚠ designer decision |
|
|
438
|
+
| `graphic-interactive-critical` (+hover/active) | `--destructive` | ⚠ designer decision |
|
|
439
|
+
| `graphic-interactive-warning` (+hover/active) | `--warning` | ⚠ designer decision |
|
|
440
|
+
| `*-ghost` variants (all colours) | — | ⚠ designer decision |
|
|
441
|
+
| `graphic-interactive-contrast-light-alpha` (+hover/active) | `white/10` → `white/20` → `transparent` | high-contrast — see legend |
|
|
442
|
+
|
|
443
|
+
### Component colors — props/variants, not token overrides
|
|
444
|
+
|
|
445
|
+
DS component colors come from **props and variants**, not CSS-token overrides. If you find code overriding a token on a scoped element to restyle a DS component (e.g. overriding `--primary` to recolor a `Button`), do **not** migrate that pattern — flag it as a designer decision; the correct fix is selecting the right component variant.
|
|
446
|
+
|
|
327
447
|
### Border radius
|
|
328
448
|
|
|
449
|
+
DS derives its named scale from a 10px base radius (`--radius: 0.625rem`).
|
|
450
|
+
|
|
329
451
|
| Tractor token | Tailwind class | Notes |
|
|
330
452
|
| --- | --- | --- |
|
|
331
453
|
| `none` | `rounded-none` | Exact |
|
|
@@ -338,6 +460,19 @@ Icon color tokens share the text semantic layer — apply `text-*` to the icon's
|
|
|
338
460
|
|
|
339
461
|
`xs` and `md` have no exact DS equivalent — flag for visual QA.
|
|
340
462
|
|
|
463
|
+
#### DS conventions by use
|
|
464
|
+
|
|
465
|
+
When authoring new rounding (not mapping a Tractor token), prefer the named scale for the element type. Prefer named scales over hardcoded values (`rounded-[8px]`) — the named scale tracks the theme.
|
|
466
|
+
|
|
467
|
+
| Use | Class | Value |
|
|
468
|
+
| --- | --- | --- |
|
|
469
|
+
| Inputs, buttons, dropdown items | `rounded-md` | 8px |
|
|
470
|
+
| Cards, panels | `rounded-lg` | 10px |
|
|
471
|
+
| Dialog, Sheet | `rounded-2xl` | 16px |
|
|
472
|
+
| Alert | `rounded-3xl` | 24px |
|
|
473
|
+
| Badge | `rounded-4xl` | — |
|
|
474
|
+
| Pills, avatars, fully-round controls | `rounded-full` | 9999px |
|
|
475
|
+
|
|
341
476
|
### Palette tokens and raw colors — designer sign-off required
|
|
342
477
|
|
|
343
478
|
If you encounter a **palette token** (e.g. `primary.500`, `critical.700`, `neutral-200`) or a **raw hex/rgb color** in the codebase, **do not map it yourself**. Flag it for designer review. The tables above cover only Tractor _semantic_ tokens (no trailing number), which can be migrated directly.
|