@giddaa-housing/ui 0.1.0 → 1.1.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.d.ts +9 -10
- package/dist/accordion.js +41 -117
- package/dist/activity-timeline.d.ts +29 -0
- package/dist/activity-timeline.js +97 -0
- package/dist/alert.d.ts +8 -9
- package/dist/alert.js +53 -141
- package/dist/auth-layout.d.ts +23 -0
- package/dist/auth-layout.js +153 -0
- package/dist/avatar.d.ts +6 -6
- package/dist/avatar.js +40 -142
- package/dist/badge.d.ts +12 -13
- package/dist/badge.js +66 -114
- package/dist/bar-chart.d.ts +136 -114
- package/dist/bar-chart.js +244 -297
- package/dist/breadcrumb.d.ts +5 -5
- package/dist/breadcrumb.js +56 -148
- package/dist/bullet-chart.d.ts +33 -33
- package/dist/bullet-chart.js +123 -183
- package/dist/button-BZIeyUw6.d.ts +17 -0
- package/dist/button-group.d.ts +13 -16
- package/dist/button-group.js +38 -163
- package/dist/button.d.ts +2 -19
- package/dist/button.js +90 -142
- package/dist/calendar.d.ts +6 -6
- package/dist/calendar.js +134 -288
- package/dist/card.d.ts +14 -16
- package/dist/card.js +58 -174
- package/dist/carousel.d.ts +34 -35
- package/dist/carousel.js +319 -378
- package/dist/chart.d.ts +58 -59
- package/dist/chart.js +350 -466
- package/dist/checkbox.d.ts +10 -12
- package/dist/checkbox.js +84 -84
- package/dist/cn-BI_4DMBf.js +23 -0
- package/dist/collapsible.d.ts +7 -8
- package/dist/collapsible.js +23 -77
- package/dist/combobox.d.ts +10 -10
- package/dist/combobox.js +220 -696
- package/dist/cta.d.ts +64 -0
- package/dist/cta.js +192 -0
- package/dist/currency-selector.d.ts +41 -0
- package/dist/currency-selector.js +114 -0
- package/dist/data-table.d.ts +164 -0
- package/dist/data-table.js +673 -0
- package/dist/date-picker.d.ts +27 -20
- package/dist/date-picker.js +122 -520
- package/dist/details-card.d.ts +19 -0
- package/dist/details-card.js +118 -0
- package/dist/dialog.d.ts +13 -14
- package/dist/dialog.js +117 -320
- package/dist/dropdown-menu.d.ts +14 -14
- package/dist/dropdown-menu.js +170 -365
- package/dist/dropzone.d.ts +55 -55
- package/dist/dropzone.js +328 -467
- package/dist/editorial-card.d.ts +27 -0
- package/dist/editorial-card.js +144 -0
- package/dist/empty-state.d.ts +8 -9
- package/dist/empty-state.js +48 -135
- package/dist/field.d.ts +23 -25
- package/dist/field.js +111 -327
- package/dist/filter.d.ts +118 -0
- package/dist/filter.js +775 -0
- package/dist/footer.d.ts +40 -0
- package/dist/footer.js +227 -0
- package/dist/funnel-chart.d.ts +38 -41
- package/dist/funnel-chart.js +168 -563
- package/dist/gallery-indicator.d.ts +17 -0
- package/dist/gallery-indicator.js +75 -0
- package/dist/heatmap-chart.d.ts +95 -0
- package/dist/heatmap-chart.js +197 -0
- package/dist/infotip.d.ts +10 -0
- package/dist/infotip.js +40 -0
- package/dist/input-CfoEJ8A6.d.ts +12 -0
- package/dist/input-group.d.ts +16 -19
- package/dist/input-group.js +92 -372
- package/dist/input-size-context-C-SFx9sx.d.ts +10 -0
- package/dist/input-size-context.d.ts +2 -11
- package/dist/input-size-context.js +14 -20
- package/dist/input.d.ts +2 -13
- package/dist/input.js +23 -79
- package/dist/item.d.ts +7 -8
- package/dist/item.js +22 -89
- package/dist/kpi-card.d.ts +18 -20
- package/dist/kpi-card.js +84 -232
- package/dist/label.d.ts +6 -6
- package/dist/label.js +39 -66
- package/dist/line-chart.d.ts +88 -89
- package/dist/line-chart.js +143 -262
- package/dist/logo.d.ts +4 -4
- package/dist/logo.js +87 -141
- package/dist/map-indicator.d.ts +13 -0
- package/dist/map-indicator.js +83 -0
- package/dist/match.d.ts +15 -0
- package/dist/match.js +68 -0
- package/dist/media-gallery-hero.d.ts +58 -0
- package/dist/media-gallery-hero.js +201 -0
- package/dist/media-player.d.ts +60 -0
- package/dist/media-player.js +919 -0
- package/dist/multi-step-form.d.ts +56 -0
- package/dist/multi-step-form.js +342 -0
- package/dist/number-input.d.ts +34 -34
- package/dist/number-input.js +62 -413
- package/dist/page-header.d.ts +10 -11
- package/dist/page-header.js +34 -107
- package/dist/pagination.d.ts +17 -20
- package/dist/pagination.js +132 -341
- package/dist/password-input.d.ts +5 -12
- package/dist/password-input.js +32 -354
- package/dist/phone-input.d.ts +19 -19
- package/dist/phone-input.js +232 -561
- package/dist/photo-gallery.d.ts +20 -20
- package/dist/photo-gallery.js +314 -746
- package/dist/picker-lzgmsNfG.js +32 -0
- package/dist/pie-chart.d.ts +60 -60
- package/dist/pie-chart.js +141 -184
- package/dist/popover.d.ts +9 -9
- package/dist/popover.js +60 -156
- package/dist/price-tag.d.ts +34 -0
- package/dist/price-tag.js +118 -0
- package/dist/progress.d.ts +18 -16
- package/dist/progress.js +156 -300
- package/dist/property-listing-card.d.ts +29 -0
- package/dist/property-listing-card.js +117 -0
- package/dist/radar-chart.d.ts +108 -0
- package/dist/radar-chart.js +172 -0
- package/dist/radio-group.d.ts +11 -13
- package/dist/radio-group.js +47 -96
- package/dist/review-block.d.ts +18 -0
- package/dist/review-block.js +154 -0
- package/dist/rich-text-editor.d.ts +30 -14
- package/dist/rich-text-editor.js +594 -979
- package/dist/scatter-chart.d.ts +140 -0
- package/dist/scatter-chart.js +248 -0
- package/dist/search-input.d.ts +8 -15
- package/dist/search-input.js +58 -408
- package/dist/select.d.ts +8 -8
- package/dist/select.js +131 -291
- package/dist/separator.d.ts +8 -9
- package/dist/separator.js +31 -70
- package/dist/sheet.d.ts +11 -11
- package/dist/sheet.js +84 -262
- package/dist/sidebar.d.ts +32 -37
- package/dist/sidebar.js +380 -1055
- package/dist/size-context-D4mYvcg8.d.ts +10 -0
- package/dist/size-context.d.ts +2 -11
- package/dist/size-context.js +14 -18
- package/dist/skeleton.d.ts +4 -5
- package/dist/skeleton.js +9 -45
- package/dist/slider.d.ts +27 -0
- package/dist/slider.js +81 -0
- package/dist/sparkline.d.ts +43 -46
- package/dist/sparkline.js +223 -561
- package/dist/stepper.d.ts +23 -24
- package/dist/stepper.js +149 -276
- package/dist/styles.css +9995 -2
- package/dist/switch.d.ts +10 -12
- package/dist/switch.js +49 -106
- package/dist/table-card.d.ts +35 -0
- package/dist/table-card.js +125 -0
- package/dist/table.d.ts +18 -14
- package/dist/table.js +114 -182
- package/dist/tabs.d.ts +23 -15
- package/dist/tabs.js +62 -149
- package/dist/tag.d.ts +22 -23
- package/dist/tag.js +104 -156
- package/dist/testimonial-block.d.ts +33 -0
- package/dist/testimonial-block.js +208 -0
- package/dist/textarea-IS_D8pXf.d.ts +11 -0
- package/dist/textarea.d.ts +2 -12
- package/dist/textarea.js +20 -74
- package/dist/time-picker.d.ts +11 -11
- package/dist/time-picker.js +247 -464
- package/dist/toast.d.ts +16 -18
- package/dist/toast.js +154 -310
- package/dist/tooltip.d.ts +9 -10
- package/dist/tooltip.js +33 -91
- package/dist/tree-map.d.ts +54 -57
- package/dist/tree-map.js +231 -646
- package/dist/use-uncontrolled-CLfM1XbB.js +21 -0
- package/dist/waterfall-chart.d.ts +126 -0
- package/dist/waterfall-chart.js +480 -0
- package/package.json +123 -34
- package/dist/accordion.js.map +0 -1
- package/dist/alert.js.map +0 -1
- package/dist/avatar.js.map +0 -1
- package/dist/badge.js.map +0 -1
- package/dist/bar-chart.js.map +0 -1
- package/dist/base.css +0 -32
- package/dist/breadcrumb.js.map +0 -1
- package/dist/bullet-chart.js.map +0 -1
- package/dist/button-group.js.map +0 -1
- package/dist/button.js.map +0 -1
- package/dist/calendar.js.map +0 -1
- package/dist/card.js.map +0 -1
- package/dist/carousel.js.map +0 -1
- package/dist/chart.js.map +0 -1
- package/dist/checkbox.js.map +0 -1
- package/dist/collapsible.js.map +0 -1
- package/dist/combobox.js.map +0 -1
- package/dist/date-picker.js.map +0 -1
- package/dist/dialog.js.map +0 -1
- package/dist/dropdown-menu.js.map +0 -1
- package/dist/dropzone.js.map +0 -1
- package/dist/empty-state.js.map +0 -1
- package/dist/field.js.map +0 -1
- 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/funnel-chart.js.map +0 -1
- package/dist/index.d.ts +0 -87
- package/dist/index.js +0 -10448
- package/dist/index.js.map +0 -1
- package/dist/input-group.js.map +0 -1
- package/dist/input-size-context.js.map +0 -1
- package/dist/input.js.map +0 -1
- package/dist/item.js.map +0 -1
- package/dist/kpi-card.js.map +0 -1
- package/dist/label.js.map +0 -1
- package/dist/line-chart.js.map +0 -1
- package/dist/logo.js.map +0 -1
- package/dist/number-input.js.map +0 -1
- package/dist/page-header.js.map +0 -1
- package/dist/pagination.js.map +0 -1
- package/dist/password-input.js.map +0 -1
- package/dist/phone-input.js.map +0 -1
- package/dist/photo-gallery.js.map +0 -1
- package/dist/pie-chart.js.map +0 -1
- package/dist/popover.js.map +0 -1
- package/dist/progress.js.map +0 -1
- package/dist/radio-group.js.map +0 -1
- package/dist/red-hat-display.css +0 -2
- package/dist/rich-text-editor.js.map +0 -1
- package/dist/search-input.js.map +0 -1
- package/dist/select.js.map +0 -1
- package/dist/separator.js.map +0 -1
- package/dist/sheet.js.map +0 -1
- package/dist/sidebar.js.map +0 -1
- package/dist/size-context.js.map +0 -1
- package/dist/skeleton.js.map +0 -1
- package/dist/sparkline.js.map +0 -1
- package/dist/stepper.js.map +0 -1
- package/dist/switch.js.map +0 -1
- package/dist/tab-list.d.ts +0 -38
- package/dist/tab-list.js +0 -394
- package/dist/tab-list.js.map +0 -1
- package/dist/table.js.map +0 -1
- package/dist/tabs.js.map +0 -1
- package/dist/tag.js.map +0 -1
- package/dist/textarea.js.map +0 -1
- package/dist/theme/giddaa.css +0 -2
- package/dist/time-picker.js.map +0 -1
- package/dist/toast.js.map +0 -1
- package/dist/tooltip.js.map +0 -1
- package/dist/tree-map.js.map +0 -1
package/dist/sparkline.js
CHANGED
|
@@ -1,568 +1,230 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 });
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as cn } from "./cn-BI_4DMBf.js";
|
|
3
|
+
import { useComponentSize } from "./size-context.js";
|
|
4
|
+
import { ChartContainer, ChartTooltip, ChartTooltipContent } from "./chart.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Area, AreaChart, Bar, BarChart, Line, LineChart, XAxis } from "recharts";
|
|
7
|
+
//#region src/sparkline.tsx
|
|
8
|
+
const SPARKLINE_LAYOUT = {
|
|
9
|
+
sm: {
|
|
10
|
+
width: 72,
|
|
11
|
+
height: 24,
|
|
12
|
+
strokeWidth: 1.5,
|
|
13
|
+
dotRadius: 2,
|
|
14
|
+
margin: {
|
|
15
|
+
top: 4,
|
|
16
|
+
right: 4,
|
|
17
|
+
bottom: 2,
|
|
18
|
+
left: 2
|
|
19
|
+
},
|
|
20
|
+
barRadius: 1,
|
|
21
|
+
maxBarSize: 6
|
|
22
|
+
},
|
|
23
|
+
md: {
|
|
24
|
+
width: 104,
|
|
25
|
+
height: 32,
|
|
26
|
+
strokeWidth: 2,
|
|
27
|
+
dotRadius: 2.5,
|
|
28
|
+
margin: {
|
|
29
|
+
top: 5,
|
|
30
|
+
right: 5,
|
|
31
|
+
bottom: 2,
|
|
32
|
+
left: 2
|
|
33
|
+
},
|
|
34
|
+
barRadius: 2,
|
|
35
|
+
maxBarSize: 8
|
|
36
|
+
},
|
|
37
|
+
lg: {
|
|
38
|
+
width: 144,
|
|
39
|
+
height: 44,
|
|
40
|
+
strokeWidth: 2,
|
|
41
|
+
dotRadius: 3,
|
|
42
|
+
margin: {
|
|
43
|
+
top: 6,
|
|
44
|
+
right: 6,
|
|
45
|
+
bottom: 3,
|
|
46
|
+
left: 3
|
|
47
|
+
},
|
|
48
|
+
barRadius: 2,
|
|
49
|
+
maxBarSize: 10
|
|
50
|
+
}
|
|
174
51
|
};
|
|
175
|
-
|
|
176
|
-
var
|
|
177
|
-
|
|
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";
|
|
333
|
-
var SPARKLINE_LAYOUT = {
|
|
334
|
-
sm: {
|
|
335
|
-
width: 72,
|
|
336
|
-
height: 24,
|
|
337
|
-
strokeWidth: 1.5,
|
|
338
|
-
dotRadius: 2,
|
|
339
|
-
margin: { top: 4, right: 4, bottom: 2, left: 2 },
|
|
340
|
-
barRadius: 1,
|
|
341
|
-
maxBarSize: 6
|
|
342
|
-
},
|
|
343
|
-
md: {
|
|
344
|
-
width: 104,
|
|
345
|
-
height: 32,
|
|
346
|
-
strokeWidth: 2,
|
|
347
|
-
dotRadius: 2.5,
|
|
348
|
-
margin: { top: 5, right: 5, bottom: 2, left: 2 },
|
|
349
|
-
barRadius: 2,
|
|
350
|
-
maxBarSize: 8
|
|
351
|
-
},
|
|
352
|
-
lg: {
|
|
353
|
-
width: 144,
|
|
354
|
-
height: 44,
|
|
355
|
-
strokeWidth: 2,
|
|
356
|
-
dotRadius: 3,
|
|
357
|
-
margin: { top: 6, right: 6, bottom: 3, left: 3 },
|
|
358
|
-
barRadius: 2,
|
|
359
|
-
maxBarSize: 10
|
|
360
|
-
}
|
|
361
|
-
};
|
|
362
|
-
var TREND_COLOR = {
|
|
363
|
-
up: "var(--color-status-success)",
|
|
364
|
-
down: "var(--color-status-danger)",
|
|
365
|
-
flat: "var(--color-fg-secondary)"
|
|
52
|
+
const TREND_COLOR = {
|
|
53
|
+
up: "var(--color-status-success)",
|
|
54
|
+
down: "var(--color-status-danger)",
|
|
55
|
+
flat: "var(--color-fg-secondary)"
|
|
366
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Derive sentiment from the series: compare the last value to the first and
|
|
59
|
+
* read flat when the change is a small fraction of the overall range.
|
|
60
|
+
*/
|
|
367
61
|
function resolveTrend(data) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
return delta > 0 ? "up" : "down";
|
|
62
|
+
if (data.length < 2) return "flat";
|
|
63
|
+
const first = data[0];
|
|
64
|
+
const last = data[data.length - 1];
|
|
65
|
+
const min = Math.min(...data);
|
|
66
|
+
const range = Math.max(...data) - min || 1;
|
|
67
|
+
const delta = last - first;
|
|
68
|
+
if (Math.abs(delta) / range < .05) return "flat";
|
|
69
|
+
return delta > 0 ? "up" : "down";
|
|
377
70
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
r: radius,
|
|
394
|
-
fill: "var(--color-value)",
|
|
395
|
-
stroke: "var(--color-surface)",
|
|
396
|
-
strokeWidth: 2
|
|
397
|
-
}
|
|
398
|
-
);
|
|
71
|
+
/**
|
|
72
|
+
* Custom dot passed to recharts as `dot={<SparklineEndDot ... />}`. recharts
|
|
73
|
+
* clones it for every point, injecting `cx`/`cy`/`index`; we only paint the
|
|
74
|
+
* latest point so the series carries a single end-point marker.
|
|
75
|
+
*/
|
|
76
|
+
function SparklineEndDot({ cx, cy, index, lastIndex, radius }) {
|
|
77
|
+
if (cx == null || cy == null || index !== lastIndex) return null;
|
|
78
|
+
return /* @__PURE__ */ jsx("circle", {
|
|
79
|
+
cx,
|
|
80
|
+
cy,
|
|
81
|
+
r: radius,
|
|
82
|
+
fill: "var(--color-value)",
|
|
83
|
+
stroke: "var(--color-surface)",
|
|
84
|
+
strokeWidth: 2
|
|
85
|
+
});
|
|
399
86
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
rx: radius,
|
|
424
|
-
ry: radius,
|
|
425
|
-
fill: "var(--color-value)"
|
|
426
|
-
}
|
|
427
|
-
),
|
|
428
|
-
index === lastIndex ? /* @__PURE__ */ jsx3(
|
|
429
|
-
"circle",
|
|
430
|
-
{
|
|
431
|
-
cx: x + width / 2,
|
|
432
|
-
cy: markerY,
|
|
433
|
-
r: dotRadius,
|
|
434
|
-
fill: "var(--color-value)",
|
|
435
|
-
stroke: "var(--color-surface)",
|
|
436
|
-
strokeWidth: 2
|
|
437
|
-
}
|
|
438
|
-
) : null
|
|
439
|
-
] });
|
|
87
|
+
/**
|
|
88
|
+
* Bars do not support `dot`, so the marker is rendered as part of a custom bar
|
|
89
|
+
* shape. Only the latest bar receives the end-point marker.
|
|
90
|
+
*/
|
|
91
|
+
function SparklineBarShape({ x, y, width, height, index, value, lastIndex, radius, dotRadius }) {
|
|
92
|
+
if (x == null || y == null || width == null || height == null) return null;
|
|
93
|
+
const markerY = typeof value === "number" && value < 0 ? y + height : y;
|
|
94
|
+
return /* @__PURE__ */ jsxs("g", { children: [/* @__PURE__ */ jsx("rect", {
|
|
95
|
+
x,
|
|
96
|
+
y,
|
|
97
|
+
width,
|
|
98
|
+
height,
|
|
99
|
+
rx: radius,
|
|
100
|
+
ry: radius,
|
|
101
|
+
fill: "var(--color-value)"
|
|
102
|
+
}), index === lastIndex ? /* @__PURE__ */ jsx("circle", {
|
|
103
|
+
cx: x + width / 2,
|
|
104
|
+
cy: markerY,
|
|
105
|
+
r: dotRadius,
|
|
106
|
+
fill: "var(--color-value)",
|
|
107
|
+
stroke: "var(--color-surface)",
|
|
108
|
+
strokeWidth: 2
|
|
109
|
+
}) : null] });
|
|
440
110
|
}
|
|
441
|
-
function Sparkline({
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
)
|
|
560
|
-
] })
|
|
561
|
-
}
|
|
562
|
-
);
|
|
111
|
+
function Sparkline({ data, type = "line", size, trend, showMarker = true, tooltip = false, label = "Value", labels, valueType = "number", className, style, ...props }) {
|
|
112
|
+
const layout = SPARKLINE_LAYOUT[useComponentSize(size)];
|
|
113
|
+
const resolvedTrend = trend ?? resolveTrend(data);
|
|
114
|
+
const color = TREND_COLOR[resolvedTrend];
|
|
115
|
+
const chartData = data.map((value, i) => ({
|
|
116
|
+
x: labels?.[i] ?? `${i + 1}`,
|
|
117
|
+
value
|
|
118
|
+
}));
|
|
119
|
+
const lastIndex = data.length - 1;
|
|
120
|
+
const config = { value: {
|
|
121
|
+
label,
|
|
122
|
+
color
|
|
123
|
+
} };
|
|
124
|
+
const showDot = showMarker && data.length >= 2;
|
|
125
|
+
const endDot = showDot ? /* @__PURE__ */ jsx(SparklineEndDot, {
|
|
126
|
+
lastIndex,
|
|
127
|
+
radius: layout.dotRadius
|
|
128
|
+
}) : false;
|
|
129
|
+
const barShape = showDot ? /* @__PURE__ */ jsx(SparklineBarShape, {
|
|
130
|
+
lastIndex,
|
|
131
|
+
radius: layout.barRadius,
|
|
132
|
+
dotRadius: layout.dotRadius
|
|
133
|
+
}) : void 0;
|
|
134
|
+
const activeDot = tooltip ? {
|
|
135
|
+
r: layout.dotRadius + .5,
|
|
136
|
+
fill: "var(--color-value)",
|
|
137
|
+
stroke: "var(--color-surface)",
|
|
138
|
+
strokeWidth: 2
|
|
139
|
+
} : false;
|
|
140
|
+
const tooltipNode = tooltip ? /* @__PURE__ */ jsx(ChartTooltip, {
|
|
141
|
+
cursor: false,
|
|
142
|
+
content: /* @__PURE__ */ jsx(ChartTooltipContent, {
|
|
143
|
+
size: "xs",
|
|
144
|
+
valueType
|
|
145
|
+
})
|
|
146
|
+
}) : null;
|
|
147
|
+
const ariaLabel = props["aria-label"] ?? `${label} sparkline, trend ${resolvedTrend}`;
|
|
148
|
+
if (data.length < 2) return /* @__PURE__ */ jsx("div", {
|
|
149
|
+
...props,
|
|
150
|
+
"aria-label": ariaLabel,
|
|
151
|
+
role: "img",
|
|
152
|
+
className: cn("w-full", className),
|
|
153
|
+
style: {
|
|
154
|
+
height: layout.height,
|
|
155
|
+
...style
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return /* @__PURE__ */ jsx(ChartContainer, {
|
|
159
|
+
...props,
|
|
160
|
+
"aria-label": ariaLabel,
|
|
161
|
+
role: "img",
|
|
162
|
+
config,
|
|
163
|
+
className: cn("aspect-auto w-full", className),
|
|
164
|
+
style: {
|
|
165
|
+
height: layout.height,
|
|
166
|
+
...style
|
|
167
|
+
},
|
|
168
|
+
children: type === "bar" ? /* @__PURE__ */ jsxs(BarChart, {
|
|
169
|
+
accessibilityLayer: true,
|
|
170
|
+
data: chartData,
|
|
171
|
+
margin: layout.margin,
|
|
172
|
+
children: [tooltipNode, /* @__PURE__ */ jsx(Bar, {
|
|
173
|
+
dataKey: "value",
|
|
174
|
+
fill: "var(--color-value)",
|
|
175
|
+
radius: layout.barRadius,
|
|
176
|
+
maxBarSize: layout.maxBarSize,
|
|
177
|
+
shape: barShape,
|
|
178
|
+
isAnimationActive: false
|
|
179
|
+
})]
|
|
180
|
+
}) : type === "area" ? /* @__PURE__ */ jsxs(AreaChart, {
|
|
181
|
+
accessibilityLayer: true,
|
|
182
|
+
data: chartData,
|
|
183
|
+
margin: layout.margin,
|
|
184
|
+
children: [
|
|
185
|
+
tooltip ? /* @__PURE__ */ jsx(XAxis, {
|
|
186
|
+
dataKey: "x",
|
|
187
|
+
hide: true
|
|
188
|
+
}) : null,
|
|
189
|
+
tooltipNode,
|
|
190
|
+
/* @__PURE__ */ jsx(Area, {
|
|
191
|
+
type: "monotone",
|
|
192
|
+
dataKey: "value",
|
|
193
|
+
stroke: "var(--color-value)",
|
|
194
|
+
strokeWidth: layout.strokeWidth,
|
|
195
|
+
strokeLinejoin: "round",
|
|
196
|
+
strokeLinecap: "round",
|
|
197
|
+
fill: "var(--color-value)",
|
|
198
|
+
fillOpacity: .14,
|
|
199
|
+
dot: endDot,
|
|
200
|
+
activeDot,
|
|
201
|
+
isAnimationActive: false
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}) : /* @__PURE__ */ jsxs(LineChart, {
|
|
205
|
+
accessibilityLayer: true,
|
|
206
|
+
data: chartData,
|
|
207
|
+
margin: layout.margin,
|
|
208
|
+
children: [
|
|
209
|
+
tooltip ? /* @__PURE__ */ jsx(XAxis, {
|
|
210
|
+
dataKey: "x",
|
|
211
|
+
hide: true
|
|
212
|
+
}) : null,
|
|
213
|
+
tooltipNode,
|
|
214
|
+
/* @__PURE__ */ jsx(Line, {
|
|
215
|
+
type: "monotone",
|
|
216
|
+
dataKey: "value",
|
|
217
|
+
stroke: "var(--color-value)",
|
|
218
|
+
strokeWidth: layout.strokeWidth,
|
|
219
|
+
strokeLinejoin: "round",
|
|
220
|
+
strokeLinecap: "round",
|
|
221
|
+
dot: endDot,
|
|
222
|
+
activeDot,
|
|
223
|
+
isAnimationActive: false
|
|
224
|
+
})
|
|
225
|
+
]
|
|
226
|
+
})
|
|
227
|
+
});
|
|
563
228
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
Sparkline
|
|
567
|
-
};
|
|
568
|
-
//# sourceMappingURL=sparkline.js.map
|
|
229
|
+
//#endregion
|
|
230
|
+
export { SPARKLINE_LAYOUT, Sparkline };
|