@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.
Files changed (315) hide show
  1. package/README.md +18 -6
  2. package/css/base.css +37 -0
  3. package/css/components.css +135 -0
  4. package/css/generated/shared.css +1 -0
  5. package/css/giddaa.css +402 -0
  6. package/css/preset.css +77 -0
  7. package/css/styles.css +2 -0
  8. package/css/theme.css +255 -0
  9. package/dist/accordion.d.ts +9 -10
  10. package/dist/accordion.js +41 -117
  11. package/dist/activity-timeline.d.ts +29 -0
  12. package/dist/activity-timeline.js +97 -0
  13. package/dist/alert.d.ts +8 -9
  14. package/dist/alert.js +53 -141
  15. package/dist/auth-layout.d.ts +23 -0
  16. package/dist/auth-layout.js +153 -0
  17. package/dist/avatar.d.ts +6 -6
  18. package/dist/avatar.js +40 -142
  19. package/dist/badge.d.ts +12 -13
  20. package/dist/badge.js +66 -114
  21. package/dist/bar-chart.d.ts +136 -114
  22. package/dist/bar-chart.js +244 -297
  23. package/dist/breadcrumb.d.ts +5 -5
  24. package/dist/breadcrumb.js +56 -148
  25. package/dist/bullet-chart.d.ts +33 -33
  26. package/dist/bullet-chart.js +123 -183
  27. package/dist/button-BZIeyUw6.d.ts +17 -0
  28. package/dist/button-group.d.ts +13 -16
  29. package/dist/button-group.js +38 -163
  30. package/dist/button.d.ts +2 -19
  31. package/dist/button.js +90 -142
  32. package/dist/calendar.d.ts +6 -6
  33. package/dist/calendar.js +134 -288
  34. package/dist/card.d.ts +14 -16
  35. package/dist/card.js +58 -174
  36. package/dist/carousel.d.ts +34 -35
  37. package/dist/carousel.js +319 -378
  38. package/dist/chart.d.ts +58 -59
  39. package/dist/chart.js +350 -466
  40. package/dist/checkbox.d.ts +10 -12
  41. package/dist/checkbox.js +84 -84
  42. package/dist/cn-BI_4DMBf.js +23 -0
  43. package/dist/collapsible.d.ts +7 -8
  44. package/dist/collapsible.js +23 -77
  45. package/dist/combobox.d.ts +10 -10
  46. package/dist/combobox.js +220 -696
  47. package/dist/cta.d.ts +64 -0
  48. package/dist/cta.js +192 -0
  49. package/dist/currency-selector.d.ts +41 -0
  50. package/dist/currency-selector.js +114 -0
  51. package/dist/data-table.d.ts +164 -0
  52. package/dist/data-table.js +673 -0
  53. package/dist/date-picker.d.ts +27 -20
  54. package/dist/date-picker.js +122 -520
  55. package/dist/details-card.d.ts +19 -0
  56. package/dist/details-card.js +118 -0
  57. package/dist/dialog.d.ts +13 -14
  58. package/dist/dialog.js +117 -320
  59. package/dist/dropdown-menu.d.ts +14 -14
  60. package/dist/dropdown-menu.js +170 -365
  61. package/dist/dropzone.d.ts +55 -55
  62. package/dist/dropzone.js +328 -467
  63. package/dist/editorial-card.d.ts +27 -0
  64. package/dist/editorial-card.js +144 -0
  65. package/dist/empty-state.d.ts +8 -9
  66. package/dist/empty-state.js +48 -135
  67. package/dist/field.d.ts +23 -25
  68. package/dist/field.js +111 -327
  69. package/dist/filter.d.ts +118 -0
  70. package/dist/filter.js +775 -0
  71. package/dist/footer.d.ts +40 -0
  72. package/dist/footer.js +227 -0
  73. package/dist/funnel-chart.d.ts +38 -41
  74. package/dist/funnel-chart.js +168 -563
  75. package/dist/gallery-indicator.d.ts +17 -0
  76. package/dist/gallery-indicator.js +75 -0
  77. package/dist/heatmap-chart.d.ts +95 -0
  78. package/dist/heatmap-chart.js +197 -0
  79. package/dist/infotip.d.ts +10 -0
  80. package/dist/infotip.js +40 -0
  81. package/dist/input-CfoEJ8A6.d.ts +12 -0
  82. package/dist/input-group.d.ts +16 -19
  83. package/dist/input-group.js +92 -372
  84. package/dist/input-size-context-C-SFx9sx.d.ts +10 -0
  85. package/dist/input-size-context.d.ts +2 -11
  86. package/dist/input-size-context.js +14 -20
  87. package/dist/input.d.ts +2 -13
  88. package/dist/input.js +23 -79
  89. package/dist/item.d.ts +7 -8
  90. package/dist/item.js +22 -89
  91. package/dist/kpi-card.d.ts +18 -20
  92. package/dist/kpi-card.js +84 -232
  93. package/dist/label.d.ts +6 -6
  94. package/dist/label.js +39 -66
  95. package/dist/line-chart.d.ts +88 -89
  96. package/dist/line-chart.js +143 -262
  97. package/dist/logo.d.ts +4 -4
  98. package/dist/logo.js +87 -141
  99. package/dist/map-indicator.d.ts +13 -0
  100. package/dist/map-indicator.js +83 -0
  101. package/dist/match.d.ts +15 -0
  102. package/dist/match.js +68 -0
  103. package/dist/media-gallery-hero.d.ts +58 -0
  104. package/dist/media-gallery-hero.js +201 -0
  105. package/dist/media-player.d.ts +60 -0
  106. package/dist/media-player.js +919 -0
  107. package/dist/multi-step-form.d.ts +56 -0
  108. package/dist/multi-step-form.js +342 -0
  109. package/dist/number-input.d.ts +34 -34
  110. package/dist/number-input.js +62 -413
  111. package/dist/page-header.d.ts +10 -11
  112. package/dist/page-header.js +34 -107
  113. package/dist/pagination.d.ts +17 -20
  114. package/dist/pagination.js +132 -341
  115. package/dist/password-input.d.ts +5 -12
  116. package/dist/password-input.js +32 -354
  117. package/dist/phone-input.d.ts +19 -19
  118. package/dist/phone-input.js +232 -561
  119. package/dist/photo-gallery.d.ts +20 -20
  120. package/dist/photo-gallery.js +314 -746
  121. package/dist/picker-lzgmsNfG.js +32 -0
  122. package/dist/pie-chart.d.ts +60 -60
  123. package/dist/pie-chart.js +141 -184
  124. package/dist/popover.d.ts +9 -9
  125. package/dist/popover.js +60 -156
  126. package/dist/price-tag.d.ts +34 -0
  127. package/dist/price-tag.js +118 -0
  128. package/dist/progress.d.ts +18 -16
  129. package/dist/progress.js +156 -300
  130. package/dist/property-listing-card.d.ts +29 -0
  131. package/dist/property-listing-card.js +117 -0
  132. package/dist/radar-chart.d.ts +108 -0
  133. package/dist/radar-chart.js +172 -0
  134. package/dist/radio-group.d.ts +11 -13
  135. package/dist/radio-group.js +47 -96
  136. package/dist/review-block.d.ts +18 -0
  137. package/dist/review-block.js +154 -0
  138. package/dist/rich-text-editor.d.ts +30 -14
  139. package/dist/rich-text-editor.js +594 -979
  140. package/dist/scatter-chart.d.ts +140 -0
  141. package/dist/scatter-chart.js +248 -0
  142. package/dist/search-input.d.ts +8 -15
  143. package/dist/search-input.js +58 -408
  144. package/dist/select.d.ts +8 -8
  145. package/dist/select.js +131 -291
  146. package/dist/separator.d.ts +8 -9
  147. package/dist/separator.js +31 -70
  148. package/dist/sheet.d.ts +11 -11
  149. package/dist/sheet.js +84 -262
  150. package/dist/sidebar.d.ts +32 -37
  151. package/dist/sidebar.js +380 -1055
  152. package/dist/size-context-D4mYvcg8.d.ts +10 -0
  153. package/dist/size-context.d.ts +2 -11
  154. package/dist/size-context.js +14 -18
  155. package/dist/skeleton.d.ts +4 -5
  156. package/dist/skeleton.js +9 -45
  157. package/dist/slider.d.ts +27 -0
  158. package/dist/slider.js +81 -0
  159. package/dist/sparkline.d.ts +43 -46
  160. package/dist/sparkline.js +223 -561
  161. package/dist/stepper.d.ts +23 -24
  162. package/dist/stepper.js +149 -276
  163. package/dist/styles.css +9995 -2
  164. package/dist/switch.d.ts +10 -12
  165. package/dist/switch.js +49 -106
  166. package/dist/table-card.d.ts +35 -0
  167. package/dist/table-card.js +125 -0
  168. package/dist/table.d.ts +18 -14
  169. package/dist/table.js +114 -182
  170. package/dist/tabs.d.ts +23 -15
  171. package/dist/tabs.js +62 -149
  172. package/dist/tag.d.ts +22 -23
  173. package/dist/tag.js +104 -156
  174. package/dist/testimonial-block.d.ts +33 -0
  175. package/dist/testimonial-block.js +208 -0
  176. package/dist/textarea-IS_D8pXf.d.ts +11 -0
  177. package/dist/textarea.d.ts +2 -12
  178. package/dist/textarea.js +20 -74
  179. package/dist/time-picker.d.ts +11 -11
  180. package/dist/time-picker.js +247 -464
  181. package/dist/toast.d.ts +16 -18
  182. package/dist/toast.js +154 -310
  183. package/dist/tooltip.d.ts +9 -10
  184. package/dist/tooltip.js +33 -91
  185. package/dist/tree-map.d.ts +54 -57
  186. package/dist/tree-map.js +231 -646
  187. package/dist/use-uncontrolled-CLfM1XbB.js +21 -0
  188. package/dist/waterfall-chart.d.ts +126 -0
  189. package/dist/waterfall-chart.js +480 -0
  190. package/package.json +123 -34
  191. package/dist/accordion.js.map +0 -1
  192. package/dist/alert.js.map +0 -1
  193. package/dist/avatar.js.map +0 -1
  194. package/dist/badge.js.map +0 -1
  195. package/dist/bar-chart.js.map +0 -1
  196. package/dist/base.css +0 -32
  197. package/dist/breadcrumb.js.map +0 -1
  198. package/dist/bullet-chart.js.map +0 -1
  199. package/dist/button-group.js.map +0 -1
  200. package/dist/button.js.map +0 -1
  201. package/dist/calendar.js.map +0 -1
  202. package/dist/card.js.map +0 -1
  203. package/dist/carousel.js.map +0 -1
  204. package/dist/chart.js.map +0 -1
  205. package/dist/checkbox.js.map +0 -1
  206. package/dist/collapsible.js.map +0 -1
  207. package/dist/combobox.js.map +0 -1
  208. package/dist/date-picker.js.map +0 -1
  209. package/dist/dialog.js.map +0 -1
  210. package/dist/dropdown-menu.js.map +0 -1
  211. package/dist/dropzone.js.map +0 -1
  212. package/dist/empty-state.js.map +0 -1
  213. package/dist/field.js.map +0 -1
  214. package/dist/files/red-hat-display-latin-300-italic.woff +0 -0
  215. package/dist/files/red-hat-display-latin-300-italic.woff2 +0 -0
  216. package/dist/files/red-hat-display-latin-300-normal.woff +0 -0
  217. package/dist/files/red-hat-display-latin-300-normal.woff2 +0 -0
  218. package/dist/files/red-hat-display-latin-400-italic.woff +0 -0
  219. package/dist/files/red-hat-display-latin-400-italic.woff2 +0 -0
  220. package/dist/files/red-hat-display-latin-400-normal.woff +0 -0
  221. package/dist/files/red-hat-display-latin-400-normal.woff2 +0 -0
  222. package/dist/files/red-hat-display-latin-500-italic.woff +0 -0
  223. package/dist/files/red-hat-display-latin-500-italic.woff2 +0 -0
  224. package/dist/files/red-hat-display-latin-500-normal.woff +0 -0
  225. package/dist/files/red-hat-display-latin-500-normal.woff2 +0 -0
  226. package/dist/files/red-hat-display-latin-600-italic.woff +0 -0
  227. package/dist/files/red-hat-display-latin-600-italic.woff2 +0 -0
  228. package/dist/files/red-hat-display-latin-600-normal.woff +0 -0
  229. package/dist/files/red-hat-display-latin-600-normal.woff2 +0 -0
  230. package/dist/files/red-hat-display-latin-700-italic.woff +0 -0
  231. package/dist/files/red-hat-display-latin-700-italic.woff2 +0 -0
  232. package/dist/files/red-hat-display-latin-700-normal.woff +0 -0
  233. package/dist/files/red-hat-display-latin-700-normal.woff2 +0 -0
  234. package/dist/files/red-hat-display-latin-800-italic.woff +0 -0
  235. package/dist/files/red-hat-display-latin-800-italic.woff2 +0 -0
  236. package/dist/files/red-hat-display-latin-800-normal.woff +0 -0
  237. package/dist/files/red-hat-display-latin-800-normal.woff2 +0 -0
  238. package/dist/files/red-hat-display-latin-900-italic.woff +0 -0
  239. package/dist/files/red-hat-display-latin-900-italic.woff2 +0 -0
  240. package/dist/files/red-hat-display-latin-900-normal.woff +0 -0
  241. package/dist/files/red-hat-display-latin-900-normal.woff2 +0 -0
  242. package/dist/files/red-hat-display-latin-ext-300-italic.woff +0 -0
  243. package/dist/files/red-hat-display-latin-ext-300-italic.woff2 +0 -0
  244. package/dist/files/red-hat-display-latin-ext-300-normal.woff +0 -0
  245. package/dist/files/red-hat-display-latin-ext-300-normal.woff2 +0 -0
  246. package/dist/files/red-hat-display-latin-ext-400-italic.woff +0 -0
  247. package/dist/files/red-hat-display-latin-ext-400-italic.woff2 +0 -0
  248. package/dist/files/red-hat-display-latin-ext-400-normal.woff +0 -0
  249. package/dist/files/red-hat-display-latin-ext-400-normal.woff2 +0 -0
  250. package/dist/files/red-hat-display-latin-ext-500-italic.woff +0 -0
  251. package/dist/files/red-hat-display-latin-ext-500-italic.woff2 +0 -0
  252. package/dist/files/red-hat-display-latin-ext-500-normal.woff +0 -0
  253. package/dist/files/red-hat-display-latin-ext-500-normal.woff2 +0 -0
  254. package/dist/files/red-hat-display-latin-ext-600-italic.woff +0 -0
  255. package/dist/files/red-hat-display-latin-ext-600-italic.woff2 +0 -0
  256. package/dist/files/red-hat-display-latin-ext-600-normal.woff +0 -0
  257. package/dist/files/red-hat-display-latin-ext-600-normal.woff2 +0 -0
  258. package/dist/files/red-hat-display-latin-ext-700-italic.woff +0 -0
  259. package/dist/files/red-hat-display-latin-ext-700-italic.woff2 +0 -0
  260. package/dist/files/red-hat-display-latin-ext-700-normal.woff +0 -0
  261. package/dist/files/red-hat-display-latin-ext-700-normal.woff2 +0 -0
  262. package/dist/files/red-hat-display-latin-ext-800-italic.woff +0 -0
  263. package/dist/files/red-hat-display-latin-ext-800-italic.woff2 +0 -0
  264. package/dist/files/red-hat-display-latin-ext-800-normal.woff +0 -0
  265. package/dist/files/red-hat-display-latin-ext-800-normal.woff2 +0 -0
  266. package/dist/files/red-hat-display-latin-ext-900-italic.woff +0 -0
  267. package/dist/files/red-hat-display-latin-ext-900-italic.woff2 +0 -0
  268. package/dist/files/red-hat-display-latin-ext-900-normal.woff +0 -0
  269. package/dist/files/red-hat-display-latin-ext-900-normal.woff2 +0 -0
  270. package/dist/funnel-chart.js.map +0 -1
  271. package/dist/index.d.ts +0 -87
  272. package/dist/index.js +0 -10448
  273. package/dist/index.js.map +0 -1
  274. package/dist/input-group.js.map +0 -1
  275. package/dist/input-size-context.js.map +0 -1
  276. package/dist/input.js.map +0 -1
  277. package/dist/item.js.map +0 -1
  278. package/dist/kpi-card.js.map +0 -1
  279. package/dist/label.js.map +0 -1
  280. package/dist/line-chart.js.map +0 -1
  281. package/dist/logo.js.map +0 -1
  282. package/dist/number-input.js.map +0 -1
  283. package/dist/page-header.js.map +0 -1
  284. package/dist/pagination.js.map +0 -1
  285. package/dist/password-input.js.map +0 -1
  286. package/dist/phone-input.js.map +0 -1
  287. package/dist/photo-gallery.js.map +0 -1
  288. package/dist/pie-chart.js.map +0 -1
  289. package/dist/popover.js.map +0 -1
  290. package/dist/progress.js.map +0 -1
  291. package/dist/radio-group.js.map +0 -1
  292. package/dist/red-hat-display.css +0 -2
  293. package/dist/rich-text-editor.js.map +0 -1
  294. package/dist/search-input.js.map +0 -1
  295. package/dist/select.js.map +0 -1
  296. package/dist/separator.js.map +0 -1
  297. package/dist/sheet.js.map +0 -1
  298. package/dist/sidebar.js.map +0 -1
  299. package/dist/size-context.js.map +0 -1
  300. package/dist/skeleton.js.map +0 -1
  301. package/dist/sparkline.js.map +0 -1
  302. package/dist/stepper.js.map +0 -1
  303. package/dist/switch.js.map +0 -1
  304. package/dist/tab-list.d.ts +0 -38
  305. package/dist/tab-list.js +0 -394
  306. package/dist/tab-list.js.map +0 -1
  307. package/dist/table.js.map +0 -1
  308. package/dist/tabs.js.map +0 -1
  309. package/dist/tag.js.map +0 -1
  310. package/dist/textarea.js.map +0 -1
  311. package/dist/theme/giddaa.css +0 -2
  312. package/dist/time-picker.js.map +0 -1
  313. package/dist/toast.js.map +0 -1
  314. package/dist/tooltip.js.map +0 -1
  315. package/dist/tree-map.js.map +0 -1
