@taiv/ui 1.0.2 → 1.1.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.
Files changed (79) hide show
  1. package/README.md +23 -1
  2. package/dist/components/Data/Chart.d.ts +32 -0
  3. package/dist/components/Data/Chart.d.ts.map +1 -0
  4. package/dist/components/Data/Chart.js +97 -0
  5. package/dist/components/Data/PieChart.d.ts +24 -0
  6. package/dist/components/Data/PieChart.d.ts.map +1 -0
  7. package/dist/components/Data/PieChart.js +61 -0
  8. package/dist/components/Data/StatsCard.d.ts +17 -0
  9. package/dist/components/Data/StatsCard.d.ts.map +1 -0
  10. package/dist/components/Data/StatsCard.js +38 -0
  11. package/dist/components/Data/shared/dataFormats.d.ts +35 -0
  12. package/dist/components/Data/shared/dataFormats.d.ts.map +1 -0
  13. package/dist/components/Data/shared/dataFormats.js +25 -0
  14. package/dist/components/Info/Badge.d.ts +1 -0
  15. package/dist/components/Info/Badge.d.ts.map +1 -0
  16. package/dist/components/Info/Badge.js +1 -0
  17. package/dist/components/Info/InfoCard.d.ts +9 -0
  18. package/dist/components/Info/InfoCard.d.ts.map +1 -0
  19. package/dist/components/Info/InfoCard.js +18 -0
  20. package/dist/components/Info/Tooltips/InfoTooltip.d.ts +4 -2
  21. package/dist/components/Info/Tooltips/InfoTooltip.d.ts.map +1 -1
  22. package/dist/components/Info/Tooltips/InfoTooltip.js +2 -2
  23. package/dist/components/Info/Tooltips/Tooltip.d.ts +1 -1
  24. package/dist/components/Info/Tooltips/Tooltip.d.ts.map +1 -1
  25. package/dist/components/Info/Tooltips/Tooltip.js +1 -1
  26. package/dist/components/Inputs/Buttons/Button.d.ts +2 -1
  27. package/dist/components/Inputs/Buttons/Button.d.ts.map +1 -1
  28. package/dist/components/Inputs/Buttons/Button.js +12 -2
  29. package/dist/components/Inputs/Buttons/shared/variants.d.ts +50 -0
  30. package/dist/components/Inputs/Buttons/shared/variants.d.ts.map +1 -1
  31. package/dist/components/Inputs/Buttons/shared/variants.js +50 -0
  32. package/dist/components/Inputs/DatePickers/DatePicker.d.ts +12 -0
  33. package/dist/components/Inputs/DatePickers/DatePicker.d.ts.map +1 -0
  34. package/dist/components/Inputs/DatePickers/DatePicker.js +35 -0
  35. package/dist/components/Layout/AutoGrid.d.ts +8 -0
  36. package/dist/components/Layout/AutoGrid.d.ts.map +1 -0
  37. package/dist/components/Layout/AutoGrid.js +6 -0
  38. package/dist/components/Layout/Card.d.ts +8 -0
  39. package/dist/components/Layout/Card.d.ts.map +1 -0
  40. package/dist/components/Layout/Card.js +16 -0
  41. package/dist/components/Layout/Grid.d.ts +10 -0
  42. package/dist/components/Layout/Grid.d.ts.map +1 -0
  43. package/dist/components/Layout/Grid.js +9 -0
  44. package/dist/components/Layout/SectionCard.d.ts +11 -0
  45. package/dist/components/Layout/SectionCard.d.ts.map +1 -0
  46. package/dist/components/Layout/SectionCard.js +12 -0
  47. package/dist/components/Layout/Tabs.d.ts +17 -0
  48. package/dist/components/Layout/Tabs.d.ts.map +1 -0
  49. package/dist/components/Layout/Tabs.js +48 -0
  50. package/dist/components/Misc/IconBadge.d.ts +8 -0
  51. package/dist/components/Misc/IconBadge.d.ts.map +1 -0
  52. package/dist/components/Misc/IconBadge.js +29 -0
  53. package/dist/components/Typography/Fraction.d.ts +10 -0
  54. package/dist/components/Typography/Fraction.d.ts.map +1 -0
  55. package/dist/components/Typography/Fraction.js +7 -0
  56. package/dist/components/Typography/Text.d.ts.map +1 -1
  57. package/dist/components/Typography/Text.js +10 -2
  58. package/dist/components/index.d.ts +44 -32
  59. package/dist/components/index.d.ts.map +1 -1
  60. package/dist/components/index.js +44 -32
  61. package/dist/constants/colors.d.ts +97 -11
  62. package/dist/constants/colors.d.ts.map +1 -1
  63. package/dist/constants/colors.js +35 -19
  64. package/package.json +20 -4
  65. package/dist/components/Info/Modals/ConfirmationModal.d.ts +0 -18
  66. package/dist/components/Info/Modals/ConfirmationModal.d.ts.map +0 -1
  67. package/dist/components/Info/Modals/ConfirmationModal.js +0 -76
  68. package/dist/components/Info/Modals/InfoModal.d.ts +0 -15
  69. package/dist/components/Info/Modals/InfoModal.d.ts.map +0 -1
  70. package/dist/components/Info/Modals/InfoModal.js +0 -70
  71. package/dist/components/Info/Notifications/Notifications.d.ts +0 -16
  72. package/dist/components/Info/Notifications/Notifications.d.ts.map +0 -1
  73. package/dist/components/Info/Notifications/Notifications.js +0 -41
  74. package/dist/components/Misc/Copy.d.ts +0 -10
  75. package/dist/components/Misc/Copy.d.ts.map +0 -1
  76. package/dist/components/Misc/Copy.js +0 -18
  77. package/dist/components/Misc/MediaQuery.d.ts +0 -3
  78. package/dist/components/Misc/MediaQuery.d.ts.map +0 -1
  79. package/dist/components/Misc/MediaQuery.js +0 -2
