@gsk_poc/untitled-ui-base 0.1.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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -0
  3. package/components/application/app-navigation/base-components/featured-cards.demo.tsx +86 -0
  4. package/components/application/app-navigation/base-components/featured-cards.story.tsx +49 -0
  5. package/components/application/app-navigation/header-navigation.demo.tsx +59 -0
  6. package/components/application/app-navigation/header-navigation.story.tsx +23 -0
  7. package/components/application/app-navigation/sidebar-navigation.demo.tsx +409 -0
  8. package/components/application/app-navigation/sidebar-navigation.story.tsx +47 -0
  9. package/components/application/carousel/carousel.demo.tsx +107 -0
  10. package/components/application/carousel/carousel.story.tsx +21 -0
  11. package/components/application/charts/activity-gauges.demo.tsx +251 -0
  12. package/components/application/charts/activity-gauges.story.tsx +27 -0
  13. package/components/application/charts/bar-charts.demo.tsx +506 -0
  14. package/components/application/charts/bar-charts.story.tsx +36 -0
  15. package/components/application/charts/line-charts.demo.tsx +604 -0
  16. package/components/application/charts/line-charts.story.tsx +43 -0
  17. package/components/application/charts/pie-charts.demo.tsx +193 -0
  18. package/components/application/charts/pie-charts.story.tsx +30 -0
  19. package/components/application/charts/progress-circles.demo.tsx +110 -0
  20. package/components/application/charts/progress-circles.story.tsx +33 -0
  21. package/components/application/charts/radar-charts.demo.tsx +203 -0
  22. package/components/application/charts/radar-charts.story.tsx +18 -0
  23. package/components/application/date-picker/date-picker.demo.tsx +217 -0
  24. package/components/application/date-picker/date-picker.story.tsx +44 -0
  25. package/components/application/file-upload/file-upload.demo.tsx +292 -0
  26. package/components/application/file-upload/file-upload.story.tsx +70 -0
  27. package/components/application/loading-indicator/loading-indicator.demo.tsx +73 -0
  28. package/components/application/loading-indicator/loading-indicator.story.tsx +22 -0
  29. package/components/application/pagination/pagination.demo.tsx +104 -0
  30. package/components/application/pagination/pagination.story.tsx +54 -0
  31. package/components/application/table/table.demo.tsx +1038 -0
  32. package/components/application/table/table.story.tsx +119 -0
  33. package/components/application/tabs/tabs.demo.tsx +322 -0
  34. package/components/application/tabs/tabs.story.tsx +43 -0
  35. package/components/base/avatar/avatar.demo.tsx +865 -0
  36. package/components/base/avatar/avatar.story.tsx +27 -0
  37. package/components/base/badges/badge-groups.demo.tsx +357 -0
  38. package/components/base/badges/badge-groups.story.tsx +25 -0
  39. package/components/base/badges/badges.demo.tsx +497 -0
  40. package/components/base/badges/badges.story.tsx +83 -0
  41. package/components/base/button-group/button-group.demo.tsx +131 -0
  42. package/components/base/button-group/button-group.story.tsx +16 -0
  43. package/components/base/buttons/app-store-buttons.demo.tsx +129 -0
  44. package/components/base/buttons/app-store-buttons.story.tsx +13 -0
  45. package/components/base/buttons/buttons.demo.tsx +1022 -0
  46. package/components/base/buttons/buttons.story.tsx +42 -0
  47. package/components/base/buttons/social-buttons.demo.tsx +432 -0
  48. package/components/base/buttons/social-buttons.story.tsx +20 -0
  49. package/components/base/checkbox/checkbox.demo.tsx +62 -0
  50. package/components/base/checkbox/checkbox.story.tsx +18 -0
  51. package/components/base/dropdown/dropdown.demo.tsx +137 -0
  52. package/components/base/dropdown/dropdown.story.tsx +22 -0
  53. package/components/base/input/inputs.demo.tsx +758 -0
  54. package/components/base/input/inputs.story.tsx +52 -0
  55. package/components/base/pin-input/pin-input.demo.tsx +126 -0
  56. package/components/base/pin-input/pin-input.story.tsx +22 -0
  57. package/components/base/progress-indicators/progress-indicators.demo.tsx +54 -0
  58. package/components/base/progress-indicators/progress-indicators.story.tsx +57 -0
  59. package/components/base/radio-buttons/radio-buttons.demo.tsx +77 -0
  60. package/components/base/radio-buttons/radio-buttons.story.tsx +19 -0
  61. package/components/base/select/select.demo.tsx +936 -0
  62. package/components/base/select/select.story.tsx +43 -0
  63. package/components/base/slider/slider.demo.tsx +19 -0
  64. package/components/base/slider/slider.story.tsx +26 -0
  65. package/components/base/tags/tags.demo.tsx +341 -0
  66. package/components/base/tags/tags.story.tsx +28 -0
  67. package/components/base/textarea/textarea.demo.tsx +25 -0
  68. package/components/base/textarea/textarea.story.tsx +15 -0
  69. package/components/base/toggle/toggle.demo.tsx +76 -0
  70. package/components/base/toggle/toggle.story.tsx +23 -0
  71. package/components/base/tooltip/tooltip.demo.tsx +125 -0
  72. package/components/base/tooltip/tooltip.story.tsx +21 -0
  73. package/components/foundations/featured-icon/featured-icon.demo.tsx +160 -0
  74. package/components/foundations/featured-icon/featured-icon.story.tsx +25 -0
  75. package/components/shared-assets/credit-card/credit-card.demo.tsx +106 -0
  76. package/components/shared-assets/credit-card/credit-card.story.tsx +41 -0
  77. package/dist/index.d.mts +1417 -0
  78. package/dist/index.d.ts +1417 -0
  79. package/dist/index.js +10435 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/index.mjs +10345 -0
  82. package/dist/index.mjs.map +1 -0
  83. package/package.json +126 -0
  84. package/styles/globals.css +65 -0
  85. package/styles/theme.css +430 -0
  86. package/styles/tokens-mapped.css +233 -0
  87. package/styles/tokens.css +807 -0
  88. package/styles/typography.css +430 -0
  89. package/tokens/design-tokens.dtcg.json +3515 -0
