@salesmind-ai/design-system 0.3.3 → 0.3.4

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 (215) hide show
  1. package/dist/{SectionShell-BfBw5q0Y.d.cts → SectionShell-GlglHCzz.d.cts} +1 -0
  2. package/dist/{SectionShell-BfBw5q0Y.d.ts → SectionShell-GlglHCzz.d.ts} +1 -0
  3. package/dist/StatsSection-B8iD9L-o.d.ts +68 -0
  4. package/dist/StatsSection-wgd8Vge1.d.cts +68 -0
  5. package/dist/admin/index.cjs +2928 -68
  6. package/dist/admin/index.cjs.map +1 -1
  7. package/dist/admin/index.js +2915 -5
  8. package/dist/admin/index.js.map +1 -1
  9. package/dist/blog/index.cjs +1064 -53
  10. package/dist/blog/index.cjs.map +1 -1
  11. package/dist/blog/index.d.cts +1 -1
  12. package/dist/blog/index.d.ts +1 -1
  13. package/dist/blog/index.js +1054 -8
  14. package/dist/blog/index.js.map +1 -1
  15. package/dist/charts/index.cjs +2694 -46
  16. package/dist/charts/index.cjs.map +1 -1
  17. package/dist/charts/index.js +2680 -3
  18. package/dist/charts/index.js.map +1 -1
  19. package/dist/core/index.cjs +4333 -807
  20. package/dist/core/index.cjs.map +1 -1
  21. package/dist/core/index.js +4130 -14
  22. package/dist/core/index.js.map +1 -1
  23. package/dist/i18n/index.cjs +558 -86
  24. package/dist/i18n/index.cjs.map +1 -1
  25. package/dist/i18n/index.js +544 -1
  26. package/dist/i18n/index.js.map +1 -1
  27. package/dist/index.cjs +17140 -1432
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.css +24 -13
  30. package/dist/index.css.map +1 -1
  31. package/dist/index.d.cts +2 -2
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.js +16785 -31
  34. package/dist/index.js.map +1 -1
  35. package/dist/marketing/index.cjs +3072 -142
  36. package/dist/marketing/index.cjs.map +1 -1
  37. package/dist/marketing/index.d.cts +1 -1
  38. package/dist/marketing/index.d.ts +1 -1
  39. package/dist/marketing/index.js +3042 -11
  40. package/dist/marketing/index.js.map +1 -1
  41. package/dist/motion/index.cjs +1222 -26
  42. package/dist/motion/index.cjs.map +1 -1
  43. package/dist/motion/index.js +1215 -2
  44. package/dist/motion/index.js.map +1 -1
  45. package/dist/nav/index.cjs +1518 -101
  46. package/dist/nav/index.cjs.map +1 -1
  47. package/dist/nav/index.css +24 -13
  48. package/dist/nav/index.css.map +1 -1
  49. package/dist/nav/index.js +1498 -4
  50. package/dist/nav/index.js.map +1 -1
  51. package/dist/report/index.cjs +2403 -171
  52. package/dist/report/index.cjs.map +1 -1
  53. package/dist/report/index.js +2363 -3
  54. package/dist/report/index.js.map +1 -1
  55. package/dist/sections/index.cjs +382 -28
  56. package/dist/sections/index.cjs.map +1 -1
  57. package/dist/sections/index.d.cts +15 -69
  58. package/dist/sections/index.d.ts +15 -69
  59. package/dist/sections/index.js +376 -4
  60. package/dist/sections/index.js.map +1 -1
  61. package/dist/social-proof/index.cjs +1250 -53
  62. package/dist/social-proof/index.cjs.map +1 -1
  63. package/dist/social-proof/index.d.cts +1 -1
  64. package/dist/social-proof/index.d.ts +1 -1
  65. package/dist/social-proof/index.js +1235 -6
  66. package/dist/social-proof/index.js.map +1 -1
  67. package/dist/theme/index.cjs +565 -38
  68. package/dist/theme/index.cjs.map +1 -1
  69. package/dist/theme/index.js +555 -2
  70. package/dist/theme/index.js.map +1 -1
  71. package/dist/web/client/index.cjs +491 -38
  72. package/dist/web/client/index.cjs.map +1 -1
  73. package/dist/web/client/index.js +483 -4
  74. package/dist/web/client/index.js.map +1 -1
  75. package/dist/web/index.cjs +1346 -158
  76. package/dist/web/index.cjs.map +1 -1
  77. package/dist/web/index.js +1305 -9
  78. package/dist/web/index.js.map +1 -1
  79. package/dist/web/server/index.cjs +563 -26
  80. package/dist/web/server/index.cjs.map +1 -1
  81. package/dist/web/server/index.js +560 -1
  82. package/dist/web/server/index.js.map +1 -1
  83. package/package.json +1 -1
  84. package/dist/chunk-2GARWEJK.js +0 -17
  85. package/dist/chunk-2GARWEJK.js.map +0 -1
  86. package/dist/chunk-3NKRFUAR.js +0 -37
  87. package/dist/chunk-3NKRFUAR.js.map +0 -1
  88. package/dist/chunk-3TGSIILM.cjs +0 -201
  89. package/dist/chunk-3TGSIILM.cjs.map +0 -1
  90. package/dist/chunk-4GM5BGBN.cjs +0 -801
  91. package/dist/chunk-4GM5BGBN.cjs.map +0 -1
  92. package/dist/chunk-5LGDEZWY.cjs +0 -2434
  93. package/dist/chunk-5LGDEZWY.cjs.map +0 -1
  94. package/dist/chunk-6H4DSTXR.js +0 -786
  95. package/dist/chunk-6H4DSTXR.js.map +0 -1
  96. package/dist/chunk-6UNG76Y2.js +0 -153
  97. package/dist/chunk-6UNG76Y2.js.map +0 -1
  98. package/dist/chunk-7PX2AZ6Y.js +0 -39
  99. package/dist/chunk-7PX2AZ6Y.js.map +0 -1
  100. package/dist/chunk-B6AVAX4F.js +0 -1415
  101. package/dist/chunk-B6AVAX4F.js.map +0 -1
  102. package/dist/chunk-BILT5KD3.js +0 -264
  103. package/dist/chunk-BILT5KD3.js.map +0 -1
  104. package/dist/chunk-C2BCDNAV.js +0 -24
  105. package/dist/chunk-C2BCDNAV.js.map +0 -1
  106. package/dist/chunk-CH42VPWE.cjs +0 -421
  107. package/dist/chunk-CH42VPWE.cjs.map +0 -1
  108. package/dist/chunk-CJ2MKVAF.cjs +0 -46
  109. package/dist/chunk-CJ2MKVAF.cjs.map +0 -1
  110. package/dist/chunk-DP74LUXG.cjs +0 -98
  111. package/dist/chunk-DP74LUXG.cjs.map +0 -1
  112. package/dist/chunk-E7D6EKJ4.cjs +0 -44
  113. package/dist/chunk-E7D6EKJ4.cjs.map +0 -1
  114. package/dist/chunk-ECXBTUH6.cjs +0 -584
  115. package/dist/chunk-ECXBTUH6.cjs.map +0 -1
  116. package/dist/chunk-EFRAP5ES.js +0 -157
  117. package/dist/chunk-EFRAP5ES.js.map +0 -1
  118. package/dist/chunk-F6YYWMME.js +0 -485
  119. package/dist/chunk-F6YYWMME.js.map +0 -1
  120. package/dist/chunk-FAFAP4L5.js +0 -183
  121. package/dist/chunk-FAFAP4L5.js.map +0 -1
  122. package/dist/chunk-GUZIMHWS.js +0 -1608
  123. package/dist/chunk-GUZIMHWS.js.map +0 -1
  124. package/dist/chunk-H2Y6BSTL.cjs +0 -69
  125. package/dist/chunk-H2Y6BSTL.cjs.map +0 -1
  126. package/dist/chunk-HN4PHABT.js +0 -126
  127. package/dist/chunk-HN4PHABT.js.map +0 -1
  128. package/dist/chunk-HRENHNDJ.js +0 -211
  129. package/dist/chunk-HRENHNDJ.js.map +0 -1
  130. package/dist/chunk-I75BFEYT.cjs +0 -2561
  131. package/dist/chunk-I75BFEYT.cjs.map +0 -1
  132. package/dist/chunk-IFRATNLU.js +0 -562
  133. package/dist/chunk-IFRATNLU.js.map +0 -1
  134. package/dist/chunk-IYPXJ6YC.cjs +0 -69
  135. package/dist/chunk-IYPXJ6YC.cjs.map +0 -1
  136. package/dist/chunk-JPJN4YBC.js +0 -409
  137. package/dist/chunk-JPJN4YBC.js.map +0 -1
  138. package/dist/chunk-KBA2LFBG.js +0 -62
  139. package/dist/chunk-KBA2LFBG.js.map +0 -1
  140. package/dist/chunk-KCKUSU2M.cjs +0 -166
  141. package/dist/chunk-KCKUSU2M.cjs.map +0 -1
  142. package/dist/chunk-KJ2OXQF4.js +0 -287
  143. package/dist/chunk-KJ2OXQF4.js.map +0 -1
  144. package/dist/chunk-KNQEIU7O.cjs +0 -1202
  145. package/dist/chunk-KNQEIU7O.cjs.map +0 -1
  146. package/dist/chunk-KVGSVGRK.cjs +0 -569
  147. package/dist/chunk-KVGSVGRK.cjs.map +0 -1
  148. package/dist/chunk-L352JRV6.cjs +0 -105
  149. package/dist/chunk-L352JRV6.cjs.map +0 -1
  150. package/dist/chunk-LJADZITX.cjs +0 -298
  151. package/dist/chunk-LJADZITX.cjs.map +0 -1
  152. package/dist/chunk-LMJPWXTZ.cjs +0 -194
  153. package/dist/chunk-LMJPWXTZ.cjs.map +0 -1
  154. package/dist/chunk-LOWEAQST.js +0 -701
  155. package/dist/chunk-LOWEAQST.js.map +0 -1
  156. package/dist/chunk-MDB2WCRQ.cjs +0 -137
  157. package/dist/chunk-MDB2WCRQ.cjs.map +0 -1
  158. package/dist/chunk-MQDEE7HC.cjs +0 -283
  159. package/dist/chunk-MQDEE7HC.cjs.map +0 -1
  160. package/dist/chunk-MQRB634A.cjs +0 -34
  161. package/dist/chunk-MQRB634A.cjs.map +0 -1
  162. package/dist/chunk-MTI27RDV.js +0 -185
  163. package/dist/chunk-MTI27RDV.js.map +0 -1
  164. package/dist/chunk-MU6GW5ZV.js +0 -2317
  165. package/dist/chunk-MU6GW5ZV.js.map +0 -1
  166. package/dist/chunk-NN3TUHIH.js +0 -28
  167. package/dist/chunk-NN3TUHIH.js.map +0 -1
  168. package/dist/chunk-NT4LBP7D.cjs +0 -111
  169. package/dist/chunk-NT4LBP7D.cjs.map +0 -1
  170. package/dist/chunk-OLV7OD3X.cjs +0 -502
  171. package/dist/chunk-OLV7OD3X.cjs.map +0 -1
  172. package/dist/chunk-OXNXEQY7.js +0 -2538
  173. package/dist/chunk-OXNXEQY7.js.map +0 -1
  174. package/dist/chunk-P5BOFE5A.js +0 -546
  175. package/dist/chunk-P5BOFE5A.js.map +0 -1
  176. package/dist/chunk-Q2MFGYTE.cjs +0 -1449
  177. package/dist/chunk-Q2MFGYTE.cjs.map +0 -1
  178. package/dist/chunk-Q75DBVDY.cjs +0 -68
  179. package/dist/chunk-Q75DBVDY.cjs.map +0 -1
  180. package/dist/chunk-REQ5Q6ZI.js +0 -1022
  181. package/dist/chunk-REQ5Q6ZI.js.map +0 -1
  182. package/dist/chunk-SICKWUWB.js +0 -62
  183. package/dist/chunk-SICKWUWB.js.map +0 -1
  184. package/dist/chunk-T343CCH5.js +0 -1190
  185. package/dist/chunk-T343CCH5.js.map +0 -1
  186. package/dist/chunk-TEC62D4A.cjs +0 -1624
  187. package/dist/chunk-TEC62D4A.cjs.map +0 -1
  188. package/dist/chunk-TW5JB35D.js +0 -2122
  189. package/dist/chunk-TW5JB35D.js.map +0 -1
  190. package/dist/chunk-VC5LMUVQ.cjs +0 -20
  191. package/dist/chunk-VC5LMUVQ.cjs.map +0 -1
  192. package/dist/chunk-VM7WFMKI.cjs +0 -76
  193. package/dist/chunk-VM7WFMKI.cjs.map +0 -1
  194. package/dist/chunk-W2WTP6HS.cjs +0 -233
  195. package/dist/chunk-W2WTP6HS.cjs.map +0 -1
  196. package/dist/chunk-WH7PYHZY.cjs +0 -35
  197. package/dist/chunk-WH7PYHZY.cjs.map +0 -1
  198. package/dist/chunk-XQZVY7JJ.cjs +0 -717
  199. package/dist/chunk-XQZVY7JJ.cjs.map +0 -1
  200. package/dist/chunk-XU3OMQ7V.js +0 -98
  201. package/dist/chunk-XU3OMQ7V.js.map +0 -1
  202. package/dist/chunk-XWPDRMZG.js +0 -62
  203. package/dist/chunk-XWPDRMZG.js.map +0 -1
  204. package/dist/chunk-Y3CPKNB7.js +0 -67
  205. package/dist/chunk-Y3CPKNB7.js.map +0 -1
  206. package/dist/chunk-YNVRDD2P.js +0 -98
  207. package/dist/chunk-YNVRDD2P.js.map +0 -1
  208. package/dist/chunk-YSYR54XR.js +0 -92
  209. package/dist/chunk-YSYR54XR.js.map +0 -1
  210. package/dist/chunk-YTYDQBVY.cjs +0 -162
  211. package/dist/chunk-YTYDQBVY.cjs.map +0 -1
  212. package/dist/chunk-ZDLOA2UT.cjs +0 -1042
  213. package/dist/chunk-ZDLOA2UT.cjs.map +0 -1
  214. package/dist/chunk-ZWUKRCOJ.cjs +0 -2162
  215. package/dist/chunk-ZWUKRCOJ.cjs.map +0 -1
