flikkui 0.1.0-beta.8 → 0.1.0-beta.9

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 (36) hide show
  1. package/dist/components/charts/AreaChart/AreaChart.js +80 -38
  2. package/dist/components/charts/AreaChart/AreaChart.types.d.ts +5 -1
  3. package/dist/components/charts/BarChart/BarChart.js +51 -77
  4. package/dist/components/charts/BarChart/BarChart.types.d.ts +1 -0
  5. package/dist/components/charts/LineChart/LineChart.js +6 -6
  6. package/dist/components/charts/types/chart.types.d.ts +1 -1
  7. package/dist/components/charts/utils/chart-validation.js +13 -4
  8. package/dist/components/charts/utils/color-utils.js +12 -12
  9. package/dist/components/core/Avatar/Avatar.theme.js +1 -1
  10. package/dist/components/core/Badge/Badge.theme.js +12 -12
  11. package/dist/components/core/Breadcrumbs/Breadcrumbs.theme.js +4 -4
  12. package/dist/components/core/Card/Card.js +2 -2
  13. package/dist/components/core/Card/Card.theme.js +1 -1
  14. package/dist/components/core/Divider/Divider.theme.js +1 -1
  15. package/dist/components/core/Drawer/Drawer.theme.js +4 -4
  16. package/dist/components/forms/RichTextEditor/RichTextEditor.d.ts +4 -0
  17. package/dist/components/forms/RichTextEditor/RichTextEditor.js +960 -0
  18. package/dist/components/forms/RichTextEditor/RichTextEditor.theme.d.ts +10 -0
  19. package/dist/components/forms/RichTextEditor/RichTextEditor.theme.js +37 -0
  20. package/dist/components/forms/RichTextEditor/RichTextEditor.types.d.ts +122 -0
  21. package/dist/components/forms/RichTextEditor/index.d.ts +3 -0
  22. package/dist/components/forms/index.d.ts +1 -0
  23. package/dist/components/navigation/NavItem/NavItem.theme.d.ts +1 -1
  24. package/dist/components/navigation/NavItem/NavItem.theme.js +15 -15
  25. package/dist/index.js +2 -0
  26. package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowUturnLeftIcon.js +28 -0
  27. package/dist/node_modules/@heroicons/react/24/outline/esm/ArrowUturnRightIcon.js +28 -0
  28. package/dist/node_modules/@heroicons/react/24/outline/esm/Bars3BottomLeftIcon.js +28 -0
  29. package/dist/node_modules/@heroicons/react/24/outline/esm/Bars3BottomRightIcon.js +28 -0
  30. package/dist/node_modules/@heroicons/react/24/outline/esm/BoldIcon.js +27 -0
  31. package/dist/node_modules/@heroicons/react/24/outline/esm/ItalicIcon.js +28 -0
  32. package/dist/node_modules/@heroicons/react/24/outline/esm/UnderlineIcon.js +28 -0
  33. package/dist/node_modules/@heroicons/react/24/solid/esm/PaintBrushIcon.js +26 -0
  34. package/dist/styles.css +1 -1
  35. package/package.json +1 -1
  36. package/src/shadcn-compat.css +0 -80
@@ -1,7 +1,6 @@
1
1
  import { __rest, __assign, __spreadArray } from '../../../node_modules/tslib/tslib.es6.js';
2
2
  import React__default, { useRef, useState, useEffect } from 'react';
3
3
  import { cn } from '../../../utils/cn.js';
4
- import { useChartTheme } from '../hooks/useChartTheme.js';
5
4
  import { useTooltipPosition } from '../hooks/useTooltipPosition.js';
6
5
  import { useChartAccessibility } from '../hooks/useChartAccessibility.js';
7
6
  import { XAxis } from '../shared/ChartAxis/XAxis.js';
@@ -10,29 +9,27 @@ import { HorizontalGrid } from '../shared/ChartGrid/HorizontalGrid.js';
10
9
  import { ChartTooltip } from '../shared/ChartTooltip/ChartTooltip.js';
11
10
  import { ChartMarker } from '../shared/ChartMarker/ChartMarker.js';
12
11
  import { ChartCrosshair } from '../shared/ChartCrosshair/ChartCrosshair.js';
13
- import { getColorValue } from '../utils/color-utils.js';
14
12
  import { AREA_CHART_DEFAULTS } from './AreaChart.types.js';
15
13
 
16
14
  // Color configuration for data series
17
15
  var getSeriesColorClass = function (index) {
18
16
  var colors = [
19
- "stroke-primary-base fill-primary-base",
20
- "stroke-warning-base fill-warning-base",
21
- "stroke-success-base fill-success-base",
22
- "stroke-error-base fill-error-base",
17
+ "stroke-[var(--color-primary)] fill-[var(--color-primary)]",
18
+ "stroke-[var(--color-warning)] fill-[var(--color-warning)]",
19
+ "stroke-[var(--color-success)] fill-[var(--color-success)]",
20
+ "stroke-[var(--color-danger)] fill-[var(--color-danger)]",
23
21
  ];
24
22
  return colors[index % colors.length];
25
23
  };
