funuicss 3.6.19 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/fun.css +138 -127
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/package.json +1 -2
- package/ui/carousel/Carousel.d.ts +2 -0
- package/ui/carousel/Carousel.js +11 -11
- package/ui/chart/Line.d.ts +68 -11
- package/ui/chart/Line.js +227 -26
- package/ui/sidebar/SideBar.js +1 -1
- package/ui/text/Text.js +73 -33
- package/ui/theme/theme.d.ts +12 -0
- package/ui/theme/theme.js +104 -52
- package/js/firebase/Auth.d.ts +0 -191
- package/js/firebase/Auth.js +0 -746
- package/js/firebase/FireStore.d.ts +0 -54
- package/js/firebase/FireStore.js +0 -285
package/ui/chart/Line.js
CHANGED
|
@@ -11,12 +11,56 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
return __assign.apply(this, arguments);
|
|
13
13
|
};
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
17
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
var react_1 =
|
|
48
|
+
var react_1 = __importStar(require("react"));
|
|
19
49
|
var recharts_1 = require("recharts");
|
|
50
|
+
var componentUtils_1 = require("../../utils/componentUtils");
|
|
51
|
+
// Parse string to object utility
|
|
52
|
+
var parseIfString = function (value, fallback) {
|
|
53
|
+
if (typeof value === 'string') {
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(value);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.error('Failed to parse JSON string:', error);
|
|
59
|
+
return fallback;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return value;
|
|
63
|
+
};
|
|
20
64
|
// CSS var resolver
|
|
21
65
|
var getCssVar = function (varName) {
|
|
22
66
|
var _a;
|
|
@@ -32,34 +76,191 @@ var resolveStrokeColor = function (color) {
|
|
|
32
76
|
return color;
|
|
33
77
|
return getCssVar(color) || color;
|
|
34
78
|
};
|
|
35
|
-
// Tooltip
|
|
79
|
+
// Default Tooltip
|
|
36
80
|
var CustomTooltip = function (_a) {
|
|
37
|
-
var active = _a.active, payload = _a.payload, label = _a.label;
|
|
81
|
+
var active = _a.active, payload = _a.payload, label = _a.label, formatter = _a.formatter;
|
|
38
82
|
if (active && payload && payload.length) {
|
|
39
|
-
return (react_1.default.createElement("div", { className: "
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
83
|
+
return (react_1.default.createElement("div", { className: "card raised round-edge p-2 text-sm", style: {
|
|
84
|
+
maxWidth: '300px'
|
|
85
|
+
} },
|
|
86
|
+
react_1.default.createElement("div", { className: "text-bold mb-1" }, label),
|
|
87
|
+
payload.map(function (entry, index) { return (react_1.default.createElement("div", { key: index, style: {
|
|
88
|
+
lineHeight: 1.4,
|
|
89
|
+
display: 'flex',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
gap: '8px'
|
|
92
|
+
} },
|
|
93
|
+
react_1.default.createElement("div", { style: {
|
|
94
|
+
width: '12px',
|
|
95
|
+
height: '12px',
|
|
96
|
+
backgroundColor: entry.color,
|
|
97
|
+
borderRadius: '2px'
|
|
98
|
+
} }),
|
|
99
|
+
react_1.default.createElement("span", { style: { fontWeight: 500 } },
|
|
100
|
+
entry.name,
|
|
101
|
+
":"),
|
|
102
|
+
react_1.default.createElement("span", { style: { fontWeight: 600, color: 'var(--text-color, #1a202c)' } }, formatter ? formatter(entry.value, entry.name, entry) : entry.value))); })));
|
|
45
103
|
}
|
|
46
104
|
return null;
|
|
47
105
|
};
|
|
48
106
|
var Lines = function (_a) {
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
107
|
+
var _b;
|
|
108
|
+
var data = _a.data, id = _a.id, series = _a.series, fromColor = _a.fromColor, toColor = _a.toColor, dy = _a.dy, _c = _a.showGrid, showGrid = _c === void 0 ? true : _c, _d = _a.horizontalLines, horizontalLines = _d === void 0 ? false : _d, _e = _a.showLegend, showLegend = _e === void 0 ? true : _e, _f = _a.showXAxis, showXAxis = _f === void 0 ? true : _f, _g = _a.showYAxis, showYAxis = _g === void 0 ? false : _g, _h = _a.showTooltip, showTooltip = _h === void 0 ? true : _h, funcss = _a.funcss, _j = _a.curveType, curveType = _j === void 0 ? 'monotone' : _j, _k = _a.height, height = _k === void 0 ? "100%" : _k, _l = _a.width, width = _l === void 0 ? '100%' : _l, _m = _a.margin, margin = _m === void 0 ? { top: 10, right: 30, left: 0, bottom: 20 } : _m, _o = _a.xAxisProps, xAxisProps = _o === void 0 ? {} : _o, _p = _a.yAxisProps, yAxisProps = _p === void 0 ? {} : _p, tooltipFormatter = _a.tooltipFormatter, _q = _a.legendProps, legendProps = _q === void 0 ? {} : _q, _r = _a.tooltipProps, tooltipProps = _r === void 0 ? {} : _r, rotateLabel = _a.rotateLabel, xLabelSize = _a.xLabelSize, yLabelSize = _a.yLabelSize, xInterval = _a.xInterval, yInterval = _a.yInterval, _s = _a.variant, variant = _s === void 0 ? '' : _s, xAxisLabel = _a.xAxisLabel, yAxisLabel = _a.yAxisLabel, _t = _a.tickLine, tickLine = _t === void 0 ? true : _t, _u = _a.axisLine, axisLine = _u === void 0 ? true : _u, gridStroke = _a.gridStroke, _v = _a.gridStrokeDasharray, gridStrokeDasharray = _v === void 0 ? "3 3" : _v, customTooltip = _a.customTooltip, _w = _a.animation, animation = _w === void 0 ? true : _w, _x = _a.animationDuration, animationDuration = _x === void 0 ? 500 : _x, _y = _a.isAnimationActive, isAnimationActive = _y === void 0 ? true : _y, syncId = _a.syncId, chartBackground = _a.chartBackground, borderRadius = _a.borderRadius, padding = _a.padding, _z = _a.shadow, shadow = _z === void 0 ? false : _z, aspect = _a.aspect, minHeight = _a.minHeight, maxHeight = _a.maxHeight, minWidth = _a.minWidth, maxWidth = _a.maxWidth;
|
|
109
|
+
// Use component configuration with variant support
|
|
110
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('AreaChart', variant).mergeWithLocal;
|
|
111
|
+
// Create local props object
|
|
112
|
+
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
|
|
160
|
+
};
|
|
161
|
+
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
162
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
163
|
+
// Parse data and series if they're strings
|
|
164
|
+
var parsedData = (0, react_1.useMemo)(function () { return parseIfString(mergedProps.data, []); }, [mergedProps.data]);
|
|
165
|
+
var parsedSeries = (0, react_1.useMemo)(function () { return parseIfString(mergedProps.series, []); }, [mergedProps.series]);
|
|
166
|
+
// Extract final values
|
|
167
|
+
var final = (0, react_1.useMemo)(function () { return ({
|
|
168
|
+
data: parsedData,
|
|
169
|
+
id: mergedProps.id,
|
|
170
|
+
series: parsedSeries,
|
|
171
|
+
fromColor: mergedProps.fromColor,
|
|
172
|
+
toColor: mergedProps.toColor,
|
|
173
|
+
dy: mergedProps.dy,
|
|
174
|
+
showGrid: mergedProps.showGrid,
|
|
175
|
+
horizontalLines: mergedProps.horizontalLines,
|
|
176
|
+
showLegend: mergedProps.showLegend,
|
|
177
|
+
showXAxis: mergedProps.showXAxis,
|
|
178
|
+
showYAxis: mergedProps.showYAxis,
|
|
179
|
+
showTooltip: mergedProps.showTooltip,
|
|
180
|
+
funcss: mergedProps.funcss,
|
|
181
|
+
curveType: mergedProps.curveType,
|
|
182
|
+
height: mergedProps.height,
|
|
183
|
+
width: mergedProps.width,
|
|
184
|
+
margin: mergedProps.margin,
|
|
185
|
+
xAxisProps: mergedProps.xAxisProps,
|
|
186
|
+
yAxisProps: mergedProps.yAxisProps,
|
|
187
|
+
tooltipFormatter: mergedProps.tooltipFormatter,
|
|
188
|
+
legendProps: mergedProps.legendProps,
|
|
189
|
+
tooltipProps: mergedProps.tooltipProps,
|
|
190
|
+
rotateLabel: mergedProps.rotateLabel,
|
|
191
|
+
xLabelSize: mergedProps.xLabelSize,
|
|
192
|
+
yLabelSize: mergedProps.yLabelSize,
|
|
193
|
+
xInterval: mergedProps.xInterval,
|
|
194
|
+
yInterval: mergedProps.yInterval,
|
|
195
|
+
xAxisLabel: mergedProps.xAxisLabel,
|
|
196
|
+
yAxisLabel: mergedProps.yAxisLabel,
|
|
197
|
+
tickLine: mergedProps.tickLine,
|
|
198
|
+
axisLine: mergedProps.axisLine,
|
|
199
|
+
gridStroke: mergedProps.gridStroke,
|
|
200
|
+
gridStrokeDasharray: mergedProps.gridStrokeDasharray,
|
|
201
|
+
customTooltip: mergedProps.customTooltip,
|
|
202
|
+
animation: mergedProps.animation,
|
|
203
|
+
animationDuration: mergedProps.animationDuration,
|
|
204
|
+
isAnimationActive: mergedProps.isAnimationActive,
|
|
205
|
+
syncId: mergedProps.syncId,
|
|
206
|
+
chartBackground: mergedProps.chartBackground,
|
|
207
|
+
borderRadius: mergedProps.borderRadius,
|
|
208
|
+
padding: mergedProps.padding,
|
|
209
|
+
shadow: mergedProps.shadow,
|
|
210
|
+
aspect: mergedProps.aspect,
|
|
211
|
+
minHeight: mergedProps.minHeight,
|
|
212
|
+
maxHeight: mergedProps.maxHeight,
|
|
213
|
+
minWidth: mergedProps.minWidth,
|
|
214
|
+
maxWidth: mergedProps.maxWidth
|
|
215
|
+
}); }, [parsedData, parsedSeries, mergedProps]);
|
|
216
|
+
var baseGradientId = final.id || 'areaChartGradient';
|
|
217
|
+
var TooltipComponent = final.customTooltip || CustomTooltip;
|
|
218
|
+
// Generate per-series gradients
|
|
219
|
+
var gradients = (0, react_1.useMemo)(function () {
|
|
220
|
+
return final.series.map(function (s, index) {
|
|
221
|
+
if (!s.fromColor && !s.toColor)
|
|
222
|
+
return null;
|
|
223
|
+
var gradientId = "".concat(baseGradientId, "-").concat(index);
|
|
224
|
+
var startColor = resolveStrokeColor(s.fromColor || s.color || final.fromColor);
|
|
225
|
+
var endColor = resolveStrokeColor(s.toColor || final.toColor);
|
|
226
|
+
return (react_1.default.createElement("linearGradient", { key: gradientId, id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1" },
|
|
227
|
+
react_1.default.createElement("stop", { offset: "5%", stopColor: startColor, stopOpacity: 0.8 }),
|
|
228
|
+
react_1.default.createElement("stop", { offset: "95%", stopColor: endColor, stopOpacity: 0 })));
|
|
229
|
+
});
|
|
230
|
+
}, [final.series, baseGradientId, final.fromColor, final.toColor]);
|
|
231
|
+
// Default gradient for series without custom gradients
|
|
232
|
+
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]);
|
|
235
|
+
var containerStyle = (0, react_1.useMemo)(function () { return ({
|
|
236
|
+
height: final.height,
|
|
237
|
+
width: final.width,
|
|
238
|
+
minHeight: final.minHeight,
|
|
239
|
+
maxHeight: final.maxHeight,
|
|
240
|
+
minWidth: final.minWidth,
|
|
241
|
+
maxWidth: final.maxWidth,
|
|
242
|
+
background: final.chartBackground,
|
|
243
|
+
borderRadius: final.borderRadius,
|
|
244
|
+
padding: final.padding,
|
|
245
|
+
boxShadow: final.shadow ? '0 4px 6px -1px rgba(0, 0, 0, 0.1)' : undefined,
|
|
246
|
+
}); }, [final]);
|
|
247
|
+
return (react_1.default.createElement(recharts_1.ResponsiveContainer, { width: final.width, height: final.height, aspect: final.aspect, className: final.funcss, style: containerStyle },
|
|
248
|
+
react_1.default.createElement(recharts_1.AreaChart, { data: final.data, margin: final.margin, syncId: final.syncId },
|
|
53
249
|
react_1.default.createElement("defs", null,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
showGrid && react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
react_1.default.createElement(recharts_1.
|
|
62
|
-
|
|
63
|
-
|
|
250
|
+
defaultGradient,
|
|
251
|
+
gradients),
|
|
252
|
+
final.showGrid && (react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: final.gridStrokeDasharray, stroke: final.gridStroke || getCssVar('border-color') || '#e2e8f0' })),
|
|
253
|
+
!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: (_b = final.dy) !== null && _b !== void 0 ? _b : 10, tickLine: final.tickLine, axisLine: final.axisLine, label: final.xAxisLabel ? { value: final.xAxisLabel, position: 'insideBottom', offset: -10 } : undefined }, final.xAxisProps))),
|
|
255
|
+
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
|
+
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
|
+
final.showLegend && react_1.default.createElement(recharts_1.Legend, __assign({}, final.legendProps)),
|
|
258
|
+
final.series.map(function (s, index) {
|
|
259
|
+
var hasCustomGradient = s.fromColor || s.toColor;
|
|
260
|
+
var gradientId = hasCustomGradient
|
|
261
|
+
? "".concat(baseGradientId, "-").concat(index)
|
|
262
|
+
: baseGradientId;
|
|
263
|
+
return (react_1.default.createElement(recharts_1.Area, { key: s.dataKey || 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 }));
|
|
264
|
+
}))));
|
|
64
265
|
};
|
|
65
266
|
exports.default = Lines;
|
package/ui/sidebar/SideBar.js
CHANGED
|
@@ -129,7 +129,7 @@ function SideBar(_a) {
|
|
|
129
129
|
window.location.href = link.uri;
|
|
130
130
|
}
|
|
131
131
|
}, key: link.uri },
|
|
132
|
-
react_1.default.createElement(Button_1.default, { fullWidth: true, small: true, funcss: "p-1 pl-2 pr-2 sidebar-link text-left ".concat(isActive ? "primary ".concat(activeCss || '') : 'hoverable'), startIcon: react_1.default.createElement("span", { className: "".concat(iconCSS || '', " \n ").concat((variant === 'standard' || popIcon) ? "p-1 ".concat(isActive ? "primary" : "lighter border", " central") : (variant === "minimal" && !isActive) ? "p-1 central lighter " : ""), style: { lineHeight: 0, borderRadius: "0.4rem" } }, link.icon) },
|
|
132
|
+
react_1.default.createElement(Button_1.default, { fullWidth: true, small: true, funcss: "p-1 pl-2 pr-2 sidebar-link text-left ".concat(isActive ? "primary ".concat(activeCss || '') : 'hoverable'), startIcon: react_1.default.createElement("span", { className: "".concat(iconCSS || '', " \n ").concat((variant === 'standard' || popIcon) ? "p-1 ".concat(isActive ? "primary" : "lighter text-primary border", " central") : (variant === "minimal" && !isActive) ? "p-1 central lighter text-primary" : ""), style: { lineHeight: 0, borderRadius: "0.4rem" } }, link.icon) },
|
|
133
133
|
react_1.default.createElement(Text_1.default, { text: link.text, size: "sm", weight: 400 }))));
|
|
134
134
|
})));
|
|
135
135
|
}))),
|
package/ui/text/Text.js
CHANGED
|
@@ -28,59 +28,99 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
var react_1 = __importDefault(require("react"));
|
|
30
30
|
var pi_1 = require("react-icons/pi");
|
|
31
|
-
var getCssVariable_1 = require("../../utils/getCssVariable");
|
|
32
31
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
33
32
|
var Text = function (_a) {
|
|
34
33
|
var id = _a.id, bg = _a.bg, color = _a.color, children = _a.children, hoverBg = _a.hoverBg, hoverText = _a.hoverText, text = _a.text, funcss = _a.funcss, emp = _a.emp, bold = _a.bold, block = _a.block, body = _a.body, article = _a.article, light = _a.light, lighter = _a.lighter, italic = _a.italic, weight = _a.weight, underline = _a.underline, align = _a.align, lineHeight = _a.lineHeight, letterSpacing = _a.letterSpacing, uppercase = _a.uppercase, lowercase = _a.lowercase, capitalize = _a.capitalize, textDecoration = _a.textDecoration, textTransform = _a.textTransform, whiteSpace = _a.whiteSpace, wordBreak = _a.wordBreak, fontFamily = _a.fontFamily, truncate = _a.truncate, textShadow = _a.textShadow, textAlign = _a.textAlign, customStyles = _a.customStyles, monospace = _a.monospace, quote = _a.quote, opacity = _a.opacity, _b = _a.variant, variant = _b === void 0 ? '' : _b, _c = _a.size, size = _c === void 0 ? 'base' : _c, margin = _a.margin, padding = _a.padding, rest = __rest(_a, ["id", "bg", "color", "children", "hoverBg", "hoverText", "text", "funcss", "emp", "bold", "block", "body", "article", "light", "lighter", "italic", "weight", "underline", "align", "lineHeight", "letterSpacing", "uppercase", "lowercase", "capitalize", "textDecoration", "textTransform", "whiteSpace", "wordBreak", "fontFamily", "truncate", "textShadow", "textAlign", "customStyles", "monospace", "quote", "opacity", "variant", "size", "margin", "padding"]);
|
|
35
|
-
//
|
|
36
|
-
var
|
|
34
|
+
// Only use component config if variant is provided and not empty
|
|
35
|
+
var shouldUseConfig = variant !== undefined && variant !== '';
|
|
36
|
+
// Use the component config hook only when needed
|
|
37
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Text', shouldUseConfig ? variant : undefined).mergeWithLocal;
|
|
38
|
+
// Create local props object
|
|
39
|
+
var localProps = __assign({ bg: bg, color: color, funcss: funcss, emp: emp, bold: bold, block: block, body: body, article: article, light: light, lighter: lighter, italic: italic, weight: weight, underline: underline, align: align, lineHeight: lineHeight, letterSpacing: letterSpacing, uppercase: uppercase, lowercase: lowercase, capitalize: capitalize, textDecoration: textDecoration, textTransform: textTransform, whiteSpace: whiteSpace, wordBreak: wordBreak, fontFamily: fontFamily, truncate: truncate, textShadow: textShadow, textAlign: textAlign, monospace: monospace, quote: quote, opacity: opacity, size: size, margin: margin, padding: padding }, rest);
|
|
37
40
|
// Merge config with local props - local props override config
|
|
38
|
-
var mergedProps =
|
|
41
|
+
var mergedProps = (shouldUseConfig
|
|
42
|
+
? mergeWithLocal(localProps)
|
|
43
|
+
: { props: localProps }).props;
|
|
44
|
+
// Extract final values - local props take precedence, handle empty strings properly
|
|
45
|
+
var final = {
|
|
46
|
+
bg: bg !== undefined ? bg : mergedProps.bg,
|
|
47
|
+
color: color !== undefined ? color : mergedProps.color,
|
|
48
|
+
funcss: funcss !== undefined ? funcss : mergedProps.funcss,
|
|
49
|
+
emp: emp !== undefined ? emp : mergedProps.emp,
|
|
50
|
+
bold: bold !== undefined ? bold : mergedProps.bold,
|
|
51
|
+
block: block !== undefined ? block : mergedProps.block,
|
|
52
|
+
body: body !== undefined ? body : mergedProps.body,
|
|
53
|
+
article: article !== undefined ? article : mergedProps.article,
|
|
54
|
+
light: light !== undefined ? light : mergedProps.light,
|
|
55
|
+
lighter: lighter !== undefined ? lighter : mergedProps.lighter,
|
|
56
|
+
italic: italic !== undefined ? italic : mergedProps.italic,
|
|
57
|
+
weight: weight !== undefined ? weight : mergedProps.weight,
|
|
58
|
+
underline: underline !== undefined ? underline : mergedProps.underline,
|
|
59
|
+
align: align !== undefined ? align : mergedProps.align,
|
|
60
|
+
lineHeight: lineHeight !== undefined ? lineHeight : mergedProps.lineHeight,
|
|
61
|
+
letterSpacing: letterSpacing !== undefined ? letterSpacing : mergedProps.letterSpacing,
|
|
62
|
+
uppercase: uppercase !== undefined ? uppercase : mergedProps.uppercase,
|
|
63
|
+
lowercase: lowercase !== undefined ? lowercase : mergedProps.lowercase,
|
|
64
|
+
capitalize: capitalize !== undefined ? capitalize : mergedProps.capitalize,
|
|
65
|
+
textDecoration: textDecoration !== undefined ? textDecoration : mergedProps.textDecoration,
|
|
66
|
+
textTransform: textTransform !== undefined ? textTransform : mergedProps.textTransform,
|
|
67
|
+
whiteSpace: whiteSpace !== undefined ? whiteSpace : mergedProps.whiteSpace,
|
|
68
|
+
wordBreak: wordBreak !== undefined ? wordBreak : mergedProps.wordBreak,
|
|
69
|
+
fontFamily: fontFamily !== undefined ? fontFamily : mergedProps.fontFamily,
|
|
70
|
+
truncate: truncate !== undefined ? truncate : mergedProps.truncate,
|
|
71
|
+
textShadow: textShadow !== undefined ? textShadow : mergedProps.textShadow,
|
|
72
|
+
textAlign: textAlign !== undefined ? textAlign : mergedProps.textAlign,
|
|
73
|
+
monospace: monospace !== undefined ? monospace : mergedProps.monospace,
|
|
74
|
+
quote: quote !== undefined ? quote : mergedProps.quote,
|
|
75
|
+
opacity: opacity !== undefined ? opacity : mergedProps.opacity,
|
|
76
|
+
size: size !== undefined ? size : mergedProps.size,
|
|
77
|
+
margin: margin !== undefined ? margin : mergedProps.margin,
|
|
78
|
+
padding: padding !== undefined ? padding : mergedProps.padding,
|
|
79
|
+
};
|
|
39
80
|
// If margin is provided, force block display
|
|
40
|
-
var shouldBeBlock =
|
|
81
|
+
var shouldBeBlock = final.block || !!final.margin;
|
|
41
82
|
var Tag = shouldBeBlock ? 'div' : 'span';
|
|
42
|
-
var sizeClass = "".concat(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"text-".concat(
|
|
49
|
-
var
|
|
50
|
-
var mergedStyles = __assign(__assign({ display: shouldBeBlock ? 'block' : undefined, fontWeight: mergedProps.bold ? 'bold' : mergedProps.weight ? mergedProps.weight : Number(bdFontWeight), lineHeight: mergedProps.lineHeight, letterSpacing: mergedProps.letterSpacing, textTransform: mergedProps.textTransform, textDecoration: mergedProps.textDecoration, fontFamily: mergedProps.fontFamily, textShadow: mergedProps.textShadow, textAlign: mergedProps.textAlign, whiteSpace: mergedProps.whiteSpace, wordBreak: mergedProps.wordBreak, transform: mergedProps.transform, margin: mergedProps.margin, padding: mergedProps.padding }, customStyles), (mergedProps.truncate
|
|
83
|
+
var sizeClass = "".concat(final.size === 'h1' ? "h1" :
|
|
84
|
+
final.size === 'h2' ? "h2" :
|
|
85
|
+
final.size === 'h3' ? "h3" :
|
|
86
|
+
final.size === 'h4' ? "h4" :
|
|
87
|
+
final.size === 'h5' ? "h5" :
|
|
88
|
+
final.size === 'h6' ? "h6" :
|
|
89
|
+
"text-".concat(final.size));
|
|
90
|
+
var mergedStyles = __assign(__assign({ display: shouldBeBlock ? 'block' : undefined, fontWeight: final.bold ? 'bold' : final.weight ? final.weight : undefined, lineHeight: final.lineHeight, letterSpacing: final.letterSpacing, textTransform: final.textTransform, textDecoration: final.textDecoration, fontFamily: final.fontFamily, textShadow: final.textShadow, textAlign: final.textAlign, whiteSpace: final.whiteSpace, wordBreak: final.wordBreak, margin: final.margin, padding: final.padding }, customStyles), (final.truncate
|
|
51
91
|
? {
|
|
52
92
|
display: '-webkit-box',
|
|
53
93
|
WebkitBoxOrient: 'vertical',
|
|
54
|
-
WebkitLineClamp:
|
|
94
|
+
WebkitLineClamp: final.truncate,
|
|
55
95
|
overflow: 'hidden',
|
|
56
96
|
textOverflow: 'ellipsis',
|
|
57
97
|
}
|
|
58
98
|
: {}));
|
|
59
99
|
var classNames = [
|
|
60
|
-
|
|
100
|
+
final.funcss || '',
|
|
61
101
|
sizeClass,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
102
|
+
final.color ? " text-".concat(final.color, " ") : '',
|
|
103
|
+
final.align ? " text-".concat(final.align, " ") : '',
|
|
104
|
+
final.monospace ? 'monospace' : '',
|
|
105
|
+
final.bg || '',
|
|
66
106
|
hoverText ? "hover-text-".concat(hoverText) : '',
|
|
67
107
|
hoverBg ? "hover-".concat(hoverBg) : '',
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
108
|
+
final.light ? 'lightText' : final.lighter ? 'lighterText' : '',
|
|
109
|
+
final.italic ? 'italicText' : '',
|
|
110
|
+
final.underline ? 'underlineText' : '',
|
|
111
|
+
final.body ? 'body' : '',
|
|
112
|
+
final.article ? 'article' : '',
|
|
113
|
+
final.emp ? 'emp' : '',
|
|
114
|
+
final.bold ? 'bold' : '',
|
|
115
|
+
final.uppercase ? 'uppercase' : '',
|
|
116
|
+
final.lowercase ? 'lowercase' : '',
|
|
117
|
+
final.capitalize ? 'capitalize' : '',
|
|
118
|
+
final.opacity ? 'opacity-' + final.opacity : '',
|
|
79
119
|
]
|
|
80
120
|
.filter(Boolean)
|
|
81
121
|
.join(' ');
|
|
82
|
-
return (react_1.default.createElement(Tag, __assign({ id: id, className: classNames, style: mergedStyles },
|
|
83
|
-
|
|
122
|
+
return (react_1.default.createElement(Tag, __assign({ id: id, className: classNames, style: mergedStyles }, rest),
|
|
123
|
+
final.quote && (react_1.default.createElement("div", null,
|
|
84
124
|
react_1.default.createElement(pi_1.PiQuotesLight, null))),
|
|
85
125
|
children,
|
|
86
126
|
text));
|
package/ui/theme/theme.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export type ThemeName = 'light' | 'dark' | 'dark-blue' | 'light-gray' | 'pastel-
|
|
|
4
4
|
interface ThemeConfig {
|
|
5
5
|
[key: string]: any;
|
|
6
6
|
}
|
|
7
|
+
interface Variable {
|
|
8
|
+
name: string;
|
|
9
|
+
value: any;
|
|
10
|
+
}
|
|
7
11
|
interface ProjectData {
|
|
8
12
|
theme_config?: {
|
|
9
13
|
colors?: Record<string, string>;
|
|
@@ -12,6 +16,7 @@ interface ProjectData {
|
|
|
12
16
|
};
|
|
13
17
|
components?: Record<string, any>;
|
|
14
18
|
default_variation?: ThemeVariant;
|
|
19
|
+
variables?: Variable[];
|
|
15
20
|
name?: string;
|
|
16
21
|
project_id?: string;
|
|
17
22
|
version?: number;
|
|
@@ -38,6 +43,11 @@ export declare const useVariant: () => {
|
|
|
38
43
|
variant: ThemeVariant;
|
|
39
44
|
setVariant: React.Dispatch<React.SetStateAction<ThemeVariant>>;
|
|
40
45
|
};
|
|
46
|
+
export declare const getVariable: (name: string) => {
|
|
47
|
+
name: string;
|
|
48
|
+
value: any;
|
|
49
|
+
} | undefined;
|
|
50
|
+
export declare const getAllVariables: () => Variable[];
|
|
41
51
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
42
52
|
export default ThemeProvider;
|
|
43
53
|
export declare const useThemeValue: (key: string) => string | undefined;
|
|
@@ -49,3 +59,5 @@ export declare const useProjectData: () => ProjectData | null;
|
|
|
49
59
|
export declare const useColor: (colorName: string) => string | undefined;
|
|
50
60
|
export declare const useTypographyValue: (property: string) => string | undefined;
|
|
51
61
|
export declare const useComponentVariant: (componentName: string, variantName?: string) => any;
|
|
62
|
+
export declare const useVariables: () => Variable[];
|
|
63
|
+
export declare const useVariable: (name: string) => any;
|