funuicss 3.6.20 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ui/chart/Line.js CHANGED
@@ -11,55 +11,353 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
17
47
  Object.defineProperty(exports, "__esModule", { value: true });
18
- var react_1 = __importDefault(require("react"));
48
+ var react_1 = __importStar(require("react"));
19
49
  var recharts_1 = require("recharts");
20
- // CSS var resolver
50
+ var componentUtils_1 = require("../../utils/componentUtils");
51
+ // Parse string to object utility with enhanced error handling
52
+ var parseIfString = function (value, fallback) {
53
+ if (typeof value === 'string') {
54
+ try {
55
+ var parsed = JSON.parse(value);
56
+ // Additional validation for arrays
57
+ if (Array.isArray(fallback) && !Array.isArray(parsed)) {
58
+ console.warn('Parsed value is not an array, using fallback');
59
+ return fallback;
60
+ }
61
+ return parsed;
62
+ }
63
+ catch (error) {
64
+ console.error('Failed to parse JSON string:', error);
65
+ return fallback;
66
+ }
67
+ }
68
+ // Handle null/undefined values
69
+ if (value == null) {
70
+ return fallback;
71
+ }
72
+ return value;
73
+ };
74
+ // Safe array access utility
75
+ var getSafeArray = function (value, fallback) {
76
+ if (fallback === void 0) { fallback = []; }
77
+ if (!value || !Array.isArray(value))
78
+ return fallback;
79
+ return value;
80
+ };
81
+ // CSS var resolver with error handling
21
82
  var getCssVar = function (varName) {
22
83
  var _a;
23
84
  if (typeof window === 'undefined')
24
85
  return '';
25
- return ((_a = getComputedStyle(document.documentElement).getPropertyValue("--".concat(varName))) === null || _a === void 0 ? void 0 : _a.trim()) || '';
86
+ try {
87
+ return ((_a = getComputedStyle(document.documentElement).getPropertyValue("--".concat(varName))) === null || _a === void 0 ? void 0 : _a.trim()) || '';
88
+ }
89
+ catch (error) {
90
+ console.warn("Failed to get CSS variable --".concat(varName, ":"), error);
91
+ return '';
92
+ }
26
93
  };
27
- // Color resolver
94
+ // Color resolver with fallbacks
28
95
  var resolveStrokeColor = function (color) {
29
96
  if (!color)
30
97
  return getCssVar('primary') || '#8884d8';
31
98
  if (color.startsWith('#'))
32
99
  return color;
33
- return getCssVar(color) || color;
100
+ var cssColor = getCssVar(color);
101
+ if (cssColor)
102
+ return cssColor;
103
+ // Fallback to common color names if CSS var not found
104
+ var colorMap = {
105
+ primary: '#8884d8',
106
+ secondary: '#82ca9d',
107
+ error: '#ff4d4f',
108
+ warning: '#faad14',
109
+ success: '#52c41a'
110
+ };
111
+ return colorMap[color] || color || '#8884d8';
34
112
  };
