@ceed/cds 1.22.3 → 1.22.4

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.
Files changed (44) hide show
  1. package/dist/components/data-display/InfoSign.md +74 -91
  2. package/dist/components/data-display/Typography.md +363 -63
  3. package/dist/components/feedback/CircularProgress.md +257 -0
  4. package/dist/components/feedback/Skeleton.md +280 -0
  5. package/dist/components/feedback/llms.txt +2 -0
  6. package/dist/components/inputs/ButtonGroup.md +115 -104
  7. package/dist/components/inputs/CurrencyInput.md +181 -8
  8. package/dist/components/inputs/DatePicker.md +108 -436
  9. package/dist/components/inputs/DateRangePicker.md +130 -496
  10. package/dist/components/inputs/FilterableCheckboxGroup.md +141 -20
  11. package/dist/components/inputs/FormControl.md +368 -0
  12. package/dist/components/inputs/IconButton.md +137 -88
  13. package/dist/components/inputs/Input.md +203 -77
  14. package/dist/components/inputs/MonthPicker.md +95 -427
  15. package/dist/components/inputs/MonthRangePicker.md +89 -471
  16. package/dist/components/inputs/PercentageInput.md +183 -19
  17. package/dist/components/inputs/RadioButton.md +163 -35
  18. package/dist/components/inputs/RadioList.md +241 -0
  19. package/dist/components/inputs/RadioTileGroup.md +146 -62
  20. package/dist/components/inputs/Select.md +219 -328
  21. package/dist/components/inputs/Slider.md +334 -0
  22. package/dist/components/inputs/Switch.md +143 -376
  23. package/dist/components/inputs/Textarea.md +209 -11
  24. package/dist/components/inputs/Uploader/Uploader.md +145 -66
  25. package/dist/components/inputs/llms.txt +3 -0
  26. package/dist/components/navigation/Breadcrumbs.md +57 -308
  27. package/dist/components/navigation/Drawer.md +180 -0
  28. package/dist/components/navigation/Dropdown.md +98 -215
  29. package/dist/components/navigation/IconMenuButton.md +40 -502
  30. package/dist/components/navigation/InsetDrawer.md +281 -650
  31. package/dist/components/navigation/Link.md +31 -348
  32. package/dist/components/navigation/Menu.md +92 -285
  33. package/dist/components/navigation/MenuButton.md +55 -448
  34. package/dist/components/navigation/Pagination.md +47 -338
  35. package/dist/components/navigation/Stepper.md +160 -28
  36. package/dist/components/navigation/Tabs.md +57 -316
  37. package/dist/components/surfaces/Accordions.md +49 -804
  38. package/dist/components/surfaces/Card.md +97 -157
  39. package/dist/components/surfaces/Divider.md +83 -234
  40. package/dist/components/surfaces/Sheet.md +152 -327
  41. package/dist/guides/ThemeProvider.md +89 -0
  42. package/dist/guides/llms.txt +9 -0
  43. package/dist/llms.txt +8 -0
  44. package/package.json +1 -1
@@ -2,7 +2,9 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- The Link component is a navigational element that allows users to navigate between pages or external resources. Built on Joy UI's Link, it provides consistent styling and accessibility features while supporting various visual styles and text hierarchy levels. Links are fundamental to web navigation and should be used to connect related content within your application.
5
+ The Link component is a navigational element that allows users to move between pages or access external resources. Built on top of Joy UI's Link, it provides consistent styling, multiple visual variants, and comprehensive accessibility features out of the box.
6
+
7
+ Links are fundamental to web navigation. Use them to connect related content, reference external documentation, or enable movement between sections of your application. For actions that do not navigate (such as submitting a form or opening a modal), use a Button instead.
6
8
 
7
9
  ```tsx
8
10
  <Link
@@ -27,15 +29,12 @@ import { Link } from '@ceed/cds';
27
29
  function MyComponent() {
28
30
  return (
29
31
  <div>
30
- {/* Basic link */}
31
32
  <Link href="/about">About Us</Link>
32
33
 
33
- {/* External link */}
34
34
  <Link href="https://example.com" target="_blank" rel="noopener noreferrer">
35
35
  External Site
36
36
  </Link>
37
37
 
38
- {/* Styled link */}
39
38
  <Link href="/contact" color="primary" underline="hover">
40
39
  Contact
41
40
  </Link>
@@ -44,153 +43,23 @@ function MyComponent() {
44
43
  }
45
44
  ```
46
45
 
