@aircall/ds 0.30.0 → 0.31.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aircall/ds",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "sideEffects": [
@@ -3,7 +3,7 @@ name: aircall-ds/migrate-tractor
3
3
  description: >
4
4
  Migrate a file from @aircall/tractor to @aircall/ds. Load FIRST when converting
5
5
  Tractor components (Modal, Banner, Select, Button, Typography, Flex, Tooltip, Tag,
6
- Dropdown, Form, …) to @aircall/ds. Carries the cross-cutting rules (import form,
6
+ Dropdown, Form, ...) to @aircall/ds. Carries the cross-cutting rules (import form,
7
7
  prop renames, the render prop, data-attribute shape) and a lookup table mapping
8
8
  each Tractor component to its @aircall/ds target and the recipe skill to load next.
9
9
  type: core
@@ -17,29 +17,29 @@ sources:
17
17
 
18
18
  # Migrating from @aircall/tractor to @aircall/ds
19
19
 
20
- Load this skill first for any Tractor → DS migration. It gives the cross-cutting
20
+ Load this skill first for any Tractor -> DS migration. It gives the cross-cutting
21
21
  rules that apply to every component and a lookup table to find the DS replacement.
22
22
  Then load the component-specific recipe skill from the `recipe to load` column.
23
23
 
24
24
  ## How to run this migration (end-to-end)
25
25
 
26
26
  This skill and its recipes cover *converting code*. The full migration is a repeatable
27
- loop — do it incrementally, one file/screen at a time, shipping each green:
27
+ loop - do it incrementally, one file/screen at a time, shipping each green:
28
28
 
29
- 0. **Set up once** — load `@aircall/ds#aircall-ds/setup` and do the wiring before any
29
+ 0. **Set up once** - load `@aircall/ds#aircall-ds/setup` and do the wiring before any
30
30
  conversion: install `@aircall/ds` + `@aircall/react-icons` (>= 0.4.0), import the
31
31
  precompiled `globals.css`, mount the root providers (incl. `DsI18nProvider` under
32
32
  react-i18next + `NotificationQueueProvider`), keep `TractorProvider` mounted for
33
33
  cohabitation, and add the jsdom test shims (selector guard for DS popups +
34
34
  Switch-via-hidden-checkbox). DS and Tractor run side by side until the last Tractor