35
- // Tooltip
113
+ // Default Tooltip with error handling
36
114
  var CustomTooltip = function (_a) {
37
- var active = _a.active, payload = _a.payload, label = _a.label;
38
- if (active && payload && payload.length) {
39
- return (react_1.default.createElement("div", { className: "dark raised round-edge p-2 text-sm" },
40
- react_1.default.createElement("div", { className: "text-bold" }, label),
41
- payload.map(function (entry, index) { return (react_1.default.createElement("div", { key: index, style: { lineHeight: 1 } },
42
- entry.name,
43
- ": ",
44
- react_1.default.createElement("span", { className: "font-semibold" }, entry.value))); })));
115
+ var active = _a.active, payload = _a.payload, label = _a.label, formatter = _a.formatter;
116
+ if (!active || !payload || !Array.isArray(payload) || payload.length === 0) {
117
+ return null;
118
+ }
119
+ try {
120
+ return (react_1.default.createElement("div", { className: "card raised round-edge p-2 text-sm", style: {
121
+ maxWidth: '300px'
122
+ } },
123
+ react_1.default.createElement("div", { className: "text-bold mb-1" }, label || 'N/A'),
124
+ payload.map(function (entry, index) {
125
+ if (!entry)
126
+ return null;
127
+ var value = formatter ? formatter(entry.value, entry.name, entry) : entry.value;
128
+ var displayValue = value != null ? value : 'N/A';
129
+ var displayName = entry.name || 'Unknown';
130
+ var displayColor = entry.color || '#8884d8';
131
+ return (react_1.default.createElement("div", { key: index, style: {
132
+ lineHeight: 1.4,
133
+ display: 'flex',
134
+ alignItems: 'center',
135
+ gap: '8px'
136
+ } },
137
+ react_1.default.createElement("div", { style: {
138
+ width: '12px',
139
+ height: '12px',
140
+ backgroundColor: displayColor,
141
+ borderRadius: '2px'
142
+ } }),
143
+ react_1.default.createElement("span", { style: { fontWeight: 500 } },
144
+ displayName,
145
+ ":"),
146
+ react_1.default.createElement("span", { style: { fontWeight: 600, color: 'var(--text-color, #1a202c)' } }, displayValue)));
147
+ })));
148
+ }
149
+ catch (error) {
150
+ console.error('Error rendering tooltip:', error);
151
+ return (react_1.default.createElement("div", { className: "card raised round-edge p-2 text-sm" },
152
+ react_1.default.createElement("div", { className: "text-error" }, "Error displaying tooltip")));
45
153
  }
46
- return null;
47
154
  };
48
155
  var Lines = function (_a) {
49
- var data = _a.data, id = _a.id, series = _a.series, fromColor = _a.fromColor, toColor = _a.toColor, dy = _a.dy, _b = _a.showGrid, showGrid = _b === void 0 ? true : _b, _c = _a.horizontalLines, horizontalLines = _c === void 0 ? false : _c, _d = _a.showLegend, showLegend = _d === void 0 ? true : _d, _e = _a.showXAxis, showXAxis = _e === void 0 ? true : _e, _f = _a.showYAxis, showYAxis = _f === void 0 ? false : _f, funcss = _a.funcss, _g = _a.curveType, curveType = _g === void 0 ? 'monotone' : _g, _h = _a.height, height = _h === void 0 ? "100%" : _h, _j = _a.width, width = _j === void 0 ? '100%' : _j, _k = _a.margin, margin = _k === void 0 ? { top: 10, right: 30, left: 0, bottom: 20 } : _k, _l = _a.xAxisProps, xAxisProps = _l === void 0 ? {} : _l, _m = _a.yAxisProps, yAxisProps = _m === void 0 ? {} : _m, tooltipFormatter = _a.tooltipFormatter, _o = _a.legendProps, legendProps = _o === void 0 ? {} : _o, rotateLabel = _a.rotateLabel, xLabelSize = _a.xLabelSize, yLabelSize = _a.yLabelSize, xInterval = _a.xInterval, yInterval = _a.yInterval;
50
- var gradientId = id || 'colorUv';
51
- return (react_1.default.createElement(recharts_1.ResponsiveContainer, { width: width, height: height, className: funcss },
52
- react_1.default.createElement(recharts_1.AreaChart, { data: data, margin: margin },
156
+ var _b, _c;
157
+ var data = _a.data, id = _a.id, series = _a.series, fromColor = _a.fromColor, toColor = _a.toColor, dy = _a.dy, _d = _a.showGrid, showGrid = _d === void 0 ? true : _d, _e = _a.horizontalLines, horizontalLines = _e === void 0 ? false : _e, _f = _a.showLegend, showLegend = _f === void 0 ? true : _f, _g = _a.showXAxis, showXAxis = _g === void 0 ? true : _g, _h = _a.showYAxis, showYAxis = _h === void 0 ? false : _h, _j = _a.showTooltip, showTooltip = _j === void 0 ? true : _j, funcss = _a.funcss, _k = _a.curveType, curveType = _k === void 0 ? 'monotone' : _k, _l = _a.height, height = _l === void 0 ? "100%" : _l, _m = _a.width, width = _m === void 0 ? '100%' : _m, _o = _a.margin, margin = _o === void 0 ? { top: 10, right: 30, left: 0, bottom: 20 } : _o, _p = _a.xAxisProps, xAxisProps = _p === void 0 ? {} : _p, _q = _a.yAxisProps, yAxisProps = _q === void 0 ? {} : _q, tooltipFormatter = _a.tooltipFormatter, _r = _a.legendProps, legendProps = _r === void 0 ? {} : _r, _s = _a.tooltipProps, tooltipProps = _s === void 0 ? {} : _s, rotateLabel = _a.rotateLabel, xLabelSize = _a.xLabelSize, yLabelSize = _a.yLabelSize, xInterval = _a.xInterval, yInterval = _a.yInterval, _t = _a.variant, variant = _t === void 0 ? '' : _t, xAxisLabel = _a.xAxisLabel, yAxisLabel = _a.yAxisLabel, _u = _a.tickLine, tickLine = _u === void 0 ? true : _u, _v = _a.axisLine, axisLine = _v === void 0 ? true : _v, gridStroke = _a.gridStroke, _w = _a.gridStrokeDasharray, gridStrokeDasharray = _w === void 0 ? "3 3" : _w, customTooltip = _a.customTooltip, _x = _a.animation, animation = _x === void 0 ? true : _x, _y = _a.animationDuration, animationDuration = _y === void 0 ? 500 : _y, _z = _a.isAnimationActive, isAnimationActive = _z === void 0 ? true : _z, syncId = _a.syncId, chartBackground = _a.chartBackground, borderRadius = _a.borderRadius, padding = _a.padding, _0 = _a.shadow, shadow = _0 === void 0 ? false : _0, aspect = _a.aspect, minHeight = _a.minHeight, maxHeight = _a.maxHeight, minWidth = _a.minWidth, maxWidth = _a.maxWidth;
158
+ // Use component configuration with variant support and error handling
159
+ var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('AreaChart', variant).mergeWithLocal;
160
+ // Create local props object with null checks
161
+ var localProps = {
162
+ data: data !== null && data !== void 0 ? data : [],
163
+ id: id !== null && id !== void 0 ? id : '',
164
+ series: series !== null && series !== void 0 ? series : [],
165
+ fromColor: fromColor !== null && fromColor !== void 0 ? fromColor : '',
166
+ toColor: toColor !== null && toColor !== void 0 ? toColor : '',
167
+ dy: dy !== null && dy !== void 0 ? dy : 0,
168
+ showGrid: showGrid !== null && showGrid !== void 0 ? showGrid : true,
169
+ horizontalLines: horizontalLines !== null && horizontalLines !== void 0 ? horizontalLines : false,
170
+ showLegend: showLegend !== null && showLegend !== void 0 ? showLegend : true,
171
+ showXAxis: showXAxis !== null && showXAxis !== void 0 ? showXAxis : true,
172
+ showYAxis: showYAxis !== null && showYAxis !== void 0 ? showYAxis : false,
173
+ showTooltip: showTooltip !== null && showTooltip !== void 0 ? showTooltip : true,
174
+ funcss: funcss !== null && funcss !== void 0 ? funcss : '',
175
+ curveType: curveType !== null && curveType !== void 0 ? curveType : 'monotone',
176
+ height: height !== null && height !== void 0 ? height : "100%",
177
+ width: width !== null && width !== void 0 ? width : '100%',
178
+ margin: margin !== null && margin !== void 0 ? margin : { top: 10, right: 30, left: 0, bottom: 20 },
179
+ xAxisProps: xAxisProps !== null && xAxisProps !== void 0 ? xAxisProps : {},
180
+ yAxisProps: yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {},
181
+ tooltipFormatter: tooltipFormatter !== null && tooltipFormatter !== void 0 ? tooltipFormatter : undefined,
182
+ legendProps: legendProps !== null && legendProps !== void 0 ? legendProps : {},
183
+ tooltipProps: tooltipProps !== null && tooltipProps !== void 0 ? tooltipProps : {},
184
+ rotateLabel: rotateLabel !== null && rotateLabel !== void 0 ? rotateLabel : 0,
185
+ xLabelSize: xLabelSize !== null && xLabelSize !== void 0 ? xLabelSize : "0.8rem",
186
+ yLabelSize: yLabelSize !== null && yLabelSize !== void 0 ? yLabelSize : "0.8rem",
187
+ xInterval: xInterval !== null && xInterval !== void 0 ? xInterval : undefined,
188
+ yInterval: yInterval !== null && yInterval !== void 0 ? yInterval : undefined,
189
+ xAxisLabel: xAxisLabel !== null && xAxisLabel !== void 0 ? xAxisLabel : '',
190
+ yAxisLabel: yAxisLabel !== null && yAxisLabel !== void 0 ? yAxisLabel : '',
191
+ tickLine: tickLine !== null && tickLine !== void 0 ? tickLine : true,
192
+ axisLine: axisLine !== null && axisLine !== void 0 ? axisLine : true,
193
+ gridStroke: gridStroke !== null && gridStroke !== void 0 ? gridStroke : '',
194
+ gridStrokeDasharray: gridStrokeDasharray !== null && gridStrokeDasharray !== void 0 ? gridStrokeDasharray : "3 3",
195
+ customTooltip: customTooltip !== null && customTooltip !== void 0 ? customTooltip : undefined,
196
+ animation: animation !== null && animation !== void 0 ? animation : true,
197
+ animationDuration: animationDuration !== null && animationDuration !== void 0 ? animationDuration : 500,
198
+ isAnimationActive: isAnimationActive !== null && isAnimationActive !== void 0 ? isAnimationActive : true,
199
+ syncId: syncId !== null && syncId !== void 0 ? syncId : '',
200
+ chartBackground: chartBackground !== null && chartBackground !== void 0 ? chartBackground : '',
201
+ borderRadius: borderRadius !== null && borderRadius !== void 0 ? borderRadius : '',
202
+ padding: padding !== null && padding !== void 0 ? padding : '',
203
+ shadow: shadow !== null && shadow !== void 0 ? shadow : false,
204
+ aspect: aspect !== null && aspect !== void 0 ? aspect : undefined,
205
+ minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : undefined,
206
+ maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
207
+ minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : undefined,
208
+ maxWidth: maxWidth !== null && maxWidth !== void 0 ? maxWidth : undefined
209
+ };
210
+ // Merge with config - LOCAL PROPS OVERRIDE CONFIG with error handling
211
+ var mergedProps;
212
+ try {
213
+ var result = mergeWithLocal(localProps);
214
+ mergedProps = (_b = result === null || result === void 0 ? void 0 : result.props) !== null && _b !== void 0 ? _b : localProps;
215
+ }
216
+ catch (error) {
217
+ console.error('Error merging component configuration:', error);
218
+ mergedProps = localProps;
219
+ }
220
+ // Parse data and series if they're strings with enhanced validation
221
+ var parsedData = (0, react_1.useMemo)(function () {
222
+ var parsed = parseIfString(mergedProps.data, []);
223
+ return getSafeArray(parsed);
224
+ }, [mergedProps.data]);
225
+ var parsedSeries = (0, react_1.useMemo)(function () {
226
+ var parsed = parseIfString(mergedProps.series, []);
227
+ return getSafeArray(parsed).filter(function (series) {
228
+ return series && typeof series === 'object' && series.dataKey;
229
+ });
230
+ }, [mergedProps.series]);
231
+ // Check if we have valid data to display
232
+ var hasValidData = parsedData.length > 0 && parsedSeries.length > 0;
233
+ // Extract final values with fallbacks
234
+ var final = (0, react_1.useMemo)(function () {
235
+ var _a, _b, _c, _d, _e, _f;
236
+ return ({
237
+ data: parsedData,
238
+ id: mergedProps.id || 'area-chart',
239
+ series: parsedSeries,
240
+ fromColor: mergedProps.fromColor || '',
241
+ toColor: mergedProps.toColor || '',
242
+ dy: mergedProps.dy || 0,
243
+ showGrid: (_a = mergedProps.showGrid) !== null && _a !== void 0 ? _a : true,
244
+ horizontalLines: (_b = mergedProps.horizontalLines) !== null && _b !== void 0 ? _b : false,
245
+ showLegend: mergedProps.showLegend,
246
+ showXAxis: mergedProps.showXAxis,
247
+ showYAxis: mergedProps.showYAxis,
248
+ showTooltip: mergedProps.showTooltip,
249
+ funcss: mergedProps.funcss || '',
250
+ curveType: mergedProps.curveType || 'monotone',
251
+ height: mergedProps.height || "100%",
252
+ width: mergedProps.width || '100%',
253
+ margin: mergedProps.margin || { top: 10, right: 30, left: 0, bottom: 20 },
254
+ xAxisProps: mergedProps.xAxisProps || {},
255
+ yAxisProps: mergedProps.yAxisProps || {},
256
+ tooltipFormatter: mergedProps.tooltipFormatter,
257
+ legendProps: mergedProps.legendProps || {},
258
+ tooltipProps: mergedProps.tooltipProps || {},
259
+ rotateLabel: mergedProps.rotateLabel || 0,
260
+ xLabelSize: mergedProps.xLabelSize || "0.8rem",
261
+ yLabelSize: mergedProps.yLabelSize || "0.8rem",
262
+ xInterval: mergedProps.xInterval,
263
+ yInterval: mergedProps.yInterval,
264
+ xAxisLabel: mergedProps.xAxisLabel || '',
265
+ yAxisLabel: mergedProps.yAxisLabel || '',
266
+ tickLine: (_c = mergedProps.tickLine) !== null && _c !== void 0 ? _c : true,
267
+ axisLine: (_d = mergedProps.axisLine) !== null && _d !== void 0 ? _d : true,
268
+ gridStroke: mergedProps.gridStroke || '',
269
+ gridStrokeDasharray: mergedProps.gridStrokeDasharray || "3 3",
270
+ customTooltip: mergedProps.customTooltip,
271
+ animation: (_e = mergedProps.animation) !== null && _e !== void 0 ? _e : true,
272
+ animationDuration: mergedProps.animationDuration || 500,
273
+ isAnimationActive: mergedProps.isAnimationActive,
274
+ syncId: mergedProps.syncId || '',
275
+ chartBackground: mergedProps.chartBackground || '',
276
+ borderRadius: mergedProps.borderRadius || '',
277
+ padding: mergedProps.padding || '',
278
+ shadow: (_f = mergedProps.shadow) !== null && _f !== void 0 ? _f : false,
279
+ aspect: mergedProps.aspect,
280
+ minHeight: mergedProps.minHeight,
281
+ maxHeight: mergedProps.maxHeight,
282
+ minWidth: mergedProps.minWidth,
283
+ maxWidth: mergedProps.maxWidth
284
+ });
285
+ }, [parsedData, parsedSeries, mergedProps, hasValidData]);
286
+ var baseGradientId = final.id || 'areaChartGradient';
287
+ var TooltipComponent = final.customTooltip || CustomTooltip;
288
+ // Generate per-series gradients with error handling
289
+ var gradients = (0, react_1.useMemo)(function () {
290
+ if (!final.series || !Array.isArray(final.series))
291
+ return [];
292
+ return final.series.map(function (s, index) {
293
+ if (!s || typeof s !== 'object')
294
+ return null;
295
+ try {
296
+ if (!s.fromColor && !s.toColor)
297
+ return null;
298
+ var gradientId = "".concat(baseGradientId, "-").concat(index);
299
+ var startColor = resolveStrokeColor(s.fromColor || s.color || final.fromColor);
300
+ var endColor = resolveStrokeColor(s.toColor || final.toColor);
301
+ return (react_1.default.createElement("linearGradient", { key: gradientId, id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1" },
302
+ react_1.default.createElement("stop", { offset: "5%", stopColor: startColor, stopOpacity: 0.8 }),
303
+ react_1.default.createElement("stop", { offset: "95%", stopColor: endColor, stopOpacity: 0 })));
304
+ }
305
+ catch (error) {
306
+ console.error('Error generating gradient for series:', error);
307
+ return null;
308
+ }
309
+ }).filter(Boolean);
310
+ }, [final.series, baseGradientId, final.fromColor, final.toColor]);
311
+ // Default gradient for series without custom gradients
312
+ var defaultGradient = (0, react_1.useMemo)(function () { return (react_1.default.createElement("linearGradient", { id: baseGradientId, x1: "0", y1: "0", x2: "0", y2: "1" },
313
+ react_1.default.createElement("stop", { offset: "5%", stopColor: getCssVar(final.fromColor || 'primary') || '#8884d8', stopOpacity: 0.8 }),
314
+ react_1.default.createElement("stop", { offset: "95%", stopColor: getCssVar(final.toColor || 'primary200') || '#8884d8', stopOpacity: 0 }))); }, [baseGradientId, final.fromColor, final.toColor]);
315
+ var containerStyle = (0, react_1.useMemo)(function () { return ({
316
+ height: final.height,
317
+ width: final.width,
318
+ minHeight: final.minHeight,
319
+ maxHeight: final.maxHeight,
320
+ minWidth: final.minWidth,
321
+ maxWidth: final.maxWidth,
322
+ background: final.chartBackground,
323
+ borderRadius: final.borderRadius,
324
+ padding: final.padding,
325
+ boxShadow: final.shadow ? '0 4px 6px -1px rgba(0, 0, 0, 0.1)' : undefined,
326
+ }); }, [final]);
327
+ // Show empty state if no data
328
+ if (!hasValidData) {
329
+ return (react_1.default.createElement("div", { className: "flex items-center justify-center ".concat(final.funcss), style: containerStyle },
330
+ react_1.default.createElement("div", { className: "text-center text-muted" },
331
+ react_1.default.createElement("div", { className: "text-lg mb-2" }, "\uD83D\uDCCA"),
332
+ react_1.default.createElement("div", null, "No chart data available"))));
333
+ }
334
+ return (react_1.default.createElement(recharts_1.ResponsiveContainer, { width: final.width, height: final.height, aspect: final.aspect, className: final.funcss, style: containerStyle },
335
+ react_1.default.createElement(recharts_1.AreaChart, { data: final.data, margin: final.margin, syncId: final.syncId },
53
336
  react_1.default.createElement("defs", null,
54
- react_1.default.createElement("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1" },
55
- react_1.default.createElement("stop", { offset: "5%", stopColor: getCssVar(fromColor || 'primary'), stopOpacity: 0.8 }),
56
- react_1.default.createElement("stop", { offset: "95%", stopColor: getCssVar(toColor || 'primary200'), stopOpacity: 0 }))),
57
- showGrid && react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: "3 3" }),
58
- !showGrid && horizontalLines && (react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: "3 3", horizontal: true, vertical: false })),
59
- showXAxis && (react_1.default.createElement(recharts_1.XAxis, __assign({ interval: xInterval || 0, padding: { left: 10, right: 10 }, fontSize: xLabelSize || "0.8rem", strokeWidth: horizontalLines ? 0 : 0.2, dataKey: "label", angle: rotateLabel || -35, dy: dy !== null && dy !== void 0 ? dy : 10 }, xAxisProps))),
60
- showYAxis && (react_1.default.createElement(recharts_1.YAxis, __assign({ interval: yInterval || 0, strokeWidth: horizontalLines ? 0 : 0.2, fontSize: yLabelSize || "0.8rem" }, yAxisProps))),
61
- react_1.default.createElement(recharts_1.Tooltip, { content: react_1.default.createElement(CustomTooltip, null), formatter: tooltipFormatter }),
62
- showLegend && react_1.default.createElement(recharts_1.Legend, __assign({}, legendProps)),
63
- series.map(function (s, index) { return (react_1.default.createElement(recharts_1.Area, { key: s.dataKey, type: curveType, dataKey: s.dataKey, name: s.label || s.dataKey, stroke: resolveStrokeColor(s.color), fill: "url(#".concat(gradientId, ")"), fillOpacity: 1, strokeWidth: s.strokeWidth || 2, dot: s.dot !== false ? { r: 4 } : false, activeDot: { r: 8 } })); }))));
337
+ defaultGradient,
338
+ gradients),
339
+ final.showGrid && (react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: final.gridStrokeDasharray, stroke: final.gridStroke || getCssVar('border-color') || '#e2e8f0' })),
340
+ !final.showGrid && final.horizontalLines && (react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: final.gridStrokeDasharray, horizontal: true, vertical: false, stroke: final.gridStroke || getCssVar('border-color') || '#e2e8f0' })),
341
+ final.showXAxis && (react_1.default.createElement(recharts_1.XAxis, __assign({ interval: final.xInterval, padding: { left: 10, right: 10 }, fontSize: final.xLabelSize || "0.8rem", strokeWidth: final.horizontalLines ? 0 : 0.2, dataKey: "label", angle: final.rotateLabel || -35, dy: (_c = final.dy) !== null && _c !== void 0 ? _c : 10, tickLine: final.tickLine, axisLine: final.axisLine, label: final.xAxisLabel ? { value: final.xAxisLabel, position: 'insideBottom', offset: -10 } : undefined }, final.xAxisProps))),
342
+ final.showYAxis && (react_1.default.createElement(recharts_1.YAxis, __assign({ interval: final.yInterval, strokeWidth: final.horizontalLines ? 0 : 0.2, fontSize: final.yLabelSize || "0.8rem", tickLine: final.tickLine, axisLine: final.axisLine, label: final.yAxisLabel ? { value: final.yAxisLabel, angle: -90, position: 'insideLeft' } : undefined }, final.yAxisProps))),
343
+ final.showTooltip && (react_1.default.createElement(recharts_1.Tooltip, __assign({ content: react_1.default.createElement(TooltipComponent, { formatter: final.tooltipFormatter }), formatter: final.tooltipFormatter }, final.tooltipProps))),
344
+ final.showLegend && react_1.default.createElement(recharts_1.Legend, __assign({}, final.legendProps)),
345
+ final.series.map(function (s, index) {
346
+ if (!s || !s.dataKey) {
347
+ console.warn('Invalid series configuration at index:', index);
348
+ return null;
349
+ }
350
+ try {
351
+ var hasCustomGradient = s.fromColor || s.toColor;
352
+ var gradientId = hasCustomGradient
353
+ ? "".concat(baseGradientId, "-").concat(index)
354
+ : baseGradientId;
355
+ return (react_1.default.createElement(recharts_1.Area, { key: s.dataKey || "series-".concat(index), type: final.curveType, dataKey: s.dataKey, name: s.label || s.dataKey, stroke: resolveStrokeColor(s.color), fill: hasCustomGradient || final.fromColor ? "url(#".concat(gradientId, ")") : resolveStrokeColor(s.color), fillOpacity: s.fillOpacity !== undefined ? s.fillOpacity : 0.6, strokeWidth: s.strokeWidth || 2, strokeDasharray: s.strokeDasharray, dot: s.dot !== false ? { r: 4 } : false, activeDot: s.activeDot !== false ? (typeof s.activeDot === 'object' ? s.activeDot : { r: 6, strokeWidth: 2 }) : false, isAnimationActive: final.isAnimationActive, animationDuration: final.animationDuration }));
356
+ }
357
+ catch (error) {
358
+ console.error('Error rendering area series:', error);
359
+ return null;
360
+ }
361
+ }))));
64
362
  };
