chiperos-ai-components-library 0.1.8 → 0.2.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.
@@ -0,0 +1,38 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { ComposedChart } from './index';
3
+
4
+ declare const meta: Meta<typeof ComposedChart>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof ComposedChart>;
7
+ /**
8
+ * Default example showing a mixed chart with bars and a line
9
+ */
10
+ export declare const Default: Story;
11
+ /**
12
+ * Chart with Area, Bar, and Line combined
13
+ */
14
+ export declare const WithArea: Story;
15
+ /**
16
+ * Multiple bars chart
17
+ */
18
+ export declare const BarsOnly: Story;
19
+ /**
20
+ * Multiple lines chart
21
+ */
22
+ export declare const LinesOnly: Story;
23
+ /**
24
+ * Stacked bars example
25
+ */
26
+ export declare const StackedBars: Story;
27
+ /**
28
+ * Full composed example with all three types
29
+ */
30
+ export declare const FullComposed: Story;
31
+ /**
32
+ * Chart with dual Y-axis
33
+ */
34
+ export declare const DualYAxis: Story;
35
+ /**
36
+ * Minimal chart without grid and legend
37
+ */
38
+ export declare const Minimal: Story;
@@ -0,0 +1,111 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Configuration for a single data series in the chart
4
+ */
5
+ export interface ComposedChartSeries {
6
+ /**
7
+ * Type of visualization for this series
8
+ */
9
+ type: 'bar' | 'line' | 'area';
10
+ /**
11
+ * Key in the data objects for this series values
12
+ */
13
+ dataKey: string;
14
+ /**
15
+ * Display name for this series (used in legend and tooltip)
16
+ */
17
+ name?: string;
18
+ /**
19
+ * Color for this series
20
+ * @default Auto-assigned from palette
21
+ */
22
+ color?: string;
23
+ /**
24
+ * Stack ID for grouping stacked bars/areas
25
+ */
26
+ stackId?: string;
27
+ /**
28
+ * Y-axis ID to use for this series
29
+ * @default "left"
30
+ */
31
+ yAxisId?: 'left' | 'right';
32
+ }
33
+ export interface ComposedChartProps {
34
+ /**
35
+ * Array of data objects to display
36
+ */
37
+ data: Record<string, unknown>[];
38
+ /**
39
+ * Configuration for each data series
40
+ */
41
+ series: ComposedChartSeries[];
42
+ /**
43
+ * Key in the data objects for the X-axis values
44
+ */
45
+ xAxisKey: string;
46
+ /**
47
+ * Height of the chart in pixels
48
+ * @default 400
49
+ */
50
+ height?: number;
51
+ /**
52
+ * Whether to show the grid lines
53
+ * @default true
54
+ */
55
+ showGrid?: boolean;
56
+ /**
57
+ * Whether to show the legend
58
+ * @default true
59
+ */
60
+ showLegend?: boolean;
61
+ /**
62
+ * Whether to show tooltips on hover
63
+ * @default true
64
+ */
65
+ showTooltip?: boolean;
66
+ /**
67
+ * Whether to show a secondary Y-axis on the right
68
+ * @default false
69
+ */
70
+ showRightYAxis?: boolean;
71
+ /**
72
+ * Custom margin for the chart
73
+ */
74
+ margin?: {
75
+ top?: number;
76
+ right?: number;
77
+ bottom?: number;
78
+ left?: number;
79
+ };
80
+ /**
81
+ * Bar gap in pixels
82
+ * @default 4
83
+ */
84
+ barGap?: number;
85
+ /**
86
+ * Bar size in pixels
87
+ */
88
+ barSize?: number;
89
+ }
90
+ /**
91
+ * ComposedChart Component
92
+ *
93
+ * A flexible chart component that can display bars, lines, and areas together.
94
+ * Built on top of recharts library.
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * <ComposedChart
99
+ * data={[
100
+ * { month: 'Jan', sales: 400, revenue: 2400 },
101
+ * { month: 'Feb', sales: 300, revenue: 1398 },
102
+ * ]}
103
+ * xAxisKey="month"
104
+ * series={[
105
+ * { type: 'bar', dataKey: 'sales', name: 'Sales', color: '#00995a' },
106
+ * { type: 'line', dataKey: 'revenue', name: 'Revenue', color: '#312e4d' },
107
+ * ]}
108
+ * />
109
+ * ```
110
+ */
111
+ export declare const ComposedChart: React.FC<ComposedChartProps>;
@@ -0,0 +1,26 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { FilterContainer } from './index';
3
+
4
+ declare const meta: Meta<typeof FilterContainer>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof FilterContainer>;
7
+ /**
8
+ * Basic usage with a few filters
9
+ */
10
+ export declare const Default: Story;
11
+ /**
12
+ * Multiple filters demonstrating flex-wrap behavior
13
+ */
14
+ export declare const ManyFilters: Story;
15
+ /**
16
+ * Single filter
17
+ */
18
+ export declare const SingleFilter: Story;
19
+ /**
20
+ * With disabled buttons
21
+ */
22
+ export declare const DisabledButtons: Story;
23
+ /**
24
+ * Controlled example with state management
25
+ */
26
+ export declare const Controlled: Story;
@@ -0,0 +1,70 @@
1
+ import { default as React } from 'react';
2
+ import { SelectOption } from '../Select';
3
+
4
+ export interface FilterContainerFilter {
5
+ /**
6
+ * Unique key for the filter
7
+ */
8
+ key: string;
9
+ /**
10
+ * Label for the filter
11
+ */
12
+ label: string;
13
+ /**
14
+ * Placeholder text shown when no option is selected
15
+ */
16
+ placeholder?: string;
17
+ /**
18
+ * Options for dropdown filter
19
+ */
20
+ options: SelectOption[];
21
+ /**
22
+ * Selected value
23
+ */
24
+ value?: string;
25
+ /**
26
+ * Callback when filter changes
27
+ */
28
+ onChange?: (value: string) => void;
29
+ }
30
+ export interface FilterContainerProps {
31
+ /**
32
+ * Array of filters to display
33
+ */
34
+ filters: FilterContainerFilter[];
35
+ /**
36
+ * Callback when Apply button is clicked
37
+ */
38
+ onApply?: () => void;
39
+ /**
40
+ * Callback when Download button is clicked
41
+ */
42
+ onDownload?: () => void;
43
+ /**
44
+ * Callback when Restart button is clicked
45
+ */
46
+ onRestart?: () => void;
47
+ /**
48
+ * Custom label for Apply button
49
+ * @default "Apply"
50
+ */
51
+ applyLabel?: string;
52
+ /**
53
+ * Disable Apply button
54
+ */
55
+ applyDisabled?: boolean;
56
+ /**
57
+ * Disable Download button
58
+ */
59
+ downloadDisabled?: boolean;
60
+ /**
61
+ * Disable Restart button
62
+ */
63
+ restartDisabled?: boolean;
64
+ /**
65
+ * Additional CSS classes
66
+ */
67
+ className?: string;
68
+ }
69
+ export declare const FilterContainer: React.FC<FilterContainerProps>;
70
+ export default FilterContainer;
@@ -0,0 +1,42 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { ProgressBarInfo } from './index';
3
+
4
+ declare const meta: Meta<typeof ProgressBarInfo>;
5
+ export default meta;
6
+ type Story = StoryObj<typeof ProgressBarInfo>;
7
+ /**
8
+ * Default example matching the Product Category Breakdown design
9
+ */
10
+ export declare const Default: Story;
11
+ /**
12
+ * Single column legend layout
13
+ */
14
+ export declare const SingleColumnLegend: Story;
15
+ /**
16
+ * Three segments example
17
+ */
18
+ export declare const ThreeSegments: Story;
19
+ /**
20
+ * Without change indicators
21
+ */
22
+ export declare const WithoutChange: Story;
23
+ /**
24
+ * Custom colors example
25
+ */
26
+ export declare const CustomColors: Story;
27
+ /**
28
+ * Taller bar variant
29
+ */
30
+ export declare const TallBar: Story;
31
+ /**
32
+ * Thin bar variant
33
+ */
34
+ export declare const ThinBar: Story;
35
+ /**
36
+ * Without legend
37
+ */
38
+ export declare const WithoutLegend: Story;
39
+ /**
40
+ * Three column legend
41
+ */
42
+ export declare const ThreeColumnLegend: Story;
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * A single segment in the progress bar
4
+ */
5
+ export interface ProgressBarSegment {
6
+ /**
7
+ * Unique identifier for the segment
8
+ */
9
+ id: string;
10
+ /**
11
+ * Display label for this segment
12
+ */
13
+ label: string;
14
+ /**
15
+ * Percentage value (0-100) for this segment
16
+ */
17
+ percentage: number;
18
+ /**
19
+ * Change indicator (e.g., +5.9%, -2.3%)
20
+ */
21
+ change?: string;
22
+ /**
23
+ * Custom color for this segment (optional - uses palette if not provided)
24
+ */
25
+ color?: string;
26
+ }
27
+ export interface ProgressBarInfoProps extends React.HTMLAttributes<HTMLDivElement> {
28
+ /**
29
+ * Array of segments to display
30
+ */
31
+ segments: ProgressBarSegment[];
32
+ /**
33
+ * Height of the progress bar in pixels
34
+ * @default 24
35
+ */
36
+ barHeight?: number;
37
+ /**
38
+ * Border radius of the progress bar
39
+ * @default 8
40
+ */
41
+ borderRadius?: number;
42
+ /**
43
+ * Number of columns for the legend grid
44
+ * @default 2
45
+ */
46
+ legendColumns?: number;
47
+ /**
48
+ * Whether to show the legend
49
+ * @default true
50
+ */
51
+ showLegend?: boolean;
52
+ /**
53
+ * Gap between legend items
54
+ * @default 16
55
+ */
56
+ legendGap?: number;
57
+ }
58
+ /**
59
+ * ProgressBarInfo Component
60
+ *
61
+ * A stacked horizontal progress bar with a legend showing category breakdown.
62
+ * Width is 100% of its container.
63
+ *
64
+ * @example
65
+ * ```tsx
66
+ * <ProgressBarInfo
67
+ * segments={[
68
+ * { id: '1', label: 'Bebidas no Alcohólicas', percentage: 41.2, change: '+5.9%' },
69
+ * { id: '2', label: 'Despensa', percentage: 12.3, change: '+1.7%' },
70
+ * { id: '3', label: 'Pide tu bulto aquí', percentage: 8, change: '+23.2%' },
71
+ * ]}
72
+ * />
73
+ * ```
74
+ */
75
+ export declare const ProgressBarInfo: React.ForwardRefExoticComponent<ProgressBarInfoProps & React.RefAttributes<HTMLDivElement>>;
@@ -16,3 +16,6 @@ export * from './Switcher';
16
16
  export * from './Table';
