funuicss 2.7.15 → 3.0.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/css/fun.css +6663 -6653
- package/index.d.ts +3 -0
- package/index.js +7 -1
- package/js/google/AnalyticsHandler.d.ts +10 -0
- package/js/google/AnalyticsHandler.js +20 -0
- package/js/google/analytics.d.ts +6 -0
- package/js/google/analytics.js +53 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/ui/flex/Flex.d.ts +3 -8
- package/ui/flex/Flex.js +15 -9
- package/ui/flex/FlexItem.d.ts +17 -0
- package/ui/flex/FlexItem.js +39 -0
- package/ui/notification/Notification.d.ts +7 -3
- package/ui/notification/Notification.js +18 -14
- package/ui/scrolltotop/ScrollToTop.d.ts +3 -0
- package/ui/scrolltotop/ScrollToTop.js +61 -0
- package/ui/video/Video.d.ts +2 -1
- package/ui/video/Video.js +10 -10
- package/ui/video/videoShortcuts.d.ts +1 -1
- package/ui/video/videoShortcuts.js +2 -2
- package/ui/view/View.d.ts +27 -38
- package/ui/view/View.js +10 -38
- package/ui/vista/Vista.d.ts +6 -1
- package/ui/vista/Vista.js +33 -4
- package/assets/colors/colors.d.ts +0 -347
- package/assets/colors/colors.js +0 -348
- package/assets/colors/colors.tsx +0 -697
- package/hooks/useHls.tsx +0 -69
- package/index.tsx +0 -57
- package/js/Cookie.tsx +0 -91
- package/js/Fun.jsx +0 -225
- package/js/Fun.tsx +0 -239
- package/tsconfig.json +0 -20
- package/types/react-easy-export.d.ts +0 -4
- package/ui/ScrollInView/ScrollInView.tsx +0 -69
- package/ui/accordion/Accordion.tsx +0 -125
- package/ui/alert/Alert.tsx +0 -106
- package/ui/aos/AOS.tsx +0 -24
- package/ui/appbar/AppBar.tsx +0 -115
- package/ui/appbar/Hamburger.tsx +0 -30
- package/ui/avatar/Avatar.tsx +0 -52
- package/ui/blob/Blob.tsx +0 -34
- package/ui/breadcrumb/BreadCrumb.tsx +0 -48
- package/ui/button/Button.tsx +0 -153
- package/ui/calendar/ActivityCard.tsx +0 -27
- package/ui/calendar/Calendar.tsx +0 -343
- package/ui/card/Card.tsx +0 -117
- package/ui/card/CardBody.tsx +0 -14
- package/ui/card/CardFab.tsx +0 -16
- package/ui/card/CardFooter.tsx +0 -14
- package/ui/card/CardHeader.tsx +0 -14
- package/ui/carousel/Carousel.tsx +0 -148
- package/ui/chart/Bar.tsx +0 -121
- package/ui/chart/Line.tsx +0 -186
- package/ui/chart/Pie.tsx +0 -127
- package/ui/container/Container.tsx +0 -38
- package/ui/datepicker/DatePicker.tsx +0 -148
- package/ui/div/Div.tsx +0 -61
- package/ui/drop/Action.tsx +0 -16
- package/ui/drop/Down.tsx +0 -18
- package/ui/drop/Dropdown.tsx +0 -117
- package/ui/drop/Item.tsx +0 -15
- package/ui/drop/Menu.tsx +0 -40
- package/ui/drop/Up.tsx +0 -18
- package/ui/flex/Flex.tsx +0 -115
- package/ui/grid/Col.tsx +0 -43
- package/ui/grid/Grid.tsx +0 -37
- package/ui/input/Iconic.tsx +0 -43
- package/ui/input/Input.tsx +0 -409
- package/ui/list/Item.tsx +0 -18
- package/ui/list/List.tsx +0 -45
- package/ui/loader/Loader.tsx +0 -47
- package/ui/modal/Action.tsx +0 -14
- package/ui/modal/Close.tsx +0 -14
- package/ui/modal/Content.tsx +0 -15
- package/ui/modal/Header.tsx +0 -19
- package/ui/modal/Modal.tsx +0 -140
- package/ui/notification/Content.tsx +0 -14
- package/ui/notification/Footer.tsx +0 -14
- package/ui/notification/Header.tsx +0 -14
- package/ui/notification/Notification.tsx +0 -62
- package/ui/page/NotFound.tsx +0 -67
- package/ui/page/UnAuthorized.tsx +0 -64
- package/ui/progress/Bar.tsx +0 -114
- package/ui/richtext/RichText.tsx +0 -156
- package/ui/sidebar/SideBar.tsx +0 -202
- package/ui/sidebar/SideContent.tsx +0 -16
- package/ui/slider/Slider.tsx +0 -75
- package/ui/snackbar/SnackBar.tsx +0 -56
- package/ui/specials/Circle.tsx +0 -49
- package/ui/specials/CircleGroup.tsx +0 -49
- package/ui/specials/FullCenteredPage.tsx +0 -25
- package/ui/specials/Hr.tsx +0 -16
- package/ui/specials/RowFlex.tsx +0 -56
- package/ui/specials/Section.tsx +0 -18
- package/ui/step/Container.tsx +0 -27
- package/ui/step/Header.tsx +0 -16
- package/ui/step/Line.tsx +0 -17
- package/ui/step/Step.tsx +0 -17
- package/ui/table/Body.tsx +0 -10
- package/ui/table/Data.tsx +0 -15
- package/ui/table/Head.tsx +0 -10
- package/ui/table/Row.tsx +0 -16
- package/ui/table/Table.tsx +0 -372
- package/ui/text/Text.tsx +0 -179
- package/ui/theme/dark.tsx +0 -45
- package/ui/theme/darkenUtils.ts +0 -15
- package/ui/theme/theme.tsx +0 -48
- package/ui/theme/themes.ts +0 -154
- package/ui/tooltip/Tip.tsx +0 -34
- package/ui/tooltip/ToolTip.tsx +0 -20
- package/ui/video/Video.tsx +0 -347
- package/ui/video/videoFunctions.tsx +0 -19
- package/ui/video/videoShortcuts.ts +0 -12
- package/ui/view/View.tsx +0 -157
- package/ui/vista/Vista.tsx +0 -165
- package/utils/Emojis.tsx +0 -59
- package/utils/Functions.tsx +0 -9
- package/utils/getCssVariable.tsx +0 -9
package/ui/carousel/Carousel.tsx
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import React, { useRef, ReactNode, useState, useEffect } from 'react';
|
|
3
|
-
import { PiCaretLeft, PiCaretRight } from 'react-icons/pi';
|
|
4
|
-
import Circle from '../specials/Circle';
|
|
5
|
-
import RowFlex from '../specials/RowFlex';
|
|
6
|
-
import { isTouchDevice } from '../../utils/Functions';
|
|
7
|
-
|
|
8
|
-
interface CarouselProps {
|
|
9
|
-
scrollNumber?: number;
|
|
10
|
-
gap?: number;
|
|
11
|
-
funcss?: string;
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
showDashes?: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const Carousel: React.FC<CarouselProps> = ({
|
|
17
|
-
scrollNumber = 320,
|
|
18
|
-
gap = 0.5,
|
|
19
|
-
funcss = '',
|
|
20
|
-
showDashes = true,
|
|
21
|
-
children,
|
|
22
|
-
}) => {
|
|
23
|
-
const scrollRef = useRef<HTMLDivElement | null>(null);
|
|
24
|
-
const [scrollPosition, setScrollPosition] = useState<'start' | 'middle' | 'end'>('start');
|
|
25
|
-
const [isPhone, setIsPhone] = useState(false);
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (isTouchDevice()) {
|
|
29
|
-
setIsPhone(true);
|
|
30
|
-
} else {
|
|
31
|
-
setIsPhone(false);
|
|
32
|
-
}
|
|
33
|
-
}, []);
|
|
34
|
-
|
|
35
|
-
// Track scroll position
|
|
36
|
-
const handleScroll = () => {
|
|
37
|
-
const container = scrollRef.current;
|
|
38
|
-
if (!container) return;
|
|
39
|
-
|
|
40
|
-
const { scrollLeft, scrollWidth, clientWidth } = container;
|
|
41
|
-
const maxScrollLeft = scrollWidth - clientWidth;
|
|
42
|
-
|
|
43
|
-
if (scrollLeft === 0) {
|
|
44
|
-
setScrollPosition('start');
|
|
45
|
-
} else if (scrollLeft >= maxScrollLeft - 10) {
|
|
46
|
-
setScrollPosition('end');
|
|
47
|
-
} else {
|
|
48
|
-
setScrollPosition('middle');
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const scroll = (direction: 'left' | 'right') => {
|
|
53
|
-
const container = scrollRef.current;
|
|
54
|
-
if (!container) return;
|
|
55
|
-
|
|
56
|
-
container.scrollBy({
|
|
57
|
-
left: direction === 'left' ? -scrollNumber : scrollNumber,
|
|
58
|
-
behavior: 'smooth',
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
const container = scrollRef.current;
|
|
64
|
-
if (container) {
|
|
65
|
-
container.addEventListener('scroll', handleScroll);
|
|
66
|
-
return () => container.removeEventListener('scroll', handleScroll);
|
|
67
|
-
}
|
|
68
|
-
}, []);
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<div className={`carousel-wrapper ${funcss}`}>
|
|
72
|
-
<RowFlex gap={1} wrap="nowrap" alignItems="center">
|
|
73
|
-
{!isPhone && (
|
|
74
|
-
<div>
|
|
75
|
-
<Circle onClick={() => scroll('left')}>
|
|
76
|
-
<PiCaretLeft size={24} />
|
|
77
|
-
</Circle>
|
|
78
|
-
</div>
|
|
79
|
-
)}
|
|
80
|
-
|
|
81
|
-
<div
|
|
82
|
-
ref={scrollRef}
|
|
83
|
-
className={`carousel-container scrollbar-hide w-full`}
|
|
84
|
-
style={{
|
|
85
|
-
width: '100%',
|
|
86
|
-
gap: gap + 'rem',
|
|
87
|
-
overflowX: 'auto',
|
|
88
|
-
display: 'flex',
|
|
89
|
-
scrollSnapType: 'x mandatory',
|
|
90
|
-
scrollBehavior: 'smooth',
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
{React.Children.map(children, (child) => (
|
|
94
|
-
<div className="carousel-item" style={{ flexShrink: 0 }}>
|
|
95
|
-
<div className="carousel-card">{child}</div>
|
|
96
|
-
</div>
|
|
97
|
-
))}
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
{!isPhone && (
|
|
101
|
-
<div>
|
|
102
|
-
<Circle onClick={() => scroll('right')}>
|
|
103
|
-
<PiCaretRight size={24} />
|
|
104
|
-
</Circle>
|
|
105
|
-
</div>
|
|
106
|
-
)}
|
|
107
|
-
</RowFlex>
|
|
108
|
-
|
|
109
|
-
{/* Dashes below the carousel */}
|
|
110
|
-
{
|
|
111
|
-
showDashes && (
|
|
112
|
-
<div className="center padding-top-10">
|
|
113
|
-
<RowFlex gap={0.5} justify="center">
|
|
114
|
-
{['start', 'middle', 'end'].map((pos) => (
|
|
115
|
-
<div
|
|
116
|
-
className={'pointer '}
|
|
117
|
-
key={pos}
|
|
118
|
-
onClick={() => {
|
|
119
|
-
if(pos === 'start') {
|
|
120
|
-
scroll('left')
|
|
121
|
-
} else if(pos === 'middle') {
|
|
122
|
-
scrollRef.current?.scrollTo({
|
|
123
|
-
left: scrollRef.current?.scrollWidth / 2,
|
|
124
|
-
behavior: 'smooth',
|
|
125
|
-
});
|
|
126
|
-
} else if(pos === 'end') {
|
|
127
|
-
scroll('right')
|
|
128
|
-
}
|
|
129
|
-
}}
|
|
130
|
-
style={{
|
|
131
|
-
width: '10px',
|
|
132
|
-
height: '10px',
|
|
133
|
-
background: scrollPosition === pos ? 'var(--primary)' : 'var(--borderColor)',
|
|
134
|
-
borderRadius: '50%',
|
|
135
|
-
transform: scrollPosition === pos ? 'scale(1.3)' : 'scale(0.9)',
|
|
136
|
-
transition: 'transform 0.3s ease, background 0.3s ease',
|
|
137
|
-
}}
|
|
138
|
-
/>
|
|
139
|
-
))}
|
|
140
|
-
</RowFlex>
|
|
141
|
-
</div>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
|
-
</div>
|
|
145
|
-
);
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export default Carousel;
|
package/ui/chart/Bar.tsx
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
BarChart,
|
|
6
|
-
Bar,
|
|
7
|
-
XAxis,
|
|
8
|
-
YAxis,
|
|
9
|
-
Tooltip,
|
|
10
|
-
Legend,
|
|
11
|
-
CartesianGrid,
|
|
12
|
-
ResponsiveContainer,
|
|
13
|
-
} from 'recharts';
|
|
14
|
-
|
|
15
|
-
type DataItem = {
|
|
16
|
-
label: string;
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
type ChartSeries = {
|
|
21
|
-
dataKey: string;
|
|
22
|
-
label?: string;
|
|
23
|
-
color?: string; // CSS variable name (e.g. 'primary') or hex
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
interface BarsProps {
|
|
27
|
-
data: DataItem[];
|
|
28
|
-
series: ChartSeries[];
|
|
29
|
-
|
|
30
|
-
// Style and behavior
|
|
31
|
-
showGrid?: boolean;
|
|
32
|
-
showLegend?: boolean;
|
|
33
|
-
showXAxis?: boolean;
|
|
34
|
-
showYAxis?: boolean;
|
|
35
|
-
funcss?: string;
|
|
36
|
-
barRadius?: number;
|
|
37
|
-
barSize?: number;
|
|
38
|
-
width?: number | string;
|
|
39
|
-
height?: number | string;
|
|
40
|
-
margin?: { top?: number; right?: number; left?: number; bottom?: number };
|
|
41
|
-
|
|
42
|
-
// Axis custom props
|
|
43
|
-
xAxisProps?: any;
|
|
44
|
-
yAxisProps?: any;
|
|
45
|
-
|
|
46
|
-
// Tooltip and legend customization
|
|
47
|
-
tooltipFormatter?: (value: any, name: string, props: any) => React.ReactNode;
|
|
48
|
-
legendProps?: any;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Resolve CSS variables
|
|
52
|
-
const getCssVar = (varName: string): string => {
|
|
53
|
-
if (typeof window === 'undefined') return '';
|
|
54
|
-
return getComputedStyle(document.documentElement).getPropertyValue(varName)?.trim() || '';
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const resolveColor = (color?: string): string => {
|
|
58
|
-
if (!color) return getCssVar('--primary') || '#8884d8';
|
|
59
|
-
if (color.startsWith('#')) return color;
|
|
60
|
-
return getCssVar(`--${color}`) || color;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// Custom Tooltip
|
|
64
|
-
const CustomTooltip = ({ active, payload, label }: any) => {
|
|
65
|
-
if (active && payload && payload.length) {
|
|
66
|
-
return (
|
|
67
|
-
<div className="dark raised round-edge p-2 text-sm">
|
|
68
|
-
<div className="text-bold">{label}</div>
|
|
69
|
-
{payload.map((entry: any, index: number) => (
|
|
70
|
-
<div key={index} style={{ lineHeight: 1 }}>
|
|
71
|
-
{entry.name}: <span className="font-semibold">{entry.value}</span>
|
|
72
|
-
</div>
|
|
73
|
-
))}
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const Bars: React.FC<BarsProps> = ({
|
|
81
|
-
data,
|
|
82
|
-
series,
|
|
83
|
-
showGrid = true,
|
|
84
|
-
showLegend = true,
|
|
85
|
-
showXAxis = true,
|
|
86
|
-
showYAxis = false,
|
|
87
|
-
barRadius = 6,
|
|
88
|
-
funcss,
|
|
89
|
-
barSize = 30,
|
|
90
|
-
width = '100%',
|
|
91
|
-
height = "100%",
|
|
92
|
-
margin = { top: 10, right: 30, left: 0, bottom: 20 },
|
|
93
|
-
xAxisProps = {},
|
|
94
|
-
yAxisProps = {},
|
|
95
|
-
tooltipFormatter,
|
|
96
|
-
legendProps = {},
|
|
97
|
-
}) => {
|
|
98
|
-
return (
|
|
99
|
-
<ResponsiveContainer className={funcss || ``} width={width} height={height}>
|
|
100
|
-
<BarChart data={data} margin={margin}>
|
|
101
|
-
{showGrid && <CartesianGrid strokeDasharray="3 3" />}
|
|
102
|
-
{showXAxis && <XAxis dataKey="label" {...xAxisProps} />}
|
|
103
|
-
{showYAxis && <YAxis {...yAxisProps} />}
|
|
104
|
-
<Tooltip content={<CustomTooltip />} formatter={tooltipFormatter} />
|
|
105
|
-
{showLegend && <Legend {...legendProps} />}
|
|
106
|
-
{series.map((s) => (
|
|
107
|
-
<Bar
|
|
108
|
-
key={s.dataKey}
|
|
109
|
-
dataKey={s.dataKey}
|
|
110
|
-
name={s.label || s.dataKey}
|
|
111
|
-
fill={resolveColor(s.color)}
|
|
112
|
-
radius={[barRadius, barRadius, 0, 0]}
|
|
113
|
-
barSize={barSize}
|
|
114
|
-
/>
|
|
115
|
-
))}
|
|
116
|
-
</BarChart>
|
|
117
|
-
</ResponsiveContainer>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export default Bars;
|
package/ui/chart/Line.tsx
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
AreaChart,
|
|
6
|
-
Area,
|
|
7
|
-
XAxis,
|
|
8
|
-
YAxis,
|
|
9
|
-
Tooltip,
|
|
10
|
-
Legend,
|
|
11
|
-
CartesianGrid,
|
|
12
|
-
ResponsiveContainer,
|
|
13
|
-
} from 'recharts';
|
|
14
|
-
|
|
15
|
-
type DataItem = {
|
|
16
|
-
label: string;
|
|
17
|
-
[key: string]: any;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
type ChartSeries = {
|
|
21
|
-
dataKey: string;
|
|
22
|
-
label?: string;
|
|
23
|
-
color?: string;
|
|
24
|
-
strokeWidth?: number;
|
|
25
|
-
dot?: boolean;
|
|
26
|
-
fromColor?: string;
|
|
27
|
-
toColor?: string;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
interface AreaChartProps {
|
|
31
|
-
data: DataItem[];
|
|
32
|
-
series: ChartSeries[];
|
|
33
|
-
fromColor?: string;
|
|
34
|
-
toColor?: string;
|
|
35
|
-
id?: string;
|
|
36
|
-
|
|
37
|
-
// Display controls
|
|
38
|
-
showGrid?: boolean;
|
|
39
|
-
horizontalLines?: boolean;
|
|
40
|
-
showLegend?: boolean;
|
|
41
|
-
showXAxis?: boolean;
|
|
42
|
-
showYAxis?: boolean;
|
|
43
|
-
|
|
44
|
-
// Appearance controls
|
|
45
|
-
funcss?: string;
|
|
46
|
-
curveType?: 'linear' | 'monotone' | 'step' | 'basis';
|
|
47
|
-
height?: number | string;
|
|
48
|
-
width?: number | string;
|
|
49
|
-
margin?: { top?: number; right?: number; left?: number; bottom?: number };
|
|
50
|
-
|
|
51
|
-
// Axis controls
|
|
52
|
-
dy?: number;
|
|
53
|
-
xAxisProps?: any;
|
|
54
|
-
yAxisProps?: any;
|
|
55
|
-
|
|
56
|
-
// Tooltip / Legend
|
|
57
|
-
tooltipFormatter?: (value: any, name: string, props: any) => React.ReactNode;
|
|
58
|
-
legendProps?: any;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// CSS var resolver
|
|
62
|
-
const getCssVar = (varName: string): string => {
|
|
63
|
-
if (typeof window === 'undefined') return '';
|
|
64
|
-
return getComputedStyle(document.documentElement).getPropertyValue(`--${varName}`)?.trim() || '';
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// Color resolver
|
|
68
|
-
const resolveStrokeColor = (color?: string): string => {
|
|
69
|
-
if (!color) return getCssVar('primary') || '#8884d8';
|
|
70
|
-
if (color.startsWith('#')) return color;
|
|
71
|
-
return getCssVar(color) || color;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// Tooltip
|
|
75
|
-
const CustomTooltip = ({ active, payload, label }: any) => {
|
|
76
|
-
if (active && payload && payload.length) {
|
|
77
|
-
return (
|
|
78
|
-
<div className="dark raised round-edge p-2 text-sm">
|
|
79
|
-
<div className="text-bold">{label}</div>
|
|
80
|
-
{payload.map((entry: any, index: number) => (
|
|
81
|
-
<div key={index} style={{ lineHeight: 1 }}>
|
|
82
|
-
{entry.name}: <span className="font-semibold">{entry.value}</span>
|
|
83
|
-
</div>
|
|
84
|
-
))}
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const Lines: React.FC<AreaChartProps> = ({
|
|
92
|
-
data,
|
|
93
|
-
id,
|
|
94
|
-
series,
|
|
95
|
-
fromColor,
|
|
96
|
-
toColor,
|
|
97
|
-
dy,
|
|
98
|
-
showGrid = true,
|
|
99
|
-
horizontalLines = false,
|
|
100
|
-
showLegend = true,
|
|
101
|
-
showXAxis = true,
|
|
102
|
-
showYAxis = false,
|
|
103
|
-
funcss,
|
|
104
|
-
curveType = 'monotone',
|
|
105
|
-
height = "100%",
|
|
106
|
-
width = '100%',
|
|
107
|
-
margin = { top: 10, right: 30, left: 0, bottom: 20 },
|
|
108
|
-
xAxisProps = {},
|
|
109
|
-
yAxisProps = {},
|
|
110
|
-
tooltipFormatter,
|
|
111
|
-
legendProps = {},
|
|
112
|
-
}) => {
|
|
113
|
-
const gradientId = id || 'colorUv';
|
|
114
|
-
|
|
115
|
-
return (
|
|
116
|
-
<ResponsiveContainer width={width} height={height} className={funcss}>
|
|
117
|
-
<AreaChart data={data} margin={margin}>
|
|
118
|
-
{/* Gradient Fill */}
|
|
119
|
-
<defs>
|
|
120
|
-
<linearGradient id={gradientId} x1="0" y1="0" x2="0" y2="1">
|
|
121
|
-
<stop
|
|
122
|
-
offset="5%"
|
|
123
|
-
stopColor={getCssVar(fromColor || 'primary')}
|
|
124
|
-
stopOpacity={0.8}
|
|
125
|
-
/>
|
|
126
|
-
<stop
|
|
127
|
-
offset="95%"
|
|
128
|
-
stopColor={getCssVar(toColor || 'primary200')}
|
|
129
|
-
stopOpacity={0}
|
|
130
|
-
/>
|
|
131
|
-
</linearGradient>
|
|
132
|
-
</defs>
|
|
133
|
-
|
|
134
|
-
{/* Grid */}
|
|
135
|
-
{showGrid && <CartesianGrid strokeDasharray="3 3" />}
|
|
136
|
-
{!showGrid && horizontalLines && (
|
|
137
|
-
<CartesianGrid strokeDasharray="3 3" horizontal={true} vertical={false} />
|
|
138
|
-
)}
|
|
139
|
-
|
|
140
|
-
{/* Axes */}
|
|
141
|
-
{showXAxis && (
|
|
142
|
-
<XAxis
|
|
143
|
-
interval={0}
|
|
144
|
-
padding={{ left: 10, right: 10 }}
|
|
145
|
-
fontSize="0.8rem"
|
|
146
|
-
strokeWidth={horizontalLines ? 0 : 0.2}
|
|
147
|
-
dataKey="label"
|
|
148
|
-
angle={-35}
|
|
149
|
-
dy={dy ?? 10}
|
|
150
|
-
{...xAxisProps}
|
|
151
|
-
/>
|
|
152
|
-
)}
|
|
153
|
-
{showYAxis && (
|
|
154
|
-
<YAxis
|
|
155
|
-
interval={0}
|
|
156
|
-
strokeWidth={horizontalLines ? 0 : 0.2}
|
|
157
|
-
fontSize="0.8rem"
|
|
158
|
-
{...yAxisProps}
|
|
159
|
-
/>
|
|
160
|
-
)}
|
|
161
|
-
|
|
162
|
-
{/* Tooltip & Legend */}
|
|
163
|
-
<Tooltip content={<CustomTooltip />} formatter={tooltipFormatter} />
|
|
164
|
-
{showLegend && <Legend {...legendProps} />}
|
|
165
|
-
|
|
166
|
-
{/* Area series */}
|
|
167
|
-
{series.map((s, index) => (
|
|
168
|
-
<Area
|
|
169
|
-
key={s.dataKey}
|
|
170
|
-
type={curveType}
|
|
171
|
-
dataKey={s.dataKey}
|
|
172
|
-
name={s.label || s.dataKey}
|
|
173
|
-
stroke={resolveStrokeColor(s.color)}
|
|
174
|
-
fill={`url(#${gradientId})`}
|
|
175
|
-
fillOpacity={1}
|
|
176
|
-
strokeWidth={s.strokeWidth || 2}
|
|
177
|
-
dot={s.dot !== false ? { r: 4 } : false}
|
|
178
|
-
activeDot={{ r: 8 }}
|
|
179
|
-
/>
|
|
180
|
-
))}
|
|
181
|
-
</AreaChart>
|
|
182
|
-
</ResponsiveContainer>
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export default Lines;
|
package/ui/chart/Pie.tsx
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import {
|
|
5
|
-
PieChart as RePieChart,
|
|
6
|
-
Pie,
|
|
7
|
-
Cell,
|
|
8
|
-
Tooltip,
|
|
9
|
-
Legend,
|
|
10
|
-
ResponsiveContainer,
|
|
11
|
-
} from 'recharts';
|
|
12
|
-
|
|
13
|
-
type PieDataItem = {
|
|
14
|
-
label: string;
|
|
15
|
-
value: number;
|
|
16
|
-
color?: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
interface PieChartProps {
|
|
20
|
-
data: PieDataItem[];
|
|
21
|
-
donut?: boolean;
|
|
22
|
-
showLegend?: boolean;
|
|
23
|
-
funcss?: string;
|
|
24
|
-
width?: number | string;
|
|
25
|
-
height?: number | string;
|
|
26
|
-
outerRadius?: number;
|
|
27
|
-
innerRadius?: number;
|
|
28
|
-
tooltipFormatter?: (value: any, name: string, props: any) => React.ReactNode;
|
|
29
|
-
legendProps?: any;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Get CSS variable value from :root
|
|
33
|
-
const getCssVar = (varName: string): string => {
|
|
34
|
-
if (typeof window === 'undefined') return '';
|
|
35
|
-
return (
|
|
36
|
-
getComputedStyle(document.documentElement)
|
|
37
|
-
.getPropertyValue(`--${varName}`)
|
|
38
|
-
?.trim() || ''
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
// Resolve color from CSS var or fallback
|
|
43
|
-
const resolveColor = (input?: string, fallback = '#8884d8') => {
|
|
44
|
-
if (!input) return getCssVar('primary') || fallback;
|
|
45
|
-
if (input.startsWith('#')) return input;
|
|
46
|
-
return getCssVar(input) || input;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Custom Tooltip
|
|
50
|
-
const CustomTooltip = ({ active, payload, label }: any) => {
|
|
51
|
-
if (active && payload && payload.length) {
|
|
52
|
-
return (
|
|
53
|
-
<div className="dark raised round-edge p-2 text-sm">
|
|
54
|
-
<div className="text-bold">{payload[0].name}</div>
|
|
55
|
-
<div style={{ lineHeight: 1 }}>
|
|
56
|
-
Count: <span className="font-semibold">{payload[0].value}</span>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const ChartPie: React.FC<PieChartProps> = ({
|
|
65
|
-
data,
|
|
66
|
-
donut = false,
|
|
67
|
-
showLegend = true,
|
|
68
|
-
funcss = '',
|
|
69
|
-
width,
|
|
70
|
-
height,
|
|
71
|
-
outerRadius = 100,
|
|
72
|
-
innerRadius,
|
|
73
|
-
tooltipFormatter,
|
|
74
|
-
legendProps = {},
|
|
75
|
-
}) => {
|
|
76
|
-
const chart = (
|
|
77
|
-
<RePieChart
|
|
78
|
-
width={typeof width === 'number' ? width : undefined}
|
|
79
|
-
height={typeof height === 'number' ? height : undefined}
|
|
80
|
-
>
|
|
81
|
-
<Tooltip content={<CustomTooltip />} formatter={tooltipFormatter} />
|
|
82
|
-
{showLegend && <Legend {...legendProps} />}
|
|
83
|
-
<Pie
|
|
84
|
-
data={data}
|
|
85
|
-
dataKey="value"
|
|
86
|
-
nameKey="label"
|
|
87
|
-
cx="50%"
|
|
88
|
-
cy="50%"
|
|
89
|
-
outerRadius={outerRadius}
|
|
90
|
-
innerRadius={donut ? innerRadius ?? outerRadius * 0.6 : 0}
|
|
91
|
-
label={false} // <-- Hide slice value labels
|
|
92
|
-
labelLine={false} // <-- Remove line pointers
|
|
93
|
-
>
|
|
94
|
-
{data.map((entry, index) => (
|
|
95
|
-
<Cell
|
|
96
|
-
key={`cell-${index}`}
|
|
97
|
-
fill={resolveColor(entry.color)}
|
|
98
|
-
stroke="#ffffff"
|
|
99
|
-
strokeWidth={1}
|
|
100
|
-
/>
|
|
101
|
-
))}
|
|
102
|
-
</Pie>
|
|
103
|
-
</RePieChart>
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
if (!width && !height) {
|
|
107
|
-
return (
|
|
108
|
-
<ResponsiveContainer width="100%" height={300} className={funcss}>
|
|
109
|
-
{chart}
|
|
110
|
-
</ResponsiveContainer>
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<div
|
|
116
|
-
className={funcss}
|
|
117
|
-
style={{
|
|
118
|
-
width: typeof width === 'number' ? `${width}px` : width || '100%',
|
|
119
|
-
height: typeof height === 'number' ? `${height}px` : height || '300px',
|
|
120
|
-
}}
|
|
121
|
-
>
|
|
122
|
-
{chart}
|
|
123
|
-
</div>
|
|
124
|
-
);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export default ChartPie;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { ReactNode, CSSProperties, HTMLProps } from 'react';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
|
|
5
|
-
interface ContainerProps extends HTMLProps<HTMLDivElement> {
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
funcss?: string;
|
|
8
|
-
margin?: string;
|
|
9
|
-
padding?: string;
|
|
10
|
-
customStyle?: CSSProperties;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const Container: React.FC<ContainerProps> = ({
|
|
14
|
-
children,
|
|
15
|
-
funcss,
|
|
16
|
-
margin,
|
|
17
|
-
padding,
|
|
18
|
-
customStyle,
|
|
19
|
-
id,
|
|
20
|
-
...rest
|
|
21
|
-
}) => {
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
id={id}
|
|
25
|
-
className={`container ${funcss}`}
|
|
26
|
-
style={{
|
|
27
|
-
margin: margin || "",
|
|
28
|
-
padding: padding || "",
|
|
29
|
-
...customStyle
|
|
30
|
-
}}
|
|
31
|
-
{...rest}
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export default Container;
|