@neynar/ui 0.3.0 → 0.3.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.
- package/.llm/a.llm.md +131 -0
- package/.llm/accordion-content.llm.md +67 -0
- package/.llm/accordion-item.llm.md +61 -0
- package/.llm/accordion-trigger.llm.md +69 -0
- package/.llm/accordion.llm.md +88 -0
- package/.llm/alert-description.llm.md +78 -0
- package/.llm/alert-dialog-action.llm.md +51 -0
- package/.llm/alert-dialog-cancel.llm.md +48 -0
- package/.llm/alert-dialog-content.llm.md +88 -0
- package/.llm/alert-dialog-description.llm.md +53 -0
- package/.llm/alert-dialog-footer.llm.md +41 -0
- package/.llm/alert-dialog-header.llm.md +39 -0
- package/.llm/alert-dialog-overlay.llm.md +44 -0
- package/.llm/alert-dialog-portal.llm.md +41 -0
- package/.llm/alert-dialog-title.llm.md +46 -0
- package/.llm/alert-dialog-trigger.llm.md +40 -0
- package/.llm/alert-dialog.llm.md +80 -0
- package/.llm/alert-title.llm.md +48 -0
- package/.llm/alert.llm.md +92 -0
- package/.llm/aspect-ratio.llm.md +41 -0
- package/.llm/avatar-fallback.llm.md +41 -0
- package/.llm/avatar-image.llm.md +48 -0
- package/.llm/avatar.llm.md +35 -0
- package/.llm/badge.llm.md +117 -0
- package/.llm/blockquote.llm.md +117 -0
- package/.llm/breadcrumb-ellipsis.llm.md +73 -0
- package/.llm/breadcrumb-item.llm.md +53 -0
- package/.llm/breadcrumb-link.llm.md +84 -0
- package/.llm/breadcrumb-list.llm.md +54 -0
- package/.llm/breadcrumb-page.llm.md +52 -0
- package/.llm/breadcrumb-separator.llm.md +60 -0
- package/.llm/breadcrumb.llm.md +110 -0
- package/.llm/button-group-separator.llm.md +53 -0
- package/.llm/button-group-text.llm.md +56 -0
- package/.llm/button-group.llm.md +81 -0
- package/.llm/button.llm.md +281 -0
- package/.llm/calendar-day-button.llm.md +57 -0
- package/.llm/calendar.llm.md +340 -0
- package/.llm/card-action.llm.md +64 -0
- package/.llm/card-content.llm.md +48 -0
- package/.llm/card-description.llm.md +46 -0
- package/.llm/card-footer.llm.md +56 -0
- package/.llm/card-header.llm.md +53 -0
- package/.llm/card-title.llm.md +43 -0
- package/.llm/card.llm.md +100 -0
- package/.llm/carousel-content.llm.md +77 -0
- package/.llm/carousel-item.llm.md +96 -0
- package/.llm/carousel-next.llm.md +95 -0
- package/.llm/carousel-previous.llm.md +95 -0
- package/.llm/carousel.llm.md +211 -0
- package/.llm/chart-config.llm.md +71 -0
- package/.llm/chart-container.llm.md +148 -0
- package/.llm/chart-legend-content.llm.md +85 -0
- package/.llm/chart-legend.llm.md +144 -0
- package/.llm/chart-style.llm.md +28 -0
- package/.llm/chart-tooltip-content.llm.md +149 -0
- package/.llm/chart-tooltip.llm.md +184 -0
- package/.llm/checkbox.llm.md +100 -0
- package/.llm/cn.llm.md +46 -0
- package/.llm/code.llm.md +103 -0
- package/.llm/collapsible-content.llm.md +109 -0
- package/.llm/collapsible-trigger.llm.md +75 -0
- package/.llm/collapsible.llm.md +109 -0
- package/.llm/combobox-option.llm.md +53 -0
- package/.llm/combobox.llm.md +208 -0
- package/.llm/command-dialog.llm.md +112 -0
- package/.llm/command-empty.llm.md +63 -0
- package/.llm/command-group.llm.md +83 -0
- package/.llm/command-input.llm.md +82 -0
- package/.llm/command-item.llm.md +97 -0
- package/.llm/command-list.llm.md +53 -0
- package/.llm/command-loading.llm.md +48 -0
- package/.llm/command-separator.llm.md +44 -0
- package/.llm/command-shortcut.llm.md +63 -0
- package/.llm/command.llm.md +147 -0
- package/.llm/container.llm.md +236 -0
- package/.llm/context-menu-checkbox-item.llm.md +97 -0
- package/.llm/context-menu-content.llm.md +91 -0
- package/.llm/context-menu-group.llm.md +61 -0
- package/.llm/context-menu-item.llm.md +94 -0
- package/.llm/context-menu-label.llm.md +60 -0
- package/.llm/context-menu-portal.llm.md +49 -0
- package/.llm/context-menu-radio-group.llm.md +66 -0
- package/.llm/context-menu-radio-item.llm.md +76 -0
- package/.llm/context-menu-separator.llm.md +51 -0
- package/.llm/context-menu-shortcut.llm.md +57 -0
- package/.llm/context-menu-sub-content.llm.md +90 -0
- package/.llm/context-menu-sub-trigger.llm.md +73 -0
- package/.llm/context-menu-sub.llm.md +61 -0
- package/.llm/context-menu-trigger.llm.md +53 -0
- package/.llm/context-menu.llm.md +103 -0
- package/.llm/date-picker.llm.md +90 -0
- package/.llm/dialog-close.llm.md +61 -0
- package/.llm/dialog-content.llm.md +128 -0
- package/.llm/dialog-description.llm.md +44 -0
- package/.llm/dialog-footer.llm.md +38 -0
- package/.llm/dialog-header.llm.md +40 -0
- package/.llm/dialog-overlay.llm.md +57 -0
- package/.llm/dialog-portal.llm.md +47 -0
- package/.llm/dialog-title.llm.md +41 -0
- package/.llm/dialog-trigger.llm.md +51 -0
- package/.llm/dialog.llm.md +113 -0
- package/.llm/drawer-close.llm.md +53 -0
- package/.llm/drawer-content.llm.md +58 -0
- package/.llm/drawer-description.llm.md +54 -0
- package/.llm/drawer-footer.llm.md +67 -0
- package/.llm/drawer-header.llm.md +60 -0
- package/.llm/drawer-overlay.llm.md +40 -0
- package/.llm/drawer-portal.llm.md +42 -0
- package/.llm/drawer-title.llm.md +51 -0
- package/.llm/drawer-trigger.llm.md +44 -0
- package/.llm/drawer.llm.md +194 -0
- package/.llm/dropdown-menu-checkbox-item.llm.md +111 -0
- package/.llm/dropdown-menu-content.llm.md +109 -0
- package/.llm/dropdown-menu-group.llm.md +38 -0
- package/.llm/dropdown-menu-item.llm.md +94 -0
- package/.llm/dropdown-menu-label.llm.md +66 -0
- package/.llm/dropdown-menu-portal.llm.md +32 -0
- package/.llm/dropdown-menu-radio-group.llm.md +73 -0
- package/.llm/dropdown-menu-radio-item.llm.md +92 -0
- package/.llm/dropdown-menu-separator.llm.md +55 -0
- package/.llm/dropdown-menu-shortcut.llm.md +74 -0
- package/.llm/dropdown-menu-sub-content.llm.md +80 -0
- package/.llm/dropdown-menu-sub-trigger.llm.md +84 -0
- package/.llm/dropdown-menu-sub.llm.md +74 -0
- package/.llm/dropdown-menu-trigger.llm.md +48 -0
- package/.llm/dropdown-menu.llm.md +120 -0
- package/.llm/empty-content.llm.md +103 -0
- package/.llm/empty-description.llm.md +70 -0
- package/.llm/empty-header.llm.md +64 -0
- package/.llm/empty-media.llm.md +81 -0
- package/.llm/empty-state.llm.md +174 -0
- package/.llm/empty-title.llm.md +54 -0
- package/.llm/empty.llm.md +158 -0
- package/.llm/field-content.llm.md +28 -0
- package/.llm/field-description.llm.md +28 -0
- package/.llm/field-error.llm.md +41 -0
- package/.llm/field-group.llm.md +84 -0
- package/.llm/field-label.llm.md +28 -0
- package/.llm/field-legend.llm.md +77 -0
- package/.llm/field-separator.llm.md +35 -0
- package/.llm/field-set.llm.md +80 -0
- package/.llm/field-title.llm.md +28 -0
- package/.llm/field.llm.md +35 -0
- package/.llm/h1.llm.md +108 -0
- package/.llm/h2.llm.md +108 -0
- package/.llm/h3.llm.md +106 -0
- package/.llm/h4.llm.md +104 -0
- package/.llm/h5.llm.md +105 -0
- package/.llm/h6.llm.md +105 -0
- package/.llm/hover-card-content.llm.md +167 -0
- package/.llm/hover-card-trigger.llm.md +65 -0
- package/.llm/hover-card.llm.md +121 -0
- package/.llm/input-group-addon.llm.md +91 -0
- package/.llm/input-group-button.llm.md +120 -0
- package/.llm/input-group-input.llm.md +145 -0
- package/.llm/input-group-text.llm.md +75 -0
- package/.llm/input-group-textarea.llm.md +157 -0
- package/.llm/input-group.llm.md +108 -0
- package/.llm/input.llm.md +319 -0
- package/.llm/item-actions.llm.md +77 -0
- package/.llm/item-content.llm.md +73 -0
- package/.llm/item-description.llm.md +61 -0
- package/.llm/item-footer.llm.md +68 -0
- package/.llm/item-group.llm.md +73 -0
- package/.llm/item-header.llm.md +66 -0
- package/.llm/item-media.llm.md +75 -0
- package/.llm/item-separator.llm.md +80 -0
- package/.llm/item-title.llm.md +59 -0
- package/.llm/item.llm.md +115 -0
- package/.llm/kbd-group.llm.md +71 -0
- package/.llm/kbd.llm.md +71 -0
- package/.llm/label.llm.md +145 -0
- package/.llm/lead.llm.md +114 -0
- package/.llm/menubar-checkbox-item.llm.md +66 -0
- package/.llm/menubar-content.llm.md +128 -0
- package/.llm/menubar-group.llm.md +40 -0
- package/.llm/menubar-item.llm.md +62 -0
- package/.llm/menubar-label.llm.md +40 -0
- package/.llm/menubar-menu.llm.md +32 -0
- package/.llm/menubar-portal.llm.md +38 -0
- package/.llm/menubar-radio-group.llm.md +39 -0
- package/.llm/menubar-radio-item.llm.md +59 -0
- package/.llm/menubar-separator.llm.md +35 -0
- package/.llm/menubar-shortcut.llm.md +37 -0
- package/.llm/menubar-sub-content.llm.md +127 -0
- package/.llm/menubar-sub-trigger.llm.md +51 -0
- package/.llm/menubar-sub.llm.md +53 -0
- package/.llm/menubar-trigger.llm.md +37 -0
- package/.llm/menubar.llm.md +115 -0
- package/.llm/navigation-menu-content.llm.md +116 -0
- package/.llm/navigation-menu-indicator.llm.md +68 -0
- package/.llm/navigation-menu-item.llm.md +62 -0
- package/.llm/navigation-menu-link.llm.md +109 -0
- package/.llm/navigation-menu-list.llm.md +52 -0
- package/.llm/navigation-menu-trigger-style.llm.md +22 -0
- package/.llm/navigation-menu-trigger.llm.md +57 -0
- package/.llm/navigation-menu-viewport.llm.md +51 -0
- package/.llm/navigation-menu.llm.md +184 -0
- package/.llm/p.llm.md +110 -0
- package/.llm/pagination-content.llm.md +60 -0
- package/.llm/pagination-ellipsis.llm.md +107 -0
- package/.llm/pagination-item.llm.md +59 -0
- package/.llm/pagination-link.llm.md +150 -0
- package/.llm/pagination-next.llm.md +115 -0
- package/.llm/pagination-previous.llm.md +115 -0
- package/.llm/pagination.llm.md +190 -0
- package/.llm/popover-anchor.llm.md +53 -0
- package/.llm/popover-content.llm.md +109 -0
- package/.llm/popover-trigger.llm.md +54 -0
- package/.llm/popover.llm.md +116 -0
- package/.llm/progress.llm.md +76 -0
- package/.llm/radio-group-indicator.llm.md +28 -0
- package/.llm/radio-group-item.llm.md +40 -0
- package/.llm/radio-group.llm.md +76 -0
- package/.llm/resizable-handle.llm.md +156 -0
- package/.llm/resizable-panel-group.llm.md +149 -0
- package/.llm/resizable-panel.llm.md +157 -0
- package/.llm/scroll-area-corner.llm.md +41 -0
- package/.llm/scroll-area-thumb.llm.md +39 -0
- package/.llm/scroll-area-viewport.llm.md +60 -0
- package/.llm/scroll-area.llm.md +125 -0
- package/.llm/scroll-bar.llm.md +78 -0
- package/.llm/sdk-items-registry.json +3022 -0
- package/.llm/select-content.llm.md +139 -0
- package/.llm/select-group.llm.md +60 -0
- package/.llm/select-item.llm.md +75 -0
- package/.llm/select-label.llm.md +62 -0
- package/.llm/select-scroll-down-button.llm.md +45 -0
- package/.llm/select-scroll-up-button.llm.md +45 -0
- package/.llm/select-separator.llm.md +59 -0
- package/.llm/select-trigger.llm.md +66 -0
- package/.llm/select-value.llm.md +67 -0
- package/.llm/select.llm.md +159 -0
- package/.llm/separator.llm.md +129 -0
- package/.llm/sheet-close.llm.md +49 -0
- package/.llm/sheet-content.llm.md +115 -0
- package/.llm/sheet-description.llm.md +62 -0
- package/.llm/sheet-footer.llm.md +64 -0
- package/.llm/sheet-header.llm.md +52 -0
- package/.llm/sheet-title.llm.md +53 -0
- package/.llm/sheet-trigger.llm.md +46 -0
- package/.llm/sheet.llm.md +126 -0
- package/.llm/sidebar-content.llm.md +63 -0
- package/.llm/sidebar-footer.llm.md +50 -0
- package/.llm/sidebar-group-action.llm.md +60 -0
- package/.llm/sidebar-group-content.llm.md +64 -0
- package/.llm/sidebar-group-label.llm.md +53 -0
- package/.llm/sidebar-group.llm.md +56 -0
- package/.llm/sidebar-header.llm.md +67 -0
- package/.llm/sidebar-input.llm.md +50 -0
- package/.llm/sidebar-inset.llm.md +52 -0
- package/.llm/sidebar-menu-action.llm.md +84 -0
- package/.llm/sidebar-menu-badge.llm.md +60 -0
- package/.llm/sidebar-menu-button.llm.md +103 -0
- package/.llm/sidebar-menu-item.llm.md +75 -0
- package/.llm/sidebar-menu-skeleton.llm.md +76 -0
- package/.llm/sidebar-menu-sub-button.llm.md +85 -0
- package/.llm/sidebar-menu-sub-item.llm.md +54 -0
- package/.llm/sidebar-menu-sub.llm.md +74 -0
- package/.llm/sidebar-menu.llm.md +65 -0
- package/.llm/sidebar-provider.llm.md +79 -0
- package/.llm/sidebar-rail.llm.md +34 -0
- package/.llm/sidebar-separator.llm.md +57 -0
- package/.llm/sidebar-trigger.llm.md +49 -0
- package/.llm/sidebar.llm.md +129 -0
- package/.llm/skeleton.llm.md +134 -0
- package/.llm/slider.llm.md +173 -0
- package/.llm/small.llm.md +110 -0
- package/.llm/span.llm.md +118 -0
- package/.llm/spinner.llm.md +182 -0
- package/.llm/stack.llm.md +28 -0
- package/.llm/strong.llm.md +110 -0
- package/.llm/switch.llm.md +76 -0
- package/.llm/table-body.llm.md +36 -0
- package/.llm/table-caption.llm.md +48 -0
- package/.llm/table-cell.llm.md +53 -0
- package/.llm/table-footer.llm.md +41 -0
- package/.llm/table-head.llm.md +69 -0
- package/.llm/table-header.llm.md +41 -0
- package/.llm/table-row.llm.md +42 -0
- package/.llm/table.llm.md +123 -0
- package/.llm/tabs-content.llm.md +47 -0
- package/.llm/tabs-list.llm.md +41 -0
- package/.llm/tabs-trigger.llm.md +47 -0
- package/.llm/tabs.llm.md +71 -0
- package/.llm/text-field.llm.md +327 -0
- package/.llm/textarea.llm.md +311 -0
- package/.llm/theme-preference.llm.md +25 -0
- package/.llm/theme-toggle.llm.md +57 -0
- package/.llm/theme.llm.md +14 -0
- package/.llm/toast.llm.md +32 -0
- package/.llm/toaster.llm.md +193 -0
- package/.llm/toggle-group-item.llm.md +59 -0
- package/.llm/toggle-group.llm.md +101 -0
- package/.llm/toggle.llm.md +40 -0
- package/.llm/tooltip-content.llm.md +185 -0
- package/.llm/tooltip-provider.llm.md +68 -0
- package/.llm/tooltip-trigger.llm.md +70 -0
- package/.llm/tooltip.llm.md +129 -0
- package/.llm/typography.llm.md +161 -0
- package/.llm/use-carousel.llm.md +55 -0
- package/.llm/use-command-state.llm.md +32 -0
- package/.llm/use-is-mobile.llm.md +73 -0
- package/.llm/use-sidebar.llm.md +61 -0
- package/dist/components/ui/scroll-area.d.ts +5 -5
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -1
- package/dist/components/ui/theme-toggle.d.ts +0 -3
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/index.js +4972 -9636
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/ui/stack.tsx +3 -1
- package/src/components/ui/theme-toggle.tsx +1 -3
- package/src/components/ui/theme.tsx +6 -1
- package/src/styles/globals.css +57 -85
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# ChartConfig
|
|
2
|
+
|
|
3
|
+
**Type**: type
|
|
4
|
+
|
|
5
|
+
Configuration object for chart data series Defines labels, colors, and icons for chart data series with support for both static colors and theme-aware color definitions. Each series can have either a static color or theme-specific colors for light/dark modes. This configuration drives both visual styling and accessibility features throughout the chart ecosystem.
|
|
6
|
+
|
|
7
|
+
## Type Definition
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { ChartConfig } from '@neynar/ui';
|
|
11
|
+
|
|
12
|
+
type ChartConfig = {
|
|
13
|
+
[k in string]: {
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
icon?: React.ComponentType;
|
|
16
|
+
} & (
|
|
17
|
+
| { color?: string; theme?: never }
|
|
18
|
+
| { color?: never; theme: Record<keyof typeof THEMES, string> }
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Example 1
|
|
26
|
+
```tsx
|
|
27
|
+
// Static color configuration with icon
|
|
28
|
+
const chartConfig = {
|
|
29
|
+
revenue: {
|
|
30
|
+
label: "Revenue",
|
|
31
|
+
color: "hsl(var(--chart-1))",
|
|
32
|
+
icon: DollarSignIcon,
|
|
33
|
+
},
|
|
34
|
+
} satisfies ChartConfig
|
|
35
|
+
```
|
|
36
|
+
### Example 2
|
|
37
|
+
```tsx
|
|
38
|
+
// Theme-aware color configuration for dark/light modes
|
|
39
|
+
const chartConfig = {
|
|
40
|
+
users: {
|
|
41
|
+
label: "Active Users",
|
|
42
|
+
theme: {
|
|
43
|
+
light: "#0ea5e9",
|
|
44
|
+
dark: "#0284c7",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
} satisfies ChartConfig
|
|
48
|
+
```
|
|
49
|
+
### Example 3
|
|
50
|
+
```tsx
|
|
51
|
+
// Complex configuration with multiple series
|
|
52
|
+
const chartConfig = {
|
|
53
|
+
desktop: {
|
|
54
|
+
label: "Desktop Users",
|
|
55
|
+
color: "var(--chart-1)",
|
|
56
|
+
icon: MonitorIcon,
|
|
57
|
+
},
|
|
58
|
+
mobile: {
|
|
59
|
+
label: "Mobile Users",
|
|
60
|
+
color: "var(--chart-2)",
|
|
61
|
+
icon: SmartphoneIcon,
|
|
62
|
+
},
|
|
63
|
+
revenue: {
|
|
64
|
+
label: "Revenue ($)",
|
|
65
|
+
theme: {
|
|
66
|
+
light: "#059669",
|
|
67
|
+
dark: "#10b981",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
} satisfies ChartConfig
|
|
71
|
+
```
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# ChartContainer
|
|
2
|
+
|
|
3
|
+
**Type**: component
|
|
4
|
+
|
|
5
|
+
Container component for Recharts charts with theming and configuration The ChartContainer provides a responsive wrapper for Recharts components with automatic theming, color management, and configuration. It generates CSS custom properties for chart colors, handles dark mode support, and applies consistent styling across all chart types. Built on the shadcn/ui design system with Recharts as the underlying charting library.
|
|
6
|
+
|
|
7
|
+
## JSX Usage
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { ChartContainer } from '@neynar/ui';
|
|
11
|
+
|
|
12
|
+
<ChartContainer
|
|
13
|
+
config={value}
|
|
14
|
+
id="value"
|
|
15
|
+
className="value"
|
|
16
|
+
style={value}
|
|
17
|
+
"aria-label"="value"
|
|
18
|
+
"aria-describedby"="value"
|
|
19
|
+
>
|
|
20
|
+
{/* Your content here */}
|
|
21
|
+
</ChartContainer>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Component Props
|
|
25
|
+
|
|
26
|
+
### config
|
|
27
|
+
- **Type**: `ChartConfig`
|
|
28
|
+
- **Required**: Yes
|
|
29
|
+
- **Description**: No description available
|
|
30
|
+
|
|
31
|
+
### children
|
|
32
|
+
- **Type**: `React.ComponentProps<
|
|
33
|
+
typeof RechartsPrimitive.ResponsiveContainer
|
|
34
|
+
>["children"]`
|
|
35
|
+
- **Required**: Yes
|
|
36
|
+
- **Description**: No description available
|
|
37
|
+
|
|
38
|
+
### id
|
|
39
|
+
- **Type**: `string`
|
|
40
|
+
- **Required**: No
|
|
41
|
+
- **Description**: No description available
|
|
42
|
+
|
|
43
|
+
### className
|
|
44
|
+
- **Type**: `string`
|
|
45
|
+
- **Required**: No
|
|
46
|
+
- **Description**: No description available
|
|
47
|
+
|
|
48
|
+
### style
|
|
49
|
+
- **Type**: `React.CSSProperties`
|
|
50
|
+
- **Required**: No
|
|
51
|
+
- **Description**: No description available
|
|
52
|
+
|
|
53
|
+
### "aria-label"
|
|
54
|
+
- **Type**: `string`
|
|
55
|
+
- **Required**: No
|
|
56
|
+
- **Description**: No description available
|
|
57
|
+
|
|
58
|
+
### "aria-describedby"
|
|
59
|
+
- **Type**: `string`
|
|
60
|
+
- **Required**: No
|
|
61
|
+
- **Description**: No description available
|
|
62
|
+
|
|
63
|
+
## Examples
|
|
64
|
+
|
|
65
|
+
### Example 1
|
|
66
|
+
```tsx
|
|
67
|
+
// Basic line chart with accessibility and tooltips
|
|
68
|
+
const chartData = [
|
|
69
|
+
{ month: "Jan", revenue: 2000, profit: 400 },
|
|
70
|
+
{ month: "Feb", revenue: 2400, profit: 600 },
|
|
71
|
+
{ month: "Mar", revenue: 3200, profit: 900 },
|
|
72
|
+
]
|
|
73
|
+
const chartConfig = {
|
|
74
|
+
revenue: {
|
|
75
|
+
label: "Revenue",
|
|
76
|
+
color: "hsl(var(--chart-1))",
|
|
77
|
+
},
|
|
78
|
+
profit: {
|
|
79
|
+
label: "Profit",
|
|
80
|
+
color: "hsl(var(--chart-2))",
|
|
81
|
+
},
|
|
82
|
+
} satisfies ChartConfig
|
|
83
|
+
<ChartContainer config={chartConfig} className="min-h-[300px]">
|
|
84
|
+
<LineChart data={chartData} accessibilityLayer>
|
|
85
|
+
<CartesianGrid strokeDasharray="3 3" />
|
|
86
|
+
<XAxis dataKey="month" />
|
|
87
|
+
<YAxis />
|
|
88
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
89
|
+
<Line
|
|
90
|
+
type="monotone"
|
|
91
|
+
dataKey="revenue"
|
|
92
|
+
stroke="var(--color-revenue)"
|
|
93
|
+
strokeWidth={2}
|
|
94
|
+
/>
|
|
95
|
+
<Line
|
|
96
|
+
type="monotone"
|
|
97
|
+
dataKey="profit"
|
|
98
|
+
stroke="var(--color-profit)"
|
|
99
|
+
strokeWidth={2}
|
|
100
|
+
/>
|
|
101
|
+
</LineChart>
|
|
102
|
+
</ChartContainer>
|
|
103
|
+
```
|
|
104
|
+
### Example 2
|
|
105
|
+
```tsx
|
|
106
|
+
// Bar chart with theme-aware colors and custom formatting
|
|
107
|
+
<ChartContainer
|
|
108
|
+
config={{
|
|
109
|
+
sales: {
|
|
110
|
+
label: "Sales",
|
|
111
|
+
theme: {
|
|
112
|
+
light: "#0ea5e9",
|
|
113
|
+
dark: "#0284c7",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
}}
|
|
117
|
+
className="h-[400px]"
|
|
118
|
+
>
|
|
119
|
+
<BarChart data={data} accessibilityLayer>
|
|
120
|
+
<XAxis dataKey="month" />
|
|
121
|
+
<YAxis tickFormatter={(value) => `$${value.toLocaleString()}`} />
|
|
122
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
123
|
+
<Bar dataKey="sales" fill="var(--color-sales)" radius={4} />
|
|
124
|
+
</BarChart>
|
|
125
|
+
</ChartContainer>
|
|
126
|
+
```
|
|
127
|
+
### Example 3
|
|
128
|
+
```tsx
|
|
129
|
+
// Pie chart with legend and icons for device breakdown
|
|
130
|
+
<ChartContainer config={{
|
|
131
|
+
desktop: {
|
|
132
|
+
label: "Desktop",
|
|
133
|
+
color: "var(--chart-1)",
|
|
134
|
+
icon: MonitorIcon,
|
|
135
|
+
},
|
|
136
|
+
mobile: {
|
|
137
|
+
label: "Mobile",
|
|
138
|
+
color: "var(--chart-2)",
|
|
139
|
+
icon: SmartphoneIcon,
|
|
140
|
+
},
|
|
141
|
+
}}>
|
|
142
|
+
<PieChart>
|
|
143
|
+
<Pie data={data} dataKey="value" nameKey="device" />
|
|
144
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
145
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
146
|
+
</PieChart>
|
|
147
|
+
</ChartContainer>
|
|
148
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# ChartLegendContent
|
|
2
|
+
|
|
3
|
+
**Type**: component
|
|
4
|
+
|
|
5
|
+
Custom legend content component for charts Provides a styled legend that displays chart series with colors and labels from the chart configuration. Supports icon display, custom positioning, and automatic theming integration.
|
|
6
|
+
|
|
7
|
+
## JSX Usage
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { ChartLegendContent } from '@neynar/ui';
|
|
11
|
+
|
|
12
|
+
<ChartLegendContent
|
|
13
|
+
hideIcon={true}
|
|
14
|
+
nameKey="value"
|
|
15
|
+
payload={value}
|
|
16
|
+
verticalAlign={value}
|
|
17
|
+
className="value"
|
|
18
|
+
/>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Component Props
|
|
22
|
+
|
|
23
|
+
### hideIcon
|
|
24
|
+
- **Type**: `boolean`
|
|
25
|
+
- **Required**: No
|
|
26
|
+
- **Description**: No description available
|
|
27
|
+
|
|
28
|
+
### nameKey
|
|
29
|
+
- **Type**: `string`
|
|
30
|
+
- **Required**: No
|
|
31
|
+
- **Description**: No description available
|
|
32
|
+
|
|
33
|
+
### payload
|
|
34
|
+
- **Type**: `Array<{
|
|
35
|
+
value: string;
|
|
36
|
+
type?: string;
|
|
37
|
+
color?: string;
|
|
38
|
+
dataKey?: string;
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
payload?: any;
|
|
41
|
+
}>`
|
|
42
|
+
- **Required**: No
|
|
43
|
+
- **Description**: No description available
|
|
44
|
+
|
|
45
|
+
### verticalAlign
|
|
46
|
+
- **Type**: `"top" | "middle" | "bottom"`
|
|
47
|
+
- **Required**: No
|
|
48
|
+
- **Description**: No description available
|
|
49
|
+
|
|
50
|
+
### className
|
|
51
|
+
- **Type**: `string`
|
|
52
|
+
- **Required**: No
|
|
53
|
+
- **Description**: No description available
|
|
54
|
+
|
|
55
|
+
## Examples
|
|
56
|
+
|
|
57
|
+
### Example 1
|
|
58
|
+
```tsx
|
|
59
|
+
// Basic legend with default settings
|
|
60
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
61
|
+
```
|
|
62
|
+
### Example 2
|
|
63
|
+
```tsx
|
|
64
|
+
// Legend positioned at top without icons
|
|
65
|
+
<ChartLegend
|
|
66
|
+
content={
|
|
67
|
+
<ChartLegendContent
|
|
68
|
+
verticalAlign="top"
|
|
69
|
+
hideIcon={true}
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
/>
|
|
73
|
+
```
|
|
74
|
+
### Example 3
|
|
75
|
+
```tsx
|
|
76
|
+
// Legend with custom name key
|
|
77
|
+
<ChartLegend
|
|
78
|
+
content={
|
|
79
|
+
<ChartLegendContent
|
|
80
|
+
nameKey="category"
|
|
81
|
+
className="justify-start"
|
|
82
|
+
/>
|
|
83
|
+
}
|
|
84
|
+
/>
|
|
85
|
+
```
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# ChartLegend
|
|
2
|
+
|
|
3
|
+
**Type**: component
|
|
4
|
+
|
|
5
|
+
Legend component for charts Re-export of Recharts Legend component with support for custom content. Use with ChartLegendContent for consistent styling and theming integration.
|
|
6
|
+
|
|
7
|
+
## JSX Usage
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { ChartLegend } from '@neynar/ui';
|
|
11
|
+
|
|
12
|
+
<ChartLegend
|
|
13
|
+
content={value}
|
|
14
|
+
payload={value}
|
|
15
|
+
align={value}
|
|
16
|
+
verticalAlign={value}
|
|
17
|
+
height={0}
|
|
18
|
+
width={0}
|
|
19
|
+
wrapperStyle={value}
|
|
20
|
+
wrapperClassName="value"
|
|
21
|
+
layout={value}
|
|
22
|
+
iconSize={0}
|
|
23
|
+
iconType={value}
|
|
24
|
+
margin={value}
|
|
25
|
+
onClick={handleClick}
|
|
26
|
+
onMouseEnter={handleMouseEnter}
|
|
27
|
+
onMouseLeave={handleMouseLeave}
|
|
28
|
+
formatter={() => {}}
|
|
29
|
+
/>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Component Props
|
|
33
|
+
|
|
34
|
+
### content
|
|
35
|
+
- **Type**: `React.ComponentType<any> | React.ReactElement`
|
|
36
|
+
- **Required**: No
|
|
37
|
+
- **Description**: No description available
|
|
38
|
+
|
|
39
|
+
### payload
|
|
40
|
+
- **Type**: `Array<{
|
|
41
|
+
value: string;
|
|
42
|
+
type?: string;
|
|
43
|
+
color?: string;
|
|
44
|
+
dataKey?: string;
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
payload?: any;
|
|
47
|
+
}>`
|
|
48
|
+
- **Required**: No
|
|
49
|
+
- **Description**: No description available
|
|
50
|
+
|
|
51
|
+
### align
|
|
52
|
+
- **Type**: `"left" | "center" | "right"`
|
|
53
|
+
- **Required**: No
|
|
54
|
+
- **Description**: No description available
|
|
55
|
+
|
|
56
|
+
### verticalAlign
|
|
57
|
+
- **Type**: `"top" | "middle" | "bottom"`
|
|
58
|
+
- **Required**: No
|
|
59
|
+
- **Description**: No description available
|
|
60
|
+
|
|
61
|
+
### height
|
|
62
|
+
- **Type**: `number`
|
|
63
|
+
- **Required**: No
|
|
64
|
+
- **Description**: No description available
|
|
65
|
+
|
|
66
|
+
### width
|
|
67
|
+
- **Type**: `number`
|
|
68
|
+
- **Required**: No
|
|
69
|
+
- **Description**: No description available
|
|
70
|
+
|
|
71
|
+
### wrapperStyle
|
|
72
|
+
- **Type**: `React.CSSProperties`
|
|
73
|
+
- **Required**: No
|
|
74
|
+
- **Description**: No description available
|
|
75
|
+
|
|
76
|
+
### wrapperClassName
|
|
77
|
+
- **Type**: `string`
|
|
78
|
+
- **Required**: No
|
|
79
|
+
- **Description**: No description available
|
|
80
|
+
|
|
81
|
+
### layout
|
|
82
|
+
- **Type**: `"horizontal" | "vertical"`
|
|
83
|
+
- **Required**: No
|
|
84
|
+
- **Description**: No description available
|
|
85
|
+
|
|
86
|
+
### iconSize
|
|
87
|
+
- **Type**: `number`
|
|
88
|
+
- **Required**: No
|
|
89
|
+
- **Description**: No description available
|
|
90
|
+
|
|
91
|
+
### iconType
|
|
92
|
+
- **Type**: `| "line"
|
|
93
|
+
| "rect"
|
|
94
|
+
| "circle"
|
|
95
|
+
| "cross"
|
|
96
|
+
| "diamond"
|
|
97
|
+
| "square"
|
|
98
|
+
| "star"
|
|
99
|
+
| "triangle"
|
|
100
|
+
| "wye"`
|
|
101
|
+
- **Required**: No
|
|
102
|
+
- **Description**: No description available
|
|
103
|
+
|
|
104
|
+
### margin
|
|
105
|
+
- **Type**: `{ top?: number; right?: number; bottom?: number; left?: number }`
|
|
106
|
+
- **Required**: No
|
|
107
|
+
- **Description**: No description available
|
|
108
|
+
|
|
109
|
+
### onClick
|
|
110
|
+
- **Type**: `(data: any, index: number, event: React.MouseEvent) => void`
|
|
111
|
+
- **Required**: No
|
|
112
|
+
- **Description**: No description available
|
|
113
|
+
|
|
114
|
+
### onMouseEnter
|
|
115
|
+
- **Type**: `(data: any, index: number, event: React.MouseEvent) => void`
|
|
116
|
+
- **Required**: No
|
|
117
|
+
- **Description**: No description available
|
|
118
|
+
|
|
119
|
+
### onMouseLeave
|
|
120
|
+
- **Type**: `(data: any, index: number, event: React.MouseEvent) => void`
|
|
121
|
+
- **Required**: No
|
|
122
|
+
- **Description**: No description available
|
|
123
|
+
|
|
124
|
+
### formatter
|
|
125
|
+
- **Type**: `(value: any, entry: any, index: number) => React.ReactNode`
|
|
126
|
+
- **Required**: No
|
|
127
|
+
- **Description**: No description available
|
|
128
|
+
|
|
129
|
+
## Examples
|
|
130
|
+
|
|
131
|
+
### Example 1
|
|
132
|
+
```tsx
|
|
133
|
+
// Basic legend
|
|
134
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
135
|
+
```
|
|
136
|
+
### Example 2
|
|
137
|
+
```tsx
|
|
138
|
+
// Legend positioned at top
|
|
139
|
+
<ChartLegend
|
|
140
|
+
content={<ChartLegendContent />}
|
|
141
|
+
verticalAlign="top"
|
|
142
|
+
height={36}
|
|
143
|
+
/>
|
|
144
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# ChartStyle
|
|
2
|
+
|
|
3
|
+
**Type**: component
|
|
4
|
+
|
|
5
|
+
Internal component that generates CSS custom properties for chart colors Creates CSS variables based on the chart configuration to enable theme-aware coloring. Generates variables for both light and dark themes when theme configurations are provided, or uses static colors when available.
|
|
6
|
+
|
|
7
|
+
## JSX Usage
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { ChartStyle } from '@neynar/ui';
|
|
11
|
+
|
|
12
|
+
<ChartStyle
|
|
13
|
+
id={value}
|
|
14
|
+
config={value}
|
|
15
|
+
/>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Component Props
|
|
19
|
+
|
|
20
|
+
### id
|
|
21
|
+
- **Type**: `unknown`
|
|
22
|
+
- **Required**: Yes
|
|
23
|
+
- **Description**: No description available
|
|
24
|
+
|
|
25
|
+
### config
|
|
26
|
+
- **Type**: `unknown`
|
|
27
|
+
- **Required**: Yes
|
|
28
|
+
- **Description**: No description available
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# ChartTooltipContent
|
|
2
|
+
|
|
3
|
+
**Type**: component
|
|
4
|
+
|
|
5
|
+
Custom tooltip content component for charts Provides a styled tooltip that displays chart data with proper formatting, colors, and labels from the chart configuration. Supports multiple indicator styles, custom formatters, and automatic theming integration.
|
|
6
|
+
|
|
7
|
+
## JSX Usage
|
|
8
|
+
|
|
9
|
+
```jsx
|
|
10
|
+
import { ChartTooltipContent } from '@neynar/ui';
|
|
11
|
+
|
|
12
|
+
<ChartTooltipContent
|
|
13
|
+
hideLabel={true}
|
|
14
|
+
hideIndicator={true}
|
|
15
|
+
indicator={value}
|
|
16
|
+
nameKey="value"
|
|
17
|
+
labelKey="value"
|
|
18
|
+
active={true}
|
|
19
|
+
payload={[]}
|
|
20
|
+
className="value"
|
|
21
|
+
label={value}
|
|
22
|
+
formatter={() => {}}
|
|
23
|
+
labelFormatter={[]}
|
|
24
|
+
labelClassName="value"
|
|
25
|
+
color="value"
|
|
26
|
+
/>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Component Props
|
|
30
|
+
|
|
31
|
+
### hideLabel
|
|
32
|
+
- **Type**: `boolean`
|
|
33
|
+
- **Required**: No
|
|
34
|
+
- **Description**: No description available
|
|
35
|
+
|
|
36
|
+
### hideIndicator
|
|
37
|
+
- **Type**: `boolean`
|
|
38
|
+
- **Required**: No
|
|
39
|
+
- **Description**: No description available
|
|
40
|
+
|
|
41
|
+
### indicator
|
|
42
|
+
- **Type**: `"line" | "dot" | "dashed"`
|
|
43
|
+
- **Required**: No
|
|
44
|
+
- **Description**: No description available
|
|
45
|
+
|
|
46
|
+
### nameKey
|
|
47
|
+
- **Type**: `string`
|
|
48
|
+
- **Required**: No
|
|
49
|
+
- **Description**: No description available
|
|
50
|
+
|
|
51
|
+
### labelKey
|
|
52
|
+
- **Type**: `string`
|
|
53
|
+
- **Required**: No
|
|
54
|
+
- **Description**: No description available
|
|
55
|
+
|
|
56
|
+
### active
|
|
57
|
+
- **Type**: `boolean`
|
|
58
|
+
- **Required**: No
|
|
59
|
+
- **Description**: No description available
|
|
60
|
+
|
|
61
|
+
### payload
|
|
62
|
+
- **Type**: `any[]`
|
|
63
|
+
- **Required**: No
|
|
64
|
+
- **Description**: No description available
|
|
65
|
+
|
|
66
|
+
### className
|
|
67
|
+
- **Type**: `string`
|
|
68
|
+
- **Required**: No
|
|
69
|
+
- **Description**: No description available
|
|
70
|
+
|
|
71
|
+
### label
|
|
72
|
+
- **Type**: `string | number`
|
|
73
|
+
- **Required**: No
|
|
74
|
+
- **Description**: No description available
|
|
75
|
+
|
|
76
|
+
### formatter
|
|
77
|
+
- **Type**: `(
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
+
value: any,
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
name: any,
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
props: any,
|
|
84
|
+
) => [React.ReactNode, React.ReactNode] | React.ReactNode`
|
|
85
|
+
- **Required**: No
|
|
86
|
+
- **Description**: No description available
|
|
87
|
+
|
|
88
|
+
### labelFormatter
|
|
89
|
+
- **Type**: `(label: any, payload: any[]) => React.ReactNode`
|
|
90
|
+
- **Required**: No
|
|
91
|
+
- **Description**: No description available
|
|
92
|
+
|
|
93
|
+
### labelClassName
|
|
94
|
+
- **Type**: `string`
|
|
95
|
+
- **Required**: No
|
|
96
|
+
- **Description**: No description available
|
|
97
|
+
|
|
98
|
+
### color
|
|
99
|
+
- **Type**: `string`
|
|
100
|
+
- **Required**: No
|
|
101
|
+
- **Description**: No description available
|
|
102
|
+
|
|
103
|
+
## Examples
|
|
104
|
+
|
|
105
|
+
### Example 1
|
|
106
|
+
```tsx
|
|
107
|
+
// Basic tooltip with default styling
|
|
108
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
109
|
+
```
|
|
110
|
+
### Example 2
|
|
111
|
+
```tsx
|
|
112
|
+
// Tooltip with custom value formatter
|
|
113
|
+
<ChartTooltip
|
|
114
|
+
content={
|
|
115
|
+
<ChartTooltipContent
|
|
116
|
+
formatter={(value, name) => [
|
|
117
|
+
`$${value.toLocaleString()}`,
|
|
118
|
+
name.toUpperCase()
|
|
119
|
+
]}
|
|
120
|
+
/>
|
|
121
|
+
}
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
### Example 3
|
|
125
|
+
```tsx
|
|
126
|
+
// Tooltip with line indicator and custom label
|
|
127
|
+
<ChartTooltip
|
|
128
|
+
content={
|
|
129
|
+
<ChartTooltipContent
|
|
130
|
+
indicator="line"
|
|
131
|
+
labelFormatter={(label) => `Week of ${label}`}
|
|
132
|
+
hideLabel={false}
|
|
133
|
+
/>
|
|
134
|
+
}
|
|
135
|
+
/>
|
|
136
|
+
```
|
|
137
|
+
### Example 4
|
|
138
|
+
```tsx
|
|
139
|
+
// Tooltip with dashed indicator and no icons
|
|
140
|
+
<ChartTooltip
|
|
141
|
+
content={
|
|
142
|
+
<ChartTooltipContent
|
|
143
|
+
indicator="dashed"
|
|
144
|
+
hideIndicator={false}
|
|
145
|
+
nameKey="category"
|
|
146
|
+
/>
|
|
147
|
+
}
|
|
148
|
+
/>
|
|
149
|
+
```
|