@giddaa-housing/ui 0.1.0 → 1.0.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/README.md +18 -6
- package/css/base.css +37 -0
- package/css/components.css +135 -0
- package/css/generated/shared.css +1 -0
- package/css/giddaa.css +402 -0
- package/css/preset.css +77 -0
- package/css/styles.css +2 -0
- package/css/theme.css +255 -0
- package/dist/accordion.js +5 -35
- package/dist/accordion.js.map +1 -1
- package/dist/activity-timeline.d.ts +33 -0
- package/dist/activity-timeline.js +212 -0
- package/dist/activity-timeline.js.map +1 -0
- package/dist/alert.js +5 -35
- package/dist/alert.js.map +1 -1
- package/dist/auth-layout.d.ts +23 -0
- package/dist/auth-layout.js +304 -0
- package/dist/auth-layout.js.map +1 -0
- package/dist/avatar.js +10 -142
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +6 -114
- package/dist/badge.js.map +1 -1
- package/dist/bar-chart.d.ts +101 -77
- package/dist/bar-chart.js +142 -220
- package/dist/bar-chart.js.map +1 -1
- package/dist/breadcrumb.js +5 -35
- package/dist/breadcrumb.js.map +1 -1
- package/dist/bullet-chart.js +15 -48
- package/dist/bullet-chart.js.map +1 -1
- package/dist/button-group.js +14 -90
- package/dist/button-group.js.map +1 -1
- package/dist/button.d.ts +5 -5
- package/dist/button.js +7 -140
- package/dist/button.js.map +1 -1
- package/dist/calendar.js +12 -287
- package/dist/calendar.js.map +1 -1
- package/dist/card.js +5 -35
- package/dist/card.js.map +1 -1
- package/dist/carousel.js +12 -386
- package/dist/carousel.js.map +1 -1
- package/dist/chart.js +16 -480
- package/dist/chart.js.map +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js +13 -48
- package/dist/checkbox.js.map +1 -1
- package/dist/chunk-322YCNVL.js +278 -0
- package/dist/chunk-322YCNVL.js.map +1 -0
- package/dist/chunk-3ACQVT7A.js +25 -0
- package/dist/chunk-3ACQVT7A.js.map +1 -0
- package/dist/chunk-3T65TLJX.js +334 -0
- package/dist/chunk-3T65TLJX.js.map +1 -0
- package/dist/chunk-6ZSGQHH2.js +192 -0
- package/dist/chunk-6ZSGQHH2.js.map +1 -0
- package/dist/chunk-7TBMLFGW.js +41 -0
- package/dist/chunk-7TBMLFGW.js.map +1 -0
- package/dist/chunk-B4H6RNDH.js +135 -0
- package/dist/chunk-B4H6RNDH.js.map +1 -0
- package/dist/chunk-BUXCGZ6X.js +219 -0
- package/dist/chunk-BUXCGZ6X.js.map +1 -0
- package/dist/chunk-CHII2QHH.js +58 -0
- package/dist/chunk-CHII2QHH.js.map +1 -0
- package/dist/chunk-DMNOXRRW.js +147 -0
- package/dist/chunk-DMNOXRRW.js.map +1 -0
- package/dist/chunk-EFSOSSIC.js +130 -0
- package/dist/chunk-EFSOSSIC.js.map +1 -0
- package/dist/chunk-FZDSVMKY.js +363 -0
- package/dist/chunk-FZDSVMKY.js.map +1 -0
- package/dist/chunk-GJOFIJS3.js +246 -0
- package/dist/chunk-GJOFIJS3.js.map +1 -0
- package/dist/chunk-HL3ZSYES.js +23 -0
- package/dist/chunk-HL3ZSYES.js.map +1 -0
- package/dist/chunk-JVLUBAPB.js +129 -0
- package/dist/chunk-JVLUBAPB.js.map +1 -0
- package/dist/chunk-KDPYSOYZ.js +64 -0
- package/dist/chunk-KDPYSOYZ.js.map +1 -0
- package/dist/chunk-KSMDANKI.js +43 -0
- package/dist/chunk-KSMDANKI.js.map +1 -0
- package/dist/chunk-MEKCCOP5.js +46 -0
- package/dist/chunk-MEKCCOP5.js.map +1 -0
- package/dist/chunk-NOFXVRWL.js +451 -0
- package/dist/chunk-NOFXVRWL.js.map +1 -0
- package/dist/chunk-PC5MHNVA.js +171 -0
- package/dist/chunk-PC5MHNVA.js.map +1 -0
- package/dist/chunk-QKAQZ2GU.js +122 -0
- package/dist/chunk-QKAQZ2GU.js.map +1 -0
- package/dist/chunk-QZHSHSVV.js +26 -0
- package/dist/chunk-QZHSHSVV.js.map +1 -0
- package/dist/chunk-RBMK26XD.js +19 -0
- package/dist/chunk-RBMK26XD.js.map +1 -0
- package/dist/chunk-SFNJGF6M.js +262 -0
- package/dist/chunk-SFNJGF6M.js.map +1 -0
- package/dist/chunk-UJJNLGTM.js +112 -0
- package/dist/chunk-UJJNLGTM.js.map +1 -0
- package/dist/chunk-VGR4ZWJ3.js +418 -0
- package/dist/chunk-VGR4ZWJ3.js.map +1 -0
- package/dist/chunk-XG47P6D4.js +99 -0
- package/dist/chunk-XG47P6D4.js.map +1 -0
- package/dist/chunk-XZZAHNVM.js +21 -0
- package/dist/chunk-XZZAHNVM.js.map +1 -0
- package/dist/chunk-Y4TTYVNE.js +36 -0
- package/dist/chunk-Y4TTYVNE.js.map +1 -0
- package/dist/chunk-YDWIHW6Q.js +69 -0
- package/dist/chunk-YDWIHW6Q.js.map +1 -0
- package/dist/collapsible.js +6 -35
- package/dist/collapsible.js.map +1 -1
- package/dist/combobox.js +26 -694
- package/dist/combobox.js.map +1 -1
- package/dist/cta.d.ts +66 -0
- package/dist/cta.js +358 -0
- package/dist/cta.js.map +1 -0
- package/dist/currency-selector.d.ts +42 -0
- package/dist/currency-selector.js +192 -0
- package/dist/currency-selector.js.map +1 -0
- package/dist/date-picker.d.ts +18 -10
- package/dist/date-picker.js +105 -430
- package/dist/date-picker.js.map +1 -1
- package/dist/details-card.d.ts +19 -0
- package/dist/details-card.js +267 -0
- package/dist/details-card.js.map +1 -0
- package/dist/dialog.js +36 -146
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/dropdown-menu.js +20 -358
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/dropzone.js +13 -40
- package/dist/dropzone.js.map +1 -1
- package/dist/editorial-card.d.ts +29 -0
- package/dist/editorial-card.js +311 -0
- package/dist/editorial-card.js.map +1 -0
- package/dist/empty-state.js +5 -35
- package/dist/empty-state.js.map +1 -1
- package/dist/field.js +30 -135
- package/dist/field.js.map +1 -1
- package/dist/footer.d.ts +47 -0
- package/dist/footer.js +430 -0
- package/dist/footer.js.map +1 -0
- package/dist/funnel-chart.js +42 -415
- package/dist/funnel-chart.js.map +1 -1
- package/dist/gallery-indicator.d.ts +18 -0
- package/dist/gallery-indicator.js +12 -0
- package/dist/gallery-indicator.js.map +1 -0
- package/dist/heatmap-chart.d.ts +98 -0
- package/dist/heatmap-chart.js +248 -0
- package/dist/heatmap-chart.js.map +1 -0
- package/dist/infotip.d.ts +11 -0
- package/dist/infotip.js +66 -0
- package/dist/infotip.js.map +1 -0
- package/dist/input-group.d.ts +2 -1
- package/dist/input-group.js +15 -371
- package/dist/input-group.js.map +1 -1
- package/dist/input-size-context.js +5 -19
- package/dist/input-size-context.js.map +1 -1
- package/dist/input.js +6 -78
- package/dist/input.js.map +1 -1
- package/dist/item.js +5 -35
- package/dist/item.js.map +1 -1
- package/dist/kpi-card.js +12 -52
- package/dist/kpi-card.js.map +1 -1
- package/dist/label.js +5 -64
- package/dist/label.js.map +1 -1
- package/dist/line-chart.js +9 -166
- package/dist/line-chart.js.map +1 -1
- package/dist/logo.js +4 -141
- package/dist/logo.js.map +1 -1
- package/dist/map-indicator.d.ts +13 -0
- package/dist/map-indicator.js +109 -0
- package/dist/map-indicator.js.map +1 -0
- package/dist/match.d.ts +16 -0
- package/dist/match.js +113 -0
- package/dist/match.js.map +1 -0
- package/dist/media-gallery-hero.d.ts +60 -0
- package/dist/media-gallery-hero.js +362 -0
- package/dist/media-gallery-hero.js.map +1 -0
- package/dist/media-player.d.ts +60 -0
- package/dist/media-player.js +1394 -0
- package/dist/media-player.js.map +1 -0
- package/dist/number-input.js +30 -325
- package/dist/number-input.js.map +1 -1
- package/dist/page-header.js +4 -32
- package/dist/page-header.js.map +1 -1
- package/dist/pagination.d.ts +1 -0
- package/dist/pagination.js +27 -161
- package/dist/pagination.js.map +1 -1
- package/dist/password-input.d.ts +1 -0
- package/dist/password-input.js +21 -319
- package/dist/password-input.js.map +1 -1
- package/dist/phone-input.d.ts +2 -1
- package/dist/phone-input.js +148 -359
- package/dist/phone-input.js.map +1 -1
- package/dist/photo-gallery.d.ts +1 -1
- package/dist/photo-gallery.js +97 -393
- package/dist/photo-gallery.js.map +1 -1
- package/dist/pie-chart.js +17 -52
- package/dist/pie-chart.js.map +1 -1
- package/dist/popover.js +13 -158
- package/dist/popover.js.map +1 -1
- package/dist/price-tag.d.ts +35 -0
- package/dist/price-tag.js +178 -0
- package/dist/price-tag.js.map +1 -0
- package/dist/progress.d.ts +5 -2
- package/dist/progress.js +14 -303
- package/dist/progress.js.map +1 -1
- package/dist/property-listing-card.d.ts +32 -0
- package/dist/property-listing-card.js +235 -0
- package/dist/property-listing-card.js.map +1 -0
- package/dist/radar-chart.d.ts +110 -0
- package/dist/radar-chart.js +147 -0
- package/dist/radar-chart.js.map +1 -0
- package/dist/radio-group.js +15 -50
- package/dist/radio-group.js.map +1 -1
- package/dist/review-block.d.ts +20 -0
- package/dist/review-block.js +10 -0
- package/dist/review-block.js.map +1 -0
- package/dist/rich-text-editor.js +172 -433
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/scatter-chart.d.ts +142 -0
- package/dist/scatter-chart.js +252 -0
- package/dist/scatter-chart.js.map +1 -0
- package/dist/search-input.d.ts +1 -0
- package/dist/search-input.js +22 -320
- package/dist/search-input.js.map +1 -1
- package/dist/select.js +15 -292
- package/dist/select.js.map +1 -1
- package/dist/separator.js +5 -68
- package/dist/separator.js.map +1 -1
- package/dist/sheet.js +14 -271
- package/dist/sheet.js.map +1 -1
- package/dist/sidebar.d.ts +1 -1
- package/dist/sidebar.js +89 -494
- package/dist/sidebar.js.map +1 -1
- package/dist/size-context.js +5 -17
- package/dist/size-context.js.map +1 -1
- package/dist/skeleton.js +4 -44
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.d.ts +28 -0
- package/dist/slider.js +152 -0
- package/dist/slider.js.map +1 -0
- package/dist/sparkline.js +33 -341
- package/dist/sparkline.js.map +1 -1
- package/dist/stepper.js +5 -35
- package/dist/stepper.js.map +1 -1
- package/dist/styles.css +9593 -2
- package/dist/switch.js +13 -48
- package/dist/switch.js.map +1 -1
- package/dist/tab-list.js +35 -306
- package/dist/tab-list.js.map +1 -1
- package/dist/table.js +5 -32
- package/dist/table.js.map +1 -1
- package/dist/tabs.js +10 -150
- package/dist/tabs.js.map +1 -1
- package/dist/tag.d.ts +7 -6
- package/dist/tag.js +101 -97
- package/dist/tag.js.map +1 -1
- package/dist/testimonial-block.d.ts +34 -0
- package/dist/testimonial-block.js +377 -0
- package/dist/testimonial-block.js.map +1 -0
- package/dist/textarea.js +6 -73
- package/dist/textarea.js.map +1 -1
- package/dist/time-picker.js +119 -279
- package/dist/time-picker.js.map +1 -1
- package/dist/toast.js +27 -132
- package/dist/toast.js.map +1 -1
- package/dist/tooltip.d.ts +5 -5
- package/dist/tooltip.js +7 -90
- package/dist/tooltip.js.map +1 -1
- package/dist/tree-map.js +41 -414
- package/dist/tree-map.js.map +1 -1
- package/dist/waterfall-chart.d.ts +129 -0
- package/dist/waterfall-chart.js +577 -0
- package/dist/waterfall-chart.js.map +1 -0
- package/package.json +98 -28
- package/dist/base.css +0 -32
- package/dist/files/red-hat-display-latin-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-900-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-300-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-500-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-600-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-700-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-800-normal.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-italic.woff2 +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff +0 -0
- package/dist/files/red-hat-display-latin-ext-900-normal.woff2 +0 -0
- package/dist/index.d.ts +0 -87
- package/dist/index.js +0 -10448
- package/dist/index.js.map +0 -1
- package/dist/red-hat-display.css +0 -2
- package/dist/theme/giddaa.css +0 -2
package/dist/sparkline.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ChartContainer,
|
|
4
|
+
ChartTooltip,
|
|
5
|
+
ChartTooltipContent
|
|
6
|
+
} from "./chunk-NOFXVRWL.js";
|
|
7
|
+
import {
|
|
8
|
+
useComponentSize
|
|
9
|
+
} from "./chunk-HL3ZSYES.js";
|
|
10
|
+
import {
|
|
11
|
+
cn
|
|
12
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
13
|
+
|
|
14
|
+
// src/sparkline.tsx
|
|
2
15
|
import {
|
|
3
16
|
Area,
|
|
4
17
|
AreaChart,
|
|
@@ -8,328 +21,7 @@ import {
|
|
|
8
21
|
LineChart,
|
|
9
22
|
XAxis
|
|
10
23
|
} from "recharts";
|
|
11
|
-
|
|
12
|
-
// src/lib/cn.ts
|
|
13
|
-
import { clsx } from "clsx";
|
|
14
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
15
|
-
var twMerge = extendTailwindMerge({
|
|
16
|
-
extend: {
|
|
17
|
-
classGroups: {
|
|
18
|
-
"font-size": [
|
|
19
|
-
{
|
|
20
|
-
text: [
|
|
21
|
-
"gdt-display",
|
|
22
|
-
"gdt-h1",
|
|
23
|
-
"gdt-h2",
|
|
24
|
-
"gdt-h3",
|
|
25
|
-
"gdt-h4",
|
|
26
|
-
"gdt-h5",
|
|
27
|
-
"gdt-xl",
|
|
28
|
-
"gdt-lg",
|
|
29
|
-
"gdt-md",
|
|
30
|
-
"gdt-sm",
|
|
31
|
-
"gdt-xs",
|
|
32
|
-
"gdt-subtext",
|
|
33
|
-
"gdt-capitalized"
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
function cn(...inputs) {
|
|
41
|
-
return twMerge(clsx(inputs));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// src/components/ui/chart.tsx
|
|
45
|
-
import { cva } from "class-variance-authority";
|
|
46
|
-
import * as React from "react";
|
|
47
|
-
import * as RechartsPrimitive from "recharts";
|
|
48
|
-
|
|
49
|
-
// src/components/ui/size-context.tsx
|
|
50
|
-
import { createContext, useContext } from "react";
|
|
51
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
52
|
-
var SizeContext = createContext(void 0);
|
|
53
|
-
function useComponentSize(size, fallback = "md") {
|
|
54
|
-
const inheritedSize = useContext(SizeContext);
|
|
55
|
-
return size ?? inheritedSize ?? fallback;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// src/components/ui/chart.tsx
|
|
59
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
60
|
-
var SERIES_COLOR_PLACEHOLDER = "var(--color-surface-brand)";
|
|
61
|
-
function formatChartValue(value, type) {
|
|
62
|
-
if (Array.isArray(value)) {
|
|
63
|
-
return value.join(", ");
|
|
64
|
-
}
|
|
65
|
-
if (typeof value !== "number") {
|
|
66
|
-
return value == null ? "" : String(value);
|
|
67
|
-
}
|
|
68
|
-
switch (type) {
|
|
69
|
-
case "currency":
|
|
70
|
-
return `\u20A6${value.toLocaleString("en-NG")}`;
|
|
71
|
-
case "percentage":
|
|
72
|
-
return `${value.toLocaleString("en-NG", {
|
|
73
|
-
minimumFractionDigits: 1,
|
|
74
|
-
maximumFractionDigits: 1
|
|
75
|
-
})}%`;
|
|
76
|
-
default:
|
|
77
|
-
return value.toLocaleString("en-NG");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
var THEMES = { light: "", dark: ".dark" };
|
|
81
|
-
var INITIAL_DIMENSION = { width: 320, height: 200 };
|
|
82
|
-
var ChartContext = React.createContext(null);
|
|
83
|
-
function useChart() {
|
|
84
|
-
const context = React.useContext(ChartContext);
|
|
85
|
-
if (!context) {
|
|
86
|
-
throw new Error("useChart must be used within a <ChartContainer />");
|
|
87
|
-
}
|
|
88
|
-
return context;
|
|
89
|
-
}
|
|
90
|
-
var chartCardVariants = cva(
|
|
91
|
-
"flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1",
|
|
92
|
-
{
|
|
93
|
-
variants: {
|
|
94
|
-
size: {
|
|
95
|
-
sm: "gap-3 p-4",
|
|
96
|
-
md: "gap-4 p-5",
|
|
97
|
-
lg: "gap-5 p-6"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
defaultVariants: { size: "md" }
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
var chartTitleVariants = cva("min-w-0 font-bold text-fg-primary", {
|
|
104
|
-
variants: {
|
|
105
|
-
size: {
|
|
106
|
-
sm: "text-gdt-md",
|
|
107
|
-
md: "text-gdt-lg",
|
|
108
|
-
lg: "text-gdt-h5"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
defaultVariants: { size: "md" }
|
|
112
|
-
});
|
|
113
|
-
var chartDescriptionVariants = cva("min-w-0 font-normal text-fg-secondary", {
|
|
114
|
-
variants: {
|
|
115
|
-
size: {
|
|
116
|
-
sm: "text-gdt-xs",
|
|
117
|
-
md: "text-gdt-sm",
|
|
118
|
-
lg: "text-gdt-sm"
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
defaultVariants: { size: "md" }
|
|
122
|
-
});
|
|
123
|
-
function ChartContainer({
|
|
124
|
-
id,
|
|
125
|
-
className,
|
|
126
|
-
children,
|
|
127
|
-
config,
|
|
128
|
-
initialDimension = INITIAL_DIMENSION,
|
|
129
|
-
...props
|
|
130
|
-
}) {
|
|
131
|
-
const uniqueId = React.useId();
|
|
132
|
-
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
133
|
-
return /* @__PURE__ */ jsx2(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs(
|
|
134
|
-
"div",
|
|
135
|
-
{
|
|
136
|
-
"data-slot": "chart",
|
|
137
|
-
"data-chart": chartId,
|
|
138
|
-
className: cn(
|
|
139
|
-
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden",
|
|
140
|
-
className
|
|
141
|
-
),
|
|
142
|
-
...props,
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ jsx2(ChartStyle, { id: chartId, config }),
|
|
145
|
-
/* @__PURE__ */ jsx2(
|
|
146
|
-
RechartsPrimitive.ResponsiveContainer,
|
|
147
|
-
{
|
|
148
|
-
initialDimension,
|
|
149
|
-
children
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
) });
|
|
155
|
-
}
|
|
156
|
-
var ChartStyle = ({ id, config }) => {
|
|
157
|
-
const colorConfig = Object.entries(config).filter(
|
|
158
|
-
([, config2]) => config2.theme ?? config2.color
|
|
159
|
-
);
|
|
160
|
-
if (!colorConfig.length) {
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
const styleContent = Object.entries(THEMES).map(
|
|
164
|
-
([theme, prefix]) => `
|
|
165
|
-
${prefix} [data-chart=${id}] {
|
|
166
|
-
${colorConfig.map(([key, itemConfig]) => {
|
|
167
|
-
const color = itemConfig.theme?.[theme] ?? itemConfig.color;
|
|
168
|
-
return color ? ` --color-${key}: ${color};` : null;
|
|
169
|
-
}).join("\n")}
|
|
170
|
-
}
|
|
171
|
-
`
|
|
172
|
-
).join("\n");
|
|
173
|
-
return /* @__PURE__ */ jsx2("style", { children: styleContent });
|
|
174
|
-
};
|
|
175
|
-
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
176
|
-
var chartTooltipVariants = cva(
|
|
177
|
-
"flex flex-col bg-surface-overlay border border-line-subtle shadow-2",
|
|
178
|
-
{
|
|
179
|
-
variants: {
|
|
180
|
-
size: {
|
|
181
|
-
xs: "gap-0.5 rounded-md p-2",
|
|
182
|
-
sm: "gap-0.5 rounded-md p-2.5",
|
|
183
|
-
md: "gap-1 rounded-lg p-3",
|
|
184
|
-
lg: "gap-1 rounded-xl p-3.5"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
defaultVariants: {
|
|
188
|
-
size: "md"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
);
|
|
192
|
-
var chartTooltipDotVariants = cva("shrink-0 rounded-full", {
|
|
193
|
-
variants: {
|
|
194
|
-
size: {
|
|
195
|
-
xs: "size-1.5",
|
|
196
|
-
sm: "size-2",
|
|
197
|
-
md: "size-2.5",
|
|
198
|
-
lg: "size-2.5"
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
defaultVariants: {
|
|
202
|
-
size: "md"
|
|
203
|
-
}
|
|
204
|
-
});
|
|
205
|
-
var chartTooltipLabelVariants = cva("font-medium text-fg-secondary", {
|
|
206
|
-
variants: {
|
|
207
|
-
size: {
|
|
208
|
-
xs: "text-gdt-xs",
|
|
209
|
-
sm: "text-gdt-xs",
|
|
210
|
-
md: "text-gdt-sm",
|
|
211
|
-
lg: "text-gdt-sm"
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
defaultVariants: { size: "md" }
|
|
215
|
-
});
|
|
216
|
-
var chartTooltipValueVariants = cva(
|
|
217
|
-
"font-extrabold text-fg-primary tabular-nums",
|
|
218
|
-
{
|
|
219
|
-
variants: {
|
|
220
|
-
size: {
|
|
221
|
-
xs: "text-gdt-sm",
|
|
222
|
-
sm: "text-gdt-md",
|
|
223
|
-
md: "text-gdt-lg",
|
|
224
|
-
lg: "text-gdt-xl"
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
defaultVariants: { size: "md" }
|
|
228
|
-
}
|
|
229
|
-
);
|
|
230
|
-
function ChartTooltipContent({
|
|
231
|
-
active,
|
|
232
|
-
payload,
|
|
233
|
-
className,
|
|
234
|
-
hideIndicator = false,
|
|
235
|
-
label,
|
|
236
|
-
labelFormatter,
|
|
237
|
-
formatter,
|
|
238
|
-
color,
|
|
239
|
-
nameKey,
|
|
240
|
-
valueType = "number",
|
|
241
|
-
size = "md"
|
|
242
|
-
}) {
|
|
243
|
-
const { config } = useChart();
|
|
244
|
-
if (!active || !payload?.length) {
|
|
245
|
-
return null;
|
|
246
|
-
}
|
|
247
|
-
const [item] = payload.filter((entry) => entry.type !== "none");
|
|
248
|
-
if (!item) {
|
|
249
|
-
return null;
|
|
250
|
-
}
|
|
251
|
-
const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
|
|
252
|
-
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
253
|
-
const dotColor = color ?? item.payload?.fill ?? item.color ?? SERIES_COLOR_PLACEHOLDER;
|
|
254
|
-
const metricLabel = itemConfig?.label ?? item.name;
|
|
255
|
-
const heroValue = formatter ? formatter(item.value, item.name ?? "", item, 0, item.payload) : formatChartValue(item.value, valueType);
|
|
256
|
-
const periodCaption = labelFormatter ? labelFormatter(label, payload) : (typeof label === "string" ? config[label]?.label : null) ?? label;
|
|
257
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(chartTooltipVariants({ size }), className), children: [
|
|
258
|
-
metricLabel != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:shrink-0", children: [
|
|
259
|
-
!hideIndicator && (itemConfig?.icon ? /* @__PURE__ */ jsx2(itemConfig.icon, {}) : /* @__PURE__ */ jsx2(
|
|
260
|
-
"span",
|
|
261
|
-
{
|
|
262
|
-
"aria-hidden": "true",
|
|
263
|
-
className: cn(chartTooltipDotVariants({ size })),
|
|
264
|
-
style: { backgroundColor: dotColor }
|
|
265
|
-
}
|
|
266
|
-
)),
|
|
267
|
-
/* @__PURE__ */ jsx2("span", { className: cn(chartTooltipLabelVariants({ size })), children: metricLabel })
|
|
268
|
-
] }),
|
|
269
|
-
/* @__PURE__ */ jsx2("p", { className: cn(chartTooltipValueVariants({ size })), children: heroValue }),
|
|
270
|
-
periodCaption != null && periodCaption !== "" && /* @__PURE__ */ jsx2("p", { className: "text-gdt-xs text-fg-caption-placeholder", children: periodCaption })
|
|
271
|
-
] });
|
|
272
|
-
}
|
|
273
|
-
var chartLegendItemVariants = cva(
|
|
274
|
-
"group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0",
|
|
275
|
-
{
|
|
276
|
-
variants: {
|
|
277
|
-
size: {
|
|
278
|
-
sm: "gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3",
|
|
279
|
-
md: "gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5"
|
|
280
|
-
},
|
|
281
|
-
interactive: {
|
|
282
|
-
true: "cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised",
|
|
283
|
-
false: ""
|
|
284
|
-
},
|
|
285
|
-
inactive: {
|
|
286
|
-
true: "text-fg-caption-placeholder line-through",
|
|
287
|
-
false: ""
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
defaultVariants: {
|
|
291
|
-
size: "md",
|
|
292
|
-
interactive: false,
|
|
293
|
-
inactive: false
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
);
|
|
297
|
-
var chartLegendMarkerSizeVariants = cva("shrink-0", {
|
|
298
|
-
variants: {
|
|
299
|
-
marker: {
|
|
300
|
-
dot: "rounded-full",
|
|
301
|
-
square: "rounded-[2px]",
|
|
302
|
-
line: "rounded-full"
|
|
303
|
-
},
|
|
304
|
-
size: {
|
|
305
|
-
sm: "",
|
|
306
|
-
md: ""
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
compoundVariants: [
|
|
310
|
-
{ marker: ["dot", "square"], size: "sm", className: "size-2" },
|
|
311
|
-
{ marker: ["dot", "square"], size: "md", className: "size-2.5" },
|
|
312
|
-
{ marker: "line", size: "sm", className: "h-[3px] w-3" },
|
|
313
|
-
{ marker: "line", size: "md", className: "h-[3px] w-3.5" }
|
|
314
|
-
],
|
|
315
|
-
defaultVariants: { marker: "dot", size: "md" }
|
|
316
|
-
});
|
|
317
|
-
function getPayloadConfigFromPayload(config, payload, key) {
|
|
318
|
-
if (typeof payload !== "object" || payload === null) {
|
|
319
|
-
return void 0;
|
|
320
|
-
}
|
|
321
|
-
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
|
|
322
|
-
let configLabelKey = key;
|
|
323
|
-
if (key in payload && typeof payload[key] === "string") {
|
|
324
|
-
configLabelKey = payload[key];
|
|
325
|
-
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
326
|
-
configLabelKey = payloadPayload[key];
|
|
327
|
-
}
|
|
328
|
-
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
// src/components/ui/sparkline.tsx
|
|
332
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
24
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
333
25
|
var SPARKLINE_LAYOUT = {
|
|
334
26
|
sm: {
|
|
335
27
|
width: 72,
|
|
@@ -385,7 +77,7 @@ function SparklineEndDot({
|
|
|
385
77
|
if (cx == null || cy == null || index !== lastIndex) {
|
|
386
78
|
return null;
|
|
387
79
|
}
|
|
388
|
-
return /* @__PURE__ */
|
|
80
|
+
return /* @__PURE__ */ jsx(
|
|
389
81
|
"circle",
|
|
390
82
|
{
|
|
391
83
|
cx,
|
|
@@ -412,8 +104,8 @@ function SparklineBarShape({
|
|
|
412
104
|
return null;
|
|
413
105
|
}
|
|
414
106
|
const markerY = typeof value === "number" && value < 0 ? y + height : y;
|
|
415
|
-
return /* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
417
109
|
"rect",
|
|
418
110
|
{
|
|
419
111
|
x,
|
|
@@ -425,7 +117,7 @@ function SparklineBarShape({
|
|
|
425
117
|
fill: "var(--color-value)"
|
|
426
118
|
}
|
|
427
119
|
),
|
|
428
|
-
index === lastIndex ? /* @__PURE__ */
|
|
120
|
+
index === lastIndex ? /* @__PURE__ */ jsx(
|
|
429
121
|
"circle",
|
|
430
122
|
{
|
|
431
123
|
cx: x + width / 2,
|
|
@@ -464,8 +156,8 @@ function Sparkline({
|
|
|
464
156
|
value: { label, color }
|
|
465
157
|
};
|
|
466
158
|
const showDot = showMarker && data.length >= 2;
|
|
467
|
-
const endDot = showDot ? /* @__PURE__ */
|
|
468
|
-
const barShape = showDot ? /* @__PURE__ */
|
|
159
|
+
const endDot = showDot ? /* @__PURE__ */ jsx(SparklineEndDot, { lastIndex, radius: layout.dotRadius }) : false;
|
|
160
|
+
const barShape = showDot ? /* @__PURE__ */ jsx(
|
|
469
161
|
SparklineBarShape,
|
|
470
162
|
{
|
|
471
163
|
lastIndex,
|
|
@@ -479,16 +171,16 @@ function Sparkline({
|
|
|
479
171
|
stroke: "var(--color-surface)",
|
|
480
172
|
strokeWidth: 2
|
|
481
173
|
} : false;
|
|
482
|
-
const tooltipNode = tooltip ? /* @__PURE__ */
|
|
174
|
+
const tooltipNode = tooltip ? /* @__PURE__ */ jsx(
|
|
483
175
|
ChartTooltip,
|
|
484
176
|
{
|
|
485
177
|
cursor: false,
|
|
486
|
-
content: /* @__PURE__ */
|
|
178
|
+
content: /* @__PURE__ */ jsx(ChartTooltipContent, { size: "xs", valueType })
|
|
487
179
|
}
|
|
488
180
|
) : null;
|
|
489
181
|
const ariaLabel = props["aria-label"] ?? `${label} sparkline, trend ${resolvedTrend}`;
|
|
490
182
|
if (data.length < 2) {
|
|
491
|
-
return /* @__PURE__ */
|
|
183
|
+
return /* @__PURE__ */ jsx(
|
|
492
184
|
"div",
|
|
493
185
|
{
|
|
494
186
|
...props,
|
|
@@ -499,7 +191,7 @@ function Sparkline({
|
|
|
499
191
|
}
|
|
500
192
|
);
|
|
501
193
|
}
|
|
502
|
-
return /* @__PURE__ */
|
|
194
|
+
return /* @__PURE__ */ jsx(
|
|
503
195
|
ChartContainer,
|
|
504
196
|
{
|
|
505
197
|
...props,
|
|
@@ -508,9 +200,9 @@ function Sparkline({
|
|
|
508
200
|
config,
|
|
509
201
|
className: cn("aspect-auto w-full", className),
|
|
510
202
|
style: { height: layout.height, ...style },
|
|
511
|
-
children: type === "bar" ? /* @__PURE__ */
|
|
203
|
+
children: type === "bar" ? /* @__PURE__ */ jsxs(BarChart, { accessibilityLayer: true, data: chartData, margin: layout.margin, children: [
|
|
512
204
|
tooltipNode,
|
|
513
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
514
206
|
Bar,
|
|
515
207
|
{
|
|
516
208
|
dataKey: "value",
|
|
@@ -521,10 +213,10 @@ function Sparkline({
|
|
|
521
213
|
isAnimationActive: false
|
|
522
214
|
}
|
|
523
215
|
)
|
|
524
|
-
] }) : type === "area" ? /* @__PURE__ */
|
|
525
|
-
tooltip ? /* @__PURE__ */
|
|
216
|
+
] }) : type === "area" ? /* @__PURE__ */ jsxs(AreaChart, { accessibilityLayer: true, data: chartData, margin: layout.margin, children: [
|
|
217
|
+
tooltip ? /* @__PURE__ */ jsx(XAxis, { dataKey: "x", hide: true }) : null,
|
|
526
218
|
tooltipNode,
|
|
527
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
528
220
|
Area,
|
|
529
221
|
{
|
|
530
222
|
type: "monotone",
|
|
@@ -540,10 +232,10 @@ function Sparkline({
|
|
|
540
232
|
isAnimationActive: false
|
|
541
233
|
}
|
|
542
234
|
)
|
|
543
|
-
] }) : /* @__PURE__ */
|
|
544
|
-
tooltip ? /* @__PURE__ */
|
|
235
|
+
] }) : /* @__PURE__ */ jsxs(LineChart, { accessibilityLayer: true, data: chartData, margin: layout.margin, children: [
|
|
236
|
+
tooltip ? /* @__PURE__ */ jsx(XAxis, { dataKey: "x", hide: true }) : null,
|
|
545
237
|
tooltipNode,
|
|
546
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ jsx(
|
|
547
239
|
Line,
|
|
548
240
|
{
|
|
549
241
|
type: "monotone",
|
package/dist/sparkline.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/sparkline.tsx","../src/lib/cn.ts","../src/components/ui/chart.tsx","../src/components/ui/size-context.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport {\n\tArea,\n\tAreaChart,\n\tBar,\n\tBarChart,\n\tLine,\n\tLineChart,\n\tXAxis,\n} from \"recharts\";\nimport { cn } from \"../../lib/cn\";\nimport {\n\ttype ChartConfig,\n\tChartContainer,\n\tChartTooltip,\n\tChartTooltipContent,\n\ttype ChartValueType,\n} from \"./chart\";\nimport { type ComponentSize, useComponentSize } from \"./size-context\";\n\n/**\n * Small inline trend lines for KPI cards and dense tables — no axes, no\n * gridlines. Composed from recharts plot primitives (`Line`/`Area`/`Bar`) so it\n * shares one charting engine with `line-chart`/`bar-chart` and gets hover\n * tooltips for free via the shared `ChartTooltip`/`ChartTooltipContent`.\n *\n * Sizing follows the same convention as the other charts: `size` sets the height\n * (plus stroke/dot scale) and the width is parent-driven — the component is\n * `w-full`, so constrain it with a wrapper (the SPARKLINE_LAYOUT widths are the\n * recommended container sizes) or let it fill a KPI card.\n *\n * Sentiment colour is driven by the data direction — `status-success` for an\n * upward series, `status-danger` for downward, `text-secondary` for flat — and\n * can be overridden with `trend`. The area fill reuses the line colour at 14 %.\n *\n * Tokens:\n * - Stroke / fill — up: `var(--color-status-success)`, down:\n * `var(--color-status-danger)`, flat: `var(--color-fg-secondary)` (fed through\n * `ChartConfig` as `--color-value`)\n * - Area fill: the same colour at `0.14` opacity\n * - End-point dot ring: `var(--color-surface)` (separates the dot from the line)\n *\n * @example\n * // KPI card trend — colour follows the metric's sentiment automatically\n * <Sparkline data={[40, 44, 42, 55, 58, 62, 70]} type=\"area\" />\n *\n * @example\n * // Interactive — hover tooltip with currency formatting and month captions\n * <Sparkline data={values} tooltip label=\"Revenue\" valueType=\"currency\" labels={months} />\n *\n * @example\n * // Dense table cell — fixed-width wrapper, bar render, no marker\n * <span className=\"inline-block w-[72px]\">\n * <Sparkline data={values} type=\"bar\" size=\"sm\" showMarker={false} />\n * </span>\n */\n\n/** Sparkline sizes line up with the three shared `ComponentSize` values. */\ntype SparklineSize = ComponentSize;\n\n/** Render style for the series. */\ntype SparklineType = \"line\" | \"bar\" | \"area\";\n\n/** Sentiment of the series — drives the stroke/fill colour. */\ntype SparklineTrend = \"up\" | \"down\" | \"flat\";\n\ntype SparklineLayout = {\n\t/** Recommended container width in px (width is parent-driven). */\n\twidth: number;\n\t/** Plot height in px. */\n\theight: number;\n\t/** Line/area stroke width in px. */\n\tstrokeWidth: number;\n\t/** Radius of the end-point dot. */\n\tdotRadius: number;\n\t/** Outer margin — keeps the stroke, peaks, and end dot from clipping. */\n\tmargin: { top: number; right: number; bottom: number; left: number };\n\t/** Corner radius for bars. */\n\tbarRadius: number;\n\t/** Cap on bar thickness so stretched sparklines keep thin bars. */\n\tmaxBarSize: number;\n};\n\nconst SPARKLINE_LAYOUT: Record<SparklineSize, SparklineLayout> = {\n\tsm: {\n\t\twidth: 72,\n\t\theight: 24,\n\t\tstrokeWidth: 1.5,\n\t\tdotRadius: 2,\n\t\tmargin: { top: 4, right: 4, bottom: 2, left: 2 },\n\t\tbarRadius: 1,\n\t\tmaxBarSize: 6,\n\t},\n\tmd: {\n\t\twidth: 104,\n\t\theight: 32,\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 2.5,\n\t\tmargin: { top: 5, right: 5, bottom: 2, left: 2 },\n\t\tbarRadius: 2,\n\t\tmaxBarSize: 8,\n\t},\n\tlg: {\n\t\twidth: 144,\n\t\theight: 44,\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3,\n\t\tmargin: { top: 6, right: 6, bottom: 3, left: 3 },\n\t\tbarRadius: 2,\n\t\tmaxBarSize: 10,\n\t},\n};\n\nconst TREND_COLOR: Record<SparklineTrend, string> = {\n\tup: \"var(--color-status-success)\",\n\tdown: \"var(--color-status-danger)\",\n\tflat: \"var(--color-fg-secondary)\",\n};\n\n/**\n * Derive sentiment from the series: compare the last value to the first and\n * read flat when the change is a small fraction of the overall range.\n */\nfunction resolveTrend(data: number[]): SparklineTrend {\n\tif (data.length < 2) return \"flat\";\n\tconst first = data[0];\n\tconst last = data[data.length - 1];\n\tconst min = Math.min(...data);\n\tconst max = Math.max(...data);\n\tconst range = max - min || 1;\n\tconst delta = last - first;\n\tif (Math.abs(delta) / range < 0.05) return \"flat\";\n\treturn delta > 0 ? \"up\" : \"down\";\n}\n\n/**\n * Custom dot passed to recharts as `dot={<SparklineEndDot ... />}`. recharts\n * clones it for every point, injecting `cx`/`cy`/`index`; we only paint the\n * latest point so the series carries a single end-point marker.\n */\nfunction SparklineEndDot({\n\tcx,\n\tcy,\n\tindex,\n\tlastIndex,\n\tradius,\n}: {\n\tcx?: number;\n\tcy?: number;\n\tindex?: number;\n\tlastIndex?: number;\n\tradius?: number;\n}) {\n\tif (cx == null || cy == null || index !== lastIndex) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<circle\n\t\t\tcx={cx}\n\t\t\tcy={cy}\n\t\t\tr={radius}\n\t\t\tfill=\"var(--color-value)\"\n\t\t\tstroke=\"var(--color-surface)\"\n\t\t\tstrokeWidth={2}\n\t\t/>\n\t);\n}\n\n/**\n * Bars do not support `dot`, so the marker is rendered as part of a custom bar\n * shape. Only the latest bar receives the end-point marker.\n */\nfunction SparklineBarShape({\n\tx,\n\ty,\n\twidth,\n\theight,\n\tindex,\n\tvalue,\n\tlastIndex,\n\tradius,\n\tdotRadius,\n}: {\n\tx?: number;\n\ty?: number;\n\twidth?: number;\n\theight?: number;\n\tindex?: number;\n\tvalue?: number;\n\tlastIndex?: number;\n\tradius: number;\n\tdotRadius: number;\n}) {\n\tif (x == null || y == null || width == null || height == null) {\n\t\treturn null;\n\t}\n\n\tconst markerY = typeof value === \"number\" && value < 0 ? y + height : y;\n\n\treturn (\n\t\t<g>\n\t\t\t<rect\n\t\t\t\tx={x}\n\t\t\t\ty={y}\n\t\t\t\twidth={width}\n\t\t\t\theight={height}\n\t\t\t\trx={radius}\n\t\t\t\try={radius}\n\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t/>\n\t\t\t{index === lastIndex ? (\n\t\t\t\t<circle\n\t\t\t\t\tcx={x + width / 2}\n\t\t\t\t\tcy={markerY}\n\t\t\t\t\tr={dotRadius}\n\t\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t\t\tstroke=\"var(--color-surface)\"\n\t\t\t\t\tstrokeWidth={2}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</g>\n\t);\n}\n\ntype SparklineDatum = { x: string; value: number };\n\ntype SparklineProps = Omit<\n\tReact.ComponentProps<typeof ChartContainer>,\n\t\"config\" | \"children\"\n> & {\n\t/** The series to plot. Needs at least two points to draw a trend. */\n\tdata: number[];\n\t/** Render style. Defaults to `line`. */\n\ttype?: SparklineType;\n\t/** Explicit size; otherwise inherited from the nearest `SizeProvider`. */\n\tsize?: SparklineSize;\n\t/** Override the auto-detected sentiment colour. */\n\ttrend?: SparklineTrend;\n\t/** Show the filled marker on the latest value. Default true. */\n\tshowMarker?: boolean;\n\t/** Enable the hover tooltip. Default false. */\n\ttooltip?: boolean;\n\t/** Series name shown in the tooltip, e.g. \"Revenue\". */\n\tlabel?: string;\n\t/** Per-point captions for the tooltip (e.g. months). Indexed by data point. */\n\tlabels?: string[];\n\t/** Value formatting for the tooltip. Defaults to `number`. */\n\tvalueType?: ChartValueType;\n};\n\nfunction Sparkline({\n\tdata,\n\ttype = \"line\",\n\tsize,\n\ttrend,\n\tshowMarker = true,\n\ttooltip = false,\n\tlabel = \"Value\",\n\tlabels,\n\tvalueType = \"number\",\n\tclassName,\n\tstyle,\n\t...props\n}: SparklineProps) {\n\tconst layout = SPARKLINE_LAYOUT[useComponentSize(size)];\n\tconst resolvedTrend = trend ?? resolveTrend(data);\n\tconst color = TREND_COLOR[resolvedTrend];\n\n\tconst chartData: SparklineDatum[] = data.map((value, i) => ({\n\t\tx: labels?.[i] ?? `${i + 1}`,\n\t\tvalue,\n\t}));\n\tconst lastIndex = data.length - 1;\n\n\tconst config = {\n\t\tvalue: { label, color },\n\t} satisfies ChartConfig;\n\n\tconst showDot = showMarker && data.length >= 2;\n\tconst endDot = showDot ? (\n\t\t<SparklineEndDot lastIndex={lastIndex} radius={layout.dotRadius} />\n\t) : (\n\t\tfalse\n\t);\n\tconst barShape = showDot ? (\n\t\t<SparklineBarShape\n\t\t\tlastIndex={lastIndex}\n\t\t\tradius={layout.barRadius}\n\t\t\tdotRadius={layout.dotRadius}\n\t\t/>\n\t) : undefined;\n\tconst activeDot = tooltip\n\t\t? {\n\t\t\t\tr: layout.dotRadius + 0.5,\n\t\t\t\tfill: \"var(--color-value)\",\n\t\t\t\tstroke: \"var(--color-surface)\",\n\t\t\t\tstrokeWidth: 2,\n\t\t\t}\n\t\t: false;\n\n\tconst tooltipNode = tooltip ? (\n\t\t<ChartTooltip\n\t\t\tcursor={false}\n\t\t\tcontent={<ChartTooltipContent size=\"xs\" valueType={valueType} />}\n\t\t/>\n\t) : null;\n\n\tconst ariaLabel =\n\t\t(props[\"aria-label\"] as string | undefined) ??\n\t\t`${label} sparkline, trend ${resolvedTrend}`;\n\n\tif (data.length < 2) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...props}\n\t\t\t\taria-label={ariaLabel}\n\t\t\t\trole=\"img\"\n\t\t\t\tclassName={cn(\"w-full\", className)}\n\t\t\t\tstyle={{ height: layout.height, ...style }}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ChartContainer\n\t\t\t{...props}\n\t\t\taria-label={ariaLabel}\n\t\t\trole=\"img\"\n\t\t\tconfig={config}\n\t\t\tclassName={cn(\"aspect-auto w-full\", className)}\n\t\t\tstyle={{ height: layout.height, ...style }}\n\t\t>\n\t\t\t{type === \"bar\" ? (\n\t\t\t\t<BarChart accessibilityLayer data={chartData} margin={layout.margin}>\n\t\t\t\t\t{tooltipNode}\n\t\t\t\t\t<Bar\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t\t\t\tradius={layout.barRadius}\n\t\t\t\t\t\tmaxBarSize={layout.maxBarSize}\n\t\t\t\t\t\tshape={barShape}\n\t\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t\t/>\n\t\t\t\t</BarChart>\n\t\t\t) : type === \"area\" ? (\n\t\t\t\t<AreaChart accessibilityLayer data={chartData} margin={layout.margin}>\n\t\t\t\t\t{tooltip ? <XAxis dataKey=\"x\" hide /> : null}\n\t\t\t\t\t{tooltipNode}\n\t\t\t\t\t<Area\n\t\t\t\t\t\ttype=\"monotone\"\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tstroke=\"var(--color-value)\"\n\t\t\t\t\t\tstrokeWidth={layout.strokeWidth}\n\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t\t\t\tfillOpacity={0.14}\n\t\t\t\t\t\tdot={endDot}\n\t\t\t\t\t\tactiveDot={activeDot}\n\t\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t\t/>\n\t\t\t\t</AreaChart>\n\t\t\t) : (\n\t\t\t\t<LineChart accessibilityLayer data={chartData} margin={layout.margin}>\n\t\t\t\t\t{tooltip ? <XAxis dataKey=\"x\" hide /> : null}\n\t\t\t\t\t{tooltipNode}\n\t\t\t\t\t<Line\n\t\t\t\t\t\ttype=\"monotone\"\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tstroke=\"var(--color-value)\"\n\t\t\t\t\t\tstrokeWidth={layout.strokeWidth}\n\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\tdot={endDot}\n\t\t\t\t\t\tactiveDot={activeDot}\n\t\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t\t/>\n\t\t\t\t</LineChart>\n\t\t\t)}\n\t\t</ChartContainer>\n\t);\n}\n\nexport { Sparkline, SPARKLINE_LAYOUT };\nexport type { SparklineProps, SparklineSize, SparklineTrend, SparklineType };\n","import { type ClassValue, clsx } from \"clsx\";\nimport { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n\textend: {\n\t\tclassGroups: {\n\t\t\t\"font-size\": [\n\t\t\t\t{\n\t\t\t\t\ttext: [\n\t\t\t\t\t\t\"gdt-display\",\n\t\t\t\t\t\t\"gdt-h1\",\n\t\t\t\t\t\t\"gdt-h2\",\n\t\t\t\t\t\t\"gdt-h3\",\n\t\t\t\t\t\t\"gdt-h4\",\n\t\t\t\t\t\t\"gdt-h5\",\n\t\t\t\t\t\t\"gdt-xl\",\n\t\t\t\t\t\t\"gdt-lg\",\n\t\t\t\t\t\t\"gdt-md\",\n\t\t\t\t\t\t\"gdt-sm\",\n\t\t\t\t\t\t\"gdt-xs\",\n\t\t\t\t\t\t\"gdt-subtext\",\n\t\t\t\t\t\t\"gdt-capitalized\",\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n});\n\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport type { TooltipValueType } from \"recharts\";\nimport * as RechartsPrimitive from \"recharts\";\nimport { cn } from \"../../lib/cn\";\nimport {\n\ttype ComponentSize,\n\tSizeProvider,\n\tuseComponentSize,\n} from \"./size-context\";\n\n/**\n * Markers use `--color-surface-brand` as a placeholder. Giddaa has no\n * categorical chart palette yet — add `chart-1`…`chart-N` tokens and bind each\n * series (its legend marker and tooltip dot) to its own colour once they exist.\n * Until then any series without an explicit colour paints brand-green.\n */\nconst SERIES_COLOR_PLACEHOLDER = \"var(--color-surface-brand)\";\n\n/** How a precise value is formatted in the tooltip and which prefix/suffix it carries. */\nexport type ChartValueType = \"number\" | \"percentage\" | \"currency\";\n\nfunction formatChartValue(\n\tvalue: TooltipValueType | undefined,\n\ttype: ChartValueType,\n) {\n\tif (Array.isArray(value)) {\n\t\treturn value.join(\", \");\n\t}\n\n\tif (typeof value !== \"number\") {\n\t\treturn value == null ? \"\" : String(value);\n\t}\n\n\tswitch (type) {\n\t\tcase \"currency\":\n\t\t\treturn `₦${value.toLocaleString(\"en-NG\")}`;\n\t\tcase \"percentage\":\n\t\t\treturn `${value.toLocaleString(\"en-NG\", {\n\t\t\t\tminimumFractionDigits: 1,\n\t\t\t\tmaximumFractionDigits: 1,\n\t\t\t})}%`;\n\t\tdefault:\n\t\t\treturn value.toLocaleString(\"en-NG\");\n\t}\n}\n\n// Format: { THEME_NAME: CSS_SELECTOR }\nconst THEMES = { light: \"\", dark: \".dark\" } as const;\n\nconst INITIAL_DIMENSION = { width: 320, height: 200 } as const;\ntype TooltipNameType = number | string;\n\nexport type ChartConfig = Record<\n\tstring,\n\t{\n\t\tlabel?: React.ReactNode;\n\t\ticon?: React.ComponentType;\n\t} & (\n\t\t| { color?: string; theme?: never }\n\t\t| { color?: never; theme: Record<keyof typeof THEMES, string> }\n\t)\n>;\n\ntype ChartContextProps = {\n\tconfig: ChartConfig;\n};\n\nconst ChartContext = React.createContext<ChartContextProps | null>(null);\n\nfunction useChart() {\n\tconst context = React.useContext(ChartContext);\n\n\tif (!context) {\n\t\tthrow new Error(\"useChart must be used within a <ChartContainer />\");\n\t}\n\n\treturn context;\n}\n\n/**\n * Shared chart frame — the chrome that surrounds the plot of any chart type\n * (bar, line, area, pie). These are presentational, domain-free, and size-aware:\n * a `size` flows through `SizeProvider` so the plot and its labels can scale\n * with the card. Compose them with the plot primitives:\n *\n * <ChartCard size=\"md\">\n * <ChartHeader>\n * <ChartTitle>Revenue Overview</ChartTitle>\n * <ChartDescription>Monthly revenue · Jan–Jul</ChartDescription>\n * </ChartHeader>\n * <ChartContainer config={config}>{/* recharts plot *\\/}</ChartContainer>\n * </ChartCard>\n */\nconst chartCardVariants = cva(\n\t\"flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: \"gap-3 p-4\",\n\t\t\t\tmd: \"gap-4 p-5\",\n\t\t\t\tlg: \"gap-5 p-6\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { size: \"md\" },\n\t},\n);\n\nfunction ChartCard({\n\tclassName,\n\tsize,\n\tchildren,\n\t...props\n}: React.ComponentProps<\"section\"> & { size?: ComponentSize }) {\n\tconst resolvedSize = useComponentSize(size);\n\n\treturn (\n\t\t<SizeProvider size={resolvedSize}>\n\t\t\t<section\n\t\t\t\tdata-slot=\"chart-card\"\n\t\t\t\tclassName={cn(chartCardVariants({ size: resolvedSize }), className)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</section>\n\t\t</SizeProvider>\n\t);\n}\n\nfunction ChartHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"chart-header\"\n\t\t\tclassName={cn(\"flex min-w-0 flex-col gap-1\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst chartTitleVariants = cva(\"min-w-0 font-bold text-fg-primary\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"text-gdt-md\",\n\t\t\tmd: \"text-gdt-lg\",\n\t\t\tlg: \"text-gdt-h5\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nfunction ChartTitle({\n\tclassName,\n\tsize,\n\t...props\n}: React.ComponentProps<\"h3\"> & { size?: ComponentSize }) {\n\tconst resolvedSize = useComponentSize(size);\n\n\treturn (\n\t\t<h3\n\t\t\tdata-slot=\"chart-title\"\n\t\t\tclassName={cn(chartTitleVariants({ size: resolvedSize }), className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst chartDescriptionVariants = cva(\"min-w-0 font-normal text-fg-secondary\", {\n\tvariants: {\n\t\tsize: {\n\t\t\tsm: \"text-gdt-xs\",\n\t\t\tmd: \"text-gdt-sm\",\n\t\t\tlg: \"text-gdt-sm\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nfunction ChartDescription({\n\tclassName,\n\tsize,\n\t...props\n}: React.ComponentProps<\"p\"> & { size?: ComponentSize }) {\n\tconst resolvedSize = useComponentSize(size);\n\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"chart-description\"\n\t\t\tclassName={cn(\n\t\t\t\tchartDescriptionVariants({ size: resolvedSize }),\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nfunction ChartContainer({\n\tid,\n\tclassName,\n\tchildren,\n\tconfig,\n\tinitialDimension = INITIAL_DIMENSION,\n\t...props\n}: React.ComponentProps<\"div\"> & {\n\tconfig: ChartConfig;\n\tchildren: React.ComponentProps<\n\t\ttypeof RechartsPrimitive.ResponsiveContainer\n\t>[\"children\"];\n\tinitialDimension?: {\n\t\twidth: number;\n\t\theight: number;\n\t};\n}) {\n\tconst uniqueId = React.useId();\n\tconst chartId = `chart-${id ?? uniqueId.replace(/:/g, \"\")}`;\n\n\treturn (\n\t\t<ChartContext.Provider value={{ config }}>\n\t\t\t<div\n\t\t\t\tdata-slot=\"chart\"\n\t\t\t\tdata-chart={chartId}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-hidden [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector]:outline-hidden [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-surface]:outline-hidden\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<ChartStyle id={chartId} config={config} />\n\t\t\t\t<RechartsPrimitive.ResponsiveContainer\n\t\t\t\t\tinitialDimension={initialDimension}\n\t\t\t\t>\n\t\t\t\t\t{children}\n\t\t\t\t</RechartsPrimitive.ResponsiveContainer>\n\t\t\t</div>\n\t\t</ChartContext.Provider>\n\t);\n}\n\nconst ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {\n\tconst colorConfig = Object.entries(config).filter(\n\t\t([, config]) => config.theme ?? config.color,\n\t);\n\n\tif (!colorConfig.length) {\n\t\treturn null;\n\t}\n\n\tconst styleContent = Object.entries(THEMES)\n\t\t.map(\n\t\t\t([theme, prefix]) => `\n${prefix} [data-chart=${id}] {\n${colorConfig\n\t.map(([key, itemConfig]) => {\n\t\tconst color =\n\t\t\titemConfig.theme?.[theme as keyof typeof itemConfig.theme] ??\n\t\t\titemConfig.color;\n\t\treturn color ? ` --color-${key}: ${color};` : null;\n\t})\n\t.join(\"\\n\")}\n}\n`,\n\t\t)\n\t\t.join(\"\\n\");\n\n\treturn <style>{styleContent}</style>;\n};\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\n/**\n * Hover tooltip for a chart data point. It surfaces a single precise value with\n * type-appropriate formatting — grouped integers, percentages, or ₦-prefixed\n * currency — sitting on an elevated overlay (bg-surface-overlay, Shadow-2,\n * 1px border-subtle) so users can read exact figures without leaving the chart.\n *\n * Anatomy: series dot · metric label · hero value · period caption.\n */\nconst chartTooltipVariants = cva(\n\t\"flex flex-col bg-surface-overlay border border-line-subtle shadow-2\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\txs: \"gap-0.5 rounded-md p-2\",\n\t\t\t\tsm: \"gap-0.5 rounded-md p-2.5\",\n\t\t\t\tmd: \"gap-1 rounded-lg p-3\",\n\t\t\t\tlg: \"gap-1 rounded-xl p-3.5\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tsize: \"md\",\n\t\t},\n\t},\n);\n\nconst chartTooltipDotVariants = cva(\"shrink-0 rounded-full\", {\n\tvariants: {\n\t\tsize: {\n\t\t\txs: \"size-1.5\",\n\t\t\tsm: \"size-2\",\n\t\t\tmd: \"size-2.5\",\n\t\t\tlg: \"size-2.5\",\n\t\t},\n\t},\n\tdefaultVariants: {\n\t\tsize: \"md\",\n\t},\n});\n\nconst chartTooltipLabelVariants = cva(\"font-medium text-fg-secondary\", {\n\tvariants: {\n\t\tsize: {\n\t\t\txs: \"text-gdt-xs\",\n\t\t\tsm: \"text-gdt-xs\",\n\t\t\tmd: \"text-gdt-sm\",\n\t\t\tlg: \"text-gdt-sm\",\n\t\t},\n\t},\n\tdefaultVariants: { size: \"md\" },\n});\n\nconst chartTooltipValueVariants = cva(\n\t\"font-extrabold text-fg-primary tabular-nums\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\txs: \"text-gdt-sm\",\n\t\t\t\tsm: \"text-gdt-md\",\n\t\t\t\tmd: \"text-gdt-lg\",\n\t\t\t\tlg: \"text-gdt-xl\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: { size: \"md\" },\n\t},\n);\n\nfunction ChartTooltipContent({\n\tactive,\n\tpayload,\n\tclassName,\n\thideIndicator = false,\n\tlabel,\n\tlabelFormatter,\n\tformatter,\n\tcolor,\n\tnameKey,\n\tvalueType = \"number\",\n\tsize = \"md\",\n}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &\n\tReact.ComponentProps<\"div\"> & {\n\t\thideIndicator?: boolean;\n\t\tnameKey?: string;\n\t\tvalueType?: ChartValueType;\n\t} & VariantProps<typeof chartTooltipVariants> &\n\tOmit<\n\t\tRechartsPrimitive.DefaultTooltipContentProps<\n\t\t\tTooltipValueType,\n\t\t\tTooltipNameType\n\t\t>,\n\t\t\"accessibilityLayer\"\n\t>) {\n\tconst { config } = useChart();\n\n\tif (!active || !payload?.length) {\n\t\treturn null;\n\t}\n\n\tconst [item] = payload.filter((entry) => entry.type !== \"none\");\n\n\tif (!item) {\n\t\treturn null;\n\t}\n\n\tconst key = `${nameKey ?? item.name ?? item.dataKey ?? \"value\"}`;\n\tconst itemConfig = getPayloadConfigFromPayload(config, item, key);\n\tconst dotColor =\n\t\tcolor ?? item.payload?.fill ?? item.color ?? SERIES_COLOR_PLACEHOLDER;\n\n\t// Metric label — the short name of the series being read, e.g. \"Total Revenue\".\n\tconst metricLabel = itemConfig?.label ?? item.name;\n\t// Hero value — the precise, formatted figure, the visual focus of the tooltip.\n\tconst heroValue = formatter\n\t\t? formatter(item.value, item.name ?? \"\", item, 0, item.payload)\n\t\t: formatChartValue(item.value, valueType);\n\t// Period caption — the time context for the value, e.g. \"March 2026\".\n\tconst periodCaption = labelFormatter\n\t\t? labelFormatter(label, payload)\n\t\t: ((typeof label === \"string\" ? config[label]?.label : null) ?? label);\n\n\treturn (\n\t\t<div className={cn(chartTooltipVariants({ size }), className)}>\n\t\t\t{metricLabel != null && (\n\t\t\t\t<div className=\"flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:shrink-0\">\n\t\t\t\t\t{!hideIndicator &&\n\t\t\t\t\t\t(itemConfig?.icon ? (\n\t\t\t\t\t\t\t<itemConfig.icon />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\tclassName={cn(chartTooltipDotVariants({ size }))}\n\t\t\t\t\t\t\t\tstyle={{ backgroundColor: dotColor }}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t<span className={cn(chartTooltipLabelVariants({ size }))}>\n\t\t\t\t\t\t{metricLabel}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<p className={cn(chartTooltipValueVariants({ size }))}>{heroValue}</p>\n\t\t\t{periodCaption != null && periodCaption !== \"\" && (\n\t\t\t\t<p className=\"text-gdt-xs text-fg-caption-placeholder\">\n\t\t\t\t\t{periodCaption}\n\t\t\t\t</p>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\n/** Marker shape that ties a legend item to its series. */\ntype ChartLegendMarker = \"dot\" | \"square\" | \"line\";\n\nconst chartLegendItemVariants = cva(\n\t\"group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0\",\n\t{\n\t\tvariants: {\n\t\t\tsize: {\n\t\t\t\tsm: \"gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3\",\n\t\t\t\tmd: \"gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5\",\n\t\t\t},\n\t\t\tinteractive: {\n\t\t\t\ttrue: \"cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised\",\n\t\t\t\tfalse: \"\",\n\t\t\t},\n\t\t\tinactive: {\n\t\t\t\ttrue: \"text-fg-caption-placeholder line-through\",\n\t\t\t\tfalse: \"\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tsize: \"md\",\n\t\t\tinteractive: false,\n\t\t\tinactive: false,\n\t\t},\n\t},\n);\n\nconst chartLegendMarkerSizeVariants = cva(\"shrink-0\", {\n\tvariants: {\n\t\tmarker: {\n\t\t\tdot: \"rounded-full\",\n\t\t\tsquare: \"rounded-[2px]\",\n\t\t\tline: \"rounded-full\",\n\t\t},\n\t\tsize: {\n\t\t\tsm: \"\",\n\t\t\tmd: \"\",\n\t\t},\n\t},\n\tcompoundVariants: [\n\t\t{ marker: [\"dot\", \"square\"], size: \"sm\", className: \"size-2\" },\n\t\t{ marker: [\"dot\", \"square\"], size: \"md\", className: \"size-2.5\" },\n\t\t{ marker: \"line\", size: \"sm\", className: \"h-[3px] w-3\" },\n\t\t{ marker: \"line\", size: \"md\", className: \"h-[3px] w-3.5\" },\n\t],\n\tdefaultVariants: { marker: \"dot\", size: \"md\" },\n});\n\n/**\n * A shared legend for all chart types. Each item pairs a series marker with a\n * label and can be toggled to hide or show its series — the inactive state mutes\n * the marker and strikes through the label. Items compose into horizontal rows\n * or vertical columns, in two sizes, with dot, square, or line markers.\n *\n * Toggling: pass `onToggle` to make items interactive. Inactive items are read\n * from each payload entry's `inactive` flag (recharts sets this when wired) or\n * the controlled `inactiveKeys` set.\n */\nfunction ChartLegendContent({\n\tclassName,\n\thideIcon = false,\n\tpayload,\n\tverticalAlign = \"bottom\",\n\tnameKey,\n\tmarker = \"dot\",\n\tsize = \"md\",\n\torientation = \"horizontal\",\n\tinactiveKeys,\n\tonToggle,\n}: React.ComponentProps<\"div\"> & {\n\thideIcon?: boolean;\n\tnameKey?: string;\n\tmarker?: ChartLegendMarker;\n\tsize?: \"sm\" | \"md\";\n\torientation?: \"horizontal\" | \"vertical\";\n\tinactiveKeys?: Iterable<string>;\n\tonToggle?: (key: string) => void;\n} & RechartsPrimitive.DefaultLegendContentProps) {\n\tconst { config } = useChart();\n\n\tif (!payload?.length) {\n\t\treturn null;\n\t}\n\n\tconst inactiveSet = inactiveKeys ? new Set(inactiveKeys) : undefined;\n\tconst interactive = Boolean(onToggle);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t\"flex\",\n\t\t\t\torientation === \"vertical\"\n\t\t\t\t\t? \"flex-col items-start gap-0.5\"\n\t\t\t\t\t: \"flex-row flex-wrap items-center justify-center gap-x-1 gap-y-0.5\",\n\t\t\t\tverticalAlign === \"top\" ? \"pb-3\" : \"pt-3\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t>\n\t\t\t{payload\n\t\t\t\t.filter((item) => item.type !== \"none\")\n\t\t\t\t.map((item, index) => {\n\t\t\t\t\tconst key = `${nameKey ?? item.dataKey ?? \"value\"}`;\n\t\t\t\t\tconst itemKey = `${item.dataKey ?? item.value ?? index}`;\n\t\t\t\t\tconst itemConfig = getPayloadConfigFromPayload(config, item, key);\n\t\t\t\t\tconst inactive =\n\t\t\t\t\t\t(inactiveSet?.has(key) ?? false) || Boolean(item.inactive);\n\t\t\t\t\tconst markerColor = inactive\n\t\t\t\t\t\t? \"var(--color-fg-caption-placeholder)\"\n\t\t\t\t\t\t: (item.color ?? SERIES_COLOR_PLACEHOLDER);\n\n\t\t\t\t\tconst content = (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{itemConfig?.icon && !hideIcon ? (\n\t\t\t\t\t\t\t\t<itemConfig.icon />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\tchartLegendMarkerSizeVariants({ marker, size }),\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\tstyle={{ backgroundColor: markerColor }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{itemConfig?.label ?? item.value}\n\t\t\t\t\t\t</>\n\t\t\t\t\t);\n\n\t\t\t\t\tif (interactive) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={itemKey}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\taria-pressed={!inactive}\n\t\t\t\t\t\t\t\tonClick={() => onToggle?.(key)}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\tchartLegendItemVariants({ size, interactive, inactive }),\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{content}\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={itemKey}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\tchartLegendItemVariants({ size, interactive, inactive }),\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{content}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t</div>\n\t);\n}\n\n/** The size-scaled layout numbers a cartesian chart needs to build axis props. */\ntype CartesianAxisLayout = {\n\ttickMargin: number;\n\ttickFontSize: number;\n\tyAxisWidth: number;\n};\n\n/**\n * Shared `<XAxis>`/`<YAxis>` props — the giddaa cartesian-axis defaults (no tick\n * or axis lines, a size-scaled tick font, and a reserved value-axis width) that\n * every bar and line chart would otherwise repeat per axis. Spread the result\n * onto the recharts axis, then add the chart-specific props (`dataKey`,\n * `domain`, `ticks`, a `width`/`type` override, …):\n *\n * const chart = useBarChartLayout();\n * <XAxis dataKey=\"month\" {...chart.xAxis} />\n * <YAxis domain={[0, 120]} {...chart.yAxis} />\n */\nfunction cartesianAxisProps(layout: CartesianAxisLayout) {\n\tconst tick = { fontSize: layout.tickFontSize };\n\treturn {\n\t\txAxis: {\n\t\t\ttickLine: false,\n\t\t\taxisLine: false,\n\t\t\ttickMargin: layout.tickMargin,\n\t\t\ttick,\n\t\t},\n\t\tyAxis: {\n\t\t\ttickLine: false,\n\t\t\taxisLine: false,\n\t\t\twidth: layout.yAxisWidth,\n\t\t\ttick,\n\t\t},\n\t} as const;\n}\n\nfunction getPayloadConfigFromPayload(\n\tconfig: ChartConfig,\n\tpayload: unknown,\n\tkey: string,\n) {\n\tif (typeof payload !== \"object\" || payload === null) {\n\t\treturn undefined;\n\t}\n\n\tconst payloadPayload =\n\t\t\"payload\" in payload &&\n\t\ttypeof payload.payload === \"object\" &&\n\t\tpayload.payload !== null\n\t\t\t? payload.payload\n\t\t\t: undefined;\n\n\tlet configLabelKey: string = key;\n\n\tif (\n\t\tkey in payload &&\n\t\ttypeof payload[key as keyof typeof payload] === \"string\"\n\t) {\n\t\tconfigLabelKey = payload[key as keyof typeof payload] as string;\n\t} else if (\n\t\tpayloadPayload &&\n\t\tkey in payloadPayload &&\n\t\ttypeof payloadPayload[key as keyof typeof payloadPayload] === \"string\"\n\t) {\n\t\tconfigLabelKey = payloadPayload[\n\t\t\tkey as keyof typeof payloadPayload\n\t\t] as string;\n\t}\n\n\treturn configLabelKey in config ? config[configLabelKey] : config[key];\n}\n\nexport {\n\tcartesianAxisProps,\n\tChartCard,\n\tChartContainer,\n\tChartDescription,\n\tChartHeader,\n\tChartLegend,\n\tChartLegendContent,\n\tChartStyle,\n\tChartTitle,\n\tChartTooltip,\n\tChartTooltipContent,\n};\nexport type { CartesianAxisLayout };\n","\"use client\";\n\nimport { createContext, type ReactNode, useContext } from \"react\";\n\ntype ComponentSize = \"sm\" | \"md\" | \"lg\";\n\nconst SizeContext = createContext<ComponentSize | undefined>(undefined);\n\nfunction SizeProvider({\n\tchildren,\n\tsize,\n}: {\n\tchildren: ReactNode;\n\tsize?: ComponentSize | null;\n}) {\n\tif (!size) {\n\t\treturn <>{children}</>;\n\t}\n\n\treturn <SizeContext.Provider value={size}>{children}</SizeContext.Provider>;\n}\n\nfunction useComponentSize(\n\tsize?: ComponentSize | null,\n\tfallback: ComponentSize = \"md\",\n) {\n\tconst inheritedSize = useContext(SizeContext);\n\treturn size ?? inheritedSize ?? fallback;\n}\n\nexport { SizeProvider, useComponentSize, type ComponentSize };\n"],"mappings":";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;;;ACXP,SAA0B,YAAY;AACtC,SAAS,2BAA2B;AAEpC,IAAM,UAAU,oBAAoB;AAAA,EACnC,QAAQ;AAAA,IACP,aAAa;AAAA,MACZ,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,YACL;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAEM,SAAS,MAAM,QAAsB;AAC3C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC5B;;;AC7BA,SAAS,WAA8B;AACvC,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,gBAAAA;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,QAAO;AAAA,YACP,aAAa,OAAO;AAAA,YACpB,gBAAe;AAAA,YACf,eAAc;AAAA,YACd,KAAK;AAAA,YACL;AAAA,YACA,mBAAmB;AAAA;AAAA,QACpB;AAAA,SACD;AAAA;AAAA,EAEF;AAEF;","names":["Fragment","jsx","jsx","config","jsx","jsxs"]}
|
|
1
|
+
{"version":3,"sources":["../src/sparkline.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport {\n\tArea,\n\tAreaChart,\n\tBar,\n\tBarChart,\n\tLine,\n\tLineChart,\n\tXAxis,\n} from \"recharts\";\nimport {\n\ttype ChartConfig,\n\tChartContainer,\n\tChartTooltip,\n\tChartTooltipContent,\n\ttype ChartValueType,\n} from \"./chart\";\nimport { cn } from \"./lib/cn\";\nimport { type ComponentSize, useComponentSize } from \"./size-context\";\n\n/**\n * Small inline trend lines for KPI cards and dense tables — no axes, no\n * gridlines. Composed from recharts plot primitives (`Line`/`Area`/`Bar`) so it\n * shares one charting engine with `line-chart`/`bar-chart` and gets hover\n * tooltips for free via the shared `ChartTooltip`/`ChartTooltipContent`.\n *\n * Sizing follows the same convention as the other charts: `size` sets the height\n * (plus stroke/dot scale) and the width is parent-driven — the component is\n * `w-full`, so constrain it with a wrapper (the SPARKLINE_LAYOUT widths are the\n * recommended container sizes) or let it fill a KPI card.\n *\n * Sentiment colour is driven by the data direction — `status-success` for an\n * upward series, `status-danger` for downward, `text-secondary` for flat — and\n * can be overridden with `trend`. The area fill reuses the line colour at 14 %.\n *\n * Tokens:\n * - Stroke / fill — up: `var(--color-status-success)`, down:\n * `var(--color-status-danger)`, flat: `var(--color-fg-secondary)` (fed through\n * `ChartConfig` as `--color-value`)\n * - Area fill: the same colour at `0.14` opacity\n * - End-point dot ring: `var(--color-surface)` (separates the dot from the line)\n *\n * @example\n * // KPI card trend — colour follows the metric's sentiment automatically\n * <Sparkline data={[40, 44, 42, 55, 58, 62, 70]} type=\"area\" />\n *\n * @example\n * // Interactive — hover tooltip with currency formatting and month captions\n * <Sparkline data={values} tooltip label=\"Revenue\" valueType=\"currency\" labels={months} />\n *\n * @example\n * // Dense table cell — fixed-width wrapper, bar render, no marker\n * <span className=\"inline-block w-[72px]\">\n * <Sparkline data={values} type=\"bar\" size=\"sm\" showMarker={false} />\n * </span>\n */\n\n/** Sparkline sizes line up with the three shared `ComponentSize` values. */\ntype SparklineSize = ComponentSize;\n\n/** Render style for the series. */\ntype SparklineType = \"line\" | \"bar\" | \"area\";\n\n/** Sentiment of the series — drives the stroke/fill colour. */\ntype SparklineTrend = \"up\" | \"down\" | \"flat\";\n\ntype SparklineLayout = {\n\t/** Recommended container width in px (width is parent-driven). */\n\twidth: number;\n\t/** Plot height in px. */\n\theight: number;\n\t/** Line/area stroke width in px. */\n\tstrokeWidth: number;\n\t/** Radius of the end-point dot. */\n\tdotRadius: number;\n\t/** Outer margin — keeps the stroke, peaks, and end dot from clipping. */\n\tmargin: { top: number; right: number; bottom: number; left: number };\n\t/** Corner radius for bars. */\n\tbarRadius: number;\n\t/** Cap on bar thickness so stretched sparklines keep thin bars. */\n\tmaxBarSize: number;\n};\n\nconst SPARKLINE_LAYOUT: Record<SparklineSize, SparklineLayout> = {\n\tsm: {\n\t\twidth: 72,\n\t\theight: 24,\n\t\tstrokeWidth: 1.5,\n\t\tdotRadius: 2,\n\t\tmargin: { top: 4, right: 4, bottom: 2, left: 2 },\n\t\tbarRadius: 1,\n\t\tmaxBarSize: 6,\n\t},\n\tmd: {\n\t\twidth: 104,\n\t\theight: 32,\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 2.5,\n\t\tmargin: { top: 5, right: 5, bottom: 2, left: 2 },\n\t\tbarRadius: 2,\n\t\tmaxBarSize: 8,\n\t},\n\tlg: {\n\t\twidth: 144,\n\t\theight: 44,\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3,\n\t\tmargin: { top: 6, right: 6, bottom: 3, left: 3 },\n\t\tbarRadius: 2,\n\t\tmaxBarSize: 10,\n\t},\n};\n\nconst TREND_COLOR: Record<SparklineTrend, string> = {\n\tup: \"var(--color-status-success)\",\n\tdown: \"var(--color-status-danger)\",\n\tflat: \"var(--color-fg-secondary)\",\n};\n\n/**\n * Derive sentiment from the series: compare the last value to the first and\n * read flat when the change is a small fraction of the overall range.\n */\nfunction resolveTrend(data: number[]): SparklineTrend {\n\tif (data.length < 2) return \"flat\";\n\tconst first = data[0];\n\tconst last = data[data.length - 1];\n\tconst min = Math.min(...data);\n\tconst max = Math.max(...data);\n\tconst range = max - min || 1;\n\tconst delta = last - first;\n\tif (Math.abs(delta) / range < 0.05) return \"flat\";\n\treturn delta > 0 ? \"up\" : \"down\";\n}\n\n/**\n * Custom dot passed to recharts as `dot={<SparklineEndDot ... />}`. recharts\n * clones it for every point, injecting `cx`/`cy`/`index`; we only paint the\n * latest point so the series carries a single end-point marker.\n */\nfunction SparklineEndDot({\n\tcx,\n\tcy,\n\tindex,\n\tlastIndex,\n\tradius,\n}: {\n\tcx?: number;\n\tcy?: number;\n\tindex?: number;\n\tlastIndex?: number;\n\tradius?: number;\n}) {\n\tif (cx == null || cy == null || index !== lastIndex) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<circle\n\t\t\tcx={cx}\n\t\t\tcy={cy}\n\t\t\tr={radius}\n\t\t\tfill=\"var(--color-value)\"\n\t\t\tstroke=\"var(--color-surface)\"\n\t\t\tstrokeWidth={2}\n\t\t/>\n\t);\n}\n\n/**\n * Bars do not support `dot`, so the marker is rendered as part of a custom bar\n * shape. Only the latest bar receives the end-point marker.\n */\nfunction SparklineBarShape({\n\tx,\n\ty,\n\twidth,\n\theight,\n\tindex,\n\tvalue,\n\tlastIndex,\n\tradius,\n\tdotRadius,\n}: {\n\tx?: number;\n\ty?: number;\n\twidth?: number;\n\theight?: number;\n\tindex?: number;\n\tvalue?: number;\n\tlastIndex?: number;\n\tradius: number;\n\tdotRadius: number;\n}) {\n\tif (x == null || y == null || width == null || height == null) {\n\t\treturn null;\n\t}\n\n\tconst markerY = typeof value === \"number\" && value < 0 ? y + height : y;\n\n\treturn (\n\t\t<g>\n\t\t\t<rect\n\t\t\t\tx={x}\n\t\t\t\ty={y}\n\t\t\t\twidth={width}\n\t\t\t\theight={height}\n\t\t\t\trx={radius}\n\t\t\t\try={radius}\n\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t/>\n\t\t\t{index === lastIndex ? (\n\t\t\t\t<circle\n\t\t\t\t\tcx={x + width / 2}\n\t\t\t\t\tcy={markerY}\n\t\t\t\t\tr={dotRadius}\n\t\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t\t\tstroke=\"var(--color-surface)\"\n\t\t\t\t\tstrokeWidth={2}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</g>\n\t);\n}\n\ntype SparklineDatum = { x: string; value: number };\n\ntype SparklineProps = Omit<\n\tReact.ComponentProps<typeof ChartContainer>,\n\t\"config\" | \"children\"\n> & {\n\t/** The series to plot. Needs at least two points to draw a trend. */\n\tdata: number[];\n\t/** Render style. Defaults to `line`. */\n\ttype?: SparklineType;\n\t/** Explicit size; otherwise inherited from the nearest `SizeProvider`. */\n\tsize?: SparklineSize;\n\t/** Override the auto-detected sentiment colour. */\n\ttrend?: SparklineTrend;\n\t/** Show the filled marker on the latest value. Default true. */\n\tshowMarker?: boolean;\n\t/** Enable the hover tooltip. Default false. */\n\ttooltip?: boolean;\n\t/** Series name shown in the tooltip, e.g. \"Revenue\". */\n\tlabel?: string;\n\t/** Per-point captions for the tooltip (e.g. months). Indexed by data point. */\n\tlabels?: string[];\n\t/** Value formatting for the tooltip. Defaults to `number`. */\n\tvalueType?: ChartValueType;\n};\n\nfunction Sparkline({\n\tdata,\n\ttype = \"line\",\n\tsize,\n\ttrend,\n\tshowMarker = true,\n\ttooltip = false,\n\tlabel = \"Value\",\n\tlabels,\n\tvalueType = \"number\",\n\tclassName,\n\tstyle,\n\t...props\n}: SparklineProps) {\n\tconst layout = SPARKLINE_LAYOUT[useComponentSize(size)];\n\tconst resolvedTrend = trend ?? resolveTrend(data);\n\tconst color = TREND_COLOR[resolvedTrend];\n\n\tconst chartData: SparklineDatum[] = data.map((value, i) => ({\n\t\tx: labels?.[i] ?? `${i + 1}`,\n\t\tvalue,\n\t}));\n\tconst lastIndex = data.length - 1;\n\n\tconst config = {\n\t\tvalue: { label, color },\n\t} satisfies ChartConfig;\n\n\tconst showDot = showMarker && data.length >= 2;\n\tconst endDot = showDot ? (\n\t\t<SparklineEndDot lastIndex={lastIndex} radius={layout.dotRadius} />\n\t) : (\n\t\tfalse\n\t);\n\tconst barShape = showDot ? (\n\t\t<SparklineBarShape\n\t\t\tlastIndex={lastIndex}\n\t\t\tradius={layout.barRadius}\n\t\t\tdotRadius={layout.dotRadius}\n\t\t/>\n\t) : undefined;\n\tconst activeDot = tooltip\n\t\t? {\n\t\t\t\tr: layout.dotRadius + 0.5,\n\t\t\t\tfill: \"var(--color-value)\",\n\t\t\t\tstroke: \"var(--color-surface)\",\n\t\t\t\tstrokeWidth: 2,\n\t\t\t}\n\t\t: false;\n\n\tconst tooltipNode = tooltip ? (\n\t\t<ChartTooltip\n\t\t\tcursor={false}\n\t\t\tcontent={<ChartTooltipContent size=\"xs\" valueType={valueType} />}\n\t\t/>\n\t) : null;\n\n\tconst ariaLabel =\n\t\t(props[\"aria-label\"] as string | undefined) ??\n\t\t`${label} sparkline, trend ${resolvedTrend}`;\n\n\tif (data.length < 2) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...props}\n\t\t\t\taria-label={ariaLabel}\n\t\t\t\trole=\"img\"\n\t\t\t\tclassName={cn(\"w-full\", className)}\n\t\t\t\tstyle={{ height: layout.height, ...style }}\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ChartContainer\n\t\t\t{...props}\n\t\t\taria-label={ariaLabel}\n\t\t\trole=\"img\"\n\t\t\tconfig={config}\n\t\t\tclassName={cn(\"aspect-auto w-full\", className)}\n\t\t\tstyle={{ height: layout.height, ...style }}\n\t\t>\n\t\t\t{type === \"bar\" ? (\n\t\t\t\t<BarChart accessibilityLayer data={chartData} margin={layout.margin}>\n\t\t\t\t\t{tooltipNode}\n\t\t\t\t\t<Bar\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t\t\t\tradius={layout.barRadius}\n\t\t\t\t\t\tmaxBarSize={layout.maxBarSize}\n\t\t\t\t\t\tshape={barShape}\n\t\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t\t/>\n\t\t\t\t</BarChart>\n\t\t\t) : type === \"area\" ? (\n\t\t\t\t<AreaChart accessibilityLayer data={chartData} margin={layout.margin}>\n\t\t\t\t\t{tooltip ? <XAxis dataKey=\"x\" hide /> : null}\n\t\t\t\t\t{tooltipNode}\n\t\t\t\t\t<Area\n\t\t\t\t\t\ttype=\"monotone\"\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tstroke=\"var(--color-value)\"\n\t\t\t\t\t\tstrokeWidth={layout.strokeWidth}\n\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\tfill=\"var(--color-value)\"\n\t\t\t\t\t\tfillOpacity={0.14}\n\t\t\t\t\t\tdot={endDot}\n\t\t\t\t\t\tactiveDot={activeDot}\n\t\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t\t/>\n\t\t\t\t</AreaChart>\n\t\t\t) : (\n\t\t\t\t<LineChart accessibilityLayer data={chartData} margin={layout.margin}>\n\t\t\t\t\t{tooltip ? <XAxis dataKey=\"x\" hide /> : null}\n\t\t\t\t\t{tooltipNode}\n\t\t\t\t\t<Line\n\t\t\t\t\t\ttype=\"monotone\"\n\t\t\t\t\t\tdataKey=\"value\"\n\t\t\t\t\t\tstroke=\"var(--color-value)\"\n\t\t\t\t\t\tstrokeWidth={layout.strokeWidth}\n\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\t\t\tdot={endDot}\n\t\t\t\t\t\tactiveDot={activeDot}\n\t\t\t\t\t\tisAnimationActive={false}\n\t\t\t\t\t/>\n\t\t\t\t</LineChart>\n\t\t\t)}\n\t\t</ChartContainer>\n\t);\n}\n\nexport { Sparkline, SPARKLINE_LAYOUT };\nexport type { SparklineProps, SparklineSize, SparklineTrend, SparklineType };\n"],"mappings":";;;;;;;;;;;;;;AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAoJL,cA2CA,YA3CA;AA1EF,IAAM,mBAA2D;AAAA,EAChE,IAAI;AAAA,IACH,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,WAAW;AAAA,IACX,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAE;AAAA,IAC/C,WAAW;AAAA,IACX,YAAY;AAAA,EACb;AAAA,EACA,IAAI;AAAA,IACH,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,WAAW;AAAA,IACX,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAE;AAAA,IAC/C,WAAW;AAAA,IACX,YAAY;AAAA,EACb;AAAA,EACA,IAAI;AAAA,IACH,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,WAAW;AAAA,IACX,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAE;AAAA,IAC/C,WAAW;AAAA,IACX,YAAY;AAAA,EACb;AACD;AAEA,IAAM,cAA8C;AAAA,EACnD,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AACP;AAMA,SAAS,aAAa,MAAgC;AACrD,MAAI,KAAK,SAAS,EAAG,QAAO;AA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,YACf,eAAc;AAAA,YACd,KAAK;AAAA,YACL;AAAA,YACA,mBAAmB;AAAA;AAAA,QACpB;AAAA,SACD;AAAA;AAAA,EAEF;AAEF;","names":[]}
|
package/dist/stepper.js
CHANGED
|
@@ -1,41 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
4
|
+
|
|
5
|
+
// src/stepper.tsx
|
|
2
6
|
import { cva } from "class-variance-authority";
|
|
3
7
|
import { CheckIcon } from "lucide-react";
|
|
4
8
|
import * as React from "react";
|
|
5
|
-
|
|
6
|
-
// src/lib/cn.ts
|
|
7
|
-
import { clsx } from "clsx";
|
|
8
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
9
|
-
var twMerge = extendTailwindMerge({
|
|
10
|
-
extend: {
|
|
11
|
-
classGroups: {
|
|
12
|
-
"font-size": [
|
|
13
|
-
{
|
|
14
|
-
text: [
|
|
15
|
-
"gdt-display",
|
|
16
|
-
"gdt-h1",
|
|
17
|
-
"gdt-h2",
|
|
18
|
-
"gdt-h3",
|
|
19
|
-
"gdt-h4",
|
|
20
|
-
"gdt-h5",
|
|
21
|
-
"gdt-xl",
|
|
22
|
-
"gdt-lg",
|
|
23
|
-
"gdt-md",
|
|
24
|
-
"gdt-sm",
|
|
25
|
-
"gdt-xs",
|
|
26
|
-
"gdt-subtext",
|
|
27
|
-
"gdt-capitalized"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
function cn(...inputs) {
|
|
35
|
-
return twMerge(clsx(inputs));
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/components/ui/stepper.tsx
|
|
39
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
40
10
|
var StepperContext = React.createContext(null);
|
|
41
11
|
function useStepper() {
|