@aircall/blocks 0.6.0 → 0.7.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.
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: aircall-blocks/setup
3
+ description: >
4
+ Set up @aircall/blocks in an app already (or simultaneously) adopting @aircall/ds.
5
+ Load when wiring blocks compositions (DashboardPage, DashboardPageHeader,
6
+ DashboardSidebar, empty states, form fields) into a project: installing the
7
+ package, importing its precompiled globals.css after the DS bundle, and the DS
8
+ providers it relies on.
9
+ type: core
10
+ library: aircall-blocks
11
+ library_version: "0.5.1"
12
+ requires:
13
+ - aircall-ds/setup
14
+ sources:
15
+ - "aircall/hydra:docs/migration-guides/tractor-to-ds/00-setup.md"
16
+ - "aircall/hydra:packages/blocks/package.json"
17
+ ---
18
+
19
+ # Setting up @aircall/blocks
20
+
21
+ This skill builds on aircall-ds/setup. Read it first: blocks compose `@aircall/ds`
22
+ primitives and depend on DS being installed and its `globals.css` imported.
23
+
24
+ ## Setup
25
+
26
+ Install blocks alongside DS:
27
+
28
+ ```bash
29
+ pnpm add @aircall/blocks @aircall/ds @aircall/react-icons
30
+ ```
31
+
32
+ Import the blocks bundle **after** the DS bundle from your JS/TS entry. It carries
33
+ the page-layout grid and block-only tokens on top of DS:
34
+
35
+ ```tsx
36
+ // main.tsx
37
+ import '@aircall/ds/globals.css';
38
+ import '@aircall/blocks/globals.css';
39
+ ```
40
+
41
+ Blocks render under the same DS providers — there is no blocks-specific provider; mount the
42
+ DS root providers from `aircall-ds/setup` as needed (`ThemeProvider` / `TooltipProvider` /
43
+ `Toaster`). Two DS providers matter specifically once you use blocks:
44
+
45
+ - **`DsI18nProvider`** (from `@aircall/ds`) — importing `@aircall/blocks` runs
46
+ `import './i18n/register'` at module load (`packages/blocks/src/index.ts`), which registers
47
+ a `blocks` namespace on DS's shared i18next instance. Block strings render localized off the
48
+ self-initialized DS singleton even without a provider; to make DS + blocks strings follow the
49
+ **user's** language (and track switches), mount `DsI18nProvider` **as a descendant of your
50
+ react-i18next `I18nextProvider`** and pass the active language (`language={i18n.language}`).
51
+ Use **either** `DsI18nProvider` **or** `syncDsLanguage(i18n)`, never both. See
52
+ `aircall-ds/setup` for the full provider tree and nesting order.
53
+ - **`NotificationQueueProvider` + `NotificationSlot`** (from `@aircall/ds`) — needed only if
54
+ your block compositions surface notifications/banners: wrap `NotificationQueueProvider`
55
+ (props `{ children }`) above any notification caller, and render a `NotificationSlot
56
+ slot="page"` (props `{ slot: string; className? }`) inside it.
57
+
58
+ Source: `packages/blocks/src/index.ts`; `@aircall/ds` `DsI18nProvider` / `NotificationQueueProvider`.
59
+
60
+ ## Core Patterns
61
+
62
+ ### Use a block composition
63
+
64
+ ```tsx
65
+ import {
66
+ DashboardPageHeader,
67
+ DashboardPageHeaderTitle,
68
+ } from '@aircall/blocks';
69
+
70
+ function CampaignsHeader() {
71
+ return (
72
+ <DashboardPageHeader>
73
+ <DashboardPageHeaderTitle size="lg">Campaigns</DashboardPageHeaderTitle>
74
+ </DashboardPageHeader>
75
+ );
76
+ }
77
+ ```
78
+
79
+ ## Common Mistakes
80
+
81
+ ### HIGH — Importing blocks globals before DS globals (or omitting DS globals)
82
+
83
+ Wrong:
84
+
85
+ ```tsx
86
+ import '@aircall/blocks/globals.css';
87
+ import '@aircall/ds/globals.css';
88
+ ```
89
+
90
+ Correct:
91
+
92
+ ```tsx
93
+ import '@aircall/ds/globals.css';
94
+ import '@aircall/blocks/globals.css';
95
+ ```
96
+
97
+ The blocks bundle layers page-layout tokens on top of the DS reset/tokens; loading it first (or without DS) leaves block compositions with missing base tokens and broken layout.
98
+
99
+ Source: aircall/hydra:docs/migration-guides/tractor-to-ds/00-setup.md (§3)
100
+
101
+ ### MEDIUM — Installing @aircall/blocks without @aircall/ds
102
+
103
+ Wrong:
104
+
105
+ ```bash
106
+ pnpm add @aircall/blocks
107
+ ```
108
+
109
+ Correct:
110
+
111
+ ```bash
112
+ pnpm add @aircall/blocks @aircall/ds
113
+ ```
114
+
115
+ Blocks import from `@aircall/ds` at runtime; without it the blocks barrel fails to resolve its peer and the build breaks.
116
+
117
+ Source: aircall/hydra:packages/blocks/package.json (peerDependencies)
118
+
119
+ ### MEDIUM — Expecting a separate BlocksProvider
120
+
121
+ Wrong: searching for a `BlocksProvider` to mount.
122
+
123
+ Correct: blocks render under the DS providers from aircall-ds/setup; mount those, not a blocks-specific provider.
124
+
125
+ There is no blocks-specific provider; assuming one wastes time and produces dead wiring.
126
+
127
+ Source: aircall/hydra:docs/migration-guides/tractor-to-ds/00-setup.md (§4)