package/README.md CHANGED
@@ -1 +1,23 @@
1
- # taiv-ui-toolkit
1
+ # **Taiv Web UI Toolkit**
2
+
3
+ This toolkit is designed to make frontend work quicker, easier, and better for developers working on Taiv’s web apps.
4
+
5
+ To get started with the toolkit in a new repo, the npm package for the toolkit needs to be installed and setup.
6
+
7
+ ## Installation
8
+
9
+ To get started with the toolkit, ensure you have the following installed in your project:
10
+
11
+ - Node 20
12
+ - TypeScript 5
13
+ - React 17
14
+
15
+ Then, you can install the package from npm:
16
+
17
+ ```tsx
18
+ npm i @taiv/ui
19
+ ```
20
+
21
+ The npm package is **public** and requires no access keys. It contains **strictly** UI components, constants, etc. so in order to test changes, you will need to npm link to your web project and run that.
22
+
23
+ See the Notion documentation for more information on usages and best practices.
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { CardProps } from '../Layout/Card';
3
+ import { dataFormats } from './shared/dataFormats';
4
+ export interface ChartDataPoint {
5
+ date: string | number;
6
+ value: number;
7
+ label?: string;
8
+ }
9
+ export interface ChartSeries {
10
+ name: string;
11
+ data: ChartDataPoint[];
12
+ color?: string;
13
+ type?: 'line' | 'area' | 'bar';
14
+ }
15
+ export interface ChartProps extends Omit<CardProps, 'children'> {
16
+ title: string;
17
+ subtitle?: string;
18
+ series: ChartSeries[];
19
+ height?: string | number;
20
+ showLegend?: boolean;
21
+ showGrid?: boolean;
22
+ xAxisLabel?: string;
23
+ yAxisLabel?: string;
24
+ format?: keyof typeof dataFormats;
25
+ formatYAxis?: (value: number) => string;
26
+ formatXAxis?: (value: string | number) => string;
27
+ tooltipContent?: (data: any) => React.ReactNode;
28
+ loading?: boolean;
29
+ emptyMessage?: string;
30
+ }
31
+ export declare const Chart: React.FC<ChartProps>;
32
+ //# sourceMappingURL=Chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../../src/components/Data/Chart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQjD,OAAO,EAAE,WAAW,EAAgB,MAAM,sBAAsB,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;CAChC;AAED,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,MAAM,CAAC,EAAE,MAAM,OAAO,WAAW,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IAEjD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,CAAC;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAyOtC,CAAC"}
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Card } from '../Layout/Card';
3
+ import { Text } from '../Typography/Text';
4
+ import { Title } from '../Typography/Title';
5
+ import { Stack } from '../Layout/Stack';
6
+ import { Center } from '../Layout/Center';
7
+ import { primary, neutral } from '../../constants/colors';
8
+ import { Area, Bar, CartesianGrid, ComposedChart, Legend, Line, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';
9
+ import { Group } from '../Layout/Group';
10
+ import { chartFormats } from './shared/dataFormats';
11
+ export const Chart = ({ title, subtitle, series, height = 300, showLegend = true, showGrid = true, xAxisLabel, yAxisLabel,
12
+ // New formatting props
13
+ format = 'decimal', // Default format
14
+ formatYAxis, // Custom formatter
15
+ formatXAxis = (value) => value.toString(), tooltipContent, loading = false, emptyMessage = 'No data available', ...cardProps }) => {
16
+ var _a;
17
+ // Create the Y-axis formatter function
18
+ const getYAxisFormatter = () => {
19
+ // If custom formatYAxis is provided, use it (takes priority)
20
+ if (formatYAxis) {
21
+ return formatYAxis;
22
+ }
23
+ // Otherwise, use the smart chart format
24
+ return chartFormats[format];
25
+ };
26
+ const yAxisFormatter = getYAxisFormatter();
27
+ const hasData = series.some((s) => s.data.length > 0);
28
+ // Custom tick components using our Text component
29
+ const CustomXAxisTick = (props) => {
30
+ const { x, y, payload } = props;
31
+ return (_jsx("g", { transform: `translate(${x},${y})`, children: _jsx("foreignObject", { x: -50, y: 0, width: 100, height: 20, children: _jsx("div", { style: { display: 'flex', justifyContent: 'center' }, children: _jsx(Text, { variant: "label", children: formatXAxis(payload.value) }) }) }) }));
32
+ };
33
+ const CustomYAxisTick = (props) => {
34
+ const { x, y, payload } = props;
35
+ return (_jsx("g", { transform: `translate(${x},${y})`, children: _jsx("foreignObject", { x: -35, y: -10, width: 35, height: 20, children: _jsx("div", { style: { display: 'flex', justifyContent: 'flex-end', alignItems: 'center', height: '100%' }, children: _jsx(Text, { variant: "label", children: yAxisFormatter(payload.value) }) }) }) }));
36
+ };
37
+ if (loading) {
38
+ return (_jsx(Card, { ...cardProps, children: _jsxs(Stack, { gap: "1rem", children: [_jsx(Title, { variant: "cardHeader", children: title }), subtitle && _jsx(Text, { variant: "label", children: subtitle }), _jsx(Center, { style: { height, backgroundColor: neutral[25], borderRadius: '8px' }, children: _jsx(Text, { variant: "label", color: neutral[200], children: "Loading..." }) })] }) }));
39
+ }
40
+ if (!hasData) {
41
+ return (_jsx(Card, { ...cardProps, children: _jsxs(Stack, { gap: "1rem", children: [_jsx(Title, { variant: "cardHeader", children: title }), subtitle && _jsx(Text, { variant: "label", children: subtitle }), _jsx(Center, { style: { height, backgroundColor: neutral[25], borderRadius: '8px' }, children: _jsx(Text, { variant: "label", color: neutral[200], children: emptyMessage }) })] }) }));
42
+ }
43
+ // Transform data to match Recharts format
44
+ const chartData = (_a = series[0]) === null || _a === void 0 ? void 0 : _a.data.map((point, index) => {
45
+ const dataPoint = { date: point.date };
46
+ series.forEach((s, seriesIndex) => {
47
+ if (s.data[index]) {
48
+ dataPoint[s.name] = s.data[index].value;
49
+ }
50
+ });
51
+ return dataPoint;
52
+ });
53
+ // Custom tooltip component
54
+ const CustomTooltip = ({ active, payload, label }) => {
55
+ if (active && payload && payload.length) {
56
+ return (_jsxs("div", { style: {
57
+ backgroundColor: 'white',
58
+ padding: '10px',
59
+ border: `1px solid ${neutral[100]}`,
60
+ borderRadius: '8px',
61
+ boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
62
+ }, children: [_jsx(Text, { weight: "semibold", color: neutral[300], children: formatXAxis(label) }), payload.map((entry) => (_jsxs(Group, { children: [_jsx("div", { style: {
63
+ width: '8px',
64
+ height: '8px',
65
+ borderRadius: '50%',
66
+ backgroundColor: entry.color,
67
+ } }), _jsxs(Group, { gap: "0.25rem", children: [_jsxs(Text, { variant: "label", color: neutral[300], children: [entry.name, ":"] }), _jsx(Text, { variant: "label", children: yAxisFormatter(entry.value) })] })] }, entry.name)))] }));
68
+ }
69
+ return null;
70
+ };
71
+ return (_jsxs(_Fragment, { children: [_jsx(Card, { ...cardProps, children: _jsxs(Stack, { gap: "1rem", children: [_jsxs(Stack, { gap: "0.5rem", children: [_jsx(Title, { variant: "cardHeader", children: title }), subtitle && _jsx(Text, { variant: "label", children: subtitle })] }), _jsx(Center, { style: { height, width: '100%' }, children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", children: _jsxs(ComposedChart, { data: chartData, children: [_jsx("defs", { children: series.map((s, index) => (_jsxs("linearGradient", { id: `gradient-${index}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: s.color || primary[200], stopOpacity: 0.3 }), _jsx("stop", { offset: "99%", stopColor: s.color || primary[200], stopOpacity: 0.05 })] }, s.name))) }), _jsx(XAxis, { dataKey: "date", axisLine: { stroke: neutral[50] }, tickLine: { stroke: neutral[50] }, tick: _jsx(CustomXAxisTick, {}) }), _jsx(YAxis, { width: 40, axisLine: false, tickLine: false, tick: _jsx(CustomYAxisTick, {}) }), _jsx(CartesianGrid, { strokeDasharray: "0", stroke: neutral[50], horizontal: true, vertical: false }), series.map((s, index) => {
72
+ const seriesType = s.type || 'line'; // Default to 'line' if no type specified
73
+ if (seriesType === 'area') {
74
+ return (_jsx(Area, { type: "monotone", dataKey: s.name, stroke: s.color || primary[200], strokeWidth: 2, fill: `url(#gradient-${index})`, baseValue: "dataMin", style: { outline: 'none' } }, s.name));
75
+ }
76
+ else if (seriesType === 'bar') {
77
+ return _jsx(Bar, { dataKey: s.name, fill: s.color || primary[200], radius: [2, 2, 0, 0], style: { outline: 'none' } }, s.name);
78
+ }
79
+ else {
80
+ // Default to line (seriesType === 'line')
81
+ return _jsx(Line, { type: "monotone", dataKey: s.name, stroke: s.color || primary[200], strokeWidth: 2, dot: false, style: { outline: 'none' } }, s.name);
82
+ }
83
+ }), _jsx(Tooltip, { content: tooltipContent || _jsx(CustomTooltip, {}), wrapperStyle: {
84
+ border: 'none',
85
+ outline: 'none', // Remove any outline
86
+ boxShadow: 'none', // Remove default shadow
87
+ }, contentStyle: {
88
+ border: 'none',
89
+ outline: 'none',
90
+ boxShadow: 'none',
91
+ padding: 0,
92
+ margin: 0,
93
+ backgroundColor: 'transparent',
94
+ }, labelStyle: {
95
+ display: 'none',
96
+ } }), showLegend && (_jsx(Legend, { iconType: "circle", iconSize: 8, formatter: (value) => (_jsx(Text, { variant: "label", sx: { color: neutral[300], display: 'inline', whiteSpace: 'nowrap' }, children: value })) }))] }) }) })] }) }), _jsx("style", { children: `.recharts-surface { outline: none; }` })] }));
97
+ };
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { CardProps } from '../Layout/Card';
3
+ export interface PieChartDataPoint {
4
+ name: string;
5
+ value: number;
6
+ color?: string;
7
+ }
8
+ export interface PieChartProps extends Omit<CardProps, 'children'> {
9
+ title: string;
10
+ subtitle?: string;
11
+ data: PieChartDataPoint[];
12
+ height?: string | number;
13
+ showLegend?: boolean;
14
+ innerRadius?: number;
15
+ outerRadius?: number;
16
+ paddingAngle?: number;
17
+ colors?: string[];
18
+ formatValue?: (value: number) => string;
19
+ tooltipContent?: (data: any) => React.ReactNode;
20
+ loading?: boolean;
21
+ emptyMessage?: string;
22
+ }
23
+ export declare const PieChart: React.FC<PieChartProps>;
24
+ //# sourceMappingURL=PieChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PieChart.d.ts","sourceRoot":"","sources":["../../../src/components/Data/PieChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,gBAAgB,CAAC;AASjD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,iBAAiB,EAAE,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,CAAC;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAKD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwK5C,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Card } from '../Layout/Card';
3
+ import { Text } from '../Typography/Text';
4
+ import { Title } from '../Typography/Title';
5
+ import { Stack } from '../Layout/Stack';
6
+ import { Center } from '../Layout/Center';
7
+ import { Group } from '../Layout/Group';
8
+ import { primary, neutral } from '../../constants/colors';
9
+ import { PieChart as RechartsPieChart, Pie, Cell, ResponsiveContainer, Tooltip, Legend } from 'recharts';
10
+ // Default color palette
11
+ const DEFAULT_COLORS = [primary[200], primary[300], primary[100], primary[50], '#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F'];
12
+ export const PieChart = ({ title, subtitle, data, height = '30rem', showLegend = true, innerRadius = 80, outerRadius = 100, paddingAngle = 5, colors = DEFAULT_COLORS, formatValue = (value) => value.toString(), tooltipContent, loading = false, emptyMessage = 'No data available', ...cardProps }) => {
13
+ const hasData = data && data.length > 0;
14
+ const totalValue = hasData ? data.reduce((sum, item) => sum + item.value, 0) : 0;
15
+ const firstDataPoint = hasData ? data[0] : null;
16
+ const firstDataPercentage = firstDataPoint && totalValue > 0 ? Math.round((firstDataPoint.value / totalValue) * 100) : 0;
17
+ if (loading) {
18
+ return (_jsx(Card, { ...cardProps, children: _jsxs(Stack, { gap: "1rem", children: [_jsx(Title, { variant: "cardHeader", children: title }), subtitle && _jsx(Text, { variant: "label", children: subtitle }), _jsx(Center, { style: { height, backgroundColor: neutral[25], borderRadius: '8px' }, children: _jsx(Text, { variant: "label", color: neutral[200], children: "Loading..." }) })] }) }));
19
+ }
20
+ if (!hasData) {
21
+ return (_jsx(Card, { ...cardProps, children: _jsxs(Stack, { gap: "1rem", children: [_jsx(Title, { variant: "cardHeader", children: title }), subtitle && _jsx(Text, { variant: "label", children: subtitle }), _jsx(Center, { style: { height, backgroundColor: neutral[25], borderRadius: '8px' }, children: _jsx(Text, { variant: "label", color: neutral[200], children: emptyMessage }) })] }) }));
22
+ }
23
+ // Custom tooltip component
24
+ const CustomTooltip = ({ active, payload, label }) => {
25
+ if (active && payload && payload.length) {
26
+ return (_jsxs("div", { style: {
27
+ backgroundColor: 'white',
28
+ padding: '10px',
29
+ border: `1px solid ${neutral[100]}`,
30
+ borderRadius: '8px',
31
+ boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
32
+ }, children: [_jsx(Text, { weight: "semibold", color: neutral[300], children: label }), payload.map((entry) => (_jsxs(Group, { children: [_jsx("div", { style: {
33
+ width: '8px',
34
+ height: '8px',
35
+ borderRadius: '50%',
36
+ backgroundColor: entry.color,
37
+ } }), _jsxs(Group, { gap: "0.25rem", children: [_jsxs(Text, { variant: "label", color: neutral[300], children: [entry.name, ":"] }), _jsx(Text, { variant: "label", children: formatValue(entry.value) })] })] }, entry.name)))] }));
38
+ }
39
+ return null;
40
+ };
41
+ return (_jsxs(_Fragment, { children: [_jsx(Card, { ...cardProps, children: _jsxs(Stack, { gap: "0", children: [_jsxs(Stack, { gap: "0.5rem", children: [_jsx(Title, { variant: "cardHeader", children: title }), subtitle && _jsx(Text, { variant: "label", children: subtitle })] }), _jsxs(Center, { style: { height, width: '100%', position: 'relative' }, children: [_jsx(ResponsiveContainer, { width: "100%", height: "100%", style: { outline: 'none' }, children: _jsxs(RechartsPieChart, { style: { outline: 'none' }, children: [_jsx(Pie, { data: data, innerRadius: innerRadius, outerRadius: outerRadius, paddingAngle: paddingAngle, dataKey: "value", style: { outline: 'none' }, children: data.map((entry, index) => (_jsx(Cell, { fill: entry.color || colors[index % colors.length], style: { outline: 'none' } }, `cell-${entry.name}`))) }), _jsx(Tooltip, { content: tooltipContent || _jsx(CustomTooltip, {}), wrapperStyle: {
42
+ border: 'none',
43
+ outline: 'none',
44
+ boxShadow: 'none',
45
+ }, contentStyle: {
46
+ border: 'none',
47
+ outline: 'none',
48
+ boxShadow: 'none',
49
+ padding: 0,
50
+ margin: 0,
51
+ backgroundColor: 'transparent',
52
+ } }), showLegend && (_jsx(Legend, { iconType: "circle", iconSize: 8, style: {
53
+ marginTop: '1rem',
54
+ }, formatter: (value) => (_jsx(Text, { variant: "label", style: { color: neutral[300], display: 'inline', whiteSpace: 'nowrap' }, children: value })) }))] }) }), _jsx(Center, { style: {
55
+ position: 'absolute',
56
+ top: '45%',
57
+ left: '50%',
58
+ transform: 'translate(-50%, -50%)',
59
+ textAlign: 'center',
60
+ }, children: _jsxs(Stack, { gap: "0", align: "center", children: [_jsxs(Title, { variant: "cardHeader", color: neutral[300], children: [firstDataPercentage, "%"] }), _jsx(Text, { variant: "label", children: title })] }) })] })] }) }), _jsx("style", { children: `.recharts-surface { outline: none; }` })] }));
61
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { CardProps } from '../Layout/Card';
3
+ import { palettes } from '../../constants/colors';
4
+ import { dataFormats } from './shared/dataFormats';
5
+ export interface StatsCardProps extends Omit<CardProps, 'children'> {
6
+ value: number;
7
+ title: string;
8
+ description?: string;
9
+ format?: keyof typeof dataFormats;
10
+ isDelta?: boolean;
11
+ icon?: React.ReactNode;
12
+ iconColor?: keyof typeof palettes;
13
+ tooltip?: React.ReactNode;
14
+ increaseDescription?: string;
15
+ }
16
+ export declare const StatsCard: ({ value, format, isDelta, title, description, increaseDescription, icon: Icon, iconColor, tooltip, ...cardProps }: StatsCardProps) => import("react/jsx-runtime").JSX.Element;
17
+ //# sourceMappingURL=StatsCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatsCard.d.ts","sourceRoot":"","sources":["../../../src/components/Data/StatsCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMjD,OAAO,EAAE,QAAQ,EAAmB,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,OAAO,WAAW,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,SAAS,GAAI,mHAAgJ,cAAc,4CA4DvL,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Card } from '../Layout/Card';
3
+ import { InfoTooltip } from '../Info/Tooltips/InfoTooltip';
4
+ import { Text } from '../Typography/Text';
5
+ import { Title } from '../Typography/Title';
6
+ import { Group } from '../Layout/Group';
7
+ import { Stack } from '../Layout/Stack';
8
+ import { colors, neutral } from '../../constants/colors';
9
+ import { dataFormats } from './shared/dataFormats';
10
+ import { IconBadge } from '../Misc/IconBadge';
11
+ export const StatsCard = ({ value, format = 'decimal', isDelta = false, title, description, increaseDescription, icon: Icon, iconColor = 'blue', tooltip, ...cardProps }) => {
12
+ const getDelta = () => {
13
+ const currentDirection = isDelta ? (value > 0 ? 'positive' : value < 0 ? 'negative' : null) : null;
14
+ return {
15
+ direction: currentDirection,
16
+ color: currentDirection === 'positive' ? colors.success[200] : currentDirection === 'negative' ? colors.neutral[200] : undefined,
17
+ showIncrementalText: currentDirection === 'positive',
18
+ };
19
+ };
20
+ const delta = getDelta();
21
+ const formatValue = () => {
22
+ const config = dataFormats[format];
23
+ const formattedNumber = value.toLocaleString('en-US', {
24
+ minimumFractionDigits: config.decimalPlaces,
25
+ maximumFractionDigits: config.decimalPlaces,
26
+ });
27
+ let result = formattedNumber;
28
+ if (delta.direction === 'positive') {
29
+ result = `+${result}`;
30
+ }
31
+ else if (delta.direction === 'negative') {
32
+ result = `-${result}`;
33
+ }
34
+ result = `${config.prefix}${result}${config.suffix}`;
35
+ return result;
36
+ };
37
+ return (_jsx(Card, { bg: neutral[25], animate: true, ...cardProps, children: _jsxs(Stack, { gap: "1.6rem", children: [_jsxs(Stack, { gap: "0.25rem", children: [_jsxs(Group, { position: "apart", children: [_jsx(Title, { size: "3xl", weight: "bold", children: formatValue() }), Icon && _jsx(IconBadge, { icon: Icon, color: iconColor })] }), _jsxs(Group, { gap: "0.75rem", children: [_jsx(Title, { variant: "cardHeader", color: "#6D6D6D", weight: "medium", children: title }), tooltip && _jsx(InfoTooltip, { text: tooltip })] })] }), _jsxs(Stack, { gap: "0", children: [description && _jsx(Text, { variant: "label", children: description }), delta.showIncrementalText && increaseDescription && (_jsx(Text, { variant: "label", color: delta.color, children: increaseDescription }))] })] }) }));
38
+ };
@@ -0,0 +1,35 @@
1
+ export declare const dataFormats: {
2
+ readonly integer: {
3
+ readonly decimalPlaces: 0;
4
+ readonly prefix: "";
5
+ readonly suffix: "";
6
+ };
7
+ readonly decimal: {
8
+ readonly decimalPlaces: 1;
9
+ readonly prefix: "";
10
+ readonly suffix: "";
11
+ };
12
+ readonly currency: {
13
+ readonly decimalPlaces: 2;
14
+ readonly prefix: "$";
15
+ readonly suffix: "";
16
+ };
17
+ readonly percentage: {
18
+ readonly decimalPlaces: 1;
19
+ readonly prefix: "";
20
+ readonly suffix: "%";
21
+ };
22
+ readonly multiple: {
23
+ readonly decimalPlaces: 1;
24
+ readonly prefix: "";
25
+ readonly suffix: "x";
26
+ };
27
+ };
28
+ export declare const chartFormats: {
29
+ readonly integer: (value: number) => string;
30
+ readonly decimal: (value: number) => string;
31
+ readonly currency: (value: number) => string;
32
+ readonly percentage: (value: number) => string;
33
+ readonly multiple: (value: number) => string;
34
+ };
35
+ //# sourceMappingURL=dataFormats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataFormats.d.ts","sourceRoot":"","sources":["../../../../src/components/Data/shared/dataFormats.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;CAMd,CAAC;AAiBX,eAAO,MAAM,YAAY;8BACN,MAAM,KAAG,MAAM;8BAEf,MAAM,KAAG,MAAM;+BAEd,MAAM,KAAG,MAAM;iCAEb,MAAM,KAAG,MAAM;+BAEjB,MAAM,KAAG,MAAM;CACzB,CAAC"}
@@ -0,0 +1,25 @@
1
+ export const dataFormats = {
2
+ integer: { decimalPlaces: 0, prefix: '', suffix: '' },
3
+ decimal: { decimalPlaces: 1, prefix: '', suffix: '' },
4
+ currency: { decimalPlaces: 2, prefix: '$', suffix: '' },
5
+ percentage: { decimalPlaces: 1, prefix: '', suffix: '%' },
6
+ multiple: { decimalPlaces: 1, prefix: '', suffix: 'x' },
7
+ };
8
+ // Helper function to format numbers with truncation
9
+ const formatWithTruncation = (value, prefix, suffix, decimalPlaces, truncateAt1000 = true) => {
10
+ const absValue = Math.abs(value);
11
+ if (absValue >= 1000000) {
12
+ return `${prefix}${(value / 1000000).toFixed(1)}M${suffix}`;
13
+ }
14
+ if (truncateAt1000 && absValue >= 1000) {
15
+ return `${prefix}${(value / 1000).toFixed(1)}k${suffix}`;
16
+ }
17
+ return `${prefix}${value.toFixed(decimalPlaces)}${suffix}`;
18
+ };
19
+ export const chartFormats = {
20
+ integer: (value) => formatWithTruncation(value, '', '', 0, true),
21
+ decimal: (value) => formatWithTruncation(value, '', '', 1, true),
22
+ currency: (value) => formatWithTruncation(value, '$', '', 2, true),
23
+ percentage: (value) => formatWithTruncation(value, '', '%', 1, true),
24
+ multiple: (value) => formatWithTruncation(value, '', 'x', 1, true),
25
+ };
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Info/Badge.tsx"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { CardProps } from '../Layout/Card';
3
+ import { colors } from '../../constants/colors';
4
+ export interface InfoCardProps extends Omit<CardProps, 'children'> {
5
+ children: React.ReactNode;
6
+ variant?: keyof typeof colors;
7
+ }
8
+ export declare const InfoCard: ({ children, variant, ...cardProps }: InfoCardProps) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=InfoCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InfoCard.d.ts","sourceRoot":"","sources":["../../../src/components/Info/InfoCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAChE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;CAC/B;AAED,eAAO,MAAM,QAAQ,GAAI,qCAAiD,aAAa,4CAwBtF,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Card } from '../Layout/Card';
3
+ import { Center } from '../Layout/Center';
4
+ import { colors } from '../../constants/colors';
5
+ export const InfoCard = ({ children, variant = 'primary', ...cardProps }) => {
6
+ const colorPalette = colors[variant];
7
+ const style = {
8
+ border: `1px solid ${colorPalette[200]}`,
9
+ backgroundColor: colorPalette[25],
10
+ color: colorPalette[200] + ' !important',
11
+ padding: '3.2rem 6.4rem',
12
+ };
13
+ return (_jsx(Card, { shadow: "lg", style: style, sx: {
14
+ '& *': {
15
+ color: `${colorPalette[200]} !important`,
16
+ },
17
+ }, ...cardProps, children: _jsx(Center, { children: children }) }));
18
+ };
@@ -1,6 +1,8 @@
1
+ import React from 'react';
1
2
  import { CSSObject } from '@mantine/styles';