65
363
  exports.default = Lines;
package/ui/input/Input.js CHANGED
@@ -75,14 +75,16 @@ var statusIcons = {
75
75
  };
76
76
  // Utility function to generate CSS classes
77
77
  var generateInputClasses = function (_a) {
78
- var status = _a.status, rounded = _a.rounded, bg = _a.bg, funcss = _a.funcss, flat = _a.flat, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, bordered = _a.bordered, borderless = _a.borderless, _b = _a.additionalClasses, additionalClasses = _b === void 0 ? '' : _b;
78
+ var status = _a.status, rounded = _a.rounded, bg = _a.bg, funcss = _a.funcss, flat = _a.flat, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, bordered = _a.bordered, borderless = _a.borderless, _b = _a.additionalClasses, additionalClasses = _b === void 0 ? '' : _b, _c = _a.hasNoPrefix, hasNoPrefix = _c === void 0 ? false : _c, _d = _a.hasNoLabel, hasNoLabel = _d === void 0 ? false : _d;
79
79
  var statusClass = status ? "".concat(status, "-input") : '';
80
80
  var roundedClass = rounded ? 'rounded' : '';
81
81
  var bgClass = bg || '';
82
82
  var flatClass = flat ? 'flat' : '';
83
83
  var cornerClass = leftRounded ? 'leftRounded' : rightRounded ? 'rightRounded' : '';
84
84
  var borderClass = bordered ? 'borderedInput' : borderless ? 'borderless' : (!bordered && !borderless ? 'borderedInput' : '');
85
- return "\n ".concat(statusClass, "\n ").concat(roundedClass, "\n ").concat(bgClass, "\n ").concat(funcss || '', "\n ").concat(flatClass, "\n ").concat(cornerClass, "\n ").concat(borderClass, "\n ").concat(additionalClasses, "\n input\n ").trim().replace(/\s+/g, ' ');
85
+ var noPrefixClass = hasNoPrefix ? 'no_prefix' : '';
86
+ var noLabelClass = hasNoLabel ? 'no_label' : '';
87
+ return "\n ".concat(statusClass, "\n ").concat(roundedClass, "\n ").concat(bgClass, "\n ").concat(funcss || '', "\n ").concat(flatClass, "\n ").concat(cornerClass, "\n ").concat(borderClass, "\n ").concat(additionalClasses, "\n ").concat(noPrefixClass, "\n ").concat(noLabelClass, "\n input\n ").trim().replace(/\s+/g, ' ');
86
88
  };