47
- ## Examples
48
-
49
- ### Basic Link
50
-
51
- The default link appearance with plain variant.
52
-
53
- ```tsx
54
- <Link
55
- children="Link"
56
- variant="plain"
57
- />
58
- ```
59
-
60
- ### Variants
61
-
62
- Links support different visual styles through the variant prop.
63
-
64
- ```
65
- <Canvas of={Link.Variants} />
66
- ```
67
-
68
- ### Colors
69
-
70
- Apply different semantic colors to links.
71
-
72
- ```
73
- <Canvas of={Link.Colors} />
74
- ```
75
-
76
- ### Underline Styles
77
-
78
- Control the underline behavior of links.
79
-
80
- ```
81
- <Canvas of={Link.Underline} />
82
- ```
83
-
84
- ### Typography Levels
85
-
86
- Links can inherit or specify typography levels for different text hierarchies.
87
-
88
- ```
89
- <Canvas of={Link.Levels} />
90
- ```
91
-
92
- ### Disabled State
93
-
94
- Links can be disabled to prevent interaction.
95
-
96
- ```
97
- <Canvas of={Link.Disabled} />
98
- ```
99
-
100
- ### External Links
101
-
102
- Links to external resources with proper security attributes.
103
-
104
- ```
105
- <Canvas of={Link.ExternalLink} />
106
- ```
107
-
108
- ### Inline with Text
109
-
110
- Links can be seamlessly integrated within paragraph text.
111
-
112
- ```
113
- <Canvas of={Link.InlineWithText} />
114
- ```
115
-
116
- ## When to Use
117
-
118
- ### ✅ Good Use Cases
119
-
120
- - **Page navigation**: Moving between different pages or sections within your app
121
- - **External resources**: Linking to external websites, documentation, or references
122
- - **In-context references**: Linking related content mentioned in text
123
- - **Skip navigation**: Accessibility links for keyboard users
124
- - **Breadcrumbs**: Navigation hierarchy indicators
125
- - **Footer navigation**: Site-wide links in footer sections
126
-
127
- ### ❌ When Not to Use
128
-
129
- - **Actions that don't navigate**: Use Button instead for actions like submitting forms, opening modals, or triggering events
130
- - **Primary calls to action**: Use Button for prominent actions users should take
131
- - **Menu items**: Use MenuItem components within navigation menus
132
- - **Tab navigation**: Use Tabs component for content switching within a page
133
- - **Cards/clickable areas**: Use Card with onClick or a wrapping anchor element
134
-
135
46
  ## Common Use Cases
136
47
 
137
- ### Navigation Menu Links
138
-
139
- ```tsx
140
- function NavigationMenu() {
141
- return (
142
- <nav>
143
- <Stack direction="row" spacing={3}>
144
- <Link href="/" color="neutral" underline="none">
145
- Home
146
- </Link>
147
- <Link href="/products" color="neutral" underline="none">
148
- Products
149
- </Link>
150
- <Link href="/about" color="neutral" underline="none">
151
- About
152
- </Link>
153
- <Link href="/contact" color="neutral" underline="none">
154
- Contact
155
- </Link>
156
- </Stack>
157
- </nav>
158
- );
159
- }
160
- ```
161
-
162
48
  ### Inline Text Links
163
49
 
164
50
  ```tsx
165
51
  function ArticleContent() {
166
52
  return (
167
53
  <Typography level="body-md">
168
- For more information about our services, please visit our{' '}
169
- <Link href="/services">services page</Link> or read our{' '}
54
+ For more information, visit our{' '}
55
+ <Link href="/services">services page</Link> or read the{' '}
170
56
  <Link href="/faq">frequently asked questions</Link>.
171
57
  </Typography>
172
58
  );
173
59
  }
174
60
  ```
175
61
 
176
- ### External Links with Icon
177
-
178
- ```tsx
179
- function ExternalResourceLink() {
180
- return (
181
- <Link
182
- href="https://documentation.example.com"
183
- target="_blank"
184
- rel="noopener noreferrer"
185
- endDecorator={<OpenInNewIcon sx={{ fontSize: 16 }} />}
186
- >
187
- View Documentation
188
- </Link>
189
- );
190
- }
191
- ```
192
-
193
- ### Footer Links
62
+ ### Footer Navigation
194
63
 
195
64
  ```tsx
196
65
  function FooterLinks() {
@@ -210,12 +79,12 @@ function FooterLinks() {
210
79
  }
211
80
  ```
212
81
 
213
- ### Link with React Router
82
+ ### Router Integration
214
83
 
215
84
  ```tsx
216
85
  import { Link as RouterLink } from 'react-router-dom';
217
86
 
218
- function RouterIntegration() {
87
+ function AppNavigation() {
219
88
  return (
220
89
  <Link component={RouterLink} to="/dashboard">
221
90
  Go to Dashboard
@@ -224,235 +93,49 @@ function RouterIntegration() {
224
93
  }
225
94
  ```