package/dist/chart.js CHANGED
@@ -1,494 +1,378 @@
1
- // src/components/ui/chart.tsx
1
+ "use client";
2
+ import { t as cn } from "./cn-BI_4DMBf.js";
3
+ import { SizeProvider, useComponentSize } from "./size-context.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
5
  import { cva } from "class-variance-authority";
3
6
  import * as React from "react";
4
7
  import * as RechartsPrimitive from "recharts";
5
-
6
- // src/lib/cn.ts
7
- import { clsx } from "clsx";
8
- import { extendTailwindMerge } from "tailwind-merge";
9
- var twMerge = extendTailwindMerge({
10
- extend: {
11
- classGroups: {
12
- "font-size": [
13
- {
14
- text: [
15
- "gdt-display",
16
- "gdt-h1",
17
- "gdt-h2",
18
- "gdt-h3",
19
- "gdt-h4",
20
- "gdt-h5",
21
- "gdt-xl",
22
- "gdt-lg",
23
- "gdt-md",
24
- "gdt-sm",
25
- "gdt-xs",
26
- "gdt-subtext",
27
- "gdt-capitalized"
28
- ]
29
- }
30
- ]
31
- }
32
- }
33
- });
34
- function cn(...inputs) {
35
- return twMerge(clsx(inputs));
36
- }
37
-
38
- // src/components/ui/size-context.tsx
39
- import { createContext, useContext } from "react";
40
- import { Fragment, jsx } from "react/jsx-runtime";
41
- var SizeContext = createContext(void 0);
42
- function SizeProvider({
43
- children,
44
- size
45
- }) {
46
- if (!size) {
47
- return /* @__PURE__ */ jsx(Fragment, { children });
48
- }
49
- return /* @__PURE__ */ jsx(SizeContext.Provider, { value: size, children });
50
- }
51
- function useComponentSize(size, fallback = "md") {
52
- const inheritedSize = useContext(SizeContext);
53
- return size ?? inheritedSize ?? fallback;
54
- }
55
-
56
- // src/components/ui/chart.tsx
57
- import { Fragment as Fragment2, jsx as jsx2, jsxs } from "react/jsx-runtime";
58
- var SERIES_COLOR_PLACEHOLDER = "var(--color-surface-brand)";
8
+ //#region src/chart.tsx
9
+ /**
10
+ * Markers use `--color-surface-brand` as a placeholder. Giddaa has no
11
+ * categorical chart palette yet — add `chart-1`…`chart-N` tokens and bind each
12
+ * series (its legend marker and tooltip dot) to its own colour once they exist.
13
+ * Until then any series without an explicit colour paints brand-green.
14
+ */
15
+ const SERIES_COLOR_PLACEHOLDER = "var(--color-surface-brand)";
59
16
  function formatChartValue(value, type) {
60
- if (Array.isArray(value)) {
61
- return value.join(", ");
62
- }
63
- if (typeof value !== "number") {
64
- return value == null ? "" : String(value);
65
- }
66
- switch (type) {
67
- case "currency":
68
- return `\u20A6${value.toLocaleString("en-NG")}`;
69
- case "percentage":
70
- return `${value.toLocaleString("en-NG", {
71
- minimumFractionDigits: 1,
72
- maximumFractionDigits: 1
73
- })}%`;
74
- default:
75
- return value.toLocaleString("en-NG");
76
- }
17
+ if (Array.isArray(value)) return value.join(", ");
18
+ if (typeof value !== "number") return value == null ? "" : String(value);
19
+ switch (type) {
20
+ case "currency": return `₦${value.toLocaleString("en-NG")}`;
21
+ case "percentage": return `${value.toLocaleString("en-NG", {
22
+ minimumFractionDigits: 1,
23
+ maximumFractionDigits: 1
24
+ })}%`;
25
+ default: return value.toLocaleString("en-NG");
26
+ }
77
27
  }