35
- import is gone. (This skill `requires` setup so it loads automatically — but do the
35
+ import is gone. (This skill `requires` setup so it loads automatically - but do the
36
36
  install/provider/jest wiring first.)
37
- 1. **Inventory** — list the file's `@aircall/tractor` and `@aircall/icons` imports. Each
37
+ 1. **Inventory** - list the file's `@aircall/tractor` and `@aircall/icons` imports. Each
38
38
  maps to a row in the lookup table below, or to `@aircall/ds#aircall-ds/migrate-icons`
39
39
  for icons.
40
- 2. **Migrate** — apply the cross-cutting rules (§1–§3), then load the per-component recipe
40
+ 2. **Migrate** - apply the cross-cutting rules (sections 1-3), then load the per-component recipe
41
41
  from the `recipe to load` column for each component; use `migrate-icons` for icons.
42
- 3. **Verify green** — `tsc --noEmit`, the test suite (DS popups/Switch need the setup jsdom
42
+ 3. **Verify green** - `tsc --noEmit`, the test suite (DS popups/Switch need the setup jsdom
43
43
  shims), and biome/lint. Re-screenshot if the screen changed visually.
44
44
  4. **Repeat** per file/screen until no `@aircall/tractor` / `@aircall/icons` imports remain,
45
45
  then drop them from `package.json`.
@@ -71,7 +71,7 @@ const Styled = styled(Button)`font-size: ${fromTheme('typography.variants.body.f
71
71
  <div className="mx-2 my-4 bg-primary" />
72
72
  ```
73
73
 
74
- The migration is progressive — Tractor and DS can coexist. Remove `TractorProvider`
74
+ The migration is progressive - Tractor and DS can coexist. Remove `TractorProvider`
75
75
  only when the last `@aircall/tractor` import is gone.
76
76
 
77
77
  ## 3. Standard prop renames
@@ -86,9 +86,9 @@ These apply to every component that had them in Tractor:
86
86
  | `onChange` (boolean: Checkbox, Switch) | `onCheckedChange` |
87
87
  | `validationStatus="error"` | `aria-invalid={true}` |
88
88
  | `variant="critical"` | `variant="destructive"` (Button) |
89
- | `as="…"` | `render={<Element />}` |
89
+ | `as="..."` | `render={<Element />}` |
90
90
 
91
- > `onValueChange` for Select receives `(value: string | null, event)` — `null` when
91
+ > `onValueChange` for Select receives `(value: string | null, event)` - `null` when
92
92
  > cleared. Widen your handler to accept `null`.
93
93
 
94
94
  ## 4. The `render` prop (replaces `asChild`)
@@ -102,7 +102,7 @@ When a Trigger or Close must render as a custom element, pass it to `render`:
102
102
  Affected: Trigger/Close on Dialog, Sheet, Popover, Tooltip, DropdownMenu, Collapsible,
103
103
  Drawer, plus `Button`, `Badge`, `Item`, `PaginationLink`, and Sidebar subcomponents.
104
104
 
105
- Drawer is Base UI (via Coss UI) — same `render` rule applies. Its body wrapper is
105
+ Drawer is Base UI (via Coss UI) - same `render` rule applies. Its body wrapper is
106
106
  `DrawerPopup` (not `DrawerContent`), and Tractor's `direction` becomes `position`.
107
107
 
108
108
  ## 5. Labels live inside Groups
@@ -120,7 +120,7 @@ For `DropdownMenu` and `Select`, `Label` must be a child of a `*Group`:
120
120
 
121
121
  ## 6. Data attributes in Tailwind classes
122
122
 
123
- DS uses single-key data attributes for state (not Radix `[state=…]` form):
123
+ DS uses single-key data attributes for state (not Radix `[state=...]` form):
124
124
 
125
125
  | Use | Not |
126
126
  | --- | --- |
@@ -128,7 +128,7 @@ DS uses single-key data attributes for state (not Radix `[state=…]` form):
128
128
  | `data-checked:bg-primary` | `data-[state=checked]:bg-primary` |
129
129
  | `data-disabled:opacity-50` | `data-[disabled]:opacity-50` |
130
130
 
131
- **Orientation is the exception** — it's a value attribute, not a flag. Style with
131
+ **Orientation is the exception** - it's a value attribute, not a flag. Style with
132
132
  `data-[orientation=horizontal]:` / `data-[orientation=vertical]:` (Tabs, Slider,
133
133
  Separator).
134
134
 
@@ -137,7 +137,7 @@ Separator).
137
137
 
138
138
  ## 7. Size baselines
139
139
 
140
- > These are recommended starting points. Verify with design — pixel sizes have shifted
140
+ > These are recommended starting points. Verify with design - pixel sizes have shifted
141
141
  > between Tractor and DS, so a verbatim same-size match isn't always possible.
142
142
 
143
143
  **Button** (DS heights: `sm`=24px, `default`=32px, `lg`=40px):
@@ -187,11 +187,11 @@ Tractor used `variant` + `mode`. DS uses a single `variant`.
187
187
  | `primary` + `mode="ghost"` | `ghost` (Button) |
188
188
  | `primary` + `mode="link"` | `link` (Button) |
189
189
 
190
- Each DS component has its own variant set — check the lookup table below.
190
+ Each DS component has its own variant set - check the lookup table below.
191
191
 
192
192
  ## 9. Icons
193
193
 
194
- `@aircall/icons` → `@aircall/react-icons`. The `<Icon component={X} />` wrapper is
194
+ `@aircall/icons` -> `@aircall/react-icons`. The `<Icon component={X} />` wrapper is
195
195
  gone; import the icon directly:
196
196
 
197
197
  ```tsx
@@ -204,14 +204,14 @@ import { AddCircleFill } from '@aircall/react-icons';
204
204
  <AddCircleFill className="mr-2 size-4" />
205
205
  ```
206
206
 
207
- Some names differ significantly (e.g. `InfoCircleFilled` → `InformationCircleFill`,
208
- `PlayFilled` → `ControlPlayFill`).
207
+ Some names differ significantly (e.g. `InfoCircleFilled` -> `InformationCircleFill`,
208
+ `PlayFilled` -> `ControlPlayFill`).
209
209
 
210
210
  ## 10. Forms & validation
211
211
 
212
- A Tractor `Form`/`FormItem` that collects and submits data migrates to **`@aircall/blocks` `useForm` + the `Form*Field` wrappers** — do NOT keep field values in React `useState`, and do NOT hand-wire the ds `Field`/`Input` primitives. The form owns state, validation, dirty/`canSubmit`/`isSubmitting`, and errors (which drive `SubmitButton`/`CardSaveBar`). Use the bare ds `Field` primitives only for non-form display. See `@aircall/ds#aircall-ds/migrate-tractor/form-and-field` and `@aircall/blocks#aircall-blocks/migrate-dashboard/form-wizard`.
212
+ A Tractor `Form`/`FormItem` that collects and submits data migrates to **`@aircall/blocks` `useForm` + the `Form*Field` wrappers** - do NOT keep field values in React `useState`, and do NOT hand-wire the ds `Field`/`Input` primitives. The form owns state, validation, dirty/`canSubmit`/`isSubmitting`, and errors (which drive `SubmitButton`/`CardSaveBar`). Use the bare ds `Field` primitives only for non-form display. See `@aircall/ds#aircall-ds/migrate-tractor/form-and-field` and `@aircall/blocks#aircall-blocks/migrate-dashboard/form-wizard`.
213
213
 
214
- Field-level validation state is `aria-invalid` — DS components style themselves from it:
214
+ Field-level validation state is `aria-invalid` - DS components style themselves from it:
215
215
 
216
216
  ```tsx
217
217
  <Input aria-invalid={hasError} />
@@ -220,7 +220,7 @@ Field-level validation state is `aria-invalid` — DS components style themselve
220
220
  ## 11. Cleanup items
221
221
 
222
222
  - **Base font size**: Tractor used 14px. DS uses 16px. Remove any `font-size: 14px`
223
- on `html` or `body` — DS's `globals.css` already sets the correct base.
223
+ on `html` or `body` - DS's `globals.css` already sets the correct base.
224
224
  - **SVG workarounds**: Remove any `svg { display: block; line-height: 0; }` global CSS.
225
225
 
226
226
  ---
@@ -242,52 +242,54 @@ Then load the listed recipe skill (if `available`) for the detailed swap.
242
242
  | `Box` | native `<div>` + Tailwind classes | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
243
243
  | `Button` | `Button` | `@aircall/ds#aircall-ds/migrate-tractor/button` | available |
244
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
- | `Checkbox` | `Checkbox` + `<Label>` | — | not-yet |
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
- | `DatePicker` | `Calendar` + your own `Popover` trigger | — | not-yet |
248
+ | `DatePicker` | `DatePicker` (single mode, `value: Date`, `onValueChange`) | `@aircall/ds#aircall-ds/migrate-tractor/date-picker` | available |
249
+ | `DateSelect` (range + predefined shortcuts) | `DatePicker` (range mode, `value: DateRange`, `onRangeChange`, `predefinedRanges`) | `@aircall/ds#aircall-ds/migrate-tractor/date-picker` | available |
249
250
  | `Divider` | `Separator` | `@aircall/ds#aircall-ds/migrate-tractor/divider` | available |
250
251
  | `DragAndDrop` / `ConversationDragAndDrop` / react-dropzone (`useDropzone`) + project wrappers (`Dropzone`/`DropzoneV2`) | `Dropzone` | `@aircall/ds#aircall-ds/migrate-tractor/dropzone` | available |
251
252
  | `Drawer` | `Drawer` (compound, `DrawerPopup` body) | `@aircall/ds#aircall-ds/migrate-tractor/sheet-vs-drawer` | available |
252
253
  | `Dropdown` | `DropdownMenu` (compound) | `@aircall/ds#aircall-ds/migrate-tractor/dropdown-menu` | available |
253
- | `Flex` | native `<div className="flex …">` + Tailwind | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
254
- | `FlagIcon` | `CountryFlag` (prop: `countryIsoCode`) | — | not-yet |
254
+ | `Flex` | native `<div className="flex ...">` + Tailwind | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
255
+ | `FlagIcon` | `CountryFlag` (prop: `countryIsoCode`) | - | not-yet |
255
256
  | `Form` | native `<form>` + `Field` per row | `@aircall/ds#aircall-ds/migrate-tractor/form-and-field` | available |
256
257
  | `FormItem` | `Field` + `FieldLabel` + `FieldDescription` + `FieldError` | `@aircall/ds#aircall-ds/migrate-tractor/form-and-field` | available |
257
258
  | `Gauge` | `Gauge` (8-segment audio meter) | `@aircall/ds#aircall-ds/migrate-tractor/gauge` | available |
258
- | `Grid` | native `<div className="grid …">` + Tailwind | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
259
+ | `Grid` | native `<div className="grid ...">` + Tailwind | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
259
260
  | `Icon` | direct icon import from `@aircall/react-icons` | `@aircall/ds#aircall-ds/migrate-icons` | available |
260
261
  | `IconButton` | `Button` with `size` `icon` / `icon-sm` / `icon-lg` | `@aircall/ds#aircall-ds/migrate-tractor/button` | available |
261
262
  | `Link` | `Link` | `@aircall/ds#aircall-ds/migrate-tractor/link` | available |
262
263
  | `List` (+ `ListItem`) | `ItemGroup` + `Item` + `ItemMedia`/`ItemContent`/`ItemActions` | `@aircall/ds#aircall-ds/migrate-tractor/item` | available |
263
- | `Menu` (+ `MenuItem`) | standalone list → `ItemGroup` + `Item`; **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 |
264
+ | `Menu` (+ `MenuItem`) | standalone list -> `ItemGroup` + `Item`; **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 |
264
265
  | `Modal` | `Dialog` (compound) | `@aircall/ds#aircall-ds/migrate-tractor/dialog` | available |
265
266
  | `PasswordInput` | `InputGroup` recipe | `@aircall/ds#aircall-ds/migrate-tractor/input` | available |
266
267
  | `Popover` | `Popover` + `PopoverTrigger` + `PopoverContent` | `@aircall/ds#aircall-ds/migrate-tractor/popover` | available |
267
- | `Progress` | `Progress` (compound: `ProgressTrack` + `ProgressIndicator`) | — | not-yet |
268
+ | `Progress` | `Progress` (compound: `ProgressTrack` + `ProgressIndicator`) | - | not-yet |
268
269
  | `QuickAvatar` | `Avatar` (same as Avatar row) | `@aircall/ds#aircall-ds/migrate-tractor/avatar` | available |
269
- | `Radio` + `RadioGroup` | `RadioGroup` + `RadioGroupItem` | — | not-yet |
270
+ | `Radio` + `RadioGroup` | `RadioGroup` + `RadioGroupItem` | - | not-yet |
270
271
  | `SegmentedControl` | `Tabs` (with panel) or `ToggleGroup` (visual only) | `@aircall/ds#aircall-ds/migrate-tractor/tabs` | available |
271
272
  | `Select` + `SelectOption` | `Select` (compound: `SelectTrigger` + `SelectValue` + `SelectContent` + `SelectGroup` + `SelectItem`) | `@aircall/ds#aircall-ds/migrate-tractor/select` | available |
272
- | `SidenavDropdown` | `Sidebar` + `Collapsible` (compose) | — | not-yet |
273
- | `SidenavItem` | `Sidebar*` family | — | not-yet |
274
- | `Skeleton` | `Skeleton` — size via Tailwind (`className="h-4 w-32"`) | `@aircall/ds#aircall-ds/migrate-tractor/skeleton` | available |
275
- | `Slider` | `Slider` (`onValueChange`, value is `number[]`, no `size`) | — | not-yet |
273
+ | `SidenavDropdown` | `Sidebar` + `Collapsible` (compose) | - | not-yet |
274
+ | `SidenavItem` | `Sidebar*` family | - | not-yet |
275
+ | `Skeleton` | `Skeleton` - size via Tailwind (`className="h-4 w-32"`) | `@aircall/ds#aircall-ds/migrate-tractor/skeleton` | available |
276
+ | `Slider` | `Slider` (`onValueChange`, value is `number[]`, no `size`) | - | not-yet |
276
277
  | `Spacer` | `<div className="flex flex-col gap-*">` or `FieldGroup` | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
277
- | `SpinnerOutlined` | `Spinner` (sizes: `sm`/`default`/`lg`/`xl`, always animated) | — | not-yet |
278
+ | `SpinnerOutlined` | `Spinner` (sizes: `sm`/`default`/`lg`/`xl`, always animated) | - | not-yet |
278
279
  | `Tab` (+ `Tab.Item`/`TabList`/`TabPanel`) | `Tabs` + `TabsTrigger` + `TabsList` + `TabsContent` | `@aircall/ds#aircall-ds/migrate-tractor/tabs` | available |
279
280
  | `Table` (+ `ActionBar`) | `DataTable` (data-driven) or `Table` primitive (static) | `@aircall/ds#aircall-ds/migrate-tractor/data-table` | available |
280
281
  | `Tag` | `Badge` (`color` + `tone` props; `legacyColor` for custom hex) | `@aircall/ds#aircall-ds/migrate-tractor/badge` | available |
281
- | `Textarea` | `Textarea` (no `size`, use `aria-invalid`) | — | not-yet |
282
+ | `Textarea` | `Textarea` (no `size`, use `aria-invalid`) | - | not-yet |
282
283
  | `TextFieldInput` | `Input` (no `sizing`, 40px fixed, use `aria-invalid`) | `@aircall/ds#aircall-ds/migrate-tractor/input` | available |
283
- | `Toggle` | `Switch` (`onCheckedChange`, no `size`) | — | not-yet |
284
- | `ToggleGroup` / `TabToggle` | `ToggleGroup` (`multiple` boolean; value always `string[]`) | — | not-yet |
284
+ | `Toggle` | `Switch` (`onCheckedChange`, no `size`) | - | not-yet |
285
+ | `ToggleGroup` / `TabToggle` | `ToggleGroup` (`multiple` boolean; value always `string[]`) | - | not-yet |
286
+ | Day-of-week toggle row (custom) | `DaysPicker` (`labels: Record<DayOfWeek,string>`, `value: DayOfWeek[]`, `onValueChange`) | - | available |
285
287
  | `Tooltip` | `Tooltip` (compound) + `TooltipProvider` at app root | `@aircall/ds#aircall-ds/migrate-tractor/tooltip` | available |
286
288
  | `Tree` | `DataTree` (data-driven) or `Tree` primitive | `@aircall/ds#aircall-ds/migrate-tractor/tree` | available |
287
- | `TreeSelect` | no turn-key equivalent — `DataTree` inside a `Popover` | `@aircall/ds#aircall-ds/migrate-tractor/tree` | available |
289
+ | `TreeSelect` | no turn-key equivalent - `DataTree` inside a `Popover` | `@aircall/ds#aircall-ds/migrate-tractor/tree` | available |
288
290
  | `Typography` | native HTML + Tailwind text classes | `@aircall/ds#aircall-ds/migrate-tractor/styling` | available |
289
291
  | `useToast` | `toast` from `sonner` + `<Toaster />` at app root | `@aircall/ds#aircall-ds/migrate-tractor/toast` | available |
290
- | `WhatsAppTemplatePreview` | — (no DS equivalent) | — | not-yet |
292
+ | `WhatsAppTemplatePreview` | - (no DS equivalent) | - | not-yet |
291
293
 
292
294
  ---
293
295
 
@@ -295,21 +297,21 @@ Then load the listed recipe skill (if `available`) for the detailed swap.
295
297
 
296
298
  These APIs do not exist in DS. Do not propose them.
297
299
 
298
- - `<Input sizing="lg" />` — Input has **no** `sizing`/`size` prop. It is 40px, period.
299
- - `<Textarea size="…" />` — no size prop.
300
- - `<Switch size="…" />` — no size prop.
301
- - `<Checkbox size="…" />` — no size prop.
302
- - `<RadioGroup size="…" />` — no size prop.
303
- - `<Slider size="…" />` — no size prop.
304
- - `<Tabs size="…" />` / `<TabsList variant="…" />` — no such props.
305
- - `<Badge variant="destructive" | "success" | "warning" | "info" />` — Badge has only
300
+ - `<Input sizing="lg" />` - Input has **no** `sizing`/`size` prop. It is 40px, period.
301
+ - `<Textarea size="..." />` - no size prop.
302
+ - `<Switch size="..." />` - no size prop.
303
+ - `<Checkbox size="..." />` - no size prop.
304
+ - `<RadioGroup size="..." />` - no size prop.
305
+ - `<Slider size="..." />` - no size prop.
306
+ - `<Tabs size="..." />` / `<TabsList variant="..." />` - no such props.
307
+ - `<Badge variant="destructive" | "success" | "warning" | "info" />` - Badge has only
306
308
  `default`, `secondary`, `outline`. For semantic colors use `Alert`, `CounterBadge`,
307
309
  or `className` with a semantic token.
308
- - `<Alert variant="destructive" />` — Alert's error variant is `error`, not
310
+ - `<Alert variant="destructive" />` - Alert's error variant is `error`, not
309
311
  `destructive`. Full set: `default` / `info` / `success` / `warning` / `error`.
310
- - `<CounterBadge count={…} max={…} />` — no `count`/`max` props. Pass the already-
312
+ - `<CounterBadge count={...} max={...} />` - no `count`/`max` props. Pass the already-
311
313
  capped value as children. Variants: `default` / `secondary` / `ghost`.
312
- - `<TooltipProvider delayDuration={…} />` — Base UI prop is `delay`, default `0`.
314
+ - `<TooltipProvider delayDuration={...} />` - Base UI prop is `delay`, default `0`.
313
315
  `delayDuration` is silently ignored.
314
- - Subpath imports like `@aircall/ds/components/<name>` — never propose. Always use
316
+ - Subpath imports like `@aircall/ds/components/<name>` - never propose. Always use
315
317
  `import { X } from '@aircall/ds'`.
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: aircall-ds/migrate-tractor/date-picker
3
+ description: >
4
+ Migrate Tractor DatePicker (single) and DateSelect (range + predefined shortcuts)
5
+ to @aircall/ds DatePicker. Also covers migrating ad-hoc day-of-week toggle rows
6
+ to @aircall/ds DaysPicker.
7
+ type: recipe
8
+ library: aircall-ds
9
+ library_version: "0.22.0"
10
+ requires:
11
+ - aircall-ds/migrate-tractor
12
+ ---
13
+
14
+ # Migrating DatePicker / DateSelect / DaysPicker
15
+
16
+ ## Tractor DatePicker -> DS DatePicker (single mode)
17
+
18
+ ```tsx
19
+ // Before (Tractor)
20
+ import { DatePicker } from '@aircall/tractor';
21
+ <DatePicker
22
+ value={date}
23
+ onChange={setDate}
24
+ label="Appointment date"
25
+ disabled={isLoading}
26
+ />
27
+
28
+ // After (DS)
29
+ import { DatePicker, FieldLabel, Field } from '@aircall/ds';
30
+ <Field>
31
+ <FieldLabel htmlFor="appointment-date">Appointment date</FieldLabel>
32
+ <DatePicker
33
+ id="appointment-date"
34
+ value={date}
35
+ onValueChange={setDate}
36
+ disabled={isLoading}
37
+ />
38
+ </Field>
39
+ ```
40
+
41
+ **Key prop renames:**
42
+ | Tractor | DS |
43
+ |---|---|
44
+ | `onChange` | `onValueChange` |
45
+ | `label` | Use `<FieldLabel>` outside the component |
46
+ | `isOpen` | `open` |
47
+ | `onClose` | `onOpenChange` |
48
+ | `validationStatus="error"` | `invalid={true}` |
49
+
50
+ ## Tractor DateSelect -> DS DatePicker (range mode)
51
+
52
+ ```tsx
53
+ // Before (Tractor)
54
+ import { DateSelect } from '@aircall/tractor';
55
+ <DateSelect
56
+ value={range}
57
+ onChange={setRange}
58
+ predefinedRanges={[
59
+ { label: 'Last 7 days', from: subDays(today, 7), to: today }
60
+ ]}
61
+ />
62
+
63
+ // After (DS)
64
+ import { DatePicker } from '@aircall/ds';
65
+ <DatePicker
66
+ mode="range"
67
+ value={range}
68
+ onRangeChange={(r, { matchedRangeId }) => setRange(r)}
69
+ predefinedRanges={[
70
+ { label: 'Last 7 days', from: subDays(today, 7), to: today, id: 'last-7' }
71
+ ]}
72
+ />
73
+ ```
74
+
75
+ The segmented input shows raw per-segment values; there is no formatted trigger-label string, so no label algorithm is reproduced from Tractor DateSelect.
76
+
77
+ ## Ad-hoc day-of-week toggles -> DaysPicker
78
+
79
+ ```tsx
80
+ // Before (custom)
81
+ const DAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
82
+ <div className="flex gap-1">
83
+ {DAYS.map(day => (
84
+ <button
85
+ key={day}
86
+ className={selected.includes(day) ? 'bg-primary text-white' : ''}
87
+ onClick={() => toggle(day)}
88
+ >
89
+ {t(`days.${day}`)}
90
+ </button>
91
+ ))}
92
+ </div>
93
+
94
+ // After (blocks)
95
+ import { DaysPicker, type DayOfWeek } from '@aircall/blocks';
96
+ <DaysPicker
97
+ value={selected}
98
+ onValueChange={setSelected}
99
+ />
100
+ ```
101
+
102
+ **Key differences:**
103
+ - `DaysPicker` is in `@aircall/blocks`, NOT `@aircall/ds`. Import from `@aircall/blocks`.
104
+ - Visible single-letter labels and full-name aria-labels are always derived from the blocks
105
+ i18n instance (en/fr/es/de/it). There are no `labels` or `ariaLabels` override props.
106
+ - Order is fixed Mon->Sun. Consumer cannot reorder.
107
+ - `onValueChange` receives the full updated `DayOfWeek[]` list.
108
+ - `value` is `DayOfWeek[]` (not `string[]`). `DayOfWeek` is exported from `@aircall/blocks`.
109
+
110
+ ## DS DatePicker input model
111
+
112
+ The DS DatePicker is a SEGMENTED date input: day, month, and year are separate
113
+ editable fields (each rendered as `role="spinbutton"`). Segment focus is
114
+ type-only -- the Calendar does NOT open on focus. The calendar opens via the
115
+ calendar icon button (right side of the input group) or Alt+ArrowDown while any
116
+ segment is focused. On open, focus moves into the calendar grid; on close (Escape
117
+ or day pick), focus returns to the icon button (trap-focus). There is NO `variant`
118
+ prop and NO separate readonly or typeable mode -- there is a single segmented input.
119
+
120
+ Segment order is derived from the locale (e.g. MM/DD/YYYY in en-US, DD/MM/YYYY
121
+ in fr-FR). If a `dateFormat` prop appears in existing code, note that it is
122
+ removed from the DS DatePicker API -- it never controlled segment order; locale does.
123
+
124
+ The `placeholder` prop is also not supported: each segment self-labels with a
125
+ locale-derived placeholder (`dd`, `mm`, `yyyy`). Remove any `placeholder` prop
126
+ from migrated code.
127
+
128
+ **Migrating from Tractor variants:** all Tractor DatePicker variants
129
+ (`icon-right`, `icon-left`, `no-icon`, `with-button`) map to the single DS
130
+ segmented DatePicker. There is no icon-left/icon-right/no-icon/with-button
131
+ choice in the DS API.
132
+
133
+ ## minDate / maxDate -- selection bounds
134
+
135
+ `minDate` and `maxDate` are selection bounds, not year clamps:
136
+
137
+ - Day cells outside the bounds are greyed and unclickable in the calendar.
138
+ - Typing a date outside the bounds reverts the segments to the last committed value
139
+ and emits a transient accessible hint (via `aria-live`). `onValueChange` is NOT called.
140
+ - The year segment is NOT clamped to yearMin/yearMax when typing. Validity is judged
141
+ only on the completed date.
142
+ - `aria-valuemin`/`aria-valuemax` on the year segment still reflect the bounds for
143
+ screen-reader affordance.
144
+
145
+ ## disabledDates -- full RDP Matcher support
146
+
147
+ `disabledDates` supports the full react-day-picker Matcher set:
148
+ - `Date` -- a specific date
149
+ - `Date[]` -- an array of specific dates
150
+ - `{ before: Date }` -- all dates before (exclusive)
151
+ - `{ after: Date }` -- all dates after (exclusive)
152
+ - `{ from: Date, to: Date }` -- a date range
153
+ - `{ dayOfWeek: number[] }` -- specific days of the week (0=Sunday)
154
+ - `(date: Date) => boolean` -- predicate function
155
+
156
+ The same constraint is enforced identically for typed input and calendar clicks.
157
+ Typed disabled dates revert to the last committed value with a "not available" hint.