2
3
  interface InfoTooltipProps {
3
- text: string;
4
+ text: React.ReactNode;
5
+ content?: React.ReactNode;
4
6
  position?: 'top-end' | 'bottom-end' | 'top-start' | 'bottom-start';
5
7
  size?: keyof typeof componentSizes;
6
8
  offset?: number;
@@ -13,6 +15,6 @@ declare const componentSizes: {
13
15
  readonly lg: "2rem";
14
16
  readonly xl: "2.4rem";
15
17
  };
16
- declare const InfoTooltip: ({ text, position, size, offset, className, styles }: InfoTooltipProps) => import("react/jsx-runtime").JSX.Element;
18
+ declare const InfoTooltip: ({ text, content, position, size, offset, className, styles }: InfoTooltipProps) => import("react/jsx-runtime").JSX.Element;
17
19
  export { InfoTooltip };
18
20
  //# sourceMappingURL=InfoTooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InfoTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Tooltips/InfoTooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;IACnE,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,cAAc;;;;;CAKV,CAAC;AAEX,QAAA,MAAM,WAAW,GAAI,qDAA0E,gBAAgB,4CAc9G,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"InfoTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Tooltips/InfoTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,UAAU,gBAAgB;IACxB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;IACnE,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,cAAc;;;;;CAKV,CAAC;AAEX,QAAA,MAAM,WAAW,GAAI,8DAAmF,gBAAgB,4CAcvH,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -7,7 +7,7 @@ const componentSizes = {
7
7
  lg: '2rem',
8
8
  xl: '2.4rem',
9
9
  };
