@taiv/ui 1.10.10 → 1.11.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/dist/components/Data/PieChart/PieChart.js +2 -2
- package/dist/components/Data/PieChart/PieChart.stories.d.ts +14 -0
- package/dist/components/Data/PieChart/PieChart.stories.d.ts.map +1 -0
- package/dist/components/Data/PieChart/PieChart.stories.js +121 -0
- package/dist/components/Data/Progress/Progress.d.ts +10 -0
- package/dist/components/Data/Progress/Progress.d.ts.map +1 -0
- package/dist/components/Data/Progress/Progress.js +8 -0
- package/dist/components/Data/Progress/Progress.stories.d.ts +15 -0
- package/dist/components/Data/Progress/Progress.stories.d.ts.map +1 -0
- package/dist/components/Data/Progress/Progress.stories.js +146 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/types/types.d.ts +6 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import { Box } from '../../Layout/Box/Box';
|
|
|
9
9
|
import { neutral } from '../../../constants/colors';
|
|
10
10
|
import { textStyle } from '../../../constants/font';
|
|
11
11
|
import { getChartFormatter } from '../../../utils/charts';
|
|
12
|
-
export const PieChart = ({ data, showLegend = true, innerRadius = 80, outerRadius = 100, paddingAngle =
|
|
12
|
+
export const PieChart = ({ data, showLegend = true, innerRadius = 80, outerRadius = 100, paddingAngle = 0, format = 'percentage', loading = false, centerContent, height = '100%', }) => {
|
|
13
13
|
const hasData = data && data.length > 0;
|
|
14
14
|
const transformedData = data.map((item) => ({
|
|
15
15
|
...item,
|
|
@@ -37,7 +37,7 @@ export const PieChart = ({ data, showLegend = true, innerRadius = 80, outerRadiu
|
|
|
37
37
|
}
|
|
38
38
|
return null;
|
|
39
39
|
};
|
|
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: `
|
|
40
|
+
return (_jsxs(_Fragment, { children: [loading || !hasData ? (_jsx(Center, { style: { height, 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
41
|
.recharts-legend-item-text {
|
|
42
42
|
font-family: ${textStyle.label.fontFamily};
|
|
43
43
|
font-size: ${textStyle.label.fontSize};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import type { PieChartProps } from "./PieChart";
|
|
3
|
+
declare const meta: Meta<PieChartProps>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<PieChartProps>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Formats: Story;
|
|
8
|
+
export declare const WithCenterContent: Story;
|
|
9
|
+
export declare const DonutGeometry: Story;
|
|
10
|
+
export declare const PaddingAngle: Story;
|
|
11
|
+
export declare const WithoutLegend: Story;
|
|
12
|
+
export declare const Loading: Story;
|
|
13
|
+
export declare const Empty: Story;
|
|
14
|
+
//# sourceMappingURL=PieChart.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PieChart.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Data/PieChart/PieChart.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAShD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,aAAa,CAmE7B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;AAErC,eAAO,MAAM,OAAO,EAAE,KAarB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAqBrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAe/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KA6B3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAoC1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAW3B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAMnB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { numberFormats } from "../../../constants/data";
|
|
3
|
+
import { primary, success, warning } from "../../../constants/colors";
|
|
4
|
+
import { Box } from "../../Layout/Box/Box";
|
|
5
|
+
import { Group } from "../../Layout/Group/Group";
|
|
6
|
+
import { PieChart } from "./PieChart";
|
|
7
|
+
const samplePieData = [
|
|
8
|
+
{ key: "Product A", value: 45, color: primary[200] },
|
|
9
|
+
{ key: "Product B", value: 30, color: success[200] },
|
|
10
|
+
{ key: "Product C", value: 25, color: warning[200] },
|
|
11
|
+
];
|
|
12
|
+
const meta = {
|
|
13
|
+
title: "Components/Data/PieChart",
|
|
14
|
+
component: PieChart,
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: "padded",
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: "A pie / donut chart built on Recharts. Slice values are formatted with `getChartFormatter` via the `format` prop (key of `numberFormats`). Optional `centerContent` renders a label in the donut hole. `paddingAngle` defaults to `0` (no gap between slices); increase it for separation. Use a parent with a definite height when `height` is `'100%'` (see stories).",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
data: {
|
|
25
|
+
control: { type: "object" },
|
|
26
|
+
description: "PieDataPoint[] — key, value, optional color per slice",
|
|
27
|
+
table: { type: { summary: "PieDataPoint[]" } },
|
|
28
|
+
},
|
|
29
|
+
format: {
|
|
30
|
+
control: { type: "select" },
|
|
31
|
+
options: Object.keys(numberFormats),
|
|
32
|
+
description: "Format key for tooltip and optional center value",
|
|
33
|
+
table: {
|
|
34
|
+
type: { summary: "keyof typeof numberFormats" },
|
|
35
|
+
defaultValue: { summary: "'percentage'" },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
height: {
|
|
39
|
+
control: { type: "text" },
|
|
40
|
+
description: "Chart height (CSS length or number); loading and empty states match this height",
|
|
41
|
+
table: {
|
|
42
|
+
type: { summary: "string | number" },
|
|
43
|
+
defaultValue: { summary: "'100%'" },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
showLegend: {
|
|
47
|
+
control: { type: "boolean" },
|
|
48
|
+
description: "Show Recharts legend below the chart",
|
|
49
|
+
table: { defaultValue: { summary: "true" } },
|
|
50
|
+
},
|
|
51
|
+
loading: {
|
|
52
|
+
control: { type: "boolean" },
|
|
53
|
+
description: "Placeholder state while data is loading",
|
|
54
|
+
table: { defaultValue: { summary: "false" } },
|
|
55
|
+
},
|
|
56
|
+
innerRadius: {
|
|
57
|
+
control: { type: "number" },
|
|
58
|
+
description: "Inner radius in px (larger = more donut, 0 = pie)",
|
|
59
|
+
table: { defaultValue: { summary: "80" } },
|
|
60
|
+
},
|
|
61
|
+
outerRadius: {
|
|
62
|
+
control: { type: "number" },
|
|
63
|
+
description: "Outer radius in px",
|
|
64
|
+
table: { defaultValue: { summary: "100" } },
|
|
65
|
+
},
|
|
66
|
+
paddingAngle: {
|
|
67
|
+
control: { type: "number" },
|
|
68
|
+
description: "Angular gap between slices in degrees (Recharts `Pie` `paddingAngle`). Default **0** — slices touch; increase for visible separation.",
|
|
69
|
+
table: { defaultValue: { summary: "0" } },
|
|
70
|
+
},
|
|
71
|
+
centerContent: {
|
|
72
|
+
control: { type: "object" },
|
|
73
|
+
description: "Optional center: title, subtitle, value",
|
|
74
|
+
table: { type: { summary: "PieCardCenterContentProps" } },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
export default meta;
|
|
79
|
+
export const Default = {
|
|
80
|
+
args: {
|
|
81
|
+
data: samplePieData,
|
|
82
|
+
format: "percentage",
|
|
83
|
+
height: "100%",
|
|
84
|
+
showLegend: true,
|
|
85
|
+
loading: false,
|
|
86
|
+
},
|
|
87
|
+
render: (args) => (_jsx(Box, { w: "100%", maw: 480, h: 360, children: _jsx(PieChart, { ...args }) })),
|
|
88
|
+
};
|
|
89
|
+
export const Formats = {
|
|
90
|
+
render: () => (_jsx(Group, { align: "flex-start", gap: "1.6rem", styles: { root: { flexWrap: "wrap" } }, children: ["integer", "decimal", "currency", "percentage", "multiple"].map((fmt) => (_jsx(Box, { w: 400, h: 400, children: _jsx(PieChart, { data: samplePieData, format: fmt, height: "100%", showLegend: false }) }, fmt))) })),
|
|
91
|
+
};
|
|
92
|
+
export const WithCenterContent = {
|
|
93
|
+
render: () => (_jsx(Box, { w: "100%", maw: 480, h: 360, children: _jsx(PieChart, { data: samplePieData, format: "percentage", height: "100%", centerContent: {
|
|
94
|
+
value: 100,
|
|
95
|
+
title: "Share",
|
|
96
|
+
subtitle: "Q1 2026",
|
|
97
|
+
} }) })),
|
|
98
|
+
};
|
|
99
|
+
export const DonutGeometry = {
|
|
100
|
+
render: () => (_jsxs(Group, { align: "flex-start", gap: "1.6rem", styles: { root: { flexWrap: "wrap" } }, children: [_jsx(Box, { w: 400, h: 400, children: _jsx(PieChart, { data: samplePieData, format: "percentage", height: "100%", innerRadius: 0, outerRadius: 100, showLegend: false }) }), _jsx(Box, { w: 400, h: 400, children: _jsx(PieChart, { data: samplePieData, format: "percentage", height: "100%", innerRadius: 80, outerRadius: 100, showLegend: false }) })] })),
|
|
101
|
+
};
|
|
102
|
+
export const PaddingAngle = {
|
|
103
|
+
name: "Slice gaps (paddingAngle)",
|
|
104
|
+
parameters: {
|
|
105
|
+
docs: {
|
|
106
|
+
description: {
|
|
107
|
+
story: "The component defaults **`paddingAngle` to `0`**, so slices meet with no gap. Pass a positive value (degrees) when you want separation between segments—the background shows through in those gaps.",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
render: () => (_jsxs(Group, { align: "flex-start", gap: "1.6rem", styles: { root: { flexWrap: "wrap" } }, children: [_jsx(Box, { w: 400, h: 400, children: _jsx(PieChart, { data: samplePieData, format: "percentage", height: "100%", paddingAngle: 0, showLegend: false }) }), _jsx(Box, { w: 400, h: 400, children: _jsx(PieChart, { data: samplePieData, format: "percentage", height: "100%", paddingAngle: 8, showLegend: false }) })] })),
|
|
112
|
+
};
|
|
113
|
+
export const WithoutLegend = {
|
|
114
|
+
render: () => (_jsx(Box, { w: "100%", h: 320, children: _jsx(PieChart, { data: samplePieData, format: "percentage", height: "100%", showLegend: false }) })),
|
|
115
|
+
};
|
|
116
|
+
export const Loading = {
|
|
117
|
+
render: () => (_jsx(Box, { w: "100%", h: 300, children: _jsx(PieChart, { data: samplePieData, format: "percentage", height: "100%", loading: true }) })),
|
|
118
|
+
};
|
|
119
|
+
export const Empty = {
|
|
120
|
+
render: () => (_jsx(Box, { w: "100%", h: 300, children: _jsx(PieChart, { data: [], format: "percentage", height: "100%" }) })),
|
|
121
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ProgressProps as MantineProgressProps } from '@mantine/core';
|
|
2
|
+
import type { ProgressDataPoint } from '../../../types';
|
|
3
|
+
export interface ProgressProps extends Omit<MantineProgressProps, 'animate' | 'style' | 'size' | 'radius' | 'sections'> {
|
|
4
|
+
width?: string | number;
|
|
5
|
+
scale?: string;
|
|
6
|
+
cornerRadius?: string;
|
|
7
|
+
data?: ProgressDataPoint[];
|
|
8
|
+
}
|
|
9
|
+
export declare const Progress: ({ width, color, data, scale, cornerRadius, ...props }: ProgressProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.d.ts","sourceRoot":"","sources":["../../../../src/components/Data/Progress/Progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,IAAI,oBAAoB,EAC3C,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,WAAW,aACf,SAAQ,IAAI,CACV,oBAAoB,EACpB,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CACrD;IACD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,QAAQ,GAAI,uDAOtB,aAAa,4CAcf,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Progress as MantineProgress, } from '@mantine/core';
|
|
3
|
+
import { primary } from '../../../constants/colors';
|
|
4
|
+
export const Progress = ({ width, color, data, scale = 'md', cornerRadius = 'md', ...props }) => {
|
|
5
|
+
const hasData = Array.isArray(data) && data.length > 0;
|
|
6
|
+
const resolvedColor = !hasData && color === undefined ? primary[200] : color;
|
|
7
|
+
return (_jsx(MantineProgress, { ...props, radius: cornerRadius, size: scale, sections: data, color: resolvedColor, style: width ? { width } : undefined }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Progress } from './Progress';
|
|
3
|
+
declare const meta: Meta<typeof Progress>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Values: Story;
|
|
8
|
+
export declare const Scale: Story;
|
|
9
|
+
export declare const CornerRadius: Story;
|
|
10
|
+
export declare const Striped: Story;
|
|
11
|
+
export declare const WithLabel: Story;
|
|
12
|
+
export declare const Data: Story;
|
|
13
|
+
export declare const WithTooltips: Story;
|
|
14
|
+
export declare const Width: Story;
|
|
15
|
+
//# sourceMappingURL=Progress.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Progress.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/Data/Progress/Progress.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CA6E/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KASpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAQ1B,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAMrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,KAYlB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KA2B1B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAOnB,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { primary, purple, success } from '../../../constants/colors';
|
|
3
|
+
import { Stack } from '../../Layout/Stack/Stack';
|
|
4
|
+
import { Progress } from './Progress';
|
|
5
|
+
const presetOptions = ['xs', 'sm', 'md', 'lg', 'xl'];
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/Data/Progress',
|
|
8
|
+
component: Progress,
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (_jsx("div", { style: { width: '25rem' }, children: _jsx(Story, {}) })),
|
|
11
|
+
],
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'centered',
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component: 'Horizontal progress bar. **`data`** (`ProgressDataPoint[]`) for multi-part segments; **`value`** / **`color`** for a single fill. Root width: **`width`** (**rem** or **`%`**). Bar thickness and corners: **`scale`** and **`cornerRadius`** (`xs`–`xl` preset strings). **`styles`** for Mantine styling hooks when needed.',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
scale: {
|
|
22
|
+
control: { type: 'select' },
|
|
23
|
+
options: [...presetOptions],
|
|
24
|
+
description: 'Bar height on the xs–xl scale',
|
|
25
|
+
table: {
|
|
26
|
+
type: { summary: 'string' },
|
|
27
|
+
defaultValue: { summary: "'md'" },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
cornerRadius: {
|
|
31
|
+
control: { type: 'select' },
|
|
32
|
+
options: [...presetOptions],
|
|
33
|
+
description: 'Corner rounding on the xs–xl scale',
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: 'string' },
|
|
36
|
+
defaultValue: { summary: undefined },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
value: {
|
|
40
|
+
control: { type: 'range', min: 0, max: 100, step: 1 },
|
|
41
|
+
description: 'Filled percent (single-bar mode; use `data` for multiple segments)',
|
|
42
|
+
table: { type: { summary: 'number' }, defaultValue: { summary: '0' } },
|
|
43
|
+
},
|
|
44
|
+
color: {
|
|
45
|
+
control: { type: 'text' },
|
|
46
|
+
description: 'Theme color of the bar (single-bar mode)',
|
|
47
|
+
table: {
|
|
48
|
+
type: { summary: 'string' },
|
|
49
|
+
defaultValue: { summary: 'primary[200]' },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
width: {
|
|
53
|
+
control: { type: 'text' },
|
|
54
|
+
description: 'Root width (e.g. rem string or percentage)',
|
|
55
|
+
table: {
|
|
56
|
+
type: { summary: 'string | number' },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
data: {
|
|
60
|
+
control: { type: 'object' },
|
|
61
|
+
description: 'Multi-segment bar data',
|
|
62
|
+
table: { type: { summary: 'ProgressDataPoint[]' } },
|
|
63
|
+
},
|
|
64
|
+
striped: {
|
|
65
|
+
control: { type: 'boolean' },
|
|
66
|
+
table: {
|
|
67
|
+
type: { summary: 'boolean' },
|
|
68
|
+
defaultValue: { summary: 'false' },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
label: {
|
|
72
|
+
control: { type: 'text' },
|
|
73
|
+
description: 'Label inside the bar (single-bar mode)',
|
|
74
|
+
table: { type: { summary: 'string' } },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
export default meta;
|
|
79
|
+
export const Default = {
|
|
80
|
+
args: {
|
|
81
|
+
value: 50,
|
|
82
|
+
scale: 'md',
|
|
83
|
+
cornerRadius: 'md',
|
|
84
|
+
width: undefined,
|
|
85
|
+
striped: false,
|
|
86
|
+
data: undefined,
|
|
87
|
+
label: undefined,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
export const Values = {
|
|
91
|
+
render: () => (_jsxs(Stack, { spacing: "md", children: [_jsx(Progress, { value: 0, scale: "xl", cornerRadius: "xl" }), _jsx(Progress, { value: 25, scale: "xl", cornerRadius: "xl" }), _jsx(Progress, { value: 50, scale: "xl", cornerRadius: "xl" }), _jsx(Progress, { value: 100, scale: "xl", cornerRadius: "xl" })] })),
|
|
92
|
+
};
|
|
93
|
+
export const Scale = {
|
|
94
|
+
render: () => (_jsx(Stack, { spacing: "md", children: presetOptions.map((preset) => (_jsx(Progress, { value: 60, scale: preset, cornerRadius: "md" }, preset))) })),
|
|
95
|
+
};
|
|
96
|
+
export const CornerRadius = {
|
|
97
|
+
render: () => (_jsx(Stack, { spacing: "md", children: presetOptions.map((radius) => (_jsx(Progress, { value: 60, scale: "xl", cornerRadius: radius }, radius))) })),
|
|
98
|
+
};
|
|
99
|
+
export const Striped = {
|
|
100
|
+
render: () => (_jsx(Stack, { spacing: "md", children: _jsx(Progress, { value: 55, scale: "xl", cornerRadius: "xl", striped: true }) })),
|
|
101
|
+
};
|
|
102
|
+
export const WithLabel = {
|
|
103
|
+
args: {
|
|
104
|
+
value: 70,
|
|
105
|
+
scale: 'xl',
|
|
106
|
+
cornerRadius: 'xl',
|
|
107
|
+
label: '70%',
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
export const Data = {
|
|
111
|
+
render: () => (_jsx(Progress, { scale: "xl", cornerRadius: "xl", data: [
|
|
112
|
+
{ value: 35, color: primary[200], label: '35%' },
|
|
113
|
+
{ value: 25, color: success[200], label: '25%' },
|
|
114
|
+
{ value: 30, color: purple[200], label: '30%' },
|
|
115
|
+
] })),
|
|
116
|
+
};
|
|
117
|
+
export const WithTooltips = {
|
|
118
|
+
render: () => (_jsx(Progress, { scale: "xl", cornerRadius: "xl", data: [
|
|
119
|
+
{
|
|
120
|
+
value: 40,
|
|
121
|
+
color: primary[200],
|
|
122
|
+
label: '40%',
|
|
123
|
+
tooltip: 'Completed tasks — 40%',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
value: 35,
|
|
127
|
+
color: success[200],
|
|
128
|
+
label: '35%',
|
|
129
|
+
tooltip: 'In progress — 35%',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
value: 25,
|
|
133
|
+
color: purple[200],
|
|
134
|
+
label: '25%',
|
|
135
|
+
tooltip: 'Remaining — 25%',
|
|
136
|
+
},
|
|
137
|
+
] })),
|
|
138
|
+
};
|
|
139
|
+
export const Width = {
|
|
140
|
+
args: {
|
|
141
|
+
value: 45,
|
|
142
|
+
scale: 'xl',
|
|
143
|
+
cornerRadius: 'xl',
|
|
144
|
+
width: '24rem',
|
|
145
|
+
},
|
|
146
|
+
};
|
|
@@ -6,6 +6,7 @@ export { PieChartCard } from './Data/Cards/PieChartCard/PieChartCard';
|
|
|
6
6
|
export { RemovableItemList } from './Data/RemovableItemList/RemovableItemList';
|
|
7
7
|
export { StatsCard } from './Data/Cards/StatsCard/StatsCard';
|
|
8
8
|
export { StatsBadge } from './Data/StatsBadge/StatsBadge';
|
|
9
|
+
export { Progress } from './Data/Progress/Progress';
|
|
9
10
|
export { Modal } from './Info/Modals/Modal/Modal';
|
|
10
11
|
export { FormModal } from './Info/Modals/FormModal/FormModal';
|
|
11
12
|
export { ModalProvider } from './Info/Modals/ModalProvider/ModalProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAm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B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { PieChartCard } from './Data/Cards/PieChartCard/PieChartCard';
|
|
|
7
7
|
export { RemovableItemList } from './Data/RemovableItemList/RemovableItemList';
|
|
8
8
|
export { StatsCard } from './Data/Cards/StatsCard/StatsCard';
|
|
9
9
|
export { StatsBadge } from './Data/StatsBadge/StatsBadge';
|
|
10
|
+
export { Progress } from './Data/Progress/Progress';
|
|
10
11
|
//Info
|
|
11
12
|
export { Modal } from './Info/Modals/Modal/Modal';
|
|
12
13
|
export { FormModal } from './Info/Modals/FormModal/FormModal';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -22,4 +22,10 @@ export type ChartFormatOptions = {
|
|
|
22
22
|
truncateAt?: keyof typeof truncation;
|
|
23
23
|
decimalPlaces?: number;
|
|
24
24
|
};
|
|
25
|
+
export type ProgressDataPoint = {
|
|
26
|
+
value: number;
|
|
27
|
+
color: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
tooltip?: string;
|
|
30
|
+
};
|
|
25
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,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