226
95
 
227
- ### Skip to Content Link
228
-
229
- ```tsx
230
- function SkipLink() {
231
- return (
232
- <Link
233
- href="#main-content"
234
- sx={{
235
- position: 'absolute',
236
- left: '-9999px',
237
- '&:focus': {
238
- left: 0,
239
- zIndex: 1000,
240
- p: 2,
241
- bgcolor: 'background.surface',
242
- },
243
- }}
244
- >
245
- Skip to main content
246
- </Link>
247
- );
248
- }
249
- ```
250
-
251
- ### Download Link
252
-
253
- ```tsx
254
- function DownloadLink({ filename, url }) {
255
- return (
256
- <Link
257
- href={url}
258
- download={filename}
259
- startDecorator={<DownloadIcon />}
260
- >
261
- Download {filename}
262
- </Link>
263
- );
264
- }
265
- ```
266
-
267
- ## Props and Customization
268
-
269
- ### Key Props
270
-
271
- | Prop | Type | Default | Description |
272
- | ---------------- | -------------------------------------------------------------- | ----------- | ---------------------------------------- |
273
- | `href` | `string` | - | The URL to navigate to |
274
- | `variant` | `'plain' \| 'outlined' \| 'soft' \| 'solid'` | `'plain'` | Visual style variant |
275
- | `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
276
- | `level` | `string` | - | Typography level (e.g., 'body-md', 'h4') |
277
- | `underline` | `'none' \| 'hover' \| 'always'` | `'hover'` | Underline behavior |
278
- | `disabled` | `boolean` | `false` | Disable the link |
279
- | `startDecorator` | `ReactNode` | - | Element before the link text |
280
- | `endDecorator` | `ReactNode` | - | Element after the link text |
281
- | `component` | `ElementType` | `'a'` | The root element type |
282
-
283
- ### Underline Behavior
284
-
285
- ```tsx
286
- <Stack spacing={2}>
287
- {/* No underline */}
288
- <Link underline="none" href="#">Never underlined</Link>
289
-
290
- {/* Underline on hover (default) */}
291
- <Link underline="hover" href="#">Underline on hover</Link>
292
-
293
- {/* Always underlined */}
294
- <Link underline="always" href="#">Always underlined</Link>
295
- </Stack>
296
- ```
297
-
298
- ### With Decorators
299
-
300
- ```tsx
301
- <Stack spacing={2}>
302
- <Link href="#" startDecorator={<HomeIcon />}>
303
- Home
304
- </Link>
305
-
306
- <Link href="#" endDecorator={<ArrowForwardIcon />}>
307
- Learn more
308
- </Link>
309
-
310
- <Link
311
- href="https://external.com"
312
- target="_blank"
313
- endDecorator={<OpenInNewIcon sx={{ fontSize: '1rem' }} />}
314
- >
315
- External link
316
- </Link>
317
- </Stack>
318
- ```
319
-
320
- ### Custom Styling
321
-
322
- ```tsx
323
- <Link
324
- href="#"
325
- sx={{
326
- fontWeight: 'bold',
327
- transition: 'color 0.2s',
328
- '&:hover': {
329
- color: 'primary.600',
330
- },
331
- }}
332
- >
333
- Custom styled link
334
- </Link>
335
- ```
336
-
337
- ## Accessibility
338
-
339
- Link components include comprehensive accessibility features:
340
-
341
- ### Semantic HTML
342
-
343
- - Uses native `<a>` element by default for proper semantics
344
- - Supports custom components for router integration
345
-
346
- ### Screen Reader Support
96
+ ## Best Practices
347
97
 
348
- - Links announce their destination or purpose
349
- - Use descriptive link text instead of "click here" or "read more"
98
+ - **Use descriptive link text.** The text should clearly communicate the destination. Avoid generic labels such as "click here" or "read more".
350
99
 
351
100
  ```tsx
352
- // Good: Descriptive link text
353
- <Link href="/pricing">View our pricing plans</Link>
101
+ // Good
102
+ <Link href="/pricing">View pricing plans</Link>
354
103
 
355
- // Bad: Non-descriptive link text
104
+ // Bad
356
105
  <Link href="/pricing">Click here</Link>
357
106
  ```
358
107
 
359
- ### Keyboard Navigation
360
-
361
- - **Tab**: Navigate to and from links
362
- - **Enter**: Activate the link
363
- - Links receive visible focus indicators
364
-
365
- ### External Links
366
-
367
- Always include proper attributes for external links:
108
+ - **Indicate external links.** When a link opens in a new tab, add a visual cue (such as an icon) and the appropriate security attributes.
368
109
 
369
110
  ```tsx
