@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/kpi-card.js
CHANGED
|
@@ -1,56 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
Skeleton
|
|
3
|
+
} from "./chunk-XZZAHNVM.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-Y4TTYVNE.js";
|
|
7
|
+
|
|
8
|
+
// src/kpi-card.tsx
|
|
2
9
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
10
|
import { useRender } from "@base-ui/react/use-render";
|
|
4
11
|
import { cva } from "class-variance-authority";
|
|
5
12
|
import { ArrowDown, ArrowUp, ArrowUpRight } from "lucide-react";
|
|
6
|
-
|
|
7
|
-
// src/lib/cn.ts
|
|
8
|
-
import { clsx } from "clsx";
|
|
9
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
10
|
-
var twMerge = extendTailwindMerge({
|
|
11
|
-
extend: {
|
|
12
|
-
classGroups: {
|
|
13
|
-
"font-size": [
|
|
14
|
-
{
|
|
15
|
-
text: [
|
|
16
|
-
"gdt-display",
|
|
17
|
-
"gdt-h1",
|
|
18
|
-
"gdt-h2",
|
|
19
|
-
"gdt-h3",
|
|
20
|
-
"gdt-h4",
|
|
21
|
-
"gdt-h5",
|
|
22
|
-
"gdt-xl",
|
|
23
|
-
"gdt-lg",
|
|
24
|
-
"gdt-md",
|
|
25
|
-
"gdt-sm",
|
|
26
|
-
"gdt-xs",
|
|
27
|
-
"gdt-subtext",
|
|
28
|
-
"gdt-capitalized"
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
function cn(...inputs) {
|
|
36
|
-
return twMerge(clsx(inputs));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// src/components/ui/skeleton.tsx
|
|
40
|
-
import { jsx } from "react/jsx-runtime";
|
|
41
|
-
function Skeleton({ className, ...props }) {
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
"data-slot": "skeleton",
|
|
46
|
-
className: cn("animate-pulse rounded-md bg-line", className),
|
|
47
|
-
...props
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// src/components/ui/kpi-card.tsx
|
|
53
|
-
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
54
14
|
function KpiCard({
|
|
55
15
|
className,
|
|
56
16
|
loading = false,
|
|
@@ -110,7 +70,7 @@ function KpiCardLinkOutIcon({
|
|
|
110
70
|
"pointer-events-none absolute right-gdt-md top-gdt-md inline-flex size-4 shrink-0 items-center justify-center text-fg-secondary [&>svg]:size-4 [&>svg]:shrink-0",
|
|
111
71
|
className
|
|
112
72
|
),
|
|
113
|
-
children: children ?? /* @__PURE__ */
|
|
73
|
+
children: children ?? /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": "true" })
|
|
114
74
|
},
|
|
115
75
|
props
|
|
116
76
|
),
|
|
@@ -140,7 +100,7 @@ function KpiCardValueSkeleton({
|
|
|
140
100
|
className,
|
|
141
101
|
...props
|
|
142
102
|
}) {
|
|
143
|
-
return /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
144
104
|
Skeleton,
|
|
145
105
|
{
|
|
146
106
|
className: cn(
|
|
@@ -180,7 +140,7 @@ function KpiCardTrend({
|
|
|
180
140
|
{
|
|
181
141
|
className: cn(kpiCardTrendVariants({ direction }), className),
|
|
182
142
|
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
183
|
-
showIcon ? /* @__PURE__ */
|
|
143
|
+
showIcon ? /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true", className: "size-3 shrink-0" }) : null,
|
|
184
144
|
children
|
|
185
145
|
] })
|
|
186
146
|
},
|
package/dist/kpi-card.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/kpi-card.tsx"],"sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { ArrowDown, ArrowUp, ArrowUpRight } from \"lucide-react\";\nimport { cn } from \"./lib/cn\";\nimport { Skeleton } from \"./skeleton\";\n\nfunction KpiCard({\n\tclassName,\n\tloading = false,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"article\"> & { loading?: boolean }) {\n\treturn useRender({\n\t\tdefaultTagName: \"article\",\n\t\tprops: mergeProps<\"article\">(\n\t\t\t{\n\t\t\t\t\"aria-busy\": loading || undefined,\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"group/kpi-card relative flex w-full min-w-0 flex-col gap-4 rounded-xl p-5 text-fg-primary transition-[background-color,border-color,box-shadow,transform] outline-none border border-line-subtle shadow-1\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tslot: \"kpi-card\",\n\t\t\tloading,\n\t\t},\n\t});\n}\n\nfunction KpiCardTitle({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"h3\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"h3\",\n\t\tprops: mergeProps<\"h3\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"min-w-0 pr-gdt-xl text-gdt-sm font-semibold capitalized text-fg-secondary\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction KpiCardLinkOutIcon({\n\tchildren,\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"span\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"span\",\n\t\tprops: mergeProps<\"span\">(\n\t\t\t{\n\t\t\t\t\"aria-hidden\": true,\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"pointer-events-none absolute right-gdt-md top-gdt-md inline-flex size-4 shrink-0 items-center justify-center text-fg-secondary [&>svg]:size-4 [&>svg]:shrink-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t\tchildren: children ?? <ArrowUpRight aria-hidden=\"true\" />,\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction KpiCardValue({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"p\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"p\",\n\t\tprops: mergeProps<\"p\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"text-gdt-h3 font-extrabold text-fg-primary group-aria-busy/kpi-card:hidden\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction KpiCardValueSkeleton({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof Skeleton>) {\n\treturn (\n\t\t<Skeleton\n\t\t\tclassName={cn(\n\t\t\t\t\"hidden h-8 mt-2 md:mt-3 w-24 rounded-md group-aria-busy/kpi-card:block\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nconst kpiCardTrendVariants = cva(\n\t\"flex min-w-0 items-center gap-1.5 text-gdt-capitalized\",\n\t{\n\t\tvariants: {\n\t\t\tdirection: {\n\t\t\t\tup: \"text-status-success\",\n\t\t\t\tdown: \"text-status-danger\",\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tdirection: \"up\",\n\t\t},\n\t},\n);\n\ntype KpiCardTrendProps = useRender.ComponentProps<\"p\"> &\n\tVariantProps<typeof kpiCardTrendVariants> & {\n\t\tshowIcon?: boolean;\n\t};\n\nfunction KpiCardTrend({\n\tchildren,\n\tclassName,\n\tdirection = \"up\",\n\trender,\n\tshowIcon = true,\n\t...props\n}: KpiCardTrendProps) {\n\tconst Icon = direction === \"down\" ? ArrowDown : ArrowUp;\n\n\treturn useRender({\n\t\tdefaultTagName: \"p\",\n\t\tprops: mergeProps<\"p\">(\n\t\t\t{\n\t\t\t\tclassName: cn(kpiCardTrendVariants({ direction }), className),\n\t\t\t\tchildren: (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{showIcon ? (\n\t\t\t\t\t\t\t<Icon aria-hidden=\"true\" className=\"size-3 shrink-0\" />\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t\tstate: {\n\t\t\tdirection,\n\t\t\tshowIcon,\n\t\t\tslot: \"kpi-card-trend\",\n\t\t},\n\t});\n}\n\nfunction KpiCardTrendValue({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"span\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"span\",\n\t\tprops: mergeProps<\"span\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\"text-gdt-sm text-current font-semibold\", className),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\nfunction KpiCardTrendCaption({\n\tclassName,\n\trender,\n\t...props\n}: useRender.ComponentProps<\"span\">) {\n\treturn useRender({\n\t\tdefaultTagName: \"span\",\n\t\tprops: mergeProps<\"span\">(\n\t\t\t{\n\t\t\t\tclassName: cn(\n\t\t\t\t\t\"min-w-0 truncate text-gdt-xs text-fg-secondary font-normal\",\n\t\t\t\t\tclassName,\n\t\t\t\t),\n\t\t\t},\n\t\t\tprops,\n\t\t),\n\t\trender,\n\t});\n}\n\n/**\n * Composition examples:\n *\n * <KpiCard>\n * <KpiCardTitle>Total Revenue</KpiCardTitle>\n * <KpiCardValue>$1.25M</KpiCardValue>\n * <KpiCardTrend>\n * <KpiCardTrendValue>+12.5%</KpiCardTrendValue>\n * <KpiCardTrendCaption>vs last month</KpiCardTrendCaption>\n * </KpiCardTrend>\n * </KpiCard>\n *\n * <KpiCard interactive render={<a href=\"/reports\" aria-label=\"View revenue report\" />}>\n * <KpiCardLinkOutIcon />\n * <KpiCardTitle>Total Revenue</KpiCardTitle>\n * <KpiCardValue>$1.25M</KpiCardValue>\n * </KpiCard>\n *\n * <KpiCard loading>\n * <KpiCardTitle>Total Revenue</KpiCardTitle>\n * <KpiCardValue>$1.25M</KpiCardValue>\n * <KpiCardValueSkeleton />\n * </KpiCard>\n */\nexport {\n\tKpiCard,\n\tKpiCardLinkOutIcon,\n\tKpiCardTitle,\n\tKpiCardTrend,\n\tKpiCardTrendCaption,\n\tKpiCardTrendValue,\n\tKpiCardValue,\n\tKpiCardValueSkeleton,\n\tkpiCardTrendVariants,\n};\n"],"mappings":";;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,WAA8B;AACvC,SAAS,WAAW,SAAS,oBAAo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SAAO,UAAU;AAAA,IAChB,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACN;AAAA,QACC,WAAW;AAAA,UACV;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,MACA;AAAA,IACD;AAAA,IACA;AAAA,EACD,CAAC;AACF;","names":[]}
|
package/dist/label.js
CHANGED
|
@@ -1,67 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
classGroups: {
|
|
7
|
-
"font-size": [
|
|
8
|
-
{
|
|
9
|
-
text: [
|
|
10
|
-
"gdt-display",
|
|
11
|
-
"gdt-h1",
|
|
12
|
-
"gdt-h2",
|
|
13
|
-
"gdt-h3",
|
|
14
|
-
"gdt-h4",
|
|
15
|
-
"gdt-h5",
|
|
16
|
-
"gdt-xl",
|
|
17
|
-
"gdt-lg",
|
|
18
|
-
"gdt-md",
|
|
19
|
-
"gdt-sm",
|
|
20
|
-
"gdt-xs",
|
|
21
|
-
"gdt-subtext",
|
|
22
|
-
"gdt-capitalized"
|
|
23
|
-
]
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
function cn(...inputs) {
|
|
30
|
-
return twMerge(clsx(inputs));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// src/components/ui/label.tsx
|
|
34
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
35
|
-
function Label({
|
|
36
|
-
className,
|
|
37
|
-
children,
|
|
38
|
-
withAsterisk = false,
|
|
39
|
-
showOptionalText = false,
|
|
40
|
-
...props
|
|
41
|
-
}) {
|
|
42
|
-
const labelClassName = cn(
|
|
43
|
-
"flex w-fit max-w-full items-center gap-1 text-gdt-sm leading-none font-semibold text-fg-primary select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
44
|
-
className
|
|
45
|
-
);
|
|
46
|
-
if (withAsterisk) {
|
|
47
|
-
return (
|
|
48
|
-
// biome-ignore lint/a11y/noLabelWithoutControl: association is supplied by callers through htmlFor or nesting patterns.
|
|
49
|
-
/* @__PURE__ */ jsxs("label", { "data-slot": "label", className: labelClassName, ...props, children: [
|
|
50
|
-
/* @__PURE__ */ jsx("div", { className: "inline-flex", children }),
|
|
51
|
-
withAsterisk && /* @__PURE__ */ jsx("span", { className: "inline-flex shrink-0 text-fg-danger", children: "*" }),
|
|
52
|
-
showOptionalText && /* @__PURE__ */ jsx("span", { className: "text-gdt-xs font-normal italic", children: "(optional)" })
|
|
53
|
-
] })
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
return (
|
|
57
|
-
// biome-ignore lint/a11y/noLabelWithoutControl: association is supplied by callers through htmlFor or nesting patterns.
|
|
58
|
-
/* @__PURE__ */ jsx("label", { "data-slot": "label", className: labelClassName, ...props, children: /* @__PURE__ */ jsxs("div", { children: [
|
|
59
|
-
children,
|
|
60
|
-
" ",
|
|
61
|
-
showOptionalText && /* @__PURE__ */ jsx("span", { className: "text-gdt-xs font-normal italic", children: "(optional)" })
|
|
62
|
-
] }) })
|
|
63
|
-
);
|
|
64
|
-
}
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Label
|
|
4
|
+
} from "./chunk-7TBMLFGW.js";
|
|
5
|
+
import "./chunk-Y4TTYVNE.js";
|
|
65
6
|
export {
|
|
66
7
|
Label
|
|
67
8
|
};
|
package/dist/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/line-chart.js
CHANGED
|
@@ -1,170 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cartesianAxisProps
|
|
4
|
+
} from "./chunk-NOFXVRWL.js";
|
|
5
|
+
import {
|
|
6
|
+
useComponentSize
|
|
7
|
+
} from "./chunk-HL3ZSYES.js";
|
|
8
|
+
import "./chunk-Y4TTYVNE.js";
|
|
5
9
|
|
|
6
|
-
// src/
|
|
7
|
-
import { createContext, useContext } from "react";
|
|
8
|
-
import { Fragment, jsx } from "react/jsx-runtime";
|
|
9
|
-
var SizeContext = createContext(void 0);
|
|
10
|
-
function useComponentSize(size, fallback = "md") {
|
|
11
|
-
const inheritedSize = useContext(SizeContext);
|
|
12
|
-
return size ?? inheritedSize ?? fallback;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/components/ui/chart.tsx
|
|
16
|
-
import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
17
|
-
var ChartContext = React.createContext(null);
|
|
18
|
-
var chartCardVariants = cva(
|
|
19
|
-
"flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1",
|
|
20
|
-
{
|
|
21
|
-
variants: {
|
|
22
|
-
size: {
|
|
23
|
-
sm: "gap-3 p-4",
|
|
24
|
-
md: "gap-4 p-5",
|
|
25
|
-
lg: "gap-5 p-6"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
defaultVariants: { size: "md" }
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
var chartTitleVariants = cva("min-w-0 font-bold text-fg-primary", {
|
|
32
|
-
variants: {
|
|
33
|
-
size: {
|
|
34
|
-
sm: "text-gdt-md",
|
|
35
|
-
md: "text-gdt-lg",
|
|
36
|
-
lg: "text-gdt-h5"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
defaultVariants: { size: "md" }
|
|
40
|
-
});
|
|
41
|
-
var chartDescriptionVariants = cva("min-w-0 font-normal text-fg-secondary", {
|
|
42
|
-
variants: {
|
|
43
|
-
size: {
|
|
44
|
-
sm: "text-gdt-xs",
|
|
45
|
-
md: "text-gdt-sm",
|
|
46
|
-
lg: "text-gdt-sm"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
defaultVariants: { size: "md" }
|
|
50
|
-
});
|
|
51
|
-
var chartTooltipVariants = cva(
|
|
52
|
-
"flex flex-col bg-surface-overlay border border-line-subtle shadow-2",
|
|
53
|
-
{
|
|
54
|
-
variants: {
|
|
55
|
-
size: {
|
|
56
|
-
xs: "gap-0.5 rounded-md p-2",
|
|
57
|
-
sm: "gap-0.5 rounded-md p-2.5",
|
|
58
|
-
md: "gap-1 rounded-lg p-3",
|
|
59
|
-
lg: "gap-1 rounded-xl p-3.5"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
defaultVariants: {
|
|
63
|
-
size: "md"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
var chartTooltipDotVariants = cva("shrink-0 rounded-full", {
|
|
68
|
-
variants: {
|
|
69
|
-
size: {
|
|
70
|
-
xs: "size-1.5",
|
|
71
|
-
sm: "size-2",
|
|
72
|
-
md: "size-2.5",
|
|
73
|
-
lg: "size-2.5"
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
defaultVariants: {
|
|
77
|
-
size: "md"
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
var chartTooltipLabelVariants = cva("font-medium text-fg-secondary", {
|
|
81
|
-
variants: {
|
|
82
|
-
size: {
|
|
83
|
-
xs: "text-gdt-xs",
|
|
84
|
-
sm: "text-gdt-xs",
|
|
85
|
-
md: "text-gdt-sm",
|
|
86
|
-
lg: "text-gdt-sm"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
defaultVariants: { size: "md" }
|
|
90
|
-
});
|
|
91
|
-
var chartTooltipValueVariants = cva(
|
|
92
|
-
"font-extrabold text-fg-primary tabular-nums",
|
|
93
|
-
{
|
|
94
|
-
variants: {
|
|
95
|
-
size: {
|
|
96
|
-
xs: "text-gdt-sm",
|
|
97
|
-
sm: "text-gdt-md",
|
|
98
|
-
md: "text-gdt-lg",
|
|
99
|
-
lg: "text-gdt-xl"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
defaultVariants: { size: "md" }
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
var chartLegendItemVariants = cva(
|
|
106
|
-
"group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0",
|
|
107
|
-
{
|
|
108
|
-
variants: {
|
|
109
|
-
size: {
|
|
110
|
-
sm: "gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3",
|
|
111
|
-
md: "gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5"
|
|
112
|
-
},
|
|
113
|
-
interactive: {
|
|
114
|
-
true: "cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised",
|
|
115
|
-
false: ""
|
|
116
|
-
},
|
|
117
|
-
inactive: {
|
|
118
|
-
true: "text-fg-caption-placeholder line-through",
|
|
119
|
-
false: ""
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
defaultVariants: {
|
|
123
|
-
size: "md",
|
|
124
|
-
interactive: false,
|
|
125
|
-
inactive: false
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
);
|
|
129
|
-
var chartLegendMarkerSizeVariants = cva("shrink-0", {
|
|
130
|
-
variants: {
|
|
131
|
-
marker: {
|
|
132
|
-
dot: "rounded-full",
|
|
133
|
-
square: "rounded-[2px]",
|
|
134
|
-
line: "rounded-full"
|
|
135
|
-
},
|
|
136
|
-
size: {
|
|
137
|
-
sm: "",
|
|
138
|
-
md: ""
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
compoundVariants: [
|
|
142
|
-
{ marker: ["dot", "square"], size: "sm", className: "size-2" },
|
|
143
|
-
{ marker: ["dot", "square"], size: "md", className: "size-2.5" },
|
|
144
|
-
{ marker: "line", size: "sm", className: "h-[3px] w-3" },
|
|
145
|
-
{ marker: "line", size: "md", className: "h-[3px] w-3.5" }
|
|
146
|
-
],
|
|
147
|
-
defaultVariants: { marker: "dot", size: "md" }
|
|
148
|
-
});
|
|
149
|
-
function cartesianAxisProps(layout) {
|
|
150
|
-
const tick = { fontSize: layout.tickFontSize };
|
|
151
|
-
return {
|
|
152
|
-
xAxis: {
|
|
153
|
-
tickLine: false,
|
|
154
|
-
axisLine: false,
|
|
155
|
-
tickMargin: layout.tickMargin,
|
|
156
|
-
tick
|
|
157
|
-
},
|
|
158
|
-
yAxis: {
|
|
159
|
-
tickLine: false,
|
|
160
|
-
axisLine: false,
|
|
161
|
-
width: layout.yAxisWidth,
|
|
162
|
-
tick
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// src/components/ui/line-chart.tsx
|
|
10
|
+
// src/line-chart.tsx
|
|
168
11
|
var LINE_CHART_LAYOUT = {
|
|
169
12
|
sm: {
|
|
170
13
|
height: 64,
|
package/dist/line-chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ui/chart.tsx","../src/components/ui/size-context.tsx","../src/components/ui/line-chart.tsx"],"sourcesContent":["\"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","\"use client\";\n\nimport { cartesianAxisProps } from \"./chart\";\nimport { type ComponentSize, useComponentSize } from \"./size-context\";\n\n/**\n * Line charts are composed from recharts plot primitives directly — recharts\n * identifies `Line`, `Area`, `XAxis`, `YAxis`, and `CartesianGrid` by component\n * identity and cannot be wrapped. This module supplies giddaa-specific defaults\n * that would otherwise be copy-pasted into every line chart: per-size layout\n * numbers. Pair them with the shared frame and overlays from `./chart`.\n *\n * Five sizes (sm → huge) extend the three `ComponentSize` values used elsewhere.\n * xl and huge must be passed explicitly — they cannot be inherited from\n * `SizeProvider` since `ComponentSize` only carries sm/md/lg.\n *\n * Tokens:\n * - Primary series stroke + dots + area fill: `var(--color-surface-brand)`\n * - Comparison series: `var(--color-surface-accent)`\n * - Gridlines: `var(--color-line-subtle)`\n * - Area wash: primary series colour at 15 % opacity (`fillOpacity={0.15}`)\n * - Active-dot ring: `var(--color-surface-raised)` stroke (matches card bg)\n *\n * @example\n * const chart = useLineChartLayout();\n * <ChartCard size=\"md\">\n * <ChartHeader>\n * <ChartTitle>Revenue Overview</ChartTitle>\n * <ChartDescription>Monthly revenue · Jan–Jul</ChartDescription>\n * </ChartHeader>\n * <ChartContainer config={config} {...chart.container}>\n * <AreaChart data={data} {...chart.chart}>\n * <CartesianGrid vertical={false} stroke=\"var(--color-line-subtle)\" />\n * <XAxis dataKey=\"month\" {...chart.xAxis} />\n * <YAxis {...chart.yAxis} />\n * <ChartLegend verticalAlign=\"top\" content={<ChartLegendContent marker=\"line\" />} />\n * <ChartTooltip content={<ChartTooltipContent />} />\n * <Area dataKey=\"revenue\" {...chart.area(\"var(--color-revenue)\")} />\n * </AreaChart>\n * </ChartContainer>\n * </ChartCard>\n */\n\n/** Five sizes for line charts — extends ComponentSize with xl and huge. */\ntype LineChartSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"huge\";\n\ntype LineChartLayout = {\n\t/** Plot height in px. Width stays fluid via ResponsiveContainer. */\n\theight: number;\n\t/** Outer margin. Top leaves room above the highest data point. */\n\tmargin: { top: number; right: number; bottom: number; left: number };\n\t/** Line stroke width in px. */\n\tstrokeWidth: number;\n\t/** Radius of the resting data-point dot. */\n\tdotRadius: number;\n\t/** Radius of the active (hover) dot. */\n\tactiveDotRadius: number;\n\t/** Axis tick label font size. */\n\ttickFontSize: number;\n\t/** Reserved width for the value (Y) axis. */\n\tyAxisWidth: number;\n\t/** Space between an axis and its tick labels. */\n\ttickMargin: number;\n};\n\nconst LINE_CHART_LAYOUT: Record<LineChartSize, LineChartLayout> = {\n\tsm: {\n\t\theight: 64,\n\t\tmargin: { top: 6, right: 6, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 2.5,\n\t\tactiveDotRadius: 4,\n\t\ttickFontSize: 9,\n\t\tyAxisWidth: 22,\n\t\ttickMargin: 3,\n\t},\n\tmd: {\n\t\theight: 88,\n\t\tmargin: { top: 8, right: 8, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3,\n\t\tactiveDotRadius: 4.5,\n\t\ttickFontSize: 10,\n\t\tyAxisWidth: 24,\n\t\ttickMargin: 4,\n\t},\n\tlg: {\n\t\theight: 108,\n\t\tmargin: { top: 10, right: 10, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3.5,\n\t\tactiveDotRadius: 5,\n\t\ttickFontSize: 11,\n\t\tyAxisWidth: 26,\n\t\ttickMargin: 5,\n\t},\n\txl: {\n\t\theight: 132,\n\t\tmargin: { top: 12, right: 12, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 4,\n\t\tactiveDotRadius: 5.5,\n\t\ttickFontSize: 11,\n\t\tyAxisWidth: 28,\n\t\ttickMargin: 6,\n\t},\n\thuge: {\n\t\theight: 164,\n\t\tmargin: { top: 14, right: 14, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 4.5,\n\t\tactiveDotRadius: 6,\n\t\ttickFontSize: 12,\n\t\tyAxisWidth: 30,\n\t\ttickMargin: 7,\n\t},\n};\n\n/** Map the 5 line-chart sizes to the 3 ComponentSize values for ChartCard. */\nfunction toComponentSize(size: LineChartSize): ComponentSize {\n\tif (size === \"xl\" || size === \"huge\") return \"lg\";\n\treturn size as ComponentSize;\n}\n\n/**\n * Build the colour-bound props for a `<Line>`/`<Area>` series at a given size:\n * the rounded stroke geometry plus the resting and active dots, all painted in\n * `color`. `area` adds the 15 %-opacity wash beneath the stroke.\n */\nfunction seriesProps(layout: LineChartLayout, color: string) {\n\treturn {\n\t\ttype: \"linear\" as const,\n\t\tstroke: color,\n\t\tstrokeWidth: layout.strokeWidth,\n\t\tstrokeLinejoin: \"round\" as const,\n\t\tstrokeLinecap: \"round\" as const,\n\t\tdot: { r: layout.dotRadius, fill: color, strokeWidth: 0 },\n\t\tactiveDot: {\n\t\t\tr: layout.activeDotRadius,\n\t\t\tfill: color,\n\t\t\tstroke: \"var(--color-surface-raised)\",\n\t\t\tstrokeWidth: 2,\n\t\t},\n\t};\n}\n\n/**\n * Resolve the line-chart layout for an explicit or inherited component size. The\n * returned object groups the giddaa defaults by the recharts component they\n * belong to. `line(color)`/`area(color)` return the full series props for a\n * given colour — spread each onto its element, then pass the data-specific props\n * (`config`, `data`, `dataKey`, …) directly afterwards to add or override:\n *\n * const chart = useLineChartLayout(size);\n * <ChartContainer config={config} {...chart.container}>\n * <AreaChart data={data} {...chart.chart}>\n * <XAxis dataKey=\"month\" {...chart.xAxis} />\n * <YAxis {...chart.yAxis} />\n * <Area dataKey=\"revenue\" {...chart.area(\"var(--color-revenue)\")} />\n */\nfunction useLineChartLayout(size?: LineChartSize) {\n\tconst inheritedSize = useComponentSize() as LineChartSize;\n\tconst resolved: LineChartSize = size ?? inheritedSize;\n\tconst layout = LINE_CHART_LAYOUT[resolved] ?? LINE_CHART_LAYOUT.md;\n\tconst axes = cartesianAxisProps(layout);\n\n\treturn {\n\t\tcontainer: {\n\t\t\tclassName: \"aspect-auto w-full\",\n\t\t\tstyle: { height: layout.height },\n\t\t},\n\t\tchart: {\n\t\t\taccessibilityLayer: true,\n\t\t\tmargin: layout.margin,\n\t\t},\n\t\txAxis: axes.xAxis,\n\t\tyAxis: axes.yAxis,\n\t\tline: (color: string) => seriesProps(layout, color),\n\t\tarea: (color: string) => ({\n\t\t\t...seriesProps(layout, color),\n\t\t\tfill: color,\n\t\t\tfillOpacity: 0.15,\n\t\t}),\n\t};\n}\n\nexport { LINE_CHART_LAYOUT, toComponentSize, useLineChartLayout };\nexport type { LineChartLayout, LineChartSize };\n"],"mappings":";AAEA,SAAS,WAA8B;AACvC,YAAY,WAAW;AAEvB,YAAY,uBAAuB;;;ACHnC,SAAS,eAA+B,kBAAk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M,CAAC,UAAkB,YAAY,QAAQ,KAAK;AAAA,IAClD,MAAM,CAAC,WAAmB;AAAA,MACzB,GAAG,YAAY,QAAQ,KAAK;AAAA,MAC5B,MAAM;AAAA,MACN,aAAa;AAAA,IACd;AAAA,EACD;AACD;","names":["Fragment","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../src/line-chart.tsx"],"sourcesContent":["\"use client\";\n\nimport { cartesianAxisProps } from \"./chart\";\nimport { type ComponentSize, useComponentSize } from \"./size-context\";\n\n/**\n * Line charts are composed from recharts plot primitives directly — recharts\n * identifies `Line`, `Area`, `XAxis`, `YAxis`, and `CartesianGrid` by component\n * identity and cannot be wrapped. This module supplies giddaa-specific defaults\n * that would otherwise be copy-pasted into every line chart: per-size layout\n * numbers. Pair them with the shared frame and overlays from `./chart`.\n *\n * Five sizes (sm → huge) extend the three `ComponentSize` values used elsewhere.\n * xl and huge must be passed explicitly — they cannot be inherited from\n * `SizeProvider` since `ComponentSize` only carries sm/md/lg.\n *\n * Tokens:\n * - Primary series stroke + dots + area fill: `var(--color-surface-brand)`\n * - Comparison series: `var(--color-surface-accent)`\n * - Gridlines: `var(--color-line-subtle)`\n * - Area wash: primary series colour at 15 % opacity (`fillOpacity={0.15}`)\n * - Active-dot ring: `var(--color-surface-raised)` stroke (matches card bg)\n *\n * @example\n * const chart = useLineChartLayout();\n * <ChartCard size=\"md\">\n * <ChartHeader>\n * <ChartTitle>Revenue Overview</ChartTitle>\n * <ChartDescription>Monthly revenue · Jan–Jul</ChartDescription>\n * </ChartHeader>\n * <ChartContainer config={config} {...chart.container}>\n * <AreaChart data={data} {...chart.chart}>\n * <CartesianGrid vertical={false} stroke=\"var(--color-line-subtle)\" />\n * <XAxis dataKey=\"month\" {...chart.xAxis} />\n * <YAxis {...chart.yAxis} />\n * <ChartLegend verticalAlign=\"top\" content={<ChartLegendContent marker=\"line\" />} />\n * <ChartTooltip content={<ChartTooltipContent />} />\n * <Area dataKey=\"revenue\" {...chart.area(\"var(--color-revenue)\")} />\n * </AreaChart>\n * </ChartContainer>\n * </ChartCard>\n */\n\n/** Five sizes for line charts — extends ComponentSize with xl and huge. */\ntype LineChartSize = \"sm\" | \"md\" | \"lg\" | \"xl\" | \"huge\";\n\ntype LineChartLayout = {\n\t/** Plot height in px. Width stays fluid via ResponsiveContainer. */\n\theight: number;\n\t/** Outer margin. Top leaves room above the highest data point. */\n\tmargin: { top: number; right: number; bottom: number; left: number };\n\t/** Line stroke width in px. */\n\tstrokeWidth: number;\n\t/** Radius of the resting data-point dot. */\n\tdotRadius: number;\n\t/** Radius of the active (hover) dot. */\n\tactiveDotRadius: number;\n\t/** Axis tick label font size. */\n\ttickFontSize: number;\n\t/** Reserved width for the value (Y) axis. */\n\tyAxisWidth: number;\n\t/** Space between an axis and its tick labels. */\n\ttickMargin: number;\n};\n\nconst LINE_CHART_LAYOUT: Record<LineChartSize, LineChartLayout> = {\n\tsm: {\n\t\theight: 64,\n\t\tmargin: { top: 6, right: 6, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 2.5,\n\t\tactiveDotRadius: 4,\n\t\ttickFontSize: 9,\n\t\tyAxisWidth: 22,\n\t\ttickMargin: 3,\n\t},\n\tmd: {\n\t\theight: 88,\n\t\tmargin: { top: 8, right: 8, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3,\n\t\tactiveDotRadius: 4.5,\n\t\ttickFontSize: 10,\n\t\tyAxisWidth: 24,\n\t\ttickMargin: 4,\n\t},\n\tlg: {\n\t\theight: 108,\n\t\tmargin: { top: 10, right: 10, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 3.5,\n\t\tactiveDotRadius: 5,\n\t\ttickFontSize: 11,\n\t\tyAxisWidth: 26,\n\t\ttickMargin: 5,\n\t},\n\txl: {\n\t\theight: 132,\n\t\tmargin: { top: 12, right: 12, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 4,\n\t\tactiveDotRadius: 5.5,\n\t\ttickFontSize: 11,\n\t\tyAxisWidth: 28,\n\t\ttickMargin: 6,\n\t},\n\thuge: {\n\t\theight: 164,\n\t\tmargin: { top: 14, right: 14, bottom: 0, left: 0 },\n\t\tstrokeWidth: 2,\n\t\tdotRadius: 4.5,\n\t\tactiveDotRadius: 6,\n\t\ttickFontSize: 12,\n\t\tyAxisWidth: 30,\n\t\ttickMargin: 7,\n\t},\n};\n\n/** Map the 5 line-chart sizes to the 3 ComponentSize values for ChartCard. */\nfunction toComponentSize(size: LineChartSize): ComponentSize {\n\tif (size === \"xl\" || size === \"huge\") return \"lg\";\n\treturn size as ComponentSize;\n}\n\n/**\n * Build the colour-bound props for a `<Line>`/`<Area>` series at a given size:\n * the rounded stroke geometry plus the resting and active dots, all painted in\n * `color`. `area` adds the 15 %-opacity wash beneath the stroke.\n */\nfunction seriesProps(layout: LineChartLayout, color: string) {\n\treturn {\n\t\ttype: \"linear\" as const,\n\t\tstroke: color,\n\t\tstrokeWidth: layout.strokeWidth,\n\t\tstrokeLinejoin: \"round\" as const,\n\t\tstrokeLinecap: \"round\" as const,\n\t\tdot: { r: layout.dotRadius, fill: color, strokeWidth: 0 },\n\t\tactiveDot: {\n\t\t\tr: layout.activeDotRadius,\n\t\t\tfill: color,\n\t\t\tstroke: \"var(--color-surface-raised)\",\n\t\t\tstrokeWidth: 2,\n\t\t},\n\t};\n}\n\n/**\n * Resolve the line-chart layout for an explicit or inherited component size. The\n * returned object groups the giddaa defaults by the recharts component they\n * belong to. `line(color)`/`area(color)` return the full series props for a\n * given colour — spread each onto its element, then pass the data-specific props\n * (`config`, `data`, `dataKey`, …) directly afterwards to add or override:\n *\n * const chart = useLineChartLayout(size);\n * <ChartContainer config={config} {...chart.container}>\n * <AreaChart data={data} {...chart.chart}>\n * <XAxis dataKey=\"month\" {...chart.xAxis} />\n * <YAxis {...chart.yAxis} />\n * <Area dataKey=\"revenue\" {...chart.area(\"var(--color-revenue)\")} />\n */\nfunction useLineChartLayout(size?: LineChartSize) {\n\tconst inheritedSize = useComponentSize() as LineChartSize;\n\tconst resolved: LineChartSize = size ?? inheritedSize;\n\tconst layout = LINE_CHART_LAYOUT[resolved] ?? LINE_CHART_LAYOUT.md;\n\tconst axes = cartesianAxisProps(layout);\n\n\treturn {\n\t\tcontainer: {\n\t\t\tclassName: \"aspect-auto w-full\",\n\t\t\tstyle: { height: layout.height },\n\t\t},\n\t\tchart: {\n\t\t\taccessibilityLayer: true,\n\t\t\tmargin: layout.margin,\n\t\t},\n\t\txAxis: axes.xAxis,\n\t\tyAxis: axes.yAxis,\n\t\tline: (color: string) => seriesProps(layout, color),\n\t\tarea: (color: string) => ({\n\t\t\t...seriesProps(layout, color),\n\t\t\tfill: color,\n\t\t\tfillOpacity: 0.15,\n\t\t}),\n\t};\n}\n\nexport { LINE_CHART_LAYOUT, toComponentSize, useLineChartLayout };\nexport type { LineChartLayout, LineChartSize };\n"],"mappings":";;;;;;;;;;AAiEA,IAAM,oBAA4D;AAAA,EACjE,IAAI;AAAA,IACH,QAAQ;AAAA,IACR,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAE;AAAA,IAC/C,aAAa;AAAA,IACb,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,YAAY;AAAA,EACb;AAAA,EACA,IAAI;AAAA,IACH,QAAQ;AAAA,IACR,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,EAAE;AAAA,IAC/C,aAAa;AAAA,IACb,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,YAAY;AAAA,EACb;AAAA,EACA,IAAI;AAAA,IACH,QAAQ;AAAA,IACR,QAAQ,EAAE,KAAK,IAAI,OAAO,IAAI,QAAQ,GAAG,MAAM,EAAE;AAAA,IACjD,aAAa;AAAA,IACb,WAAW;AAAA,I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