@salesmind-ai/design-system 0.2.1 → 0.3.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 (121) hide show
  1. package/dist/AppearancePanel-UT57J69V.d.cts +51 -0
  2. package/dist/AppearancePanel-UT57J69V.d.ts +51 -0
  3. package/dist/AppearanceProvider-C36a8-eb.d.cts +45 -0
  4. package/dist/AppearanceProvider-C36a8-eb.d.ts +45 -0
  5. package/dist/Breadcrumb-RX-B_gDV.d.cts +44 -0
  6. package/dist/Breadcrumb-RX-B_gDV.d.ts +44 -0
  7. package/dist/ExportMenu-A2TLFiVv.d.cts +311 -0
  8. package/dist/ExportMenu-C8qck5AT.d.ts +311 -0
  9. package/dist/SectionShell-BfBw5q0Y.d.cts +18 -0
  10. package/dist/SectionShell-BfBw5q0Y.d.ts +18 -0
  11. package/dist/Select-BdZmK0Lt.d.cts +66 -0
  12. package/dist/Select-BdZmK0Lt.d.ts +66 -0
  13. package/dist/admin/index.cjs +2941 -0
  14. package/dist/admin/index.cjs.map +1 -0
  15. package/dist/admin/index.css +4145 -0
  16. package/dist/admin/index.css.map +1 -0
  17. package/dist/admin/index.d.cts +491 -0
  18. package/dist/admin/index.d.ts +491 -0
  19. package/dist/admin/index.js +2918 -0
  20. package/dist/admin/index.js.map +1 -0
  21. package/dist/{audit-CiyPkxk1.d.cts → audit-BS2fn7M4.d.ts} +2 -51
  22. package/dist/{audit-CiyPkxk1.d.ts → audit-DwCmg32J.d.cts} +2 -51
  23. package/dist/blog/index.cjs +1074 -0
  24. package/dist/blog/index.cjs.map +1 -0
  25. package/dist/blog/index.css +1422 -0
  26. package/dist/blog/index.css.map +1 -0
  27. package/dist/blog/index.d.cts +233 -0
  28. package/dist/blog/index.d.ts +233 -0
  29. package/dist/blog/index.js +1056 -0
  30. package/dist/blog/index.js.map +1 -0
  31. package/dist/chart-types-BGVVO-zl.d.cts +208 -0
  32. package/dist/chart-types-BGVVO-zl.d.ts +208 -0
  33. package/dist/charts/index.cjs +2698 -0
  34. package/dist/charts/index.cjs.map +1 -0
  35. package/dist/charts/index.css +1167 -0
  36. package/dist/charts/index.css.map +1 -0
  37. package/dist/charts/index.d.cts +453 -0
  38. package/dist/charts/index.d.ts +453 -0
  39. package/dist/charts/index.js +2682 -0
  40. package/dist/charts/index.js.map +1 -0
  41. package/dist/core/index.cjs +526 -395
  42. package/dist/core/index.cjs.map +1 -1
  43. package/dist/core/index.css +294 -0
  44. package/dist/core/index.css.map +1 -1
  45. package/dist/core/index.d.cts +7 -982
  46. package/dist/core/index.d.ts +7 -982
  47. package/dist/core/index.js +476 -351
  48. package/dist/core/index.js.map +1 -1
  49. package/dist/i18n/index.cjs +585 -0
  50. package/dist/i18n/index.cjs.map +1 -0
  51. package/dist/i18n/index.d.cts +855 -0
  52. package/dist/i18n/index.d.ts +855 -0
  53. package/dist/i18n/index.js +547 -0
  54. package/dist/i18n/index.js.map +1 -0
  55. package/dist/index.d.cts +22 -1290
  56. package/dist/index.d.ts +22 -1290
  57. package/dist/marketing/index.cjs +2144 -3023
  58. package/dist/marketing/index.cjs.map +1 -1
  59. package/dist/marketing/index.css +3729 -4824
  60. package/dist/marketing/index.css.map +1 -1
  61. package/dist/marketing/index.d.cts +1351 -4
  62. package/dist/marketing/index.d.ts +1351 -4
  63. package/dist/marketing/index.js +2190 -3054
  64. package/dist/marketing/index.js.map +1 -1
  65. package/dist/motion/index.cjs +1230 -0
  66. package/dist/motion/index.cjs.map +1 -0
  67. package/dist/motion/index.css +699 -0
  68. package/dist/motion/index.css.map +1 -0
  69. package/dist/motion/index.d.cts +68 -0
  70. package/dist/motion/index.d.ts +68 -0
  71. package/dist/motion/index.js +1218 -0
  72. package/dist/motion/index.js.map +1 -0
  73. package/dist/nav/index.cjs +1533 -0
  74. package/dist/nav/index.cjs.map +1 -0
  75. package/dist/nav/index.css +1984 -0
  76. package/dist/nav/index.css.map +1 -0
  77. package/dist/nav/index.d.cts +279 -0
  78. package/dist/nav/index.d.ts +279 -0
  79. package/dist/nav/index.js +1501 -0
  80. package/dist/nav/index.js.map +1 -0
  81. package/dist/report/index.cjs +26 -1649
  82. package/dist/report/index.cjs.map +1 -1
  83. package/dist/report/index.css +0 -963
  84. package/dist/report/index.css.map +1 -1
  85. package/dist/report/index.d.cts +4 -2
  86. package/dist/report/index.d.ts +4 -2
  87. package/dist/report/index.js +27 -1640
  88. package/dist/report/index.js.map +1 -1
  89. package/dist/sections/index.cjs +385 -0
  90. package/dist/sections/index.cjs.map +1 -0
  91. package/dist/sections/index.css +818 -0
  92. package/dist/sections/index.css.map +1 -0
  93. package/dist/sections/index.d.cts +69 -0
  94. package/dist/sections/index.d.ts +69 -0
  95. package/dist/sections/index.js +374 -0
  96. package/dist/sections/index.js.map +1 -0
  97. package/dist/social-proof/index.cjs +1254 -0
  98. package/dist/social-proof/index.cjs.map +1 -0
  99. package/dist/social-proof/index.css +1416 -0
  100. package/dist/social-proof/index.css.map +1 -0
  101. package/dist/social-proof/index.d.cts +258 -0
  102. package/dist/social-proof/index.d.ts +258 -0
  103. package/dist/social-proof/index.js +1237 -0
  104. package/dist/social-proof/index.js.map +1 -0
  105. package/dist/theme/index.cjs +573 -0
  106. package/dist/theme/index.cjs.map +1 -0
  107. package/dist/theme/index.css +464 -0
  108. package/dist/theme/index.css.map +1 -0
  109. package/dist/theme/index.d.cts +48 -0
  110. package/dist/theme/index.d.ts +48 -0
  111. package/dist/theme/index.js +558 -0
  112. package/dist/theme/index.js.map +1 -0
  113. package/dist/types-DAlgDGzw.d.cts +52 -0
  114. package/dist/types-DAlgDGzw.d.ts +52 -0
  115. package/dist/web/index.d.cts +3 -2
  116. package/dist/web/index.d.ts +3 -2
  117. package/package.json +68 -9
  118. package/dist/ExportMenu-hEe5MhLq.d.cts +0 -1027
  119. package/dist/ExportMenu-hEe5MhLq.d.ts +0 -1027
  120. package/dist/index-B64suAAc.d.cts +0 -1498
  121. package/dist/index-B64suAAc.d.ts +0 -1498
