@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,506 @@
1
+ "use client";
2
+
3
+ import { Bar, CartesianGrid, ComposedChart, Label, Legend, Line, BarChart as RechartsBarChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
4
+ import { ChartLegendContent, ChartTooltipContent, selectEvenlySpacedItems } from "@/components/application/charts/charts-base";
5
+ import { useBreakpoint } from "@/hooks/use-breakpoint";
6
+
7
+ const barData = [
8
+ // collapse-start
9
+ {
10
+ month: new Date(2025, 0, 1),
11
+ A: 300,
12
+ B: 200,
13
+ C: 350,
14
+ },
15
+ {
16
+ month: new Date(2025, 1, 1),
17
+ A: 320,
18
+ B: 300,
19
+ C: 300,
20
+ },
21
+ {
22
+ month: new Date(2025, 2, 1),
23
+ A: 300,
24
+ B: 200,
25
+ C: 240,
26
+ },
27
+ {
28
+ month: new Date(2025, 3, 1),
29
+ A: 240,
30
+ B: 300,
31
+ C: 280,
32
+ },
33
+ {
34
+ month: new Date(2025, 4, 1),
35
+ A: 320,
36
+ B: 280,
37
+ C: 100,
38
+ },
39
+ {
40
+ month: new Date(2025, 5, 1),
41
+ A: 330,
42
+ B: 300,
43
+ C: 130,
44
+ },
45
+ {
46
+ month: new Date(2025, 6, 1),
47
+ A: 300,
48
+ B: 200,
49
+ C: 100,
50
+ },
51
+ {
52
+ month: new Date(2025, 7, 1),
53
+ A: 350,
54
+ B: 300,
55
+ C: 200,
56
+ },
57
+ {
58
+ month: new Date(2025, 8, 1),
59
+ A: 300,
60
+ B: 200,
61
+ C: 100,
62
+ },
63
+ {
64
+ month: new Date(2025, 9, 1),
65
+ A: 200,
66
+ B: 300,
67
+ C: 280,
68
+ },
69
+ {
70
+ month: new Date(2025, 10, 1),
71
+ A: 240,
72
+ B: 300,
73
+ C: 300,
74
+ },
75
+ {
76
+ month: new Date(2025, 11, 1),
77
+ A: 200,
78
+ B: 400,
79
+ C: 350,
80
+ },
81
+ // collapse-end
82
+ ];
83
+
84
+ export const BarChart = () => {
85
+ const isDesktop = useBreakpoint("lg");
86
+
87
+ const colors: Record<string, string> = {
88
+ A: "text-utility-brand-700",
89
+ B: "text-utility-brand-500",
90
+ C: "text-utility-gray-200",
91
+ };
92
+
93
+ return (
94
+ <ResponsiveContainer className="h-60!">
95
+ <RechartsBarChart
96
+ data={barData}
97
+ className="text-tertiary [&_.recharts-text]:text-xs"
98
+ margin={{
99
+ left: 4,
100
+ right: 0,
101
+ top: isDesktop ? 12 : 6,
102
+ bottom: 18,
103
+ }}
104
+ >
105
+ <CartesianGrid vertical={false} stroke="currentColor" className="text-utility-gray-100" />
106
+
107
+ <Legend
108
+ verticalAlign="top"
109
+ align="right"
110
+ layout={isDesktop ? "vertical" : "horizontal"}
111
+ content={<ChartLegendContent className="-translate-y-2" />}
112
+ />
113
+
114
+ <XAxis
115
+ fill="currentColor"
116
+ axisLine={false}
117
+ tickLine={false}
118
+ tickMargin={11}
119
+ interval="preserveStartEnd"
120
+ dataKey="month"
121
+ tickFormatter={(value) => value.toLocaleDateString(undefined, { month: "short" })}
122
+ >
123
+ <Label value="Month" fill="currentColor" className="!text-xs font-medium" position="bottom" />
124
+ </XAxis>
125
+
126
+ <YAxis
127
+ fill="currentColor"
128
+ axisLine={false}
129
+ tickLine={false}
130
+ interval="preserveStartEnd"
131
+ tickFormatter={(value) => Number(value).toLocaleString()}
132
+ >
133
+ <Label
134
+ value="Active users"
135
+ fill="currentColor"
136
+ className="!text-xs font-medium"
137
+ style={{ textAnchor: "middle" }}
138
+ angle={-90}
139
+ position="insideLeft"
140
+ />
141
+ </YAxis>
142
+
143
+ <Tooltip
144
+ content={<ChartTooltipContent />}
145
+ formatter={(value) => Number(value).toLocaleString()}
146
+ labelFormatter={(value) => value.toLocaleDateString(undefined, { month: "short", year: "numeric" })}
147
+ cursor={{
148
+ className: "fill-utility-gray-200/20",
149
+ }}
150
+ />
151
+
152
+ <Bar
153
+ isAnimationActive={false}
154
+ className={colors["A"]}
155
+ dataKey="A"
156
+ name="Series 1"
157
+ type="monotone"
158
+ stackId="a"
159
+ fill="currentColor"
160
+ maxBarSize={isDesktop ? 32 : 16}
161
+ />
162
+ <Bar
163
+ isAnimationActive={false}
164
+ className={colors["B"]}
165
+ dataKey="B"
166
+ name="Series 2"
167
+ type="monotone"
168
+ stackId="a"
169
+ fill="currentColor"
170
+ maxBarSize={isDesktop ? 32 : 16}
171
+ />
172
+ <Bar
173
+ isAnimationActive={false}
174
+ className={colors["C"]}
175
+ dataKey="C"
176
+ name="Series 3"
177
+ type="monotone"
178
+ stackId="a"
179
+ fill="currentColor"
180
+ maxBarSize={isDesktop ? 32 : 16}
181
+ radius={[6, 6, 0, 0]}
182
+ />
183
+ </RechartsBarChart>
184
+ </ResponsiveContainer>
185
+ );
186
+ };
187
+
188
+ export const BarChart02 = () => {
189
+ const colors: Record<string, string> = {
190
+ A: "text-utility-brand-600",
191
+ B: "text-utility-brand-400",
192
+ };
193
+
194
+ const data = [
195
+ // collapse-start
196
+ { A: 633, B: 190, date: "2025-01-01" },
197
+ { A: 443, B: 228, date: "2025-01-08" },
198
+ { A: 506, B: 225, date: "2025-01-15" },
199
+ { A: 316, B: 227, date: "2025-01-22" },
200
+ { A: 760, B: 209, date: "2025-01-29" },
201
+ { A: 950, B: 220, date: "2025-02-05" },
202
+ { A: 760, B: 224, date: "2025-02-12" },
203
+ { A: 570, B: 279, date: "2025-02-19" },
204
+ { A: 253, B: 296, date: "2025-02-26" },
205
+ { A: 380, B: 263, date: "2025-03-05" },
206
+ { A: 443, B: 333, date: "2025-03-12" },
207
+ { A: 443, B: 306, date: "2025-03-19" },
208
+ { A: 316, B: 315, date: "2025-03-26" },
209
+ { A: 190, B: 325, date: "2025-04-02" },
210
+ { A: 380, B: 367, date: "2025-04-09" },
211
+ { A: 506, B: 372, date: "2025-04-16" },
212
+ { A: 443, B: 374, date: "2025-04-23" },
213
+ { A: 696, B: 278, date: "2025-04-30" },
214
+ { A: 950, B: 258, date: "2025-05-07" },
215
+ { A: 633, B: 357, date: "2025-05-14" },
216
+ { A: 570, B: 372, date: "2025-05-21" },
217
+ { A: 253, B: 404, date: "2025-05-28" },
218
+ { A: 316, B: 314, date: "2025-06-04" },
219
+ { A: 380, B: 359, date: "2025-06-11" },
220
+ { A: 253, B: 400, date: "2025-06-18" },
221
+ { A: 190, B: 381, date: "2025-06-25" },
222
+ { A: 316, B: 427, date: "2025-07-02" },
223
+ { A: 633, B: 371, date: "2025-07-09" },
224
+ { A: 570, B: 382, date: "2025-07-16" },
225
+ { A: 760, B: 383, date: "2025-07-23" },
226
+ { A: 950, B: 361, date: "2025-07-30" },
227
+ { A: 696, B: 405, date: "2025-08-06" },
228
+ { A: 570, B: 400, date: "2025-08-13" },
229
+ { A: 443, B: 391, date: "2025-08-20" },
230
+ { A: 316, B: 425, date: "2025-08-27" },
231
+ { A: 253, B: 406, date: "2025-09-03" },
232
+ { A: 380, B: 472, date: "2025-09-10" },
233
+ { A: 633, B: 477, date: "2025-09-17" },
234
+ { A: 570, B: 465, date: "2025-09-24" },
235
+ { A: 443, B: 488, date: "2025-10-01" },
236
+ { A: 380, B: 501, date: "2025-10-08" },
237
+ { A: 316, B: 615, date: "2025-10-15" },
238
+ { A: 570, B: 612, date: "2025-10-22" },
239
+ { A: 506, B: 673, date: "2025-10-29" },
240
+ { A: 443, B: 630, date: "2025-11-05" },
241
+ { A: 760, B: 630, date: "2025-11-12" },
242
+ { A: 443, B: 597, date: "2025-11-19" },
243
+ { A: 506, B: 572, date: "2025-11-26" },
244
+ { A: 316, B: 636, date: "2025-12-03" },
245
+ { A: 633, B: 664, date: "2025-12-10" },
246
+ { A: 380, B: 742, date: "2025-12-17" },
247
+ { A: 633, B: 808, date: "2025-12-24" },
248
+ // collapse-end
249
+ ];
250
+
251
+ return (
252
+ <div className="flex h-60 flex-col gap-2">
253
+ <ResponsiveContainer className="h-full">
254
+ <ComposedChart
255
+ data={data}
256
+ margin={{
257
+ left: 4,
258
+ right: 0,
259
+ top: 12,
260
+ bottom: 18,
261
+ }}
262
+ className="text-tertiary [&_.recharts-text]:text-xs"
263
+ >
264
+ <CartesianGrid vertical={false} stroke="currentColor" className="text-utility-gray-100" />
265
+
266
+ <XAxis
267
+ fill="currentColor"
268
+ axisLine={false}
269
+ tickLine={false}
270
+ tickMargin={12}
271
+ interval="preserveStartEnd"
272
+ dataKey="date"
273
+ tickFormatter={(value) => new Date(value).toLocaleDateString(undefined, { month: "short" })}
274
+ ticks={selectEvenlySpacedItems(data, 12).map((item) => item.date)}
275
+ >
276
+ <Label value="Month" fill="currentColor" className="!text-xs font-medium" position="bottom" />
277
+ </XAxis>
278
+
279
+ <YAxis
280
+ fill="currentColor"
281
+ axisLine={false}
282
+ tickLine={false}
283
+ interval="preserveStartEnd"
284
+ tickFormatter={(value) => Number(value).toLocaleString()}
285
+ >
286
+ <Label
287
+ value="Active users"
288
+ fill="currentColor"
289
+ className="!text-xs font-medium"
290
+ style={{ textAnchor: "middle" }}
291
+ angle={-90}
292
+ position="insideLeft"
293
+ />
294
+ </YAxis>
295
+
296
+ <Tooltip
297
+ content={<ChartTooltipContent />}
298
+ formatter={(value) => Number(value).toLocaleString()}
299
+ // Custom label formatter to show the week range
300
+ labelFormatter={(value) => {
301
+ const date = new Date(value);
302
+ const endDate = new Date(date);
303
+ endDate.setDate(date.getDate() + 6); // Set end date to 7 days after start date
304
+
305
+ // If the start and end dates are in the same month, shorten the label (Jun 1-7, 2025)
306
+ if (date.getMonth() === endDate.getMonth()) {
307
+ return `${date.toLocaleDateString(undefined, { month: "long" })} ${date.getDate()}-${endDate.getDate()}, ${endDate.getFullYear()}`;
308
+ }
309
+
310
+ // Otherwise, show the full month range (May 30 - Jun 5, 2025)
311
+ return `${date.toLocaleDateString(undefined, { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" })}`;
312
+ }}
313
+ cursor={{
314
+ className: "fill-utility-gray-200/20",
315
+ }}
316
+ />
317
+
318
+ <Bar
319
+ isAnimationActive={false}
320
+ className={colors["A"]}
321
+ name="Mobile"
322
+ dataKey="A"
323
+ type="monotone"
324
+ stackId="a"
325
+ fill="currentColor"
326
+ maxBarSize={12}
327
+ radius={[4, 4, 0, 0]}
328
+ />
329
+ <Line
330
+ isAnimationActive={false}
331
+ className={colors["B"]}
332
+ dataKey="B"
333
+ name="Desktop"
334
+ type="monotone"
335
+ stroke="currentColor"
336
+ strokeWidth={2}
337
+ strokeDasharray="0.1 8"
338
+ strokeLinecap="round"
339
+ activeDot={false}
340
+ dot={false}
341
+ />
342
+ </ComposedChart>
343
+ </ResponsiveContainer>
344
+ </div>
345
+ );
346
+ };
347
+
348
+ export const BarChart03 = () => {
349
+ const colors: Record<string, string> = {
350
+ A: "text-utility-brand-600",
351
+ B: "text-utility-brand-400",
352
+ };
353
+
354
+ const data = [
355
+ // collapse-start
356
+ { A: 633, B: 190, date: "2025-01-01" },
357
+ { A: 443, B: 228, date: "2025-01-08" },
358
+ { A: 506, B: 225, date: "2025-01-15" },
359
+ { A: 316, B: 227, date: "2025-01-22" },
360
+ { A: 760, B: 209, date: "2025-01-29" },
361
+ { A: 950, B: 220, date: "2025-02-05" },
362
+ { A: 760, B: 224, date: "2025-02-12" },
363
+ { A: 570, B: 279, date: "2025-02-19" },
364
+ { A: 253, B: 296, date: "2025-02-26" },
365
+ { A: 380, B: 263, date: "2025-03-05" },
366
+ { A: 443, B: 333, date: "2025-03-12" },
367
+ { A: 443, B: 306, date: "2025-03-19" },
368
+ { A: 316, B: 315, date: "2025-03-26" },
369
+ { A: 190, B: 325, date: "2025-04-02" },
370
+ { A: 380, B: 367, date: "2025-04-09" },
371
+ { A: 506, B: 372, date: "2025-04-16" },
372
+ { A: 443, B: 374, date: "2025-04-23" },
373
+ { A: 696, B: 278, date: "2025-04-30" },
374
+ { A: 950, B: 258, date: "2025-05-07" },
375
+ { A: 633, B: 357, date: "2025-05-14" },
376
+ { A: 570, B: 372, date: "2025-05-21" },
377
+ { A: 253, B: 404, date: "2025-05-28" },
378
+ { A: 316, B: 314, date: "2025-06-04" },
379
+ { A: 380, B: 359, date: "2025-06-11" },
380
+ { A: 253, B: 400, date: "2025-06-18" },
381
+ { A: 190, B: 381, date: "2025-06-25" },
382
+ { A: 316, B: 427, date: "2025-07-02" },
383
+ { A: 633, B: 371, date: "2025-07-09" },
384
+ { A: 570, B: 382, date: "2025-07-16" },
385
+ { A: 760, B: 383, date: "2025-07-23" },
386
+ { A: 950, B: 361, date: "2025-07-30" },
387
+ { A: 696, B: 405, date: "2025-08-06" },
388
+ { A: 570, B: 400, date: "2025-08-13" },
389
+ { A: 443, B: 391, date: "2025-08-20" },
390
+ { A: 316, B: 425, date: "2025-08-27" },
391
+ { A: 253, B: 406, date: "2025-09-03" },
392
+ { A: 380, B: 472, date: "2025-09-10" },
393
+ { A: 633, B: 477, date: "2025-09-17" },
394
+ { A: 570, B: 465, date: "2025-09-24" },
395
+ { A: 443, B: 488, date: "2025-10-01" },
396
+ { A: 380, B: 501, date: "2025-10-08" },
397
+ { A: 316, B: 615, date: "2025-10-15" },
398
+ { A: 570, B: 612, date: "2025-10-22" },
399
+ { A: 506, B: 673, date: "2025-10-29" },
400
+ { A: 443, B: 630, date: "2025-11-05" },
401
+ { A: 760, B: 630, date: "2025-11-12" },
402
+ { A: 443, B: 597, date: "2025-11-19" },
403
+ { A: 506, B: 572, date: "2025-11-26" },
404
+ { A: 316, B: 636, date: "2025-12-03" },
405
+ { A: 633, B: 664, date: "2025-12-10" },
406
+ { A: 380, B: 742, date: "2025-12-17" },
407
+ { A: 633, B: 808, date: "2025-12-24" },
408
+ // collapse-end
409
+ ];
410
+
411
+ return (
412
+ <div className="flex h-60 flex-col gap-2">
413
+ <ResponsiveContainer className="h-full">
414
+ <ComposedChart
415
+ data={data}
416
+ margin={{
417
+ left: 4,
418
+ right: 0,
419
+ top: 12,
420
+ bottom: 18,
421
+ }}
422
+ className="text-tertiary [&_.recharts-text]:text-xs"
423
+ >
424
+ <CartesianGrid vertical={false} stroke="currentColor" className="text-utility-gray-100" />
425
+
426
+ <XAxis
427
+ fill="currentColor"
428
+ axisLine={false}
429
+ tickLine={false}
430
+ tickMargin={12}
431
+ interval="preserveStartEnd"
432
+ dataKey="date"
433
+ tickFormatter={(value) => new Date(value).toLocaleDateString(undefined, { month: "short" })}
434
+ ticks={selectEvenlySpacedItems(data, 12).map((item) => item.date)}
435
+ >
436
+ <Label value="Month" fill="currentColor" className="!text-xs font-medium" position="bottom" />
437
+ </XAxis>
438
+
439
+ <YAxis
440
+ fill="currentColor"
441
+ axisLine={false}
442
+ tickLine={false}
443
+ interval="preserveStartEnd"
444
+ tickFormatter={(value) => Number(value).toLocaleString()}
445
+ >
446
+ <Label
447
+ value="Active users"
448
+ fill="currentColor"
449
+ className="!text-xs font-medium"
450
+ style={{ textAnchor: "middle" }}
451
+ angle={-90}
452
+ position="insideLeft"
453
+ />
454
+ </YAxis>
455
+
456
+ <Tooltip
457
+ content={<ChartTooltipContent />}
458
+ formatter={(value) => Number(value).toLocaleString()}
459
+ // Custom label formatter to show the week range
460
+ labelFormatter={(value) => {
461
+ const date = new Date(value);
462
+ const endDate = new Date(date);
463
+ endDate.setDate(date.getDate() + 6); // Set end date to 7 days after start date
464
+
465
+ // If the start and end dates are in the same month, shorten the label (Jun 1-7, 2025)
466
+ if (date.getMonth() === endDate.getMonth()) {
467
+ return `${date.toLocaleDateString(undefined, { month: "long" })} ${date.getDate()}-${endDate.getDate()}, ${endDate.getFullYear()}`;
468
+ }
469
+
470
+ // Otherwise, show the full month range (May 30 - Jun 5, 2025)
471
+ return `${date.toLocaleDateString(undefined, { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric" })}`;
472
+ }}
473
+ cursor={{
474
+ className: "fill-utility-gray-200/20",
475
+ }}
476
+ />
477
+
478
+ <Bar
479
+ isAnimationActive={false}
480
+ className={colors["A"]}
481
+ name="Mobile"
482
+ dataKey="A"
483
+ type="monotone"
484
+ stackId="a"
485
+ fill="currentColor"
486
+ maxBarSize={8}
487
+ radius={[4, 4, 0, 0]}
488
+ />
489
+ <Line
490
+ isAnimationActive={false}
491
+ className={colors["B"]}
492
+ dataKey="B"
493
+ name="Desktop"
494
+ type="monotone"
495
+ stroke="currentColor"
496
+ strokeWidth={2}
497
+ strokeDasharray="0.1 8"
498
+ strokeLinecap="round"
499
+ activeDot={false}
500
+ dot={false}
501
+ />
502
+ </ComposedChart>
503
+ </ResponsiveContainer>
504
+ </div>
505
+ );
506
+ };
@@ -0,0 +1,36 @@
1
+ import type { FC } from "react";
2
+ import * as Charts from "./bar-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 BarChart = () => (
18
+ <div className="w-full max-w-7xl">
19
+ <Charts.BarChart />
20
+ </div>
21
+ );
22
+ BarChart.storyName = "Bar chart";
23
+
24
+ export const BarChart02 = () => (
25
+ <div className="w-full max-w-7xl">
26
+ <Charts.BarChart02 />
27
+ </div>
28
+ );
29
+ BarChart02.storyName = "Bar chart 02";
30
+
31
+ export const BarChart03 = () => (
32
+ <div className="w-full max-w-7xl">
33
+ <Charts.BarChart03 />
34
+ </div>
35
+ );
36
+ BarChart03.storyName = "Bar chart 03";