17
17
  export * from './TableHeader';
18
18
  export * from './Toasts';
19
+ export * from './FilterContainer';
20
+ export * from './ComposedChart';
21
+ export * from './ProgressBarInfo';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "chiperos-ai-components-library",
3
3
  "private": false,
4
- "version": "0.1.8",
4
+ "version": "0.2.1",
5
5
  "description": "Chiperos AI Components Library - A modern React component library built with Vite, TypeScript and Tailwind CSS.",
6
6
  "type": "module",
7
7
  "main": "./dist/chiperos-ai-components-library.cjs",
@@ -29,16 +29,17 @@
29
29
  "class-variance-authority": "^0.7.1",
30
30
  "libphonenumber-js": "^1.12.31",
31
31
  "lucide-react": "^0.534.0",
32
+ "recharts": "^3.6.0",
32
33
  "zod": "^4.1.13"
33
34
  },
34
35
  "peerDependencies": {
35
- "react": "^18.2.0",
36
- "react-dom": "^18.2.0",
37
36
  "@radix-ui/react-radio-group": "^1.3.8",
38
37
  "@radix-ui/react-slot": "^1.2.4",
39
38
  "@radix-ui/react-switch": "^1.2.6",
40
39
  "next-intl": "^4.3.4",
41
- "radix-ui": "^1.4.3"
40
+ "radix-ui": "^1.4.3",
41
+ "react": "^18.2.0",
42
+ "react-dom": "^18.2.0"
42
43
  },
