funuicss 3.7.0 → 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/css/fun.css +11 -10
- package/package.json +1 -1
- package/ui/chart/Line.js +246 -149
- package/ui/input/Input.js +43 -14
- package/ui/table/Table.d.ts +2 -1
- package/ui/table/Table.js +14 -17
package/css/fun.css
CHANGED
|
@@ -2397,7 +2397,9 @@ border-radius: var(--borderRadius);
|
|
|
2397
2397
|
background-color: transparent;
|
|
2398
2398
|
}
|
|
2399
2399
|
|
|
2400
|
-
|
|
2400
|
+
.no_label{
|
|
2401
|
+
padding:var(--inputPadding) !important;
|
|
2402
|
+
}
|
|
2401
2403
|
/* Status Input Styles */
|
|
2402
2404
|
.input.success-input,
|
|
2403
2405
|
.input.warning-input,
|
|
@@ -3719,14 +3721,7 @@ padding-right: 2.5rem;
|
|
|
3719
3721
|
|
|
3720
3722
|
|
|
3721
3723
|
/* tables */
|
|
3722
|
-
|
|
3723
|
-
thead {
|
|
3724
|
-
border-bottom: var(--border);
|
|
3725
|
-
}
|
|
3726
|
-
.table thead > td,
|
|
3727
|
-
th {
|
|
3728
|
-
font-weight: bold;
|
|
3729
|
-
}
|
|
3724
|
+
|
|
3730
3725
|
.table , table {
|
|
3731
3726
|
width: 100%;
|
|
3732
3727
|
text-align: left;
|
|
@@ -3738,7 +3733,12 @@ th {
|
|
|
3738
3733
|
border: var(--border);
|
|
3739
3734
|
}
|
|
3740
3735
|
|
|
3741
|
-
|
|
3736
|
+
|
|
3737
|
+
th{font-weight: 400 !important; }
|
|
3738
|
+
thead{ background-color: var(--lighter); border-radius: var(--radius) !important;}
|
|
3739
|
+
|
|
3740
|
+
|
|
3741
|
+
.table.stripped tr:nth-child(odd) {
|
|
3742
3742
|
background-color: var(--lighter);
|
|
3743
3743
|
}
|
|
3744
3744
|
.table tr,
|
|
@@ -9755,3 +9755,4 @@ transform: translateY(-50%);
|
|
|
9755
9755
|
-webkit-background-clip: text;
|
|
9756
9756
|
}
|
|
9757
9757
|
|
|
9758
|
+
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.7.
|
|
2
|
+
"version": "3.7.1",
|
|
3
3
|
"name": "funuicss",
|
|
4
4
|
"description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
|
|
5
5
|
"main": "index.js",
|
package/ui/chart/Line.js
CHANGED
|
@@ -48,190 +48,270 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
var react_1 = __importStar(require("react"));
|
|
49
49
|
var recharts_1 = require("recharts");
|
|
50
50
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
51
|
-
// Parse string to object utility
|
|
51
|
+
// Parse string to object utility with enhanced error handling
|
|
52
52
|
var parseIfString = function (value, fallback) {
|
|
53
53
|
if (typeof value === 'string') {
|
|
54
54
|
try {
|
|
55
|
-
|
|
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;
|
|
56
62
|
}
|
|
57
63
|
catch (error) {
|
|
58
64
|
console.error('Failed to parse JSON string:', error);
|
|
59
65
|
return fallback;
|
|
60
66
|
}
|
|
61
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;
|
|
62
79
|
return value;
|
|
63
80
|
};
|
|
64
|
-
// CSS var resolver
|
|
81
|
+
// CSS var resolver with error handling
|
|
65
82
|
var getCssVar = function (varName) {
|
|
66
83
|
var _a;
|
|
67
84
|
if (typeof window === 'undefined')
|
|
68
85
|
return '';
|
|
69
|
-
|
|
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
|
+
}
|
|
70
93
|
};
|
|
71
|
-
// Color resolver
|
|
94
|
+
// Color resolver with fallbacks
|
|
72
95
|
var resolveStrokeColor = function (color) {
|
|
73
96
|
if (!color)
|
|
74
97
|
return getCssVar('primary') || '#8884d8';
|
|
75
98
|
if (color.startsWith('#'))
|
|
76
99
|
return color;
|
|
77
|
-
|
|
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';
|
|
78
112
|
};
|
|
79
|
-
// Default Tooltip
|
|
113
|
+
// Default Tooltip with error handling
|
|
80
114
|
var CustomTooltip = function (_a) {
|
|
81
115
|
var active = _a.active, payload = _a.payload, label = _a.label, formatter = _a.formatter;
|
|
82
|
-
if (active
|
|
116
|
+
if (!active || !payload || !Array.isArray(payload) || payload.length === 0) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
83
120
|
return (react_1.default.createElement("div", { className: "card raised round-edge p-2 text-sm", style: {
|
|
84
121
|
maxWidth: '300px'
|
|
85
122
|
} },
|
|
86
|
-
react_1.default.createElement("div", { className: "text-bold mb-1" }, label),
|
|
87
|
-
payload.map(function (entry, index) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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")));
|
|
103
153
|
}
|
|
104
|
-
return null;
|
|
105
154
|
};
|
|
106
155
|
var Lines = function (_a) {
|
|
107
|
-
var _b;
|
|
108
|
-
var data = _a.data, id = _a.id, series = _a.series, fromColor = _a.fromColor, toColor = _a.toColor, dy = _a.dy,
|
|
109
|
-
// Use component configuration with variant support
|
|
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
|
|
110
159
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('AreaChart', variant).mergeWithLocal;
|
|
111
|
-
// Create local props object
|
|
160
|
+
// Create local props object with null checks
|
|
112
161
|
var localProps = {
|
|
113
|
-
data: data,
|
|
114
|
-
id: id,
|
|
115
|
-
series: series,
|
|
116
|
-
fromColor: fromColor,
|
|
117
|
-
toColor: toColor,
|
|
118
|
-
dy: dy,
|
|
119
|
-
showGrid: showGrid,
|
|
120
|
-
horizontalLines: horizontalLines,
|
|
121
|
-
showLegend: showLegend,
|
|
122
|
-
showXAxis: showXAxis,
|
|
123
|
-
showYAxis: showYAxis,
|
|
124
|
-
showTooltip: showTooltip,
|
|
125
|
-
funcss: funcss,
|
|
126
|
-
curveType: curveType,
|
|
127
|
-
height: height,
|
|
128
|
-
width: width,
|
|
129
|
-
margin: margin,
|
|
130
|
-
xAxisProps: xAxisProps,
|
|
131
|
-
yAxisProps: yAxisProps,
|
|
132
|
-
tooltipFormatter: tooltipFormatter,
|
|
133
|
-
legendProps: legendProps,
|
|
134
|
-
tooltipProps: tooltipProps,
|
|
135
|
-
rotateLabel: rotateLabel,
|
|
136
|
-
xLabelSize: xLabelSize,
|
|
137
|
-
yLabelSize: yLabelSize,
|
|
138
|
-
xInterval: xInterval,
|
|
139
|
-
yInterval: yInterval,
|
|
140
|
-
xAxisLabel: xAxisLabel,
|
|
141
|
-
yAxisLabel: yAxisLabel,
|
|
142
|
-
tickLine: tickLine,
|
|
143
|
-
axisLine: axisLine,
|
|
144
|
-
gridStroke: gridStroke,
|
|
145
|
-
gridStrokeDasharray: gridStrokeDasharray,
|
|
146
|
-
customTooltip: customTooltip,
|
|
147
|
-
animation: animation,
|
|
148
|
-
animationDuration: animationDuration,
|
|
149
|
-
isAnimationActive: isAnimationActive,
|
|
150
|
-
syncId: syncId,
|
|
151
|
-
chartBackground: chartBackground,
|
|
152
|
-
borderRadius: borderRadius,
|
|
153
|
-
padding: padding,
|
|
154
|
-
shadow: shadow,
|
|
155
|
-
aspect: aspect,
|
|
156
|
-
minHeight: minHeight,
|
|
157
|
-
maxHeight: maxHeight,
|
|
158
|
-
minWidth: minWidth,
|
|
159
|
-
maxWidth: maxWidth
|
|
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
|
|
160
209
|
};
|
|
161
|
-
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
162
|
-
var mergedProps
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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]);
|
|
216
286
|
var baseGradientId = final.id || 'areaChartGradient';
|
|
217
287
|
var TooltipComponent = final.customTooltip || CustomTooltip;
|
|
218
|
-
// Generate per-series gradients
|
|
288
|
+
// Generate per-series gradients with error handling
|
|
219
289
|
var gradients = (0, react_1.useMemo)(function () {
|
|
290
|
+
if (!final.series || !Array.isArray(final.series))
|
|
291
|
+
return [];
|
|
220
292
|
return final.series.map(function (s, index) {
|
|
221
|
-
if (!s
|
|
293
|
+
if (!s || typeof s !== 'object')
|
|
222
294
|
return null;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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);
|
|
230
310
|
}, [final.series, baseGradientId, final.fromColor, final.toColor]);
|
|
231
311
|
// Default gradient for series without custom gradients
|
|
232
312
|
var defaultGradient = (0, react_1.useMemo)(function () { return (react_1.default.createElement("linearGradient", { id: baseGradientId, x1: "0", y1: "0", x2: "0", y2: "1" },
|
|
233
|
-
react_1.default.createElement("stop", { offset: "5%", stopColor: getCssVar(final.fromColor || 'primary'), stopOpacity: 0.8 }),
|
|
234
|
-
react_1.default.createElement("stop", { offset: "95%", stopColor: getCssVar(final.toColor || 'primary200'), stopOpacity: 0 }))); }, [baseGradientId, final.fromColor, final.toColor]);
|
|
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]);
|
|
235
315
|
var containerStyle = (0, react_1.useMemo)(function () { return ({
|
|
236
316
|
height: final.height,
|
|
237
317
|
width: final.width,
|
|
@@ -244,6 +324,13 @@ var Lines = function (_a) {
|
|
|
244
324
|
padding: final.padding,
|
|
245
325
|
boxShadow: final.shadow ? '0 4px 6px -1px rgba(0, 0, 0, 0.1)' : undefined,
|
|
246
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
|
+
}
|
|
247
334
|
return (react_1.default.createElement(recharts_1.ResponsiveContainer, { width: final.width, height: final.height, aspect: final.aspect, className: final.funcss, style: containerStyle },
|
|
248
335
|
react_1.default.createElement(recharts_1.AreaChart, { data: final.data, margin: final.margin, syncId: final.syncId },
|
|
249
336
|
react_1.default.createElement("defs", null,
|
|
@@ -251,16 +338,26 @@ var Lines = function (_a) {
|
|
|
251
338
|
gradients),
|
|
252
339
|
final.showGrid && (react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: final.gridStrokeDasharray, stroke: final.gridStroke || getCssVar('border-color') || '#e2e8f0' })),
|
|
253
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' })),
|
|
254
|
-
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: (
|
|
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))),
|
|
255
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))),
|
|
256
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))),
|
|
257
344
|
final.showLegend && react_1.default.createElement(recharts_1.Legend, __assign({}, final.legendProps)),
|
|
258
345
|
final.series.map(function (s, index) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
+
}
|
|
264
361
|
}))));
|
|
265
362
|
};
|
|
266
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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" },
|
package/ui/table/Table.d.ts
CHANGED
|
@@ -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 {};
|
package/ui/table/Table.js
CHANGED
|
@@ -95,7 +95,7 @@ function Table(_a) {
|
|
|
95
95
|
var _b, _c;
|
|
96
96
|
var children = _a.children, funcss = _a.funcss, bordered = _a.bordered, noStripped = _a.noStripped, hoverable = _a.hoverable, _d = _a.title, title = _d === void 0 ? "" : _d, showTotal = _a.showTotal, light = _a.light, dark = _a.dark, head = _a.head, body = _a.body, data = _a.data, _e = _a.isLoading, isLoading = _e === void 0 ? false : _e, right = _a.right, hideExport = _a.hideExport, height = _a.height, _f = _a.pageSize, pageSize = _f === void 0 ? data ? 10 : 0 : _f, // Default page size,
|
|
97
97
|
customColumns = _a.customColumns, filterableFields = _a.filterableFields, // New prop
|
|
98
|
-
emptyResponse = _a.emptyResponse, filterOnchange = _a.filterOnchange, clearSearch = _a.clearSearch, _g = _a.prioritizeSearchFields, prioritizeSearchFields = _g === void 0 ? [] : _g, onRowClick = _a.onRowClick, rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields", "emptyResponse", "filterOnchange", "clearSearch", "prioritizeSearchFields", "onRowClick"]);
|
|
98
|
+
emptyResponse = _a.emptyResponse, filterOnchange = _a.filterOnchange, clearSearch = _a.clearSearch, _g = _a.prioritizeSearchFields, prioritizeSearchFields = _g === void 0 ? [] : _g, onRowClick = _a.onRowClick, trCss = _a.trCss, rest = __rest(_a, ["children", "funcss", "bordered", "noStripped", "hoverable", "title", "showTotal", "light", "dark", "head", "body", "data", "isLoading", "right", "hideExport", "height", "pageSize", "customColumns", "filterableFields", "emptyResponse", "filterOnchange", "clearSearch", "prioritizeSearchFields", "onRowClick", "trCss"]);
|
|
99
99
|
// Check if data is null or undefined before accessing its properties
|
|
100
100
|
// Replace this in your component
|
|
101
101
|
var _h = (0, react_1.useState)(''), search = _h[0], setSearch = _h[1];
|
|
@@ -188,28 +188,26 @@ function Table(_a) {
|
|
|
188
188
|
}, [selectedField, selectedValue]);
|
|
189
189
|
return (React.createElement("div", { className: "".concat(funcss ? funcss : '', " roundEdge") },
|
|
190
190
|
data &&
|
|
191
|
-
React.createElement("div", { className: "
|
|
191
|
+
React.createElement("div", { className: "pr-4 pl-4 pt-2 pb-2 lighter round-edge mb-2", style: { overflow: "show" } },
|
|
192
192
|
React.createElement(RowFlex_1.default, { gap: 0.5, justify: 'space-between' },
|
|
193
193
|
title ?
|
|
194
194
|
React.createElement("div", null,
|
|
195
195
|
showTotal && data &&
|
|
196
196
|
React.createElement("div", null,
|
|
197
|
-
React.createElement(Text_1.default, { text:
|
|
198
|
-
React.createElement(Text_1.default, { text: filteredData.length, weight: 600 })),
|
|
197
|
+
React.createElement(Text_1.default, { text: "".concat(filteredData.length, " Records"), size: 'sm', weight: 500 })),
|
|
199
198
|
title &&
|
|
200
199
|
React.createElement("div", null,
|
|
201
|
-
React.createElement(Text_1.default, { text: title || "", size: 'h6' })))
|
|
200
|
+
React.createElement(Text_1.default, { text: title || "", size: 'h6', lineHeight: '0.8' })))
|
|
202
201
|
:
|
|
203
202
|
React.createElement(React.Fragment, null, showTotal && data &&
|
|
204
203
|
React.createElement("div", null,
|
|
205
|
-
React.createElement(Text_1.default, { text:
|
|
206
|
-
React.createElement(Text_1.default, { text: filteredData.length, weight: 600, color: 'primary' }))),
|
|
204
|
+
React.createElement(Text_1.default, { text: "".concat(filteredData.length, " Records"), size: 'sm', weight: 500 }))),
|
|
207
205
|
data ?
|
|
208
206
|
React.createElement("div", null,
|
|
209
207
|
React.createElement(Flex_1.default, { width: '100%', wrap: 'nowrap', alignItems: 'center', gap: 0.7 },
|
|
210
208
|
!selectedField && !showSearch && filterableFields &&
|
|
211
209
|
React.createElement("div", null,
|
|
212
|
-
React.createElement(Select_1.default, { fullWidth: true, searchable: true, funcss: 'min-w-300 w-full', rounded: true, value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
|
|
210
|
+
React.createElement(Select_1.default, { fullWidth: true, searchable: true, funcss: 'min-w-300 w-full bg', rounded: true, value: selectedField || '', onChange: function (e) { return handleFieldChange(e); }, options: __spreadArray([
|
|
213
211
|
{ text: '🔍 Filter', value: '' },
|
|
214
212
|
{ text: 'All*', value: '' }
|
|
215
213
|
], (filterableFields || []).map(function (field) { return ({
|
|
@@ -217,7 +215,7 @@ function Table(_a) {
|
|
|
217
215
|
value: field
|
|
218
216
|
}); }), true) })),
|
|
219
217
|
selectedField && !showSearch && filterableFields && (React.createElement("div", { className: '' },
|
|
220
|
-
React.createElement(Select_1.default, { rounded: true, searchable: true, funcss: 'min-w-300 w-full', fullWidth: true, value: selectedValue || '', onChange: function (e) {
|
|
218
|
+
React.createElement(Select_1.default, { rounded: true, searchable: true, funcss: 'min-w-300 w-full bg', fullWidth: true, value: selectedValue || '', onChange: function (e) {
|
|
221
219
|
if (e === 'clear_all') {
|
|
222
220
|
setSelectedField('');
|
|
223
221
|
}
|
|
@@ -238,21 +236,21 @@ function Table(_a) {
|
|
|
238
236
|
showSearch ?
|
|
239
237
|
React.createElement(Flex_1.default, { gap: 0.5, wrap: 'nowrap', alignItems: 'center' },
|
|
240
238
|
React.createElement("div", { className: 'animated slide-up' },
|
|
241
|
-
React.createElement(Input_1.default, { borderless: true, funcss: 'min-w-300', fullWidth: true, rounded: true, value: searchQuery, onChange: function (e) { return setsearchQuery(e.target.value); }, label: "Search..." })),
|
|
239
|
+
React.createElement(Input_1.default, { borderless: true, funcss: 'min-w-300 bg', fullWidth: true, rounded: true, value: searchQuery, onChange: function (e) { return setsearchQuery(e.target.value); }, label: "Search..." })),
|
|
242
240
|
React.createElement("div", { className: 'animated fade-in' },
|
|
243
241
|
React.createElement("div", { onClick: function () { return setshowSearch(false); } },
|
|
244
242
|
React.createElement(ToolTip_1.default, null,
|
|
245
243
|
filterableFields ? React.createElement(io5_1.IoFilterOutline, { className: 'pointer' })
|
|
246
244
|
:
|
|
247
245
|
React.createElement(pi_1.PiXThin, { className: 'pointer', size: 23, onClick: function () { return setshowSearch(false); } }),
|
|
248
|
-
React.createElement(Tip_1.default, { tip: "
|
|
246
|
+
React.createElement(Tip_1.default, { tip: "top", animation: "Opacity", duration: 1, content: filterableFields ? "Filter" : "Close Search" })))))
|
|
249
247
|
:
|
|
250
248
|
React.createElement("div", { className: 'animated fade-in' },
|
|
251
249
|
React.createElement(ToolTip_1.default, null,
|
|
252
250
|
React.createElement(ci_1.CiSearch, { className: 'pointer', size: 23, onClick: function () { return setshowSearch(true); } }),
|
|
253
|
-
React.createElement(Tip_1.default, { tip: "
|
|
251
|
+
React.createElement(Tip_1.default, { tip: "top", animation: "Opacity", duration: 1, content: "Search Data" })))))
|
|
254
252
|
: '',
|
|
255
|
-
React.createElement(React.Fragment, null,
|
|
253
|
+
React.createElement(React.Fragment, null, (right || !hideExport) &&
|
|
256
254
|
React.createElement(RowFlex_1.default, { gap: 0.5 },
|
|
257
255
|
right && right,
|
|
258
256
|
!hideExport &&
|
|
@@ -260,7 +258,7 @@ function Table(_a) {
|
|
|
260
258
|
React.createElement(ToolTip_1.default, null,
|
|
261
259
|
React.createElement(Circle_1.default, { bg: 'lighter', bordered: true, onClick: Export },
|
|
262
260
|
React.createElement(pi_1.PiExportThin, null)),
|
|
263
|
-
React.createElement(Tip_1.default, { tip: "
|
|
261
|
+
React.createElement(Tip_1.default, { tip: "top", animation: "Opacity", duration: 1, content: "Export Data" }))))))),
|
|
264
262
|
React.createElement("main", { style: { overflow: "auto", width: "100%" } },
|
|
265
263
|
React.createElement("table", __assign({ className: "table ".concat(bordered ? 'border' : '', " ").concat(noStripped ? '' : 'stripped', " ").concat(hoverable ? 'hoverableTr' : '', " ").concat(light ? 'light' : '', " ").concat(dark ? 'dark' : ''), style: {
|
|
266
264
|
height: height ? height + "px" : "",
|
|
@@ -269,8 +267,7 @@ function Table(_a) {
|
|
|
269
267
|
} }, rest),
|
|
270
268
|
data &&
|
|
271
269
|
(data === null || data === void 0 ? void 0 : data.titles) &&
|
|
272
|
-
React.createElement(Head_1.default, null, data.titles.map(function (mdoc) { return (React.createElement("th", { key: mdoc },
|
|
273
|
-
React.createElement(Text_1.default, { text: mdoc, weight: 500, funcss: 'text-secondary' }))); })),
|
|
270
|
+
React.createElement(Head_1.default, null, data.titles.map(function (mdoc, index) { return (React.createElement("th", { key: mdoc, className: "text-secondary \n ".concat(index === 0 ? "first_table_data" : "", " \n ").concat(index === (data.titles.length - 1) ? "last_table_data" : "", " \n ") }, mdoc)); })),
|
|
274
271
|
head && React.createElement(Head_1.default, null, head),
|
|
275
272
|
body && React.createElement(Body_1.default, null, body),
|
|
276
273
|
data &&
|
|
@@ -278,7 +275,7 @@ function Table(_a) {
|
|
|
278
275
|
var results = (0, Query_1.getAdvancedFilteredData)(filteredData, searchQuery, data, getNestedValue, prioritizeSearchFields);
|
|
279
276
|
var shouldSlice = !searchQuery || results.length > 10;
|
|
280
277
|
return (shouldSlice ? results.slice(startIndex, endIndex) : results)
|
|
281
|
-
.map(function (mdoc, index) { return (React.createElement("tr", { className:
|
|
278
|
+
.map(function (mdoc, index) { return (React.createElement("tr", { className: "animated slide-up ".concat(trCss), key: index, onClick: onRowClick ? function () { return onRowClick(mdoc); } : undefined },
|
|
282
279
|
data.fields.map(function (fdoc, findex) {
|
|
283
280
|
var _a;
|
|
284
281
|
return (React.createElement(Data_1.default, { key: fdoc, funcss: data.funcss ? ((_a = data === null || data === void 0 ? void 0 : data.funcss) === null || _a === void 0 ? void 0 : _a[findex]) || '' : '' }, getNestedValue(mdoc, fdoc)));
|