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/appbar/AppBar.js
CHANGED
|
@@ -33,6 +33,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
37
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
38
|
+
if (ar || !(i in from)) {
|
|
39
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40
|
+
ar[i] = from[i];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
44
|
+
};
|
|
36
45
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
47
|
};
|
|
@@ -40,18 +49,174 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
49
|
exports.default = AppBar;
|
|
41
50
|
var React = __importStar(require("react"));
|
|
42
51
|
var react_1 = require("react");
|
|
43
|
-
var navigation_1 = require("next/navigation");
|
|
52
|
+
var navigation_1 = require("next/navigation");
|
|
44
53
|
var Hamburger_1 = __importDefault(require("./Hamburger"));
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
var componentUtils_1 = require("../../utils/componentUtils");
|
|
55
|
+
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
56
|
+
// Parse string to object utility
|
|
57
|
+
var parseIfString = function (value, fallback) {
|
|
58
|
+
if (typeof value === 'string') {
|
|
59
|
+
try {
|
|
60
|
+
var parsed = JSON.parse(value);
|
|
61
|
+
if (Array.isArray(fallback) && !Array.isArray(parsed)) {
|
|
62
|
+
console.warn('Parsed value is not an array, using fallback');
|
|
63
|
+
return fallback;
|
|
64
|
+
}
|
|
65
|
+
return parsed;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error('Failed to parse JSON string:', error);
|
|
69
|
+
return fallback;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (value == null) {
|
|
73
|
+
return fallback;
|
|
74
|
+
}
|
|
75
|
+
return value;
|
|
76
|
+
};
|
|
77
|
+
// Dropdown Arrow Icon Component
|
|
78
|
+
var DropdownArrow = function (_a) {
|
|
79
|
+
var isOpen = _a.isOpen;
|
|
80
|
+
return (React.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", style: {
|
|
81
|
+
transition: 'transform 0.3s ease',
|
|
82
|
+
transform: isOpen ? 'rotate(180deg)' : 'rotate(0deg)'
|
|
83
|
+
} },
|
|
84
|
+
React.createElement("path", { d: "M4 6 L8 10 L12 6", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" })));
|
|
85
|
+
};
|
|
86
|
+
// Link Item Component with Dropdown Support
|
|
87
|
+
var LinkItem = function (_a) {
|
|
88
|
+
var link = _a.link, renderLink = _a.renderLink, _b = _a.linkPadding, linkPadding = _b === void 0 ? '0.5rem 1rem' : _b, _c = _a.activeLinkColor, activeLinkColor = _c === void 0 ? 'primary' : _c, _d = _a.dropdownArrow, dropdownArrow = _d === void 0 ? true : _d, _e = _a.isMobile, isMobile = _e === void 0 ? false : _e;
|
|
89
|
+
var _f = (0, react_1.useState)(false), isOpen = _f[0], setIsOpen = _f[1];
|
|
90
|
+
var _g = (0, react_1.useState)(null), iconNode = _g[0], setIconNode = _g[1];
|
|
91
|
+
var timeoutRef = (0, react_1.useRef)();
|
|
92
|
+
var dropdownRef = (0, react_1.useRef)(null);
|
|
93
|
+
// Handle dynamic icon loading
|
|
94
|
+
(0, react_1.useEffect)(function () {
|
|
95
|
+
if (link.icon) {
|
|
96
|
+
(0, getDynamicIcon_1.getDynamicIcon)(link.icon).then(setIconNode);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
setIconNode(null);
|
|
100
|
+
}
|
|
101
|
+
}, [link.icon]);
|
|
102
|
+
// Close dropdown when clicking outside
|
|
103
|
+
(0, react_1.useEffect)(function () {
|
|
104
|
+
var handleClickOutside = function (event) {
|
|
105
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
106
|
+
setIsOpen(false);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
if (isOpen) {
|
|
110
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
111
|
+
}
|
|
112
|
+
return function () {
|
|
113
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
114
|
+
};
|
|
115
|
+
}, [isOpen]);
|
|
116
|
+
var hasChildren = link.children && link.children.length > 0;
|
|
117
|
+
var handleMouseEnter = function () {
|
|
118
|
+
if (timeoutRef.current)
|
|
119
|
+
clearTimeout(timeoutRef.current);
|
|
120
|
+
if (!isMobile && hasChildren) {
|
|
121
|
+
setIsOpen(true);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
var handleMouseLeave = function () {
|
|
125
|
+
if (!isMobile) {
|
|
126
|
+
timeoutRef.current = setTimeout(function () { return setIsOpen(false); }, 150);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var handleClick = function (e) {
|
|
130
|
+
if (hasChildren && isMobile) {
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
setIsOpen(!isOpen);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
var linkContent = (React.createElement("span", { className: "nav_link-content ".concat(link.active ? 'active' : '', " ").concat(link.className || ''), style: {
|
|
136
|
+
display: 'flex',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
gap: '0.5rem',
|
|
139
|
+
padding: linkPadding,
|
|
140
|
+
color: 'inherit',
|
|
141
|
+
textDecoration: 'none'
|
|
142
|
+
} },
|
|
143
|
+
iconNode && link.iconPosition !== 'suffix' && (React.createElement("span", { className: "nav_link-icon prefix", style: { display: 'flex', alignItems: 'center' } }, iconNode)),
|
|
144
|
+
React.createElement("span", { className: "nav_link-text" }, link.label),
|
|
145
|
+
iconNode && link.iconPosition === 'suffix' && (React.createElement("span", { className: "nav_link-icon suffix", style: { display: 'flex', alignItems: 'center' } }, iconNode)),
|
|
146
|
+
hasChildren && dropdownArrow && (React.createElement("span", { className: "nav_link-arrow", style: { display: 'flex', alignItems: 'center' } },
|
|
147
|
+
React.createElement(DropdownArrow, { isOpen: isOpen })))));
|
|
148
|
+
// If custom renderer is provided, use it
|
|
149
|
+
if (renderLink) {
|
|
150
|
+
return renderLink(link, 0);
|
|
151
|
+
}
|
|
152
|
+
return (React.createElement("div", { ref: dropdownRef, className: "nav_item ".concat(hasChildren ? 'has-dropdown' : '', " ").concat(isOpen ? 'dropdown-open' : ''), onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, style: { position: 'relative' } },
|
|
153
|
+
React.createElement("a", { href: link.href, className: "nav_link ".concat(link.active ? 'active' : ''), onClick: handleClick, style: {
|
|
154
|
+
textDecoration: 'none',
|
|
155
|
+
color: 'inherit',
|
|
156
|
+
display: 'flex',
|
|
157
|
+
alignItems: 'center'
|
|
158
|
+
} }, linkContent),
|
|
159
|
+
hasChildren && isOpen && (React.createElement("div", { className: "nav_dropdown-menu ".concat(isMobile ? 'nav_dropdown-mobile' : '') }, link.children.map(function (child, index) { return (React.createElement(LinkItem, { key: index, link: child, renderLink: renderLink, linkPadding: linkPadding, activeLinkColor: activeLinkColor, dropdownArrow: dropdownArrow, isMobile: isMobile })); })))));
|
|
160
|
+
};
|
|
161
|
+
// Links component to render navigation links
|
|
162
|
+
var NavLinks = function (_a) {
|
|
163
|
+
var links = _a.links, renderLink = _a.renderLink, _b = _a.linkGap, linkGap = _b === void 0 ? '1rem' : _b, _c = _a.linkPadding, linkPadding = _c === void 0 ? '0.5rem 1rem' : _c, _d = _a.activeLinkColor, activeLinkColor = _d === void 0 ? 'primary' : _d, _e = _a.dropdownArrow, dropdownArrow = _e === void 0 ? true : _e, _f = _a.isMobile, isMobile = _f === void 0 ? false : _f;
|
|
164
|
+
if (!links || !Array.isArray(links) || links.length === 0) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
return (React.createElement("div", { className: "nav_links", style: {
|
|
168
|
+
display: 'flex',
|
|
169
|
+
alignItems: 'center',
|
|
170
|
+
gap: linkGap,
|
|
171
|
+
flexDirection: isMobile ? 'column' : 'row'
|
|
172
|
+
} }, links.map(function (link, index) { return (React.createElement(LinkItem, { key: index, link: link, renderLink: renderLink, linkPadding: linkPadding, activeLinkColor: activeLinkColor, dropdownArrow: dropdownArrow, isMobile: isMobile })); })));
|
|
173
|
+
};
|
|
174
|
+
// Logo component with multiple display options
|
|
175
|
+
var Logo = function (_a) {
|
|
176
|
+
var _b = _a.type, type = _b === void 0 ? 'text' : _b, _c = _a.text, text = _c === void 0 ? 'MyApp' : _c, _d = _a.textSize, textSize = _d === void 0 ? 'xl' : _d, _e = _a.textColor, textColor = _e === void 0 ? 'primary' : _e, _f = _a.textWeight, textWeight = _f === void 0 ? 'bold' : _f, _g = _a.url, url = _g === void 0 ? '' : _g, _h = _a.alt, alt = _h === void 0 ? 'Logo' : _h, _j = _a.width, width = _j === void 0 ? '40px' : _j, _k = _a.height, height = _k === void 0 ? 'auto' : _k, _l = _a.href, href = _l === void 0 ? '/' : _l, onClick = _a.onClick;
|
|
177
|
+
if (type === 'none')
|
|
178
|
+
return null;
|
|
179
|
+
var logoContent = (React.createElement("div", { className: "logo-content", style: { display: 'flex', alignItems: 'center', gap: '0.75rem' } },
|
|
180
|
+
(type === 'image' || type === 'both') && url && (React.createElement("img", { src: url, alt: alt, style: {
|
|
181
|
+
width: width,
|
|
182
|
+
height: height,
|
|
183
|
+
objectFit: 'contain',
|
|
184
|
+
display: 'block'
|
|
185
|
+
}, className: "logo-image" })),
|
|
186
|
+
(type === 'text' || type === 'both') && text && (React.createElement("span", { className: "logo-text text-".concat(textSize, " text-").concat(textColor, " font-").concat(textWeight), style: {
|
|
187
|
+
lineHeight: 1,
|
|
188
|
+
whiteSpace: 'nowrap'
|
|
189
|
+
} }, text))));
|
|
190
|
+
// Wrap in link if href provided
|
|
191
|
+
if (href) {
|
|
192
|
+
return (React.createElement("a", { href: href, onClick: onClick, style: {
|
|
193
|
+
textDecoration: 'none',
|
|
194
|
+
color: 'inherit',
|
|
195
|
+
display: 'flex',
|
|
196
|
+
alignItems: 'center'
|
|
197
|
+
}, className: "logo-link" }, logoContent));
|
|
198
|
+
}
|
|
199
|
+
return (React.createElement("div", { onClick: onClick, style: { cursor: onClick ? 'pointer' : 'default' }, className: "logo-container" }, logoContent));
|
|
200
|
+
};
|
|
201
|
+
function AppBar(localProps) {
|
|
202
|
+
// Use component configuration with variant support
|
|
203
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('AppBar', localProps.variant).mergeWithLocal;
|
|
204
|
+
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
205
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
206
|
+
// Parse link props if they're strings
|
|
207
|
+
var parsedLeftLinks = parseIfString(mergedProps.leftLinks, []);
|
|
208
|
+
var parsedCenterLinks = parseIfString(mergedProps.centerLinks, []);
|
|
209
|
+
var parsedRightLinks = parseIfString(mergedProps.rightLinks, []);
|
|
210
|
+
// Use mergedProps directly
|
|
211
|
+
var final = mergedProps;
|
|
212
|
+
var _a = (0, react_1.useState)(false), isMobileMenuOpen = _a[0], setIsMobileMenuOpen = _a[1];
|
|
213
|
+
var _b = (0, react_1.useState)(false), isMobileScreen = _b[0], setIsMobileScreen = _b[1];
|
|
214
|
+
var pathname = (0, navigation_1.usePathname)();
|
|
50
215
|
var toggleMenu = function () { return setIsMobileMenuOpen(function (prev) { return !prev; }); };
|
|
51
216
|
var closeMenu = function () { return setIsMobileMenuOpen(false); };
|
|
52
217
|
(0, react_1.useEffect)(function () {
|
|
53
218
|
var handleResize = function () {
|
|
54
|
-
var isMobile = window.innerWidth < 992;
|
|
219
|
+
var isMobile = window.innerWidth < (final.mobileMenuBreakpoint || 992);
|
|
55
220
|
setIsMobileScreen(isMobile);
|
|
56
221
|
if (!isMobile) {
|
|
57
222
|
closeMenu(); // close on larger screens
|
|
@@ -60,7 +225,7 @@ function AppBar(_a) {
|
|
|
60
225
|
handleResize(); // initial check
|
|
61
226
|
window.addEventListener('resize', handleResize);
|
|
62
227
|
return function () { return window.removeEventListener('resize', handleResize); };
|
|
63
|
-
}, []);
|
|
228
|
+
}, [final.mobileMenuBreakpoint]);
|
|
64
229
|
// Automatically close menu on route (pathname) change
|
|
65
230
|
(0, react_1.useEffect)(function () {
|
|
66
231
|
closeMenu();
|
|
@@ -69,19 +234,56 @@ function AppBar(_a) {
|
|
|
69
234
|
var isOpen = _a.isOpen;
|
|
70
235
|
return React.createElement(Hamburger_1.default, { isOpen: isOpen });
|
|
71
236
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
237
|
+
// Enhanced left section with logo customization
|
|
238
|
+
var renderLeftSection = function () {
|
|
239
|
+
// If custom left content is provided, use it (overrides everything)
|
|
240
|
+
if (final.left)
|
|
241
|
+
return final.left;
|
|
242
|
+
// Render logo based on configuration
|
|
243
|
+
var shouldRenderLogo = final.logoType && final.logoType !== 'none';
|
|
244
|
+
var hasLeftLinks = parsedLeftLinks.length > 0;
|
|
245
|
+
return (React.createElement("div", { className: "left-section", style: { display: 'flex', alignItems: 'center', gap: '2rem' } },
|
|
246
|
+
shouldRenderLogo && (React.createElement(Logo, { type: final.logoType, text: final.logoText, textSize: final.logoTextSize, textColor: final.logoTextColor, textWeight: final.logoTextWeight, url: final.logoUrl, alt: final.logoAlt, width: final.logoWidth, height: final.logoHeight, href: final.logoHref, onClick: final.onLogoClick })),
|
|
247
|
+
hasLeftLinks && !isMobileScreen && (React.createElement(NavLinks, { links: parsedLeftLinks, renderLink: final.renderLink, linkGap: final.linkGap, linkPadding: final.linkPadding, activeLinkColor: final.activeLinkColor, dropdownArrow: final.dropdownArrow }))));
|
|
248
|
+
};
|
|
249
|
+
var renderCenterSection = function () {
|
|
250
|
+
if (final.center)
|
|
251
|
+
return final.center;
|
|
252
|
+
if (parsedCenterLinks.length > 0 && !isMobileScreen) {
|
|
253
|
+
return (React.createElement(NavLinks, { links: parsedCenterLinks, renderLink: final.renderLink, linkGap: final.linkGap, linkPadding: final.linkPadding, activeLinkColor: final.activeLinkColor, dropdownArrow: final.dropdownArrow }));
|
|
254
|
+
}
|
|
255
|
+
return null;
|
|
256
|
+
};
|
|
257
|
+
var renderRightSection = function () {
|
|
258
|
+
if (final.right)
|
|
259
|
+
return final.right;
|
|
260
|
+
if (parsedRightLinks.length > 0 && !isMobileScreen) {
|
|
261
|
+
return (React.createElement(NavLinks, { links: parsedRightLinks, renderLink: final.renderLink, linkGap: final.linkGap, linkPadding: final.linkPadding, activeLinkColor: final.activeLinkColor, dropdownArrow: final.dropdownArrow }));
|
|
262
|
+
}
|
|
263
|
+
return null;
|
|
264
|
+
};
|
|
265
|
+
// Mobile menu content
|
|
266
|
+
var renderMobileMenu = function () {
|
|
267
|
+
if (!isMobileScreen || !isMobileMenuOpen)
|
|
268
|
+
return null;
|
|
269
|
+
var allLinks = __spreadArray(__spreadArray(__spreadArray([], parsedLeftLinks, true), parsedCenterLinks, true), parsedRightLinks, true);
|
|
270
|
+
return (React.createElement("div", { className: "nav_mobile-menu" },
|
|
271
|
+
React.createElement(NavLinks, { links: allLinks, renderLink: final.renderLink, linkGap: "0.5rem", linkPadding: "1rem", activeLinkColor: final.activeLinkColor, dropdownArrow: final.dropdownArrow, isMobile: true })));
|
|
272
|
+
};
|
|
273
|
+
return (React.createElement(React.Fragment, null,
|
|
274
|
+
React.createElement("nav", { id: 'appBar', className: "navigation-bar\n ".concat(isMobileMenuOpen ? 'navbar-mobile-open' : '', "\n ").concat(final.funcss || '', "\n ").concat(final.fixedTop ? 'fixed_top_navbar' : '', "\n ").concat(final.sideBar ? 'there_is_sidebar' : '', "\n ").concat(final.transparent ? 'transparent' : '', "\n ").concat(final.fixedBottom ? 'fixedBottom' : '', "\n "), style: {
|
|
275
|
+
padding: "".concat(final.padding || ''),
|
|
276
|
+
justifyContent: "".concat(final.justify || ''),
|
|
277
|
+
} },
|
|
278
|
+
React.createElement("div", { className: "logoWrapper" },
|
|
279
|
+
renderLeftSection(),
|
|
280
|
+
isMobileScreen && isMobileMenuOpen && (React.createElement("div", { className: "hover-text-error pointer _closeNav", onClick: closeMenu },
|
|
281
|
+
React.createElement(Trigger, { isOpen: isMobileMenuOpen })))),
|
|
282
|
+
React.createElement("div", { className: "linkWrapper" }, renderCenterSection()),
|
|
283
|
+
React.createElement("div", { className: "linkWrapper" }, renderRightSection()),
|
|
284
|
+
isMobileScreen && !isMobileMenuOpen && (React.createElement(React.Fragment, null, final.hasSidebar ?
|
|
285
|
+
React.createElement("span", { className: "sidebar-trigger pointer hover-text-primary", onClick: final.openSidebar }, final.sidebarTrigger || React.createElement(Trigger, { isOpen: final.sidebarOpen }))
|
|
286
|
+
:
|
|
287
|
+
React.createElement("span", { className: "sidebar-trigger pointer hover-text-primary", onClick: toggleMenu }, final.sidebarTrigger || React.createElement(Trigger, { isOpen: isMobileMenuOpen }))))),
|
|
288
|
+
renderMobileMenu()));
|
|
87
289
|
}
|
package/ui/chart/Bar.js
CHANGED
|
@@ -155,113 +155,17 @@ var CustomTooltip = function (_a) {
|
|
|
155
155
|
react_1.default.createElement("div", { className: "text-error" }, "Error displaying tooltip")));
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
|
-
var Bars = function (
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// Display controls
|
|
170
|
-
_p = _a.showGrid,
|
|
171
|
-
// Display controls
|
|
172
|
-
showGrid = _p === void 0 ? true : _p, _q = _a.horizontalLines, horizontalLines = _q === void 0 ? false : _q, _r = _a.verticalLines, verticalLines = _r === void 0 ? true : _r, _s = _a.showLegend, showLegend = _s === void 0 ? true : _s, _t = _a.showXAxis, showXAxis = _t === void 0 ? true : _t, _u = _a.showYAxis, showYAxis = _u === void 0 ? false : _u, _v = _a.showTooltip, showTooltip = _v === void 0 ? true : _v,
|
|
173
|
-
// Appearance controls
|
|
174
|
-
funcss = _a.funcss, rotateLabel = _a.rotateLabel, xLabelSize = _a.xLabelSize, yLabelSize = _a.yLabelSize, xInterval = _a.xInterval, yInterval = _a.yInterval, gridStroke = _a.gridStroke, _w = _a.gridStrokeDasharray, gridStrokeDasharray = _w === void 0 ? "3 3" : _w,
|
|
175
|
-
// Axis controls
|
|
176
|
-
dy = _a.dy, _x = _a.xAxisProps, xAxisProps = _x === void 0 ? {} : _x, _y = _a.yAxisProps, yAxisProps = _y === void 0 ? {} : _y, xAxisLabel = _a.xAxisLabel, yAxisLabel = _a.yAxisLabel, _z = _a.tickLine, tickLine = _z === void 0 ? true : _z, _0 = _a.axisLine, axisLine = _0 === void 0 ? true : _0,
|
|
177
|
-
// Tooltip / Legend
|
|
178
|
-
tooltipFormatter = _a.tooltipFormatter, _1 = _a.legendProps, legendProps = _1 === void 0 ? {} : _1, _2 = _a.tooltipProps, tooltipProps = _2 === void 0 ? {} : _2, customTooltip = _a.customTooltip,
|
|
179
|
-
// Animation & Interaction
|
|
180
|
-
_3 = _a.animation,
|
|
181
|
-
// Animation & Interaction
|
|
182
|
-
animation = _3 === void 0 ? true : _3, _4 = _a.animationDuration, animationDuration = _4 === void 0 ? 500 : _4, _5 = _a.isAnimationActive, isAnimationActive = _5 === void 0 ? true : _5, syncId = _a.syncId,
|
|
183
|
-
// Stacking & Grouping
|
|
184
|
-
_6 = _a.stackOffset,
|
|
185
|
-
// Stacking & Grouping
|
|
186
|
-
stackOffset = _6 === void 0 ? 'none' : _6, barCategoryGapPercentage = _a.barCategoryGapPercentage,
|
|
187
|
-
// Styling
|
|
188
|
-
chartBackground = _a.chartBackground, borderRadius = _a.borderRadius, padding = _a.padding, _7 = _a.shadow, shadow = _7 === void 0 ? false : _7,
|
|
189
|
-
// Responsive
|
|
190
|
-
aspect = _a.aspect, minHeight = _a.minHeight, maxHeight = _a.maxHeight, minWidth = _a.minWidth, maxWidth = _a.maxWidth,
|
|
191
|
-
// Advanced
|
|
192
|
-
onBarClick = _a.onBarClick, onBarMouseEnter = _a.onBarMouseEnter, onBarMouseLeave = _a.onBarMouseLeave;
|
|
193
|
-
// Use component configuration with variant support and error handling
|
|
194
|
-
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('BarChart', variant).mergeWithLocal;
|
|
195
|
-
// Create local props object with null checks
|
|
196
|
-
var localProps = {
|
|
197
|
-
data: data !== null && data !== void 0 ? data : [],
|
|
198
|
-
series: series !== null && series !== void 0 ? series : [],
|
|
199
|
-
id: id !== null && id !== void 0 ? id : '',
|
|
200
|
-
variant: variant !== null && variant !== void 0 ? variant : '',
|
|
201
|
-
width: width !== null && width !== void 0 ? width : '100%',
|
|
202
|
-
height: height !== null && height !== void 0 ? height : 300,
|
|
203
|
-
layout: layout !== null && layout !== void 0 ? layout : 'horizontal',
|
|
204
|
-
margin: margin !== null && margin !== void 0 ? margin : { top: 10, right: 30, left: 0, bottom: 20 },
|
|
205
|
-
barRadius: barRadius !== null && barRadius !== void 0 ? barRadius : 6,
|
|
206
|
-
barSize: barSize !== null && barSize !== void 0 ? barSize : 30,
|
|
207
|
-
barGap: barGap !== null && barGap !== void 0 ? barGap : 4,
|
|
208
|
-
barCategoryGap: barCategoryGap !== null && barCategoryGap !== void 0 ? barCategoryGap : '10%',
|
|
209
|
-
maxBarSize: maxBarSize !== null && maxBarSize !== void 0 ? maxBarSize : 100,
|
|
210
|
-
showGrid: showGrid !== null && showGrid !== void 0 ? showGrid : true,
|
|
211
|
-
horizontalLines: horizontalLines !== null && horizontalLines !== void 0 ? horizontalLines : false,
|
|
212
|
-
verticalLines: verticalLines !== null && verticalLines !== void 0 ? verticalLines : true,
|
|
213
|
-
showLegend: showLegend !== null && showLegend !== void 0 ? showLegend : true,
|
|
214
|
-
showXAxis: showXAxis !== null && showXAxis !== void 0 ? showXAxis : true,
|
|
215
|
-
showYAxis: showYAxis !== null && showYAxis !== void 0 ? showYAxis : false,
|
|
216
|
-
showTooltip: showTooltip !== null && showTooltip !== void 0 ? showTooltip : true,
|
|
217
|
-
funcss: funcss !== null && funcss !== void 0 ? funcss : '',
|
|
218
|
-
rotateLabel: rotateLabel !== null && rotateLabel !== void 0 ? rotateLabel : 0,
|
|
219
|
-
xLabelSize: xLabelSize !== null && xLabelSize !== void 0 ? xLabelSize : "0.8rem",
|
|
220
|
-
yLabelSize: yLabelSize !== null && yLabelSize !== void 0 ? yLabelSize : "0.8rem",
|
|
221
|
-
xInterval: xInterval !== null && xInterval !== void 0 ? xInterval : undefined,
|
|
222
|
-
yInterval: yInterval !== null && yInterval !== void 0 ? yInterval : undefined,
|
|
223
|
-
gridStroke: gridStroke !== null && gridStroke !== void 0 ? gridStroke : '',
|
|
224
|
-
gridStrokeDasharray: gridStrokeDasharray !== null && gridStrokeDasharray !== void 0 ? gridStrokeDasharray : "3 3",
|
|
225
|
-
dy: dy !== null && dy !== void 0 ? dy : 0,
|
|
226
|
-
xAxisProps: xAxisProps !== null && xAxisProps !== void 0 ? xAxisProps : {},
|
|
227
|
-
yAxisProps: yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {},
|
|
228
|
-
xAxisLabel: xAxisLabel !== null && xAxisLabel !== void 0 ? xAxisLabel : '',
|
|
229
|
-
yAxisLabel: yAxisLabel !== null && yAxisLabel !== void 0 ? yAxisLabel : '',
|
|
230
|
-
tickLine: tickLine !== null && tickLine !== void 0 ? tickLine : true,
|
|
231
|
-
axisLine: axisLine !== null && axisLine !== void 0 ? axisLine : true,
|
|
232
|
-
tooltipFormatter: tooltipFormatter !== null && tooltipFormatter !== void 0 ? tooltipFormatter : undefined,
|
|
233
|
-
legendProps: legendProps !== null && legendProps !== void 0 ? legendProps : {},
|
|
234
|
-
tooltipProps: tooltipProps !== null && tooltipProps !== void 0 ? tooltipProps : {},
|
|
235
|
-
customTooltip: customTooltip !== null && customTooltip !== void 0 ? customTooltip : undefined,
|
|
236
|
-
animation: animation !== null && animation !== void 0 ? animation : true,
|
|
237
|
-
animationDuration: animationDuration !== null && animationDuration !== void 0 ? animationDuration : 500,
|
|
238
|
-
isAnimationActive: isAnimationActive !== null && isAnimationActive !== void 0 ? isAnimationActive : true,
|
|
239
|
-
syncId: syncId !== null && syncId !== void 0 ? syncId : '',
|
|
240
|
-
stackOffset: stackOffset !== null && stackOffset !== void 0 ? stackOffset : 'none',
|
|
241
|
-
barCategoryGapPercentage: barCategoryGapPercentage !== null && barCategoryGapPercentage !== void 0 ? barCategoryGapPercentage : undefined,
|
|
242
|
-
chartBackground: chartBackground !== null && chartBackground !== void 0 ? chartBackground : '',
|
|
243
|
-
borderRadius: borderRadius !== null && borderRadius !== void 0 ? borderRadius : '',
|
|
244
|
-
padding: padding !== null && padding !== void 0 ? padding : '',
|
|
245
|
-
shadow: shadow !== null && shadow !== void 0 ? shadow : false,
|
|
246
|
-
aspect: aspect !== null && aspect !== void 0 ? aspect : undefined,
|
|
247
|
-
minHeight: minHeight !== null && minHeight !== void 0 ? minHeight : undefined,
|
|
248
|
-
maxHeight: maxHeight !== null && maxHeight !== void 0 ? maxHeight : undefined,
|
|
249
|
-
minWidth: minWidth !== null && minWidth !== void 0 ? minWidth : undefined,
|
|
250
|
-
maxWidth: maxWidth !== null && maxWidth !== void 0 ? maxWidth : undefined,
|
|
251
|
-
onBarClick: onBarClick !== null && onBarClick !== void 0 ? onBarClick : undefined,
|
|
252
|
-
onBarMouseEnter: onBarMouseEnter !== null && onBarMouseEnter !== void 0 ? onBarMouseEnter : undefined,
|
|
253
|
-
onBarMouseLeave: onBarMouseLeave !== null && onBarMouseLeave !== void 0 ? onBarMouseLeave : undefined
|
|
254
|
-
};
|
|
255
|
-
// Merge with config - LOCAL PROPS OVERRIDE CONFIG with error handling
|
|
256
|
-
var mergedProps;
|
|
257
|
-
try {
|
|
258
|
-
var result = mergeWithLocal(localProps);
|
|
259
|
-
mergedProps = (_b = result === null || result === void 0 ? void 0 : result.props) !== null && _b !== void 0 ? _b : localProps;
|
|
260
|
-
}
|
|
261
|
-
catch (error) {
|
|
262
|
-
console.error('Error merging component configuration:', error);
|
|
263
|
-
mergedProps = localProps;
|
|
264
|
-
}
|
|
158
|
+
var Bars = function (localProps) {
|
|
159
|
+
var _a;
|
|
160
|
+
// Use component configuration with variant support
|
|
161
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Bar', localProps.variant).mergeWithLocal;
|
|
162
|
+
// Merge with config - LOCAL PROPS OVERRIDE CONFIG
|
|
163
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
164
|
+
// Debug: Log what props are actually coming through
|
|
165
|
+
react_1.default.useEffect(function () {
|
|
166
|
+
console.log('Bars merged props:', mergedProps);
|
|
167
|
+
console.log('Bars config available:', Object.keys(mergedProps).length > 0);
|
|
168
|
+
}, [mergedProps]);
|
|
265
169
|
// Parse data and series if they're strings with enhanced validation
|
|
266
170
|
var parsedData = (0, react_1.useMemo)(function () {
|
|
267
171
|
var parsed = parseIfString(mergedProps.data, []);
|
|
@@ -276,66 +180,8 @@ var Bars = function (_a) {
|
|
|
276
180
|
// Check if we have valid data to display
|
|
277
181
|
var hasValidData = parsedData.length > 0 && parsedSeries.length > 0;
|
|
278
182
|
var isVertical = mergedProps.layout === 'vertical';
|
|
279
|
-
//
|
|
280
|
-
var final =
|
|
281
|
-
data: parsedData,
|
|
282
|
-
series: parsedSeries,
|
|
283
|
-
id: mergedProps.id || 'bar-chart',
|
|
284
|
-
variant: mergedProps.variant,
|
|
285
|
-
width: mergedProps.width,
|
|
286
|
-
height: mergedProps.height,
|
|
287
|
-
layout: mergedProps.layout,
|
|
288
|
-
margin: mergedProps.margin,
|
|
289
|
-
barRadius: mergedProps.barRadius,
|
|
290
|
-
barSize: mergedProps.barSize,
|
|
291
|
-
barGap: mergedProps.barGap,
|
|
292
|
-
barCategoryGap: mergedProps.barCategoryGap,
|
|
293
|
-
maxBarSize: mergedProps.maxBarSize,
|
|
294
|
-
showGrid: mergedProps.showGrid,
|
|
295
|
-
horizontalLines: mergedProps.horizontalLines,
|
|
296
|
-
verticalLines: mergedProps.verticalLines,
|
|
297
|
-
showLegend: mergedProps.showLegend,
|
|
298
|
-
showXAxis: mergedProps.showXAxis,
|
|
299
|
-
showYAxis: mergedProps.showYAxis,
|
|
300
|
-
showTooltip: mergedProps.showTooltip,
|
|
301
|
-
funcss: mergedProps.funcss,
|
|
302
|
-
rotateLabel: mergedProps.rotateLabel,
|
|
303
|
-
xLabelSize: mergedProps.xLabelSize,
|
|
304
|
-
yLabelSize: mergedProps.yLabelSize,
|
|
305
|
-
xInterval: mergedProps.xInterval,
|
|
306
|
-
yInterval: mergedProps.yInterval,
|
|
307
|
-
gridStroke: mergedProps.gridStroke,
|
|
308
|
-
gridStrokeDasharray: mergedProps.gridStrokeDasharray,
|
|
309
|
-
dy: mergedProps.dy,
|
|
310
|
-
xAxisProps: mergedProps.xAxisProps,
|
|
311
|
-
yAxisProps: mergedProps.yAxisProps,
|
|
312
|
-
xAxisLabel: mergedProps.xAxisLabel,
|
|
313
|
-
yAxisLabel: mergedProps.yAxisLabel,
|
|
314
|
-
tickLine: mergedProps.tickLine,
|
|
315
|
-
axisLine: mergedProps.axisLine,
|
|
316
|
-
tooltipFormatter: mergedProps.tooltipFormatter,
|
|
317
|
-
legendProps: mergedProps.legendProps,
|
|
318
|
-
tooltipProps: mergedProps.tooltipProps,
|
|
319
|
-
customTooltip: mergedProps.customTooltip,
|
|
320
|
-
animation: mergedProps.animation,
|
|
321
|
-
animationDuration: mergedProps.animationDuration,
|
|
322
|
-
isAnimationActive: mergedProps.isAnimationActive,
|
|
323
|
-
syncId: mergedProps.syncId,
|
|
324
|
-
stackOffset: mergedProps.stackOffset,
|
|
325
|
-
barCategoryGapPercentage: mergedProps.barCategoryGapPercentage,
|
|
326
|
-
chartBackground: mergedProps.chartBackground,
|
|
327
|
-
borderRadius: mergedProps.borderRadius,
|
|
328
|
-
padding: mergedProps.padding,
|
|
329
|
-
shadow: mergedProps.shadow,
|
|
330
|
-
aspect: mergedProps.aspect,
|
|
331
|
-
minHeight: mergedProps.minHeight,
|
|
332
|
-
maxHeight: mergedProps.maxHeight,
|
|
333
|
-
minWidth: mergedProps.minWidth,
|
|
334
|
-
maxWidth: mergedProps.maxWidth,
|
|
335
|
-
onBarClick: mergedProps.onBarClick,
|
|
336
|
-
onBarMouseEnter: mergedProps.onBarMouseEnter,
|
|
337
|
-
onBarMouseLeave: mergedProps.onBarMouseLeave
|
|
338
|
-
}); }, [parsedData, parsedSeries, mergedProps, hasValidData]);
|
|
183
|
+
// Use mergedProps directly - no need for complex fallback logic
|
|
184
|
+
var final = mergedProps;
|
|
339
185
|
// Smart default margins based on layout
|
|
340
186
|
var smartMargin = (0, react_1.useMemo)(function () {
|
|
341
187
|
var baseMargin = { top: 10, right: 30, left: 0, bottom: 20 };
|
|
@@ -384,9 +230,9 @@ var Bars = function (_a) {
|
|
|
384
230
|
react_1.default.createElement("div", null, "No chart data available"))));
|
|
385
231
|
}
|
|
386
232
|
return (react_1.default.createElement(recharts_1.ResponsiveContainer, { width: final.width, height: smartHeight, aspect: final.aspect, className: final.funcss, style: containerStyle },
|
|
387
|
-
react_1.default.createElement(recharts_1.BarChart, { data:
|
|
233
|
+
react_1.default.createElement(recharts_1.BarChart, { data: parsedData, layout: final.layout, margin: smartMargin, barGap: final.barGap, barCategoryGap: final.barCategoryGap, stackOffset: final.stackOffset, syncId: final.syncId },
|
|
388
234
|
final.showGrid && (react_1.default.createElement(recharts_1.CartesianGrid, { strokeDasharray: final.gridStrokeDasharray, stroke: final.gridStroke || getCssVar('border-color') || '#e2e8f0', horizontal: final.horizontalLines !== false, vertical: final.verticalLines !== false })),
|
|
389
|
-
final.showXAxis && (react_1.default.createElement(recharts_1.XAxis, __assign({ type: isVertical ? 'number' : 'category', dataKey: isVertical ? undefined : 'label', interval: final.xInterval, padding: { left: 10, right: 10 }, fontSize: final.xLabelSize, strokeWidth: 0.2, angle: final.rotateLabel || (isVertical ? 0 : -35), dy: (
|
|
235
|
+
final.showXAxis && (react_1.default.createElement(recharts_1.XAxis, __assign({ type: isVertical ? 'number' : 'category', dataKey: isVertical ? undefined : 'label', interval: final.xInterval, padding: { left: 10, right: 10 }, fontSize: final.xLabelSize, strokeWidth: 0.2, angle: final.rotateLabel || (isVertical ? 0 : -35), dy: (_a = final.dy) !== null && _a !== void 0 ? _a : (isVertical ? 0 : 10), tickLine: final.tickLine, axisLine: final.axisLine, label: final.xAxisLabel ? {
|
|
390
236
|
value: final.xAxisLabel,
|
|
391
237
|
position: isVertical ? 'insideBottom' : 'insideBottom',
|
|
392
238
|
offset: isVertical ? -10 : -30
|
|
@@ -398,7 +244,7 @@ var Bars = function (_a) {
|
|
|
398
244
|
} : undefined }, final.yAxisProps))),
|
|
399
245
|
final.showTooltip && (react_1.default.createElement(recharts_1.Tooltip, __assign({ content: react_1.default.createElement(TooltipComponent, { formatter: final.tooltipFormatter }), formatter: final.tooltipFormatter }, final.tooltipProps))),
|
|
400
246
|
final.showLegend && react_1.default.createElement(recharts_1.Legend, __assign({}, final.legendProps)),
|
|
401
|
-
|
|
247
|
+
parsedSeries.map(function (s, index) {
|
|
402
248
|
if (!s || !s.dataKey) {
|
|
403
249
|
console.warn('Invalid series configuration at index:', index);
|
|
404
250
|
return null;
|