@ceed/ads 1.29.0 → 1.30.0-next.1

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 (64) hide show
  1. package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
  2. package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
  3. package/dist/components/DataTable/hooks.d.ts +2 -1
  4. package/dist/components/DataTable/utils.d.ts +1 -0
  5. package/dist/components/ProfileMenu/ProfileMenu.d.ts +1 -1
  6. package/dist/components/SearchBar/SearchBar.d.ts +21 -0
  7. package/dist/components/SearchBar/index.d.ts +3 -0
  8. package/dist/components/data-display/Badge.md +39 -71
  9. package/dist/components/data-display/DataTable.md +1 -1
  10. package/dist/components/data-display/InfoSign.md +98 -74
  11. package/dist/components/data-display/Typography.md +97 -363
  12. package/dist/components/feedback/Dialog.md +62 -76
  13. package/dist/components/feedback/Modal.md +44 -259
  14. package/dist/components/feedback/llms.txt +0 -2
  15. package/dist/components/index.d.ts +2 -0
  16. package/dist/components/inputs/Autocomplete.md +107 -356
  17. package/dist/components/inputs/ButtonGroup.md +106 -115
  18. package/dist/components/inputs/Calendar.md +459 -98
  19. package/dist/components/inputs/CurrencyInput.md +5 -183
  20. package/dist/components/inputs/DatePicker.md +431 -108
  21. package/dist/components/inputs/DateRangePicker.md +492 -131
  22. package/dist/components/inputs/FilterMenu.md +19 -169
  23. package/dist/components/inputs/FilterableCheckboxGroup.md +23 -123
  24. package/dist/components/inputs/IconButton.md +88 -137
  25. package/dist/components/inputs/Input.md +0 -5
  26. package/dist/components/inputs/MonthPicker.md +422 -95
  27. package/dist/components/inputs/MonthRangePicker.md +466 -89
  28. package/dist/components/inputs/PercentageInput.md +16 -185
  29. package/dist/components/inputs/RadioButton.md +35 -163
  30. package/dist/components/inputs/RadioTileGroup.md +61 -150
  31. package/dist/components/inputs/SearchBar.md +44 -0
  32. package/dist/components/inputs/Select.md +326 -222
  33. package/dist/components/inputs/Switch.md +376 -136
  34. package/dist/components/inputs/Textarea.md +10 -213
  35. package/dist/components/inputs/Uploader/Uploader.md +66 -145
  36. package/dist/components/inputs/llms.txt +1 -3
  37. package/dist/components/navigation/Breadcrumbs.md +322 -80
  38. package/dist/components/navigation/Dropdown.md +221 -92
  39. package/dist/components/navigation/IconMenuButton.md +502 -40
  40. package/dist/components/navigation/InsetDrawer.md +738 -68
  41. package/dist/components/navigation/Link.md +298 -39
  42. package/dist/components/navigation/Menu.md +285 -92
  43. package/dist/components/navigation/MenuButton.md +448 -55
  44. package/dist/components/navigation/Pagination.md +338 -47
  45. package/dist/components/navigation/ProfileMenu.md +268 -45
  46. package/dist/components/navigation/Stepper.md +28 -160
  47. package/dist/components/navigation/Tabs.md +316 -57
  48. package/dist/components/surfaces/Sheet.md +334 -151
  49. package/dist/index.browser.js +15 -13
  50. package/dist/index.browser.js.map +4 -4
  51. package/dist/index.cjs +313 -291
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.js +450 -372
  54. package/dist/llms.txt +1 -8
  55. package/framer/index.js +1 -1
  56. package/package.json +16 -15
  57. package/dist/chunks/rehype-accent-FZRUD7VI.js +0 -39
  58. package/dist/components/feedback/CircularProgress.md +0 -257
  59. package/dist/components/feedback/Skeleton.md +0 -280
  60. package/dist/components/inputs/FormControl.md +0 -361
  61. package/dist/components/inputs/RadioList.md +0 -241
  62. package/dist/components/inputs/Slider.md +0 -334
  63. package/dist/guides/ThemeProvider.md +0 -116
  64. package/dist/guides/llms.txt +0 -9