43
44
  "peerDependenciesMeta": {
44
45
  "@radix-ui/react-radio-group": {
@@ -58,13 +59,10 @@
58
59
  }
59
60
  },
60
61
  "devDependencies": {
62
+ "@chromatic-com/storybook": "^1.5.0",
61
63
  "@radix-ui/react-radio-group": "^1.3.8",
62
64
  "@radix-ui/react-slot": "^1.2.4",
63
65
  "@radix-ui/react-switch": "^1.2.6",
64
- "lucide-react": "^0.534.0",
65
- "next-intl": "^4.3.4",
66
- "radix-ui": "^1.4.3",
67
- "@chromatic-com/storybook": "^1.5.0",
68
66
  "@storybook/addon-essentials": "^8.1.10",
69
67
  "@storybook/addon-interactions": "^8.1.10",
70
68
  "@storybook/addon-links": "^8.1.10",
@@ -81,6 +79,9 @@
81
79
  "@vitejs/plugin-react": "^4.3.1",
82
80
  "clsx": "^2.1.1",
83
81
  "jsdom": "^24.1.0",
82
+ "lucide-react": "^0.534.0",
83
+ "next-intl": "^4.3.4",
84
+ "radix-ui": "^1.4.3",
84
85
  "react": "^18.2.0",
85
86
  "react-dom": "^18.2.0",
86
87
  "storybook": "^8.1.10",