87
89
  // Iconic Input Wrapper Component
88
90
  var IconicInputWrapper = function (_a) {
@@ -102,8 +104,9 @@ var IconicInputWrapper = function (_a) {
102
104
  };
103
105
  // Input Container with Floating Label
104
106
  var InputContainer = function (_a) {
105
- var label = _a.label, status = _a.status, helperText = _a.helperText, children = _a.children, isFocused = _a.isFocused, hasValue = _a.hasValue, fullWidth = _a.fullWidth, id = _a.id, startIcon = _a.startIcon, prefix = _a.prefix;
106
- var showFloatingLabel = label && (isFocused || hasValue);
107
+ var label = _a.label, status = _a.status, helperText = _a.helperText, children = _a.children, isFocused = _a.isFocused, hasValue = _a.hasValue, fullWidth = _a.fullWidth, id = _a.id, startIcon = _a.startIcon, prefix = _a.prefix, _b = _a.isSelect, isSelect = _b === void 0 ? false : _b;
108
+ // For select inputs, label is always active
109
+ var showFloatingLabel = label && (isSelect || isFocused || hasValue);
107
110
  return (react_1.default.createElement("div", { className: "input-wrapper ".concat(fullWidth ? 'full-width' : '') },
108
111
  react_1.default.createElement("div", { className: "input-container-with-label" },
109
112
  label && (react_1.default.createElement("label", { htmlFor: id, className: "floating-label ".concat(startIcon || prefix ? "label-left" : "", " ").concat(showFloatingLabel ? 'active' : '', " ").concat(status ? "label-".concat(status) : '') }, label)),
@@ -194,6 +197,13 @@ var TextInput = function (_a) {
194
197
  }
195
198
  }, [final.stringSuffix]);
196
199
  var themeVariant = (0, theme_1.useVariant)().variant;
200
+ // Determine effective icons: stringPrefix/stringSuffix take priority, then local, then config
201
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
202
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
203
+ // Check if there's no start icon or prefix
204
+ var hasNoPrefix = !effectivePrefix;
205
+ // Check if there's no label
206
+ var hasNoLabel = !label;
197
207
  var className = generateInputClasses({
198
208
  status: final.status,
199
209
  rounded: final.rounded,
@@ -204,6 +214,8 @@ var TextInput = function (_a) {
204
214
  rightRounded: final.rightRounded,
205
215
  bordered: final.bordered,
206
216
  borderless: final.borderless,
217
+ hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
218
+ hasNoLabel: hasNoLabel,
207
219
  });
208
220
  var style = final.fullWidth ? { width: '100%' } : undefined;
209
221
  var handleChange = function (e) {
@@ -222,9 +234,6 @@ var TextInput = function (_a) {
222
234
  if (rest.onBlur)
223
235
  rest.onBlur(e);
224
236
  };
225
- // Determine effective icons: stringPrefix/stringSuffix take priority, then local, then config
226
- var effectivePrefix = prefixNode || final.prefix || final.startIcon;
227
- var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
228
237
  // Show placeholder only when label is active (focused or has value)
229
238
  var showPlaceholder = placeholder && label && (isFocused || !!inputValue);
230
239
  var inputElement = (react_1.default.createElement("input", __assign({ ref: inputRef, id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, type: type, placeholder: showPlaceholder ? placeholder : (!label ? placeholder : ''), style: style, value: inputValue }, rest)));
@@ -314,6 +323,13 @@ var SelectInput = function (_a) {
314
323
  }, [final.stringSuffix]);
315
324
  var selectHasValue = !!selectValue;
316
325
  var themeVariant = (0, theme_1.useVariant)().variant;
326
+ // Determine effective icons
327
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
328
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
329
+ // Check if there's no start icon or prefix
330
+ var hasNoPrefix = !effectivePrefix;
331
+ // Check if there's no label
332
+ var hasNoLabel = !label;
317
333
  var className = generateInputClasses({
318
334
  status: final.status,
319
335
  rounded: final.rounded,
@@ -324,6 +340,8 @@ var SelectInput = function (_a) {
324
340
  rightRounded: final.rightRounded,
325
341
  bordered: final.bordered,
326
342
  borderless: final.borderless,
343
+ hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
344
+ hasNoLabel: hasNoLabel,
327
345
  });
328
346
  var style = final.fullWidth ? { width: '100%' } : undefined;
329
347
  var handleChange = function (e) {
@@ -342,11 +360,9 @@ var SelectInput = function (_a) {
342
360
  if (rest.onBlur)
343
361
  rest.onBlur(e);
344
362
  };
345
- var effectivePrefix = prefixNode || final.prefix || final.startIcon;
346
- var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
347
363
  var selectElement = (react_1.default.createElement("select", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, value: selectValue, style: style }, rest), options.map(function (option) { return (react_1.default.createElement("option", { key: option.value, value: option.value }, option.text)); })));
348
364
  var wrappedSelect = (react_1.default.createElement(IconicInputWrapper, { startIcon: effectivePrefix, endIcon: effectiveSuffix, iconicBg: final.iconicBg, funcss: final.funcss }, selectElement));
349
- return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: final.fullWidth, id: id }, wrappedSelect));
365
+ return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: selectHasValue, fullWidth: final.fullWidth, id: id, isSelect: true }, wrappedSelect));
350
366
  };