78
- var THEMES = { light: "", dark: ".dark" };
79
- var INITIAL_DIMENSION = { width: 320, height: 200 };
80
- var ChartContext = React.createContext(null);
28
+ const THEMES = {
29
+ light: "",
30
+ dark: ".dark"
31
+ };
32
+ const INITIAL_DIMENSION = {
33
+ width: 320,
34
+ height: 200
35
+ };
36
+ const ChartContext = React.createContext(null);
81
37
  function useChart() {
82
- const context = React.useContext(ChartContext);
83
- if (!context) {
84
- throw new Error("useChart must be used within a <ChartContainer />");
85
- }
86
- return context;
38
+ const context = React.useContext(ChartContext);
39
+ if (!context) throw new Error("useChart must be used within a <ChartContainer />");
40
+ return context;
87
41
  }
88
- var chartCardVariants = cva(
89
- "flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1",
90
- {
91
- variants: {
92
- size: {
93
- sm: "gap-3 p-4",
94
- md: "gap-4 p-5",
95
- lg: "gap-5 p-6"
96
- }
97
- },
98
- defaultVariants: { size: "md" }
99
- }
100
- );
101
- function ChartCard({
102
- className,
103
- size,
104
- children,
105
- ...props
106
- }) {
107
- const resolvedSize = useComponentSize(size);
108
- return /* @__PURE__ */ jsx2(SizeProvider, { size: resolvedSize, children: /* @__PURE__ */ jsx2(
109
- "section",
110
- {
111
- "data-slot": "chart-card",
112
- className: cn(chartCardVariants({ size: resolvedSize }), className),
113
- ...props,
114
- children
115
- }
116
- ) });
42
+ /**
43
+ * Shared chart frame the chrome that surrounds the plot of any chart type
44
+ * (bar, line, area, pie). These are presentational, domain-free, and size-aware:
45
+ * a `size` flows through `SizeProvider` so the plot and its labels can scale
46
+ * with the card. Compose them with the plot primitives:
47
+ *
48
+ * <ChartCard size="md">
49
+ * <ChartHeader>
50
+ * <ChartTitle>Revenue Overview</ChartTitle>
51
+ * <ChartDescription>Monthly revenue · Jan–Jul</ChartDescription>
52
+ * </ChartHeader>
53
+ * <ChartContainer config={config}>{/* recharts plot *\/}</ChartContainer>
54
+ * </ChartCard>
55
+ */
56
+ const chartCardVariants = cva("flex w-full min-w-0 flex-col rounded-2xl border border-line-subtle bg-surface-raised text-fg-primary shadow-1", {
57
+ variants: { size: {
58
+ sm: "gap-3 p-4",
59
+ md: "gap-4 p-5",
60
+ lg: "gap-5 p-6"
61
+ } },
62
+ defaultVariants: { size: "md" }
63
+ });
64
+ function ChartCard({ className, size, children, ...props }) {
65
+ const resolvedSize = useComponentSize(size);
66
+ return /* @__PURE__ */ jsx(SizeProvider, {
67
+ size: resolvedSize,
68
+ children: /* @__PURE__ */ jsx("section", {
69
+ "data-slot": "chart-card",
70
+ className: cn(chartCardVariants({ size: resolvedSize }), className),
71
+ ...props,
72
+ children
73
+ })
74
+ });
117
75
  }
118
76
  function ChartHeader({ className, ...props }) {
119
- return /* @__PURE__ */ jsx2(
120
- "div",
121
- {
122
- "data-slot": "chart-header",
123
- className: cn("flex min-w-0 flex-col gap-1", className),
124
- ...props
125
- }
126
- );
77
+ return /* @__PURE__ */ jsx("div", {
78
+ "data-slot": "chart-header",
79
+ className: cn("flex min-w-0 flex-col gap-1", className),
80
+ ...props
81
+ });
127
82
  }
128
- var chartTitleVariants = cva("min-w-0 font-bold text-fg-primary", {
129
- variants: {
130
- size: {
131
- sm: "text-gdt-md",
132
- md: "text-gdt-lg",
133
- lg: "text-gdt-h5"
134
- }
135
- },
136
- defaultVariants: { size: "md" }
83
+ const chartTitleVariants = cva("min-w-0 font-bold text-fg-primary", {
84
+ variants: { size: {
85
+ sm: "text-gdt-md",
86
+ md: "text-gdt-lg",
87
+ lg: "text-gdt-h5"
88
+ } },
89
+ defaultVariants: { size: "md" }
137
90
  });
138
- function ChartTitle({
139
- className,
140
- size,
141
- ...props
142
- }) {
143
- const resolvedSize = useComponentSize(size);
144
- return /* @__PURE__ */ jsx2(
145
- "h3",
146
- {
147
- "data-slot": "chart-title",
148
- className: cn(chartTitleVariants({ size: resolvedSize }), className),
149
- ...props
150
- }
151
- );
91
+ function ChartTitle({ className, size, ...props }) {
92
+ const resolvedSize = useComponentSize(size);
93
+ return /* @__PURE__ */ jsx("h3", {
94
+ "data-slot": "chart-title",
95
+ className: cn(chartTitleVariants({ size: resolvedSize }), className),
96
+ ...props
97
+ });
152
98
  }
153
- var chartDescriptionVariants = cva("min-w-0 font-normal text-fg-secondary", {
154
- variants: {
155
- size: {
156
- sm: "text-gdt-xs",
157
- md: "text-gdt-sm",
158
- lg: "text-gdt-sm"
159
- }
160
- },
161
- defaultVariants: { size: "md" }
99
+ const chartDescriptionVariants = cva("min-w-0 font-normal text-fg-secondary", {
100
+ variants: { size: {
101
+ sm: "text-gdt-xs",
102
+ md: "text-gdt-sm",
103
+ lg: "text-gdt-sm"
104
+ } },
105
+ defaultVariants: { size: "md" }
162
106
  });
163
- function ChartDescription({
164
- className,
165
- size,
166
- ...props
167
- }) {
168
- const resolvedSize = useComponentSize(size);
169
- return /* @__PURE__ */ jsx2(
170
- "p",
171
- {
172
- "data-slot": "chart-description",
173
- className: cn(
174
- chartDescriptionVariants({ size: resolvedSize }),
175
- className
176
- ),
177
- ...props
178
- }
179
- );
107
+ function ChartDescription({ className, size, ...props }) {
108
+ const resolvedSize = useComponentSize(size);
109
+ return /* @__PURE__ */ jsx("p", {
110
+ "data-slot": "chart-description",
111
+ className: cn(chartDescriptionVariants({ size: resolvedSize }), className),
112
+ ...props
113
+ });
180
114
  }
181
- function ChartContainer({
182
- id,
183
- className,
184
- children,
185
- config,
186
- initialDimension = INITIAL_DIMENSION,
187
- ...props
188
- }) {
189
- const uniqueId = React.useId();
190
- const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
191
- return /* @__PURE__ */ jsx2(ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxs(
192
- "div",
193
- {
194
- "data-slot": "chart",
195
- "data-chart": chartId,
196
- className: cn(
197
- "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",
198
- className
199
- ),
200
- ...props,
201
- children: [
202
- /* @__PURE__ */ jsx2(ChartStyle, { id: chartId, config }),
203
- /* @__PURE__ */ jsx2(
204
- RechartsPrimitive.ResponsiveContainer,
205
- {
206
- initialDimension,
207
- children
208
- }
209
- )
210
- ]
211
- }
212
- ) });
115
+ function ChartContainer({ id, className, children, config, initialDimension = INITIAL_DIMENSION, ...props }) {
116
+ const uniqueId = React.useId();
117
+ const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
118
+ return /* @__PURE__ */ jsx(ChartContext.Provider, {
119
+ value: { config },
120
+ children: /* @__PURE__ */ jsxs("div", {
121
+ "data-slot": "chart",
122
+ "data-chart": chartId,
123
+ className: cn("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", className),
124
+ ...props,
125
+ children: [/* @__PURE__ */ jsx(ChartStyle, {
126
+ id: chartId,
127
+ config
128
+ }), /* @__PURE__ */ jsx(RechartsPrimitive.ResponsiveContainer, {
129
+ initialDimension,
130
+ children
131
+ })]
132
+ })
133
+ });
213
134
  }
214
- var ChartStyle = ({ id, config }) => {
215
- const colorConfig = Object.entries(config).filter(
216
- ([, config2]) => config2.theme ?? config2.color
217
- );
218
- if (!colorConfig.length) {
219
- return null;
220
- }
221
- const styleContent = Object.entries(THEMES).map(
222
- ([theme, prefix]) => `
135
+ const ChartStyle = ({ id, config }) => {
136
+ const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
137
+ if (!colorConfig.length) return null;
138
+ return /* @__PURE__ */ jsx("style", { children: Object.entries(THEMES).map(([theme, prefix]) => `
223
139
  ${prefix} [data-chart=${id}] {
224
140
  ${colorConfig.map(([key, itemConfig]) => {
225
- const color = itemConfig.theme?.[theme] ?? itemConfig.color;
226
- return color ? ` --color-${key}: ${color};` : null;
227
- }).join("\n")}
141
+ const color = itemConfig.theme?.[theme] ?? itemConfig.color;
142
+ return color ? ` --color-${key}: ${color};` : null;
143
+ }).join("\n")}
228
144
  }
229
- `
230
- ).join("\n");
231
- return /* @__PURE__ */ jsx2("style", { children: styleContent });
145
+ `).join("\n") });
232
146
  };
233
- var ChartTooltip = RechartsPrimitive.Tooltip;
234
- var chartTooltipVariants = cva(
235
- "flex flex-col bg-surface-overlay border border-line-subtle shadow-2",
236
- {
237
- variants: {
238
- size: {
239
- xs: "gap-0.5 rounded-md p-2",
240
- sm: "gap-0.5 rounded-md p-2.5",
241
- md: "gap-1 rounded-lg p-3",
242
- lg: "gap-1 rounded-xl p-3.5"
243
- }
244
- },
245
- defaultVariants: {
246
- size: "md"
247
- }
248
- }
249
- );
250
- var chartTooltipDotVariants = cva("shrink-0 rounded-full", {
251
- variants: {
252
- size: {
253
- xs: "size-1.5",
254
- sm: "size-2",
255
- md: "size-2.5",
256
- lg: "size-2.5"
257
- }
258
- },
259
- defaultVariants: {
260
- size: "md"
261
- }
147
+ const ChartTooltip = RechartsPrimitive.Tooltip;
148
+ /**
149
+ * Hover tooltip for a chart data point. It surfaces a single precise value with
150
+ * type-appropriate formatting — grouped integers, percentages, or ₦-prefixed
151
+ * currency — sitting on an elevated overlay (bg-surface-overlay, Shadow-2,
152
+ * 1px border-subtle) so users can read exact figures without leaving the chart.
153
+ *
154
+ * Anatomy: series dot · metric label · hero value · period caption.
155
+ */
156
+ const chartTooltipVariants = cva("flex flex-col bg-surface-overlay border border-line-subtle shadow-2", {
157
+ variants: { size: {
158
+ xs: "gap-0.5 rounded-md p-2",
159
+ sm: "gap-0.5 rounded-md p-2.5",
160
+ md: "gap-1 rounded-lg p-3",
161
+ lg: "gap-1 rounded-xl p-3.5"
162
+ } },
163
+ defaultVariants: { size: "md" }
164
+ });
165
+ const chartTooltipDotVariants = cva("shrink-0 rounded-full", {
166
+ variants: { size: {
167
+ xs: "size-1.5",
168
+ sm: "size-2",
169
+ md: "size-2.5",
170
+ lg: "size-2.5"
171
+ } },
172
+ defaultVariants: { size: "md" }
173
+ });
174
+ const chartTooltipLabelVariants = cva("font-medium text-fg-secondary", {
175
+ variants: { size: {
176
+ xs: "text-gdt-xs",
177
+ sm: "text-gdt-xs",
178
+ md: "text-gdt-sm",
179
+ lg: "text-gdt-sm"
180
+ } },
181
+ defaultVariants: { size: "md" }
262
182
  });
263
- var chartTooltipLabelVariants = cva("font-medium text-fg-secondary", {
264
- variants: {
265
- size: {
266
- xs: "text-gdt-xs",
267
- sm: "text-gdt-xs",
268
- md: "text-gdt-sm",
269
- lg: "text-gdt-sm"
270
- }
271
- },
272
- defaultVariants: { size: "md" }
183
+ const chartTooltipValueVariants = cva("font-extrabold text-fg-primary tabular-nums", {
184
+ variants: { size: {
185
+ xs: "text-gdt-sm",
186
+ sm: "text-gdt-md",
187
+ md: "text-gdt-lg",
188
+ lg: "text-gdt-xl"
189
+ } },
190
+ defaultVariants: { size: "md" }
273
191
  });
274
- var chartTooltipValueVariants = cva(
275
- "font-extrabold text-fg-primary tabular-nums",
276
- {
277
- variants: {
278
- size: {
279
- xs: "text-gdt-sm",
280
- sm: "text-gdt-md",
281
- md: "text-gdt-lg",
282
- lg: "text-gdt-xl"
283
- }
284
- },
285
- defaultVariants: { size: "md" }
286
- }
287
- );
288
- function ChartTooltipContent({
289
- active,
290
- payload,
291
- className,
292
- hideIndicator = false,
293
- label,
294
- labelFormatter,
295
- formatter,
296
- color,
297
- nameKey,
298
- valueType = "number",
299
- size = "md"
300
- }) {
301
- const { config } = useChart();
302
- if (!active || !payload?.length) {
303
- return null;
304
- }
305
- const [item] = payload.filter((entry) => entry.type !== "none");
306
- if (!item) {
307
- return null;
308
- }
309
- const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
310
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
311
- const dotColor = color ?? item.payload?.fill ?? item.color ?? SERIES_COLOR_PLACEHOLDER;
312
- const metricLabel = itemConfig?.label ?? item.name;
313
- const heroValue = formatter ? formatter(item.value, item.name ?? "", item, 0, item.payload) : formatChartValue(item.value, valueType);
314
- const periodCaption = labelFormatter ? labelFormatter(label, payload) : (typeof label === "string" ? config[label]?.label : null) ?? label;
315
- return /* @__PURE__ */ jsxs("div", { className: cn(chartTooltipVariants({ size }), className), children: [
316
- metricLabel != null && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:shrink-0", children: [
317
- !hideIndicator && (itemConfig?.icon ? /* @__PURE__ */ jsx2(itemConfig.icon, {}) : /* @__PURE__ */ jsx2(
318
- "span",
319
- {
320
- "aria-hidden": "true",
321
- className: cn(chartTooltipDotVariants({ size })),
322
- style: { backgroundColor: dotColor }
323
- }
324
- )),
325
- /* @__PURE__ */ jsx2("span", { className: cn(chartTooltipLabelVariants({ size })), children: metricLabel })
326
- ] }),
327
- /* @__PURE__ */ jsx2("p", { className: cn(chartTooltipValueVariants({ size })), children: heroValue }),
328
- periodCaption != null && periodCaption !== "" && /* @__PURE__ */ jsx2("p", { className: "text-gdt-xs text-fg-caption-placeholder", children: periodCaption })
329
- ] });
192
+ function ChartTooltipContent({ active, payload, className, hideIndicator = false, label, labelFormatter, formatter, color, nameKey, valueType = "number", size = "md" }) {
193
+ const { config } = useChart();
194
+ if (!active || !payload?.length) return null;
195
+ const [item] = payload.filter((entry) => entry.type !== "none");
196
+ if (!item) return null;
197
+ const itemConfig = getPayloadConfigFromPayload(config, item, `${nameKey ?? item.name ?? item.dataKey ?? "value"}`);
198
+ const dotColor = color ?? item.payload?.fill ?? item.color ?? SERIES_COLOR_PLACEHOLDER;
199
+ const metricLabel = itemConfig?.label ?? item.name;
200
+ const heroValue = formatter ? formatter(item.value, item.name ?? "", item, 0, item.payload) : formatChartValue(item.value, valueType);
201
+ const periodCaption = labelFormatter ? labelFormatter(label, payload) : (typeof label === "string" ? config[label]?.label : null) ?? label;
202
+ return /* @__PURE__ */ jsxs("div", {
203
+ className: cn(chartTooltipVariants({ size }), className),
204
+ children: [
205
+ metricLabel != null && /* @__PURE__ */ jsxs("div", {
206
+ className: "flex items-center gap-1.5 [&>svg]:size-3 [&>svg]:shrink-0",
207
+ children: [!hideIndicator && (itemConfig?.icon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("span", {
208
+ "aria-hidden": "true",
209
+ className: cn(chartTooltipDotVariants({ size })),
210
+ style: { backgroundColor: dotColor }
211
+ })), /* @__PURE__ */ jsx("span", {
212
+ className: cn(chartTooltipLabelVariants({ size })),
213
+ children: metricLabel
214
+ })]
215
+ }),
216
+ /* @__PURE__ */ jsx("p", {
217
+ className: cn(chartTooltipValueVariants({ size })),
218
+ children: heroValue
219
+ }),
220
+ periodCaption != null && periodCaption !== "" && /* @__PURE__ */ jsx("p", {
221
+ className: "text-gdt-xs text-fg-caption-placeholder",
222
+ children: periodCaption
223
+ })
224
+ ]
225
+ });
330
226
  }
331
- var ChartLegend = RechartsPrimitive.Legend;
332
- var chartLegendItemVariants = cva(
333
- "group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0",
334
- {
335
- variants: {
336
- size: {
337
- sm: "gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3",
338
- md: "gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5"
339
- },
340
- interactive: {
341
- true: "cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised",
342
- false: ""
343
- },
344
- inactive: {
345
- true: "text-fg-caption-placeholder line-through",
346
- false: ""
347
- }
348
- },
349
- defaultVariants: {
350
- size: "md",
351
- interactive: false,
352
- inactive: false
353
- }
354
- }
355
- );
356
- var chartLegendMarkerSizeVariants = cva("shrink-0", {
357
- variants: {
358
- marker: {
359
- dot: "rounded-full",
360
- square: "rounded-[2px]",
361
- line: "rounded-full"
362
- },
363
- size: {
364
- sm: "",
365
- md: ""
366
- }
367
- },
368
- compoundVariants: [
369
- { marker: ["dot", "square"], size: "sm", className: "size-2" },
370
- { marker: ["dot", "square"], size: "md", className: "size-2.5" },
371
- { marker: "line", size: "sm", className: "h-[3px] w-3" },
372
- { marker: "line", size: "md", className: "h-[3px] w-3.5" }
373
- ],
374
- defaultVariants: { marker: "dot", size: "md" }
227
+ const ChartLegend = RechartsPrimitive.Legend;
228
+ const chartLegendItemVariants = cva("group/legend-item flex items-center rounded-md leading-none text-fg-primary transition-colors [&>svg]:shrink-0", {
229
+ variants: {
230
+ size: {
231
+ sm: "gap-1.5 px-2 py-1 text-gdt-xs [&>svg]:size-3",
232
+ md: "gap-2 px-2.5 py-1.5 text-gdt-sm [&>svg]:size-3.5"
233
+ },
234
+ interactive: {
235
+ true: "cursor-pointer outline-none hover:bg-surface-raised focus-visible:bg-surface-raised",
236
+ false: ""
237
+ },
238
+ inactive: {
239
+ true: "text-fg-caption-placeholder line-through",
240
+ false: ""
241
+ }
242
+ },
243
+ defaultVariants: {
244
+ size: "md",
245
+ interactive: false,
246
+ inactive: false
247
+ }
375
248
  });
376
- function ChartLegendContent({
377
- className,
378
- hideIcon = false,
379
- payload,
380
- verticalAlign = "bottom",
381
- nameKey,
382
- marker = "dot",
383
- size = "md",
384
- orientation = "horizontal",
385
- inactiveKeys,
386
- onToggle
387
- }) {
388
- const { config } = useChart();
389
- if (!payload?.length) {
390
- return null;
391
- }
392
- const inactiveSet = inactiveKeys ? new Set(inactiveKeys) : void 0;
393
- const interactive = Boolean(onToggle);
394
- return /* @__PURE__ */ jsx2(
395
- "div",
396
- {
397
- className: cn(
398
- "flex",
399
- orientation === "vertical" ? "flex-col items-start gap-0.5" : "flex-row flex-wrap items-center justify-center gap-x-1 gap-y-0.5",
400
- verticalAlign === "top" ? "pb-3" : "pt-3",
401
- className
402
- ),
403
- children: payload.filter((item) => item.type !== "none").map((item, index) => {
404
- const key = `${nameKey ?? item.dataKey ?? "value"}`;
405
- const itemKey = `${item.dataKey ?? item.value ?? index}`;
406
- const itemConfig = getPayloadConfigFromPayload(config, item, key);
407
- const inactive = (inactiveSet?.has(key) ?? false) || Boolean(item.inactive);
408
- const markerColor = inactive ? "var(--color-fg-caption-placeholder)" : item.color ?? SERIES_COLOR_PLACEHOLDER;
409
- const content = /* @__PURE__ */ jsxs(Fragment2, { children: [
410
- itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx2(itemConfig.icon, {}) : /* @__PURE__ */ jsx2(
411
- "span",
412
- {
413
- "aria-hidden": "true",
414
- className: cn(
415
- chartLegendMarkerSizeVariants({ marker, size })
416
- ),
417
- style: { backgroundColor: markerColor }
418
- }
419
- ),
420
- itemConfig?.label ?? item.value
421
- ] });
422
- if (interactive) {
423
- return /* @__PURE__ */ jsx2(
424
- "button",
425
- {
426
- type: "button",
427
- "aria-pressed": !inactive,
428
- onClick: () => onToggle?.(key),
429
- className: cn(
430
- chartLegendItemVariants({ size, interactive, inactive })
431
- ),
432
- children: content
433
- },
434
- itemKey
435
- );
436
- }
437
- return /* @__PURE__ */ jsx2(
438
- "div",
439
- {
440
- className: cn(
441
- chartLegendItemVariants({ size, interactive, inactive })
442
- ),
443
- children: content
444
- },
445
- itemKey
446
- );
447
- })
448
- }
449
- );
249
+ const chartLegendMarkerSizeVariants = cva("shrink-0", {
250
+ variants: {
251
+ marker: {
252
+ dot: "rounded-full",
253
+ square: "rounded-[2px]",
254
+ line: "rounded-full"
255
+ },
256
+ size: {
257
+ sm: "",
258
+ md: ""
259
+ }
260
+ },
261
+ compoundVariants: [
262
+ {
263
+ marker: ["dot", "square"],
264
+ size: "sm",
265
+ className: "size-2"
266
+ },
267
+ {
268
+ marker: ["dot", "square"],
269
+ size: "md",
270
+ className: "size-2.5"
271
+ },
272
+ {
273
+ marker: "line",
274
+ size: "sm",
275
+ className: "h-[3px] w-3"
276
+ },
277
+ {
278
+ marker: "line",
279
+ size: "md",
280
+ className: "h-[3px] w-3.5"
281
+ }
282
+ ],
283
+ defaultVariants: {
284
+ marker: "dot",
285
+ size: "md"
286
+ }
287
+ });
288
+ /**
289
+ * A shared legend for all chart types. Each item pairs a series marker with a
290
+ * label and can be toggled to hide or show its series — the inactive state mutes
291
+ * the marker and strikes through the label. Items compose into horizontal rows
292
+ * or vertical columns, in two sizes, with dot, square, or line markers.
293
+ *
294
+ * Toggling: pass `onToggle` to make items interactive. Inactive items are read
295
+ * from each payload entry's `inactive` flag (recharts sets this when wired) or
296
+ * the controlled `inactiveKeys` set.
297
+ */
298
+ function ChartLegendContent({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey, marker = "dot", size = "md", orientation = "horizontal", inactiveKeys, onToggle }) {
299
+ const { config } = useChart();
300
+ if (!payload?.length) return null;
301
+ const inactiveSet = inactiveKeys ? new Set(inactiveKeys) : void 0;
302
+ const interactive = Boolean(onToggle);
303
+ return /* @__PURE__ */ jsx("div", {
304
+ className: cn("flex", orientation === "vertical" ? "flex-col items-start gap-0.5" : "flex-row flex-wrap items-center justify-center gap-x-1 gap-y-0.5", verticalAlign === "top" ? "pb-3" : "pt-3", className),
305
+ children: payload.filter((item) => item.type !== "none").map((item, index) => {
306
+ const key = `${nameKey ?? item.dataKey ?? "value"}`;
307
+ const itemKey = `${item.dataKey ?? item.value ?? index}`;
308
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
309
+ const inactive = (inactiveSet?.has(key) ?? false) || Boolean(item.inactive);
310
+ const markerColor = inactive ? "var(--color-fg-caption-placeholder)" : item.color ?? SERIES_COLOR_PLACEHOLDER;
311
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx("span", {
312
+ "aria-hidden": "true",
313
+ className: cn(chartLegendMarkerSizeVariants({
314
+ marker,
315
+ size
316
+ })),
317
+ style: { backgroundColor: markerColor }
318
+ }), itemConfig?.label ?? item.value] });
319
+ if (interactive) return /* @__PURE__ */ jsx("button", {
320
+ type: "button",
321
+ "aria-pressed": !inactive,
322
+ onClick: () => onToggle?.(key),
323
+ className: cn(chartLegendItemVariants({
324
+ size,
325
+ interactive,
326
+ inactive
327
+ })),
328
+ children: content
329
+ }, itemKey);
330
+ return /* @__PURE__ */ jsx("div", {
331
+ className: cn(chartLegendItemVariants({
332
+ size,
333
+ interactive,
334
+ inactive
335
+ })),
336
+ children: content
337
+ }, itemKey);
338
+ })
339
+ });
450
340
  }
341
+ /**
342
+ * Shared `<XAxis>`/`<YAxis>` props — the giddaa cartesian-axis defaults (no tick
343
+ * or axis lines, a size-scaled tick font, and a reserved value-axis width) that
344
+ * every bar and line chart would otherwise repeat per axis. Spread the result
345
+ * onto the recharts axis, then add the chart-specific props (`dataKey`,
346
+ * `domain`, `ticks`, a `width`/`type` override, …):
347
+ *
348
+ * const chart = useBarChartLayout();
349
+ * <XAxis dataKey="month" {...chart.xAxis} />
350
+ * <YAxis domain={[0, 120]} {...chart.yAxis} />
351
+ */
451
352
  function cartesianAxisProps(layout) {
452
- const tick = { fontSize: layout.tickFontSize };
453
- return {
454
- xAxis: {
455
- tickLine: false,
456
- axisLine: false,
457
- tickMargin: layout.tickMargin,
458
- tick
459
- },
460
- yAxis: {
461
- tickLine: false,
462
- axisLine: false,
463
- width: layout.yAxisWidth,
464
- tick
465
- }
466
- };
353
+ const tick = { fontSize: layout.tickFontSize };
354
+ return {
355
+ xAxis: {
356
+ tickLine: false,
357
+ axisLine: false,
358
+ tickMargin: layout.tickMargin,
359
+ tick
360
+ },
361
+ yAxis: {
362
+ tickLine: false,
363
+ axisLine: false,
364
+ width: layout.yAxisWidth,
365
+ tick
366
+ }
367
+ };
467
368
  }
468
369
  function getPayloadConfigFromPayload(config, payload, key) {
469
- if (typeof payload !== "object" || payload === null) {
470
- return void 0;
471
- }
472
- const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
473
- let configLabelKey = key;
474
- if (key in payload && typeof payload[key] === "string") {
475
- configLabelKey = payload[key];
476
- } else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
477
- configLabelKey = payloadPayload[key];
478
- }
479
- return configLabelKey in config ? config[configLabelKey] : config[key];
370
+ if (typeof payload !== "object" || payload === null) return;
371
+ const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : void 0;
372
+ let configLabelKey = key;
373
+ if (key in payload && typeof payload[key] === "string") configLabelKey = payload[key];
374
+ else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") configLabelKey = payloadPayload[key];
375
+ return configLabelKey in config ? config[configLabelKey] : config[key];
480
376
  }
481
- export {
482
- ChartCard,
483
- ChartContainer,
484
- ChartDescription,
485
- ChartHeader,
486
- ChartLegend,
487
- ChartLegendContent,
488
- ChartStyle,
489
- ChartTitle,
490
- ChartTooltip,
491
- ChartTooltipContent,
492
- cartesianAxisProps
493
- };
494
- //# sourceMappingURL=chart.js.map
377
+ //#endregion
378
+ export { ChartCard, ChartContainer, ChartDescription, ChartHeader, ChartLegend, ChartLegendContent, ChartStyle, ChartTitle, ChartTooltip, ChartTooltipContent, cartesianAxisProps };