@@ -0,0 +1,193 @@
1
+ "use client";
2
+
3
+ import { Legend, Pie, PieChart as RechartsPieChart, ResponsiveContainer, Tooltip } from "recharts";
4
+ import { ChartLegendContent, ChartTooltipContent } from "@/components/application/charts/charts-base";
5
+
6
+ const pieChartData = [
7
+ // collapse-start
8
+ {
9
+ name: "Series 1",
10
+ value: 200,
11
+ className: "text-utility-brand-600",
12
+ },
13
+ {
14
+ name: "Series 2",
15
+ value: 350,
16
+ className: "text-utility-brand-500",
17
+ },
18
+ {
19
+ name: "Series 3",
20
+ value: 100,
21
+ className: "text-utility-brand-400",
22
+ },
23
+ {
24
+ name: "Series 4",
25
+ value: 120,
26
+ className: "text-utility-brand-300",
27
+ },
28
+ {
29
+ name: "Series 5",
30
+ value: 230,
31
+ className: "text-utility-gray-200",
32
+ },
33
+ // collapse-end
34
+ ];
35
+
36
+ interface PieChartProps {
37
+ data?: { name: string; value: number; className?: string }[];
38
+ }
39
+
40
+ export const PieChartXxs = ({ data = pieChartData }: PieChartProps) => {
41
+ return (
42
+ <ResponsiveContainer height={120} className="max-w-52.5">
43
+ <RechartsPieChart
44
+ margin={{
45
+ left: 0,
46
+ right: 0,
47
+ top: 0,
48
+ bottom: 0,
49
+ }}
50
+ >
51
+ <Legend verticalAlign="top" align="right" layout="vertical" content={ChartLegendContent} />
52
+ <Tooltip content={<ChartTooltipContent isPieChart />} />
53
+
54
+ <Pie
55
+ isAnimationActive={false}
56
+ startAngle={-270}
57
+ endAngle={-630}
58
+ stroke="none"
59
+ data={data}
60
+ dataKey="value"
61
+ nameKey="name"
62
+ fill="currentColor"
63
+ innerRadius={30}
64
+ outerRadius={60}
65
+ />
66
+ </RechartsPieChart>
67
+ </ResponsiveContainer>
68
+ );
69
+ };
70
+
71
+ export const PieChartXs = ({ data = pieChartData }: PieChartProps) => {
72
+ return (
73
+ <ResponsiveContainer height={160} className="max-w-62.5">
74
+ <RechartsPieChart
75
+ margin={{
76
+ left: 0,
77
+ right: 0,
78
+ top: 0,
79
+ bottom: 0,
80
+ }}
81
+ >
82
+ <Legend verticalAlign="top" align="right" layout="vertical" content={ChartLegendContent} />
83
+ <Tooltip content={<ChartTooltipContent isPieChart />} />
84
+
85
+ <Pie
86
+ isAnimationActive={false}
87
+ startAngle={-270}
88
+ endAngle={-630}
89
+ stroke="none"
90
+ data={data}
91
+ dataKey="value"
92
+ nameKey="name"
93
+ fill="currentColor"
94
+ innerRadius={40}
95
+ outerRadius={80}
96
+ />
97
+ </RechartsPieChart>
98
+ </ResponsiveContainer>
99
+ );
100
+ };
101
+
102
+ export const PieChartSm = ({ data = pieChartData }: PieChartProps) => {
103
+ return (
104
+ <ResponsiveContainer height={200} className="max-w-72.5">
105
+ <RechartsPieChart
106
+ margin={{
107
+ left: 0,
108
+ right: 0,
109
+ top: 0,
110
+ bottom: 0,
111
+ }}
112
+ >
113
+ <Legend verticalAlign="top" align="right" layout="vertical" content={ChartLegendContent} />
114
+ <Tooltip content={<ChartTooltipContent isPieChart />} />
115
+
116
+ <Pie
117
+ isAnimationActive={false}
118
+ startAngle={-270}
119
+ endAngle={-630}
120
+ stroke="none"
121
+ data={data}
122
+ dataKey="value"
123
+ nameKey="name"
124
+ fill="currentColor"
125
+ innerRadius={50}
126
+ outerRadius={100}
127
+ />
128
+ </RechartsPieChart>
129
+ </ResponsiveContainer>
130
+ );
131
+ };
132
+
133
+ export const PieChartMd = ({ data = pieChartData }: PieChartProps) => {
134
+ return (
135
+ <ResponsiveContainer height={240} className="max-w-96">
136
+ <RechartsPieChart
137
+ margin={{
138
+ left: 0,
139
+ right: 0,
140
+ top: 0,
141
+ bottom: 0,
142
+ }}
143
+ >
144
+ <Legend verticalAlign="top" align="right" layout="vertical" content={ChartLegendContent} />
145
+ <Tooltip content={<ChartTooltipContent isPieChart />} />
146
+
147
+ <Pie
148
+ isAnimationActive={false}
149
+ startAngle={-270}
150
+ endAngle={-630}
151
+ stroke="none"
152
+ data={data}
153
+ dataKey="value"
154
+ nameKey="name"
155
+ fill="currentColor"
156
+ innerRadius={60}
157
+ outerRadius={120}
158
+ />
159
+ </RechartsPieChart>
160
+ </ResponsiveContainer>
161
+ );
162
+ };
163
+
164
+ export const PieChartLg = ({ data = pieChartData }: PieChartProps) => {
165
+ return (
166
+ <ResponsiveContainer height={280} className="max-w-96">
167
+ <RechartsPieChart
168
+ margin={{
169
+ left: 0,
170
+ right: 0,
171
+ top: 0,
172
+ bottom: 0,
173
+ }}
174
+ >
175
+ <Legend verticalAlign="top" align="right" layout="vertical" content={ChartLegendContent} />
176
+ <Tooltip content={<ChartTooltipContent isPieChart />} />
177
+
178
+ <Pie
179
+ isAnimationActive={false}
180
+ startAngle={-270}
181
+ endAngle={-630}
182
+ stroke="none"
183
+ data={data}
184
+ dataKey="value"
185
+ nameKey="name"
186
+ fill="currentColor"
187
+ innerRadius={70}
188
+ outerRadius={140}
189
+ />
190
+ </RechartsPieChart>
191
+ </ResponsiveContainer>
192
+ );
193
+ };
@@ -0,0 +1,30 @@
1
+ import type { FC } from "react";
2
+ import * as Charts from "./pie-charts.demo";
3
+
4
+ export default {
5
+ title: "Application/Charts",
6
+ decorators: [
7
+ (Story: FC) => (
8
+ <div className="flex min-h-screen items-center justify-center bg-primary py-8">
9
+ <div className="flex w-full items-center justify-center">
10
+ <Story />
11
+ </div>
12
+ </div>
13
+ ),
14
+ ],
15
+ };
16
+
17
+ export const PieChartXxs = () => <Charts.PieChartXxs />;
18
+ PieChartXxs.storyName = "Pie chart xxs";
19
+
20
+ export const PieChartXs = () => <Charts.PieChartXs />;
21
+ PieChartXs.storyName = "Pie chart xs";
22
+
23
+ export const PieChartSm = () => <Charts.PieChartSm />;
24
+ PieChartSm.storyName = "Pie chart sm";
25
+
26
+ export const PieChartMd = () => <Charts.PieChartMd />;
27
+ PieChartMd.storyName = "Pie chart md";
28
+
29
+ export const PieChartLg = () => <Charts.PieChartLg />;
30
+ PieChartLg.storyName = "Pie chart lg";
@@ -0,0 +1,110 @@
1
+ "use client";
2
+
3
+ import { PolarAngleAxis, RadialBar, RadialBarChart, ResponsiveContainer } from "recharts";
4
+ import { cx } from "@/utils/cx";
5
+
6
+ const progressCircleData = [
7
+ {
8
+ value: 400,
9
+ className: "text-utility-brand-600",
10
+ },
11
+ ];
12
+
13
+ export const ProgressCircle = ({ size = "sm", title, subtitle }: { size?: "xs" | "sm" | "md" | "lg"; title?: string; subtitle?: string }) => {
14
+ const sizes = {
15
+ // collapse-start
16
+ xs: {
17
+ size: 16,
18
+ innerRadius: 80 - 8,
19
+
20
+ titleDY: "1.05em",
21
+ subtitleDY: "-1.3em",
22
+
23
+ title: "text-display-xs font-semibold",
24
+ subtitle: "text-xs font-medium",
25
+ },
26
+ sm: {
27
+ size: 20,
28
+ innerRadius: 100 - 10,
29
+
30
+ titleDY: "1em",
31
+ subtitleDY: "-1.4em",
32
+
33
+ title: "text-display-sm font-semibold",
34
+ subtitle: "text-xs font-medium",
35
+ },
36
+ md: {
37
+ size: 24,
38
+ innerRadius: 120 - 12,
39
+
40
+ titleDY: "1em",
41
+ subtitleDY: "-1.5em",
42
+
43
+ title: "text-display-md font-semibold",
44
+ subtitle: "text-sm font-medium",
45
+ },
46
+ lg: {
47
+ size: 28,
48
+ innerRadius: 140 - 14,
49
+
50
+ titleDY: "1em",
51
+ subtitleDY: "-2.1em",
52
+
53
+ title: "text-display-lg font-semibold",
54
+ subtitle: "text-sm font-medium",
55
+ },
56
+ // collapse-end
57
+ };
58
+
59
+ return (
60
+ <div className="h-100 w-full">
61
+ <ResponsiveContainer>
62
+ <RadialBarChart
63
+ data={progressCircleData}
64
+ accessibilityLayer
65
+ innerRadius={sizes[size].innerRadius}
66
+ barSize={sizes[size].size}
67
+ // This is needed to start the chart at the top and go clockwise
68
+ startAngle={90}
69
+ endAngle={360 + 90}
70
+ >
71
+ <PolarAngleAxis tick={false} type="number" domain={[0, 1000]} reversed />
72
+
73
+ <RadialBar
74
+ isAnimationActive={false}
75
+ dataKey="value"
76
+ fill="currentColor"
77
+ cornerRadius={99}
78
+ background={{
79
+ className: "fill-utility-gray-200",
80
+ }}
81
+ />
82
+
83
+ {(title || subtitle) && (
84
+ <text x="50%" y="50%" textAnchor="middle" dominantBaseline="middle">
85
+ {subtitle && (
86
+ <tspan x="50%" dy={title ? sizes[size].subtitleDY : "1%"} className={cx("fill-current text-tertiary", sizes[size].subtitle)}>
87
+ {subtitle}
88
+ </tspan>
89
+ )}
90
+ {title && (
91
+ <tspan x="50%" dy={subtitle ? sizes[size].titleDY : "1%"} className={cx("fill-current text-primary", sizes[size].title)}>
92
+ {title}
93
+ </tspan>
94
+ )}
95
+ </text>
96
+ )}
97
+ </RadialBarChart>
98
+ </ResponsiveContainer>
99
+ </div>
100
+ );
101
+ };
102
+
103
+ export const ProgressCircleXs = () => <ProgressCircle size="xs" title="40%" subtitle="Active users" />;
104
+ export const ProgressCircleSm = () => <ProgressCircle title="40%" subtitle="Active users" />;
105
+ export const ProgressCircleMd = () => <ProgressCircle size="md" title="40%" subtitle="Active users" />;
106
+ export const ProgressCircleLg = () => <ProgressCircle size="lg" title="40%" subtitle="Active users" />;
107
+ export const ProgressCircleXsOnlyTitle = () => <ProgressCircle size="xs" title="40%" />;
108
+ export const ProgressCircleSmOnlyTitle = () => <ProgressCircle size="sm" title="40%" />;
109
+ export const ProgressCircleMdOnlyTitle = () => <ProgressCircle size="md" title="40%" />;
110
+ export const ProgressCircleLgOnlyTitle = () => <ProgressCircle size="lg" title="40%" />;
@@ -0,0 +1,33 @@
1
+ import type { FC } from "react";
2
+ import * as Charts from "./progress-circles.demo";
3
+
4
+ export default {
5
+ title: "Application/Charts",
6
+ decorators: [
7
+ (Story: FC) => (
8
+ <div className="flex min-h-screen items-center justify-center bg-primary py-8">
9
+ <div className="flex w-full items-center justify-center">
10
+ <Story />
11
+ </div>
12
+ </div>
13
+ ),
14
+ ],
15
+ };
16
+
17
+ export const ProgressCircleXs = () => <Charts.ProgressCircle size="xs" title="40%" subtitle="Active users" />;
18
+ ProgressCircleXs.storyName = "Progress circle xs";
19
+ export const ProgressCircleSm = () => <Charts.ProgressCircle title="40%" subtitle="Active users" />;
20
+ ProgressCircleSm.storyName = "Progress circle sm";
21
+ export const ProgressCircleMd = () => <Charts.ProgressCircle size="md" title="40%" subtitle="Active users" />;
22
+ ProgressCircleMd.storyName = "Progress circle md";
23
+ export const ProgressCircleLg = () => <Charts.ProgressCircle size="lg" title="40%" subtitle="Active users" />;
24
+ ProgressCircleLg.storyName = "Progress circle lg";
25
+
26
+ export const ProgressCircleXsOnlyTitle = () => <Charts.ProgressCircle size="xs" title="40%" />;
27
+ ProgressCircleXsOnlyTitle.storyName = "Progress circle xs only title";
28
+ export const ProgressCircleSmOnlyTitle = () => <Charts.ProgressCircle size="sm" title="40%" />;
29
+ ProgressCircleSmOnlyTitle.storyName = "Progress circle sm only title";
30
+ export const ProgressCircleMdOnlyTitle = () => <Charts.ProgressCircle size="md" title="40%" />;
31
+ ProgressCircleMdOnlyTitle.storyName = "Progress circle md only title";
32
+ export const ProgressCircleLgOnlyTitle = () => <Charts.ProgressCircle size="lg" title="40%" />;
33
+ ProgressCircleLgOnlyTitle.storyName = "Progress circle lg only title";
@@ -0,0 +1,203 @@
1
+ "use client";
2
+
3
+ import { Fragment, useEffect, useRef } from "react";
4
+ import { Legend, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart as RechartsRadarChart, ResponsiveContainer, Tooltip } from "recharts";
5
+ import { ChartLegendContent, ChartTooltipContent } from "@/components/application/charts/charts-base";
6
+ import { cx } from "@/utils/cx";
7
+
8
+ interface CustomRadarChartTickProps {
9
+ payload: { value: string };
10
+ x: number;
11
+ y: number;
12
+ textAnchor: string;
13
+ stroke: string;
14
+ radius: number;
15
+ }
16
+
17
+ export const CustomRadarChartTick = ({ payload, x, y, textAnchor, stroke, radius }: CustomRadarChartTickProps) => {
18
+ const textRef = useRef<SVGTextElement>(null);
19
+ const rectRef = useRef<SVGRectElement>(null);
20
+
21
+ useEffect(() => {
22
+ if (textRef.current && rectRef.current) {
23
+ const textBoundingBox = textRef.current.getBBox();
24
+
25
+ const EXTRA_WIDTH = 16;
26
+ const EXTRA_HEIGHT = 8;
27
+
28
+ rectRef.current.setAttribute("width", (textBoundingBox.width + EXTRA_WIDTH).toString());
29
+ rectRef.current.setAttribute("height", (textBoundingBox.height + EXTRA_HEIGHT).toString());
30
+ rectRef.current.setAttribute("x", (textBoundingBox.x - EXTRA_WIDTH / 2).toString());
31
+ rectRef.current.setAttribute("y", (textBoundingBox.y - EXTRA_HEIGHT / 2).toString());
32
+ }
33
+ }, [x, y, radius]);
34
+
35
+ return (
36
+ <Fragment>
37
+ <rect ref={rectRef} x={x} y={y} rx={11} className="fill-utility-gray-50 stroke-utility-gray-200 stroke-1"></rect>
38
+ <text
39
+ ref={textRef}
40
+ x={x}
41
+ y={y + 5}
42
+ radius={radius}
43
+ stroke={stroke}
44
+ textAnchor={textAnchor}
45
+ className="recharts-text recharts-polar-angle-axis-tick-value"
46
+ >
47
+ <tspan x={x} dy="0em" className="fill-utility-gray-700 text-xs font-medium">
48
+ {payload.value}
49
+ </tspan>
50
+ </text>
51
+ </Fragment>
52
+ );
53
+ };
54
+
55
+ const radarData = [
56
+ // collapse-start
57
+ {
58
+ subject: "Mon",
59
+ A: 800,
60
+ B: 400,
61
+ C: 600,
62
+ },
63
+ {
64
+ subject: "Tue",
65
+ A: 600,
66
+ B: 1000,
67
+ C: 800,
68
+ },
69
+ {
70
+ subject: "Wed",
71
+ A: 600,
72
+ B: 200,
73
+ C: 400,
74
+ },
75
+ {
76
+ subject: "Thu",
77
+ A: 200,
78
+ B: 600,
79
+ C: 800,
80
+ },
81
+ {
82
+ subject: "Fri",
83
+ A: 400,
84
+ B: 200,
85
+ C: 600,
86
+ },
87
+ {
88
+ subject: "Sat",
89
+ A: 1000,
90
+ B: 800,
91
+ C: 600,
92
+ },
93
+ {
94
+ subject: "Sun",
95
+ A: 400,
96
+ B: 1000,
97
+ C: 800,
98
+ },
99
+ // collapse-end
100
+ ];
101
+
102
+ export const RadarChart = () => {
103
+ const colors: Record<string, string> = {
104
+ A: "text-utility-brand-600",
105
+ B: "text-utility-pink-500",
106
+ C: "text-utility-blue-light-500",
107
+ };
108
+
109
+ return (
110
+ <ResponsiveContainer height={500} width="100%">
111
+ <RechartsRadarChart
112
+ cx="50%"
113
+ cy="50%"
114
+ outerRadius="80%"
115
+ data={radarData}
116
+ className="size-full font-medium text-tertiary [&_.recharts-polar-grid]:text-utility-gray-100 [&_.recharts-text]:text-sm"
117
+ margin={{
118
+ left: 0,
119
+ right: 0,
120
+ top: 0,
121
+ bottom: 0,
122
+ }}
123
+ >
124
+ <Legend verticalAlign="bottom" align="center" layout="horizontal" content={ChartLegendContent} />
125
+
126
+ <PolarGrid stroke="currentColor" className="text-utility-gray-100" />
127
+ <PolarAngleAxis
128
+ dataKey="subject"
129
+ stroke="currentColor"
130
+ tick={({ x, y, textAnchor, index, payload, ...props }) => (
131
+ <text
132
+ x={x}
133
+ y={index === 0 ? Number(y) - 14 : index === 3 || index === 4 ? Number(y) + 10 : Number(y)}
134
+ textAnchor={textAnchor}
135
+ {...props}
136
+ className={cx("recharts-text recharts-polar-angle-axis-tick-value", props.className)}
137
+ >
138
+ <tspan dy="0em" className="fill-utility-gray-700 text-xs font-medium">
139
+ {payload.value}
140
+ </tspan>
141
+ </text>
142
+ )}
143
+ tickLine={false}
144
+ axisLine={false}
145
+ />
146
+ <PolarRadiusAxis textAnchor="middle" tick={(props) => <CustomRadarChartTick {...props} />} axisLine={false} angle={90} domain={[0, 1000]} />
147
+
148
+ <Tooltip
149
+ content={<ChartTooltipContent />}
150
+ cursor={{
151
+ className: "stroke-utility-brand-600 stroke-2",
152
+ style: {
153
+ transform: "translateZ(0)",
154
+ },
155
+ }}
156
+ />
157
+
158
+ <Radar
159
+ isAnimationActive={false}
160
+ className={colors["A"]}
161
+ dataKey="A"
162
+ name="Series 1"
163
+ stroke="currentColor"
164
+ strokeWidth={2}
165
+ strokeLinejoin="round"
166
+ fill="currentColor"
167
+ fillOpacity={0.2}
168
+ activeDot={{
169
+ className: "fill-bg-primary stroke-utility-brand-600 stroke-2",
170
+ }}
171
+ />
172
+ <Radar
173
+ isAnimationActive={false}
174
+ className={colors["B"]}
175
+ dataKey="B"
176
+ name="Series 2"
177
+ stroke="currentColor"
178
+ strokeWidth={2}
179
+ strokeLinejoin="round"
180
+ fill="currentColor"
181
+ fillOpacity={0.2}
182
+ activeDot={{
183
+ className: "fill-bg-primary stroke-utility-brand-600 stroke-2",
184
+ }}
185
+ />
186
+ <Radar
187
+ isAnimationActive={false}
188
+ className={colors["C"]}
189
+ dataKey="C"
190
+ name="Series 3"
191
+ stroke="currentColor"
192
+ strokeWidth={2}
193
+ strokeLinejoin="round"
194
+ fill="currentColor"
195
+ fillOpacity={0.2}
196
+ activeDot={{
197
+ className: "fill-bg-primary stroke-utility-brand-600 stroke-2",
198
+ }}
199
+ />
200
+ </RechartsRadarChart>
201
+ </ResponsiveContainer>
202
+ );
203
+ };
@@ -0,0 +1,18 @@
1
+ import type { FC } from "react";
2
+ import * as Charts from "./radar-charts.demo";
3
+
4
+ export default {
5
+ title: "Application/Charts",
6
+ decorators: [
7
+ (Story: FC) => (
8
+ <div className="flex min-h-screen items-center justify-center bg-primary py-8">
9
+ <div className="flex w-full items-center justify-center">
10
+ <Story />
11
+ </div>
12
+ </div>
13
+ ),
14
+ ],
15
+ };
16
+
17
+ export const RadarChart = () => <Charts.RadarChart />;
18
+ RadarChart.storyName = "Radar chart";