lupine.components 1.1.55 → 1.1.57
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/LICENSE +21 -21
- package/package.json +1 -1
- package/src/component-pool/aspect-ratio/aspect-ratio-demo.tsx +103 -103
- package/src/component-pool/avatar/avatar-demo.tsx +127 -127
- package/src/component-pool/badge/badge-demo.tsx +152 -152
- package/src/component-pool/breadcrumbs/breadcrumbs-demo.tsx +105 -105
- package/src/component-pool/card/card-demo.tsx +179 -179
- package/src/component-pool/carousel/carousel-demo.tsx +191 -191
- package/src/component-pool/cascader/cascader-demo.tsx +127 -127
- package/src/component-pool/charts/area-chart-demo.tsx +106 -106
- package/src/component-pool/charts/area-chart.tsx +254 -254
- package/src/component-pool/charts/bar-chart-demo.tsx +107 -107
- package/src/component-pool/charts/bar-chart.tsx +223 -223
- package/src/component-pool/charts/chart-utils.ts +182 -182
- package/src/component-pool/charts/column-chart-demo.tsx +111 -111
- package/src/component-pool/charts/column-chart.tsx +230 -230
- package/src/component-pool/charts/donut-chart-demo.tsx +112 -112
- package/src/component-pool/charts/donut-chart.tsx +6 -6
- package/src/component-pool/charts/gauge-chart-demo.tsx +101 -101
- package/src/component-pool/charts/gauge-chart.tsx +117 -117
- package/src/component-pool/charts/index.ts +19 -19
- package/src/component-pool/charts/line-chart-demo.tsx +109 -109
- package/src/component-pool/charts/line-chart.tsx +233 -233
- package/src/component-pool/charts/pie-chart-demo.tsx +133 -133
- package/src/component-pool/charts/pie-chart.tsx +142 -142
- package/src/component-pool/charts/radar-chart-demo.tsx +88 -88
- package/src/component-pool/charts/radar-chart.tsx +231 -231
- package/src/component-pool/charts/scatter-chart-demo.tsx +88 -88
- package/src/component-pool/charts/scatter-chart.tsx +237 -237
- package/src/component-pool/copy-button/copy-button-demo.tsx +71 -71
- package/src/component-pool/date-picker/date-picker-demo.tsx +84 -84
- package/src/component-pool/date-picker/date-picker.tsx +437 -437
- package/src/component-pool/date-picker/index.ts +2 -2
- package/src/component-pool/floating-icon-menu/floating-icon-menu-demo.tsx +94 -94
- package/src/component-pool/floating-icon-menu/floating-icon-menu.tsx +241 -241
- package/src/component-pool/floating-icon-menu/index.ts +2 -2
- package/src/component-pool/h-editor/h-editor-demo.tsx +112 -112
- package/src/component-pool/h-editor/h-editor.ts +862 -862
- package/src/component-pool/h-editor/index.ts +2 -2
- package/src/component-pool/i-editor/i-editor-demo.tsx +72 -72
- package/src/component-pool/i-editor/i-editor-frames.ts +42 -42
- package/src/component-pool/i-editor/i-editor-styles.ts +22 -22
- package/src/component-pool/i-editor/i-editor.ts +3869 -3869
- package/src/component-pool/i-editor/index.ts +2 -2
- package/src/component-pool/map-wrapper/map-wrapper-demo.tsx +55 -55
- package/src/component-pool/p-editor/index.ts +4 -4
- package/src/component-pool/p-editor/p-editor-demo.tsx +51 -51
- package/src/component-pool/p-editor/p-editor-styles.ts +44 -44
- package/src/component-pool/p-editor/p-editor-types.ts +4 -4
- package/src/component-pool/p-editor/p-editor-utils.ts +38 -38
- package/src/component-pool/p-editor/p-editor.ts +2477 -2477
- package/src/component-pool/pdf-viewer/index.ts +2 -2
- package/src/component-pool/pdf-viewer/pdf-viewer-demo.tsx +116 -116
- package/src/component-pool/pdf-viewer/pdf-viewer.tsx +56 -56
- package/src/component-pool/picker-helper.tsx +222 -222
- package/src/component-pool/pull-to-refresh/pull-to-refresh-demo.tsx +99 -99
- package/src/component-pool/qrcode/index.ts +3 -3
- package/src/component-pool/qrcode/qrcode-demo.tsx +102 -102
- package/src/component-pool/qrcode/qrcode.tsx +169 -169
- package/src/component-pool/radial-progress/index.ts +2 -2
- package/src/component-pool/radial-progress/radial-progress-demo.tsx +84 -84
- package/src/component-pool/radial-progress/radial-progress.tsx +118 -118
- package/src/component-pool/range/gauge-demo.tsx +113 -113
- package/src/component-pool/range/gauge.tsx +392 -392
- package/src/component-pool/range/range-demo.tsx +97 -97
- package/src/component-pool/search-input/index.ts +2 -2
- package/src/component-pool/search-input/search-input-demo.tsx +50 -50
- package/src/component-pool/search-input/search-input.tsx +125 -125
- package/src/component-pool/skeleton/skeleton-card.tsx +114 -114
- package/src/component-pool/skeleton/skeleton-demo.tsx +55 -55
- package/src/component-pool/svg-icons.ts +95 -95
- package/src/component-pool/svg-props.tsx +144 -144
- package/src/component-pool/tag-input/index.ts +2 -2
- package/src/component-pool/tag-input/tag-input-demo.tsx +47 -47
- package/src/component-pool/tag-input/tag-input.tsx +166 -166
- package/src/component-pool/time-picker/index.ts +2 -2
- package/src/component-pool/time-picker/time-picker-demo.tsx +80 -80
- package/src/component-pool/time-picker/time-picker.tsx +311 -311
- package/src/component-pool/timeline/timeline-demo.tsx +75 -75
- package/src/component-pool/tooltip/tooltip-demo.tsx +144 -144
- package/src/component-pool/tour/tour-demo.tsx +92 -92
- package/src/component-pool/youtube-player/index.ts +2 -2
- package/src/component-pool/youtube-player/youtube-player-demo.tsx +57 -57
- package/src/component-pool/youtube-player/youtube-player.tsx +116 -116
- package/src/components/action-sheet-color.tsx +271 -269
- package/src/components/action-sheet-date.tsx +299 -299
- package/src/components/action-sheet-demo.tsx +216 -216
- package/src/components/action-sheet-theme.tsx +150 -150
- package/src/components/action-sheet-time.tsx +157 -157
- package/src/components/input-number.tsx +206 -206
- package/src/components/input-with-title-demo.tsx +42 -42
- package/src/components/loading-spin.tsx +74 -74
- package/src/components/message-box-demo.tsx +107 -107
- package/src/components/mobile-components/mobile-side-menu-demo.tsx +47 -47
- package/src/components/modal-demo.tsx +56 -56
- package/src/components/notice-message-demo.tsx +57 -57
- package/src/components/notice-message.tsx +3 -0
- package/src/components/paging-link-demo.tsx +430 -430
- package/src/components/popup-menu-demo.tsx +172 -172
- package/src/components/progress-demo.tsx +53 -53
- package/src/components/radio-label-demo.tsx +41 -41
- package/src/components/redirect-demo.tsx +36 -36
- package/src/components/resizable-splitter-demo.tsx +104 -104
- package/src/components/select-angle-demo.tsx +32 -32
- package/src/components/select-with-title-demo.tsx +53 -53
- package/src/components/slide-tab-component-demo.tsx +86 -86
- package/src/components/spinner-demo.tsx +52 -52
- package/src/components/stars-component-demo.tsx +36 -36
- package/src/components/switch-option-component.tsx +74 -74
- package/src/components/switch-option-demo.tsx +36 -36
- package/src/components/tabs-demo.tsx +42 -42
- package/src/components/text-glow-demo.tsx +46 -46
- package/src/components/text-scale-demo.tsx +41 -41
- package/src/components/text-wave-demo.tsx +48 -48
- package/src/components/toggle-button-demo.tsx +230 -230
- package/src/demo/demo-page.tsx +271 -271
- package/src/demo/demo-registry.ts +143 -143
- package/src/demo/demo-render-page.tsx +94 -94
- package/src/demo/demo-types.ts +22 -22
- package/src/demo/mock/demo-icons.ts +72 -72
- package/src/demo/mock/responsive-demo-mock-pages.tsx +197 -197
- package/src/demo/mock/side-menu-mock.tsx +113 -113
- package/src/demo/mock/user-settings-mock.tsx +310 -310
- package/src/frames/responsive-frame-demo.tsx +120 -120
- package/src/frames/slider-frame-demo.tsx +111 -111
- package/src/frames/slider-helper.tsx +194 -194
- package/src/lib/button-async-lock.tsx +43 -43
- package/src/lib/canvas/canvas-drawing.ts +503 -503
- package/src/lib/canvas/canvas-geometry.ts +255 -255
- package/src/lib/canvas/canvas-helper.tsx +176 -176
- package/src/lib/canvas/canvas-image.ts +110 -110
- package/src/lib/canvas/canvas-types.ts +93 -93
- package/src/lib/canvas/index.ts +5 -5
- package/src/lib/disable-console.ts +11 -11
- package/src/lib/disable-debug.ts +8 -8
- package/src/lib/support-safe-area.ts +25 -25
- package/tsconfig.json +113 -113
|
@@ -1,182 +1,182 @@
|
|
|
1
|
-
import { CssProps } from 'lupine.web';
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
namespace JSX {
|
|
5
|
-
interface IntrinsicElements {
|
|
6
|
-
svg: any;
|
|
7
|
-
g: any;
|
|
8
|
-
path: any;
|
|
9
|
-
rect: any;
|
|
10
|
-
circle: any;
|
|
11
|
-
line: any;
|
|
12
|
-
polygon: any;
|
|
13
|
-
polyline: any;
|
|
14
|
-
text: any;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Common CSS for all charts
|
|
20
|
-
export const chartCommonCss: CssProps = {
|
|
21
|
-
position: 'relative',
|
|
22
|
-
width: '100%',
|
|
23
|
-
height: 'auto',
|
|
24
|
-
minHeight: '0', // Default min height
|
|
25
|
-
maxHeight: '100%',
|
|
26
|
-
display: 'flex',
|
|
27
|
-
flexDirection: 'column',
|
|
28
|
-
|
|
29
|
-
// Tooltip integration (if we want to use the Tooltip class)
|
|
30
|
-
'.chart-svg': {
|
|
31
|
-
width: '100%',
|
|
32
|
-
height: '100%',
|
|
33
|
-
overflow: 'visible',
|
|
34
|
-
display: 'block',
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
'.chart-title': {
|
|
38
|
-
fontSize: '16px',
|
|
39
|
-
fontWeight: 'bold',
|
|
40
|
-
marginBottom: '8px',
|
|
41
|
-
color: 'var(--primary-color)',
|
|
42
|
-
textAlign: 'center' as const,
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
'.chart-legend': {
|
|
46
|
-
display: 'flex',
|
|
47
|
-
flexWrap: 'wrap',
|
|
48
|
-
justifyContent: 'center',
|
|
49
|
-
gap: '12px',
|
|
50
|
-
marginTop: '12px',
|
|
51
|
-
fontSize: '12px',
|
|
52
|
-
color: 'var(--primary-color)',
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
'.legend-item': {
|
|
56
|
-
display: 'flex',
|
|
57
|
-
alignItems: 'center',
|
|
58
|
-
gap: '6px',
|
|
59
|
-
cursor: 'pointer',
|
|
60
|
-
transition: 'opacity 0.2s',
|
|
61
|
-
|
|
62
|
-
'&.disabled': {
|
|
63
|
-
opacity: 0.5,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
'.legend-color': {
|
|
68
|
-
width: '12px',
|
|
69
|
-
height: '12px',
|
|
70
|
-
borderRadius: '2px',
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
// Tooltip specific for SVG elements
|
|
74
|
-
'.chart-element': {
|
|
75
|
-
transition: 'opacity 0.2s, stroke-width 0.2s, transform 0.2s',
|
|
76
|
-
cursor: 'pointer',
|
|
77
|
-
|
|
78
|
-
'&:hover': {
|
|
79
|
-
// Hover effect is usually implemented via JS to handle other groups, but basic SVG hover is here
|
|
80
|
-
opacity: 0.8,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Default colors for charts (Palette)
|
|
86
|
-
export const chartColors = [
|
|
87
|
-
'var(--primary-accent-color)', // usually blue
|
|
88
|
-
'#2ecc71', // green
|
|
89
|
-
'#e74c3c', // red
|
|
90
|
-
'#f1c40f', // yellow
|
|
91
|
-
'#9b59b6', // purple
|
|
92
|
-
'#e67e22', // orange
|
|
93
|
-
'#1abc9c', // teal
|
|
94
|
-
'#34495e', // dark blue
|
|
95
|
-
'#ff9ff3', // pink
|
|
96
|
-
'#00d2d3', // cyan
|
|
97
|
-
];
|
|
98
|
-
|
|
99
|
-
export const getChartColor = (index: number) => {
|
|
100
|
-
return chartColors[index % chartColors.length];
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
export type ChartSeries = {
|
|
104
|
-
name: string;
|
|
105
|
-
data: number[];
|
|
106
|
-
color?: string;
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
export type ChartData = {
|
|
110
|
-
labels: string[];
|
|
111
|
-
series: ChartSeries[];
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export type BasicChartProps = {
|
|
115
|
-
title?: string;
|
|
116
|
-
data: ChartData;
|
|
117
|
-
aspectRatio?: number;
|
|
118
|
-
width?: string | number;
|
|
119
|
-
showLegend?: boolean;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// Helper to polar to cartesian coordinates for arc drawing
|
|
123
|
-
export const polarToCartesian = (centerX: number, centerY: number, radius: number, angleInDegrees: number) => {
|
|
124
|
-
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
|
|
125
|
-
|
|
126
|
-
return {
|
|
127
|
-
x: centerX + radius * Math.cos(angleInRadians),
|
|
128
|
-
y: centerY + radius * Math.sin(angleInRadians),
|
|
129
|
-
};
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
// Helper to create an SVG arc path
|
|
133
|
-
export const describeArc = (
|
|
134
|
-
x: number,
|
|
135
|
-
y: number,
|
|
136
|
-
radius: number,
|
|
137
|
-
startAngle: number,
|
|
138
|
-
endAngle: number,
|
|
139
|
-
innerRadius: number = 0
|
|
140
|
-
) => {
|
|
141
|
-
const start = polarToCartesian(x, y, radius, endAngle);
|
|
142
|
-
const end = polarToCartesian(x, y, radius, startAngle);
|
|
143
|
-
|
|
144
|
-
const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1';
|
|
145
|
-
|
|
146
|
-
if (innerRadius === 0) {
|
|
147
|
-
// Pie slice
|
|
148
|
-
const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 0, end.x, end.y, 'L', x, y, 'Z'].join(' ');
|
|
149
|
-
return d;
|
|
150
|
-
} else {
|
|
151
|
-
// Donut slice
|
|
152
|
-
const innerStart = polarToCartesian(x, y, innerRadius, endAngle);
|
|
153
|
-
const innerEnd = polarToCartesian(x, y, innerRadius, startAngle);
|
|
154
|
-
|
|
155
|
-
const d = [
|
|
156
|
-
'M',
|
|
157
|
-
start.x,
|
|
158
|
-
start.y,
|
|
159
|
-
'A',
|
|
160
|
-
radius,
|
|
161
|
-
radius,
|
|
162
|
-
0,
|
|
163
|
-
largeArcFlag,
|
|
164
|
-
0,
|
|
165
|
-
end.x,
|
|
166
|
-
end.y,
|
|
167
|
-
'L',
|
|
168
|
-
innerEnd.x,
|
|
169
|
-
innerEnd.y,
|
|
170
|
-
'A',
|
|
171
|
-
innerRadius,
|
|
172
|
-
innerRadius,
|
|
173
|
-
0,
|
|
174
|
-
largeArcFlag,
|
|
175
|
-
1,
|
|
176
|
-
innerStart.x,
|
|
177
|
-
innerStart.y,
|
|
178
|
-
'Z',
|
|
179
|
-
].join(' ');
|
|
180
|
-
return d;
|
|
181
|
-
}
|
|
182
|
-
};
|
|
1
|
+
import { CssProps } from 'lupine.web';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
namespace JSX {
|
|
5
|
+
interface IntrinsicElements {
|
|
6
|
+
svg: any;
|
|
7
|
+
g: any;
|
|
8
|
+
path: any;
|
|
9
|
+
rect: any;
|
|
10
|
+
circle: any;
|
|
11
|
+
line: any;
|
|
12
|
+
polygon: any;
|
|
13
|
+
polyline: any;
|
|
14
|
+
text: any;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Common CSS for all charts
|
|
20
|
+
export const chartCommonCss: CssProps = {
|
|
21
|
+
position: 'relative',
|
|
22
|
+
width: '100%',
|
|
23
|
+
height: 'auto',
|
|
24
|
+
minHeight: '0', // Default min height
|
|
25
|
+
maxHeight: '100%',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
|
|
29
|
+
// Tooltip integration (if we want to use the Tooltip class)
|
|
30
|
+
'.chart-svg': {
|
|
31
|
+
width: '100%',
|
|
32
|
+
height: '100%',
|
|
33
|
+
overflow: 'visible',
|
|
34
|
+
display: 'block',
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
'.chart-title': {
|
|
38
|
+
fontSize: '16px',
|
|
39
|
+
fontWeight: 'bold',
|
|
40
|
+
marginBottom: '8px',
|
|
41
|
+
color: 'var(--primary-color)',
|
|
42
|
+
textAlign: 'center' as const,
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
'.chart-legend': {
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexWrap: 'wrap',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
gap: '12px',
|
|
50
|
+
marginTop: '12px',
|
|
51
|
+
fontSize: '12px',
|
|
52
|
+
color: 'var(--primary-color)',
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
'.legend-item': {
|
|
56
|
+
display: 'flex',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
gap: '6px',
|
|
59
|
+
cursor: 'pointer',
|
|
60
|
+
transition: 'opacity 0.2s',
|
|
61
|
+
|
|
62
|
+
'&.disabled': {
|
|
63
|
+
opacity: 0.5,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
'.legend-color': {
|
|
68
|
+
width: '12px',
|
|
69
|
+
height: '12px',
|
|
70
|
+
borderRadius: '2px',
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// Tooltip specific for SVG elements
|
|
74
|
+
'.chart-element': {
|
|
75
|
+
transition: 'opacity 0.2s, stroke-width 0.2s, transform 0.2s',
|
|
76
|
+
cursor: 'pointer',
|
|
77
|
+
|
|
78
|
+
'&:hover': {
|
|
79
|
+
// Hover effect is usually implemented via JS to handle other groups, but basic SVG hover is here
|
|
80
|
+
opacity: 0.8,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Default colors for charts (Palette)
|
|
86
|
+
export const chartColors = [
|
|
87
|
+
'var(--primary-accent-color)', // usually blue
|
|
88
|
+
'#2ecc71', // green
|
|
89
|
+
'#e74c3c', // red
|
|
90
|
+
'#f1c40f', // yellow
|
|
91
|
+
'#9b59b6', // purple
|
|
92
|
+
'#e67e22', // orange
|
|
93
|
+
'#1abc9c', // teal
|
|
94
|
+
'#34495e', // dark blue
|
|
95
|
+
'#ff9ff3', // pink
|
|
96
|
+
'#00d2d3', // cyan
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
export const getChartColor = (index: number) => {
|
|
100
|
+
return chartColors[index % chartColors.length];
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export type ChartSeries = {
|
|
104
|
+
name: string;
|
|
105
|
+
data: number[];
|
|
106
|
+
color?: string;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type ChartData = {
|
|
110
|
+
labels: string[];
|
|
111
|
+
series: ChartSeries[];
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type BasicChartProps = {
|
|
115
|
+
title?: string;
|
|
116
|
+
data: ChartData;
|
|
117
|
+
aspectRatio?: number;
|
|
118
|
+
width?: string | number;
|
|
119
|
+
showLegend?: boolean;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Helper to polar to cartesian coordinates for arc drawing
|
|
123
|
+
export const polarToCartesian = (centerX: number, centerY: number, radius: number, angleInDegrees: number) => {
|
|
124
|
+
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
x: centerX + radius * Math.cos(angleInRadians),
|
|
128
|
+
y: centerY + radius * Math.sin(angleInRadians),
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Helper to create an SVG arc path
|
|
133
|
+
export const describeArc = (
|
|
134
|
+
x: number,
|
|
135
|
+
y: number,
|
|
136
|
+
radius: number,
|
|
137
|
+
startAngle: number,
|
|
138
|
+
endAngle: number,
|
|
139
|
+
innerRadius: number = 0
|
|
140
|
+
) => {
|
|
141
|
+
const start = polarToCartesian(x, y, radius, endAngle);
|
|
142
|
+
const end = polarToCartesian(x, y, radius, startAngle);
|
|
143
|
+
|
|
144
|
+
const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1';
|
|
145
|
+
|
|
146
|
+
if (innerRadius === 0) {
|
|
147
|
+
// Pie slice
|
|
148
|
+
const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 0, end.x, end.y, 'L', x, y, 'Z'].join(' ');
|
|
149
|
+
return d;
|
|
150
|
+
} else {
|
|
151
|
+
// Donut slice
|
|
152
|
+
const innerStart = polarToCartesian(x, y, innerRadius, endAngle);
|
|
153
|
+
const innerEnd = polarToCartesian(x, y, innerRadius, startAngle);
|
|
154
|
+
|
|
155
|
+
const d = [
|
|
156
|
+
'M',
|
|
157
|
+
start.x,
|
|
158
|
+
start.y,
|
|
159
|
+
'A',
|
|
160
|
+
radius,
|
|
161
|
+
radius,
|
|
162
|
+
0,
|
|
163
|
+
largeArcFlag,
|
|
164
|
+
0,
|
|
165
|
+
end.x,
|
|
166
|
+
end.y,
|
|
167
|
+
'L',
|
|
168
|
+
innerEnd.x,
|
|
169
|
+
innerEnd.y,
|
|
170
|
+
'A',
|
|
171
|
+
innerRadius,
|
|
172
|
+
innerRadius,
|
|
173
|
+
0,
|
|
174
|
+
largeArcFlag,
|
|
175
|
+
1,
|
|
176
|
+
innerStart.x,
|
|
177
|
+
innerStart.y,
|
|
178
|
+
'Z',
|
|
179
|
+
].join(' ');
|
|
180
|
+
return d;
|
|
181
|
+
}
|
|
182
|
+
};
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import { ColumnChart } from './column-chart';
|
|
2
|
-
import { DemoStory } from '../../demo/demo-types';
|
|
3
|
-
import { ChartData } from './chart-utils';
|
|
4
|
-
|
|
5
|
-
const singleSeriesData: ChartData = {
|
|
6
|
-
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
|
7
|
-
series: [
|
|
8
|
-
{
|
|
9
|
-
name: 'Revenue',
|
|
10
|
-
data: [3500, 4200, 2800, 5100, 6000, 4800],
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const multiSeriesData: ChartData = {
|
|
16
|
-
labels: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
17
|
-
series: [
|
|
18
|
-
{ name: 'Product A', data: [400, 300, 500, 700] },
|
|
19
|
-
{ name: 'Product B', data: [200, 400, 300, 600] },
|
|
20
|
-
{ name: 'Product C', data: [150, 250, 450, 500] },
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const columnChartDemo: DemoStory<any> = {
|
|
25
|
-
id: 'columnChartDemo',
|
|
26
|
-
text: 'Column Chart',
|
|
27
|
-
args: {
|
|
28
|
-
title: 'Monthly Revenue',
|
|
29
|
-
width: '100%',
|
|
30
|
-
showLegend: true,
|
|
31
|
-
},
|
|
32
|
-
argTypes: {
|
|
33
|
-
title: { control: 'text' },
|
|
34
|
-
width: { control: 'text' },
|
|
35
|
-
showLegend: { control: 'boolean' },
|
|
36
|
-
},
|
|
37
|
-
render: (args: any) => {
|
|
38
|
-
const css = {
|
|
39
|
-
display: 'flex',
|
|
40
|
-
flexDirection: 'column',
|
|
41
|
-
gap: '48px',
|
|
42
|
-
padding: '24px',
|
|
43
|
-
alignItems: 'center',
|
|
44
|
-
|
|
45
|
-
'.demo-section': {
|
|
46
|
-
display: 'flex',
|
|
47
|
-
flexDirection: 'column',
|
|
48
|
-
alignItems: 'center',
|
|
49
|
-
gap: '24px',
|
|
50
|
-
width: '100%',
|
|
51
|
-
maxWidth: '800px',
|
|
52
|
-
},
|
|
53
|
-
'.section-title': {
|
|
54
|
-
fontSize: '20px',
|
|
55
|
-
fontWeight: 'bold',
|
|
56
|
-
color: 'var(--primary-color)',
|
|
57
|
-
marginBottom: '16px',
|
|
58
|
-
borderBottom: '2px solid var(--secondary-border-color)',
|
|
59
|
-
width: '100%',
|
|
60
|
-
paddingBottom: '8px',
|
|
61
|
-
},
|
|
62
|
-
'.chart-box': {
|
|
63
|
-
padding: '20px',
|
|
64
|
-
border: '1px solid var(--secondary-border-color)',
|
|
65
|
-
borderRadius: '8px',
|
|
66
|
-
backgroundColor: 'var(--primary-bg-color)',
|
|
67
|
-
width: '100%',
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<div css={css}>
|
|
73
|
-
<section class='demo-section'>
|
|
74
|
-
<div class='section-title'>Interactive Control</div>
|
|
75
|
-
<div class='chart-box'>
|
|
76
|
-
<ColumnChart
|
|
77
|
-
data={singleSeriesData}
|
|
78
|
-
title={args.title}
|
|
79
|
-
width={args.width}
|
|
80
|
-
showLegend={args.showLegend}
|
|
81
|
-
yAxisFormatter={(val) => '$' + val}
|
|
82
|
-
/>
|
|
83
|
-
</div>
|
|
84
|
-
</section>
|
|
85
|
-
|
|
86
|
-
<section class='demo-section'>
|
|
87
|
-
<div class='section-title'>Multi-Series (Grouped)</div>
|
|
88
|
-
<div class='chart-box'>
|
|
89
|
-
<ColumnChart data={multiSeriesData} title='Quarterly Product Sales' showLegend={true} />
|
|
90
|
-
</div>
|
|
91
|
-
</section>
|
|
92
|
-
</div>
|
|
93
|
-
);
|
|
94
|
-
},
|
|
95
|
-
code: `import { ColumnChart } from 'lupine.components/component-pool/charts';
|
|
96
|
-
|
|
97
|
-
const data = {
|
|
98
|
-
labels: ['Jan', 'Feb', 'Mar'],
|
|
99
|
-
series: [
|
|
100
|
-
{ name: 'Apples', data: [10, 20, 15] },
|
|
101
|
-
{ name: 'Bananas', data: [5, 25, 30] }
|
|
102
|
-
]
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
<ColumnChart
|
|
106
|
-
data={data}
|
|
107
|
-
title="Sales"
|
|
108
|
-
yAxisFormatter={val => val + 'k'}
|
|
109
|
-
/>
|
|
110
|
-
`,
|
|
111
|
-
};
|
|
1
|
+
import { ColumnChart } from './column-chart';
|
|
2
|
+
import { DemoStory } from '../../demo/demo-types';
|
|
3
|
+
import { ChartData } from './chart-utils';
|
|
4
|
+
|
|
5
|
+
const singleSeriesData: ChartData = {
|
|
6
|
+
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
|
|
7
|
+
series: [
|
|
8
|
+
{
|
|
9
|
+
name: 'Revenue',
|
|
10
|
+
data: [3500, 4200, 2800, 5100, 6000, 4800],
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const multiSeriesData: ChartData = {
|
|
16
|
+
labels: ['Q1', 'Q2', 'Q3', 'Q4'],
|
|
17
|
+
series: [
|
|
18
|
+
{ name: 'Product A', data: [400, 300, 500, 700] },
|
|
19
|
+
{ name: 'Product B', data: [200, 400, 300, 600] },
|
|
20
|
+
{ name: 'Product C', data: [150, 250, 450, 500] },
|
|
21
|
+
],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const columnChartDemo: DemoStory<any> = {
|
|
25
|
+
id: 'columnChartDemo',
|
|
26
|
+
text: 'Column Chart',
|
|
27
|
+
args: {
|
|
28
|
+
title: 'Monthly Revenue',
|
|
29
|
+
width: '100%',
|
|
30
|
+
showLegend: true,
|
|
31
|
+
},
|
|
32
|
+
argTypes: {
|
|
33
|
+
title: { control: 'text' },
|
|
34
|
+
width: { control: 'text' },
|
|
35
|
+
showLegend: { control: 'boolean' },
|
|
36
|
+
},
|
|
37
|
+
render: (args: any) => {
|
|
38
|
+
const css = {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
gap: '48px',
|
|
42
|
+
padding: '24px',
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
|
|
45
|
+
'.demo-section': {
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
gap: '24px',
|
|
50
|
+
width: '100%',
|
|
51
|
+
maxWidth: '800px',
|
|
52
|
+
},
|
|
53
|
+
'.section-title': {
|
|
54
|
+
fontSize: '20px',
|
|
55
|
+
fontWeight: 'bold',
|
|
56
|
+
color: 'var(--primary-color)',
|
|
57
|
+
marginBottom: '16px',
|
|
58
|
+
borderBottom: '2px solid var(--secondary-border-color)',
|
|
59
|
+
width: '100%',
|
|
60
|
+
paddingBottom: '8px',
|
|
61
|
+
},
|
|
62
|
+
'.chart-box': {
|
|
63
|
+
padding: '20px',
|
|
64
|
+
border: '1px solid var(--secondary-border-color)',
|
|
65
|
+
borderRadius: '8px',
|
|
66
|
+
backgroundColor: 'var(--primary-bg-color)',
|
|
67
|
+
width: '100%',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div css={css}>
|
|
73
|
+
<section class='demo-section'>
|
|
74
|
+
<div class='section-title'>Interactive Control</div>
|
|
75
|
+
<div class='chart-box'>
|
|
76
|
+
<ColumnChart
|
|
77
|
+
data={singleSeriesData}
|
|
78
|
+
title={args.title}
|
|
79
|
+
width={args.width}
|
|
80
|
+
showLegend={args.showLegend}
|
|
81
|
+
yAxisFormatter={(val) => '$' + val}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</section>
|
|
85
|
+
|
|
86
|
+
<section class='demo-section'>
|
|
87
|
+
<div class='section-title'>Multi-Series (Grouped)</div>
|
|
88
|
+
<div class='chart-box'>
|
|
89
|
+
<ColumnChart data={multiSeriesData} title='Quarterly Product Sales' showLegend={true} />
|
|
90
|
+
</div>
|
|
91
|
+
</section>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
code: `import { ColumnChart } from 'lupine.components/component-pool/charts';
|
|
96
|
+
|
|
97
|
+
const data = {
|
|
98
|
+
labels: ['Jan', 'Feb', 'Mar'],
|
|
99
|
+
series: [
|
|
100
|
+
{ name: 'Apples', data: [10, 20, 15] },
|
|
101
|
+
{ name: 'Bananas', data: [5, 25, 30] }
|
|
102
|
+
]
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
<ColumnChart
|
|
106
|
+
data={data}
|
|
107
|
+
title="Sales"
|
|
108
|
+
yAxisFormatter={val => val + 'k'}
|
|
109
|
+
/>
|
|
110
|
+
`,
|
|
111
|
+
};
|