@freightos/freightwind 2.1.1 → 2.1.3

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.
@@ -1,252 +1,252 @@
1
- # Components Overview
2
-
3
- ## Component list
4
-
5
- | Component | Purpose | Key props |
6
- |-----------|---------|-----------|
7
- | `Button` | Primary action trigger | `variant`, `size`, `icon`, `loading`, `tooltip`, `fullWidth` |
8
- | `Alert` | Contextual feedback banner | `variant`, `title`, `message`, `closable`, `callToAction` |
9
- | `Avatar` | User or entity representation | `variant`, `size`, `icon`, `title`, `flag`, `src` |
10
- | `Badge` | Numeric indicator or status dot | `value`, `size`, `variant`, `status`, `text` |
11
- | `Checkbox` | Boolean or indeterminate toggle | `checked`, `onCheckedChange`, `disabled`, `error`, `children` |
12
- | `Chip` | Compact label with optional badge | `variant`, `icon`, `closable`, `badge`, `children` |
13
- | `MessageProvider` / `message` | Toast notifications | Provider wraps app; `message.success()`, `.info()`, `.warning()`, `.error()` |
14
- | `PopConfirm` | Confirmation popover | `title`, `onConfirm`, `onCancel`, `placement`, `slotProps` |
15
- | `RadioButtonGroup` | Segmented button selection | `options`, `value`, `onValueChange`, `size`, `orientation` |
16
- | `RadioGroup` / `RadioGroupItem` | Traditional radio selection | Standard Radix RadioGroup API |
17
- | `Slider` | Range value selector | `value`, `onValueChange`, `min`, `max`, `step` |
18
- | `Switch` | On/off toggle | `checked`, `onCheckedChange`, `disabled`, `error`, `size`, `children` |
19
- | `Tooltip` | Contextual hover information | `message`, `placement`, `children` |
20
-
21
- ## Button
22
-
23
- The most commonly used component. Always use `Button` for clickable actions.
24
-
25
- ```tsx
26
- import { Button } from '@freightos/freightwind';
27
-
28
- // Primary action
29
- <Button variant="default" size="md">Submit</Button>
30
-
31
- // Secondary action
32
- <Button variant="secondary">Cancel</Button>
33
-
34
- // Danger action
35
- <Button variant="danger">Delete</Button>
36
-
37
- // Icon-only button (tooltip is required)
38
- <Button icon="search" tooltip="Search" />
39
-
40
- // Loading state
41
- <Button loading>Saving...</Button>
42
-
43
- // Toggle button
44
- <Button variant="toggle" active={isActive}>Grid View</Button>
45
- ```
46
-
47
- **Variants**: `default` (primary blue), `secondary` (outlined blue), `tertiary` (text-only blue), `link` (text link), `danger` (red), `danger-ghost` (outlined red), `toggle` (gray border, blue when active).
48
-
49
- **Sizes**: `sm` (24px height), `md` (32px height, default), `lg` (40px height).
50
-
51
- **Icon-only buttons** must have a `tooltip` prop for accessibility. Pass icon names in kebab-case: `icon="search"`, `icon="close"`, `icon="settings"`.
52
-
53
- ## Alert
54
-
55
- Contextual feedback banner with icon, optional title, message, and close button.
56
-
57
- ```tsx
58
- import { Alert } from '@freightos/freightwind';
59
-
60
- // Simple message-only alert
61
- <Alert variant="info" message="Your shipment has been updated." />
62
-
63
- // Alert with title
64
- <Alert variant="warning" title="Attention" message="Rate expires in 24 hours." />
65
-
66
- // Closable alert
67
- <Alert variant="success" message="Saved!" closable onClose={() => {}} />
68
-
69
- // Alert with call-to-action (only when no title)
70
- <Alert variant="error" message="Connection failed." callToAction={<Button size="sm" variant="danger">Retry</Button>} />
71
- ```
72
-
73
- **Variants**: `info` (blue), `success` (green), `warning` (yellow), `error` (red), `special` (purple).
74
-
75
- ## Avatar
76
-
77
- User or entity representation. Content priority: `src` > `flag` > `title` > `icon` > default user placeholder.
78
-
79
- ```tsx
80
- import { Avatar } from '@freightos/freightwind';
81
-
82
- // Image avatar
83
- <Avatar src="https://example.com/photo.jpg" alt="John" />
84
-
85
- // Country flag
86
- <Avatar flag="US" />
87
-
88
- // Initial letter
89
- <Avatar title="John Doe" />
90
-
91
- // Icon avatar
92
- <Avatar icon="settings" variant="info" />
93
-
94
- // Sized avatar
95
- <Avatar title="JD" size="lg" bordered />
96
- ```
97
-
98
- **Sizes**: `xs` (16px), `sm` (24px), `md` (32px, default), `lg` (40px), `xl` (58px).
99
-
100
- **Variants**: `default` (purple), `info` (blue), `secondary` (light blue), `warning` (yellow), `neutral` (gray), `positive` (green), `filled` (white bg), `ghost` (transparent).
101
-
102
- ## Badge
103
-
104
- Numeric indicator or status dot. Can wrap a child element for positioning.
105
-
106
- ```tsx
107
- import { Badge } from '@freightos/freightwind';
108
-
109
- // Standalone count badge
110
- <Badge value={5} />
111
-
112
- // Badge wrapping an icon/button
113
- <Badge value={3}><IconBell size={20} /></Badge>
114
-
115
- // Status dot with text
116
- <Badge status="success" text="Active" />
117
-
118
- // Numbers over 99 display as "99+"
119
- <Badge value={150} />
120
- ```
121
-
122
- ## Checkbox
123
-
124
- Boolean or indeterminate toggle with optional label.
125
-
126
- ```tsx
127
- import { Checkbox } from '@freightos/freightwind';
128
-
129
- // With label
130
- <Checkbox checked={value} onCheckedChange={setValue}>Accept terms</Checkbox>
131
-
132
- // Without label
133
- <Checkbox checked={value} onCheckedChange={setValue} />
134
-
135
- // Indeterminate state
136
- <Checkbox checked="indeterminate" onCheckedChange={setValue}>Select all</Checkbox>
137
-
138
- // Error state
139
- <Checkbox error>Required field</Checkbox>
140
- ```
141
-
142
- ## Chip
143
-
144
- Compact label with optional icon, badge, and close button.
145
-
146
- ```tsx
147
- import { Chip } from '@freightos/freightwind';
148
-
149
- // Basic chip
150
- <Chip>Active</Chip>
151
-
152
- // With variant and icon
153
- <Chip variant="success" icon="check-circled">Approved</Chip>
154
-
155
- // With badge count
156
- <Chip variant="info" badge={3}>Notifications</Chip>
157
-
158
- // Closable
159
- <Chip closable onClose={() => {}}>Filter</Chip>
160
- ```
161
-
162
- **Variants**: `default` (purple), `neutral` (gray), `info` (light blue), `highlight` (bright blue), `warning` (yellow), `success` (green), `notice` (light red), `error` (red).
163
-
164
- ## Switch
165
-
166
- On/off toggle with optional label.
167
-
168
- ```tsx
169
- import { Switch } from '@freightos/freightwind';
170
-
171
- // With label
172
- <Switch checked={value} onCheckedChange={setValue}>Enable notifications</Switch>
173
-
174
- // Without label
175
- <Switch checked={value} onCheckedChange={setValue} />
176
-
177
- // Sizes
178
- <Switch size="sm">Small switch</Switch>
179
- <Switch size="lg">Large switch</Switch>
180
- ```
181
-
182
- ## RadioButtonGroup
183
-
184
- Segmented button selector. Use for choosing between 2-5 mutually exclusive options.
185
-
186
- ```tsx
187
- import { RadioButtonGroup } from '@freightos/freightwind';
188
-
189
- <RadioButtonGroup
190
- options={[
191
- { value: 'list', label: 'List' },
192
- { value: 'grid', label: 'Grid' },
193
- { value: 'map', label: 'Map' },
194
- ]}
195
- value={view}
196
- onValueChange={setView}
197
- size="md"
198
- />
199
- ```
200
-
201
- ## Slider
202
-
203
- Range value selector.
204
-
205
- ```tsx
206
- import { Slider } from '@freightos/freightwind';
207
-
208
- <Slider value={[50]} onValueChange={setValue} min={0} max={100} step={1} />
209
- ```
210
-
211
- ## Tooltip
212
-
213
- Hover tooltip. Wraps any element.
214
-
215
- ```tsx
216
- import { Tooltip } from '@freightos/freightwind';
217
-
218
- <Tooltip message="Click to save" placement="top">
219
- <Button>Save</Button>
220
- </Tooltip>
221
- ```
222
-
223
- **Placements**: `top`, `bottom`, `start`, `end`, `top-start`, `top-end`, `bottom-start`, `bottom-end`.
224
-
225
- ## PopConfirm
226
-
227
- Confirmation popover. Wraps a trigger element.
228
-
229
- ```tsx
230
- import { PopConfirm } from '@freightos/freightwind';
231
-
232
- <PopConfirm title="Are you sure you want to delete this?" onConfirm={handleDelete}>
233
- <Button variant="danger">Delete</Button>
234
- </PopConfirm>
235
- ```
236
-
237
- ## MessageProvider / message
238
-
239
- Toast notification system. Add `MessageProvider` once at the app root, then call `message.*()` anywhere.
240
-
241
- ```tsx
242
- import { MessageProvider, message } from '@freightos/freightwind';
243
-
244
- // In your root layout:
245
- <MessageProvider />
246
-
247
- // Anywhere in your app:
248
- message.success('Shipment created successfully');
249
- message.error('Failed to save changes');
250
- message.warning('Rate expires soon');
251
- message.info('New update available');
252
- ```
1
+ # Components Overview
2
+
3
+ ## Component list
4
+
5
+ | Component | Purpose | Key props |
6
+ |-----------|---------|-----------|
7
+ | `Button` | Primary action trigger | `variant`, `size`, `icon`, `loading`, `tooltip`, `fullWidth` |
8
+ | `Alert` | Contextual feedback banner | `variant`, `title`, `message`, `closable`, `callToAction` |
9
+ | `Avatar` | User or entity representation | `variant`, `size`, `icon`, `title`, `flag`, `src` |
10
+ | `Badge` | Numeric indicator or status dot | `value`, `size`, `variant`, `status`, `text` |
11
+ | `Checkbox` | Boolean or indeterminate toggle | `checked`, `onCheckedChange`, `disabled`, `error`, `children` |
12
+ | `Chip` | Compact label with optional badge | `variant`, `icon`, `closable`, `badge`, `children` |
13
+ | `MessageProvider` / `message` | Toast notifications | Provider wraps app; `message.success()`, `.info()`, `.warning()`, `.error()` |
14
+ | `PopConfirm` | Confirmation popover | `title`, `onConfirm`, `onCancel`, `placement`, `slotProps` |
15
+ | `RadioButtonGroup` | Segmented button selection | `options`, `value`, `onValueChange`, `size`, `orientation` |
16
+ | `RadioGroup` / `RadioGroupItem` | Traditional radio selection | Standard Radix RadioGroup API |
17
+ | `Slider` | Range value selector | `value`, `onValueChange`, `min`, `max`, `step` |
18
+ | `Switch` | On/off toggle | `checked`, `onCheckedChange`, `disabled`, `error`, `size`, `children` |
19
+ | `Tooltip` | Contextual hover information | `message`, `placement`, `children` |
20
+
21
+ ## Button
22
+
23
+ The most commonly used component. Always use `Button` for clickable actions.
24
+
25
+ ```tsx
26
+ import { Button } from '@freightos/freightwind';
27
+
28
+ // Primary action
29
+ <Button variant="default" size="md">Submit</Button>
30
+
31
+ // Secondary action
32
+ <Button variant="secondary">Cancel</Button>
33
+
34
+ // Danger action
35
+ <Button variant="danger">Delete</Button>
36
+
37
+ // Icon-only button (tooltip is required)
38
+ <Button icon="search" tooltip="Search" />
39
+
40
+ // Loading state
41
+ <Button loading>Saving...</Button>
42
+
43
+ // Toggle button
44
+ <Button variant="toggle" active={isActive}>Grid View</Button>
45
+ ```
46
+
47
+ **Variants**: `default` (primary blue), `secondary` (outlined blue), `tertiary` (text-only blue), `link` (text link), `danger` (red), `danger-ghost` (outlined red), `toggle` (gray border, blue when active).
48
+
49
+ **Sizes**: `sm` (24px height), `md` (32px height, default), `lg` (40px height).
50
+
51
+ **Icon-only buttons** must have a `tooltip` prop for accessibility. Pass icon names in kebab-case: `icon="search"`, `icon="close"`, `icon="settings"`.
52
+
53
+ ## Alert
54
+
55
+ Contextual feedback banner with icon, optional title, message, and close button.
56
+
57
+ ```tsx
58
+ import { Alert } from '@freightos/freightwind';
59
+
60
+ // Simple message-only alert
61
+ <Alert variant="info" message="Your shipment has been updated." />
62
+
63
+ // Alert with title
64
+ <Alert variant="warning" title="Attention" message="Rate expires in 24 hours." />
65
+
66
+ // Closable alert
67
+ <Alert variant="success" message="Saved!" closable onClose={() => {}} />
68
+
69
+ // Alert with call-to-action (only when no title)
70
+ <Alert variant="error" message="Connection failed." callToAction={<Button size="sm" variant="danger">Retry</Button>} />
71
+ ```
72
+
73
+ **Variants**: `info` (blue), `success` (green), `warning` (yellow), `error` (red), `special` (purple).
74
+
75
+ ## Avatar
76
+
77
+ User or entity representation. Content priority: `src` > `flag` > `title` > `icon` > default user placeholder.
78
+
79
+ ```tsx
80
+ import { Avatar } from '@freightos/freightwind';
81
+
82
+ // Image avatar
83
+ <Avatar src="https://example.com/photo.jpg" alt="John" />
84
+
85
+ // Country flag
86
+ <Avatar flag="US" />
87
+
88
+ // Initial letter
89
+ <Avatar title="John Doe" />
90
+
91
+ // Icon avatar
92
+ <Avatar icon="settings" variant="info" />
93
+
94
+ // Sized avatar
95
+ <Avatar title="JD" size="lg" bordered />
96
+ ```
97
+
98
+ **Sizes**: `xs` (16px), `sm` (24px), `md` (32px, default), `lg` (40px), `xl` (58px).
99
+
100
+ **Variants**: `default` (purple), `info` (blue), `secondary` (light blue), `warning` (yellow), `neutral` (gray), `positive` (green), `filled` (white bg), `ghost` (transparent).
101
+
102
+ ## Badge
103
+
104
+ Numeric indicator or status dot. Can wrap a child element for positioning.
105
+
106
+ ```tsx
107
+ import { Badge } from '@freightos/freightwind';
108
+
109
+ // Standalone count badge
110
+ <Badge value={5} />
111
+
112
+ // Badge wrapping an icon/button
113
+ <Badge value={3}><IconBell size={20} /></Badge>
114
+
115
+ // Status dot with text
116
+ <Badge status="success" text="Active" />
117
+
118
+ // Numbers over 99 display as "99+"
119
+ <Badge value={150} />
120
+ ```
121
+
122
+ ## Checkbox
123
+
124
+ Boolean or indeterminate toggle with optional label.
125
+
126
+ ```tsx
127
+ import { Checkbox } from '@freightos/freightwind';
128
+
129
+ // With label
130
+ <Checkbox checked={value} onCheckedChange={setValue}>Accept terms</Checkbox>
131
+
132
+ // Without label
133
+ <Checkbox checked={value} onCheckedChange={setValue} />
134
+
135
+ // Indeterminate state
136
+ <Checkbox checked="indeterminate" onCheckedChange={setValue}>Select all</Checkbox>
137
+
138
+ // Error state
139
+ <Checkbox error>Required field</Checkbox>
140
+ ```
141
+
142
+ ## Chip
143
+
144
+ Compact label with optional icon, badge, and close button.
145
+
146
+ ```tsx
147
+ import { Chip } from '@freightos/freightwind';
148
+
149
+ // Basic chip
150
+ <Chip>Active</Chip>
151
+
152
+ // With variant and icon
153
+ <Chip variant="success" icon="check-circled">Approved</Chip>
154
+
155
+ // With badge count
156
+ <Chip variant="info" badge={3}>Notifications</Chip>
157
+
158
+ // Closable
159
+ <Chip closable onClose={() => {}}>Filter</Chip>
160
+ ```
161
+
162
+ **Variants**: `default` (purple), `neutral` (gray), `info` (light blue), `highlight` (bright blue), `warning` (yellow), `success` (green), `notice` (light red), `error` (red).
163
+
164
+ ## Switch
165
+
166
+ On/off toggle with optional label.
167
+
168
+ ```tsx
169
+ import { Switch } from '@freightos/freightwind';
170
+
171
+ // With label
172
+ <Switch checked={value} onCheckedChange={setValue}>Enable notifications</Switch>
173
+
174
+ // Without label
175
+ <Switch checked={value} onCheckedChange={setValue} />
176
+
177
+ // Sizes
178
+ <Switch size="sm">Small switch</Switch>
179
+ <Switch size="lg">Large switch</Switch>
180
+ ```
181
+
182
+ ## RadioButtonGroup
183
+
184
+ Segmented button selector. Use for choosing between 2-5 mutually exclusive options.
185
+
186
+ ```tsx
187
+ import { RadioButtonGroup } from '@freightos/freightwind';
188
+
189
+ <RadioButtonGroup
190
+ options={[
191
+ { value: 'list', label: 'List' },
192
+ { value: 'grid', label: 'Grid' },
193
+ { value: 'map', label: 'Map' },
194
+ ]}
195
+ value={view}
196
+ onValueChange={setView}
197
+ size="md"
198
+ />
199
+ ```
200
+
201
+ ## Slider
202
+
203
+ Range value selector.
204
+
205
+ ```tsx
206
+ import { Slider } from '@freightos/freightwind';
207
+
208
+ <Slider value={[50]} onValueChange={setValue} min={0} max={100} step={1} />
209
+ ```
210
+
211
+ ## Tooltip
212
+
213
+ Hover tooltip. Wraps any element.
214
+
215
+ ```tsx
216
+ import { Tooltip } from '@freightos/freightwind';
217
+
218
+ <Tooltip message="Click to save" placement="top">
219
+ <Button>Save</Button>
220
+ </Tooltip>
221
+ ```
222
+
223
+ **Placements**: `top`, `bottom`, `start`, `end`, `top-start`, `top-end`, `bottom-start`, `bottom-end`.
224
+
225
+ ## PopConfirm
226
+
227
+ Confirmation popover. Wraps a trigger element.
228
+
229
+ ```tsx
230
+ import { PopConfirm } from '@freightos/freightwind';
231
+
232
+ <PopConfirm title="Are you sure you want to delete this?" onConfirm={handleDelete}>
233
+ <Button variant="danger">Delete</Button>
234
+ </PopConfirm>
235
+ ```
236
+
237
+ ## MessageProvider / message
238
+
239
+ Toast notification system. Add `MessageProvider` once at the app root, then call `message.*()` anywhere.
240
+
241
+ ```tsx
242
+ import { MessageProvider, message } from '@freightos/freightwind';
243
+
244
+ // In your root layout:
245
+ <MessageProvider />
246
+
247
+ // Anywhere in your app:
248
+ message.success('Shipment created successfully');
249
+ message.error('Failed to save changes');
250
+ message.warning('Rate expires soon');
251
+ message.info('New update available');
252
+ ```
@@ -1,52 +1,52 @@
1
- # Icons
2
-
3
- FreightWind uses `@freightos/freightwind/icons` as a peer dependency for all iconography.
4
-
5
- ## Direct icon imports
6
-
7
- For standalone icon usage, import directly from `@freightos/freightwind/icons`:
8
-
9
- ```tsx
10
- import { IconSearch, IconClose, IconUser, IconRisk } from '@freightos/freightwind/icons';
11
-
12
- <IconSearch size={16} />
13
- <IconClose size={20} className="text-fds-gray-80" />
14
- ```
15
-
16
- All icons accept `size` (number, in px) and `className` props. Icons inherit `currentColor` by default.
17
-
18
- ## Icon prop on components
19
-
20
- Components like `Button`, `Avatar`, and `Chip` accept an `icon` prop with a kebab-case name string:
21
-
22
- ```tsx
23
- <Button icon="search" tooltip="Search" />
24
- <Avatar icon="settings" />
25
- <Chip icon="check-circled">Done</Chip>
26
- ```
27
-
28
- Do NOT pass React components to the `icon` prop — use the kebab-case string name.
29
-
30
- ## Common icon names
31
-
32
- | Name | Component | Usage |
33
- |------|-----------|-------|
34
- | `search` | `IconSearch` | Search actions |
35
- | `close` | `IconClose` | Close/dismiss actions |
36
- | `user` | `IconUser` | User profiles |
37
- | `settings` | `IconSettings` | Settings/gear |
38
- | `risk` | `IconRisk` | Warning/caution |
39
- | `check-circled` | `IconCheckCircled` | Success/confirmation |
40
- | `info-circled` | `IconInfoCircled` | Information |
41
- | `clear-circled` | `IconClearCircled` | Error/negative |
42
- | `arrow-down` | `IconArrowDown` | Directional |
43
- | `arrow-up` | `IconArrowUp` | Directional |
44
- | `edit` | `IconEdit` | Edit actions |
45
- | `delete` | `IconDelete` | Delete actions |
46
- | `download` | `IconDownload` | Download actions |
47
- | `upload` | `IconUpload` | Upload actions |
48
- | `bookmark` | `IconBookmark` | Bookmark/save |
49
-
50
- ## Icon style
51
-
52
- All icons use stroke-only outlines (`stroke="currentColor"`). They are designed at 24px but scale cleanly to any size.
1
+ # Icons
2
+
3
+ FreightWind uses `@freightos/freightwind/icons` as a peer dependency for all iconography.
4
+
5
+ ## Direct icon imports
6
+
7
+ For standalone icon usage, import directly from `@freightos/freightwind/icons`:
8
+
9
+ ```tsx
10
+ import { IconSearch, IconClose, IconUser, IconRisk } from '@freightos/freightwind/icons';
11
+
12
+ <IconSearch size={16} />
13
+ <IconClose size={20} className="text-fds-gray-80" />
14
+ ```
15
+
16
+ All icons accept `size` (number, in px) and `className` props. Icons inherit `currentColor` by default.
17
+
18
+ ## Icon prop on components
19
+
20
+ Components like `Button`, `Avatar`, and `Chip` accept an `icon` prop with a kebab-case name string:
21
+
22
+ ```tsx
23
+ <Button icon="search" tooltip="Search" />
24
+ <Avatar icon="settings" />
25
+ <Chip icon="check-circled">Done</Chip>
26
+ ```
27
+
28
+ Do NOT pass React components to the `icon` prop — use the kebab-case string name.
29
+
30
+ ## Common icon names
31
+
32
+ | Name | Component | Usage |
33
+ |------|-----------|-------|
34
+ | `search` | `IconSearch` | Search actions |
35
+ | `close` | `IconClose` | Close/dismiss actions |
36
+ | `user` | `IconUser` | User profiles |
37
+ | `settings` | `IconSettings` | Settings/gear |
38
+ | `risk` | `IconRisk` | Warning/caution |
39
+ | `check-circled` | `IconCheckCircled` | Success/confirmation |
40
+ | `info-circled` | `IconInfoCircled` | Information |
41
+ | `clear-circled` | `IconClearCircled` | Error/negative |
42
+ | `arrow-down` | `IconArrowDown` | Directional |
43
+ | `arrow-up` | `IconArrowUp` | Directional |
44
+ | `edit` | `IconEdit` | Edit actions |
45
+ | `delete` | `IconDelete` | Delete actions |
46
+ | `download` | `IconDownload` | Download actions |
47
+ | `upload` | `IconUpload` | Upload actions |
48
+ | `bookmark` | `IconBookmark` | Bookmark/save |
49
+
50
+ ## Icon style
51
+
52
+ All icons use stroke-only outlines (`stroke="currentColor"`). They are designed at 24px but scale cleanly to any size.