@coinbase/cds-mcp-server 8.60.0 → 8.62.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/CHANGELOG.md +8 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +17 -4
- package/mcp-docs/mobile/components/ControlGroup.txt +3 -2
- package/mcp-docs/mobile/components/ModalBody.txt +1 -1
- package/mcp-docs/mobile/components/ModalFooter.txt +2 -2
- package/mcp-docs/mobile/components/ModalHeader.txt +3 -3
- package/mcp-docs/mobile/components/Numpad.txt +1 -1
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +1 -1
- package/mcp-docs/mobile/components/TabbedChipsAlpha.txt +78 -4
- package/mcp-docs/mobile/components/Tabs.txt +1 -1
- package/mcp-docs/mobile/components/Tour.txt +2 -2
- package/mcp-docs/mobile/getting-started/theming.txt +96 -0
- package/mcp-docs/web/components/ControlGroup.txt +1 -0
- package/mcp-docs/web/components/DatePicker.txt +1 -1
- package/mcp-docs/web/components/Dropdown.txt +3 -3
- package/mcp-docs/web/components/FocusTrap.txt +7 -7
- package/mcp-docs/web/components/FullscreenModal.txt +3 -3
- package/mcp-docs/web/components/FullscreenModalLayout.txt +1 -1
- package/mcp-docs/web/components/Modal.txt +2 -2
- package/mcp-docs/web/components/ModalBody.txt +5 -5
- package/mcp-docs/web/components/ModalFooter.txt +7 -7
- package/mcp-docs/web/components/ModalHeader.txt +3 -3
- package/mcp-docs/web/components/NavigationTitleSelect.txt +102 -0
- package/mcp-docs/web/components/Overlay.txt +0 -1
- package/mcp-docs/web/components/Pagination.txt +8 -8
- package/mcp-docs/web/components/RemoteImageGroup.txt +1 -1
- package/mcp-docs/web/components/SelectChip.txt +3 -3
- package/mcp-docs/web/components/Switch.txt +2 -2
- package/mcp-docs/web/components/TabbedChipsAlpha.txt +90 -1
- package/mcp-docs/web/components/Table.txt +1 -0
- package/mcp-docs/web/components/TableCaption.txt +2 -0
- package/mcp-docs/web/components/TableCellFallback.txt +1 -0
- package/mcp-docs/web/components/TableRow.txt +3 -0
- package/mcp-docs/web/components/Tooltip.txt +5 -5
- package/mcp-docs/web/components/Tour.txt +3 -3
- package/mcp-docs/web/components/Tray.txt +2 -2
- package/mcp-docs/web/getting-started/theming.txt +98 -0
- package/package.json +1 -1
|
@@ -424,3 +424,101 @@ const myCustomColor = {
|
|
|
424
424
|
};
|
|
425
425
|
```
|
|
426
426
|
|
|
427
|
+
### ComponentConfigProvider component
|
|
428
|
+
|
|
429
|
+
`ComponentConfigProvider` lets you set component-level default BaseProps for all matching component instances in its subtree. It should be used sparingly and you should avoid frequent updates.
|
|
430
|
+
|
|
431
|
+
This is **not recommended for most use cases**. In most cases, passing props directly to components is clearer and more efficient.
|
|
432
|
+
|
|
433
|
+
Also, it is not recommended to nest `ComponentConfigProvider`. If you nest `ComponentConfigProvider`, it will not inherit the parent provider's config. It will only use its own config.
|
|
434
|
+
|
|
435
|
+
Use `ComponentConfigProvider` when you need to set defaults across many instances of a component (for example, changing the default `borderRadius` of all `Button` components) and you do not want to change theme tokens.
|
|
436
|
+
|
|
437
|
+
```tsx
|
|
438
|
+
import { Button } from '@coinbase/cds-web/buttons/Button';
|
|
439
|
+
import { ComponentConfigProvider } from '@coinbase/cds-web/system/ComponentConfigProvider';
|
|
440
|
+
|
|
441
|
+
const App = () => (
|
|
442
|
+
<ComponentConfigProvider value={{ Button: { borderRadius: 200 } }}>
|
|
443
|
+
<HStack gap={2}>
|
|
444
|
+
<Button>Primary action</Button>
|
|
445
|
+
<Button variant="secondary">Secondary action</Button>
|
|
446
|
+
</HStack>
|
|
447
|
+
</ComponentConfigProvider>
|
|
448
|
+
);
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Property values being set for an individual component instance will override the default values set on the provider.
|
|
452
|
+
|
|
453
|
+
```jsx live
|
|
454
|
+
<VStack gap={4}>
|
|
455
|
+
<ComponentConfigProvider value={{ Button: { borderRadius: 200 } }}>
|
|
456
|
+
<VStack gap={2}>
|
|
457
|
+
<Text font="label1">ComponentConfigProvider with custom default borderRadius</Text>
|
|
458
|
+
<HStack gap={2}>
|
|
459
|
+
<Button>Default button</Button>
|
|
460
|
+
<Button variant="secondary" borderRadius={0}>
|
|
461
|
+
Square button
|
|
462
|
+
</Button>
|
|
463
|
+
</HStack>
|
|
464
|
+
</VStack>
|
|
465
|
+
</ComponentConfigProvider>
|
|
466
|
+
<VStack gap={2}>
|
|
467
|
+
<Text font="label1">Default Button</Text>
|
|
468
|
+
<HStack gap={2}>
|
|
469
|
+
<Button>Default button</Button>
|
|
470
|
+
<Button variant="secondary" borderRadius={0}>
|
|
471
|
+
Square button
|
|
472
|
+
</Button>
|
|
473
|
+
</HStack>
|
|
474
|
+
</VStack>
|
|
475
|
+
</VStack>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
#### Function-based defaults
|
|
479
|
+
|
|
480
|
+
`ComponentConfigProvider` can also accept a function to compute defaults from incoming component props.
|
|
481
|
+
|
|
482
|
+
When using function-based defaults, keep both the resolver and provider `value` stable with `useCallback` and `useMemo` to reduce avoidable work during rerenders.
|
|
483
|
+
|
|
484
|
+
```tsx
|
|
485
|
+
import { useCallback, useMemo } from 'react';
|
|
486
|
+
import type { ComponentConfig } from '@coinbase/cds-web/core/componentConfig';
|
|
487
|
+
import { Button } from '@coinbase/cds-web/buttons/Button';
|
|
488
|
+
import { ComponentConfigProvider } from '@coinbase/cds-web/system/ComponentConfigProvider';
|
|
489
|
+
|
|
490
|
+
const compactButtonDefaults = {
|
|
491
|
+
borderRadius: 200,
|
|
492
|
+
height: 24,
|
|
493
|
+
font: 'label1',
|
|
494
|
+
} as const;
|
|
495
|
+
|
|
496
|
+
const regularButtonDefaults = {
|
|
497
|
+
borderRadius: 200,
|
|
498
|
+
height: 32,
|
|
499
|
+
font: 'headline',
|
|
500
|
+
} as const;
|
|
501
|
+
|
|
502
|
+
const App = () => {
|
|
503
|
+
const buttonConfig = useCallback(
|
|
504
|
+
(props: { compact?: boolean }) =>
|
|
505
|
+
props.compact ? compactButtonDefaults : regularButtonDefaults,
|
|
506
|
+
[],
|
|
507
|
+
);
|
|
508
|
+
|
|
509
|
+
const componentConfig = useMemo<ComponentConfig>(
|
|
510
|
+
() => ({
|
|
511
|
+
Button: buttonConfig,
|
|
512
|
+
}),
|
|
513
|
+
[buttonConfig],
|
|
514
|
+
);
|
|
515
|
+
|
|
516
|
+
return (
|
|
517
|
+
<ComponentConfigProvider value={componentConfig}>
|
|
518
|
+
<Button>Default</Button>
|
|
519
|
+
<Button compact>Compact</Button>
|
|
520
|
+
</ComponentConfigProvider>
|
|
521
|
+
);
|
|
522
|
+
};
|
|
523
|
+
```
|
|
524
|
+
|