funuicss 3.7.2 → 3.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/fun.css +262 -9
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/package.json +1 -1
- package/ui/appbar/AppBar.d.ts +32 -2
- package/ui/appbar/AppBar.js +225 -23
- package/ui/chart/Bar.js +16 -170
- package/ui/chart/Line.js +19 -124
- package/ui/chart/Pie.js +25 -138
- package/ui/input/FileUpload.d.ts +21 -0
- package/ui/input/FileUpload.js +235 -0
- package/ui/input/Input.d.ts +0 -7
- package/ui/input/Input.js +16 -132
- package/ui/text/Text.d.ts +1 -0
- package/ui/text/Text.js +2 -2
- package/ui/vista/Vista.js +12 -181
package/ui/chart/Line.js
CHANGED
|
@@ -152,71 +152,17 @@ var CustomTooltip = function (_a) {
|
|
|
152
152
|
react_1.default.createElement("div", { className: "text-error" }, "Error displaying tooltip")));
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
var Lines = function (
|
|
156
|
-
var
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
}
|
|
155
|
+
var Lines = function (localProps) {
|
|
156
|
+
var _a;
|
|
157
|
+
// Use component configuration with variant support
|
|
158
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Lines', localProps.variant).mergeWithLocal;
|
|
159
|
+
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
160
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
161
|
+
// Debug: Log what props are actually coming through
|
|
162
|
+
react_1.default.useEffect(function () {
|
|
163
|
+
console.log('Lines merged props:', mergedProps);
|
|
164
|
+
console.log('Lines config available:', Object.keys(mergedProps).length > 0);
|
|
165
|
+
}, [mergedProps]);
|
|
220
166
|
// Parse data and series if they're strings with enhanced validation
|
|
221
167
|
var parsedData = (0, react_1.useMemo)(function () {
|
|
222
168
|
var parsed = parseIfString(mergedProps.data, []);
|
|
@@ -230,66 +176,15 @@ var Lines = function (_a) {
|
|
|
230
176
|
}, [mergedProps.series]);
|
|
231
177
|
// Check if we have valid data to display
|
|
232
178
|
var hasValidData = parsedData.length > 0 && parsedSeries.length > 0;
|
|
233
|
-
//
|
|
234
|
-
var final =
|
|
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]);
|
|
179
|
+
// Use mergedProps directly - no need for complex fallback logic
|
|
180
|
+
var final = mergedProps;
|
|
286
181
|
var baseGradientId = final.id || 'areaChartGradient';
|
|
287
182
|
var TooltipComponent = final.customTooltip || CustomTooltip;
|
|
288
183
|
// Generate per-series gradients with error handling
|
|
289
184
|
var gradients = (0, react_1.useMemo)(function () {
|
|
290
|
-
if (!
|
|
185
|
+
if (!parsedSeries || !Array.isArray(parsedSeries))
|
|
291
186
|
return [];
|
|
292
|
-
return
|
|
187
|
+
return parsedSeries.map(function (s, index) {
|
|
293
188
|
if (!s || typeof s !== 'object')
|
|
294
189
|
return null;
|
|
295
190
|
try {
|
|
@@ -307,7 +202,7 @@ var Lines = function (_a) {
|
|
|
307
202
|
return null;
|
|
308
203
|
}
|
|
309
204
|
}).filter(Boolean);
|
|
310
|
-
}, [
|
|
205
|
+
}, [parsedSeries, baseGradientId, final.fromColor, final.toColor]);
|
|
311
206
|
// Default gradient for series without custom gradients
|
|
312
207
|
var defaultGradient = (0, react_1.useMemo)(function () { return (react_1.default.createElement("linearGradient", { id: baseGradientId, x1: "0", y1: "0", x2: "0", y2: "1" },
|
|
313
208
|
react_1.default.createElement("stop", { offset: "5%", stopColor: getCssVar(final.fromColor || 'primary') || '#8884d8', stopOpacity: 0.8 }),
|
|
@@ -332,17 +227,17 @@ var Lines = function (_a) {
|
|
|
332
227
|
react_1.default.createElement("div", null, "No chart data available"))));
|
|
333
228
|
}
|
|
334
229
|
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:
|
|
230
|
+
react_1.default.createElement(recharts_1.AreaChart, { data: parsedData, margin: final.margin, syncId: final.syncId },
|
|
336
231
|
react_1.default.createElement("defs", null,
|
|
337
232
|
defaultGradient,
|
|
338
233
|
gradients),
|
|
339
234
|
final.showGrid && (react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: final.gridStrokeDasharray, stroke: final.gridStroke || getCssVar('border-color') || '#e2e8f0' })),
|
|
340
235
|
!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: (
|
|
236
|
+
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: (_a = final.dy) !== null && _a !== void 0 ? _a : 10, tickLine: final.tickLine, axisLine: final.axisLine, label: final.xAxisLabel ? { value: final.xAxisLabel, position: 'insideBottom', offset: -10 } : undefined }, final.xAxisProps))),
|
|
342
237
|
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
238
|
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
239
|
final.showLegend && react_1.default.createElement(recharts_1.Legend, __assign({}, final.legendProps)),
|
|
345
|
-
|
|
240
|
+
parsedSeries.map(function (s, index) {
|
|
346
241
|
if (!s || !s.dataKey) {
|
|
347
242
|
console.warn('Invalid series configuration at index:', index);
|
|
348
243
|
return null;
|
package/ui/chart/Pie.js
CHANGED
|
@@ -158,92 +158,16 @@ var CustomLabel = function (_a) {
|
|
|
158
158
|
var y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
159
159
|
return (react_1.default.createElement("text", { x: x, y: y, fill: "white", textAnchor: x > cx ? 'start' : 'end', dominantBaseline: "central", fontSize: "12", fontWeight: "600" }, "".concat((percent * 100).toFixed(0), "%")));
|
|
160
160
|
};
|
|
161
|
-
var ChartPie = function (
|
|
162
|
-
|
|
163
|
-
var
|
|
164
|
-
//
|
|
165
|
-
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
showLegend = _o === void 0 ? true : _o, _p = _a.showTooltip, showTooltip = _p === void 0 ? true : _p, _q = _a.showLabels, showLabels = _q === void 0 ? false : _q, _r = _a.showLabelLine, showLabelLine = _r === void 0 ? false : _r, _s = _a.labelPosition, labelPosition = _s === void 0 ? 'inside' : _s, _t = _a.legendPosition, legendPosition = _t === void 0 ? 'bottom' : _t,
|
|
172
|
-
// Appearance
|
|
173
|
-
funcss = _a.funcss, legendCss = _a.legendCss, chartBackground = _a.chartBackground, borderRadius = _a.borderRadius, padding = _a.padding, _u = _a.shadow, shadow = _u === void 0 ? false : _u,
|
|
174
|
-
// Styling
|
|
175
|
-
_v = _a.strokeWidth,
|
|
176
|
-
// Styling
|
|
177
|
-
strokeWidth = _v === void 0 ? 1 : _v, _w = _a.strokeColor, strokeColor = _w === void 0 ? '#ffffff' : _w, _x = _a.activeShape, activeShape = _x === void 0 ? true : _x, _y = _a.inactiveShape, inactiveShape = _y === void 0 ? true : _y,
|
|
178
|
-
// Tooltip / Legend
|
|
179
|
-
tooltipFormatter = _a.tooltipFormatter, labelFormatter = _a.labelFormatter, _z = _a.legendProps, legendProps = _z === void 0 ? {} : _z, _0 = _a.tooltipProps, tooltipProps = _0 === void 0 ? {} : _0, customTooltip = _a.customTooltip, customLabel = _a.customLabel,
|
|
180
|
-
// Animation & Interaction
|
|
181
|
-
_1 = _a.animation,
|
|
182
|
-
// Animation & Interaction
|
|
183
|
-
animation = _1 === void 0 ? true : _1, _2 = _a.animationDuration, animationDuration = _2 === void 0 ? 500 : _2, _3 = _a.isAnimationActive, isAnimationActive = _3 === void 0 ? true : _3, onPieClick = _a.onPieClick, onPieEnter = _a.onPieEnter, onPieLeave = _a.onPieLeave,
|
|
184
|
-
// Responsive
|
|
185
|
-
aspect = _a.aspect, minHeight = _a.minHeight, maxHeight = _a.maxHeight, minWidth = _a.minWidth, maxWidth = _a.maxWidth;
|
|
186
|
-
// Use component configuration with variant support and error handling
|
|
187
|
-
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('PieChart', variant).mergeWithLocal;
|
|
188
|
-
// Create local props object with null checks
|
|
189
|
-
var localProps = {
|
|
190
|
-
data: data !== null && data !== void 0 ? data : [],
|
|
191
|
-
id: id !== null && id !== void 0 ? id : '',
|
|
192
|
-
variant: variant !== null && variant !== void 0 ? variant : '',
|
|
193
|
-
donut: donut !== null && donut !== void 0 ? donut : false,
|
|
194
|
-
width: width !== null && width !== void 0 ? width : '100%',
|
|
195
|
-
height: height !== null && height !== void 0 ? height : 300,
|
|
196
|
-
outerRadius: outerRadius !== null && outerRadius !== void 0 ? outerRadius : 80,
|
|
197
|
-
innerRadius: innerRadius !== null && innerRadius !== void 0 ? innerRadius : undefined,
|
|
198
|
-
paddingAngle: paddingAngle !== null && paddingAngle !== void 0 ? paddingAngle : 0,
|
|
199
|
-
cornerRadius: cornerRadius !== null && cornerRadius !== void 0 ? cornerRadius : 0,
|
|
200
|
-
startAngle: startAngle !== null && startAngle !== void 0 ? startAngle : 0,
|
|
201
|
-
endAngle: endAngle !== null && endAngle !== void 0 ? endAngle : 360,
|
|
202
|
-
minAngle: minAngle !== null && minAngle !== void 0 ? minAngle : 0,
|
|
203
|
-
showLegend: showLegend !== null && showLegend !== void 0 ? showLegend : true,
|
|
204
|
-
showTooltip: showTooltip !== null && showTooltip !== void 0 ? showTooltip : true,
|
|
205
|
-
showLabels: showLabels !== null && showLabels !== void 0 ? showLabels : false,
|
|
206
|
-
showLabelLine: showLabelLine !== null && showLabelLine !== void 0 ? showLabelLine : false,
|
|
207
|
-
labelPosition: labelPosition !== null && labelPosition !== void 0 ? labelPosition : 'inside',
|
|
208
|
-
legendPosition: legendPosition !== null && legendPosition !== void 0 ? legendPosition : 'bottom',
|
|
209
|
-
funcss: funcss !== null && funcss !== void 0 ? funcss : '',
|
|
210
|
-
legendCss: legendCss !== null && legendCss !== void 0 ? legendCss : '',
|
|
211
|
-
chartBackground: chartBackground !== null && chartBackground !== void 0 ? chartBackground : '',
|
|
212
|
-
borderRadius: borderRadius !== null && borderRadius !== void 0 ? borderRadius : '',
|
|
213
|
-
padding: padding !== null && padding !== void 0 ? padding : '',
|
|
214
|
-
shadow: shadow !== null && shadow !== void 0 ? shadow : false,
|
|
215
|
-
strokeWidth: strokeWidth !== null && strokeWidth !== void 0 ? strokeWidth : 1,
|
|
216
|
-
strokeColor: strokeColor !== null && strokeColor !== void 0 ? strokeColor : '#ffffff',
|
|
217
|
-
activeShape: activeShape !== null && activeShape !== void 0 ? activeShape : true,
|
|
218
|
-
inactiveShape: inactiveShape !== null && inactiveShape !== void 0 ? inactiveShape : true,
|
|
219
|
-
tooltipFormatter: tooltipFormatter !== null && tooltipFormatter !== void 0 ? tooltipFormatter : undefined,
|
|
220
|
-
labelFormatter: labelFormatter !== null && labelFormatter !== void 0 ? labelFormatter : undefined,
|
|
221
|
-
legendProps: legendProps !== null && legendProps !== void 0 ? legendProps : {},
|
|
222
|
-
tooltipProps: tooltipProps !== null && tooltipProps !== void 0 ? tooltipProps : {},
|
|
223
|
-
customTooltip: customTooltip !== null && customTooltip !== void 0 ? customTooltip : undefined,
|
|
224
|
-
customLabel: customLabel !== null && customLabel !== void 0 ? customLabel : undefined,
|
|
225
|
-
animation: animation !== null && animation !== void 0 ? animation : true,
|
|
226
|
-
animationDuration: animationDuration !== null && animationDuration !== void 0 ? animationDuration : 500,
|
|
227
|
-
isAnimationActive: isAnimationActive !== null && isAnimationActive !== void 0 ? isAnimationActive : true,
|
|
228
|
-
onPieClick: onPieClick !== null && onPieClick !== void 0 ? onPieClick : undefined,
|
|
229
|
-
onPieEnter: onPieEnter !== null && onPieEnter !== void 0 ? onPieEnter : undefined,
|
|
230
|
-
onPieLeave: onPieLeave !== null && onPieLeave !== void 0 ? onPieLeave : undefined,
|
|
231
|
-
aspect: aspect !== null && aspect !== void 0 ? aspect : undefined,
|
|
232
|
-
minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : undefined,
|
|
233
|
-
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
|
|
234
|
-
minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : undefined,
|
|
235
|
-
maxWidth: maxWidth !== null && maxWidth !== void 0 ? maxWidth : undefined
|
|
236
|
-
};
|
|
237
|
-
// Merge with config
|
|
238
|
-
var mergedProps;
|
|
239
|
-
try {
|
|
240
|
-
var result = mergeWithLocal(localProps);
|
|
241
|
-
mergedProps = (_b = result === null || result === void 0 ? void 0 : result.props) !== null && _b !== void 0 ? _b : localProps;
|
|
242
|
-
}
|
|
243
|
-
catch (error) {
|
|
244
|
-
console.error('Error merging component configuration:', error);
|
|
245
|
-
mergedProps = localProps;
|
|
246
|
-
}
|
|
161
|
+
var ChartPie = function (localProps) {
|
|
162
|
+
// Use component configuration with variant support
|
|
163
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('ChartPie', localProps.variant).mergeWithLocal;
|
|
164
|
+
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
165
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
166
|
+
// Debug: Log what props are actually coming through
|
|
167
|
+
react_1.default.useEffect(function () {
|
|
168
|
+
console.log('ChartPie merged props:', mergedProps);
|
|
169
|
+
console.log('ChartPie config available:', Object.keys(mergedProps).length > 0);
|
|
170
|
+
}, [mergedProps]);
|
|
247
171
|
// Parse data if it's a string with enhanced validation
|
|
248
172
|
var parsedData = (0, react_1.useMemo)(function () {
|
|
249
173
|
var parsed = parseIfString(mergedProps.data, []);
|
|
@@ -254,58 +178,14 @@ var ChartPie = function (_a) {
|
|
|
254
178
|
}, [mergedProps.data]);
|
|
255
179
|
// Check if we have valid data to display
|
|
256
180
|
var hasValidData = parsedData.length > 0;
|
|
257
|
-
//
|
|
258
|
-
var final =
|
|
259
|
-
|
|
260
|
-
id: mergedProps.id || 'pie-chart',
|
|
261
|
-
variant: mergedProps.variant,
|
|
262
|
-
donut: mergedProps.donut,
|
|
263
|
-
width: mergedProps.width,
|
|
264
|
-
height: mergedProps.height,
|
|
265
|
-
outerRadius: mergedProps.outerRadius,
|
|
266
|
-
innerRadius: mergedProps.donut ? (mergedProps.innerRadius || typeof mergedProps.outerRadius === 'number' ? mergedProps.outerRadius * 0.6 : '60%') : 0,
|
|
267
|
-
paddingAngle: mergedProps.paddingAngle,
|
|
268
|
-
cornerRadius: mergedProps.cornerRadius,
|
|
269
|
-
startAngle: mergedProps.startAngle,
|
|
270
|
-
endAngle: mergedProps.endAngle,
|
|
271
|
-
minAngle: mergedProps.minAngle,
|
|
272
|
-
showLegend: mergedProps.showLegend,
|
|
273
|
-
showTooltip: mergedProps.showTooltip,
|
|
274
|
-
showLabels: mergedProps.showLabels,
|
|
275
|
-
showLabelLine: mergedProps.showLabelLine,
|
|
276
|
-
labelPosition: mergedProps.labelPosition,
|
|
277
|
-
legendPosition: mergedProps.legendPosition,
|
|
278
|
-
funcss: mergedProps.funcss,
|
|
279
|
-
legendCss: mergedProps.legendCss,
|
|
280
|
-
chartBackground: mergedProps.chartBackground,
|
|
281
|
-
borderRadius: mergedProps.borderRadius,
|
|
282
|
-
padding: mergedProps.padding,
|
|
283
|
-
shadow: mergedProps.shadow,
|
|
284
|
-
strokeWidth: mergedProps.strokeWidth,
|
|
285
|
-
strokeColor: mergedProps.strokeColor,
|
|
286
|
-
activeShape: mergedProps.activeShape,
|
|
287
|
-
inactiveShape: mergedProps.inactiveShape,
|
|
288
|
-
tooltipFormatter: mergedProps.tooltipFormatter,
|
|
289
|
-
labelFormatter: mergedProps.labelFormatter,
|
|
290
|
-
legendProps: mergedProps.legendProps,
|
|
291
|
-
tooltipProps: mergedProps.tooltipProps,
|
|
292
|
-
customTooltip: mergedProps.customTooltip,
|
|
293
|
-
customLabel: mergedProps.customLabel,
|
|
294
|
-
animation: mergedProps.animation,
|
|
295
|
-
animationDuration: mergedProps.animationDuration,
|
|
296
|
-
isAnimationActive: mergedProps.isAnimationActive,
|
|
297
|
-
onPieClick: mergedProps.onPieClick,
|
|
298
|
-
onPieEnter: mergedProps.onPieEnter,
|
|
299
|
-
onPieLeave: mergedProps.onPieLeave,
|
|
300
|
-
aspect: mergedProps.aspect,
|
|
301
|
-
minHeight: mergedProps.minHeight,
|
|
302
|
-
maxHeight: mergedProps.maxHeight,
|
|
303
|
-
minWidth: mergedProps.minWidth,
|
|
304
|
-
maxWidth: mergedProps.maxWidth
|
|
305
|
-
}); }, [parsedData, mergedProps, hasValidData]);
|
|
306
|
-
// Configure legend based on position
|
|
181
|
+
// Use mergedProps directly - no need for complex fallback logic
|
|
182
|
+
var final = mergedProps;
|
|
183
|
+
// Configure legend based on position - WITH SAFE ACCESS
|
|
307
184
|
var legendConfig = (0, react_1.useMemo)(function () {
|
|
308
|
-
|
|
185
|
+
// Safely access legendProps with defaults
|
|
186
|
+
var safeLegendProps = final.legendProps || {};
|
|
187
|
+
var safeWrapperStyle = safeLegendProps.wrapperStyle || {};
|
|
188
|
+
var baseProps = __assign({ align: 'center', layout: final.legendPosition === 'left' || final.legendPosition === 'right' ? 'vertical' : 'horizontal', verticalAlign: final.legendPosition === 'top' ? 'top' : final.legendPosition === 'bottom' ? 'bottom' : 'middle', wrapperStyle: __assign({ paddingTop: final.legendPosition === 'top' ? '0' : '10px' }, safeWrapperStyle) }, safeLegendProps);
|
|
309
189
|
return baseProps;
|
|
310
190
|
}, [final.legendPosition, final.legendProps]);
|
|
311
191
|
var TooltipComponent = final.customTooltip || CustomTooltip;
|
|
@@ -322,6 +202,13 @@ var ChartPie = function (_a) {
|
|
|
322
202
|
padding: final.padding,
|
|
323
203
|
boxShadow: final.shadow ? '0 4px 6px -1px rgba(0, 0, 0, 0.1)' : undefined,
|
|
324
204
|
}); }, [final]);
|
|
205
|
+
// Calculate inner radius for donut chart
|
|
206
|
+
var innerRadius = (0, react_1.useMemo)(function () {
|
|
207
|
+
if (final.donut) {
|
|
208
|
+
return final.innerRadius || (typeof final.outerRadius === 'number' ? final.outerRadius * 0.6 : '60%');
|
|
209
|
+
}
|
|
210
|
+
return 0;
|
|
211
|
+
}, [final.donut, final.innerRadius, final.outerRadius]);
|
|
325
212
|
// Show empty state if no data
|
|
326
213
|
if (!hasValidData) {
|
|
327
214
|
return (react_1.default.createElement("div", { className: "flex items-center justify-center ".concat(final.funcss), style: containerStyle },
|
|
@@ -332,7 +219,7 @@ var ChartPie = function (_a) {
|
|
|
332
219
|
var chartContent = (react_1.default.createElement(recharts_1.PieChart, null,
|
|
333
220
|
final.showTooltip && (react_1.default.createElement(recharts_1.Tooltip, __assign({ content: react_1.default.createElement(TooltipComponent, { formatter: final.tooltipFormatter }), formatter: final.tooltipFormatter }, final.tooltipProps))),
|
|
334
221
|
final.showLegend && (react_1.default.createElement(recharts_1.Legend, __assign({}, legendConfig, { className: final.legendCss }))),
|
|
335
|
-
react_1.default.createElement(recharts_1.Pie, { data:
|
|
222
|
+
react_1.default.createElement(recharts_1.Pie, { data: parsedData, dataKey: "value", nameKey: "label", cx: "50%", cy: "50%", outerRadius: final.outerRadius, innerRadius: innerRadius, paddingAngle: final.paddingAngle, cornerRadius: final.cornerRadius, startAngle: final.startAngle, endAngle: final.endAngle, minAngle: final.minAngle, label: LabelComponent ? react_1.default.createElement(LabelComponent, null) : final.showLabels, labelLine: final.showLabelLine, isAnimationActive: final.isAnimationActive, animationDuration: final.animationDuration, onClick: final.onPieClick, onMouseEnter: final.onPieEnter, onMouseLeave: final.onPieLeave, activeShape: final.activeShape, inactiveShape: final.inactiveShape }, parsedData.map(function (entry, index) { return (react_1.default.createElement(recharts_1.Cell, { key: "cell-".concat(index), fill: resolveColor(entry.color) || defaultColors[index % defaultColors.length], stroke: resolveColor(final.strokeColor), strokeWidth: final.strokeWidth })); }))));
|
|
336
223
|
// Use ResponsiveContainer for automatic sizing
|
|
337
224
|
return (react_1.default.createElement(recharts_1.ResponsiveContainer, { width: final.width, height: final.height, aspect: final.aspect, className: final.funcss, style: containerStyle }, chartContent));
|
|
338
225
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FileUploadProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
6
|
+
onDrop?: (files: FileList) => void;
|
|
7
|
+
status?: 'success' | 'warning' | 'danger' | 'info' | '';
|
|
8
|
+
label?: string;
|
|
9
|
+
helperText?: string;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
extra?: React.ReactNode;
|
|
12
|
+
button?: React.ReactNode;
|
|
13
|
+
btn?: boolean;
|
|
14
|
+
value?: any;
|
|
15
|
+
fullWidth?: boolean;
|
|
16
|
+
accept?: string;
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
export declare const FileUpload: React.FC<FileUploadProps & React.InputHTMLAttributes<HTMLInputElement>>;
|
|
21
|
+
export default FileUpload;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
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
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.FileUpload = void 0;
|
|
63
|
+
var react_1 = __importStar(require("react"));
|
|
64
|
+
var pi_1 = require("react-icons/pi");
|
|
65
|
+
var Button_1 = __importDefault(require("../button/Button"));
|
|
66
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
67
|
+
var FileUpload = function (_a) {
|
|
68
|
+
var _b = _a.id, id = _b === void 0 ? 'fileInput' : _b, name = _a.name, onChange = _a.onChange, onDrop = _a.onDrop, status = _a.status, _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.fullWidth, fullWidth = _d === void 0 ? true : _d, accept = _a.accept, multiple = _a.multiple, rest = __rest(_a, ["id", "name", "onChange", "onDrop", "status", "label", "helperText", "icon", "extra", "button", "btn", "value", "fullWidth", "accept", "multiple"]);
|
|
69
|
+
var _e = (0, react_1.useState)(''), fileName = _e[0], setFileName = _e[1];
|
|
70
|
+
var _f = (0, react_1.useState)(false), isDragging = _f[0], setIsDragging = _f[1];
|
|
71
|
+
var _g = (0, react_1.useState)(false), isDragOver = _g[0], setIsDragOver = _g[1];
|
|
72
|
+
var inputRef = (0, react_1.useRef)(null);
|
|
73
|
+
var handleChange = function (e) {
|
|
74
|
+
var files = e.target.files;
|
|
75
|
+
if (files && files.length > 0) {
|
|
76
|
+
var file = files[0];
|
|
77
|
+
setFileName(file.name);
|
|
78
|
+
}
|
|
79
|
+
if (onChange)
|
|
80
|
+
onChange(e);
|
|
81
|
+
};
|
|
82
|
+
var handleDragEnter = function (e) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
setIsDragging(true);
|
|
86
|
+
setIsDragOver(true);
|
|
87
|
+
};
|
|
88
|
+
var handleDragLeave = function (e) {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
setIsDragOver(false);
|
|
92
|
+
// Only set dragging to false if we're leaving the actual drop zone
|
|
93
|
+
if (!e.currentTarget.contains(e.relatedTarget)) {
|
|
94
|
+
setIsDragging(false);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
var handleDragOver = function (e) {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
e.stopPropagation();
|
|
100
|
+
setIsDragOver(true);
|
|
101
|
+
};
|
|
102
|
+
var handleDrop = function (e) {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
e.stopPropagation();
|
|
105
|
+
setIsDragging(false);
|
|
106
|
+
setIsDragOver(false);
|
|
107
|
+
var files = e.dataTransfer.files;
|
|
108
|
+
if (files && files.length > 0) {
|
|
109
|
+
var file = files[0];
|
|
110
|
+
setFileName(file.name);
|
|
111
|
+
// Update the input element's files
|
|
112
|
+
if (inputRef.current) {
|
|
113
|
+
var dataTransfer = new DataTransfer();
|
|
114
|
+
for (var i = 0; i < files.length; i++) {
|
|
115
|
+
dataTransfer.items.add(files[i]);
|
|
116
|
+
}
|
|
117
|
+
inputRef.current.files = dataTransfer.files;
|
|
118
|
+
// Trigger onChange if provided
|
|
119
|
+
if (onChange) {
|
|
120
|
+
var event_1 = {
|
|
121
|
+
target: inputRef.current,
|
|
122
|
+
currentTarget: inputRef.current,
|
|
123
|
+
};
|
|
124
|
+
onChange(event_1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Call onDrop callback if provided
|
|
128
|
+
if (onDrop) {
|
|
129
|
+
onDrop(files);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var handleClick = function () {
|
|
134
|
+
if (inputRef.current) {
|
|
135
|
+
inputRef.current.click();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
// Enhanced drag and drop styles
|
|
139
|
+
var getContainerStyles = function () {
|
|
140
|
+
var baseStyles = {
|
|
141
|
+
border: '0.17rem dashed var(--borderColor)',
|
|
142
|
+
borderRadius: '16px',
|
|
143
|
+
padding: 'var(--space-5)',
|
|
144
|
+
textAlign: 'center',
|
|
145
|
+
transition: 'all 0.3s ease',
|
|
146
|
+
cursor: 'pointer',
|
|
147
|
+
margin: 'auto',
|
|
148
|
+
color: 'var(--text-color)',
|
|
149
|
+
position: 'relative',
|
|
150
|
+
};
|
|
151
|
+
if (isDragOver) {
|
|
152
|
+
return __assign(__assign({}, baseStyles), { borderColor: 'var(--primary)', backgroundColor: 'var(--lighter)', transform: 'scale(1.02)', boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)' });
|
|
153
|
+
}
|
|
154
|
+
if (isDragging) {
|
|
155
|
+
return __assign(__assign({}, baseStyles), { borderColor: 'var(--primary600)', backgroundColor: 'var(--lighter)' });
|
|
156
|
+
}
|
|
157
|
+
return baseStyles;
|
|
158
|
+
};
|
|
159
|
+
var getButtonStyles = function () {
|
|
160
|
+
if (isDragOver) {
|
|
161
|
+
return {
|
|
162
|
+
opacity: 0.8,
|
|
163
|
+
transform: 'scale(1.05)',
|
|
164
|
+
transition: 'all 0.2s ease',
|
|
165
|
+
backgroundColor: 'var(--primary600)',
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return {};
|
|
169
|
+
};
|
|
170
|
+
// Render file info when file is selected
|
|
171
|
+
var renderFileInfo = function () {
|
|
172
|
+
if (!fileName)
|
|
173
|
+
return null;
|
|
174
|
+
return (react_1.default.createElement("div", { className: "file-info", style: {
|
|
175
|
+
marginTop: 'var(--space-3)',
|
|
176
|
+
padding: 'var(--space-3)',
|
|
177
|
+
backgroundColor: 'var(--light)',
|
|
178
|
+
borderRadius: '8px',
|
|
179
|
+
border: '1px solid var(--borderColor)',
|
|
180
|
+
display: 'flex',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
gap: 'var(--space-3)',
|
|
183
|
+
justifyContent: 'center'
|
|
184
|
+
} },
|
|
185
|
+
react_1.default.createElement(pi_1.PiFile, { style: { color: 'var(--primary)', fontSize: '1.2rem' } }),
|
|
186
|
+
react_1.default.createElement(Text_1.default, { text: fileName, truncate: 1, block: true, size: 'sm' })));
|
|
187
|
+
};
|
|
188
|
+
if (btn) {
|
|
189
|
+
return (react_1.default.createElement("div", { className: "fileInput", style: { width: fullWidth ? '100%' : 'fit-content' } },
|
|
190
|
+
button || (react_1.default.createElement("div", { onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, onClick: handleClick, style: { position: 'relative' } },
|
|
191
|
+
react_1.default.createElement(Button_1.default, { startIcon: icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null), bg: isDragOver ? "primary600" : "primary", fullWidth: fullWidth, raised: true, style: getButtonStyles() }, isDragOver ? 'Drop files here' : fileName || label))),
|
|
192
|
+
react_1.default.createElement("input", __assign({ ref: inputRef, id: id, name: name, onChange: handleChange, type: "file", value: value, accept: accept, multiple: multiple, className: "filedInput" }, rest)),
|
|
193
|
+
renderFileInfo(),
|
|
194
|
+
helperText && (react_1.default.createElement("div", { className: "input-helper-text ".concat(status ? "helper-".concat(status) : ''), style: { marginTop: 'var(--space-3)' } },
|
|
195
|
+
react_1.default.createElement("span", null, helperText)))));
|
|
196
|
+
}
|
|
197
|
+
return (react_1.default.createElement("div", { className: "_upload_container", style: getContainerStyles(), onDragEnter: handleDragEnter, onDragLeave: handleDragLeave, onDragOver: handleDragOver, onDrop: handleDrop, onClick: handleClick },
|
|
198
|
+
react_1.default.createElement("div", { className: "_upload_label" },
|
|
199
|
+
react_1.default.createElement("div", { className: "_upload_icon", style: {
|
|
200
|
+
fontSize: '2.4rem',
|
|
201
|
+
color: isDragOver ? 'var(--primary600)' : 'var(--primary)',
|
|
202
|
+
marginBottom: '0.5rem',
|
|
203
|
+
transition: 'color 0.3s ease',
|
|
204
|
+
transform: isDragOver ? 'translateY(-2px)' : 'none'
|
|
205
|
+
} }, icon || react_1.default.createElement(pi_1.PiCloudArrowUp, null)),
|
|
206
|
+
react_1.default.createElement("div", { className: "_upload_text fit" },
|
|
207
|
+
react_1.default.createElement(Text_1.default, { text: isDragOver ? 'Drop files to upload' : fileName || label, truncate: 1, block: true, style: {
|
|
208
|
+
color: isDragOver ? 'var(--primary600)' : 'var(--text-color)',
|
|
209
|
+
fontWeight: isDragOver ? '600' : '400'
|
|
210
|
+
} })),
|
|
211
|
+
isDragOver && (react_1.default.createElement("div", { style: {
|
|
212
|
+
position: 'absolute',
|
|
213
|
+
top: 0,
|
|
214
|
+
left: 0,
|
|
215
|
+
right: 0,
|
|
216
|
+
bottom: 0,
|
|
217
|
+
backgroundColor: 'var(--primary)',
|
|
218
|
+
opacity: 0.1,
|
|
219
|
+
borderRadius: '14px',
|
|
220
|
+
pointerEvents: 'none'
|
|
221
|
+
} })),
|
|
222
|
+
!fileName && !isDragOver && (react_1.default.createElement("div", { style: {
|
|
223
|
+
marginTop: 'var(--space-3)',
|
|
224
|
+
fontSize: '0.8rem',
|
|
225
|
+
color: 'var(--text-muted)',
|
|
226
|
+
opacity: 0.7
|
|
227
|
+
} }, "Click or drag files to upload")),
|
|
228
|
+
extra && react_1.default.createElement("div", { className: "text-small opacity-3", style: { marginTop: 'var(--space-2)' } }, extra)),
|
|
229
|
+
react_1.default.createElement("input", __assign({ ref: inputRef, onChange: handleChange, type: "file", id: id, name: name, className: "_upload_input", value: value, accept: accept, multiple: multiple }, rest)),
|
|
230
|
+
renderFileInfo(),
|
|
231
|
+
helperText && (react_1.default.createElement("div", { className: "input-helper-text ".concat(status ? "helper-".concat(status) : ''), style: { marginTop: 'var(--space-3)' } },
|
|
232
|
+
react_1.default.createElement("span", null, helperText)))));
|
|
233
|
+
};
|
|
234
|
+
exports.FileUpload = FileUpload;
|
|
235
|
+
exports.default = exports.FileUpload;
|