Skip to content

Commit 0ae4f6b

Browse files
Copilothotlong
andcommitted
Fix chart component naming from chart-bar to bar-chart
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 635c5a7 commit 0ae4f6b

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

docs/plugins/plugin-charts.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import '@object-ui/plugin-charts'
1818

1919
// Use in schemas
2020
const schema = {
21-
type: 'chart-bar',
21+
type: 'bar-chart',
2222
data: [
2323
{ name: 'Jan', value: 400 },
2424
{ name: 'Feb', value: 300 },
@@ -41,7 +41,7 @@ const schema = {
4141

4242
```typescript
4343
{
44-
type: 'chart-bar',
44+
type: 'bar-chart',
4545
data?: Array<Record<string, any>>, // Chart data
4646
dataKey?: string, // Y-axis data key
4747
xAxisKey?: string, // X-axis label key
@@ -68,7 +68,7 @@ const schema = {
6868

6969
```tsx
7070
const schema = {
71-
type: 'chart-bar',
71+
type: 'bar-chart',
7272
data: [
7373
{ month: 'Jan', sales: 400 },
7474
{ month: 'Feb', sales: 300 },
@@ -134,7 +134,7 @@ const schema = {
134134

135135
```tsx
136136
const revenueChart = {
137-
type: 'chart-bar',
137+
type: 'bar-chart',
138138
data: [
139139
{ quarter: 'Q1 2024', revenue: 45000, target: 50000 },
140140
{ quarter: 'Q2 2024', revenue: 52000, target: 50000 },
@@ -182,7 +182,7 @@ Without lazy loading, this would add 541 KB to your main bundle. With lazy loadi
182182

183183
```tsx
184184
const schema = {
185-
type: 'chart-bar',
185+
type: 'bar-chart',
186186
data: salesData,
187187
color: '#f59e0b', // Amber color
188188
className: 'bg-white p-4 rounded-lg'
@@ -206,7 +206,7 @@ const schema = {
206206
import type { BarChartSchema } from '@object-ui/plugin-charts'
207207

208208
const chartSchema: BarChartSchema = {
209-
type: 'chart-bar',
209+
type: 'bar-chart',
210210
data: [
211211
{ name: 'Product A', value: 400 },
212212
{ name: 'Product B', value: 300 }

packages/plugin-charts/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ A lazy-loaded charting component for Object UI based on Recharts.
55
## Features
66

77
- **Internal Lazy Loading**: Recharts is loaded on-demand using `React.lazy()` and `Suspense`
8-
- **Zero Configuration**: Just import the package and use `type: 'chart-bar'` in your schema
8+
- **Zero Configuration**: Just import the package and use `type: 'bar-chart'` in your schema
99
- **Automatic Registration**: Components auto-register with the ComponentRegistry
1010
- **Skeleton Loading**: Shows a skeleton while Recharts loads
1111

@@ -25,7 +25,7 @@ import '@object-ui/plugin-charts';
2525

2626
// Now you can use chart-bar type in your schemas
2727
const schema = {
28-
type: 'chart-bar',
28+
type: 'bar-chart',
2929
data: [
3030
{ name: 'Jan', value: 400 },
3131
{ name: 'Feb', value: 300 },
@@ -57,7 +57,7 @@ The plugin exports TypeScript types for full type safety:
5757
import type { BarChartSchema } from '@object-ui/plugin-charts';
5858

5959
const schema: BarChartSchema = {
60-
type: 'chart-bar',
60+
type: 'bar-chart',
6161
data: [
6262
{ name: 'Jan', value: 400 },
6363
{ name: 'Feb', value: 300 }
@@ -72,7 +72,7 @@ const schema: BarChartSchema = {
7272

7373
```typescript
7474
{
75-
type: 'chart-bar',
75+
type: 'bar-chart',
7676
data?: Array<Record<string, any>>, // Chart data
7777
dataKey?: string, // Y-axis data key (default: 'value')
7878
xAxisKey?: string, // X-axis label key (default: 'name')

packages/plugin-charts/src/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ describe('Plugin Charts', () => {
77
await import('./index');
88
});
99

10-
describe('chart-bar component', () => {
10+
describe('bar-chart component', () => {
1111
it('should be registered in ComponentRegistry', () => {
12-
const chartBarRenderer = ComponentRegistry.get('chart-bar');
12+
const chartBarRenderer = ComponentRegistry.get('bar-chart');
1313
expect(chartBarRenderer).toBeDefined();
1414
});
1515

1616
it('should have proper metadata', () => {
17-
const config = ComponentRegistry.getConfig('chart-bar');
17+
const config = ComponentRegistry.getConfig('bar-chart');
1818
expect(config).toBeDefined();
1919
expect(config?.label).toBe('Bar Chart');
2020
expect(config?.category).toBe('plugin');
@@ -23,7 +23,7 @@ describe('Plugin Charts', () => {
2323
});
2424

2525
it('should have expected inputs', () => {
26-
const config = ComponentRegistry.getConfig('chart-bar');
26+
const config = ComponentRegistry.getConfig('bar-chart');
2727
const inputNames = config?.inputs?.map((input: any) => input.name) || [];
2828

2929
expect(inputNames).toContain('data');
@@ -34,7 +34,7 @@ describe('Plugin Charts', () => {
3434
});
3535

3636
it('should have data as required input', () => {
37-
const config = ComponentRegistry.getConfig('chart-bar');
37+
const config = ComponentRegistry.getConfig('bar-chart');
3838
const dataInput = config?.inputs?.find((input: any) => input.name === 'data');
3939

4040
expect(dataInput).toBeDefined();
@@ -43,7 +43,7 @@ describe('Plugin Charts', () => {
4343
});
4444

4545
it('should have sensible default props', () => {
46-
const config = ComponentRegistry.getConfig('chart-bar');
46+
const config = ComponentRegistry.getConfig('bar-chart');
4747
const defaults = config?.defaultProps;
4848

4949
expect(defaults).toBeDefined();

packages/plugin-charts/src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const ChartBarRenderer: React.FC<ChartBarRendererProps> = ({ schema }) =>
4444

4545
// Register the component with the ComponentRegistry
4646
ComponentRegistry.register(
47-
'chart-bar',
47+
'bar-chart',
4848
ChartBarRenderer,
4949
{
5050
label: 'Bar Chart',
@@ -196,6 +196,6 @@ ComponentRegistry.register(
196196

197197
// Standard Export Protocol - for manual integration
198198
export const chartComponents = {
199-
'chart-bar': ChartBarRenderer,
199+
'bar-chart': ChartBarRenderer,
200200
'chart': ChartRenderer,
201201
};

packages/plugin-charts/src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import type { BaseSchema } from '@object-ui/types';
1616
* import type { BarChartSchema } from '@object-ui/plugin-charts';
1717
*
1818
* const chartSchema: BarChartSchema = {
19-
* type: 'chart-bar',
19+
* type: 'bar-chart',
2020
* data: [
2121
* { name: 'Jan', value: 400 },
2222
* { name: 'Feb', value: 300 }
@@ -27,7 +27,7 @@ import type { BaseSchema } from '@object-ui/types';
2727
* ```
2828
*/
2929
export interface BarChartSchema extends BaseSchema {
30-
type: 'chart-bar';
30+
type: 'bar-chart';
3131

3232
/**
3333
* Array of data points to display in the chart.

0 commit comments

Comments
 (0)