26
- // Get fill color for gradients - now using comprehensive color mapping
24
+ // Get fill color for gradients - extract CSS variables directly
27
25
  var getSeriesFillColor = function (index) {
28
- var colorClasses = [
29
- "fill-primary-base",
30
- "fill-warning-base",
31
- "fill-success-base",
32
- "fill-error-base",
26
+ var colorVars = [
27
+ "var(--color-primary)",
28
+ "var(--color-warning)",
29
+ "var(--color-success)",
30
+ "var(--color-danger)",
33
31
  ];
34
- var colorClass = colorClasses[index % colorClasses.length];
35
- return getColorValue(colorClass);
32
+ return colorVars[index % colorVars.length];
36
33
  };
37
34
  // Simplified curve generation
38
35
  var generateMonotonePath = function (points) {
@@ -64,6 +61,49 @@ var generateLinearPath = function (points) {
64
61
  }
65
62
  return path;
66
63
  };
64
+ var generateStepPath = function (points) {
65
+ if (points.length === 0)
66
+ return "";
67
+ if (points.length === 1)
68
+ return "M ".concat(points[0].x, " ").concat(points[0].y);
69
+ var path = "M ".concat(points[0].x, " ").concat(points[0].y);
70
+ for (var i = 1; i < points.length; i++) {
71
+ var prev = points[i - 1];
72
+ var curr = points[i];
73
+ var midX = prev.x + (curr.x - prev.x) / 2;
74
+ // Step: horizontal to midpoint, vertical to current y, horizontal to current x
75
+ path += " L ".concat(midX, " ").concat(prev.y, " L ").concat(midX, " ").concat(curr.y, " L ").concat(curr.x, " ").concat(curr.y);
76
+ }
77
+ return path;
78
+ };
79
+ var generateStepBeforePath = function (points) {
80
+ if (points.length === 0)
81
+ return "";
82
+ if (points.length === 1)
83
+ return "M ".concat(points[0].x, " ").concat(points[0].y);
84
+ var path = "M ".concat(points[0].x, " ").concat(points[0].y);
85
+ for (var i = 1; i < points.length; i++) {
86
+ var prev = points[i - 1];
87
+ var curr = points[i];
88
+ // Step before: vertical first, then horizontal
89
+ path += " L ".concat(prev.x, " ").concat(curr.y, " L ").concat(curr.x, " ").concat(curr.y);
90
+ }
91
+ return path;
92
+ };
93
+ var generateStepAfterPath = function (points) {
94
+ if (points.length === 0)
95
+ return "";
96
+ if (points.length === 1)
97
+ return "M ".concat(points[0].x, " ").concat(points[0].y);
98
+ var path = "M ".concat(points[0].x, " ").concat(points[0].y);
99
+ for (var i = 1; i < points.length; i++) {
100
+ var prev = points[i - 1];
101
+ var curr = points[i];
102
+ // Step after: horizontal first, then vertical
103
+ path += " L ".concat(curr.x, " ").concat(prev.y, " L ").concat(curr.x, " ").concat(curr.y);
104
+ }
105
+ return path;
106
+ };
67
107
  // Simple curve implementation
68
108
  var generateCurvePath = function (points, curveType) {
69
109
  if (curveType === void 0) { curveType = "monotone"; }
@@ -74,50 +114,55 @@ var generateCurvePath = function (points, curveType) {
74
114
  switch (curveType) {
75
115
  case "monotone":
76
116
  return generateMonotonePath(points);
117
+ case "step":
118
+ return generateStepPath(points);
119
+ case "stepBefore":
120
+ return generateStepBeforePath(points);
121
+ case "stepAfter":
122
+ return generateStepAfterPath(points);
77
123
  case "linear":
78
124
  default:
79
125
  return generateLinearPath(points);
80
126
  }
81
127
  };
82
128
  var AreaChart = function (_a) {
129
+ // Simplified color system - no complex theme hook needed
83
130
  var data = _a.data, config = _a.config,
84
131
  // Standardized display props with defaults
85
132
  _b = _a.showGrid,
86
133
  // Standardized display props with defaults
87
134
  showGrid = _b === void 0 ? AREA_CHART_DEFAULTS.showGrid : _b, _c = _a.showXAxis, showXAxis = _c === void 0 ? AREA_CHART_DEFAULTS.showXAxis : _c, _d = _a.showYAxis, showYAxis = _d === void 0 ? AREA_CHART_DEFAULTS.showYAxis : _d, _e = _a.showNullValues, showNullValues = _e === void 0 ? AREA_CHART_DEFAULTS.showNullValues : _e, // NEW!
88
- propMinValue = _a.minValue, propMaxValue = _a.maxValue, _f = _a.variant, variant = _f === void 0 ? AREA_CHART_DEFAULTS.variant : _f, theme = _a.theme,
89
- // Standardized visual props with defaults (renamed from area-specific names)
135
+ propMinValue = _a.minValue, propMaxValue = _a.maxValue, _f = _a.variant; _f === void 0 ? AREA_CHART_DEFAULTS.variant : _f; _a.theme;
136
+ var // Standardized visual props with defaults (renamed from area-specific names)
90
137
  _g = _a.radius,
91
138
  // Standardized visual props with defaults (renamed from area-specific names)
92
139
  radius = _g === void 0 ? AREA_CHART_DEFAULTS.radius : _g, // Was dotRadius
93
140
  _h = _a.strokeWidth, // Was dotRadius
94
141
  strokeWidth = _h === void 0 ? AREA_CHART_DEFAULTS.strokeWidth : _h, _j = _a.curved, curved = _j === void 0 ? AREA_CHART_DEFAULTS.curved : _j, _k = _a.curveType, curveType = _k === void 0 ? AREA_CHART_DEFAULTS.curveType : _k, _l = _a.showDots, showDots = _l === void 0 ? AREA_CHART_DEFAULTS.showDots : _l, _m = _a.fillOpacity, fillOpacity = _m === void 0 ? AREA_CHART_DEFAULTS.fillOpacity : _m, _o = _a.showStroke, showStroke = _o === void 0 ? AREA_CHART_DEFAULTS.showStroke : _o, _p = _a.stacked, stacked = _p === void 0 ? AREA_CHART_DEFAULTS.stacked : _p,
95
142
  // Base props
96
- className = _a.className, title = _a.title, description = _a.description, _q = _a.enableKeyboardNavigation, enableKeyboardNavigation = _q === void 0 ? AREA_CHART_DEFAULTS.enableKeyboardNavigation : _q, children = _a.children, props = __rest(_a, ["data", "config", "showGrid", "showXAxis", "showYAxis", "showNullValues", "minValue", "maxValue", "variant", "theme", "radius", "strokeWidth", "curved", "curveType", "showDots", "fillOpacity", "showStroke", "stacked", "className", "title", "description", "enableKeyboardNavigation", "children"]);
97
- // Use the new theme system
98
- var _r = useChartTheme({ config: config, variant: variant, theme: theme }); _r.getSeriesColor; _r.getColorClass; _r.getOpacityClass; _r.getTransitionClass;
99
- // Legacy support
100
- _r.getThemeValue;
143
+ className = _a.className, title = _a.title, description = _a.description, _q = _a.enableKeyboardNavigation, enableKeyboardNavigation = _q === void 0 ? AREA_CHART_DEFAULTS.enableKeyboardNavigation : _q,
144
+ // Additional className overrides for chart elements
145
+ svgClassName = _a.svgClassName, areaClassName = _a.areaClassName, lineClassName = _a.lineClassName, gridClassName = _a.gridClassName, axisClassName = _a.axisClassName, children = _a.children, props = __rest(_a, ["data", "config", "showGrid", "showXAxis", "showYAxis", "showNullValues", "minValue", "maxValue", "variant", "theme", "radius", "strokeWidth", "curved", "curveType", "showDots", "fillOpacity", "showStroke", "stacked", "className", "title", "description", "enableKeyboardNavigation", "svgClassName", "areaClassName", "lineClassName", "gridClassName", "axisClassName", "children"]);
101
146
  var containerRef = useRef(null);
102
- var _s = useState({ width: 600, height: 400 }), dimensions = _s[0], setDimensions = _s[1];
103
- var _t = useState(null), hoveredPoint = _t[0], setHoveredPoint = _t[1];
147
+ var _r = useState({ width: 600, height: 400 }), dimensions = _r[0], setDimensions = _r[1];
148
+ var _s = useState(null), hoveredPoint = _s[0], setHoveredPoint = _s[1];
104
149
  // Detect if device is mobile/touch
105
150
  var isMobile = typeof window !== 'undefined' &&
106
151
  ('ontouchstart' in window || navigator.maxTouchPoints > 0);
107
152
  // Use the new tooltip positioning hook
108
- var _u = useTooltipPosition({
153
+ var _t = useTooltipPosition({
109
154
  containerRef: containerRef,
110
155
  isMobile: isMobile,
111
- }), tooltipData = _u.tooltipData, tooltipRef = _u.tooltipRef, handleMouseEnter = _u.handleMouseEnter, handleMouseMove = _u.handleMouseMove, handleMouseLeave = _u.handleMouseLeave;
156
+ }), tooltipData = _t.tooltipData, tooltipRef = _t.tooltipRef, handleMouseEnter = _t.handleMouseEnter, handleMouseMove = _t.handleMouseMove, handleMouseLeave = _t.handleMouseLeave;
112
157
  // Use accessibility hook
113
- var _v = useChartAccessibility({
158
+ var _u = useChartAccessibility({
114
159
  chartType: 'area',
115
160
  data: data,
116
161
  config: config,
117
162
  title: title,
118
163
  description: description,
119
164
  enableKeyboardNavigation: enableKeyboardNavigation,
120
- }), chartAccessibilityProps = _v.chartAccessibilityProps, descriptionProps = _v.descriptionProps; _v.focusedElementIndex; _v.isKeyboardMode; var handleMouseInteraction = _v.handleMouseInteraction;
165
+ }), chartAccessibilityProps = _u.chartAccessibilityProps, descriptionProps = _u.descriptionProps, handleMouseInteraction = _u.handleMouseInteraction;
121
166
  // Measure container dimensions
122
167
  useEffect(function () {
123
168
  var updateDimensions = function () {
@@ -140,7 +185,7 @@ var AreaChart = function (_a) {
140
185
  }, []);
141
186
  // Early return if no data
142
187
  if (!data || data.length === 0) {
143
- return (React__default.createElement("div", __assign({ className: cn("chart-container flex items-center justify-center text-neutral-500", className), role: "img", "aria-label": "Empty area chart" }, props),
188
+ return (React__default.createElement("div", __assign({ className: cn("chart-container flex items-center justify-center text-[var(--color-text-placeholder)]", className), role: "img", "aria-label": "Empty area chart" }, props),
144
189
  React__default.createElement("span", null, "No data available")));
145
190
  }
146
191
  // Calculate dimensions
@@ -292,9 +337,9 @@ var AreaChart = function (_a) {
292
337
  return stackedData;
293
338
  };
294
339
  var stackedValues = getStackedValues();
295
- return (React__default.createElement("div", __assign({ ref: containerRef, className: cn("chart-container w-full h-full", className) }, chartAccessibilityProps, { onMouseEnter: handleMouseInteraction, onMouseMove: handleMouseInteraction }, props),
340
+ return (React__default.createElement("div", __assign({ ref: containerRef, className: cn("chart-container w-full h-full relative", "[&_.chart-areas]:transition-opacity [&_.chart-areas]:duration-300", "[&_.chart-hover-areas]:cursor-pointer", "[&_.chart-hover-markers]:transition-all [&_.chart-hover-markers]:duration-200", className) }, chartAccessibilityProps, { onMouseEnter: handleMouseInteraction, onMouseMove: handleMouseInteraction }, props),
296
341
  descriptionProps && React__default.createElement("div", __assign({}, descriptionProps)),
297
- React__default.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 ".concat(dimensions.width, " ").concat(dimensions.height), className: "overflow-visible", role: "presentation" },
342
+ React__default.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 ".concat(dimensions.width, " ").concat(dimensions.height), className: cn("overflow-visible", "[&_.chart-areas_path]:transition-all [&_.chart-areas_path]:duration-200", svgClassName), role: "presentation" },
298
343
  React__default.createElement("defs", null,
299
344
  React__default.createElement("filter", { id: "area-shadow", x: "-20%", y: "-20%", width: "140%", height: "140%" },
300
345
  React__default.createElement("feDropShadow", { dx: "4", dy: "4", stdDeviation: "6", floodOpacity: "0.1", floodColor: "#000000" })),
@@ -316,7 +361,7 @@ var AreaChart = function (_a) {
316
361
  React__default.createElement("stop", { offset: "50%", stopColor: "#6b7280", stopOpacity: "0.5" }),
317
362
  React__default.createElement("stop", { offset: "60%", stopColor: "#6b7280", stopOpacity: "0.3" }),
318
363
  React__default.createElement("stop", { offset: "100%", stopColor: "#6b7280", stopOpacity: "0" }))),
319
- React__default.createElement(HorizontalGrid, { show: showGrid, x: margin.left, y: margin.top, width: innerWidth, height: innerHeight, lineCount: 5 }),
364
+ React__default.createElement(HorizontalGrid, { show: showGrid, x: margin.left, y: margin.top, width: innerWidth, height: innerHeight, lineCount: 5, className: gridClassName }),
320
365
  React__default.createElement(ChartCrosshair, { show: hoveredPoint !== null, x: hoveredPoint !== null ? (data.length === 1
321
366
  ? margin.left + innerWidth / 2
322
367
  : margin.left + (hoveredPoint.index / (data.length - 1)) * innerWidth) : 0, y: hoveredPoint !== null && dataKeys.length === 1 ? (function () {
@@ -326,19 +371,19 @@ var AreaChart = function (_a) {
326
371
  var numValue = typeof singleValue === 'number' ? singleValue : 0;
327
372
  return margin.top + innerHeight - ((numValue - minValue) / (maxValue - minValue)) * innerHeight;
328
373
  })() : undefined, margin: margin, innerWidth: innerWidth, innerHeight: innerHeight, showHorizontal: dataKeys.length === 1 }),
329
- React__default.createElement(YAxis, { show: showYAxis, min: minValue, max: maxValue, x: margin.left, y: margin.top, height: innerHeight, showGrid: false, gridWidth: innerWidth, tickFormatter: function (value) {
374
+ React__default.createElement(YAxis, { show: showYAxis, min: minValue, max: maxValue, x: margin.left, y: margin.top, height: innerHeight, showGrid: false, gridWidth: innerWidth, className: axisClassName, tickFormatter: function (value) {
330
375
  if (value >= 1000)
331
376
  return "".concat((value / 1000).toFixed(0), "k");
332
377
  return value.toString();
333
378
  } }),
334
- React__default.createElement("g", { className: "chart-areas" }, dataKeys.map(function (key, keyIndex) {
379
+ React__default.createElement("g", { className: cn("chart-areas", "[&_path]:drop-shadow-sm [&_path]:transition-all [&_path]:duration-200", areaClassName) }, dataKeys.map(function (key, keyIndex) {
335
380
  var paths = generateAreaPath(key, stackedValues[key]);
336
381
  var colorClass = getSeriesColorClass(keyIndex);
337
382
  if (!paths)
338
383
  return null;
339
384
  return (React__default.createElement("g", { key: key },
340
385
  React__default.createElement("path", { d: paths.areaPath, fill: "url(#area-gradient-".concat(key, ")"), className: "transition-all duration-200", filter: "url(#area-shadow)" }),
341
- showStroke && (React__default.createElement("path", { d: paths.linePath, fill: "none", strokeWidth: strokeWidth, strokeLinecap: "round", className: cn("transition-all duration-200", colorClass.split(' ').find(function (cls) { return cls.startsWith('stroke-'); }) || '') })),
386
+ showStroke && (React__default.createElement("path", { d: paths.linePath, fill: "none", strokeWidth: strokeWidth, strokeLinecap: "round", className: cn("transition-all duration-200", colorClass.split(' ').find(function (cls) { return cls.startsWith('stroke-'); }) || '', lineClassName) })),
342
387
  showDots &&
343
388
  data.map(function (item, dataIndex) {
344
389
  var rawValue = item[key];
@@ -351,10 +396,8 @@ var AreaChart = function (_a) {
351
396
  // Don't render dots for null values regardless of showNullValues
352
397
  if (isNull)
353
398
  return null;
354
- stacked && stackedValues[key] ? stackedValues[key][dataIndex] : minValue;
355
399
  var topValue = stacked && stackedValues[key] ? stackedValues[key][dataIndex] + value : value;
356
400
  var _a = getPointPosition(dataIndex, topValue), x = _a.x, y = _a.y;
357
- (hoveredPoint === null || hoveredPoint === void 0 ? void 0 : hoveredPoint.index) === dataIndex && hoveredPoint.key === key;
358
401
  return (React__default.createElement("g", { key: "".concat(key, "-").concat(dataIndex) },
359
402
  React__default.createElement(ChartMarker, { cx: x, cy: y, radius: radius, colorClass: colorClass })));
360
403
  })));
@@ -371,7 +414,6 @@ var AreaChart = function (_a) {
371
414
  // Don't render hover markers for null values
372
415
  if (isNull)
373
416
  return null;
374
- stacked && stackedValues[key] ? stackedValues[key][hoveredPoint.index] : minValue;
375
417
  var topValue = stacked && stackedValues[key] ? stackedValues[key][hoveredPoint.index] + value : value;
376
418
  var _a = getPointPosition(hoveredPoint.index, topValue), x = _a.x, y = _a.y;
377
419
  var colorClass = getSeriesColorClass(keyIndex);
@@ -426,7 +468,7 @@ var AreaChart = function (_a) {
426
468
  }
427
469
  }, onMouseLeave: handleMouseLeave }));
428
470
  })),
429
- React__default.createElement(XAxis, { show: showXAxis, data: data, x: margin.left, y: margin.top + innerHeight, width: innerWidth, categoryWidth: innerWidth / data.length, categoryGap: 0 })),
471
+ React__default.createElement(XAxis, { show: showXAxis, data: data, x: margin.left, y: margin.top + innerHeight, width: innerWidth, categoryWidth: innerWidth / data.length, categoryGap: 0, className: axisClassName })),
430
472
  React__default.createElement(ChartTooltip, { active: !!tooltipData, position: tooltipData ? { x: tooltipData.x, y: tooltipData.y } : { x: 0, y: 0 }, tooltipRef: tooltipRef, content: tooltipData === null || tooltipData === void 0 ? void 0 : tooltipData.content, chartType: "area" }),
431
473
  children));
432
474
  };
@@ -3,11 +3,15 @@ export interface AreaChartProps extends BaseChartProps, StandardChartDisplayProp
3
3
  radius?: number;
4
4
  strokeWidth?: number;
5
5
  curved?: boolean;
6
- curveType?: 'linear' | 'monotone';
7
6
  showDots?: boolean;
8
7
  fillOpacity?: number;
9
8
  showStroke?: boolean;
10
9
  stacked?: boolean;
10
+ svgClassName?: string;
11
+ areaClassName?: string;
12
+ lineClassName?: string;
13
+ gridClassName?: string;
14
+ axisClassName?: string;
11
15
  }
12
16
  export declare const AREA_CHART_DEFAULTS: {
13
17
  readonly radius: 4;
@@ -1,7 +1,6 @@
1
1
  import { __rest, __assign } from '../../../node_modules/tslib/tslib.es6.js';
2
2
  import React__default, { useRef, useState, useEffect } from 'react';
3
3
  import { cn } from '../../../utils/cn.js';
4
- import { useChartTheme } from '../hooks/useChartTheme.js';
5
4
  import { useTooltipPosition } from '../hooks/useTooltipPosition.js';
6
5
  import { useChartAccessibility } from '../hooks/useChartAccessibility.js';
7
6
  import { useChartValidation } from '../hooks/useChartValidation.js';
@@ -10,7 +9,6 @@ import { XAxis } from '../shared/ChartAxis/XAxis.js';
10
9
  import { YAxis } from '../shared/ChartAxis/YAxis.js';
11
10
  import { HorizontalGrid } from '../shared/ChartGrid/HorizontalGrid.js';
12
11
  import { ChartTooltip } from '../shared/ChartTooltip/ChartTooltip.js';
13
- import { getColorValue } from '../utils/color-utils.js';
14
12
  import { BAR_CHART_DEFAULTS } from './BarChart.types.js';
15
13
 
16
14
  var BarChart = function (_a) {
@@ -19,8 +17,8 @@ var BarChart = function (_a) {
19
17
  // Standardized display props with defaults
20
18
  _c = _a.showGrid,
21
19
  // Standardized display props with defaults
22
- showGrid = _c === void 0 ? BAR_CHART_DEFAULTS.showGrid : _c, _d = _a.showXAxis, showXAxis = _d === void 0 ? BAR_CHART_DEFAULTS.showXAxis : _d, _e = _a.showYAxis, showYAxis = _e === void 0 ? BAR_CHART_DEFAULTS.showYAxis : _e, _f = _a.showNullValues, showNullValues = _f === void 0 ? BAR_CHART_DEFAULTS.showNullValues : _f, propMinValue = _a.minValue, propMaxValue = _a.maxValue, _g = _a.variant, variant = _g === void 0 ? BAR_CHART_DEFAULTS.variant : _g, theme = _a.theme,
23
- // Standardized visual props with defaults (renamed from bar-specific names)
20
+ showGrid = _c === void 0 ? BAR_CHART_DEFAULTS.showGrid : _c, _d = _a.showXAxis, showXAxis = _d === void 0 ? BAR_CHART_DEFAULTS.showXAxis : _d, _e = _a.showYAxis, showYAxis = _e === void 0 ? BAR_CHART_DEFAULTS.showYAxis : _e, _f = _a.showNullValues, showNullValues = _f === void 0 ? BAR_CHART_DEFAULTS.showNullValues : _f, propMinValue = _a.minValue, propMaxValue = _a.maxValue, _g = _a.variant; _g === void 0 ? BAR_CHART_DEFAULTS.variant : _g; _a.theme;
21
+ var // Standardized visual props with defaults (renamed from bar-specific names)
24
22
  _h = _a.radius,
25
23
  // Standardized visual props with defaults (renamed from bar-specific names)
26
24
  radius = _h === void 0 ? BAR_CHART_DEFAULTS.radius : _h, // Was barRadius
@@ -35,12 +33,12 @@ var BarChart = function (_a) {
35
33
  // Bar-specific props
36
34
  _m === void 0 ? BAR_CHART_DEFAULTS.orientation : _m;
37
35
  var // Base props
38
- className = _a.className, title = _a.title, description = _a.description, _o = _a.enableKeyboardNavigation, enableKeyboardNavigation = _o === void 0 ? BAR_CHART_DEFAULTS.enableKeyboardNavigation : _o, children = _a.children, props = __rest(_a, ["data", "config", "showGrid", "showXAxis", "showYAxis", "showNullValues", "minValue", "maxValue", "variant", "theme", "radius", "gap", "categoryGap", "stacked", "orientation", "className", "title", "description", "enableKeyboardNavigation", "children"]);
36
+ className = _a.className, title = _a.title, description = _a.description, _o = _a.enableKeyboardNavigation, enableKeyboardNavigation = _o === void 0 ? BAR_CHART_DEFAULTS.enableKeyboardNavigation : _o, _p = _a.showValidationWarnings, showValidationWarnings = _p === void 0 ? process.env.NODE_ENV === 'development' : _p, children = _a.children, props = __rest(_a, ["data", "config", "showGrid", "showXAxis", "showYAxis", "showNullValues", "minValue", "maxValue", "variant", "theme", "radius", "gap", "categoryGap", "stacked", "orientation", "className", "title", "description", "enableKeyboardNavigation", "showValidationWarnings", "children"]);
39
37
  // Validate data and config with error handling
40
- var _p = useChartValidation(data, config, {
38
+ var _q = useChartValidation(data, config, {
41
39
  autoSanitize: true,
42
40
  logWarnings: true,
43
- }), validation = _p.validation, sanitizedData = _p.sanitizedData, isValid = _p.isValid, hasWarnings = _p.hasWarnings, safeScale = _p.safeScale, safeMath = _p.safeMath;
41
+ }), validation = _q.validation, sanitizedData = _q.sanitizedData, isValid = _q.isValid, hasWarnings = _q.hasWarnings, safeScale = _q.safeScale, safeMath = _q.safeMath;
44
42
  // Early return for invalid data with error message
45
43
  if (!isValid) {
46
44
  return (React__default.createElement("div", __assign({ className: cn("chart-container flex flex-col items-center justify-center p-6 border border-warning-200 bg-warning-50 rounded-lg text-center", className), role: "alert", "aria-live": "polite" }, props),
@@ -63,10 +61,16 @@ var BarChart = function (_a) {
63
61
  return (React__default.createElement("div", __assign({ className: cn("chart-container flex items-center justify-center text-neutral-500", className), role: "img", "aria-label": "Empty bar chart" }, props),
64
62
  React__default.createElement("span", null, "No data available")));
65
63
  }
66
- // Use the new theme system
67
- var _q = useChartTheme({ config: config, variant: variant, theme: theme }); _q.getSeriesColor; _q.getColorClass; _q.getOpacityClass; _q.getTransitionClass;
68
- // Legacy support
69
- _q.getThemeValue;
64
+ // Simple color functions based on direct CSS variables (following guidelines)
65
+ var getSeriesFillColor = function (index) {
66
+ var colorVars = [
67
+ "var(--color-primary)",
68
+ "var(--color-warning)",
69
+ "var(--color-success)",
70
+ "var(--color-danger)",
71
+ ];
72
+ return colorVars[index % colorVars.length];
73
+ };
70
74
  var containerRef = useRef(null);
71
75
  var _r = useState({ width: 600, height: 400 }), dimensions = _r[0], setDimensions = _r[1];
72
76
  var _s = useState(null), hoveredCategory = _s[0], setHoveredCategory = _s[1];
@@ -168,31 +172,15 @@ var BarChart = function (_a) {
168
172
  var range = maxValue - minValue;
169
173
  var barHeight = range > 0 ? ((value - minValue) / range) * innerHeight : 0;
170
174
  var y = margin.top + innerHeight - barHeight;
171
- // Get the color class for the first series (index 0)
172
- var colorClass = void 0;
173
- switch (0 % 4) {
174
- case 0:
175
- colorClass = "fill-primary-base";
176
- break;
177
- case 1:
178
- colorClass = "fill-warning-base";
179
- break;
180
- case 2:
181
- colorClass = "fill-success-base";
182
- break;
183
- case 3:
184
- colorClass = "fill-danger-base";
185
- break;
186
- default:
187
- colorClass = "fill-primary-base";
188
- }
175
+ // Get the fill color for the first series (index 0)
176
+ var fillColor = getSeriesFillColor(0);
189
177
  var content = {
190
178
  category: item.name || "Category ".concat(focusedElementIndex + 1),
191
179
  series: [{
192
180
  key: key,
193
181
  label: ((_a = config[key]) === null || _a === void 0 ? void 0 : _a.label) || key,
194
182
  value: value,
195
- color: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) || getColorValue(colorClass)
183
+ color: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) || fillColor
196
184
  }]
197
185
  };
198
186
  var svgCoordinates = {
@@ -218,11 +206,15 @@ var BarChart = function (_a) {
218
206
  return (React__default.createElement(ChartErrorBoundary, { className: className, showErrorDetails: process.env.NODE_ENV === 'development' },
219
207
  React__default.createElement("div", __assign({ ref: containerRef, className: cn("chart-container w-full h-full", className) }, chartAccessibilityProps, { onMouseEnter: handleMouseInteraction, onMouseMove: handleMouseInteraction }, props),
220
208
  descriptionProps && React__default.createElement("div", __assign({}, descriptionProps)),
221
- process.env.NODE_ENV === 'development' && hasWarnings && (React__default.createElement("div", { className: "absolute top-2 left-2 right-2 z-10 p-2 bg-yellow-50 border border-yellow-200 rounded text-xs text-yellow-800 shadow-sm" },
209
+ showValidationWarnings && hasWarnings && (React__default.createElement("div", { className: "absolute top-2 left-2 right-2 z-10 p-2 bg-yellow-50 border border-yellow-200 rounded text-xs text-yellow-800 shadow-sm" },
222
210
  React__default.createElement("strong", null, "Chart Warnings:"),
223
- React__default.createElement("ul", { className: "mt-1" }, validation.warnings.map(function (warning, index) { return (React__default.createElement("li", { key: index },
211
+ React__default.createElement("ul", { className: "mt-1" }, validation.warnings
212
+ .filter(function (warning) { return !warning.message.includes('has no valid numeric values'); })
213
+ .map(function (warning, index) { return (React__default.createElement("li", { key: index },
224
214
  "\u2022 ",
225
- warning.message)); })))),
215
+ warning.message)); })),
216
+ validation.warnings.some(function (warning) { return warning.message.includes('has no valid numeric values'); }) && (React__default.createElement("div", { className: "mt-2 pt-2 border-t border-yellow-200" },
217
+ React__default.createElement("span", { className: "text-yellow-700" }, "\u2139\uFE0F Null/undefined values are handled by using averages from other data points"))))),
226
218
  React__default.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 ".concat(dimensions.width, " ").concat(dimensions.height) },
227
219
  React__default.createElement(HorizontalGrid, { show: showGrid, x: margin.left, y: margin.top, width: innerWidth, height: innerHeight, lineCount: 5 }),
228
220
  React__default.createElement(YAxis, { show: showYAxis, min: minValue, max: maxValue, x: margin.left, y: margin.top, height: innerHeight, showGrid: false, gridWidth: innerWidth, tickFormatter: function (value) {
@@ -244,24 +236,8 @@ var BarChart = function (_a) {
244
236
  var barHeight = range > 0 ? safeMath.scale(actualValue, minValue, maxValue, 0, innerHeight) : 0;
245
237
  var currentY = stackedY_1 - barHeight;
246
238
  stackedY_1 = currentY;
247
- // Get color class for this data series
248
- var colorClass;
249
- switch (keyIndex % 4) {
250
- case 0:
251
- colorClass = "fill-primary-base";
252
- break;
253
- case 1:
254
- colorClass = "fill-warning-base";
255
- break;
256
- case 2:
257
- colorClass = "fill-success-base";
258
- break;
259
- case 3:
260
- colorClass = "fill-danger-base";
261
- break;
262
- default:
263
- colorClass = "fill-primary-base";
264
- }
239
+ // Get fill color for this data series using direct CSS variables
240
+ var fillColor = getSeriesFillColor(keyIndex);
265
241
  var isHovered = hoveredCategory === index;
266
242
  var isAnyBarHovered = hoveredCategory !== null;
267
243
  var shouldReduceOpacity = isAnyBarHovered && !isHovered;
@@ -276,10 +252,17 @@ var BarChart = function (_a) {
276
252
  }
277
253
  return (React__default.createElement("path", { key: keyIndex, d: createRoundedTopBarPath(x, currentY, individualBarWidth, barHeight, keyIndex === dataKeys.length - 1 ? radius : 0), className: cn("transition-all duration-750",
278
254
  // Only add cursor-pointer for non-null bars
279
- !isNull && "cursor-pointer", !isNull && shouldReduceOpacity ? "fill-slate-500" :
280
- isNull ? "fill-neutral-300 " : colorClass, !isNull && shouldReduceOpacity && "opacity-20",
255
+ !isNull && "cursor-pointer",
281
256
  // Keyboard focus styles
282
- isFocused && "stroke-primary-600 stroke-2"), onMouseEnter: !isNull ? function (e) {
257
+ isFocused && "stroke-2"), style: {
258
+ fill: isNull
259
+ ? "var(--color-neutral)"
260
+ : shouldReduceOpacity
261
+ ? "var(--color-neutral)"
262
+ : fillColor,
263
+ opacity: !isNull && shouldReduceOpacity ? 0.2 : 1,
264
+ stroke: isFocused ? "var(--color-primary)" : "none"
265
+ }, onMouseEnter: !isNull ? function (e) {
283
266
  var _a, _b;
284
267
  setHoveredCategory(index);
285
268
  // Create content in MultiSeriesData format for consistency
@@ -289,7 +272,7 @@ var BarChart = function (_a) {
289
272
  key: key,
290
273
  label: ((_a = config[key]) === null || _a === void 0 ? void 0 : _a.label) || key,
291
274
  value: value,
292
- color: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) || getColorValue(colorClass)
275
+ color: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) || fillColor
293
276
  }]
294
277
  };
295
278
  var svgCoordinates = {
@@ -324,24 +307,8 @@ var BarChart = function (_a) {
324
307
  var barHeight = range > 0 ? safeMath.scale(actualValue, minValue, maxValue, 0, innerHeight) : 0;
325
308
  var barX = x + keyIndex * (individualBarWidth + gap);
326
309
  var barY = margin.top + innerHeight - barHeight;
327
- // Get color class for this data series
328
- var colorClass;
329
- switch (keyIndex % 4) {
330
- case 0:
331
- colorClass = "fill-primary-base";
332
- break;
333
- case 1:
334
- colorClass = "fill-warning-base";
335
- break;
336
- case 2:
337
- colorClass = "fill-success-base";
338
- break;
339
- case 3:
340
- colorClass = "fill-danger-base";
341
- break;
342
- default:
343
- colorClass = "fill-primary-base";
344
- }
310
+ // Get fill color for this data series using direct CSS variables
311
+ var fillColor = getSeriesFillColor(keyIndex);
345
312
  var isHovered = hoveredCategory === index;
346
313
  var isAnyBarHovered = hoveredCategory !== null;
347
314
  var shouldReduceOpacity = isAnyBarHovered && !isHovered;
@@ -356,10 +323,17 @@ var BarChart = function (_a) {
356
323
  }
357
324
  return (React__default.createElement("path", { key: keyIndex, d: createRoundedTopBarPath(barX, barY, individualBarWidth, barHeight, radius), className: cn("transition-all duration-750",
358
325
  // Only add cursor-pointer for non-null bars
359
- !isNull && "cursor-pointer", !isNull && shouldReduceOpacity ? "fill-slate-500" :
360
- isNull ? "fill-neutral-300" : colorClass, !isNull && shouldReduceOpacity && "opacity-20",
326
+ !isNull && "cursor-pointer",
361
327
  // Keyboard focus styles
362
- isFocused && "stroke-primary-600 stroke-2"), onMouseEnter: !isNull ? function (e) {
328
+ isFocused && "stroke-2"), style: {
329
+ fill: isNull
330
+ ? "var(--color-neutral)"
331
+ : shouldReduceOpacity
332
+ ? "var(--color-neutral)"
333
+ : fillColor,
334
+ opacity: !isNull && shouldReduceOpacity ? 0.2 : 1,
335
+ stroke: isFocused ? "var(--color-primary)" : "none"
336
+ }, onMouseEnter: !isNull ? function (e) {
363
337
  var _a, _b;
364
338
  setHoveredCategory(index);
365
339
  // Create content in MultiSeriesData format for consistency
@@ -369,7 +343,7 @@ var BarChart = function (_a) {
369
343
  key: key,
370
344
  label: ((_a = config[key]) === null || _a === void 0 ? void 0 : _a.label) || key,
371
345
  value: value,
372
- color: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) || getColorValue(colorClass)
346
+ color: ((_b = config[key]) === null || _b === void 0 ? void 0 : _b.color) || fillColor
373
347
  }]
374
348
  };
375
349
  var svgCoordinates = {
@@ -3,6 +3,7 @@ export interface BarChartProps extends BaseChartProps, StandardChartDisplayProps
3
3
  radius?: number;
4
4
  gap?: number;
5
5
  categoryGap?: number;
6
+ showValidationWarnings?: boolean;
6
7
  }
7
8
  export declare const BAR_CHART_DEFAULTS: {
8
9
  readonly radius: 12;
@@ -16,12 +16,12 @@ import { LINE_CHART_DEFAULTS } from './LineChart.types.js';
16
16
  // Color configuration for data series
17
17
  var getSeriesColorClass = function (index) {
18
18
  var colors = [
19
- "stroke-primary-base",
20
- "stroke-warning-base",
21
- "stroke-success-base",
22
- "stroke-error-base",
23
- "stroke-info-base",
24
- "stroke-secondary-base",
19
+ "stroke-primary",
20
+ "stroke-warning",
21
+ "stroke-success",
22
+ "stroke-error",
23
+ "stroke-info",
24
+ "stroke-secondary",
25
25
  ];
26
26
  return colors[index % colors.length];
27
27
  };
@@ -10,7 +10,7 @@ export interface ChartConfig {
10
10
  };
11
11
  }
12
12
  export type ChartVariant = 'default' | 'minimal' | 'gradient';
13
- export type CurveType = 'linear' | 'monotone';
13
+ export type CurveType = 'linear' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter';
14
14
  export interface ChartThemeOverrides {
15
15
  baseStyle?: {
16
16
  colors?: Partial<{
@@ -111,12 +111,21 @@ function validateChartData(data) {
111
111
  var hasNumericValue = Object.values(item).some(function (value) {
112
112
  return typeof value === 'number' && isFinite(value);
113
113
  });
114
+ // Only warn about missing numeric values if there are no valid numeric values
115
+ // in the entire dataset. Individual items with null/undefined values are
116
+ // handled gracefully by chart components (e.g., using averages for bar charts)
114
117
  if (!hasNumericValue) {
115
- warnings.push({
116
- type: 'data',
117
- message: "Data item at index ".concat(index, " has no valid numeric values"),
118
- field: "data[".concat(index, "]")
118
+ var allDataHasNumericValues = data.some(function (dataItem) {
119
+ return dataItem && typeof dataItem === 'object' &&
120
+ Object.values(dataItem).some(function (value) { return typeof value === 'number' && isFinite(value); });
119
121
  });
122
+ if (!allDataHasNumericValues) {
123
+ warnings.push({
124
+ type: 'data',
125
+ message: "Data item at index ".concat(index, " has no valid numeric values"),
126
+ field: "data[".concat(index, "]")
127
+ });
128
+ }
120
129
  }
121
130
  });
122
131
  return { isValid: errors.length === 0, errors: errors, warnings: warnings };
@@ -133,9 +133,9 @@ function generateColorPalette(count, baseHue) {
133
133
  function getContrastColor(backgroundColor) {
134
134
  // Convert hex to RGB
135
135
  var hex = backgroundColor.replace('#', '');
136
- var r = parseInt(hex.substr(0, 2), 16);
137
- var g = parseInt(hex.substr(2, 2), 16);
138
- var b = parseInt(hex.substr(4, 2), 16);
136
+ var r = parseInt(hex.substring(0, 2), 16);
137
+ var g = parseInt(hex.substring(2, 2), 16);
138
+ var b = parseInt(hex.substring(4, 2), 16);
139
139
  // Calculate luminance
140
140
  var luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
141
141
  return luminance > 0.5 ? '#000000' : '#ffffff';
@@ -153,20 +153,20 @@ var getColorValue = function (colorClass) {
153
153
  // Map to CSS variables that actually exist in global.css
154
154
  var colorMap = {
155
155
  // Primary colors (exists)
156
- 'primary': 'var(--color-primary-base)',
156
+ 'primary': 'var(--color-primary)',
157
157
  // Warning/Yellow colors (exists)
158
- 'warning': 'var(--color-warning-base)',
158
+ 'warning': 'var(--color-warning)',
159
159
  // Success/Green colors (exists)
160
- 'success': 'var(--color-success-base)',
160
+ 'success': 'var(--color-success)',
161
161
  // Error/Danger/Red colors (exists as danger)
162
- 'error': 'var(--color-danger-base)', // Map error to danger
163
- 'danger': 'var(--color-danger-base)',
162
+ 'error': 'var(--color-danger)', // Map error to danger
163
+ 'danger': 'var(--color-danger)',
164
164
  // Fallbacks for colors that don't exist in CSS - use primary as fallback
165
- 'info': 'var(--color-primary-base)', // Fallback to primary
166
- 'secondary': 'var(--color-primary-base)', // Fallback to primary
165
+ 'info': 'var(--color-primary)', // Fallback to primary
166
+ 'secondary': 'var(--color-primary)', // Fallback to primary
167
167
  // Neutral colors - fallback to primary
168
- 'neutral': 'var(--color-primary-base)',
169
- 'slate': 'var(--color-primary-base)',
168
+ 'neutral': 'var(--color-primary)',
169
+ 'slate': 'var(--color-primary)',
170
170
  };
171
171
  // Return the CSS variable directly
172
172
  return colorMap[normalizedClass] || colorMap['primary'];
@@ -3,7 +3,7 @@
3
3
  */
4
4
  var avatarTheme = {
5
5
  // Base styles for the avatar element
6
- baseStyle: 'relative inline-flex items-center justify-center overflow-hidden bg-neutral-200 text-text-primary font-semibold tracking-tighter rounded-[var(--avatar-rounded)] ring-2 ring-[var(--color-primary)]/10 border border-white transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2',
6
+ baseStyle: 'relative inline-flex items-center justify-center overflow-hidden bg-neutral-200 text-[var(--color-text-primary)] font-semibold tracking-tighter rounded-[var(--avatar-rounded)] ring-2 ring-[var(--color-primary)]/10 border border-white transition-all duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)] focus-visible:ring-offset-2',
7
7
  // Size variants using CSS variables
8
8
  sizes: {
9
9
  xs: 'size-[var(--avatar-size-xs)] text-[var(--avatar-text-xs)]',