@@ -2,9 +2,7 @@
2
2
 
3
3
  ## Introduction
4
4
 
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.
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.
8
6
 
9
7
  ```tsx
10
8
  <Link
@@ -29,12 +27,15 @@ import { Link } from '@ceed/ads';
29
27
  function MyComponent() {
30
28
  return (
31
29
  <div>
30
+ {/* Basic link */}
32
31
  <Link href="/about">About Us</Link>
33
32
 
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 */}
38
39
  <Link href="/contact" color="primary" underline="hover">
39
40
  Contact
40
41
  </Link>
@@ -43,11 +44,22 @@ function MyComponent() {
43
44
  }
44
45
  ```
45
46
 
46
- ## Features
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
+ ```
47
59
 
48
60
  ### Variants
49
61
 
50
- Links support four visual styles through the `variant` prop: `plain`, `outlined`, `soft`, and `solid`.
62
+ Links support different visual styles through the variant prop.
51
63
 
52
64
  ```tsx
53
65
  <div style={{
@@ -72,7 +84,7 @@ Links support four visual styles through the `variant` prop: `plain`, `outlined`
72
84
 
73
85
  ### Colors
74
86
 
75
- Apply semantic colors to communicate different purposes -- `primary`, `neutral`, `success`, `warning`, and `danger`.
87
+ Apply different semantic colors to links.
76
88
 
77
89
  ```tsx
78
90
  <div style={{
@@ -100,7 +112,7 @@ Apply semantic colors to communicate different purposes -- `primary`, `neutral`,
100
112
 
101
113
  ### Underline Styles
102
114
 
103
- Control the underline behavior with three options: `none` (never shown), `hover` (shown on hover), and `always` (permanently visible).
115
+ Control the underline behavior of links.
104
116
 
105
117
  ```tsx
106
118
  <div style={{
@@ -122,7 +134,7 @@ Control the underline behavior with three options: `none` (never shown), `hover`
122
134
 
123
135
  ### Typography Levels
124
136
 
125
- Links can adopt any typography level from the design system, enabling consistent text hierarchies when links appear alongside headings or body text.
137
+ Links can inherit or specify typography levels for different text hierarchies.
126
138
 
127
139
  ```tsx
128
140
  <div style={{
@@ -160,7 +172,7 @@ Links can adopt any typography level from the design system, enabling consistent
160
172
 
161
173
  ### Disabled State
162
174
 
163
- Links can be disabled to prevent interaction while remaining visible in the layout.
175
+ Links can be disabled to prevent interaction.
164
176
 
165
177
  ```tsx
166
178
  <Link
@@ -173,7 +185,7 @@ Links can be disabled to prevent interaction while remaining visible in the layo
173
185
 
174
186
  ### External Links
175
187
 
176
- For links that navigate away from your application, include `target="_blank"` and `rel="noopener noreferrer"` for security.
188
+ Links to external resources with proper security attributes.
177
189
 
178
190
  ```tsx
179
191
  <Link href="https://example.com" target="_blank" rel="noopener noreferrer">
@@ -183,7 +195,7 @@ For links that navigate away from your application, include `target="_blank"` an
183
195
 
184
196
  ### Inline with Text
185
197
 
186
- Links integrate seamlessly within paragraph text, inheriting the surrounding font styles.
198
+ Links can be seamlessly integrated within paragraph text.
187
199
 
188
200
  ```tsx
189
201
  <p style={{
@@ -193,23 +205,84 @@ This is a paragraph with an <Link href="#">inline link</Link> that flows natural
193
205
  </p>
194
206
  ```
195
207
 
208
+ ## When to Use
209
+
210
+ ### ✅ Good Use Cases
211
+
212
+ - **Page navigation**: Moving between different pages or sections within your app
213
+ - **External resources**: Linking to external websites, documentation, or references
214
+ - **In-context references**: Linking related content mentioned in text
215
+ - **Skip navigation**: Accessibility links for keyboard users
216
+ - **Breadcrumbs**: Navigation hierarchy indicators
217
+ - **Footer navigation**: Site-wide links in footer sections
218
+
219
+ ### ❌ When Not to Use
220
+
221
+ - **Actions that don't navigate**: Use Button instead for actions like submitting forms, opening modals, or triggering events
222
+ - **Primary calls to action**: Use Button for prominent actions users should take
223
+ - **Menu items**: Use MenuItem components within navigation menus
224
+ - **Tab navigation**: Use Tabs component for content switching within a page
225
+ - **Cards/clickable areas**: Use Card with onClick or a wrapping anchor element
226
+
196
227
  ## Common Use Cases
197
228
 
229
+ ### Navigation Menu Links
230
+
231
+ ```tsx
232
+ function NavigationMenu() {
233
+ return (
234
+ <nav>
235
+ <Stack direction="row" spacing={3}>
236
+ <Link href="/" color="neutral" underline="none">
237
+ Home
238
+ </Link>
239
+ <Link href="/products" color="neutral" underline="none">
240
+ Products
241
+ </Link>
242
+ <Link href="/about" color="neutral" underline="none">
243
+ About
244
+ </Link>
245
+ <Link href="/contact" color="neutral" underline="none">
246
+ Contact
247
+ </Link>
248
+ </Stack>
249
+ </nav>
250
+ );
251
+ }
252
+ ```
253
+
198
254
  ### Inline Text Links
199
255
 
200
256
  ```tsx
201
257
  function ArticleContent() {
202
258
  return (
203
259
  <Typography level="body-md">
204
- For more information, visit our{' '}
205
- <Link href="/services">services page</Link> or read the{' '}
260
+ For more information about our services, please visit our{' '}
261
+ <Link href="/services">services page</Link> or read our{' '}
206
262
  <Link href="/faq">frequently asked questions</Link>.
207
263
  </Typography>
208
264
  );
209
265
  }
210
266
  ```
211
267
 
212
- ### Footer Navigation
268
+ ### External Links with Icon
269
+
270
+ ```tsx
271
+ function ExternalResourceLink() {
272
+ return (
273
+ <Link
274
+ href="https://documentation.example.com"
275
+ target="_blank"
276
+ rel="noopener noreferrer"
277
+ endDecorator={<OpenInNewIcon sx={{ fontSize: 16 }} />}
278
+ >
279
+ View Documentation
280
+ </Link>
281
+ );
282
+ }
283
+ ```
284
+
285
+ ### Footer Links
213
286
 
214
287
  ```tsx
215
288
  function FooterLinks() {
@@ -229,12 +302,12 @@ function FooterLinks() {
229
302
  }
230
303
  ```
231
304
 
232
- ### Router Integration
305
+ ### Link with React Router
233
306
 
234
307
  ```tsx
235
308
  import { Link as RouterLink } from 'react-router-dom';
236
309
 
237
- function AppNavigation() {
310
+ function RouterIntegration() {
238
311
  return (
239
312
  <Link component={RouterLink} to="/dashboard">
240
313
  Go to Dashboard
@@ -243,49 +316,235 @@ function AppNavigation() {
243
316
  }
244
317
  ```
245
318
 
246
- ## Best Practices
319
+ ### Skip to Content Link
320
+
321
+ ```tsx
322
+ function SkipLink() {
323
+ return (
324
+ <Link
325
+ href="#main-content"
326
+ sx={{
327
+ position: 'absolute',
328
+ left: '-9999px',
329
+ '&:focus': {
330
+ left: 0,
331
+ zIndex: 1000,
332
+ p: 2,
333
+ bgcolor: 'background.surface',
334
+ },
335
+ }}
336
+ >
337
+ Skip to main content
338
+ </Link>
339
+ );
340
+ }
341
+ ```
342
+
343
+ ### Download Link
344
+
345
+ ```tsx
346
+ function DownloadLink({ filename, url }) {
347
+ return (
348
+ <Link
349
+ href={url}
350
+ download={filename}
351
+ startDecorator={<DownloadIcon />}
352
+ >
353
+ Download {filename}
354
+ </Link>
355
+ );
356
+ }
357
+ ```
358
+
359
+ ## Props and Customization
360
+
361
+ ### Key Props
362
+
363
+ | Prop | Type | Default | Description |
364
+ | ---------------- | -------------------------------------------------------------- | ----------- | ---------------------------------------- |
365
+ | `href` | `string` | - | The URL to navigate to |
366
+ | `variant` | `'plain' \| 'outlined' \| 'soft' \| 'solid'` | `'plain'` | Visual style variant |
367
+ | `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
368
+ | `level` | `string` | - | Typography level (e.g., 'body-md', 'h4') |
369
+ | `underline` | `'none' \| 'hover' \| 'always'` | `'hover'` | Underline behavior |
370
+ | `disabled` | `boolean` | `false` | Disable the link |
371
+ | `startDecorator` | `ReactNode` | - | Element before the link text |
372
+ | `endDecorator` | `ReactNode` | - | Element after the link text |
373
+ | `component` | `ElementType` | `'a'` | The root element type |
247
374
 
248
- - **Use descriptive link text.** The text should clearly communicate the destination. Avoid generic labels such as "click here" or "read more".
375
+ ### Underline Behavior
249
376
 
250
377
  ```tsx
251
- // Good
252
- <Link href="/pricing">View pricing plans</Link>
378
+ <Stack spacing={2}>
379
+ {/* No underline */}
380
+ <Link underline="none" href="#">Never underlined</Link>
381
+
382
+ {/* Underline on hover (default) */}
383
+ <Link underline="hover" href="#">Underline on hover</Link>
384
+
385
+ {/* Always underlined */}
386
+ <Link underline="always" href="#">Always underlined</Link>
387
+ </Stack>
388
+ ```
389
+
390
+ ### With Decorators
391
+
392
+ ```tsx
393
+ <Stack spacing={2}>
394
+ <Link href="#" startDecorator={<HomeIcon />}>
395
+ Home
396
+ </Link>
397
+
398
+ <Link href="#" endDecorator={<ArrowForwardIcon />}>
399
+ Learn more
400
+ </Link>
401
+
402
+ <Link
403
+ href="https://external.com"
404
+ target="_blank"
405
+ endDecorator={<OpenInNewIcon sx={{ fontSize: '1rem' }} />}
406
+ >
407
+ External link
408
+ </Link>
409
+ </Stack>
410
+ ```
253
411
 
254
- // Bad
412
+ ### Custom Styling
413
+
414
+ ```tsx
415
+ <Link
416
+ href="#"
417
+ sx={{
418
+ fontWeight: 'bold',
419
+ transition: 'color 0.2s',
420
+ '&:hover': {
421
+ color: 'primary.600',
422
+ },
423
+ }}
424
+ >
425
+ Custom styled link
426
+ </Link>
427
+ ```
428
+
429
+ ## Accessibility
430
+
431
+ Link components include comprehensive accessibility features:
432
+
433
+ ### Semantic HTML
434
+
435
+ - Uses native `<a>` element by default for proper semantics
436
+ - Supports custom components for router integration
437
+
438
+ ### Screen Reader Support
439
+
440
+ - Links announce their destination or purpose
441
+ - Use descriptive link text instead of "click here" or "read more"
442
+
443
+ ```tsx
444
+ // ✅ Good: Descriptive link text
445
+ <Link href="/pricing">View our pricing plans</Link>
446
+
447
+ // ❌ Bad: Non-descriptive link text
255
448
  <Link href="/pricing">Click here</Link>
256
449
  ```
257
450
 
258
- - **Indicate external links.** When a link opens in a new tab, add a visual cue (such as an icon) and the appropriate security attributes.
451
+ ### Keyboard Navigation
452
+
453
+ - **Tab**: Navigate to and from links
454
+ - **Enter**: Activate the link
455
+ - Links receive visible focus indicators
456
+
457
+ ### External Links
458
+
459
+ Always include proper attributes for external links:
259
460
 
260
461
  ```tsx
261
- // Good
262
- <Link href="https://docs.example.com" target="_blank" rel="noopener noreferrer">
263
- Documentation
462
+ <Link
463
+ href="https://external-site.com"
464
+ target="_blank"
465
+ rel="noopener noreferrer"
466
+ aria-label="Visit external site (opens in new tab)"
467
+ >
468
+ External Site
264
469
  </Link>
470
+ ```
471
+
472
+ ### Color Contrast
473
+
474
+ All link colors meet WCAG contrast requirements. Avoid relying solely on color to indicate links - use underlines or other visual indicators.
475
+
476
+ ## Best Practices
477
+
478
+ ### ✅ Do
479
+
480
+ 1. **Use descriptive text**: Link text should describe the destination
265
481
 
266
- // Bad -- opens in new tab with no indication
267
- <Link href="https://docs.example.com" target="_blank">
268
- Documentation
482
+ ```tsx
483
+ // Good
484
+ <Link href="/documentation">Read the documentation</Link>
485
+
486
+ // ❌ Bad
487
+ <Link href="/documentation">Click here</Link>
488
+ ```
489
+
490
+ 2. **Indicate external links**: Show users when links open in new tabs
491
+
492
+ ```tsx
493
+ <Link href="https://external.com" target="_blank" rel="noopener noreferrer">
494
+ External Resource <OpenInNewIcon sx={{ fontSize: 14 }} />
269
495
  </Link>
270
496
  ```
271
497
 
272
- - **Do not use links for actions.** If clicking triggers a side effect (form submission, modal opening, deletion), use a Button component instead.
498
+ 3. **Use appropriate colors**: Match link colors to their context and importance
499
+
500
+ 4. **Maintain consistency**: Use consistent link styles throughout your application
501
+
502
+ ### ❌ Don't
503
+
504
+ 1. **Don't use links for actions**: Use Button for non-navigation actions
273
505
 
274
506
  ```tsx
275
- // Good
507
+ // ❌ Bad: Using link for action
508
+ <Link onClick={handleSubmit}>Submit Form</Link>
509
+
510
+ // ✅ Good: Using button for action
276
511
  <Button onClick={handleSubmit}>Submit Form</Button>
512
+ ```
277
513
 
278
- // Bad
279
- <Link onClick={handleSubmit}>Submit Form</Link>
514
+ 2. **Don't disable links without reason**: If content is unavailable, explain why
515
+
516
+ 3. **Don't open all external links in new tabs**: Only do so when users might lose context
517
+
518
+ 4. **Don't use link styling for non-interactive elements**
519
+
520
+ ## Performance Considerations
521
+
522
+ ### Prefetching
523
+
524
+ When using with routing libraries, consider implementing link prefetching for improved perceived performance:
525
+
526
+ ```tsx
527
+ // With Next.js
528
+ import NextLink from 'next/link';
529
+
530
+ <Link component={NextLink} href="/page" prefetch>
531
+ Prefetched Page
532
+ </Link>
280
533
  ```
281
534
 
282
- - **Maintain visual consistency.** Use the same variant, color, and underline settings for links that serve the same purpose across different pages.
535
+ ### Avoid Unnecessary Re-renders
283
536
 
284
- - **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.
537
+ For links in lists or frequently updating components, ensure stable references:
285
538
 
286
- ## Accessibility
539
+ ```tsx
540
+ // Using useCallback for event handlers in links
541
+ const handleClick = useCallback((e) => {
542
+ trackLinkClick(e);
543
+ }, []);
544
+
545
+ <Link href="/page" onClick={handleClick}>
546
+ Tracked Link
547
+ </Link>
548
+ ```
287
549
 
288
- - **Semantic HTML**: Renders a native `<a>` element by default, ensuring proper semantics and browser behavior. The `component` prop allows substitution with router-specific elements.
289
- - **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.
290
- - **Keyboard navigation**: Links are focusable with `Tab` and activated with `Enter`. Visible focus indicators are provided for keyboard users.
291
- - **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.
550
+ 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.