@taiv/ui 1.2.0 → 1.3.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.
- package/dist/components/Data/Cards/ChartCard.d.ts +9 -0
- package/dist/components/Data/Cards/ChartCard.d.ts.map +1 -0
- package/dist/components/Data/Cards/ChartCard.js +9 -0
- package/dist/components/Data/Cards/PieChartCard.d.ts +10 -0
- package/dist/components/Data/Cards/PieChartCard.d.ts.map +1 -0
- package/dist/components/Data/Cards/PieChartCard.js +9 -0
- package/dist/components/Data/Cards/StatsCard.d.ts +17 -0
- package/dist/components/Data/Cards/StatsCard.d.ts.map +1 -0
- package/dist/components/Data/Cards/StatsCard.js +38 -0
- package/dist/components/Data/Chart.d.ts +5 -24
- package/dist/components/Data/Chart.d.ts.map +1 -1
- package/dist/components/Data/Chart.js +63 -80
- package/dist/components/Data/JustChart.d.ts +23 -0
- package/dist/components/Data/JustChart.d.ts.map +1 -0
- package/dist/components/Data/JustChart.js +70 -0
- package/dist/components/Data/JustPieChart.d.ts +20 -0
- package/dist/components/Data/JustPieChart.d.ts.map +1 -0
- package/dist/components/Data/JustPieChart.js +63 -0
- package/dist/components/Data/PieChart.d.ts +9 -12
- package/dist/components/Data/PieChart.d.ts.map +1 -1
- package/dist/components/Data/PieChart.js +35 -43
- package/dist/components/Data/StatsBadge.d.ts +10 -0
- package/dist/components/Data/StatsBadge.d.ts.map +1 -0
- package/dist/components/Data/StatsBadge.js +25 -0
- package/dist/components/Data/StatsCard.d.ts +2 -2
- package/dist/components/Data/StatsCard.d.ts.map +1 -1
- package/dist/components/Data/StatsCard.js +2 -2
- package/dist/components/Data/shared/chartFormats.d.ts +8 -0
- package/dist/components/Data/shared/chartFormats.d.ts.map +1 -0
- package/dist/components/Data/shared/chartFormats.js +29 -0
- package/dist/components/Data/shared/dataFormats.d.ts +7 -33
- package/dist/components/Data/shared/dataFormats.d.ts.map +1 -1
- package/dist/components/Data/shared/dataFormats.js +15 -20
- package/dist/components/Info/Badge.d.ts +10 -0
- package/dist/components/Info/Badge.d.ts.map +1 -1
- package/dist/components/Info/Badge.js +64 -1
- package/dist/components/Info/Tooltips/FormulaTooltip.d.ts +8 -0
- package/dist/components/Info/Tooltips/FormulaTooltip.d.ts.map +1 -0
- package/dist/components/Info/Tooltips/FormulaTooltip.js +11 -0
- package/dist/components/Info/Tooltips/InfoTooltip.d.ts +2 -1
- package/dist/components/Info/Tooltips/InfoTooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/InfoTooltip.js +2 -2
- package/dist/components/Info/Tooltips/Tooltip.d.ts +2 -1
- package/dist/components/Info/Tooltips/Tooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/Tooltip.js +2 -2
- package/dist/components/Inputs/Controls/Radio.d.ts +8 -0
- package/dist/components/Inputs/Controls/Radio.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/Radio.js +43 -0
- package/dist/components/Inputs/Controls/RadioList.d.ts +16 -0
- package/dist/components/Inputs/Controls/RadioList.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/RadioList.js +24 -0
- package/dist/components/Inputs/DatePickers/DatePicker.d.ts.map +1 -1
- package/dist/components/Inputs/DatePickers/DatePicker.js +39 -3
- package/dist/components/Inputs/Dates/DatePicker.d.ts +12 -0
- package/dist/components/Inputs/Dates/DatePicker.d.ts.map +1 -0
- package/dist/components/Inputs/Dates/DatePicker.js +71 -0
- package/dist/components/Inputs/Dropdowns/CascadingSelect.d.ts +17 -0
- package/dist/components/Inputs/Dropdowns/CascadingSelect.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/CascadingSelect.js +70 -0
- package/dist/components/Inputs/Dropdowns/FontSelect.d.ts +2 -5
- package/dist/components/Inputs/Dropdowns/FontSelect.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/FontSelect.js +1 -1
- package/dist/components/Inputs/Dropdowns/NestedSelect.d.ts +17 -0
- package/dist/components/Inputs/Dropdowns/NestedSelect.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/NestedSelect.js +70 -0
- package/dist/components/Inputs/Dropdowns/Select.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/Select.js +2 -2
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.d.ts +1 -4
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.js +1 -4
- package/dist/components/Layout/Divider.d.ts +2 -1
- package/dist/components/Layout/Divider.d.ts.map +1 -1
- package/dist/components/Layout/Divider.js +2 -2
- package/dist/components/Layout/SectionCard.d.ts.map +1 -1
- package/dist/components/Layout/SectionCard.js +3 -2
- package/dist/components/Misc/IconBadge.d.ts +2 -2
- package/dist/components/Misc/IconBadge.d.ts.map +1 -1
- package/dist/components/Misc/IconBadge.js +3 -4
- package/dist/components/Typography/Formula.d.ts +10 -0
- package/dist/components/Typography/Formula.d.ts.map +1 -0
- package/dist/components/Typography/Formula.js +141 -0
- package/dist/components/Typography/Fraction.d.ts +3 -4
- package/dist/components/Typography/Fraction.d.ts.map +1 -1
- package/dist/components/Typography/Fraction.js +6 -3
- package/dist/components/Typography/Text.d.ts +1 -1
- package/dist/components/Typography/Text.d.ts.map +1 -1
- package/dist/components/Typography/Text.js +7 -0
- package/dist/components/index.d.ts +11 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +11 -2
- package/dist/constants/colors.d.ts +1 -1
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +3 -3
- package/dist/constants/data.d.ts +70 -0
- package/dist/constants/data.d.ts.map +1 -0
- package/dist/constants/data.js +15 -0
- package/dist/hooks/useDropdowns.d.ts +9 -0
- package/dist/hooks/useDropdowns.d.ts.map +1 -0
- package/dist/hooks/useDropdowns.js +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/types.d.ts +20 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/dist/utils/charts.d.ts +13 -0
- package/dist/utils/charts.d.ts.map +1 -0
- package/dist/utils/charts.js +48 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/select.d.ts +5 -0
- package/dist/utils/select.d.ts.map +1 -0
- package/dist/utils/select.js +12 -0
- package/package.json +6 -2
|
@@ -1,61 +1,53 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { PieChart as RechartsPieChart, Pie, Cell, ResponsiveContainer, Tooltip, Legend, Label } from 'recharts';
|
|
3
3
|
import { Text } from '../Typography/Text';
|
|
4
|
-
import { Title } from '../Typography/Title';
|
|
5
|
-
import { Stack } from '../Layout/Stack';
|
|
6
4
|
import { Center } from '../Layout/Center';
|
|
7
5
|
import { Group } from '../Layout/Group';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
import { Title } from '../Typography/Title';
|
|
7
|
+
import { Stack } from '../Layout/Stack';
|
|
8
|
+
import { Box } from '../Layout/Box';
|
|
9
|
+
import { neutral } from '../../constants/colors';
|
|
10
|
+
import { textStyle } from '../../constants/font';
|
|
11
|
+
import { getChartFormatter } from '../../utils/charts';
|
|
12
|
+
export const PieChart = ({ data, showLegend = true, innerRadius = 80, outerRadius = 100, paddingAngle = 5, format = 'percentage', loading = false, centerContent, height = '100%', }) => {
|
|
13
13
|
const hasData = data && data.length > 0;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
// Custom tooltip component
|
|
24
|
-
const CustomTooltip = ({ active, payload, label }) => {
|
|
14
|
+
const transformedData = data.map((item) => ({
|
|
15
|
+
...item,
|
|
16
|
+
name: item.key,
|
|
17
|
+
}));
|
|
18
|
+
const getCenterContent = () => {
|
|
19
|
+
return (_jsx("g", { children: _jsx("foreignObject", { x: "0%", y: "35%", width: "100%", height: "100%", style: { pointerEvents: 'none' }, children: _jsxs(Stack, { gap: "0", align: "center", children: [(centerContent === null || centerContent === void 0 ? void 0 : centerContent.value) && (_jsx(Title, { variant: "sectionHeader", color: neutral[300], children: getChartFormatter(format, { decimalPlaces: 0 })(centerContent.value) })), (centerContent === null || centerContent === void 0 ? void 0 : centerContent.title) && _jsx(Title, { variant: "cardSubheader", children: centerContent.title }), (centerContent === null || centerContent === void 0 ? void 0 : centerContent.subtitle) && _jsx(Text, { variant: "label", children: centerContent.subtitle })] }) }) }));
|
|
20
|
+
};
|
|
21
|
+
const getTooltip = ({ active, payload, label }) => {
|
|
25
22
|
if (active && payload && payload.length) {
|
|
26
|
-
return (_jsxs(
|
|
23
|
+
return (_jsxs(Box, { sx: {
|
|
27
24
|
backgroundColor: 'white',
|
|
28
|
-
padding: '
|
|
25
|
+
padding: '1rem',
|
|
29
26
|
border: `1px solid ${neutral[100]}`,
|
|
30
27
|
borderRadius: '8px',
|
|
31
28
|
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
|
29
|
+
zIndex: 1000,
|
|
30
|
+
position: 'relative',
|
|
32
31
|
}, children: [_jsx(Text, { weight: "semibold", color: neutral[300], children: label }), payload.map((entry) => (_jsxs(Group, { children: [_jsx("div", { style: {
|
|
33
32
|
width: '8px',
|
|
34
33
|
height: '8px',
|
|
35
34
|
borderRadius: '50%',
|
|
36
|
-
backgroundColor: entry.color,
|
|
37
|
-
} }), _jsxs(Group, { gap: "0.25rem", children: [_jsxs(Text, { variant: "label", color: neutral[300], children: [entry.
|
|
35
|
+
backgroundColor: entry.payload.color,
|
|
36
|
+
} }), _jsxs(Group, { gap: "0.25rem", children: [_jsxs(Text, { variant: "label", color: neutral[300], children: [entry.payload.key, ":"] }), _jsx(Text, { variant: "label", children: getChartFormatter(format)(entry.payload.value) })] })] }, entry.key)))] }));
|
|
38
37
|
}
|
|
39
38
|
return null;
|
|
40
39
|
};
|
|
41
|
-
return (_jsxs(_Fragment, { children: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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; }` })] }));
|
|
40
|
+
return (_jsxs(_Fragment, { children: [loading || !hasData ? (_jsx(Center, { style: { backgroundColor: neutral[25], borderRadius: '8px' }, children: _jsx(Text, { variant: "label", color: neutral[200], children: loading ? 'Loading...' : 'No data available' }) })) : (_jsx(Center, { h: height, w: "100%", style: { position: 'relative' }, children: _jsx(ResponsiveContainer, { width: "100%", height: "100%", style: { outline: 'none' }, children: _jsxs(RechartsPieChart, { style: { outline: 'none' }, children: [_jsxs(Pie, { data: transformedData, innerRadius: innerRadius, outerRadius: outerRadius, paddingAngle: paddingAngle, dataKey: "value", style: { outline: 'none' }, children: [_jsx(Label, { content: getCenterContent(), position: "center" }), data.map((entry, index) => (_jsx(Cell, { fill: entry.color, style: { outline: 'none' } }, `cell-${entry.key}`)))] }), _jsx(Tooltip, { content: getTooltip }), showLegend && _jsx(Legend, { iconType: "circle", iconSize: 8, wrapperStyle: { paddingTop: '0.6rem' } })] }) }) })), _jsx("style", { children: `
|
|
41
|
+
.recharts-legend-item-text {
|
|
42
|
+
font-family: ${textStyle.label.fontFamily};
|
|
43
|
+
font-size: ${textStyle.label.fontSize};
|
|
44
|
+
line-height: ${textStyle.label.lineHeight};
|
|
45
|
+
font-weight: ${textStyle.label.fontWeight};
|
|
46
|
+
-webkit-font-smoothing: ${textStyle.label.WebkitFontSmoothing};
|
|
47
|
+
-moz-osx-font-smoothing: ${textStyle.label.MozOsxFontSmoothing};
|
|
48
|
+
display: inline !important;
|
|
49
|
+
white-space: nowrap !important;
|
|
50
|
+
color: ${neutral[300]} !important;
|
|
51
|
+
}
|
|
52
|
+
` })] }));
|
|
61
53
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BadgeProps } from '../Info/Badge';
|
|
2
|
+
import { formats } from '../../constants/data';
|
|
3
|
+
interface StatsBadgeProps extends BadgeProps {
|
|
4
|
+
value: number;
|
|
5
|
+
format?: keyof typeof formats;
|
|
6
|
+
isDelta?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const StatsBadge: ({ value, format, isDelta, ...props }: StatsBadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { StatsBadge };
|
|
10
|
+
//# sourceMappingURL=StatsBadge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatsBadge.d.ts","sourceRoot":"","sources":["../../../src/components/Data/StatsBadge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,UAAU,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,UAAU,eAAgB,SAAQ,UAAU;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,OAAO,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,UAAU,GAAI,sCAA0D,eAAe,4CA2B5F,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from '../Info/Badge';
|
|
3
|
+
import { formats } from '../../constants/data';
|
|
4
|
+
const StatsBadge = ({ value, format = 'decimal', isDelta = false, ...props }) => {
|
|
5
|
+
const delta = isDelta ? (value > 0 ? 'positive' : value < 0 ? 'negative' : 'equal') : null;
|
|
6
|
+
const color = delta ? (delta === 'positive' ? 'success' : delta === 'negative' ? 'error' : 'neutral') : 'success';
|
|
7
|
+
const formatValue = () => {
|
|
8
|
+
const config = formats[format];
|
|
9
|
+
const formattedNumber = value.toLocaleString('en-US', {
|
|
10
|
+
minimumFractionDigits: config.decimalPlaces,
|
|
11
|
+
maximumFractionDigits: config.decimalPlaces,
|
|
12
|
+
});
|
|
13
|
+
let result = formattedNumber;
|
|
14
|
+
if (delta === 'positive') {
|
|
15
|
+
result = `+${result}`;
|
|
16
|
+
}
|
|
17
|
+
else if (delta === 'negative') {
|
|
18
|
+
result = `-${result}`;
|
|
19
|
+
}
|
|
20
|
+
result = `${config.prefix}${result}${config.suffix}`;
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
return (_jsx(Badge, { color: color, ...props, children: formatValue() }));
|
|
24
|
+
};
|
|
25
|
+
export { StatsBadge };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CardProps } from '../Layout/Card';
|
|
3
|
-
import {
|
|
3
|
+
import { primitives } from '../../constants/colors';
|
|
4
4
|
import { dataFormats } from './shared/dataFormats';
|
|
5
5
|
export interface StatsCardProps extends Omit<CardProps, 'children'> {
|
|
6
6
|
value: number;
|
|
@@ -9,7 +9,7 @@ export interface StatsCardProps extends Omit<CardProps, 'children'> {
|
|
|
9
9
|
format?: keyof typeof dataFormats;
|
|
10
10
|
isDelta?: boolean;
|
|
11
11
|
icon?: React.ReactNode;
|
|
12
|
-
iconColor?: keyof typeof
|
|
12
|
+
iconColor?: keyof typeof primitives;
|
|
13
13
|
tooltip?: React.ReactNode;
|
|
14
14
|
increaseDescription?: string;
|
|
15
15
|
}
|
|
@@ -1 +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,
|
|
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,UAAU,EAAoB,MAAM,wBAAwB,CAAC;AACtE,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,UAAU,CAAC;IACpC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,eAAO,MAAM,SAAS,GAAI,mHAAgJ,cAAc,4CA4DvL,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { Text } from '../Typography/Text';
|
|
|
5
5
|
import { Title } from '../Typography/Title';
|
|
6
6
|
import { Group } from '../Layout/Group';
|
|
7
7
|
import { Stack } from '../Layout/Stack';
|
|
8
|
-
import {
|
|
8
|
+
import { success, neutral } from '../../constants/colors';
|
|
9
9
|
import { dataFormats } from './shared/dataFormats';
|
|
10
10
|
import { IconBadge } from '../Misc/IconBadge';
|
|
11
11
|
export const StatsCard = ({ value, format = 'decimal', isDelta = false, title, description, increaseDescription, icon: Icon, iconColor = 'blue', tooltip, ...cardProps }) => {
|
|
@@ -13,7 +13,7 @@ export const StatsCard = ({ value, format = 'decimal', isDelta = false, title, d
|
|
|
13
13
|
const currentDirection = isDelta ? (value > 0 ? 'positive' : value < 0 ? 'negative' : null) : null;
|
|
14
14
|
return {
|
|
15
15
|
direction: currentDirection,
|
|
16
|
-
color: currentDirection === 'positive' ?
|
|
16
|
+
color: currentDirection === 'positive' ? success[200] : currentDirection === 'negative' ? neutral[200] : undefined,
|
|
17
17
|
showIncrementalText: currentDirection === 'positive',
|
|
18
18
|
};
|
|
19
19
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { formats, truncation } from '../../../constants/data';
|
|
2
|
+
interface FormatOptions {
|
|
3
|
+
truncateAt?: keyof typeof truncation;
|
|
4
|
+
decimalPlaces?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const getChartFormatter: (format: keyof typeof formats, options?: FormatOptions) => ((value: string | number) => string);
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=chartFormats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartFormats.d.ts","sourceRoot":"","sources":["../../../../src/components/Data/shared/chartFormats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAiB,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE7E,UAAU,aAAa;IACrB,UAAU,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAeD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,OAAO,OAAO,EAAE,UAAU,aAAa,KAAG,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAa5H,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { numberFormats, truncation } from '../../../constants/data';
|
|
2
|
+
const formatAndTruncate = (value, format, options) => {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const absValue = Math.abs(value);
|
|
5
|
+
const config = numberFormats[format];
|
|
6
|
+
const truncateConfig = truncation[(_a = options === null || options === void 0 ? void 0 : options.truncateAt) !== null && _a !== void 0 ? _a : 'thousand'];
|
|
7
|
+
const computedDecimalPlaces = (_b = options === null || options === void 0 ? void 0 : options.decimalPlaces) !== null && _b !== void 0 ? _b : config.decimalPlaces;
|
|
8
|
+
if (absValue >= truncateConfig.threshold) {
|
|
9
|
+
return `${config.prefix}${(value / truncateConfig.threshold).toFixed(1)}${truncateConfig.suffix}${config.suffix}`;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return `${config.prefix}${value.toFixed(computedDecimalPlaces)}${config.suffix}`;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export const getChartFormatter = (format, options) => {
|
|
16
|
+
if (format === 'string') {
|
|
17
|
+
return (value) => String(value);
|
|
18
|
+
}
|
|
19
|
+
else if (format in numberFormats) {
|
|
20
|
+
return (value) => {
|
|
21
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
22
|
+
if (isNaN(numValue)) {
|
|
23
|
+
return String(value);
|
|
24
|
+
}
|
|
25
|
+
return formatAndTruncate(numValue, format, options);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
throw new Error(`Invalid format: ${format}`);
|
|
29
|
+
};
|
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
1
|
+
export declare const getChartFormat: {
|
|
2
|
+
string: (value: string) => string;
|
|
3
|
+
integer: (value: number) => string;
|
|
4
|
+
decimal: (value: number) => string;
|
|
5
|
+
currency: (value: number) => string;
|
|
6
|
+
percentage: (value: number) => string;
|
|
7
|
+
multiple: (value: number) => string;
|
|
34
8
|
};
|
|
35
9
|
//# sourceMappingURL=dataFormats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataFormats.d.ts","sourceRoot":"","sources":["../../../../src/components/Data/shared/dataFormats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dataFormats.d.ts","sourceRoot":"","sources":["../../../../src/components/Data/shared/dataFormats.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,cAAc;oBACT,MAAM,KAAG,MAAM;qBACd,MAAM,KAAG,MAAM;qBACf,MAAM,KAAG,MAAM;sBACd,MAAM,KAAG,MAAM;wBACb,MAAM,KAAG,MAAM;sBACjB,MAAM,KAAG,MAAM;CAClC,CAAC"}
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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) => {
|
|
1
|
+
import { formats, truncation } from '../../../constants/data';
|
|
2
|
+
const formatAndTruncate = (value, format, threshold = 'million') => {
|
|
10
3
|
const absValue = Math.abs(value);
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
const config = formats[format];
|
|
5
|
+
const truncateConfig = truncation[threshold];
|
|
6
|
+
if (absValue >= truncateConfig.threshold) {
|
|
7
|
+
return `${config.prefix}${(value / truncateConfig.threshold).toFixed(1)}${truncateConfig.suffix}${config.suffix}`;
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
return `${prefix}${
|
|
9
|
+
else {
|
|
10
|
+
return `${config.prefix}${value.toFixed(config.decimalPlaces)}${config.suffix}`;
|
|
16
11
|
}
|
|
17
|
-
return `${prefix}${value.toFixed(decimalPlaces)}${suffix}`;
|
|
18
12
|
};
|
|
19
|
-
export const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
export const getChartFormat = {
|
|
14
|
+
string: (value) => value,
|
|
15
|
+
integer: (value) => formatAndTruncate(value, 'integer', 'thousand'),
|
|
16
|
+
decimal: (value) => formatAndTruncate(value, 'decimal', 'thousand'),
|
|
17
|
+
currency: (value) => formatAndTruncate(value, 'currency', 'thousand'),
|
|
18
|
+
percentage: (value) => formatAndTruncate(value, 'percentage', 'thousand'),
|
|
19
|
+
multiple: (value) => formatAndTruncate(value, 'multiple', 'thousand'),
|
|
25
20
|
};
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
import { BadgeProps as MantineBadgeProps } from '@mantine/core';
|
|
2
|
+
import { colors } from '../../constants/colors';
|
|
3
|
+
interface BadgeProps extends Omit<MantineBadgeProps, 'color'> {
|
|
4
|
+
size?: 'sm' | 'md' | 'lg';
|
|
5
|
+
color?: keyof typeof colors;
|
|
6
|
+
variant?: 'outline' | 'filled' | 'gradient';
|
|
7
|
+
}
|
|
8
|
+
declare const Badge: ({ styles, color, variant, size, ...props }: BadgeProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Badge };
|
|
10
|
+
export type { BadgeProps };
|
|
1
11
|
//# sourceMappingURL=Badge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Info/Badge.tsx"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Info/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,UAAU,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvF,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,UAAU,UAAW,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC3D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC7C;AAED,QAAA,MAAM,KAAK,GAAI,4CAA2E,UAAU,4CA8DnG,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1 +1,64 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Badge as MantineBadge } from '@mantine/core';
|
|
3
|
+
import { fontBase, inputFontSize } from '../../constants/font';
|
|
4
|
+
import { colors } from '../../constants/colors';
|
|
5
|
+
const Badge = ({ styles, color = 'primary', variant = 'outline', size = 'md', ...props }) => {
|
|
6
|
+
const sizes = {
|
|
7
|
+
sm: {
|
|
8
|
+
mantineSize: 'md',
|
|
9
|
+
padding: '0.4rem 0.8rem',
|
|
10
|
+
height: '1.5rem',
|
|
11
|
+
fontSize: inputFontSize['sm'],
|
|
12
|
+
},
|
|
13
|
+
md: {
|
|
14
|
+
mantineSize: 'lg',
|
|
15
|
+
padding: '0.4rem 0.8rem',
|
|
16
|
+
height: '2.5rem',
|
|
17
|
+
fontSize: inputFontSize['md'],
|
|
18
|
+
},
|
|
19
|
+
lg: {
|
|
20
|
+
mantineSize: 'xl',
|
|
21
|
+
padding: '0.4rem 0.8rem',
|
|
22
|
+
height: '3rem',
|
|
23
|
+
fontSize: inputFontSize['lg'],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const variants = {
|
|
27
|
+
outline: {
|
|
28
|
+
border: `1.5px solid ${colors[color][200]}`,
|
|
29
|
+
color: colors[color][200],
|
|
30
|
+
backgroundColor: 'transparent',
|
|
31
|
+
borderRadius: '8px',
|
|
32
|
+
padding: '0.4rem 0.8rem',
|
|
33
|
+
},
|
|
34
|
+
filled: {
|
|
35
|
+
backgroundColor: colors[color][50],
|
|
36
|
+
color: colors[color][200],
|
|
37
|
+
},
|
|
38
|
+
gradient: {
|
|
39
|
+
background: `linear-gradient(to right, ${colors[color][50]}, ${colors[color][200]})`,
|
|
40
|
+
color: 'white',
|
|
41
|
+
borderRadius: '16px',
|
|
42
|
+
padding: '0.4rem 0.8rem',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const selectedSize = sizes[size];
|
|
46
|
+
const selectedVariant = variants[variant];
|
|
47
|
+
const style = {
|
|
48
|
+
root: {
|
|
49
|
+
padding: selectedSize.padding,
|
|
50
|
+
height: selectedSize.height,
|
|
51
|
+
cursor: 'default',
|
|
52
|
+
...selectedVariant,
|
|
53
|
+
},
|
|
54
|
+
inner: {
|
|
55
|
+
...fontBase,
|
|
56
|
+
...selectedSize.fontSize,
|
|
57
|
+
textTransform: 'none',
|
|
58
|
+
cursor: 'default',
|
|
59
|
+
},
|
|
60
|
+
...styles,
|
|
61
|
+
};
|
|
62
|
+
return _jsx(MantineBadge, { size: selectedSize.mantineSize, styles: style, ...props });
|
|
63
|
+
};
|
|
64
|
+
export { Badge };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface FormulaTooltipProps {
|
|
2
|
+
title: string;
|
|
3
|
+
description: string;
|
|
4
|
+
expression: string;
|
|
5
|
+
}
|
|
6
|
+
declare const FormulaTooltip: ({ title, description, expression }: FormulaTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { FormulaTooltip };
|
|
8
|
+
//# sourceMappingURL=FormulaTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormulaTooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Tooltips/FormulaTooltip.tsx"],"names":[],"mappings":"AAQA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,cAAc,GAAI,oCAAoC,mBAAmB,4CAgB9E,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../../Layout/Box';
|
|
3
|
+
import { Text } from '../../Typography/Text';
|
|
4
|
+
import { Formula } from '../../Typography/Formula';
|
|
5
|
+
import { Stack } from '../../Layout/Stack';
|
|
6
|
+
import { blue } from '../../../constants/colors';
|
|
7
|
+
import { Center } from '../../Layout/Center';
|
|
8
|
+
const FormulaTooltip = ({ title, description, expression }) => {
|
|
9
|
+
return (_jsx(Box, { p: "0.8rem", children: _jsxs(Stack, { gap: "1.6rem", children: [_jsxs(Stack, { gap: "0.8rem", sx: { maxWidth: '375px' }, children: [_jsx(Text, { weight: "semibold", children: title }), _jsx(Text, { variant: "label", children: description })] }), _jsx("div", { style: { padding: '1.6rem 2.4rem', borderRadius: '16px', backgroundColor: blue[25], width: '100%' }, children: _jsx(Center, { children: _jsx(Formula, { expression: expression, color: blue[300] }) }) })] }) }));
|
|
10
|
+
};
|
|
11
|
+
export { FormulaTooltip };
|
|
@@ -8,6 +8,7 @@ interface InfoTooltipProps {
|
|
|
8
8
|
offset?: number;
|
|
9
9
|
className?: string;
|
|
10
10
|
styles?: Record<string, CSSObject>;
|
|
11
|
+
maxWidth?: string;
|
|
11
12
|
}
|
|
12
13
|
declare const componentSizes: {
|
|
13
14
|
readonly sm: "1.2rem";
|
|
@@ -15,6 +16,6 @@ declare const componentSizes: {
|
|
|
15
16
|
readonly lg: "2rem";
|
|
16
17
|
readonly xl: "2.4rem";
|
|
17
18
|
};
|
|
18
|
-
declare const InfoTooltip: ({ text, content, position, size, offset, className, styles }: InfoTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare const InfoTooltip: ({ text, content, position, size, offset, className, styles, maxWidth }: InfoTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export { InfoTooltip };
|
|
20
21
|
//# sourceMappingURL=InfoTooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,cAAc;;;;;CAKV,CAAC;AAEX,QAAA,MAAM,WAAW,GAAI,wEAA6F,gBAAgB,4CAcjI,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, content, position = 'top-start', size = 'md', offset, className, styles }) => {
|
|
10
|
+
const InfoTooltip = ({ text, content, position = 'top-start', size = 'md', offset, className, styles, maxWidth }) => {
|
|
11
11
|
const style = {
|
|
12
12
|
icon: {
|
|
13
13
|
color: neutral[100],
|
|
@@ -15,6 +15,6 @@ const InfoTooltip = ({ text, content, position = 'top-start', size = 'md', offse
|
|
|
15
15
|
},
|
|
16
16
|
...styles,
|
|
17
17
|
};
|
|
18
|
-
return (_jsx(Tooltip, { text: text || content, 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, maxWidth: maxWidth, children: _jsx("i", { className: "fas fa-info-circle", style: style.icon }) }));
|
|
19
19
|
};
|
|
20
20
|
export { InfoTooltip };
|
|
@@ -7,7 +7,8 @@ interface TooltipProps {
|
|
|
7
7
|
offset?: number;
|
|
8
8
|
className?: string;
|
|
9
9
|
styles?: Record<string, CSSObject>;
|
|
10
|
+
maxWidth?: string;
|
|
10
11
|
}
|
|
11
|
-
declare const Tooltip: ({ children, text, position, offset, className, styles }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const Tooltip: ({ children, text, position, offset, className, styles, maxWidth }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export { Tooltip };
|
|
13
14
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -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,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;
|
|
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;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,OAAO,GAAI,mEAAiF,YAAY,4CAgD7G,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Tooltip as MantineTooltip, Box } from '@mantine/core';
|
|
3
3
|
import { neutral } from '../../../constants/colors';
|
|
4
4
|
import { fontBase, fontSize, fontWeight } from '../../../constants/font';
|
|
5
|
-
const Tooltip = ({ children, text, position = 'top-start', offset, className, styles }) => {
|
|
5
|
+
const Tooltip = ({ children, text, position = 'top-start', offset, className, styles, maxWidth }) => {
|
|
6
6
|
const positionToTransition = {
|
|
7
7
|
'top-end': 'slide-up',
|
|
8
8
|
'bottom-end': 'slide-down',
|
|
@@ -23,7 +23,7 @@ const Tooltip = ({ children, text, position = 'top-start', offset, className, st
|
|
|
23
23
|
boxShadow: '0px 0px 19px 0px #00000040',
|
|
24
24
|
borderRadius: '8px',
|
|
25
25
|
textWrap: 'wrap',
|
|
26
|
-
maxWidth: '375px',
|
|
26
|
+
maxWidth: maxWidth || '375px',
|
|
27
27
|
padding: '0.75rem 1.125rem',
|
|
28
28
|
...fontSize['sm'],
|
|
29
29
|
height: 'fit-content',
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RadioProps as MantineRadioProps } from '@mantine/core';
|
|
2
|
+
import { CSSObject } from '@mantine/styles';
|
|
3
|
+
interface RadioProps extends MantineRadioProps {
|
|
4
|
+
styles?: Record<string, CSSObject>;
|
|
5
|
+
}
|
|
6
|
+
declare const Radio: ({ styles, ...props }: RadioProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export { Radio };
|
|
8
|
+
//# sourceMappingURL=Radio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Controls/Radio.tsx"],"names":[],"mappings":"AACA,OAAO,EAAyB,UAAU,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,UAAU,UAAW,SAAQ,iBAAiB;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC;AAED,QAAA,MAAM,KAAK,GAAI,sBAAsB,UAAU,4CAsC9C,CAAC;AAEF,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Radio as MantineRadio } from '@mantine/core';
|
|
3
|
+
import { primary, neutral } from '../../../constants/colors';
|
|
4
|
+
import { fontBase, inputFontSize } from '../../../constants/font';
|
|
5
|
+
const Radio = ({ styles, ...props }) => {
|
|
6
|
+
const style = {
|
|
7
|
+
root: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
},
|
|
11
|
+
radio: {
|
|
12
|
+
cursor: props.disabled || props.checked ? 'default' : 'pointer',
|
|
13
|
+
margin: 0,
|
|
14
|
+
marginTop: 0,
|
|
15
|
+
lineHeight: 'normal',
|
|
16
|
+
'&[type="radio"]': {
|
|
17
|
+
margin: 0,
|
|
18
|
+
marginTop: 0,
|
|
19
|
+
lineHeight: 'normal',
|
|
20
|
+
},
|
|
21
|
+
'&:checked': {
|
|
22
|
+
backgroundColor: primary[200],
|
|
23
|
+
borderColor: primary[200],
|
|
24
|
+
},
|
|
25
|
+
'&:hover': {
|
|
26
|
+
backgroundColor: props.checked ? primary[200] : neutral[50],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
icon: {
|
|
30
|
+
color: 'white',
|
|
31
|
+
},
|
|
32
|
+
label: {
|
|
33
|
+
cursor: props.disabled ? 'default' : 'pointer',
|
|
34
|
+
...fontBase,
|
|
35
|
+
fontSize: inputFontSize['md'].fontSize,
|
|
36
|
+
lineHeight: '2.25rem',
|
|
37
|
+
color: neutral[200],
|
|
38
|
+
},
|
|
39
|
+
...styles,
|
|
40
|
+
};
|
|
41
|
+
return _jsx(MantineRadio, { size: "lg", styles: style, ...props });
|
|
42
|
+
};
|
|
43
|
+
export { Radio };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface RadioListOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
rightContent?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
interface RadioListProps {
|
|
8
|
+
data: RadioListOption[];
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
width?: React.CSSProperties['width'];
|
|
13
|
+
}
|
|
14
|
+
declare const RadioList: ({ data, value, onChange, disabled, width }: RadioListProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { RadioList };
|
|
16
|
+
//# sourceMappingURL=RadioList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioList.d.ts","sourceRoot":"","sources":["../../../../src/components/Inputs/Controls/RadioList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;CACtC;AAED,QAAA,MAAM,SAAS,GAAI,4CAAoD,cAAc,4CAkCpF,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|