351
367
  exports.SelectInput = SelectInput;
352
368
  // Textarea Component
@@ -430,6 +446,13 @@ var TextareaInput = function (_a) {
430
446
  }
431
447
  }, [final.stringSuffix]);
432
448
  var themeVariant = (0, theme_1.useVariant)().variant;
449
+ // Determine effective icons
450
+ var effectivePrefix = prefixNode || final.prefix || final.startIcon;
451
+ var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
452
+ // Check if there's no start icon or prefix
453
+ var hasNoPrefix = !effectivePrefix;
454
+ // Check if there's no label
455
+ var hasNoLabel = !label;
433
456
  var className = generateInputClasses({
434
457
  status: final.status,
435
458
  rounded: final.rounded,
@@ -440,6 +463,8 @@ var TextareaInput = function (_a) {
440
463
  rightRounded: final.rightRounded,
441
464
  bordered: final.bordered,
442
465
  borderless: final.borderless,
466
+ hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
467
+ hasNoLabel: hasNoLabel,
443
468
  });
444
469
  var style = final.fullWidth ? { width: '100%' } : undefined;
445
470
  var handleChange = function (e) {
@@ -458,8 +483,6 @@ var TextareaInput = function (_a) {
458
483
  if (rest.onBlur)
459
484
  rest.onBlur(e);
460
485
  };
461
- var effectivePrefix = prefixNode || final.prefix || final.startIcon;
462
- var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
463
486
  // Show placeholder only when label is active (focused or has value)
464
487
  var showPlaceholder = placeholder && label && (isFocused || !!textValue);
465
488
  var textareaElement = (react_1.default.createElement("textarea", __assign({ id: id, name: name, className: className, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur, defaultValue: defaultValue, placeholder: showPlaceholder ? placeholder : (!label ? placeholder : ''), style: style, value: textValue, rows: rows }, rest)));
@@ -467,7 +490,7 @@ var TextareaInput = function (_a) {
467
490
  return (react_1.default.createElement(InputContainer, { startIcon: effectivePrefix, label: label, status: final.status, helperText: helperText, isFocused: isFocused, hasValue: !!textValue, fullWidth: final.fullWidth, id: id }, wrappedTextarea));
468
491
  };
469
492
  exports.TextareaInput = TextareaInput;
470
- // File Input Component (unchanged as it doesn't have the same value issue)
493
+ // File Input Component (updated with no_prefix and no_label logic)
471
494
  var FileInput = function (_a) {
472
495
  var _b = _a.id, id = _b === void 0 ? 'fileInput' : _b, name = _a.name, onChange = _a.onChange, status = _a.status, funcss = _a.funcss, bg = _a.bg, fullWidth = _a.fullWidth, flat = _a.flat, rounded = _a.rounded, leftRounded = _a.leftRounded, rightRounded = _a.rightRounded, startIcon = _a.startIcon, endIcon = _a.endIcon, prefix = _a.prefix, suffix = _a.suffix, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, iconicBg = _a.iconicBg, _c = _a.label, label = _c === void 0 ? 'Upload File' : _c, helperText = _a.helperText, icon = _a.icon, extra = _a.extra, button = _a.button, btn = _a.btn, value = _a.value, _d = _a.variant, variant = _d === void 0 ? '' : _d, rest = __rest(_a, ["id", "name", "onChange", "status", "funcss", "bg", "fullWidth", "flat", "rounded", "leftRounded", "rightRounded", "startIcon", "endIcon", "prefix", "suffix", "stringPrefix", "stringSuffix", "iconicBg", "label", "helperText", "icon", "extra", "button", "btn", "value", "variant"]);
473
496
  var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
@@ -545,6 +568,10 @@ var FileInput = function (_a) {
545
568
  };
546
569
  var effectivePrefix = prefixNode || final.prefix || final.startIcon;
547
570
  var effectiveSuffix = suffixNode || final.suffix || final.endIcon;
571
+ // Check if there's no start icon or prefix
572
+ var hasNoPrefix = !effectivePrefix;
573
+ // Check if there's no label (file inputs typically don't have labels in the same way)
574
+ var hasNoLabel = true; // File inputs use their own label system
548
575
  if (btn) {
549
576
  var className = generateInputClasses({
550
577
  status: final.status,
@@ -556,7 +583,9 @@ var FileInput = function (_a) {
556
583
  rightRounded: final.rightRounded,
557
584
  bordered: true,
558
585
  borderless: false,
559
- additionalClasses: 'filedInput'
586
+ additionalClasses: 'filedInput',
587
+ hasNoPrefix: hasNoPrefix, // Add no_prefix class when no start icon/prefix
588
+ hasNoLabel: hasNoLabel,
560
589
  });
561
590
  var style = final.fullWidth ? { width: '100%' } : undefined;
562
591
  var fileInputElement = (react_1.default.createElement("div", { className: "fileInput" },
@@ -129,7 +129,7 @@ function SideBar(_a) {
129
129
  window.location.href = link.uri;
130
130
  }
131
131
  }, key: link.uri },
132
- react_1.default.createElement(Button_1.default, { fullWidth: true, small: true, funcss: "p-1 pl-2 pr-2 sidebar-link text-left ".concat(isActive ? "primary ".concat(activeCss || '') : 'hoverable'), startIcon: react_1.default.createElement("span", { className: "".concat(iconCSS || '', " \n ").concat((variant === 'standard' || popIcon) ? "p-1 ".concat(isActive ? "primary" : "lighter border", " central") : (variant === "minimal" && !isActive) ? "p-1 central lighter " : ""), style: { lineHeight: 0, borderRadius: "0.4rem" } }, link.icon) },
132
+ react_1.default.createElement(Button_1.default, { fullWidth: true, small: true, funcss: "p-1 pl-2 pr-2 sidebar-link text-left ".concat(isActive ? "primary ".concat(activeCss || '') : 'hoverable'), startIcon: react_1.default.createElement("span", { className: "".concat(iconCSS || '', " \n ").concat((variant === 'standard' || popIcon) ? "p-1 ".concat(isActive ? "primary" : "lighter text-primary border", " central") : (variant === "minimal" && !isActive) ? "p-1 central lighter text-primary" : ""), style: { lineHeight: 0, borderRadius: "0.4rem" } }, link.icon) },
133
133
  react_1.default.createElement(Text_1.default, { text: link.text, size: "sm", weight: 400 }))));
134
134
  })));
135
135
  }))),
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  type TableProps = {
3
3
  children?: React.ReactNode;
4
4
  funcss?: string;
5
+ trCss?: string;
5
6
  title?: string;
6
7
  bordered?: boolean;
7
8
  noStripped?: boolean;
@@ -40,5 +41,5 @@ type TableProps = {
40
41
  };
41
42
  export default function Table({ children, funcss, bordered, noStripped, hoverable, title, showTotal, light, dark, head, body, data, isLoading, right, hideExport, height, pageSize, // Default page size,
42
43
  customColumns, filterableFields, // New prop
43
- emptyResponse, filterOnchange, clearSearch, prioritizeSearchFields, onRowClick, ...rest }: TableProps): React.JSX.Element;
44
+ emptyResponse, filterOnchange, clearSearch, prioritizeSearchFields, onRowClick, trCss, ...rest }: TableProps): React.JSX.Element;
44
45
  export {};