@@ -1,8 +1,6 @@
1
- import React2, { createContext, useMemo, useContext, useState } from 'react';
1
+ import React2, { createContext, useMemo, useContext } from 'react';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import clsx20 from 'clsx';
4
- import { LineChart as LineChart$1, CartesianGrid, XAxis, YAxis, Tooltip as Tooltip$1, 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 { Tooltip } from '@base-ui/react/tooltip';
3
+ import clsx12 from 'clsx';
6
4
  import { Select as Select$1 } from '@base-ui/react/select';
7
5
  import { Menu } from '@base-ui/react/menu';
8
6
 
@@ -1158,7 +1156,7 @@ var ReportShell = React2.forwardRef(
1158
1156
  "div",
1159
1157
  {
1160
1158
  ref,
1161
- className: clsx20("ds-report-shell", className),
1159
+ className: clsx12("ds-report-shell", className),
1162
1160
  "data-mode": mode,
1163
1161
  "data-brand": brand,
1164
1162
  ...props,
@@ -1184,7 +1182,7 @@ var ExecutiveThesis = React2.forwardRef(
1184
1182
  "section",
1185
1183
  {
1186
1184
  ref,
1187
- className: clsx20("ds-executive-thesis", className),
1185
+ className: clsx12("ds-executive-thesis", className),
1188
1186
  "aria-labelledby": "executive-thesis-title",
1189
1187
  ...props,
1190
1188
  children: [
@@ -1201,7 +1199,7 @@ var ExecutiveThesis = React2.forwardRef(
1201
1199
  /* @__PURE__ */ jsxs(
1202
1200
  "span",
1203
1201
  {
1204
- className: clsx20(
1202
+ className: clsx12(
1205
1203
  "ds-executive-thesis__metric-value",
1206
1204
  metric.trend && `ds-executive-thesis__metric-value--${metric.trend}`
1207
1205
  ),
@@ -1234,7 +1232,7 @@ var InsightBlock = React2.forwardRef(
1234
1232
  "section",
1235
1233
  {
1236
1234
  ref,
1237
- className: clsx20("ds-insight-block", getConfidenceClass(), className),
1235
+ className: clsx12("ds-insight-block", getConfidenceClass(), className),
1238
1236
  "data-insight-type": type,
1239
1237
  "aria-labelledby": `insight-${type}-title`,
1240
1238
  ...props,
@@ -1280,7 +1278,7 @@ var EvidenceGroup = React2.forwardRef(
1280
1278
  "div",
1281
1279
  {
1282
1280
  ref,
1283
- className: clsx20(
1281
+ className: clsx12(
1284
1282
  "ds-evidence-group",
1285
1283
  `ds-evidence-group--${layout}`,
1286
1284
  layout === "grid" && `ds-evidence-group--cols-${columns}`,
@@ -1306,7 +1304,7 @@ var ConfidenceIndicator = React2.forwardRef(
1306
1304
  "div",
1307
1305
  {
1308
1306
  ref,
1309
- className: clsx20(
1307
+ className: clsx12(
1310
1308
  "ds-confidence-indicator",
1311
1309
  `ds-confidence-indicator--${size}`,
1312
1310
  `ds-confidence-indicator--${threshold.level}`,
@@ -1341,7 +1339,7 @@ var DataCoverageBadge = React2.forwardRef(
1341
1339
  "div",
1342
1340
  {
1343
1341
  ref,
1344
- className: clsx20(
1342
+ className: clsx12(
1345
1343
  "ds-data-coverage-badge",
1346
1344
  `ds-data-coverage-badge--${size}`,
1347
1345
  !isSufficient && "ds-data-coverage-badge--insufficient",
@@ -1528,7 +1526,7 @@ var DataStateIndicator = React2.forwardRef(
1528
1526
  "div",
1529
1527
  {
1530
1528
  ref,
1531
- className: clsx20(
1529
+ className: clsx12(
1532
1530
  "ds-data-state-indicator",
1533
1531
  `ds-data-state-indicator--${variant}`,
1534
1532
  `ds-data-state-indicator--${state.toLowerCase().replace(/_/g, "-")}`,
@@ -1584,7 +1582,7 @@ var MethodologyNote = React2.forwardRef(
1584
1582
  "aside",
1585
1583
  {
1586
1584
  ref,
1587
- className: clsx20("ds-methodology-note", className),
1585
+ className: clsx12("ds-methodology-note", className),
1588
1586
  "aria-label": titleText,
1589
1587
  ...props,
1590
1588
  children: [
@@ -1705,7 +1703,7 @@ var CaveatBlock = React2.forwardRef(
1705
1703
  "aside",
1706
1704
  {
1707
1705
  ref,
1708
- className: clsx20("ds-caveat-block", `ds-caveat-block--${severity}`, className),
1706
+ className: clsx12("ds-caveat-block", `ds-caveat-block--${severity}`, className),
1709
1707
  role: "note",
1710
1708
  "aria-label": title,
1711
1709
  ...props,
@@ -1768,7 +1766,7 @@ var KeyMetric = React2.forwardRef(
1768
1766
  Component,
1769
1767
  {
1770
1768
  ref,
1771
- className: clsx20(
1769
+ className: clsx12(
1772
1770
  "ds-key-metric",
1773
1771
  `ds-key-metric--${size}`,
1774
1772
  loading && "ds-key-metric--loading",
@@ -1796,7 +1794,7 @@ var KeyMetric = React2.forwardRef(
1796
1794
  trend && /* @__PURE__ */ jsxs(
1797
1795
  "span",
1798
1796
  {
1799
- className: clsx20("ds-key-metric__trend", `ds-key-metric__trend--${trend.direction}`),
1797
+ className: clsx12("ds-key-metric__trend", `ds-key-metric__trend--${trend.direction}`),
1800
1798
  children: [
1801
1799
  /* @__PURE__ */ jsx("span", { className: "ds-key-metric__trend-icon", children: getTrendIcon(trend.direction) }),
1802
1800
  /* @__PURE__ */ jsxs("span", { className: "ds-key-metric__trend-value", children: [
@@ -1886,7 +1884,7 @@ var TrendIndicator = React2.forwardRef(
1886
1884
  "span",
1887
1885
  {
1888
1886
  ref,
1889
- className: clsx20(
1887
+ className: clsx12(
1890
1888
  "ds-trend-indicator",
1891
1889
  `ds-trend-indicator--${size}`,
1892
1890
  `ds-trend-indicator--${direction}`,
@@ -1909,1617 +1907,6 @@ var TrendIndicator = React2.forwardRef(
1909
1907
  }
1910
1908
  );
1911
1909
  TrendIndicator.displayName = "TrendIndicator";
1912
- function ChartContainer({
1913
- title,
1914
- subtitle,
1915
- height = 300,
1916
- data = [],
1917
- requiredFields = [],
1918
- minSampleSize = 30,
1919
- showCoverage = true,
1920
- dateRange,
1921
- loading,
1922
- emptyMessage = "No data available",
1923
- children,
1924
- className,
1925
- ...props
1926
- }) {
1927
- const { features } = useReportMode();
1928
- const { state, isRenderable, message } = useChartData({
1929
- data,
1930
- requiredFields,
1931
- minSampleSize
1932
- });
1933
- const renderContent = () => {
1934
- if (loading) {
1935
- return /* @__PURE__ */ jsxs("div", { className: "ds-chart-container__loading", children: [
1936
- /* @__PURE__ */ jsx("div", { className: "ds-chart-container__spinner" }),
1937
- /* @__PURE__ */ jsx("span", { children: "Loading chart..." })
1938
- ] });
1939
- }
1940
- if (!isRenderable && state !== "VALID") {
1941
- return /* @__PURE__ */ jsxs("div", { className: "ds-chart-container__empty", children: [
1942
- /* @__PURE__ */ jsx(
1943
- DataStateIndicator,
1944
- {
1945
- state,
1946
- variant: "full",
1947
- details: { message, sampleSize: data.length, requiredSize: minSampleSize }
1948
- }
1949
- ),
1950
- state === "INSUFFICIENT_SAMPLE" && data.length === 0 && /* @__PURE__ */ jsx("p", { className: "ds-chart-container__empty-message", children: emptyMessage })
1951
- ] });
1952
- }
1953
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children });
1954
- };
1955
- return /* @__PURE__ */ jsxs(
1956
- "div",
1957
- {
1958
- className: clsx20(
1959
- "ds-chart-container",
1960
- loading && "ds-chart-container--loading",
1961
- !isRenderable && "ds-chart-container--invalid",
1962
- className
1963
- ),
1964
- ...props,
1965
- children: [
1966
- (title || subtitle || showCoverage && features.showMethodology) && /* @__PURE__ */ jsxs("header", { className: "ds-chart-container__header", children: [
1967
- /* @__PURE__ */ jsxs("div", { className: "ds-chart-container__header-content", children: [
1968
- title && /* @__PURE__ */ jsx("h4", { className: "ds-chart-container__title", children: title }),
1969
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-chart-container__subtitle", children: subtitle })
1970
- ] }),
1971
- showCoverage && features.showMethodology && data.length > 0 && /* @__PURE__ */ jsx(
1972
- DataCoverageBadge,
1973
- {
1974
- sampleSize: data.length,
1975
- requiredSize: minSampleSize,
1976
- dateRange,
1977
- size: "sm"
1978
- }
1979
- )
1980
- ] }),
1981
- /* @__PURE__ */ jsx(
1982
- "div",
1983
- {
1984
- className: "ds-chart-container__chart",
1985
- style: { height: typeof height === "number" ? height : void 0 },
1986
- children: renderContent()
1987
- }
1988
- ),
1989
- isRenderable && state !== "VALID" && /* @__PURE__ */ jsx("footer", { className: "ds-chart-container__footer", children: /* @__PURE__ */ jsx(DataStateIndicator, { state, variant: "compact" }) })
1990
- ]
1991
- }
1992
- );
1993
- }
1994
- ChartContainer.displayName = "ChartContainer";
1995
- var DEFAULT_COLORS = [
1996
- "var(--brand-pink)",
1997
- "var(--brand-yellow)",
1998
- "var(--status-info)",
1999
- "var(--status-success)",
2000
- "var(--status-warning)"
2001
- ];
2002
- function LineChart({
2003
- data,
2004
- xKey,
2005
- lines,
2006
- title,
2007
- subtitle,
2008
- height = 300,
2009
- grid = true,
2010
- legend: showLegend = true,
2011
- curve = "monotone",
2012
- minSampleSize = 7,
2013
- dateRange,
2014
- className
2015
- }) {
2016
- const requiredFields = [xKey, ...lines.map((l) => l.key)];
2017
- const chartData = React2.useMemo(() => data.map((item) => ({ ...item })), [data]);
2018
- return /* @__PURE__ */ jsx(
2019
- ChartContainer,
2020
- {
2021
- title,
2022
- subtitle,
2023
- height,
2024
- data,
2025
- requiredFields,
2026
- minSampleSize,
2027
- dateRange,
2028
- className,
2029
- children: /* @__PURE__ */ jsxs(LineChart$1, { data: chartData, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
2030
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
2031
- /* @__PURE__ */ jsx(
2032
- XAxis,
2033
- {
2034
- dataKey: xKey,
2035
- tick: { fontSize: 12 },
2036
- tickLine: false,
2037
- axisLine: { strokeWidth: 1 }
2038
- }
2039
- ),
2040
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 }),
2041
- /* @__PURE__ */ jsx(Tooltip$1, {}),
2042
- showLegend && /* @__PURE__ */ jsx(Legend, {}),
2043
- lines.map((line, index) => /* @__PURE__ */ jsx(
2044
- Line,
2045
- {
2046
- type: curve,
2047
- dataKey: line.key,
2048
- name: line.name || line.key,
2049
- stroke: line.color || DEFAULT_COLORS[index % DEFAULT_COLORS.length],
2050
- strokeWidth: 2,
2051
- strokeDasharray: line.dashed ? "5 5" : void 0,
2052
- dot: line.dot !== false,
2053
- activeDot: { r: 6 }
2054
- },
2055
- line.key
2056
- ))
2057
- ] })
2058
- }
2059
- );
2060
- }
2061
- LineChart.displayName = "LineChart";
2062
- var DEFAULT_COLORS2 = [
2063
- "var(--brand-pink)",
2064
- "var(--brand-yellow)",
2065
- "var(--status-info)",
2066
- "var(--status-success)",
2067
- "var(--status-warning)"
2068
- ];
2069
- function BarChart({
2070
- data,
2071
- xKey,
2072
- bars,
2073
- title,
2074
- subtitle,
2075
- height = 300,
2076
- layout = "horizontal",
2077
- grid = true,
2078
- legend: showLegend = true,
2079
- radius = 4,
2080
- showLabels = false,
2081
- minSampleSize = 5,
2082
- categoryColors,
2083
- className
2084
- }) {
2085
- const requiredFields = [xKey, ...bars.map((b) => b.key)];
2086
- const isVertical = layout === "vertical";
2087
- const chartData = useMemo(() => data.map((item) => ({ ...item })), [data]);
2088
- return /* @__PURE__ */ jsx(
2089
- ChartContainer,
2090
- {
2091
- title,
2092
- subtitle,
2093
- height,
2094
- data: chartData,
2095
- requiredFields,
2096
- minSampleSize,
2097
- className,
2098
- children: /* @__PURE__ */ jsxs(
2099
- BarChart$1,
2100
- {
2101
- data: chartData,
2102
- layout: isVertical ? "vertical" : "horizontal",
2103
- margin: { top: 5, right: 20, left: isVertical ? 80 : 0, bottom: 5 },
2104
- children: [
2105
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", horizontal: !isVertical, vertical: isVertical }),
2106
- isVertical ? /* @__PURE__ */ jsxs(Fragment, { children: [
2107
- /* @__PURE__ */ jsx(XAxis, { type: "number", tick: { fontSize: 12 }, tickLine: false, axisLine: false }),
2108
- /* @__PURE__ */ jsx(
2109
- YAxis,
2110
- {
2111
- type: "category",
2112
- dataKey: xKey,
2113
- tick: { fontSize: 12 },
2114
- tickLine: false,
2115
- axisLine: false,
2116
- width: 80
2117
- }
2118
- )
2119
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2120
- /* @__PURE__ */ jsx(
2121
- XAxis,
2122
- {
2123
- dataKey: xKey,
2124
- tick: { fontSize: 12 },
2125
- tickLine: false,
2126
- axisLine: { strokeWidth: 1 }
2127
- }
2128
- ),
2129
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 })
2130
- ] }),
2131
- /* @__PURE__ */ jsx(Tooltip$1, {}),
2132
- showLegend && bars.length > 1 && /* @__PURE__ */ jsx(Legend, {}),
2133
- bars.map((bar, barIndex) => /* @__PURE__ */ jsx(
2134
- Bar,
2135
- {
2136
- dataKey: bar.key,
2137
- name: bar.name || bar.key,
2138
- fill: bar.color || DEFAULT_COLORS2[barIndex % DEFAULT_COLORS2.length],
2139
- stackId: bar.stackId,
2140
- radius: [radius, radius, 0, 0],
2141
- label: showLabels ? { position: "top", fontSize: 10 } : false,
2142
- children: categoryColors && chartData.map((_, index) => /* @__PURE__ */ jsx(Cell, { fill: categoryColors[index % categoryColors.length] }, `cell-${index}`))
2143
- },
2144
- bar.key
2145
- ))
2146
- ]
2147
- }
2148
- )
2149
- }
2150
- );
2151
- }
2152
- BarChart.displayName = "BarChart";
2153
- var DEFAULT_COLORS3 = [
2154
- "var(--brand-pink)",
2155
- "var(--brand-yellow)",
2156
- "var(--status-info)",
2157
- "var(--status-success)",
2158
- "var(--status-warning)",
2159
- "var(--status-error)",
2160
- "#8884d8",
2161
- "#82ca9d"
2162
- ];
2163
- function PieChart({
2164
- data,
2165
- title,
2166
- subtitle,
2167
- height = 300,
2168
- innerRadius = 0,
2169
- outerRadius = 80,
2170
- showLabels = true,
2171
- labelType = "percent",
2172
- legend: showLegend = true,
2173
- minSampleSize = 30,
2174
- className
2175
- }) {
2176
- const safeData = useMemo(() => data.map((item) => ({ ...item })), [data]);
2177
- const renderLabel = (props) => {
2178
- const { name, value, percent } = props;
2179
- switch (labelType) {
2180
- case "percent":
2181
- return `${((percent ?? 0) * 100).toFixed(0)}%`;
2182
- case "value":
2183
- return (value ?? 0).toLocaleString();
2184
- case "name":
2185
- return name ?? "";
2186
- default:
2187
- return "";
2188
- }
2189
- };
2190
- return /* @__PURE__ */ jsx(
2191
- ChartContainer,
2192
- {
2193
- title,
2194
- subtitle,
2195
- height,
2196
- data: safeData,
2197
- requiredFields: ["name", "value"],
2198
- minSampleSize,
2199
- className,
2200
- children: /* @__PURE__ */ jsxs(PieChart$1, { children: [
2201
- /* @__PURE__ */ jsx(
2202
- Pie,
2203
- {
2204
- data: safeData,
2205
- cx: "50%",
2206
- cy: "50%",
2207
- innerRadius,
2208
- outerRadius,
2209
- paddingAngle: 2,
2210
- dataKey: "value",
2211
- label: showLabels ? renderLabel : void 0,
2212
- labelLine: showLabels,
2213
- children: safeData.map((entry, index) => /* @__PURE__ */ jsx(
2214
- Cell,
2215
- {
2216
- fill: entry.color || DEFAULT_COLORS3[index % DEFAULT_COLORS3.length]
2217
- },
2218
- `cell-${index}`
2219
- ))
2220
- }
2221
- ),
2222
- /* @__PURE__ */ jsx(Tooltip$1, {}),
2223
- showLegend && /* @__PURE__ */ jsx(Legend, {})
2224
- ] })
2225
- }
2226
- );
2227
- }
2228
- PieChart.displayName = "PieChart";
2229
- var DEFAULT_COLORS4 = [
2230
- "var(--brand-pink)",
2231
- "var(--brand-yellow)",
2232
- "var(--status-info)",
2233
- "var(--status-success)",
2234
- "var(--status-warning)"
2235
- ];
2236
- function FunnelChart({
2237
- stages,
2238
- title,
2239
- subtitle,
2240
- showConversionRates = true,
2241
- showDropOff = true,
2242
- showValues = true,
2243
- height = 300,
2244
- className
2245
- }) {
2246
- const { features } = useReportMode();
2247
- const isValid = stages.length >= 3;
2248
- const maxValue = stages.length > 0 ? Math.max(...stages.map((s) => s.value)) : 0;
2249
- const stagesWithMetrics = useMemo(() => {
2250
- return stages.map((stage, index) => {
2251
- const prevStage = index > 0 ? stages[index - 1] : null;
2252
- const conversionRate = prevStage ? stage.value / prevStage.value * 100 : 100;
2253
- const dropOff = prevStage ? (prevStage.value - stage.value) / prevStage.value * 100 : 0;
2254
- const widthPercent = maxValue > 0 ? stage.value / maxValue * 100 : 0;
2255
- return {
2256
- ...stage,
2257
- conversionRate,
2258
- dropOff,
2259
- widthPercent,
2260
- color: stage.color || DEFAULT_COLORS4[index % DEFAULT_COLORS4.length]
2261
- };
2262
- });
2263
- }, [stages, maxValue]);
2264
- if (!isValid) {
2265
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-funnel-chart", "ds-funnel-chart--invalid", className), children: [
2266
- title && /* @__PURE__ */ jsx("h4", { className: "ds-funnel-chart__title", children: title }),
2267
- /* @__PURE__ */ jsx("div", { className: "ds-funnel-chart__empty", children: /* @__PURE__ */ jsx(
2268
- DataStateIndicator,
2269
- {
2270
- state: "INSUFFICIENT_SAMPLE",
2271
- variant: "full",
2272
- details: {
2273
- message: "Funnel requires at least 3 stages",
2274
- sampleSize: stages.length,
2275
- requiredSize: 3
2276
- }
2277
- }
2278
- ) })
2279
- ] });
2280
- }
2281
- const totalConversion = stages.length > 1 ? (stages[stages.length - 1].value / stages[0].value * 100).toFixed(1) : "100";
2282
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-funnel-chart", className), style: { minHeight: height }, children: [
2283
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-funnel-chart__header", children: [
2284
- /* @__PURE__ */ jsxs("div", { children: [
2285
- title && /* @__PURE__ */ jsx("h4", { className: "ds-funnel-chart__title", children: title }),
2286
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-funnel-chart__subtitle", children: subtitle })
2287
- ] }),
2288
- features.showMethodology && /* @__PURE__ */ jsx(DataCoverageBadge, { sampleSize: stages[0].value, size: "sm" })
2289
- ] }),
2290
- /* @__PURE__ */ jsx("div", { className: "ds-funnel-chart__stages", children: stagesWithMetrics.map((stage, index) => /* @__PURE__ */ jsxs("div", { className: "ds-funnel-chart__stage", children: [
2291
- /* @__PURE__ */ jsx("div", { className: "ds-funnel-chart__bar-container", children: /* @__PURE__ */ jsx(
2292
- "div",
2293
- {
2294
- className: "ds-funnel-chart__bar",
2295
- style: {
2296
- width: `${stage.widthPercent}%`,
2297
- backgroundColor: stage.color
2298
- },
2299
- children: showValues && /* @__PURE__ */ jsx("span", { className: "ds-funnel-chart__value", children: stage.value.toLocaleString() })
2300
- }
2301
- ) }),
2302
- /* @__PURE__ */ jsxs("div", { className: "ds-funnel-chart__label", children: [
2303
- /* @__PURE__ */ jsx("span", { className: "ds-funnel-chart__stage-name", children: stage.name }),
2304
- showConversionRates && index > 0 && /* @__PURE__ */ jsxs("span", { className: "ds-funnel-chart__conversion", children: [
2305
- stage.conversionRate.toFixed(1),
2306
- "% converted"
2307
- ] })
2308
- ] }),
2309
- showDropOff && index > 0 && stage.dropOff > 0 && /* @__PURE__ */ jsxs("div", { className: "ds-funnel-chart__dropoff", children: [
2310
- /* @__PURE__ */ jsx("span", { className: "ds-funnel-chart__dropoff-arrow", children: "\u2193" }),
2311
- /* @__PURE__ */ jsxs("span", { className: "ds-funnel-chart__dropoff-value", children: [
2312
- "-",
2313
- stage.dropOff.toFixed(1),
2314
- "%"
2315
- ] })
2316
- ] })
2317
- ] }, stage.name)) }),
2318
- /* @__PURE__ */ jsx("footer", { className: "ds-funnel-chart__footer", children: /* @__PURE__ */ jsxs("span", { className: "ds-funnel-chart__total", children: [
2319
- "Overall Conversion: ",
2320
- /* @__PURE__ */ jsxs("strong", { children: [
2321
- totalConversion,
2322
- "%"
2323
- ] })
2324
- ] }) })
2325
- ] });
2326
- }
2327
- FunnelChart.displayName = "FunnelChart";
2328
- Tooltip.Provider;
2329
- Tooltip.Root;
2330
- Tooltip.Trigger;
2331
- var TooltipContent = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx(Tooltip.Portal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, { sideOffset: 5, children: /* @__PURE__ */ jsxs(Tooltip.Popup, { ref, className: clsx20("ds-tooltip__content", className), ...props, children: [
2332
- children,
2333
- /* @__PURE__ */ jsx(Tooltip.Arrow, { className: "ds-tooltip__arrow" })
2334
- ] }) }) }));
2335
- TooltipContent.displayName = "TooltipContent";
2336
- var Tooltip4 = ({ content, children, delay = 200 }) => {
2337
- return /* @__PURE__ */ jsx(Tooltip.Provider, { delay, children: /* @__PURE__ */ jsxs(Tooltip.Root, { children: [
2338
- /* @__PURE__ */ jsx(Tooltip.Trigger, { render: children }),
2339
- /* @__PURE__ */ jsx(TooltipContent, { children: content })
2340
- ] }) });
2341
- };
2342
- function HeatmapChart({
2343
- data,
2344
- title,
2345
- subtitle,
2346
- xLabel,
2347
- yLabel,
2348
- colorScale = ["var(--glass-elevated)", "var(--brand-pink)"],
2349
- showValues = true,
2350
- valueFormatter = (v) => v.toFixed(0),
2351
- minCells = 25,
2352
- className
2353
- }) {
2354
- const { features } = useReportMode();
2355
- const { xValues, yValues, cellMap, minValue, maxValue } = useMemo(() => {
2356
- const xSet = /* @__PURE__ */ new Set();
2357
- const ySet = /* @__PURE__ */ new Set();
2358
- const map = /* @__PURE__ */ new Map();
2359
- let min = Infinity;
2360
- let max = -Infinity;
2361
- for (const cell of data) {
2362
- xSet.add(cell.x);
2363
- ySet.add(cell.y);
2364
- map.set(`${cell.x}-${cell.y}`, cell.value);
2365
- min = Math.min(min, cell.value);
2366
- max = Math.max(max, cell.value);
2367
- }
2368
- return {
2369
- xValues: Array.from(xSet),
2370
- yValues: Array.from(ySet),
2371
- cellMap: map,
2372
- minValue: min === Infinity ? 0 : min,
2373
- maxValue: max === -Infinity ? 0 : max
2374
- };
2375
- }, [data]);
2376
- const isValid = data.length >= minCells;
2377
- const getCellColor = (value) => {
2378
- if (maxValue === minValue) return colorScale[0];
2379
- const ratio = (value - minValue) / (maxValue - minValue);
2380
- return `color-mix(in srgb, ${colorScale[1]} ${ratio * 100}%, ${colorScale[0]})`;
2381
- };
2382
- const getTextColor = (value) => {
2383
- const ratio = (value - minValue) / (maxValue - minValue);
2384
- return ratio > 0.5 ? "white" : "var(--text-primary)";
2385
- };
2386
- if (!isValid) {
2387
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-heatmap-chart", "ds-heatmap-chart--invalid", className), children: [
2388
- title && /* @__PURE__ */ jsx("h4", { className: "ds-heatmap-chart__title", children: title }),
2389
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__empty", children: [
2390
- /* @__PURE__ */ jsx("p", { children: "Insufficient data for heatmap visualization" }),
2391
- /* @__PURE__ */ jsxs("p", { className: "ds-heatmap-chart__empty-detail", children: [
2392
- data.length,
2393
- " cells provided, ",
2394
- minCells,
2395
- " required"
2396
- ] })
2397
- ] })
2398
- ] });
2399
- }
2400
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-heatmap-chart", className), children: [
2401
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-heatmap-chart__header", children: [
2402
- /* @__PURE__ */ jsxs("div", { children: [
2403
- title && /* @__PURE__ */ jsx("h4", { className: "ds-heatmap-chart__title", children: title }),
2404
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-heatmap-chart__subtitle", children: subtitle })
2405
- ] }),
2406
- features.showMethodology && /* @__PURE__ */ jsx(DataCoverageBadge, { sampleSize: data.length, requiredSize: minCells, size: "sm" })
2407
- ] }),
2408
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__container", children: [
2409
- yLabel && /* @__PURE__ */ jsx("div", { className: "ds-heatmap-chart__y-label", children: /* @__PURE__ */ jsx("span", { children: yLabel }) }),
2410
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__grid-wrapper", children: [
2411
- /* @__PURE__ */ jsx(
2412
- "div",
2413
- {
2414
- className: "ds-heatmap-chart__grid",
2415
- style: {
2416
- gridTemplateColumns: `repeat(${xValues.length}, 1fr)`,
2417
- gridTemplateRows: `repeat(${yValues.length}, 1fr)`
2418
- },
2419
- children: yValues.map(
2420
- (y) => xValues.map((x) => {
2421
- const value = cellMap.get(`${x}-${y}`) ?? 0;
2422
- const cellContent = /* @__PURE__ */ jsx(
2423
- "div",
2424
- {
2425
- className: "ds-heatmap-chart__cell",
2426
- style: {
2427
- backgroundColor: getCellColor(value),
2428
- color: getTextColor(value)
2429
- },
2430
- children: showValues && /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__cell-value", children: valueFormatter(value) })
2431
- },
2432
- `${x}-${y}`
2433
- );
2434
- return /* @__PURE__ */ jsx(Tooltip4, { content: `${x}, ${y}: ${valueFormatter(value)}`, children: cellContent }, `${x}-${y}`);
2435
- })
2436
- )
2437
- }
2438
- ),
2439
- /* @__PURE__ */ jsx(
2440
- "div",
2441
- {
2442
- className: "ds-heatmap-chart__x-labels",
2443
- style: { gridTemplateColumns: `repeat(${xValues.length}, 1fr)` },
2444
- children: xValues.map((x) => /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__x-label", children: x }, x))
2445
- }
2446
- )
2447
- ] }),
2448
- /* @__PURE__ */ jsx(
2449
- "div",
2450
- {
2451
- className: "ds-heatmap-chart__y-labels",
2452
- style: { gridTemplateRows: `repeat(${yValues.length}, 1fr)` },
2453
- children: yValues.map((y) => /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__y-label-item", children: y }, y))
2454
- }
2455
- )
2456
- ] }),
2457
- xLabel && /* @__PURE__ */ jsx("div", { className: "ds-heatmap-chart__x-axis-label", children: /* @__PURE__ */ jsx("span", { children: xLabel }) }),
2458
- /* @__PURE__ */ jsxs("div", { className: "ds-heatmap-chart__legend", children: [
2459
- /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__legend-label", children: "Low" }),
2460
- /* @__PURE__ */ jsx(
2461
- "div",
2462
- {
2463
- className: "ds-heatmap-chart__legend-bar",
2464
- style: {
2465
- background: `linear-gradient(to right, ${colorScale[0]}, ${colorScale[1]})`
2466
- }
2467
- }
2468
- ),
2469
- /* @__PURE__ */ jsx("span", { className: "ds-heatmap-chart__legend-label", children: "High" })
2470
- ] })
2471
- ] });
2472
- }
2473
- HeatmapChart.displayName = "HeatmapChart";
2474
- function ChartSwitchControl({
2475
- currentType,
2476
- allowedTypes,
2477
- onTypeChange,
2478
- size = "sm",
2479
- className
2480
- }) {
2481
- if (allowedTypes.length <= 1) {
2482
- return null;
2483
- }
2484
- return /* @__PURE__ */ jsx("div", { className: clsx20("ds-chart-switch", `ds-chart-switch--${size}`, className), children: allowedTypes.map((type) => {
2485
- const meta = CHART_REGISTRY[type];
2486
- if (!meta) return null;
2487
- const isActive = type === currentType;
2488
- const Icon = getChartIcon(type);
2489
- return /* @__PURE__ */ jsxs(
2490
- "button",
2491
- {
2492
- type: "button",
2493
- className: clsx20(
2494
- "ds-chart-switch__option",
2495
- isActive && "ds-chart-switch__option--active"
2496
- ),
2497
- onClick: () => onTypeChange(type),
2498
- title: meta.name,
2499
- "aria-pressed": isActive,
2500
- children: [
2501
- /* @__PURE__ */ jsx(Icon, {}),
2502
- /* @__PURE__ */ jsx("span", { className: "ds-chart-switch__label", children: getShortLabel(type) })
2503
- ]
2504
- },
2505
- type
2506
- );
2507
- }) });
2508
- }
2509
- ChartSwitchControl.displayName = "ChartSwitchControl";
2510
- function getChartIcon(type) {
2511
- const icons = {
2512
- line: LineIcon,
2513
- smooth_line: SmoothLineIcon,
2514
- area: AreaIcon,
2515
- stacked_area: StackedAreaIcon,
2516
- area_100pct: StackedAreaIcon,
2517
- bar: BarIcon,
2518
- column: ColumnIcon,
2519
- stacked_bar: StackedBarIcon,
2520
- stacked_column: StackedColumnIcon,
2521
- column_100pct: StackedColumnIcon,
2522
- pie: PieIcon,
2523
- donut: DonutIcon,
2524
- histogram: HistogramIcon,
2525
- funnel: FunnelIcon,
2526
- heatmap: HeatmapIcon
2527
- };
2528
- return icons[type] || DefaultChartIcon;
2529
- }
2530
- function getShortLabel(type) {
2531
- const labels = {
2532
- line: "Line",
2533
- smooth_line: "Smooth",
2534
- area: "Area",
2535
- stacked_area: "Stacked",
2536
- area_100pct: "100%",
2537
- bar: "Bar",
2538
- column: "Column",
2539
- stacked_bar: "Stacked",
2540
- stacked_column: "Stacked",
2541
- column_100pct: "100%",
2542
- pie: "Pie",
2543
- donut: "Donut",
2544
- histogram: "Histogram",
2545
- funnel: "Funnel",
2546
- heatmap: "Heatmap"
2547
- };
2548
- return labels[type] || type;
2549
- }
2550
- function LineIcon() {
2551
- return /* @__PURE__ */ jsx(
2552
- "svg",
2553
- {
2554
- width: "16",
2555
- height: "16",
2556
- viewBox: "0 0 24 24",
2557
- fill: "none",
2558
- stroke: "currentColor",
2559
- strokeWidth: "2",
2560
- children: /* @__PURE__ */ jsx("polyline", { points: "22 12 18 8 13 13 9 9 2 16" })
2561
- }
2562
- );
2563
- }
2564
- function SmoothLineIcon() {
2565
- return /* @__PURE__ */ jsx(
2566
- "svg",
2567
- {
2568
- width: "16",
2569
- height: "16",
2570
- viewBox: "0 0 24 24",
2571
- fill: "none",
2572
- stroke: "currentColor",
2573
- strokeWidth: "2",
2574
- children: /* @__PURE__ */ jsx("path", { d: "M2 16 C6 16, 8 8, 12 12 S18 6, 22 10" })
2575
- }
2576
- );
2577
- }
2578
- function AreaIcon() {
2579
- return /* @__PURE__ */ jsxs(
2580
- "svg",
2581
- {
2582
- width: "16",
2583
- height: "16",
2584
- viewBox: "0 0 24 24",
2585
- fill: "none",
2586
- stroke: "currentColor",
2587
- strokeWidth: "2",
2588
- children: [
2589
- /* @__PURE__ */ jsx("path", { d: "M2 20 L2 16 L8 10 L14 14 L22 6 L22 20 Z", fill: "currentColor", fillOpacity: "0.2" }),
2590
- /* @__PURE__ */ jsx("polyline", { points: "2 16 8 10 14 14 22 6" })
2591
- ]
2592
- }
2593
- );
2594
- }
2595
- function StackedAreaIcon() {
2596
- return /* @__PURE__ */ jsxs(
2597
- "svg",
2598
- {
2599
- width: "16",
2600
- height: "16",
2601
- viewBox: "0 0 24 24",
2602
- fill: "none",
2603
- stroke: "currentColor",
2604
- strokeWidth: "2",
2605
- children: [
2606
- /* @__PURE__ */ jsx("path", { d: "M2 20 L2 14 L8 10 L14 12 L22 8 L22 20 Z", fill: "currentColor", fillOpacity: "0.3" }),
2607
- /* @__PURE__ */ jsx("path", { d: "M2 20 L2 16 L8 14 L14 15 L22 12 L22 20 Z", fill: "currentColor", fillOpacity: "0.2" })
2608
- ]
2609
- }
2610
- );
2611
- }
2612
- function BarIcon() {
2613
- return /* @__PURE__ */ jsxs(
2614
- "svg",
2615
- {
2616
- width: "16",
2617
- height: "16",
2618
- viewBox: "0 0 24 24",
2619
- fill: "none",
2620
- stroke: "currentColor",
2621
- strokeWidth: "2",
2622
- children: [
2623
- /* @__PURE__ */ jsx("rect", { x: "2", y: "4", width: "14", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
2624
- /* @__PURE__ */ jsx("rect", { x: "2", y: "10", width: "18", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
2625
- /* @__PURE__ */ jsx("rect", { x: "2", y: "16", width: "10", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.2" })
2626
- ]
2627
- }
2628
- );
2629
- }
2630
- function ColumnIcon() {
2631
- return /* @__PURE__ */ jsxs(
2632
- "svg",
2633
- {
2634
- width: "16",
2635
- height: "16",
2636
- viewBox: "0 0 24 24",
2637
- fill: "none",
2638
- stroke: "currentColor",
2639
- strokeWidth: "2",
2640
- children: [
2641
- /* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "4", height: "14", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
2642
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "4", height: "18", rx: "1", fill: "currentColor", fillOpacity: "0.2" }),
2643
- /* @__PURE__ */ jsx("rect", { x: "16", y: "12", width: "4", height: "10", rx: "1", fill: "currentColor", fillOpacity: "0.2" })
2644
- ]
2645
- }
2646
- );
2647
- }
2648
- function StackedBarIcon() {
2649
- return /* @__PURE__ */ jsxs(
2650
- "svg",
2651
- {
2652
- width: "16",
2653
- height: "16",
2654
- viewBox: "0 0 24 24",
2655
- fill: "none",
2656
- stroke: "currentColor",
2657
- strokeWidth: "2",
2658
- children: [
2659
- /* @__PURE__ */ jsx("rect", { x: "2", y: "4", width: "8", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
2660
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "6", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
2661
- /* @__PURE__ */ jsx("rect", { x: "2", y: "10", width: "12", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
2662
- /* @__PURE__ */ jsx("rect", { x: "14", y: "10", width: "6", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
2663
- /* @__PURE__ */ jsx("rect", { x: "2", y: "16", width: "6", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
2664
- /* @__PURE__ */ jsx("rect", { x: "8", y: "16", width: "4", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" })
2665
- ]
2666
- }
2667
- );
2668
- }
2669
- function StackedColumnIcon() {
2670
- return /* @__PURE__ */ jsxs(
2671
- "svg",
2672
- {
2673
- width: "16",
2674
- height: "16",
2675
- viewBox: "0 0 24 24",
2676
- fill: "none",
2677
- stroke: "currentColor",
2678
- strokeWidth: "2",
2679
- children: [
2680
- /* @__PURE__ */ jsx("rect", { x: "4", y: "14", width: "4", height: "8", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
2681
- /* @__PURE__ */ jsx("rect", { x: "4", y: "8", width: "4", height: "6", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
2682
- /* @__PURE__ */ jsx("rect", { x: "10", y: "10", width: "4", height: "12", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
2683
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "4", height: "6", rx: "1", fill: "currentColor", fillOpacity: "0.15" }),
2684
- /* @__PURE__ */ jsx("rect", { x: "16", y: "16", width: "4", height: "6", rx: "1", fill: "currentColor", fillOpacity: "0.3" }),
2685
- /* @__PURE__ */ jsx("rect", { x: "16", y: "12", width: "4", height: "4", rx: "1", fill: "currentColor", fillOpacity: "0.15" })
2686
- ]
2687
- }
2688
- );
2689
- }
2690
- function PieIcon() {
2691
- return /* @__PURE__ */ jsxs(
2692
- "svg",
2693
- {
2694
- width: "16",
2695
- height: "16",
2696
- viewBox: "0 0 24 24",
2697
- fill: "none",
2698
- stroke: "currentColor",
2699
- strokeWidth: "2",
2700
- children: [
2701
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor", fillOpacity: "0.2" }),
2702
- /* @__PURE__ */ jsx("path", { d: "M12 2 A10 10 0 0 1 22 12 L12 12 Z", fill: "currentColor", fillOpacity: "0.3" })
2703
- ]
2704
- }
2705
- );
2706
- }
2707
- function DonutIcon() {
2708
- return /* @__PURE__ */ jsxs(
2709
- "svg",
2710
- {
2711
- width: "16",
2712
- height: "16",
2713
- viewBox: "0 0 24 24",
2714
- fill: "none",
2715
- stroke: "currentColor",
2716
- strokeWidth: "2",
2717
- children: [
2718
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", fill: "currentColor", fillOpacity: "0.2" }),
2719
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "5", fill: "var(--glass-elevated)", stroke: "none" }),
2720
- /* @__PURE__ */ jsx(
2721
- "path",
2722
- {
2723
- d: "M12 2 A10 10 0 0 1 22 12 L17 12 A5 5 0 0 0 12 7 Z",
2724
- fill: "currentColor",
2725
- fillOpacity: "0.3"
2726
- }
2727
- )
2728
- ]
2729
- }
2730
- );
2731
- }
2732
- function HistogramIcon() {
2733
- return /* @__PURE__ */ jsxs(
2734
- "svg",
2735
- {
2736
- width: "16",
2737
- height: "16",
2738
- viewBox: "0 0 24 24",
2739
- fill: "none",
2740
- stroke: "currentColor",
2741
- strokeWidth: "2",
2742
- children: [
2743
- /* @__PURE__ */ jsx("rect", { x: "2", y: "14", width: "4", height: "8", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
2744
- /* @__PURE__ */ jsx("rect", { x: "6", y: "10", width: "4", height: "12", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
2745
- /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "4", height: "18", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
2746
- /* @__PURE__ */ jsx("rect", { x: "14", y: "8", width: "4", height: "14", rx: "0", fill: "currentColor", fillOpacity: "0.2" }),
2747
- /* @__PURE__ */ jsx("rect", { x: "18", y: "12", width: "4", height: "10", rx: "0", fill: "currentColor", fillOpacity: "0.2" })
2748
- ]
2749
- }
2750
- );
2751
- }
2752
- function FunnelIcon() {
2753
- return /* @__PURE__ */ jsxs(
2754
- "svg",
2755
- {
2756
- width: "16",
2757
- height: "16",
2758
- viewBox: "0 0 24 24",
2759
- fill: "none",
2760
- stroke: "currentColor",
2761
- strokeWidth: "2",
2762
- children: [
2763
- /* @__PURE__ */ jsx("path", { d: "M2 4 H22 L18 10 H6 Z", fill: "currentColor", fillOpacity: "0.3" }),
2764
- /* @__PURE__ */ jsx("path", { d: "M6 10 H18 L15 16 H9 Z", fill: "currentColor", fillOpacity: "0.25" }),
2765
- /* @__PURE__ */ jsx("path", { d: "M9 16 H15 L13 22 H11 Z", fill: "currentColor", fillOpacity: "0.2" })
2766
- ]
2767
- }
2768
- );
2769
- }
2770
- function HeatmapIcon() {
2771
- return /* @__PURE__ */ jsxs(
2772
- "svg",
2773
- {
2774
- width: "16",
2775
- height: "16",
2776
- viewBox: "0 0 24 24",
2777
- fill: "none",
2778
- stroke: "currentColor",
2779
- strokeWidth: "1",
2780
- children: [
2781
- /* @__PURE__ */ jsx("rect", { x: "2", y: "2", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.1" }),
2782
- /* @__PURE__ */ jsx("rect", { x: "9", y: "2", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.3" }),
2783
- /* @__PURE__ */ jsx("rect", { x: "16", y: "2", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.2" }),
2784
- /* @__PURE__ */ jsx("rect", { x: "2", y: "9", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.4" }),
2785
- /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.6" }),
2786
- /* @__PURE__ */ jsx("rect", { x: "16", y: "9", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.3" }),
2787
- /* @__PURE__ */ jsx("rect", { x: "2", y: "16", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.2" }),
2788
- /* @__PURE__ */ jsx("rect", { x: "9", y: "16", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.5" }),
2789
- /* @__PURE__ */ jsx("rect", { x: "16", y: "16", width: "6", height: "6", fill: "currentColor", fillOpacity: "0.4" })
2790
- ]
2791
- }
2792
- );
2793
- }
2794
- function DefaultChartIcon() {
2795
- return /* @__PURE__ */ jsxs(
2796
- "svg",
2797
- {
2798
- width: "16",
2799
- height: "16",
2800
- viewBox: "0 0 24 24",
2801
- fill: "none",
2802
- stroke: "currentColor",
2803
- strokeWidth: "2",
2804
- children: [
2805
- /* @__PURE__ */ jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
2806
- /* @__PURE__ */ jsx("path", { d: "M3 15 L9 9 L13 13 L21 5" })
2807
- ]
2808
- }
2809
- );
2810
- }
2811
- var CHART_COLORS = [
2812
- "var(--brand-pink)",
2813
- "var(--brand-yellow)",
2814
- "var(--status-info)",
2815
- "var(--status-success)",
2816
- "var(--status-warning)",
2817
- "var(--status-error)"
2818
- ];
2819
- function getColor(index, customColor) {
2820
- return customColor || CHART_COLORS[index % CHART_COLORS.length];
2821
- }
2822
- function Chart({
2823
- intent,
2824
- data,
2825
- dimensions,
2826
- measures,
2827
- defaultType,
2828
- allowedTypes,
2829
- chartType: controlledType,
2830
- onChartTypeChange,
2831
- allowSwitching = false,
2832
- title,
2833
- subtitle,
2834
- height = 300,
2835
- legend: showLegend = true,
2836
- grid = true,
2837
- className
2838
- }) {
2839
- const { features } = useReportMode();
2840
- const resolvedDefault = defaultType || getDefaultChartForIntent(intent);
2841
- const [internalType, setInternalType] = useState(resolvedDefault);
2842
- const activeType = controlledType ?? internalType;
2843
- const resolvedAllowedTypes = useMemo(() => {
2844
- if (allowedTypes) return allowedTypes;
2845
- return getAllowedSwitchTargets(activeType);
2846
- }, [allowedTypes, activeType]);
2847
- const validation = useMemo(() => {
2848
- return validateChartData(
2849
- activeType,
2850
- data,
2851
- dimensions.map((d) => d.key),
2852
- measures.map((m) => m.key)
2853
- );
2854
- }, [activeType, data, dimensions, measures]);
2855
- const handleTypeChange = (newType) => {
2856
- if (onChartTypeChange) {
2857
- onChartTypeChange(newType);
2858
- } else {
2859
- setInternalType(newType);
2860
- }
2861
- };
2862
- const chartMeta = CHART_REGISTRY[activeType];
2863
- const renderChart = () => {
2864
- if (!validation.isValid) {
2865
- return /* @__PURE__ */ jsx("div", { className: "ds-chart__invalid", children: /* @__PURE__ */ jsx(
2866
- DataStateIndicator,
2867
- {
2868
- state: "INSUFFICIENT_SAMPLE",
2869
- variant: "full",
2870
- details: {
2871
- message: validation.errors[0],
2872
- sampleSize: data.length,
2873
- requiredSize: chartMeta?.contract.minDataPoints || 0
2874
- }
2875
- }
2876
- ) });
2877
- }
2878
- const xKey = dimensions[0]?.key || "x";
2879
- switch (activeType) {
2880
- case "line":
2881
- case "smooth_line":
2882
- return renderLineChart(xKey, activeType === "smooth_line");
2883
- case "area":
2884
- case "stacked_area":
2885
- case "area_100pct":
2886
- return renderAreaChart(xKey, activeType);
2887
- case "bar":
2888
- case "stacked_bar":
2889
- return renderBarChart(xKey, activeType, "horizontal");
2890
- case "column":
2891
- case "stacked_column":
2892
- case "column_100pct":
2893
- return renderBarChart(xKey, activeType, "vertical");
2894
- case "pie":
2895
- case "donut":
2896
- return renderPieChart(xKey, activeType === "donut");
2897
- case "histogram":
2898
- return renderHistogram();
2899
- default:
2900
- return /* @__PURE__ */ jsxs("div", { className: "ds-chart__unsupported", children: [
2901
- 'Chart type "',
2902
- activeType,
2903
- '" is not yet implemented'
2904
- ] });
2905
- }
2906
- };
2907
- 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: [
2908
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
2909
- /* @__PURE__ */ jsx(
2910
- XAxis,
2911
- {
2912
- dataKey: xKey,
2913
- tick: { fontSize: 12 },
2914
- tickLine: false,
2915
- axisLine: { strokeWidth: 1 }
2916
- }
2917
- ),
2918
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 }),
2919
- /* @__PURE__ */ jsx(
2920
- Tooltip$1,
2921
- {
2922
- contentStyle: {
2923
- background: "var(--glass-elevated)",
2924
- border: "1px solid var(--glass-border)"
2925
- }
2926
- }
2927
- ),
2928
- showLegend && measures.length > 1 && /* @__PURE__ */ jsx(Legend, {}),
2929
- measures.map((measure, idx) => /* @__PURE__ */ jsx(
2930
- Line,
2931
- {
2932
- type: smooth ? "monotone" : "linear",
2933
- dataKey: measure.key,
2934
- name: measure.label || measure.key,
2935
- stroke: getColor(idx, measure.color),
2936
- strokeWidth: 2,
2937
- dot: true,
2938
- activeDot: { r: 6 }
2939
- },
2940
- measure.key
2941
- ))
2942
- ] }) });
2943
- const renderAreaChart = (xKey, type) => {
2944
- const isStacked = type === "stacked_area" || type === "area_100pct";
2945
- const is100Pct = type === "area_100pct";
2946
- const chartData = is100Pct ? normalizeData(data, measures) : data;
2947
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(AreaChart, { data: chartData, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
2948
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
2949
- /* @__PURE__ */ jsx(
2950
- XAxis,
2951
- {
2952
- dataKey: xKey,
2953
- tick: { fontSize: 12 },
2954
- tickLine: false,
2955
- axisLine: { strokeWidth: 1 }
2956
- }
2957
- ),
2958
- /* @__PURE__ */ jsx(
2959
- YAxis,
2960
- {
2961
- tick: { fontSize: 12 },
2962
- tickLine: false,
2963
- axisLine: false,
2964
- width: 40,
2965
- domain: is100Pct ? [0, 100] : void 0,
2966
- tickFormatter: is100Pct ? (v) => `${v}%` : void 0
2967
- }
2968
- ),
2969
- /* @__PURE__ */ jsx(
2970
- Tooltip$1,
2971
- {
2972
- contentStyle: {
2973
- background: "var(--glass-elevated)",
2974
- border: "1px solid var(--glass-border)"
2975
- }
2976
- }
2977
- ),
2978
- showLegend && /* @__PURE__ */ jsx(Legend, {}),
2979
- measures.map((measure, idx) => /* @__PURE__ */ jsx(
2980
- Area,
2981
- {
2982
- type: "monotone",
2983
- dataKey: measure.key,
2984
- name: measure.label || measure.key,
2985
- stroke: getColor(idx, measure.color),
2986
- fill: getColor(idx, measure.color),
2987
- fillOpacity: 0.3,
2988
- stackId: isStacked ? "stack" : void 0
2989
- },
2990
- measure.key
2991
- ))
2992
- ] }) });
2993
- };
2994
- const renderBarChart = (xKey, type, layout) => {
2995
- const isStacked = type.includes("stacked") || type.includes("100pct");
2996
- const is100Pct = type.includes("100pct");
2997
- const isHorizontal = layout === "horizontal";
2998
- const chartData = is100Pct ? normalizeData(data, measures) : data;
2999
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
3000
- BarChart$1,
3001
- {
3002
- data: chartData,
3003
- layout: isHorizontal ? "vertical" : "horizontal",
3004
- margin: { top: 5, right: 20, left: isHorizontal ? 80 : 0, bottom: 5 },
3005
- children: [
3006
- grid && /* @__PURE__ */ jsx(
3007
- CartesianGrid,
3008
- {
3009
- strokeDasharray: "3 3",
3010
- horizontal: !isHorizontal,
3011
- vertical: isHorizontal
3012
- }
3013
- ),
3014
- isHorizontal ? /* @__PURE__ */ jsxs(Fragment, { children: [
3015
- /* @__PURE__ */ jsx(
3016
- XAxis,
3017
- {
3018
- type: "number",
3019
- tick: { fontSize: 12 },
3020
- tickLine: false,
3021
- axisLine: false,
3022
- domain: is100Pct ? [0, 100] : void 0,
3023
- tickFormatter: is100Pct ? (v) => `${v}%` : void 0
3024
- }
3025
- ),
3026
- /* @__PURE__ */ jsx(
3027
- YAxis,
3028
- {
3029
- type: "category",
3030
- dataKey: xKey,
3031
- tick: { fontSize: 12 },
3032
- tickLine: false,
3033
- axisLine: false,
3034
- width: 80
3035
- }
3036
- )
3037
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3038
- /* @__PURE__ */ jsx(
3039
- XAxis,
3040
- {
3041
- dataKey: xKey,
3042
- tick: { fontSize: 12 },
3043
- tickLine: false,
3044
- axisLine: { strokeWidth: 1 }
3045
- }
3046
- ),
3047
- /* @__PURE__ */ jsx(
3048
- YAxis,
3049
- {
3050
- tick: { fontSize: 12 },
3051
- tickLine: false,
3052
- axisLine: false,
3053
- width: 40,
3054
- domain: is100Pct ? [0, 100] : void 0,
3055
- tickFormatter: is100Pct ? (v) => `${v}%` : void 0
3056
- }
3057
- )
3058
- ] }),
3059
- /* @__PURE__ */ jsx(
3060
- Tooltip$1,
3061
- {
3062
- contentStyle: {
3063
- background: "var(--glass-elevated)",
3064
- border: "1px solid var(--glass-border)"
3065
- }
3066
- }
3067
- ),
3068
- showLegend && measures.length > 1 && /* @__PURE__ */ jsx(Legend, {}),
3069
- measures.map((measure, idx) => /* @__PURE__ */ jsx(
3070
- Bar,
3071
- {
3072
- dataKey: measure.key,
3073
- name: measure.label || measure.key,
3074
- fill: getColor(idx, measure.color),
3075
- stackId: isStacked ? "stack" : void 0,
3076
- radius: isStacked ? void 0 : [4, 4, 0, 0]
3077
- },
3078
- measure.key
3079
- ))
3080
- ]
3081
- }
3082
- ) });
3083
- };
3084
- const renderPieChart = (nameKey, isDonut) => {
3085
- const valueKey = measures[0]?.key || "value";
3086
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(PieChart$1, { children: [
3087
- /* @__PURE__ */ jsx(
3088
- Pie,
3089
- {
3090
- data,
3091
- dataKey: valueKey,
3092
- nameKey,
3093
- cx: "50%",
3094
- cy: "50%",
3095
- innerRadius: isDonut ? "50%" : 0,
3096
- outerRadius: "80%",
3097
- label: ({ name, percent }) => `${name}: ${((percent ?? 0) * 100).toFixed(0)}%`,
3098
- labelLine: false,
3099
- children: data.map((_, idx) => /* @__PURE__ */ jsx(Cell, { fill: getColor(idx) }, `cell-${idx}`))
3100
- }
3101
- ),
3102
- /* @__PURE__ */ jsx(
3103
- Tooltip$1,
3104
- {
3105
- contentStyle: {
3106
- background: "var(--glass-elevated)",
3107
- border: "1px solid var(--glass-border)"
3108
- }
3109
- }
3110
- ),
3111
- showLegend && /* @__PURE__ */ jsx(Legend, {})
3112
- ] }) });
3113
- };
3114
- const renderHistogram = () => {
3115
- const valueKey = measures[0]?.key || "value";
3116
- const binKey = dimensions[0]?.key || "bin";
3117
- return /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(BarChart$1, { data, margin: { top: 5, right: 20, left: 0, bottom: 5 }, children: [
3118
- grid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", vertical: false }),
3119
- /* @__PURE__ */ jsx(
3120
- XAxis,
3121
- {
3122
- dataKey: binKey,
3123
- tick: { fontSize: 12 },
3124
- tickLine: false,
3125
- axisLine: { strokeWidth: 1 }
3126
- }
3127
- ),
3128
- /* @__PURE__ */ jsx(YAxis, { tick: { fontSize: 12 }, tickLine: false, axisLine: false, width: 40 }),
3129
- /* @__PURE__ */ jsx(
3130
- Tooltip$1,
3131
- {
3132
- contentStyle: {
3133
- background: "var(--glass-elevated)",
3134
- border: "1px solid var(--glass-border)"
3135
- }
3136
- }
3137
- ),
3138
- /* @__PURE__ */ jsx(Bar, { dataKey: valueKey, fill: getColor(0), radius: [4, 4, 0, 0] })
3139
- ] }) });
3140
- };
3141
- const normalizeData = (sourceData, sourceMeasures) => {
3142
- return sourceData.map((row) => {
3143
- const total = sourceMeasures.reduce((sum, m) => {
3144
- const val = row[m.key];
3145
- return sum + (typeof val === "number" ? val : 0);
3146
- }, 0);
3147
- if (total === 0) return row;
3148
- const normalized = { ...row };
3149
- sourceMeasures.forEach((m) => {
3150
- const val = row[m.key];
3151
- if (typeof val === "number") {
3152
- normalized[m.key] = val / total * 100;
3153
- }
3154
- });
3155
- return normalized;
3156
- });
3157
- };
3158
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-chart", className), children: [
3159
- (title || subtitle || allowSwitching) && /* @__PURE__ */ jsxs("header", { className: "ds-chart__header", children: [
3160
- /* @__PURE__ */ jsxs("div", { className: "ds-chart__header-text", children: [
3161
- title && /* @__PURE__ */ jsx("h4", { className: "ds-chart__title", children: title }),
3162
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-chart__subtitle", children: subtitle })
3163
- ] }),
3164
- /* @__PURE__ */ jsxs("div", { className: "ds-chart__header-actions", children: [
3165
- features.showMethodology && data.length > 0 && /* @__PURE__ */ jsx(
3166
- DataCoverageBadge,
3167
- {
3168
- sampleSize: data.length,
3169
- requiredSize: chartMeta?.contract.minDataPoints || 0,
3170
- size: "sm"
3171
- }
3172
- ),
3173
- allowSwitching && resolvedAllowedTypes.length > 0 && /* @__PURE__ */ jsx(
3174
- ChartSwitchControl,
3175
- {
3176
- currentType: activeType,
3177
- allowedTypes: [activeType, ...resolvedAllowedTypes],
3178
- onTypeChange: handleTypeChange
3179
- }
3180
- )
3181
- ] })
3182
- ] }),
3183
- 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)) }),
3184
- /* @__PURE__ */ jsx("div", { className: "ds-chart__body", style: { height }, children: renderChart() })
3185
- ] });
3186
- }
3187
- Chart.displayName = "Chart";
3188
- var DIMENSION_LABELS = {
3189
- EI: { left: "Extraversion", right: "Introversion", full: "E/I" },
3190
- SN: { left: "Sensing", right: "Intuition", full: "S/N" },
3191
- TF: { left: "Thinking", right: "Feeling", full: "T/F" },
3192
- JP: { left: "Judging", right: "Perceiving", full: "J/P" }
3193
- };
3194
- function MBTIRadar({
3195
- dimensions,
3196
- sampleSize,
3197
- comparison,
3198
- title,
3199
- subtitle,
3200
- size = 300,
3201
- showLabels = true,
3202
- showValues = true,
3203
- minSampleSize = 20,
3204
- confidence,
3205
- className
3206
- }) {
3207
- const { features } = useReportMode();
3208
- const isValid = sampleSize >= minSampleSize;
3209
- const radarData = useMemo(() => {
3210
- return Object.keys(dimensions).map((key) => ({
3211
- dimension: DIMENSION_LABELS[key].full,
3212
- fullName: `${DIMENSION_LABELS[key].left} vs ${DIMENSION_LABELS[key].right}`,
3213
- value: dimensions[key],
3214
- comparison: comparison?.[key],
3215
- leftLabel: DIMENSION_LABELS[key].left,
3216
- rightLabel: DIMENSION_LABELS[key].right
3217
- }));
3218
- }, [dimensions, comparison]);
3219
- const derivedType = useMemo(() => {
3220
- const e = dimensions.EI < 50 ? "E" : "I";
3221
- const s = dimensions.SN < 50 ? "S" : "N";
3222
- const t = dimensions.TF < 50 ? "T" : "F";
3223
- const j = dimensions.JP < 50 ? "J" : "P";
3224
- return `${e}${s}${t}${j}`;
3225
- }, [dimensions]);
3226
- if (!isValid) {
3227
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-mbti-radar", "ds-mbti-radar--invalid", className), children: [
3228
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-radar__title", children: title }),
3229
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__empty", children: /* @__PURE__ */ jsx(
3230
- DataStateIndicator,
3231
- {
3232
- state: "INSUFFICIENT_SAMPLE",
3233
- variant: "full",
3234
- details: {
3235
- message: "MBTI analysis requires sufficient sample size",
3236
- sampleSize,
3237
- requiredSize: minSampleSize
3238
- }
3239
- }
3240
- ) })
3241
- ] });
3242
- }
3243
- const CustomTooltip = ({
3244
- active,
3245
- payload
3246
- }) => {
3247
- if (!active || !payload?.length) return null;
3248
- const data = payload[0].payload;
3249
- return /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__tooltip", children: [
3250
- /* @__PURE__ */ jsx("p", { className: "ds-mbti-radar__tooltip-title", children: data.fullName }),
3251
- /* @__PURE__ */ jsxs("p", { className: "ds-mbti-radar__tooltip-value", children: [
3252
- data.leftLabel,
3253
- ": ",
3254
- 100 - data.value,
3255
- "%"
3256
- ] }),
3257
- /* @__PURE__ */ jsxs("p", { className: "ds-mbti-radar__tooltip-value", children: [
3258
- data.rightLabel,
3259
- ": ",
3260
- data.value,
3261
- "%"
3262
- ] }),
3263
- data.comparison !== void 0 && /* @__PURE__ */ jsxs("p", { className: "ds-mbti-radar__tooltip-comparison", children: [
3264
- "Benchmark: ",
3265
- data.comparison,
3266
- "%"
3267
- ] })
3268
- ] });
3269
- };
3270
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-mbti-radar", className), children: [
3271
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-mbti-radar__header", children: [
3272
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__header-text", children: [
3273
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-radar__title", children: title }),
3274
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-mbti-radar__subtitle", children: subtitle })
3275
- ] }),
3276
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__header-badges", children: [
3277
- features.showConfidenceScores && confidence !== void 0 && /* @__PURE__ */ jsx(ConfidenceIndicator, { score: confidence, size: "sm" }),
3278
- features.showMethodology && /* @__PURE__ */ jsx(DataCoverageBadge, { sampleSize, requiredSize: minSampleSize, size: "sm" })
3279
- ] })
3280
- ] }),
3281
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__type-badge", children: [
3282
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__type-label", children: "Derived Type" }),
3283
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__type-value", children: derivedType })
3284
- ] }),
3285
- /* @__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: [
3286
- /* @__PURE__ */ jsx(PolarGrid, { stroke: "var(--glass-border)" }),
3287
- /* @__PURE__ */ jsx(
3288
- PolarAngleAxis,
3289
- {
3290
- dataKey: "dimension",
3291
- tick: { fill: "var(--text-secondary)", fontSize: 12 }
3292
- }
3293
- ),
3294
- /* @__PURE__ */ jsx(
3295
- PolarRadiusAxis,
3296
- {
3297
- angle: 45,
3298
- domain: [0, 100],
3299
- tick: { fill: "var(--text-tertiary)", fontSize: 10 },
3300
- tickCount: 5
3301
- }
3302
- ),
3303
- /* @__PURE__ */ jsx(
3304
- Radar,
3305
- {
3306
- name: "Profile",
3307
- dataKey: "value",
3308
- stroke: "var(--brand-pink)",
3309
- fill: "var(--brand-pink)",
3310
- fillOpacity: 0.3,
3311
- strokeWidth: 2
3312
- }
3313
- ),
3314
- comparison && /* @__PURE__ */ jsx(
3315
- Radar,
3316
- {
3317
- name: "Benchmark",
3318
- dataKey: "comparison",
3319
- stroke: "var(--brand-yellow)",
3320
- fill: "var(--brand-yellow)",
3321
- fillOpacity: 0.1,
3322
- strokeWidth: 2,
3323
- strokeDasharray: "5 5"
3324
- }
3325
- ),
3326
- showValues && /* @__PURE__ */ jsx(Tooltip$1, { content: /* @__PURE__ */ jsx(CustomTooltip, {}) }),
3327
- comparison && /* @__PURE__ */ jsx(Legend, {})
3328
- ] }) }),
3329
- showLabels && /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__dimensions", children: radarData.map((d) => /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__dimension", children: [
3330
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__dimension-left", children: d.leftLabel }),
3331
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-radar__dimension-bar", children: [
3332
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__dimension-fill", style: { width: `${d.value}%` } }),
3333
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-radar__dimension-marker", style: { left: `${d.value}%` } })
3334
- ] }),
3335
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-radar__dimension-right", children: d.rightLabel })
3336
- ] }, d.dimension)) })
3337
- ] });
3338
- }
3339
- MBTIRadar.displayName = "MBTIRadar";
3340
- var MBTI_GRID = [
3341
- ["ISTJ", "ISFJ", "INFJ", "INTJ"],
3342
- ["ISTP", "ISFP", "INFP", "INTP"],
3343
- ["ESTP", "ESFP", "ENFP", "ENTP"],
3344
- ["ESTJ", "ESFJ", "ENFJ", "ENTJ"]
3345
- ];
3346
- var TYPE_DESCRIPTIONS = {
3347
- ISTJ: "The Inspector - Practical, reliable, systematic",
3348
- ISFJ: "The Protector - Caring, supportive, traditional",
3349
- INFJ: "The Advocate - Insightful, principled, compassionate",
3350
- INTJ: "The Architect - Strategic, independent, determined",
3351
- ISTP: "The Virtuoso - Observant, practical, analytical",
3352
- ISFP: "The Adventurer - Artistic, sensitive, exploratory",
3353
- INFP: "The Mediator - Idealistic, empathetic, creative",
3354
- INTP: "The Logician - Inventive, logical, objective",
3355
- ESTP: "The Entrepreneur - Energetic, pragmatic, observant",
3356
- ESFP: "The Entertainer - Spontaneous, energetic, friendly",
3357
- ENFP: "The Campaigner - Enthusiastic, creative, sociable",
3358
- ENTP: "The Debater - Clever, curious, innovative",
3359
- ESTJ: "The Executive - Organized, logical, assertive",
3360
- ESFJ: "The Consul - Caring, sociable, traditional",
3361
- ENFJ: "The Protagonist - Charismatic, empathetic, organized",
3362
- ENTJ: "The Commander - Strategic, efficient, energetic"
3363
- };
3364
- var COLUMN_LABELS = ["ST", "SF", "NF", "NT"];
3365
- var ROW_LABELS = ["I-J", "I-P", "E-P", "E-J"];
3366
- function MBTITypeGrid({
3367
- data,
3368
- sampleSize: propSampleSize,
3369
- title,
3370
- subtitle,
3371
- showPercentages = true,
3372
- showCounts = true,
3373
- highlightThreshold,
3374
- minSampleSize = 50,
3375
- confidence,
3376
- onTypeClick,
3377
- selectedType,
3378
- className
3379
- }) {
3380
- const { features } = useReportMode();
3381
- const typeMap = useMemo(() => {
3382
- const map = /* @__PURE__ */ new Map();
3383
- for (const item of data) {
3384
- map.set(item.type, item);
3385
- }
3386
- return map;
3387
- }, [data]);
3388
- const totalSampleSize = propSampleSize ?? data.reduce((sum, d) => sum + d.count, 0);
3389
- const isValid = totalSampleSize >= minSampleSize;
3390
- const maxCount = useMemo(() => Math.max(...data.map((d) => d.count), 1), [data]);
3391
- const getPercentage = (count) => {
3392
- return totalSampleSize > 0 ? (count / totalSampleSize * 100).toFixed(1) : "0.0";
3393
- };
3394
- const getIntensity = (count) => {
3395
- if (maxCount === 0) return 0;
3396
- return count / maxCount * 100;
3397
- };
3398
- const isHighlighted = (type) => {
3399
- if (!highlightThreshold) return false;
3400
- const item = typeMap.get(type);
3401
- if (!item) return false;
3402
- const percentage = item.count / totalSampleSize * 100;
3403
- return percentage >= highlightThreshold;
3404
- };
3405
- if (!isValid) {
3406
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-mbti-type-grid", "ds-mbti-type-grid--invalid", className), children: [
3407
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-type-grid__title", children: title }),
3408
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__empty", children: /* @__PURE__ */ jsx(
3409
- DataStateIndicator,
3410
- {
3411
- state: "INSUFFICIENT_SAMPLE",
3412
- variant: "full",
3413
- details: {
3414
- message: "MBTI distribution analysis requires sufficient sample size",
3415
- sampleSize: totalSampleSize,
3416
- requiredSize: minSampleSize
3417
- }
3418
- }
3419
- ) })
3420
- ] });
3421
- }
3422
- return /* @__PURE__ */ jsxs("div", { className: clsx20("ds-mbti-type-grid", className), children: [
3423
- (title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "ds-mbti-type-grid__header", children: [
3424
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__header-text", children: [
3425
- title && /* @__PURE__ */ jsx("h4", { className: "ds-mbti-type-grid__title", children: title }),
3426
- subtitle && /* @__PURE__ */ jsx("p", { className: "ds-mbti-type-grid__subtitle", children: subtitle })
3427
- ] }),
3428
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__header-badges", children: [
3429
- features.showConfidenceScores && confidence !== void 0 && /* @__PURE__ */ jsx(ConfidenceIndicator, { score: confidence, size: "sm" }),
3430
- features.showMethodology && /* @__PURE__ */ jsx(
3431
- DataCoverageBadge,
3432
- {
3433
- sampleSize: totalSampleSize,
3434
- requiredSize: minSampleSize,
3435
- size: "sm"
3436
- }
3437
- )
3438
- ] })
3439
- ] }),
3440
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__container", children: [
3441
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__column-headers", children: [
3442
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__corner" }),
3443
- COLUMN_LABELS.map((label) => /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__column-header", children: label }, label))
3444
- ] }),
3445
- MBTI_GRID.map((row, rowIndex) => /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__row", children: [
3446
- /* @__PURE__ */ jsx("div", { className: "ds-mbti-type-grid__row-header", children: ROW_LABELS[rowIndex] }),
3447
- row.map((type) => {
3448
- const typeData = typeMap.get(type);
3449
- const count = typeData?.count ?? 0;
3450
- const percentage = getPercentage(count);
3451
- const intensity = getIntensity(count);
3452
- const highlighted = isHighlighted(type);
3453
- const selected = selectedType === type;
3454
- return /* @__PURE__ */ jsx(
3455
- Tooltip4,
3456
- {
3457
- content: /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__tooltip-content", children: [
3458
- /* @__PURE__ */ jsx("strong", { children: type }),
3459
- /* @__PURE__ */ jsx("p", { children: TYPE_DESCRIPTIONS[type] }),
3460
- /* @__PURE__ */ jsxs("p", { children: [
3461
- "Count: ",
3462
- count.toLocaleString()
3463
- ] }),
3464
- /* @__PURE__ */ jsxs("p", { children: [
3465
- "Percentage: ",
3466
- percentage,
3467
- "%"
3468
- ] }),
3469
- typeData?.responseRate !== void 0 && /* @__PURE__ */ jsxs("p", { children: [
3470
- "Response Rate: ",
3471
- typeData.responseRate.toFixed(1),
3472
- "%"
3473
- ] })
3474
- ] }),
3475
- children: /* @__PURE__ */ jsxs(
3476
- "button",
3477
- {
3478
- type: "button",
3479
- className: clsx20(
3480
- "ds-mbti-type-grid__cell",
3481
- highlighted && "ds-mbti-type-grid__cell--highlighted",
3482
- selected && "ds-mbti-type-grid__cell--selected",
3483
- onTypeClick && "ds-mbti-type-grid__cell--clickable"
3484
- ),
3485
- onClick: () => onTypeClick?.(type),
3486
- disabled: !onTypeClick,
3487
- style: {
3488
- "--cell-intensity": `${intensity}%`
3489
- },
3490
- children: [
3491
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__cell-type", children: type }),
3492
- showCounts && /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__cell-count", children: count.toLocaleString() }),
3493
- showPercentages && /* @__PURE__ */ jsxs("span", { className: "ds-mbti-type-grid__cell-percentage", children: [
3494
- percentage,
3495
- "%"
3496
- ] })
3497
- ]
3498
- }
3499
- )
3500
- },
3501
- type
3502
- );
3503
- })
3504
- ] }, rowIndex))
3505
- ] }),
3506
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__legend", children: [
3507
- /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__legend-item", children: [
3508
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__legend-bar ds-mbti-type-grid__legend-bar--gradient" }),
3509
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__legend-label", children: "Distribution density" })
3510
- ] }),
3511
- highlightThreshold && /* @__PURE__ */ jsxs("div", { className: "ds-mbti-type-grid__legend-item", children: [
3512
- /* @__PURE__ */ jsx("span", { className: "ds-mbti-type-grid__legend-bar ds-mbti-type-grid__legend-bar--highlight" }),
3513
- /* @__PURE__ */ jsxs("span", { className: "ds-mbti-type-grid__legend-label", children: [
3514
- ">=",
3515
- highlightThreshold,
3516
- "% of sample"
3517
- ] })
3518
- ] })
3519
- ] })
3520
- ] });
3521
- }
3522
- MBTITypeGrid.displayName = "MBTITypeGrid";
3523
1910
  function Select({
3524
1911
  value,
3525
1912
  defaultValue,
@@ -3551,7 +1938,7 @@ var SelectTrigger = React2.forwardRef(
3551
1938
  Select$1.Trigger,
3552
1939
  {
3553
1940
  ref,
3554
- className: clsx20("ds-select__trigger", `ds-select__trigger--${size}`, className),
1941
+ className: clsx12("ds-select__trigger", `ds-select__trigger--${size}`, className),
3555
1942
  "aria-label": props["aria-label"] || (typeof placeholder === "string" ? placeholder : "Select"),
3556
1943
  ...props,
3557
1944
  children: [
@@ -3572,7 +1959,7 @@ var SelectContent = React2.forwardRef(
3572
1959
  sideOffset,
3573
1960
  align,
3574
1961
  alignItemWithTrigger: false,
3575
- children: /* @__PURE__ */ jsx(Select$1.Popup, { ref, className: clsx20("ds-select__content", className), ...props, children: /* @__PURE__ */ jsx(Select$1.List, { className: "ds-select__list", children }) })
1962
+ children: /* @__PURE__ */ jsx(Select$1.Popup, { ref, className: clsx12("ds-select__content", className), ...props, children: /* @__PURE__ */ jsx(Select$1.List, { className: "ds-select__list", children }) })
3576
1963
  }
3577
1964
  ) });
3578
1965
  }
@@ -3586,7 +1973,7 @@ var SelectItem = React2.forwardRef(
3586
1973
  ref,
3587
1974
  value,
3588
1975
  disabled,
3589
- className: clsx20("ds-select__item", className),
1976
+ className: clsx12("ds-select__item", className),
3590
1977
  ...props,
3591
1978
  children: [
3592
1979
  /* @__PURE__ */ jsx(Select$1.ItemIndicator, { className: "ds-select__item-indicator", children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
@@ -3599,7 +1986,7 @@ var SelectItem = React2.forwardRef(
3599
1986
  SelectItem.displayName = "SelectItem";
3600
1987
  var SelectGroup = React2.forwardRef(
3601
1988
  ({ className, label, children, ...props }, ref) => {
3602
- return /* @__PURE__ */ jsxs(Select$1.Group, { ref, className: clsx20("ds-select__group", className), ...props, children: [
1989
+ return /* @__PURE__ */ jsxs(Select$1.Group, { ref, className: clsx12("ds-select__group", className), ...props, children: [
3603
1990
  label && /* @__PURE__ */ jsx(Select$1.GroupLabel, { className: "ds-select__group-label", children: label }),
3604
1991
  children
3605
1992
  ] });
@@ -3607,7 +1994,7 @@ var SelectGroup = React2.forwardRef(
3607
1994
  );
3608
1995
  SelectGroup.displayName = "SelectGroup";
3609
1996
  var SelectSeparator = React2.forwardRef(({ className, ...props }, ref) => {
3610
- return /* @__PURE__ */ jsx("div", { ref, className: clsx20("ds-select__separator", className), ...props });
1997
+ return /* @__PURE__ */ jsx("div", { ref, className: clsx12("ds-select__separator", className), ...props });
3611
1998
  });
3612
1999
  SelectSeparator.displayName = "SelectSeparator";
3613
2000
  function ChevronDownIcon() {
@@ -3650,7 +2037,7 @@ var DropdownMenuTrigger = React2.forwardRef(({ className, ...props }, ref) => {
3650
2037
  Menu.Trigger,
3651
2038
  {
3652
2039
  ref,
3653
- className: clsx20("ds-dropdown-menu__trigger", className),
2040
+ className: clsx12("ds-dropdown-menu__trigger", className),
3654
2041
  ...props
3655
2042
  }
3656
2043
  );
@@ -3669,7 +2056,7 @@ var DropdownMenuContent = React2.forwardRef(
3669
2056
  Menu.Popup,
3670
2057
  {
3671
2058
  ref,
3672
- className: clsx20("ds-dropdown-menu__content", className),
2059
+ className: clsx12("ds-dropdown-menu__content", className),
3673
2060
  ...props
3674
2061
  }
3675
2062
  )
@@ -3680,16 +2067,16 @@ var DropdownMenuContent = React2.forwardRef(
3680
2067
  DropdownMenuContent.displayName = "DropdownMenuContent";
3681
2068
  var DropdownMenuItem = React2.forwardRef(
3682
2069
  ({ className, ...props }, ref) => {
3683
- return /* @__PURE__ */ jsx(Menu.Item, { ref, className: clsx20("ds-dropdown-menu__item", className), ...props });
2070
+ return /* @__PURE__ */ jsx(Menu.Item, { ref, className: clsx12("ds-dropdown-menu__item", className), ...props });
3684
2071
  }
3685
2072
  );
3686
2073
  DropdownMenuItem.displayName = "DropdownMenuItem";
3687
2074
  var DropdownMenuSeparator = React2.forwardRef(({ className, ...props }, ref) => {
3688
- return /* @__PURE__ */ jsx("div", { ref, className: clsx20("ds-dropdown-menu__separator", className), ...props });
2075
+ return /* @__PURE__ */ jsx("div", { ref, className: clsx12("ds-dropdown-menu__separator", className), ...props });
3689
2076
  });
3690
2077
  DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
3691
2078
  var DropdownMenuLabel = React2.forwardRef(({ className, ...props }, ref) => {
3692
- return /* @__PURE__ */ jsx("div", { ref, className: clsx20("ds-dropdown-menu__label", className), ...props });
2079
+ return /* @__PURE__ */ jsx("div", { ref, className: clsx12("ds-dropdown-menu__label", className), ...props });
3693
2080
  });
3694
2081
  DropdownMenuLabel.displayName = "DropdownMenuLabel";
3695
2082
  var DEFAULT_OPTIONS = [
@@ -3725,7 +2112,7 @@ function ExportMenu({
3725
2112
  /* @__PURE__ */ jsx(
3726
2113
  DropdownMenuTrigger,
3727
2114
  {
3728
- className: clsx20(
2115
+ className: clsx12(
3729
2116
  "ds-export-menu__trigger",
3730
2117
  "ds-button",
3731
2118
  `ds-button--${variant}`,
@@ -3973,6 +2360,6 @@ function JsonIcon() {
3973
2360
  );
3974
2361
  }
3975
2362
 
3976
- export { ANALYST_MODE, ANALYTICAL_STATE_CONFIG, BarChart, CHART_REGISTRY, CONFIDENCE_THRESHOLDS, CaveatBlock, Chart, ChartContainer, ChartSwitchControl, ConfidenceIndicator, DataCoverageBadge, DataStateIndicator, EXECUTIVE_MODE, EvidenceGroup, ExecutiveThesis, ExportMenu, FunnelChart, HeatmapChart, INSIGHT_TYPE_CONTRACTS, INTENT_CHART_FAMILIES, InsightBlock, KeyMetric, LineChart, MBTIRadar, MBTITypeGrid, MINIMUM_SAMPLE_SIZES, MethodologyNote, PieChart, ReportModeProvider, ReportShell, Select, SelectContent, SelectGroup, SelectItem, SelectSeparator, SelectTrigger, TrendIndicator, calculateCompleteness, calculateConfidence, calculateNormalizedVariance, calculateRecency, canSwitchChart, getAllowedSwitchTargets, getConfidenceLevel, getConfidenceThreshold, getDefaultChartForIntent, getMVPChartsForIntent, suggestChartType, useChartData, useDataState, useReportMode, validateChartData, validateReportStructure };
2363
+ export { ANALYST_MODE, ANALYTICAL_STATE_CONFIG, CHART_REGISTRY, CONFIDENCE_THRESHOLDS, CaveatBlock, ConfidenceIndicator, DataCoverageBadge, DataStateIndicator, EXECUTIVE_MODE, EvidenceGroup, ExecutiveThesis, ExportMenu, INSIGHT_TYPE_CONTRACTS, INTENT_CHART_FAMILIES, InsightBlock, KeyMetric, MINIMUM_SAMPLE_SIZES, MethodologyNote, ReportModeProvider, ReportShell, Select, SelectContent, SelectGroup, SelectItem, SelectSeparator, SelectTrigger, TrendIndicator, calculateCompleteness, calculateConfidence, calculateNormalizedVariance, calculateRecency, canSwitchChart, getAllowedSwitchTargets, getConfidenceLevel, getConfidenceThreshold, getDefaultChartForIntent, getMVPChartsForIntent, suggestChartType, useChartData, useDataState, useReportMode, validateChartData, validateReportStructure };
3977
2364
  //# sourceMappingURL=out.js.map
3978
2365
  //# sourceMappingURL=index.js.map