10
- const InfoTooltip = ({ text, position = 'top-start', size = 'md', offset, className, styles }) => {
10
+ const InfoTooltip = ({ text, content, position = 'top-start', size = 'md', offset, className, styles }) => {
11
11
  const style = {
12
12
  icon: {
13
13
  color: neutral[100],
@@ -15,6 +15,6 @@ const InfoTooltip = ({ text, position = 'top-start', size = 'md', offset, classN
15
15
  },
16
16
  ...styles,
17
17
  };
18
- return (_jsx(Tooltip, { text: text, position: position, offset: offset, className: className, children: _jsx("i", { className: "fas fa-info-circle", style: style.icon }) }));
18
+ return (_jsx(Tooltip, { text: text || content, position: position, offset: offset, className: className, children: _jsx("i", { className: "fas fa-info-circle", style: style.icon }) }));
19
19
  };
20
20
  export { InfoTooltip };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { CSSObject } from '@mantine/styles';
3
3
  interface TooltipProps {
4
4
  children: React.ReactNode;
5
- text: string;
5
+ text?: React.ReactNode;
6
6
  position?: 'top-end' | 'bottom-end' | 'top-start' | 'bottom-start';
7
7
  offset?: number;
8
8
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Tooltips/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,UAAU,YAAY;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,OAAO,GAAI,yDAAuE,YAAY,4CA+CnG,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Tooltips/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,UAAU,YAAY;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,OAAO,GAAI,yDAAuE,YAAY,4CAgDnG,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -30,6 +30,6 @@ const Tooltip = ({ children, text, position = 'top-start', offset, className, st
30
30
  },
31
31
  ...styles,
32
32
  };
33
- return (_jsx(MantineTooltip, { withArrow: true, arrowRadius: 0, arrowSize: 8, label: text, position: position, transitionProps: { transition: positionToTransition[position], duration: 200 }, color: "white", styles: tooltipStyle, offset: offset, className: className, children: _jsx(Box, { sx: wrapperStyle, children: children }) }));
33
+ return (_jsx(MantineTooltip, { withArrow: true, arrowRadius: 0, arrowSize: 8, label: text, position: position, transitionProps: { transition: positionToTransition[position], duration: 200 }, color: "white", styles: tooltipStyle, offset: offset, className: className, withinPortal: true, children: _jsx(Box, { sx: wrapperStyle, children: children }) }));
34
34
  };
35
35
  export { Tooltip };
@@ -6,6 +6,7 @@ export interface ButtonProps extends MantineButtonProps {
6
6
  size?: keyof typeof componentSizes;
7
7
  variant?: keyof typeof componentVariants;
8
8
  fullWidth?: boolean;
9
+ toggled?: boolean;
9
10
  }
10
- export declare const Button: ({ onClick, size, variant, fullWidth, styles, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const Button: ({ onClick, size, variant, fullWidth, toggled, styles, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
11
12
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Buttons/Button.tsx"],"names":[],"mappings":"AACA,OAAO,EAA2B,WAAW,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,OAAO,iBAAiB,CAAC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,MAAM,GAAI,yDAOpB,WAAW,4CAuBb,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Buttons/Button.tsx"],"names":[],"mappings":"AACA,OAAO,EAA2B,WAAW,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,OAAO,iBAAiB,CAAC;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,MAAM,GAAI,kEAAqG,WAAW,4CAkCtI,CAAC"}
@@ -3,9 +3,19 @@ import { Button as MantineButton } from '@mantine/core';
3
3
  import { fontBase, fontWeight } from '../../../constants/font';
4
4
  import { componentSizes } from './shared/sizes';
5
5
  import { componentVariants } from './shared/variants';
6
- export const Button = ({ onClick, size = 'md', variant = 'primary', fullWidth = false, styles, ...props }) => {
6
+ export const Button = ({ onClick, size = 'md', variant = 'primary', fullWidth = false, toggled = false, styles, ...props }) => {
7
7
  const selectedVariant = componentVariants[variant];
8
8
  const selectedSize = componentSizes[size];
9
+ // Apply active styles for nav variant when isActive is true
10
+ const getVariantStyles = () => {
11
+ if (toggled) {
12
+ return {
13
+ ...selectedVariant,
14
+ ...selectedVariant['&:toggled'],
15
+ };
16
+ }
17
+ return selectedVariant;
18
+ };
9
19
  const style = {
10
20
  root: {
11
21
  borderRadius: '8px',
@@ -15,7 +25,7 @@ export const Button = ({ onClick, size = 'md', variant = 'primary', fullWidth =
15
25
  padding: selectedSize.padding,
16
26
  minWidth: `${selectedSize.minWidth}rem`,
17
27
  fontSize: selectedSize.fontSize,
18
- ...selectedVariant,
28
+ ...getVariantStyles(),
19
29
  },
20
30
  label: {
21
31
  ...fontBase,