@@ -1,1608 +0,0 @@
1
- import { useReportMode, useChartData, DataCoverageBadge, DataStateIndicator, CHART_REGISTRY, getDefaultChartForIntent, getAllowedSwitchTargets, validateChartData, ConfidenceIndicator } from './chunk-B6AVAX4F.js';
2
- import { Tooltip as Tooltip$1 } from './chunk-C2BCDNAV.js';
3
- import clsx7 from 'clsx';
4
- import { LineChart as LineChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Line, BarChart as BarChart$1, Bar, Cell, PieChart as PieChart$1, Pie, RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar, ResponsiveContainer, AreaChart, Area } from 'recharts';
5
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
- import React, { useMemo, useState } from 'react';
7
-
8
- function ChartContainer({
9
- title,
10
- subtitle,
11
- height = 300,
12
- data = [],
13
- requiredFields = [],
14
- minSampleSize = 30,
15
- showCoverage = true,
16
- dateRange,
17
- loading,
18
- emptyMessage = "No data available",
19
- children,
20
- className,
21
- ...props
22
- }) {
23
- const { features } = useReportMode();
24
- const { state, isRenderable, message } = useChartData({
25
- data,
26
- requiredFields,
27
- minSampleSize
28
- });
29
- const renderContent = () => {
30
- if (loading) {
31
- return /* @__PURE__ */ jsxs("div", { className: "ds-chart-container__loading", children: [
32
- /* @__PURE__ */ jsx("div", { className: "ds-chart-container__spinner" }),
33
- /* @__PURE__ */ jsx("span", { children: "Loading chart..." })
34
- ] });
35
- }
36
- if (!isRenderable && state !== "VALID") {
37
- return /* @__PURE__ */ jsxs("div", { className: "ds-chart-container__empty", children: [
38
- /* @__PURE__ */ jsx(
39
- DataStateIndicator,
40
- {
41
- state,
42
- variant: "full",
43
- details: { message, sampleSize: data.length, requiredSize: minSampleSize }
44
- }
45
- ),
46
- state === "INSUFFICIENT_SAMPLE" && data.length === 0 && /* @__PURE__ */ jsx("p", { className: "ds-chart-container__empty-message", children: emptyMessage })
47
- ] });
48
- }
49
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children });
50
- };
51
- return /* @__PURE__ */ jsxs(
52
- "div",
53
- {
54
- className: clsx7(
55
- "ds-chart-container",
56
- loading && "ds-chart-container--loading",
57
- !isRenderable && "ds-chart-container--invalid",
58
- className
59
- ),
60
- ...props,
61
- children: [
62
- (title || subtitle || showCoverage && features.showMethodology) && /* @__PURE__ */ jsxs("header", { className: "ds-chart-container__header", children: [
63
- /* @__PURE__ */ jsxs("div", { className: "ds-chart-container__header-content", children: [
64
- title && /* @__PURE__ */ jsx("h4", { className: "ds-chart-container__title", children: title }),
65
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-chart-container__subtitle", children: subtitle })
66
- ] }),
67
- showCoverage && features.showMethodology && data.length > 0 && /* @__PURE__ */ jsx(
68
- DataCoverageBadge,
69
- {
70
- sampleSize: data.length,
71
- requiredSize: minSampleSize,
72
- dateRange,
73
- size: "sm"
74
- }
75
- )
76
- ] }),
77
- /* @__PURE__ */ jsx(
78
- "div",
79
- {
80
- className: "ds-chart-container__chart",
81
- style: { height: typeof height === "number" ? height : void 0 },
82
- children: renderContent()
83
- }
84
- ),
85
- isRenderable && state !== "VALID" && /* @__PURE__ */ jsx("footer", { className: "ds-chart-container__footer", children: /* @__PURE__ */ jsx(DataStateIndicator, { state, variant: "compact" }) })
86
- ]
87
- }
88
- );
89
- }
90
- ChartContainer.displayName = "ChartContainer";
91
- var DEFAULT_COLORS = [
92
- "var(--brand-pink)",
93
- "var(--brand-yellow)",
94
- "var(--status-info)",
95
- "var(--status-success)",
96
- "var(--status-warning)"
97
- ];
98
- function LineChart({
99
- data,
100
- xKey,
101
- lines,
102
- title,
103
- subtitle,
104
- height = 300,
105
- grid = true,
106
- legend: showLegend = true,
107
- curve = "monotone",
108
- minSampleSize = 7,
109
- dateRange,
110
- className
111
- }) {
112
- const requiredFields = [xKey, ...lines.map((l) => l.key)];
113
- const chartData = React.useMemo(() => data.map((item) => ({ ...item })), [data]);
114
- return /* @__PURE__ */ jsx(
115
- ChartContainer,
116
- {
117
- title,
118
- subtitle,
119
- height,
120
- data,
121
- requiredFields,
122
- minSampleSize,
123
- dateRange,
124
- className,
125
- children: /* @__PURE__ */ jsxs(LineChart$1, { data: chartData, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
126
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
127
- /* @__PURE__ */ jsx(
128
- XAxis,
129
- {
130
- dataKey: xKey,
131
- tick: { fontSize: 12 },
132
- tickLine: false,
133
- axisLine: { strokeWidth: 1 }
134
- }
135
- ),
136
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 }),
137
- /* @__PURE__ */ jsx(Tooltip, {}),
138
- showLegend && /* @__PURE__ */ jsx(Legend, {}),
139
- lines.map((line, index) => /* @__PURE__ */ jsx(
140
- Line,
141
- {
142
- type: curve,
143
- dataKey: line.key,
144
- name: line.name || line.key,
145
- stroke: line.color || DEFAULT_COLORS[index % DEFAULT_COLORS.length],
146
- strokeWidth: 2,
147
- strokeDasharray: line.dashed ? "5 5" : void 0,
148
- dot: line.dot !== false,
149
- activeDot: { r: 6 }
150
- },
151
- line.key
152
- ))
153
- ] })
154
- }
155
- );
156
- }
157
- LineChart.displayName = "LineChart";
158
- var DEFAULT_COLORS2 = [
159
- "var(--brand-pink)",
160
- "var(--brand-yellow)",
161
- "var(--status-info)",
162
- "var(--status-success)",
163
- "var(--status-warning)"
164
- ];
165
- function BarChart({
166
- data,
167
- xKey,
168
- bars,
169
- title,
170
- subtitle,
171
- height = 300,
172
- layout = "horizontal",
173
- grid = true,
174
- legend: showLegend = true,
175
- radius = 4,
176
- showLabels = false,
177
- minSampleSize = 5,
178
- categoryColors,
179
- className
180
- }) {
181
- const requiredFields = [xKey, ...bars.map((b) => b.key)];
182
- const isVertical = layout === "vertical";
183
- const chartData = useMemo(() => data.map((item) => ({ ...item })), [data]);
184
- return /* @__PURE__ */ jsx(
185
- ChartContainer,
186
- {
187
- title,
188
- subtitle,
189
- height,
190
- data: chartData,
191
- requiredFields,
192
- minSampleSize,
193
- className,
194
- children: /* @__PURE__ */ jsxs(
195
- BarChart$1,
196
- {
197
- data: chartData,
198
- layout: isVertical ? "vertical" : "horizontal",
199
- margin: { top: 5, right: 20, left: isVertical ? 80 : 0, bottom: 5 },
200
- children: [
201
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", horizontal: !isVertical, vertical: isVertical }),
202
- isVertical ? /* @__PURE__ */ jsxs(Fragment, { children: [
203
- /* @__PURE__ */ jsx(XAxis, { type: "number", tick: { fontSize: 12 }, tickLine: false, axisLine: false }),
204
- /* @__PURE__ */ jsx(
205
- YAxis,
206
- {
207
- type: "category",
208
- dataKey: xKey,
209
- tick: { fontSize: 12 },
210
- tickLine: false,
211
- axisLine: false,
212
- width: 80
213
- }
214
- )
215
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
216
- /* @__PURE__ */ jsx(
217
- XAxis,
218
- {
219
- dataKey: xKey,
220
- tick: { fontSize: 12 },
221
- tickLine: false,
222
- axisLine: { strokeWidth: 1 }
223
- }
224
- ),
225
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 })
226
- ] }),
227
- /* @__PURE__ */ jsx(Tooltip, {}),
228
- showLegend && bars.length > 1 && /* @__PURE__ */ jsx(Legend, {}),
229
- bars.map((bar, barIndex) => /* @__PURE__ */ jsx(
230
- Bar,
231
- {
232
- dataKey: bar.key,
233
- name: bar.name || bar.key,
234
- fill: bar.color || DEFAULT_COLORS2[barIndex % DEFAULT_COLORS2.length],
235
- stackId: bar.stackId,
236
- radius: [radius, radius, 0, 0],
237
- label: showLabels ? { position: "top", fontSize: 10 } : false,
238
- children: categoryColors && chartData.map((_, index) => /* @__PURE__ */ jsx(Cell, { fill: categoryColors[index % categoryColors.length] }, `cell-${index}`))
239
- },
240
- bar.key
241
- ))
242
- ]
243
- }
244
- )
245
- }
246
- );
247
- }
248
- BarChart.displayName = "BarChart";
249
- var DEFAULT_COLORS3 = [
250
- "var(--brand-pink)",
251
- "var(--brand-yellow)",
252
- "var(--status-info)",
253
- "var(--status-success)",
254
- "var(--status-warning)",
255
- "var(--status-error)",
256
- "#8884d8",
257
- "#82ca9d"
258
- ];
259
- function PieChart({
260
- data,
261
- title,
262
- subtitle,
263
- height = 300,
264
- innerRadius = 0,
265
- outerRadius = 80,
266
- showLabels = true,
267
- labelType = "percent",
268
- legend: showLegend = true,
269
- minSampleSize = 30,
270
- className
271
- }) {
272
- const safeData = useMemo(() => data.map((item) => ({ ...item })), [data]);
273
- const renderLabel = (props) => {
274
- const { name, value, percent } = props;
275
- switch (labelType) {
276
- case "percent":
277
- return `${((percent ?? 0) * 100).toFixed(0)}%`;
278
- case "value":
279
- return (value ?? 0).toLocaleString();
280
- case "name":
281
- return name ?? "";
282
- default:
283
- return "";
284
- }
285
- };
286
- return /* @__PURE__ */ jsx(
287
- ChartContainer,
288
- {
289
- title,
290
- subtitle,
291
- height,
292
- data: safeData,
293
- requiredFields: ["name", "value"],
294
- minSampleSize,
295
- className,
296
- children: /* @__PURE__ */ jsxs(PieChart$1, { children: [
297
- /* @__PURE__ */ jsx(
298
- Pie,
299
- {
300
- data: safeData,
301
- cx: "50%",
302
- cy: "50%",
303
- innerRadius,
304
- outerRadius,
305
- paddingAngle: 2,
306
- dataKey: "value",
307
- label: showLabels ? renderLabel : void 0,
308
- labelLine: showLabels,
309
- children: safeData.map((entry, index) => /* @__PURE__ */ jsx(
310
- Cell,
311
- {
312
- fill: entry.color || DEFAULT_COLORS3[index % DEFAULT_COLORS3.length]
313
- },
314
- `cell-${index}`
315
- ))
316
- }
317
- ),
318
- /* @__PURE__ */ jsx(Tooltip, {}),
319
- showLegend && /* @__PURE__ */ jsx(Legend, {})
320
- ] })
321
- }
322
- );
323
- }
324
- PieChart.displayName = "PieChart";
325
- var DEFAULT_COLORS4 = [
326
- "var(--brand-pink)",
327
- "var(--brand-yellow)",
328
- "var(--status-info)",
329
- "var(--status-success)",
330
- "var(--status-warning)"
331
- ];
332
- function FunnelChart({
333
- stages,
334
- title,
335
- subtitle,
336
- showConversionRates = true,
337
- showDropOff = true,
338
- showValues = true,
339
- height = 300,
340
- className
341
- }) {
342
- const { features } = useReportMode();
343
- const isValid = stages.length >= 3;
344
- const maxValue = stages.length > 0 ? Math.max(...stages.map((s) => s.value)) : 0;
345
- const stagesWithMetrics = useMemo(() => {
346
- return stages.map((stage, index) => {
347
- const prevStage = index > 0 ? stages[index - 1] : null;
348
- const conversionRate = prevStage ? stage.value / prevStage.value * 100 : 100;
349
- const dropOff = prevStage ? (prevStage.value - stage.value) / prevStage.value * 100 : 0;
350
- const widthPercent = maxValue > 0 ? stage.value / maxValue * 100 : 0;
351
- return {
352
- ...stage,
353
- conversionRate,
354
- dropOff,
355
- widthPercent,
356
- color: stage.color || DEFAULT_COLORS4[index % DEFAULT_COLORS4.length]
357
- };
358
- });
359
- }, [stages, maxValue]);
360
- if (!isValid) {
361
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-funnel-chart", "ds-funnel-chart--invalid", className), children: [
362
- title && /* @__PURE__ */ jsx("h4", { className: "ds-funnel-chart__title", children: title }),
363
- /* @__PURE__ */ jsx("div", { className: "ds-funnel-chart__empty", children: /* @__PURE__ */ jsx(
364
- DataStateIndicator,
365
- {
366
- state: "INSUFFICIENT_SAMPLE",
367
- variant: "full",
368
- details: {
369
- message: "Funnel requires at least 3 stages",
370
- sampleSize: stages.length,
371
- requiredSize: 3
372
- }
373
- }
374
- ) })
375
- ] });
376
- }
377
- const totalConversion = stages.length > 1 ? (stages[stages.length - 1].value / stages[0].value * 100).toFixed(1) : "100";
378
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-funnel-chart", className), style: { minHeight: height }, children: [
379
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-funnel-chart__header", children: [
380
- /* @__PURE__ */ jsxs("div", { children: [
381
- title && /* @__PURE__ */ jsx("h4", { className: "ds-funnel-chart__title", children: title }),
382
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-funnel-chart__subtitle", children: subtitle })
383
- ] }),
384
- features.showMethodology && /* @__PURE__ */ jsx(DataCoverageBadge, { sampleSize: stages[0].value, size: "sm" })
385
- ] }),
386
- /* @__PURE__ */ jsx("div", { className: "ds-funnel-chart__stages", children: stagesWithMetrics.map((stage, index) => /* @__PURE__ */ jsxs("div", { className: "ds-funnel-chart__stage", children: [
387
- /* @__PURE__ */ jsx("div", { className: "ds-funnel-chart__bar-container", children: /* @__PURE__ */ jsx(
388
- "div",
389
- {
390
- className: "ds-funnel-chart__bar",
391
- style: {
392
- width: `${stage.widthPercent}%`,
393
- backgroundColor: stage.color
394
- },
395
- children: showValues && /* @__PURE__ */ jsx("span", { className: "ds-funnel-chart__value", children: stage.value.toLocaleString() })
396
- }
397
- ) }),
398
- /* @__PURE__ */ jsxs("div", { className: "ds-funnel-chart__label", children: [
399
- /* @__PURE__ */ jsx("span", { className: "ds-funnel-chart__stage-name", children: stage.name }),
400
- showConversionRates && index > 0 && /* @__PURE__ */ jsxs("span", { className: "ds-funnel-chart__conversion", children: [
401
- stage.conversionRate.toFixed(1),
402
- "% converted"
403
- ] })
404
- ] }),
405
- showDropOff && index > 0 && stage.dropOff > 0 && /* @__PURE__ */ jsxs("div", { className: "ds-funnel-chart__dropoff", children: [
406
- /* @__PURE__ */ jsx("span", { className: "ds-funnel-chart__dropoff-arrow", children: "\u2193" }),
407
- /* @__PURE__ */ jsxs("span", { className: "ds-funnel-chart__dropoff-value", children: [
408
- "-",
409
- stage.dropOff.toFixed(1),
410
- "%"
411
- ] })
412
- ] })
413
- ] }, stage.name)) }),
414
- /* @__PURE__ */ jsx("footer", { className: "ds-funnel-chart__footer", children: /* @__PURE__ */ jsxs("span", { className: "ds-funnel-chart__total", children: [
415
- "Overall Conversion: ",
416
- /* @__PURE__ */ jsxs("strong", { children: [
417
- totalConversion,
418
- "%"
419
- ] })
420
- ] }) })
421
- ] });
422
- }
423
- FunnelChart.displayName = "FunnelChart";
424
- function HeatmapChart({
425
- data,
426
- title,
427
- subtitle,
428
- xLabel,
429
- yLabel,
430
- colorScale = ["var(--glass-elevated)", "var(--brand-pink)"],
431
- showValues = true,
432
- valueFormatter = (v) => v.toFixed(0),
433
- minCells = 25,
434
- className
435
- }) {
436
- const { features } = useReportMode();
437
- const { xValues, yValues, cellMap, minValue, maxValue } = useMemo(() => {
438
- const xSet = /* @__PURE__ */ new Set();
439
- const ySet = /* @__PURE__ */ new Set();
440
- const map = /* @__PURE__ */ new Map();
441
- let min = Infinity;
442
- let max = -Infinity;
443
- for (const cell of data) {
444
- xSet.add(cell.x);
445
- ySet.add(cell.y);
446
- map.set(`${cell.x}-${cell.y}`, cell.value);
447
- min = Math.min(min, cell.value);
448
- max = Math.max(max, cell.value);
449
- }
450
- return {
451
- xValues: Array.from(xSet),
452
- yValues: Array.from(ySet),
453
- cellMap: map,
454
- minValue: min === Infinity ? 0 : min,
455
- maxValue: max === -Infinity ? 0 : max
456
- };
457
- }, [data]);
458
- const isValid = data.length >= minCells;
459
- const getCellColor = (value) => {
460
- if (maxValue === minValue) return colorScale[0];
461
- const ratio = (value - minValue) / (maxValue - minValue);
462
- return `color-mix(in srgb, ${colorScale[1]} ${ratio * 100}%, ${colorScale[0]})`;
463
- };
464
- const getTextColor = (value) => {
465
- const ratio = (value - minValue) / (maxValue - minValue);
466
- return ratio > 0.5 ? "white" : "var(--text-primary)";
467
- };
468
- if (!isValid) {
469
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-heatmap-chart", "ds-heatmap-chart--invalid", className), children: [
470
- title && /* @__PURE__ */ jsx("h4", { className: "ds-heatmap-chart__title", children: title }),
471
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__empty", children: [
472
- /* @__PURE__ */ jsx("p", { children: "Insufficient data for heatmap visualization" }),
473
- /* @__PURE__ */ jsxs("p", { className: "ds-heatmap-chart__empty-detail", children: [
474
- data.length,
475
- " cells provided, ",
476
- minCells,
477
- " required"
478
- ] })
479
- ] })
480
- ] });
481
- }
482
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-heatmap-chart", className), children: [
483
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-heatmap-chart__header", children: [
484
- /* @__PURE__ */ jsxs("div", { children: [
485
- title && /* @__PURE__ */ jsx("h4", { className: "ds-heatmap-chart__title", children: title }),
486
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-heatmap-chart__subtitle", children: subtitle })
487
- ] }),
488
- features.showMethodology && /* @__PURE__ */ jsx(DataCoverageBadge, { sampleSize: data.length, requiredSize: minCells, size: "sm" })
489
- ] }),
490
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__container", children: [
491
- yLabel && /* @__PURE__ */ jsx("div", { className: "ds-heatmap-chart__y-label", children: /* @__PURE__ */ jsx("span", { children: yLabel }) }),
492
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__grid-wrapper", children: [
493
- /* @__PURE__ */ jsx(
494
- "div",
495
- {
496
- className: "ds-heatmap-chart__grid",
497
- style: {
498
- gridTemplateColumns: `repeat(${xValues.length}, 1fr)`,
499
- gridTemplateRows: `repeat(${yValues.length}, 1fr)`
500
- },
501
- children: yValues.map(
502
- (y) => xValues.map((x) => {
503
- const value = cellMap.get(`${x}-${y}`) ?? 0;
504
- const cellContent = /* @__PURE__ */ jsx(
505
- "div",
506
- {
507
- className: "ds-heatmap-chart__cell",
508
- style: {
509
- backgroundColor: getCellColor(value),
510
- color: getTextColor(value)
511
- },
512
- children: showValues && /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__cell-value", children: valueFormatter(value) })
513
- },
514
- `${x}-${y}`
515
- );
516
- return /* @__PURE__ */ jsx(Tooltip$1, { content: `${x}, ${y}: ${valueFormatter(value)}`, children: cellContent }, `${x}-${y}`);
517
- })
518
- )
519
- }
520
- ),
521
- /* @__PURE__ */ jsx(
522
- "div",
523
- {
524
- className: "ds-heatmap-chart__x-labels",
525
- style: { gridTemplateColumns: `repeat(${xValues.length}, 1fr)` },
526
- children: xValues.map((x) => /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__x-label", children: x }, x))
527
- }
528
- )
529
- ] }),
530
- /* @__PURE__ */ jsx(
531
- "div",
532
- {
533
- className: "ds-heatmap-chart__y-labels",
534
- style: { gridTemplateRows: `repeat(${yValues.length}, 1fr)` },
535
- children: yValues.map((y) => /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__y-label-item", children: y }, y))
536
- }
537
- )
538
- ] }),
539
- xLabel && /* @__PURE__ */ jsx("div", { className: "ds-heatmap-chart__x-axis-label", children: /* @__PURE__ */ jsx("span", { children: xLabel }) }),
540
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__legend", children: [
541
- /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__legend-label", children: "Low" }),
542
- /* @__PURE__ */ jsx(
543
- "div",
544
- {
545
- className: "ds-heatmap-chart__legend-bar",
546
- style: {
547
- background: `linear-gradient(to right, ${colorScale[0]}, ${colorScale[1]})`
548
- }
549
- }
550
- ),
551
- /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__legend-label", children: "High" })
552
- ] })
553
- ] });
554
- }
555
- HeatmapChart.displayName = "HeatmapChart";
556
- function ChartSwitchControl({
557
- currentType,
558
- allowedTypes,
559
- onTypeChange,
560
- size = "sm",
561
- className
562
- }) {
563
- if (allowedTypes.length <= 1) {
564
- return null;
565
- }
566
- return /* @__PURE__ */ jsx("div", { className: clsx7("ds-chart-switch", `ds-chart-switch--${size}`, className), children: allowedTypes.map((type) => {
567
- const meta = CHART_REGISTRY[type];
568
- if (!meta) return null;
569
- const isActive = type === currentType;
570
- const Icon = getChartIcon(type);
571
- return /* @__PURE__ */ jsxs(
572
- "button",
573
- {
574
- type: "button",
575
- className: clsx7(
576
- "ds-chart-switch__option",
577
- isActive && "ds-chart-switch__option--active"
578
- ),
579
- onClick: () => onTypeChange(type),
580
- title: meta.name,
581
- "aria-pressed": isActive,
582
- children: [
583
- /* @__PURE__ */ jsx(Icon, {}),
584
- /* @__PURE__ */ jsx("span", { className: "ds-chart-switch__label", children: getShortLabel(type) })
585
- ]
586
- },
587
- type
588
- );
589
- }) });
590
- }
591
- ChartSwitchControl.displayName = "ChartSwitchControl";
592
- function getChartIcon(type) {
593
- const icons = {
594
- line: LineIcon,
595
- smooth_line: SmoothLineIcon,
596
- area: AreaIcon,
597
- stacked_area: StackedAreaIcon,
598
- area_100pct: StackedAreaIcon,
599
- bar: BarIcon,
600
- column: ColumnIcon,
601
- stacked_bar: StackedBarIcon,
602
- stacked_column: StackedColumnIcon,
603
- column_100pct: StackedColumnIcon,
604
- pie: PieIcon,
605
- donut: DonutIcon,
606
- histogram: HistogramIcon,
607
- funnel: FunnelIcon,
608
- heatmap: HeatmapIcon
609
- };
610
- return icons[type] || DefaultChartIcon;
611
- }
612
- function getShortLabel(type) {
613
- const labels = {
614
- line: "Line",
615
- smooth_line: "Smooth",
616
- area: "Area",
617
- stacked_area: "Stacked",
618
- area_100pct: "100%",
619
- bar: "Bar",
620
- column: "Column",
621
- stacked_bar: "Stacked",
622
- stacked_column: "Stacked",
623
- column_100pct: "100%",
624
- pie: "Pie",
625
- donut: "Donut",
626
- histogram: "Histogram",
627
- funnel: "Funnel",
628
- heatmap: "Heatmap"
629
- };
630
- return labels[type] || type;
631
- }
632
- function LineIcon() {
633
- return /* @__PURE__ */ jsx(
634
- "svg",
635
- {
636
- width: "16",
637
- height: "16",
638
- viewBox: "0 0 24 24",
639
- fill: "none",
640
- stroke: "currentColor",
641
- strokeWidth: "2",
642
- children: /* @__PURE__ */ jsx("polyline", { points: "22 12 18 8 13 13 9 9 2 16" })
643
- }
644
- );
645
- }
646
- function SmoothLineIcon() {
647
- return /* @__PURE__ */ jsx(
648
- "svg",
649
- {
650
- width: "16",
651
- height: "16",
652
- viewBox: "0 0 24 24",
653
- fill: "none",
654
- stroke: "currentColor",
655
- strokeWidth: "2",
656
- children: /* @__PURE__ */ jsx("path", { d: "M2 16 C6 16, 8 8, 12 12 S18 6, 22 10" })
657
- }
658
- );
659
- }
660
- function AreaIcon() {
661
- return /* @__PURE__ */ jsxs(
662
- "svg",
663
- {
664
- width: "16",
665
- height: "16",
666
- viewBox: "0 0 24 24",
667
- fill: "none",
668
- stroke: "currentColor",
669
- strokeWidth: "2",
670
- children: [
671
- /* @__PURE__ */ jsx("path", { d: "M2 20 L2 16 L8 10 L14 14 L22 6 L22 20 Z", fill: "currentColor", fillOpacity: "0.2" }),
672
- /* @__PURE__ */ jsx("polyline", { points: "2 16 8 10 14 14 22 6" })
673
- ]
674
- }
675
- );
676
- }
677
- function StackedAreaIcon() {
678
- return /* @__PURE__ */ jsxs(
679
- "svg",
680
- {
681
- width: "16",
682
- height: "16",
683
- viewBox: "0 0 24 24",
684
- fill: "none",
685
- stroke: "currentColor",
686
- strokeWidth: "2",
687
- children: [
688
- /* @__PURE__ */ jsx("path", { d: "M2 20 L2 14 L8 10 L14 12 L22 8 L22 20 Z", fill: "currentColor", fillOpacity: "0.3" }),
689
- /* @__PURE__ */ jsx("path", { d: "M2 20 L2 16 L8 14 L14 15 L22 12 L22 20 Z", fill: "currentColor", fillOpacity: "0.2" })
690
- ]
691
- }
692
- );
693
- }
694
- function BarIcon() {
695
- return /* @__PURE__ */ jsxs(
696
- "svg",
697
- {
698
- width: "16",
699
- height: "16",
700
- viewBox: "0 0 24 24",
701
- fill: "none",
702
- stroke: "currentColor",
703
- strokeWidth: "2",
704
- children: [
705
- /* @__PURE__ */ jsx("rect", { x: "2", y: "4", width: "14", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
706
- /* @__PURE__ */ jsx("rect", { x: "2", y: "10", width: "18", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
707
- /* @__PURE__ */ jsx("rect", { x: "2", y: "16", width: "10", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.2" })
708
- ]
709
- }
710
- );
711
- }
712
- function ColumnIcon() {
713
- return /* @__PURE__ */ jsxs(
714
- "svg",
715
- {
716
- width: "16",
717
- height: "16",
718
- viewBox: "0 0 24 24",
719
- fill: "none",
720
- stroke: "currentColor",
721
- strokeWidth: "2",
722
- children: [
723
- /* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "4", height: "14", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
724
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "4", height: "18", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
725
- /* @__PURE__ */ jsx("rect", { x: "16", y: "12", width: "4", height: "10", rx: "1", fill: "currentColor", fillOpacity: "0.2" })
726
- ]
727
- }
728
- );
729
- }
730
- function StackedBarIcon() {
731
- return /* @__PURE__ */ jsxs(
732
- "svg",
733
- {
734
- width: "16",
735
- height: "16",
736
- viewBox: "0 0 24 24",
737
- fill: "none",
738
- stroke: "currentColor",
739
- strokeWidth: "2",
740
- children: [
741
- /* @__PURE__ */ jsx("rect", { x: "2", y: "4", width: "8", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
742
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "6", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
743
- /* @__PURE__ */ jsx("rect", { x: "2", y: "10", width: "12", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
744
- /* @__PURE__ */ jsx("rect", { x: "14", y: "10", width: "6", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
745
- /* @__PURE__ */ jsx("rect", { x: "2", y: "16", width: "6", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
746
- /* @__PURE__ */ jsx("rect", { x: "8", y: "16", width: "4", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" })
747
- ]
748
- }
749
- );
750
- }
751
- function StackedColumnIcon() {
752
- return /* @__PURE__ */ jsxs(
753
- "svg",
754
- {
755
- width: "16",
756
- height: "16",
757
- viewBox: "0 0 24 24",
758
- fill: "none",
759
- stroke: "currentColor",
760
- strokeWidth: "2",
761
- children: [
762
- /* @__PURE__ */ jsx("rect", { x: "4", y: "14", width: "4", height: "8", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
763
- /* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "4", height: "6", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
764
- /* @__PURE__ */ jsx("rect", { x: "10", y: "10", width: "4", height: "12", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
765
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "4", height: "6", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
766
- /* @__PURE__ */ jsx("rect", { x: "16", y: "16", width: "4", height: "6", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
767
- /* @__PURE__ */ jsx("rect", { x: "16", y: "12", width: "4", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" })
768
- ]
769
- }
770
- );
771
- }
772
- function PieIcon() {
773
- return /* @__PURE__ */ jsxs(
774
- "svg",
775
- {
776
- width: "16",
777
- height: "16",
778
- viewBox: "0 0 24 24",
779
- fill: "none",
780
- stroke: "currentColor",
781
- strokeWidth: "2",
782
- children: [
783
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor", fillOpacity: "0.2" }),
784
- /* @__PURE__ */ jsx("path", { d: "M12 2 A10 10 0 0 1 22 12 L12 12 Z", fill: "currentColor", fillOpacity: "0.3" })
785
- ]
786
- }
787
- );
788
- }
789
- function DonutIcon() {
790
- return /* @__PURE__ */ jsxs(
791
- "svg",
792
- {
793
- width: "16",
794
- height: "16",
795
- viewBox: "0 0 24 24",
796
- fill: "none",
797
- stroke: "currentColor",
798
- strokeWidth: "2",
799
- children: [
800
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor", fillOpacity: "0.2" }),
801
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "5", fill: "var(--glass-elevated)", stroke: "none" }),
802
- /* @__PURE__ */ jsx(
803
- "path",
804
- {
805
- d: "M12 2 A10 10 0 0 1 22 12 L17 12 A5 5 0 0 0 12 7 Z",
806
- fill: "currentColor",
807
- fillOpacity: "0.3"
808
- }
809
- )
810
- ]
811
- }
812
- );
813
- }
814
- function HistogramIcon() {
815
- return /* @__PURE__ */ jsxs(
816
- "svg",
817
- {
818
- width: "16",
819
- height: "16",
820
- viewBox: "0 0 24 24",
821
- fill: "none",
822
- stroke: "currentColor",
823
- strokeWidth: "2",
824
- children: [
825
- /* @__PURE__ */ jsx("rect", { x: "2", y: "14", width: "4", height: "8", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
826
- /* @__PURE__ */ jsx("rect", { x: "6", y: "10", width: "4", height: "12", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
827
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "4", height: "18", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
828
- /* @__PURE__ */ jsx("rect", { x: "14", y: "8", width: "4", height: "14", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
829
- /* @__PURE__ */ jsx("rect", { x: "18", y: "12", width: "4", height: "10", rx: "0", fill: "currentColor", fillOpacity: "0.2" })
830
- ]
831
- }
832
- );
833
- }
834
- function FunnelIcon() {
835
- return /* @__PURE__ */ jsxs(
836
- "svg",
837
- {
838
- width: "16",
839
- height: "16",
840
- viewBox: "0 0 24 24",
841
- fill: "none",
842
- stroke: "currentColor",
843
- strokeWidth: "2",
844
- children: [
845
- /* @__PURE__ */ jsx("path", { d: "M2 4 H22 L18 10 H6 Z", fill: "currentColor", fillOpacity: "0.3" }),
846
- /* @__PURE__ */ jsx("path", { d: "M6 10 H18 L15 16 H9 Z", fill: "currentColor", fillOpacity: "0.25" }),
847
- /* @__PURE__ */ jsx("path", { d: "M9 16 H15 L13 22 H11 Z", fill: "currentColor", fillOpacity: "0.2" })
848
- ]
849
- }
850
- );
851
- }
852
- function HeatmapIcon() {
853
- return /* @__PURE__ */ jsxs(
854
- "svg",
855
- {
856
- width: "16",
857
- height: "16",
858
- viewBox: "0 0 24 24",
859
- fill: "none",
860
- stroke: "currentColor",
861
- strokeWidth: "1",
862
- children: [
863
- /* @__PURE__ */ jsx("rect", { x: "2", y: "2", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.1" }),
864
- /* @__PURE__ */ jsx("rect", { x: "9", y: "2", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.3" }),
865
- /* @__PURE__ */ jsx("rect", { x: "16", y: "2", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.2" }),
866
- /* @__PURE__ */ jsx("rect", { x: "2", y: "9", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.4" }),
867
- /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.6" }),
868
- /* @__PURE__ */ jsx("rect", { x: "16", y: "9", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.3" }),
869
- /* @__PURE__ */ jsx("rect", { x: "2", y: "16", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.2" }),
870
- /* @__PURE__ */ jsx("rect", { x: "9", y: "16", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.5" }),
871
- /* @__PURE__ */ jsx("rect", { x: "16", y: "16", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.4" })
872
- ]
873
- }
874
- );
875
- }
876
- function DefaultChartIcon() {
877
- return /* @__PURE__ */ jsxs(
878
- "svg",
879
- {
880
- width: "16",
881
- height: "16",
882
- viewBox: "0 0 24 24",
883
- fill: "none",
884
- stroke: "currentColor",
885
- strokeWidth: "2",
886
- children: [
887
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
888
- /* @__PURE__ */ jsx("path", { d: "M3 15 L9 9 L13 13 L21 5" })
889
- ]
890
- }
891
- );
892
- }
893
- var CHART_COLORS = [
894
- "var(--brand-pink)",
895
- "var(--brand-yellow)",
896
- "var(--status-info)",
897
- "var(--status-success)",
898
- "var(--status-warning)",
899
- "var(--status-error)"
900
- ];
901
- function getColor(index, customColor) {
902
- return customColor || CHART_COLORS[index % CHART_COLORS.length];
903
- }
904
- function Chart({
905
- intent,
906
- data,
907
- dimensions,
908
- measures,
909
- defaultType,
910
- allowedTypes,
911
- chartType: controlledType,
912
- onChartTypeChange,
913
- allowSwitching = false,
914
- title,
915
- subtitle,
916
- height = 300,
917
- legend: showLegend = true,
918
- grid = true,
919
- className
920
- }) {
921
- const { features } = useReportMode();
922
- const resolvedDefault = defaultType || getDefaultChartForIntent(intent);
923
- const [internalType, setInternalType] = useState(resolvedDefault);
924
- const activeType = controlledType ?? internalType;
925
- const resolvedAllowedTypes = useMemo(() => {
926
- if (allowedTypes) return allowedTypes;
927
- return getAllowedSwitchTargets(activeType);
928
- }, [allowedTypes, activeType]);
929
- const validation = useMemo(() => {
930
- return validateChartData(
931
- activeType,
932
- data,
933
- dimensions.map((d) => d.key),
934
- measures.map((m) => m.key)
935
- );
936
- }, [activeType, data, dimensions, measures]);
937
- const handleTypeChange = (newType) => {
938
- if (onChartTypeChange) {
939
- onChartTypeChange(newType);
940
- } else {
941
- setInternalType(newType);
942
- }
943
- };
944
- const chartMeta = CHART_REGISTRY[activeType];
945
- const renderChart = () => {
946
- if (!validation.isValid) {
947
- return /* @__PURE__ */ jsx("div", { className: "ds-chart__invalid", children: /* @__PURE__ */ jsx(
948
- DataStateIndicator,
949
- {
950
- state: "INSUFFICIENT_SAMPLE",
951
- variant: "full",
952
- details: {
953
- message: validation.errors[0],
954
- sampleSize: data.length,
955
- requiredSize: chartMeta?.contract.minDataPoints || 0
956
- }
957
- }
958
- ) });
959
- }
960
- const xKey = dimensions[0]?.key || "x";
961
- switch (activeType) {
962
- case "line":
963
- case "smooth_line":
964
- return renderLineChart(xKey, activeType === "smooth_line");
965
- case "area":
966
- case "stacked_area":
967
- case "area_100pct":
968
- return renderAreaChart(xKey, activeType);
969
- case "bar":
970
- case "stacked_bar":
971
- return renderBarChart(xKey, activeType, "horizontal");
972
- case "column":
973
- case "stacked_column":
974
- case "column_100pct":
975
- return renderBarChart(xKey, activeType, "vertical");
976
- case "pie":
977
- case "donut":
978
- return renderPieChart(xKey, activeType === "donut");
979
- case "histogram":
980
- return renderHistogram();
981
- default:
982
- return /* @__PURE__ */ jsxs("div", { className: "ds-chart__unsupported", children: [
983
- 'Chart type "',
984
- activeType,
985
- '" is not yet implemented'
986
- ] });
987
- }
988
- };
989
- const renderLineChart = (xKey, smooth) => /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(LineChart$1, { data, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
990
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
991
- /* @__PURE__ */ jsx(
992
- XAxis,
993
- {
994
- dataKey: xKey,
995
- tick: { fontSize: 12 },
996
- tickLine: false,
997
- axisLine: { strokeWidth: 1 }
998
- }
999
- ),
1000
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 }),
1001
- /* @__PURE__ */ jsx(
1002
- Tooltip,
1003
- {
1004
- contentStyle: {
1005
- background: "var(--glass-elevated)",
1006
- border: "1px solid var(--glass-border)"
1007
- }
1008
- }
1009
- ),
1010
- showLegend && measures.length > 1 && /* @__PURE__ */ jsx(Legend, {}),
1011
- measures.map((measure, idx) => /* @__PURE__ */ jsx(
1012
- Line,
1013
- {
1014
- type: smooth ? "monotone" : "linear",
1015
- dataKey: measure.key,
1016
- name: measure.label || measure.key,
1017
- stroke: getColor(idx, measure.color),
1018
- strokeWidth: 2,
1019
- dot: true,
1020
- activeDot: { r: 6 }
1021
- },
1022
- measure.key
1023
- ))
1024
- ] }) });
1025
- const renderAreaChart = (xKey, type) => {
1026
- const isStacked = type === "stacked_area" || type === "area_100pct";
1027
- const is100Pct = type === "area_100pct";
1028
- const chartData = is100Pct ? normalizeData(data, measures) : data;
1029
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(AreaChart, { data: chartData, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
1030
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
1031
- /* @__PURE__ */ jsx(
1032
- XAxis,
1033
- {
1034
- dataKey: xKey,
1035
- tick: { fontSize: 12 },
1036
- tickLine: false,
1037
- axisLine: { strokeWidth: 1 }
1038
- }
1039
- ),
1040
- /* @__PURE__ */ jsx(
1041
- YAxis,
1042
- {
1043
- tick: { fontSize: 12 },
1044
- tickLine: false,
1045
- axisLine: false,
1046
- width: 40,
1047
- domain: is100Pct ? [0, 100] : void 0,
1048
- tickFormatter: is100Pct ? (v) => `${v}%` : void 0
1049
- }
1050
- ),
1051
- /* @__PURE__ */ jsx(
1052
- Tooltip,
1053
- {
1054
- contentStyle: {
1055
- background: "var(--glass-elevated)",
1056
- border: "1px solid var(--glass-border)"
1057
- }
1058
- }
1059
- ),
1060
- showLegend && /* @__PURE__ */ jsx(Legend, {}),
1061
- measures.map((measure, idx) => /* @__PURE__ */ jsx(
1062
- Area,
1063
- {
1064
- type: "monotone",
1065
- dataKey: measure.key,
1066
- name: measure.label || measure.key,
1067
- stroke: getColor(idx, measure.color),
1068
- fill: getColor(idx, measure.color),
1069
- fillOpacity: 0.3,
1070
- stackId: isStacked ? "stack" : void 0
1071
- },
1072
- measure.key
1073
- ))
1074
- ] }) });
1075
- };
1076
- const renderBarChart = (xKey, type, layout) => {
1077
- const isStacked = type.includes("stacked") || type.includes("100pct");
1078
- const is100Pct = type.includes("100pct");
1079
- const isHorizontal = layout === "horizontal";
1080
- const chartData = is100Pct ? normalizeData(data, measures) : data;
1081
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
1082
- BarChart$1,
1083
- {
1084
- data: chartData,
1085
- layout: isHorizontal ? "vertical" : "horizontal",
1086
- margin: { top: 5, right: 20, left: isHorizontal ? 80 : 0, bottom: 5 },
1087
- children: [
1088
- grid && /* @__PURE__ */ jsx(
1089
- CartesianGrid,
1090
- {
1091
- strokeDasharray: "3 3",
1092
- horizontal: !isHorizontal,
1093
- vertical: isHorizontal
1094
- }
1095
- ),
1096
- isHorizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [
1097
- /* @__PURE__ */ jsx(
1098
- XAxis,
1099
- {
1100
- type: "number",
1101
- tick: { fontSize: 12 },
1102
- tickLine: false,
1103
- axisLine: false,
1104
- domain: is100Pct ? [0, 100] : void 0,
1105
- tickFormatter: is100Pct ? (v) => `${v}%` : void 0
1106
- }
1107
- ),
1108
- /* @__PURE__ */ jsx(
1109
- YAxis,
1110
- {
1111
- type: "category",
1112
- dataKey: xKey,
1113
- tick: { fontSize: 12 },
1114
- tickLine: false,
1115
- axisLine: false,
1116
- width: 80
1117
- }
1118
- )
1119
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1120
- /* @__PURE__ */ jsx(
1121
- XAxis,
1122
- {
1123
- dataKey: xKey,
1124
- tick: { fontSize: 12 },
1125
- tickLine: false,
1126
- axisLine: { strokeWidth: 1 }
1127
- }
1128
- ),
1129
- /* @__PURE__ */ jsx(
1130
- YAxis,
1131
- {
1132
- tick: { fontSize: 12 },
1133
- tickLine: false,
1134
- axisLine: false,
1135
- width: 40,
1136
- domain: is100Pct ? [0, 100] : void 0,
1137
- tickFormatter: is100Pct ? (v) => `${v}%` : void 0
1138
- }
1139
- )
1140
- ] }),
1141
- /* @__PURE__ */ jsx(
1142
- Tooltip,
1143
- {
1144
- contentStyle: {
1145
- background: "var(--glass-elevated)",
1146
- border: "1px solid var(--glass-border)"
1147
- }
1148
- }
1149
- ),
1150
- showLegend && measures.length > 1 && /* @__PURE__ */ jsx(Legend, {}),
1151
- measures.map((measure, idx) => /* @__PURE__ */ jsx(
1152
- Bar,
1153
- {
1154
- dataKey: measure.key,
1155
- name: measure.label || measure.key,
1156
- fill: getColor(idx, measure.color),
1157
- stackId: isStacked ? "stack" : void 0,
1158
- radius: isStacked ? void 0 : [4, 4, 0, 0]
1159
- },
1160
- measure.key
1161
- ))
1162
- ]
1163
- }
1164
- ) });
1165
- };
1166
- const renderPieChart = (nameKey, isDonut) => {
1167
- const valueKey = measures[0]?.key || "value";
1168
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(PieChart$1, { children: [
1169
- /* @__PURE__ */ jsx(
1170
- Pie,
1171
- {
1172
- data,
1173
- dataKey: valueKey,
1174
- nameKey,
1175
- cx: "50%",
1176
- cy: "50%",
1177
- innerRadius: isDonut ? "50%" : 0,
1178
- outerRadius: "80%",
1179
- label: ({ name, percent }) => `${name}: ${((percent ?? 0) * 100).toFixed(0)}%`,
1180
- labelLine: false,
1181
- children: data.map((_, idx) => /* @__PURE__ */ jsx(Cell, { fill: getColor(idx) }, `cell-${idx}`))
1182
- }
1183
- ),
1184
- /* @__PURE__ */ jsx(
1185
- Tooltip,
1186
- {
1187
- contentStyle: {
1188
- background: "var(--glass-elevated)",
1189
- border: "1px solid var(--glass-border)"
1190
- }
1191
- }
1192
- ),
1193
- showLegend && /* @__PURE__ */ jsx(Legend, {})
1194
- ] }) });
1195
- };
1196
- const renderHistogram = () => {
1197
- const valueKey = measures[0]?.key || "value";
1198
- const binKey = dimensions[0]?.key || "bin";
1199
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(BarChart$1, { data, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
1200
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
1201
- /* @__PURE__ */ jsx(
1202
- XAxis,
1203
- {
1204
- dataKey: binKey,
1205
- tick: { fontSize: 12 },
1206
- tickLine: false,
1207
- axisLine: { strokeWidth: 1 }
1208
- }
1209
- ),
1210
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 }),
1211
- /* @__PURE__ */ jsx(
1212
- Tooltip,
1213
- {
1214
- contentStyle: {
1215
- background: "var(--glass-elevated)",
1216
- border: "1px solid var(--glass-border)"
1217
- }
1218
- }
1219
- ),
1220
- /* @__PURE__ */ jsx(Bar, { dataKey: valueKey, fill: getColor(0), radius: [4, 4, 0, 0] })
1221
- ] }) });
1222
- };
1223
- const normalizeData = (sourceData, sourceMeasures) => {
1224
- return sourceData.map((row) => {
1225
- const total = sourceMeasures.reduce((sum, m) => {
1226
- const val = row[m.key];
1227
- return sum + (typeof val === "number" ? val : 0);
1228
- }, 0);
1229
- if (total === 0) return row;
1230
- const normalized = { ...row };
1231
- sourceMeasures.forEach((m) => {
1232
- const val = row[m.key];
1233
- if (typeof val === "number") {
1234
- normalized[m.key] = val / total * 100;
1235
- }
1236
- });
1237
- return normalized;
1238
- });
1239
- };
1240
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-chart", className), children: [
1241
- (title || subtitle || allowSwitching) && /* @__PURE__ */ jsxs("header", { className: "ds-chart__header", children: [
1242
- /* @__PURE__ */ jsxs("div", { className: "ds-chart__header-text", children: [
1243
- title && /* @__PURE__ */ jsx("h4", { className: "ds-chart__title", children: title }),
1244
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-chart__subtitle", children: subtitle })
1245
- ] }),
1246
- /* @__PURE__ */ jsxs("div", { className: "ds-chart__header-actions", children: [
1247
- features.showMethodology && data.length > 0 && /* @__PURE__ */ jsx(
1248
- DataCoverageBadge,
1249
- {
1250
- sampleSize: data.length,
1251
- requiredSize: chartMeta?.contract.minDataPoints || 0,
1252
- size: "sm"
1253
- }
1254
- ),
1255
- allowSwitching && resolvedAllowedTypes.length > 0 && /* @__PURE__ */ jsx(
1256
- ChartSwitchControl,
1257
- {
1258
- currentType: activeType,
1259
- allowedTypes: [activeType, ...resolvedAllowedTypes],
1260
- onTypeChange: handleTypeChange
1261
- }
1262
- )
1263
- ] })
1264
- ] }),
1265
- validation.warnings.length > 0 && /* @__PURE__ */ jsx("div", { className: "ds-chart__warnings", children: validation.warnings.map((warning, idx) => /* @__PURE__ */ jsx("div", { className: "ds-chart__warning", children: warning }, idx)) }),
1266
- /* @__PURE__ */ jsx("div", { className: "ds-chart__body", style: { height }, children: renderChart() })
1267
- ] });
1268
- }
1269
- Chart.displayName = "Chart";
1270
- var DIMENSION_LABELS = {
1271
- EI: { left: "Extraversion", right: "Introversion", full: "E/I" },
1272
- SN: { left: "Sensing", right: "Intuition", full: "S/N" },
1273
- TF: { left: "Thinking", right: "Feeling", full: "T/F" },
1274
- JP: { left: "Judging", right: "Perceiving", full: "J/P" }
1275
- };
1276
- function MBTIRadar({
1277
- dimensions,
1278
- sampleSize,
1279
- comparison,
1280
- title,
1281
- subtitle,
1282
- size = 300,
1283
- showLabels = true,
1284
- showValues = true,
1285
- minSampleSize = 20,
1286
- confidence,
1287
- className
1288
- }) {
1289
- const { features } = useReportMode();
1290
- const isValid = sampleSize >= minSampleSize;
1291
- const radarData = useMemo(() => {
1292
- return Object.keys(dimensions).map((key) => ({
1293
- dimension: DIMENSION_LABELS[key].full,
1294
- fullName: `${DIMENSION_LABELS[key].left} vs ${DIMENSION_LABELS[key].right}`,
1295
- value: dimensions[key],
1296
- comparison: comparison?.[key],
1297
- leftLabel: DIMENSION_LABELS[key].left,
1298
- rightLabel: DIMENSION_LABELS[key].right
1299
- }));
1300
- }, [dimensions, comparison]);
1301
- const derivedType = useMemo(() => {
1302
- const e = dimensions.EI < 50 ? "E" : "I";
1303
- const s = dimensions.SN < 50 ? "S" : "N";
1304
- const t = dimensions.TF < 50 ? "T" : "F";
1305
- const j = dimensions.JP < 50 ? "J" : "P";
1306
- return `${e}${s}${t}${j}`;
1307
- }, [dimensions]);
1308
- if (!isValid) {
1309
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-mbti-radar", "ds-mbti-radar--invalid", className), children: [
1310
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-radar__title", children: title }),
1311
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__empty", children: /* @__PURE__ */ jsx(
1312
- DataStateIndicator,
1313
- {
1314
- state: "INSUFFICIENT_SAMPLE",
1315
- variant: "full",
1316
- details: {
1317
- message: "MBTI analysis requires sufficient sample size",
1318
- sampleSize,
1319
- requiredSize: minSampleSize
1320
- }
1321
- }
1322
- ) })
1323
- ] });
1324
- }
1325
- const CustomTooltip = ({
1326
- active,
1327
- payload
1328
- }) => {
1329
- if (!active || !payload?.length) return null;
1330
- const data = payload[0].payload;
1331
- return /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__tooltip", children: [
1332
- /* @__PURE__ */ jsx("p", { className: "ds-mbti-radar__tooltip-title", children: data.fullName }),
1333
- /* @__PURE__ */ jsxs("p", { className: "ds-mbti-radar__tooltip-value", children: [
1334
- data.leftLabel,
1335
- ": ",
1336
- 100 - data.value,
1337
- "%"
1338
- ] }),
1339
- /* @__PURE__ */ jsxs("p", { className: "ds-mbti-radar__tooltip-value", children: [
1340
- data.rightLabel,
1341
- ": ",
1342
- data.value,
1343
- "%"
1344
- ] }),
1345
- data.comparison !== void 0 && /* @__PURE__ */ jsxs("p", { className: "ds-mbti-radar__tooltip-comparison", children: [
1346
- "Benchmark: ",
1347
- data.comparison,
1348
- "%"
1349
- ] })
1350
- ] });
1351
- };
1352
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-mbti-radar", className), children: [
1353
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-mbti-radar__header", children: [
1354
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__header-text", children: [
1355
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-radar__title", children: title }),
1356
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-mbti-radar__subtitle", children: subtitle })
1357
- ] }),
1358
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__header-badges", children: [
1359
- features.showConfidenceScores && confidence !== void 0 && /* @__PURE__ */ jsx(ConfidenceIndicator, { score: confidence, size: "sm" }),
1360
- features.showMethodology && /* @__PURE__ */ jsx(DataCoverageBadge, { sampleSize, requiredSize: minSampleSize, size: "sm" })
1361
- ] })
1362
- ] }),
1363
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__type-badge", children: [
1364
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__type-label", children: "Derived Type" }),
1365
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__type-value", children: derivedType })
1366
- ] }),
1367
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__chart", style: { width: size, height: size }, children: /* @__PURE__ */ jsxs(RadarChart, { cx: "50%", cy: "50%", outerRadius: "70%", width: size, height: size, data: radarData, children: [
1368
- /* @__PURE__ */ jsx(PolarGrid, { stroke: "var(--glass-border)" }),
1369
- /* @__PURE__ */ jsx(
1370
- PolarAngleAxis,
1371
- {
1372
- dataKey: "dimension",
1373
- tick: { fill: "var(--text-secondary)", fontSize: 12 }
1374
- }
1375
- ),
1376
- /* @__PURE__ */ jsx(
1377
- PolarRadiusAxis,
1378
- {
1379
- angle: 45,
1380
- domain: [0, 100],
1381
- tick: { fill: "var(--text-tertiary)", fontSize: 10 },
1382
- tickCount: 5
1383
- }
1384
- ),
1385
- /* @__PURE__ */ jsx(
1386
- Radar,
1387
- {
1388
- name: "Profile",
1389
- dataKey: "value",
1390
- stroke: "var(--brand-pink)",
1391
- fill: "var(--brand-pink)",
1392
- fillOpacity: 0.3,
1393
- strokeWidth: 2
1394
- }
1395
- ),
1396
- comparison && /* @__PURE__ */ jsx(
1397
- Radar,
1398
- {
1399
- name: "Benchmark",
1400
- dataKey: "comparison",
1401
- stroke: "var(--brand-yellow)",
1402
- fill: "var(--brand-yellow)",
1403
- fillOpacity: 0.1,
1404
- strokeWidth: 2,
1405
- strokeDasharray: "5 5"
1406
- }
1407
- ),
1408
- showValues && /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}) }),
1409
- comparison && /* @__PURE__ */ jsx(Legend, {})
1410
- ] }) }),
1411
- showLabels && /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__dimensions", children: radarData.map((d) => /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__dimension", children: [
1412
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__dimension-left", children: d.leftLabel }),
1413
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__dimension-bar", children: [
1414
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__dimension-fill", style: { width: `${d.value}%` } }),
1415
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__dimension-marker", style: { left: `${d.value}%` } })
1416
- ] }),
1417
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__dimension-right", children: d.rightLabel })
1418
- ] }, d.dimension)) })
1419
- ] });
1420
- }
1421
- MBTIRadar.displayName = "MBTIRadar";
1422
- var MBTI_GRID = [
1423
- ["ISTJ", "ISFJ", "INFJ", "INTJ"],
1424
- ["ISTP", "ISFP", "INFP", "INTP"],
1425
- ["ESTP", "ESFP", "ENFP", "ENTP"],
1426
- ["ESTJ", "ESFJ", "ENFJ", "ENTJ"]
1427
- ];
1428
- var TYPE_DESCRIPTIONS = {
1429
- ISTJ: "The Inspector - Practical, reliable, systematic",
1430
- ISFJ: "The Protector - Caring, supportive, traditional",
1431
- INFJ: "The Advocate - Insightful, principled, compassionate",
1432
- INTJ: "The Architect - Strategic, independent, determined",
1433
- ISTP: "The Virtuoso - Observant, practical, analytical",
1434
- ISFP: "The Adventurer - Artistic, sensitive, exploratory",
1435
- INFP: "The Mediator - Idealistic, empathetic, creative",
1436
- INTP: "The Logician - Inventive, logical, objective",
1437
- ESTP: "The Entrepreneur - Energetic, pragmatic, observant",
1438
- ESFP: "The Entertainer - Spontaneous, energetic, friendly",
1439
- ENFP: "The Campaigner - Enthusiastic, creative, sociable",
1440
- ENTP: "The Debater - Clever, curious, innovative",
1441
- ESTJ: "The Executive - Organized, logical, assertive",
1442
- ESFJ: "The Consul - Caring, sociable, traditional",
1443
- ENFJ: "The Protagonist - Charismatic, empathetic, organized",
1444
- ENTJ: "The Commander - Strategic, efficient, energetic"
1445
- };
1446
- var COLUMN_LABELS = ["ST", "SF", "NF", "NT"];
1447
- var ROW_LABELS = ["I-J", "I-P", "E-P", "E-J"];
1448
- function MBTITypeGrid({
1449
- data,
1450
- sampleSize: propSampleSize,
1451
- title,
1452
- subtitle,
1453
- showPercentages = true,
1454
- showCounts = true,
1455
- highlightThreshold,
1456
- minSampleSize = 50,
1457
- confidence,
1458
- onTypeClick,
1459
- selectedType,
1460
- className
1461
- }) {
1462
- const { features } = useReportMode();
1463
- const typeMap = useMemo(() => {
1464
- const map = /* @__PURE__ */ new Map();
1465
- for (const item of data) {
1466
- map.set(item.type, item);
1467
- }
1468
- return map;
1469
- }, [data]);
1470
- const totalSampleSize = propSampleSize ?? data.reduce((sum, d) => sum + d.count, 0);
1471
- const isValid = totalSampleSize >= minSampleSize;
1472
- const maxCount = useMemo(() => Math.max(...data.map((d) => d.count), 1), [data]);
1473
- const getPercentage = (count) => {
1474
- return totalSampleSize > 0 ? (count / totalSampleSize * 100).toFixed(1) : "0.0";
1475
- };
1476
- const getIntensity = (count) => {
1477
- if (maxCount === 0) return 0;
1478
- return count / maxCount * 100;
1479
- };
1480
- const isHighlighted = (type) => {
1481
- if (!highlightThreshold) return false;
1482
- const item = typeMap.get(type);
1483
- if (!item) return false;
1484
- const percentage = item.count / totalSampleSize * 100;
1485
- return percentage >= highlightThreshold;
1486
- };
1487
- if (!isValid) {
1488
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-mbti-type-grid", "ds-mbti-type-grid--invalid", className), children: [
1489
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-type-grid__title", children: title }),
1490
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__empty", children: /* @__PURE__ */ jsx(
1491
- DataStateIndicator,
1492
- {
1493
- state: "INSUFFICIENT_SAMPLE",
1494
- variant: "full",
1495
- details: {
1496
- message: "MBTI distribution analysis requires sufficient sample size",
1497
- sampleSize: totalSampleSize,
1498
- requiredSize: minSampleSize
1499
- }
1500
- }
1501
- ) })
1502
- ] });
1503
- }
1504
- return /* @__PURE__ */ jsxs("div", { className: clsx7("ds-mbti-type-grid", className), children: [
1505
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-mbti-type-grid__header", children: [
1506
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__header-text", children: [
1507
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-type-grid__title", children: title }),
1508
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-mbti-type-grid__subtitle", children: subtitle })
1509
- ] }),
1510
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__header-badges", children: [
1511
- features.showConfidenceScores && confidence !== void 0 && /* @__PURE__ */ jsx(ConfidenceIndicator, { score: confidence, size: "sm" }),
1512
- features.showMethodology && /* @__PURE__ */ jsx(
1513
- DataCoverageBadge,
1514
- {
1515
- sampleSize: totalSampleSize,
1516
- requiredSize: minSampleSize,
1517
- size: "sm"
1518
- }
1519
- )
1520
- ] })
1521
- ] }),
1522
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__container", children: [
1523
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__column-headers", children: [
1524
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__corner" }),
1525
- COLUMN_LABELS.map((label) => /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__column-header", children: label }, label))
1526
- ] }),
1527
- MBTI_GRID.map((row, rowIndex) => /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__row", children: [
1528
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__row-header", children: ROW_LABELS[rowIndex] }),
1529
- row.map((type) => {
1530
- const typeData = typeMap.get(type);
1531
- const count = typeData?.count ?? 0;
1532
- const percentage = getPercentage(count);
1533
- const intensity = getIntensity(count);
1534
- const highlighted = isHighlighted(type);
1535
- const selected = selectedType === type;
1536
- return /* @__PURE__ */ jsx(
1537
- Tooltip$1,
1538
- {
1539
- content: /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__tooltip-content", children: [
1540
- /* @__PURE__ */ jsx("strong", { children: type }),
1541
- /* @__PURE__ */ jsx("p", { children: TYPE_DESCRIPTIONS[type] }),
1542
- /* @__PURE__ */ jsxs("p", { children: [
1543
- "Count: ",
1544
- count.toLocaleString()
1545
- ] }),
1546
- /* @__PURE__ */ jsxs("p", { children: [
1547
- "Percentage: ",
1548
- percentage,
1549
- "%"
1550
- ] }),
1551
- typeData?.responseRate !== void 0 && /* @__PURE__ */ jsxs("p", { children: [
1552
- "Response Rate: ",
1553
- typeData.responseRate.toFixed(1),
1554
- "%"
1555
- ] })
1556
- ] }),
1557
- children: /* @__PURE__ */ jsxs(
1558
- "button",
1559
- {
1560
- type: "button",
1561
- className: clsx7(
1562
- "ds-mbti-type-grid__cell",
1563
- highlighted && "ds-mbti-type-grid__cell--highlighted",
1564
- selected && "ds-mbti-type-grid__cell--selected",
1565
- onTypeClick && "ds-mbti-type-grid__cell--clickable"
1566
- ),
1567
- onClick: () => onTypeClick?.(type),
1568
- disabled: !onTypeClick,
1569
- style: {
1570
- "--cell-intensity": `${intensity}%`
1571
- },
1572
- children: [
1573
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__cell-type", children: type }),
1574
- showCounts && /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__cell-count", children: count.toLocaleString() }),
1575
- showPercentages && /* @__PURE__ */ jsxs("span", { className: "ds-mbti-type-grid__cell-percentage", children: [
1576
- percentage,
1577
- "%"
1578
- ] })
1579
- ]
1580
- }
1581
- )
1582
- },
1583
- type
1584
- );
1585
- })
1586
- ] }, rowIndex))
1587
- ] }),
1588
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__legend", children: [
1589
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__legend-item", children: [
1590
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__legend-bar ds-mbti-type-grid__legend-bar--gradient" }),
1591
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__legend-label", children: "Distribution density" })
1592
- ] }),
1593
- highlightThreshold && /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__legend-item", children: [
1594
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__legend-bar ds-mbti-type-grid__legend-bar--highlight" }),
1595
- /* @__PURE__ */ jsxs("span", { className: "ds-mbti-type-grid__legend-label", children: [
1596
- ">=",
1597
- highlightThreshold,
1598
- "% of sample"
1599
- ] })
1600
- ] })
1601
- ] })
1602
- ] });
1603
- }
1604
- MBTITypeGrid.displayName = "MBTITypeGrid";
1605
-
1606
- export { BarChart, Chart, ChartContainer, ChartSwitchControl, FunnelChart, HeatmapChart, LineChart, MBTIRadar, MBTITypeGrid, PieChart };
1607
- //# sourceMappingURL=out.js.map
1608
- //# sourceMappingURL=chunk-GUZIMHWS.js.map