370
- <Link
371
- href="https://external-site.com"
372
- target="_blank"
373
- rel="noopener noreferrer"
374
- aria-label="Visit external site (opens in new tab)"
375
- >
376
- External Site
111
+ // Good
112
+ <Link href="https://docs.example.com" target="_blank" rel="noopener noreferrer">
113
+ Documentation
377
114
  </Link>
378
- ```
379
-
380
- ### Color Contrast
381
-
382
- All link colors meet WCAG contrast requirements. Avoid relying solely on color to indicate links - use underlines or other visual indicators.
383
-
384
- ## Best Practices
385
-
386
- ### ✅ Do
387
-
388
- 1. **Use descriptive text**: Link text should describe the destination
389
115
 
390
- ```tsx
391
- // Good
392
- <Link href="/documentation">Read the documentation</Link>
393
-
394
- // ❌ Bad
395
- <Link href="/documentation">Click here</Link>
396
- ```
397
-
398
- 2. **Indicate external links**: Show users when links open in new tabs
399
-
400
- ```tsx
401
- <Link href="https://external.com" target="_blank" rel="noopener noreferrer">
402
- External Resource <OpenInNewIcon sx={{ fontSize: 14 }} />
116
+ // Bad -- opens in new tab with no indication
117
+ <Link href="https://docs.example.com" target="_blank">
118
+ Documentation
403
119
  </Link>
404
120
  ```
405
121
 
406
- 3. **Use appropriate colors**: Match link colors to their context and importance
407
-
408
- 4. **Maintain consistency**: Use consistent link styles throughout your application
409
-
410
- ### ❌ Don't
411
-
412
- 1. **Don't use links for actions**: Use Button for non-navigation actions
122
+ - **Do not use links for actions.** If clicking triggers a side effect (form submission, modal opening, deletion), use a Button component instead.
413
123
 
414
124
  ```tsx
415
- // ❌ Bad: Using link for action
416
- <Link onClick={handleSubmit}>Submit Form</Link>
417
-
418
- // ✅ Good: Using button for action
125
+ // Good
419
126
  <Button onClick={handleSubmit}>Submit Form</Button>
420
- ```
421
-
422
- 2. **Don't disable links without reason**: If content is unavailable, explain why
423
-
424
- 3. **Don't open all external links in new tabs**: Only do so when users might lose context
425
-
426
- 4. **Don't use link styling for non-interactive elements**
427
-
428
- ## Performance Considerations
429
-
430
- ### Prefetching
431
-
432
- When using with routing libraries, consider implementing link prefetching for improved perceived performance:
433
127
 
434
- ```tsx
435
- // With Next.js
436
- import NextLink from 'next/link';
437
-
438
- <Link component={NextLink} href="/page" prefetch>
439
- Prefetched Page
440
- </Link>
128
+ // Bad
129
+ <Link onClick={handleSubmit}>Submit Form</Link>
441
130
  ```
442
131
 
443
- ### Avoid Unnecessary Re-renders
132
+ - **Maintain visual consistency.** Use the same variant, color, and underline settings for links that serve the same purpose across different pages.
444
133
 
445
- For links in lists or frequently updating components, ensure stable references:
134
+ - **Match typography level to context.** When a link sits inside a heading or body text block, set its `level` prop to match the surrounding text for visual harmony.
446
135
 
447
- ```tsx
448
- // Using useCallback for event handlers in links
449
- const handleClick = useCallback((e) => {
450
- trackLinkClick(e);
451
- }, []);
452
-
453
- <Link href="/page" onClick={handleClick}>
454
- Tracked Link
455
- </Link>
456
- ```
136
+ ## Accessibility
457
137
 
458
- Link is a fundamental navigation component that ensures consistent, accessible navigation throughout your application. Use it thoughtfully to create clear pathways for users to explore your content.
138
+ - **Semantic HTML**: Renders a native `<a>` element by default, ensuring proper semantics and browser behavior. The `component` prop allows substitution with router-specific elements.
139
+ - **Descriptive text**: Screen readers announce the link text as the accessible name. Always write link text that makes sense out of context since screen reader users often navigate by listing all links on a page.
140
+ - **Keyboard navigation**: Links are focusable with `Tab` and activated with `Enter`. Visible focus indicators are provided for keyboard users.
141
+ - **External link attributes**: Always add `target="_blank"` together with `rel="noopener noreferrer"` on external links to prevent security vulnerabilities and provide an `aria-label` that mentions the new tab behavior when appropriate.