funuicss 3.7.1 → 3.7.2
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 +547 -67
- package/index.d.ts +1 -1
- package/index.js +6 -1
- package/package.json +1 -1
- package/ui/calendar/Calendar.js +1 -1
- package/ui/chart/Bar.d.ts +98 -12
- package/ui/chart/Bar.js +387 -40
- package/ui/chart/Pie.d.ts +61 -7
- package/ui/chart/Pie.js +314 -38
- package/ui/drop/Dropdown.d.ts +4 -3
- package/ui/drop/Dropdown.js +24 -29
- package/ui/input/Input.js +3 -7
- package/ui/richtext/RichText.js +1 -1
- package/ui/specials/Circle.d.ts +2 -1
- package/ui/specials/Circle.js +2 -5
- package/ui/table/Table.js +55 -49
- package/ui/text/Text.d.ts +1 -1
- package/ui/text/Text.js +50 -49
- package/ui/theme/theme.d.ts +34 -0
- package/ui/theme/theme.js +198 -18
- package/ui/vista/Vista.js +135 -49
- package/utils/componentUtils.js +27 -4
package/ui/theme/theme.js
CHANGED
|
@@ -70,7 +70,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
73
|
-
exports.useVariable = exports.useVariables = exports.useComponentVariant = exports.useTypographyValue = exports.useColor = exports.useProjectData = exports.useThemeConfig = exports.useTypography = exports.useColors = exports.useComponentConfig = exports.useThemeValue = exports.getAllVariables = exports.getVariable = exports.useVariant = exports.useTheme = void 0;
|
|
73
|
+
exports.useDocumentAssets = exports.useAudioAssets = exports.useVideoAssets = exports.useImageAssets = exports.useAssetsByType = exports.useAssetInfo = exports.useAssetType = exports.useAssetValue = exports.useAsset = exports.useAssets = exports.getAssetInfo = exports.getAssetType = exports.getAssetValue = exports.getAllAssets = exports.getAsset = exports.useVariable = exports.useVariables = exports.useComponentVariant = exports.useTypographyValue = exports.useColor = exports.useProjectData = exports.useThemeConfig = exports.useTypography = exports.useColors = exports.useComponentConfig = exports.useThemeValue = exports.getAllVariables = exports.getVariable = exports.useVariant = exports.useTheme = void 0;
|
|
74
74
|
var react_1 = __importStar(require("react"));
|
|
75
75
|
var themes_1 = require("./themes");
|
|
76
76
|
var darkenUtils_1 = require("./darkenUtils");
|
|
@@ -97,10 +97,70 @@ var useVariant = function () {
|
|
|
97
97
|
};
|
|
98
98
|
exports.useVariant = useVariant;
|
|
99
99
|
/* -------------------------------------------------------------------------- */
|
|
100
|
+
/* ORIGIN VALIDATION */
|
|
101
|
+
/* -------------------------------------------------------------------------- */
|
|
102
|
+
var getCurrentOrigin = function () {
|
|
103
|
+
if (typeof window === 'undefined')
|
|
104
|
+
return '';
|
|
105
|
+
// For local development, return localhost
|
|
106
|
+
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
|
|
107
|
+
return 'localhost';
|
|
108
|
+
}
|
|
109
|
+
// For production, return the domain without protocol and www
|
|
110
|
+
var domain = window.location.hostname;
|
|
111
|
+
domain = domain.replace(/^www\./, '');
|
|
112
|
+
return domain;
|
|
113
|
+
};
|
|
114
|
+
var validateOriginAccess = function (projectId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
|
+
var currentOrigin, projectData, trustedDomains, hasAccess, error_1;
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
switch (_a.label) {
|
|
118
|
+
case 0:
|
|
119
|
+
if (!projectId) {
|
|
120
|
+
console.error('❌ No project ID provided');
|
|
121
|
+
return [2 /*return*/, false];
|
|
122
|
+
}
|
|
123
|
+
currentOrigin = getCurrentOrigin();
|
|
124
|
+
console.log("\uD83D\uDD0D Validating origin access for: ".concat(currentOrigin));
|
|
125
|
+
_a.label = 1;
|
|
126
|
+
case 1:
|
|
127
|
+
_a.trys.push([1, 3, , 4]);
|
|
128
|
+
return [4 /*yield*/, loadThemeFromCDN(projectId)];
|
|
129
|
+
case 2:
|
|
130
|
+
projectData = _a.sent();
|
|
131
|
+
if (!projectData) {
|
|
132
|
+
console.error('❌ Project not found or inaccessible');
|
|
133
|
+
return [2 /*return*/, false];
|
|
134
|
+
}
|
|
135
|
+
trustedDomains = projectData.trustedDomains || [];
|
|
136
|
+
hasAccess = trustedDomains.some(function (domain) {
|
|
137
|
+
var trustedDomain = domain.domain.toLowerCase();
|
|
138
|
+
var currentDomain = currentOrigin.toLowerCase();
|
|
139
|
+
// Exact match or subdomain match
|
|
140
|
+
return currentDomain === trustedDomain ||
|
|
141
|
+
currentDomain.endsWith('.' + trustedDomain) ||
|
|
142
|
+
(trustedDomain === 'localhost' && currentOrigin === 'localhost');
|
|
143
|
+
});
|
|
144
|
+
if (!hasAccess) {
|
|
145
|
+
console.error("\u274C Access denied: Origin \"".concat(currentOrigin, "\" is not in trusted domains"));
|
|
146
|
+
console.log('📋 Trusted domains:', trustedDomains.map(function (d) { return d.domain; }));
|
|
147
|
+
return [2 /*return*/, false];
|
|
148
|
+
}
|
|
149
|
+
console.log('✅ Origin validation passed');
|
|
150
|
+
return [2 /*return*/, true];
|
|
151
|
+
case 3:
|
|
152
|
+
error_1 = _a.sent();
|
|
153
|
+
console.error('❌ Error during origin validation:', error_1);
|
|
154
|
+
return [2 /*return*/, false];
|
|
155
|
+
case 4: return [2 /*return*/];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}); };
|
|
159
|
+
/* -------------------------------------------------------------------------- */
|
|
100
160
|
/* LOCAL FILE MANAGEMENT */
|
|
101
161
|
/* -------------------------------------------------------------------------- */
|
|
102
162
|
var loadLocalTheme = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
-
var response, data,
|
|
163
|
+
var response, data, error_2;
|
|
104
164
|
return __generator(this, function (_a) {
|
|
105
165
|
switch (_a.label) {
|
|
106
166
|
case 0:
|
|
@@ -118,7 +178,7 @@ var loadLocalTheme = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
118
178
|
return [2 /*return*/, data];
|
|
119
179
|
case 3: return [3 /*break*/, 5];
|
|
120
180
|
case 4:
|
|
121
|
-
|
|
181
|
+
error_2 = _a.sent();
|
|
122
182
|
console.log('No local theme file found');
|
|
123
183
|
return [3 /*break*/, 5];
|
|
124
184
|
case 5: return [2 /*return*/, null];
|
|
@@ -129,7 +189,7 @@ var loadLocalTheme = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
129
189
|
/* CDN THEME LOADER */
|
|
130
190
|
/* -------------------------------------------------------------------------- */
|
|
131
191
|
var loadThemeFromCDN = function (projectId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
132
|
-
var publicUrl, response, data,
|
|
192
|
+
var publicUrl, response, data, error_3;
|
|
133
193
|
return __generator(this, function (_a) {
|
|
134
194
|
switch (_a.label) {
|
|
135
195
|
case 0:
|
|
@@ -151,8 +211,8 @@ var loadThemeFromCDN = function (projectId) { return __awaiter(void 0, void 0, v
|
|
|
151
211
|
_a.label = 4;
|
|
152
212
|
case 4: return [3 /*break*/, 6];
|
|
153
213
|
case 5:
|
|
154
|
-
|
|
155
|
-
console.error('Error loading from Firebase Storage:',
|
|
214
|
+
error_3 = _a.sent();
|
|
215
|
+
console.error('Error loading from Firebase Storage:', error_3);
|
|
156
216
|
return [3 /*break*/, 6];
|
|
157
217
|
case 6: return [2 /*return*/, null];
|
|
158
218
|
}
|
|
@@ -246,9 +306,16 @@ var ThemeProvider = function (_a) {
|
|
|
246
306
|
});
|
|
247
307
|
}
|
|
248
308
|
}, [theme]);
|
|
249
|
-
/* ---------------------- CDN Theme Sync with
|
|
309
|
+
/* ---------------------- CDN Theme Sync with Origin Validation ----------------------- */
|
|
250
310
|
(0, react_1.useEffect)(function () {
|
|
251
|
-
if (typeof window === 'undefined'
|
|
311
|
+
if (typeof window === 'undefined') {
|
|
312
|
+
setIsLoading(false);
|
|
313
|
+
setIsInitialLoad(false);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if (!projectId) {
|
|
317
|
+
console.error('❌ ThemeProvider: No projectId provided');
|
|
318
|
+
setError('Project ID is required');
|
|
252
319
|
setIsLoading(false);
|
|
253
320
|
setIsInitialLoad(false);
|
|
254
321
|
return;
|
|
@@ -256,17 +323,27 @@ var ThemeProvider = function (_a) {
|
|
|
256
323
|
var root = document.documentElement;
|
|
257
324
|
var pollTimer;
|
|
258
325
|
var syncTheme = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
259
|
-
var localTheme, localVersion, cdnTheme, cdnVersion, err_1;
|
|
326
|
+
var hasAccess, localTheme, localVersion, cdnTheme, cdnVersion, err_1;
|
|
260
327
|
return __generator(this, function (_a) {
|
|
261
328
|
switch (_a.label) {
|
|
262
329
|
case 0:
|
|
263
|
-
_a.trys.push([0,
|
|
264
|
-
|
|
330
|
+
_a.trys.push([0, 4, 5, 6]);
|
|
331
|
+
console.log('🔄 Starting theme sync with origin validation...');
|
|
332
|
+
return [4 /*yield*/, validateOriginAccess(projectId)];
|
|
265
333
|
case 1:
|
|
334
|
+
hasAccess = _a.sent();
|
|
335
|
+
if (!hasAccess) {
|
|
336
|
+
setError('Access denied: This domain is not authorized to use this theme');
|
|
337
|
+
setIsLoading(false);
|
|
338
|
+
setIsInitialLoad(false);
|
|
339
|
+
return [2 /*return*/];
|
|
340
|
+
}
|
|
341
|
+
return [4 /*yield*/, loadLocalTheme()];
|
|
342
|
+
case 2:
|
|
266
343
|
localTheme = _a.sent();
|
|
267
344
|
localVersion = (localTheme === null || localTheme === void 0 ? void 0 : localTheme.version) || 0;
|
|
268
345
|
return [4 /*yield*/, loadThemeFromCDN(projectId)];
|
|
269
|
-
case
|
|
346
|
+
case 3:
|
|
270
347
|
cdnTheme = _a.sent();
|
|
271
348
|
cdnVersion = (cdnTheme === null || cdnTheme === void 0 ? void 0 : cdnTheme.version) || 0;
|
|
272
349
|
if (cdnTheme) {
|
|
@@ -298,17 +375,17 @@ var ThemeProvider = function (_a) {
|
|
|
298
375
|
console.warn('⚠️ No theme found');
|
|
299
376
|
setError('Theme not found');
|
|
300
377
|
}
|
|
301
|
-
return [3 /*break*/,
|
|
302
|
-
case
|
|
378
|
+
return [3 /*break*/, 6];
|
|
379
|
+
case 4:
|
|
303
380
|
err_1 = _a.sent();
|
|
304
|
-
console.error('Error syncing theme:', err_1);
|
|
381
|
+
console.error('❌ Error syncing theme:', err_1);
|
|
305
382
|
setError('Failed to sync theme');
|
|
306
|
-
return [3 /*break*/,
|
|
307
|
-
case
|
|
383
|
+
return [3 /*break*/, 6];
|
|
384
|
+
case 5:
|
|
308
385
|
setIsLoading(false);
|
|
309
386
|
setIsInitialLoad(false);
|
|
310
387
|
return [7 /*endfinally*/];
|
|
311
|
-
case
|
|
388
|
+
case 6: return [2 /*return*/];
|
|
312
389
|
}
|
|
313
390
|
});
|
|
314
391
|
}); };
|
|
@@ -331,6 +408,8 @@ var ThemeProvider = function (_a) {
|
|
|
331
408
|
setProjectData(data);
|
|
332
409
|
// Cache for variable access
|
|
333
410
|
cachedProjectData = data;
|
|
411
|
+
// Cache for asset access
|
|
412
|
+
cachedAssets = data.assets || [];
|
|
334
413
|
// Apply all theme config to CSS variables
|
|
335
414
|
applyThemeConfig(themeConfig, root);
|
|
336
415
|
};
|
|
@@ -417,3 +496,104 @@ var useVariable = function (name) {
|
|
|
417
496
|
return variable === null || variable === void 0 ? void 0 : variable.value;
|
|
418
497
|
};
|
|
419
498
|
exports.useVariable = useVariable;
|
|
499
|
+
var cachedAssets = [];
|
|
500
|
+
var getAsset = function (name) {
|
|
501
|
+
if (!cachedAssets.length) {
|
|
502
|
+
console.warn('No assets available. Make sure ThemeProvider is mounted and assets are loaded.');
|
|
503
|
+
return undefined;
|
|
504
|
+
}
|
|
505
|
+
var asset = cachedAssets.find(function (a) { return a.name === name; });
|
|
506
|
+
return asset;
|
|
507
|
+
};
|
|
508
|
+
exports.getAsset = getAsset;
|
|
509
|
+
var getAllAssets = function () {
|
|
510
|
+
return cachedAssets;
|
|
511
|
+
};
|
|
512
|
+
exports.getAllAssets = getAllAssets;
|
|
513
|
+
var getAssetValue = function (name) {
|
|
514
|
+
var asset = (0, exports.getAsset)(name);
|
|
515
|
+
return asset === null || asset === void 0 ? void 0 : asset.url;
|
|
516
|
+
};
|
|
517
|
+
exports.getAssetValue = getAssetValue;
|
|
518
|
+
var getAssetType = function (name) {
|
|
519
|
+
var asset = (0, exports.getAsset)(name);
|
|
520
|
+
return asset === null || asset === void 0 ? void 0 : asset.file_type;
|
|
521
|
+
};
|
|
522
|
+
exports.getAssetType = getAssetType;
|
|
523
|
+
var getAssetInfo = function (name) {
|
|
524
|
+
var asset = (0, exports.getAsset)(name);
|
|
525
|
+
if (!asset)
|
|
526
|
+
return undefined;
|
|
527
|
+
return {
|
|
528
|
+
value: asset.url,
|
|
529
|
+
type: asset.file_type,
|
|
530
|
+
name: asset.name
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
exports.getAssetInfo = getAssetInfo;
|
|
534
|
+
/* -------------------------------------------------------------------------- */
|
|
535
|
+
/* ASSETS HOOKS */
|
|
536
|
+
/* -------------------------------------------------------------------------- */
|
|
537
|
+
// Hook to access all assets
|
|
538
|
+
var useAssets = function () {
|
|
539
|
+
var projectData = (0, exports.useTheme)().projectData;
|
|
540
|
+
return (projectData === null || projectData === void 0 ? void 0 : projectData.assets) || [];
|
|
541
|
+
};
|
|
542
|
+
exports.useAssets = useAssets;
|
|
543
|
+
// Hook to get a specific asset
|
|
544
|
+
var useAsset = function (name) {
|
|
545
|
+
var assets = (0, exports.useAssets)();
|
|
546
|
+
var asset = assets.find(function (a) { return a.name === name; });
|
|
547
|
+
return asset;
|
|
548
|
+
};
|
|
549
|
+
exports.useAsset = useAsset;
|
|
550
|
+
// Hook to get asset URL (most common use case)
|
|
551
|
+
var useAssetValue = function (name) {
|
|
552
|
+
var asset = (0, exports.useAsset)(name);
|
|
553
|
+
return asset === null || asset === void 0 ? void 0 : asset.url;
|
|
554
|
+
};
|
|
555
|
+
exports.useAssetValue = useAssetValue;
|
|
556
|
+
// Hook to get asset type
|
|
557
|
+
var useAssetType = function (name) {
|
|
558
|
+
var asset = (0, exports.useAsset)(name);
|
|
559
|
+
return asset === null || asset === void 0 ? void 0 : asset.file_type;
|
|
560
|
+
};
|
|
561
|
+
exports.useAssetType = useAssetType;
|
|
562
|
+
// Hook to get complete asset info
|
|
563
|
+
var useAssetInfo = function (name) {
|
|
564
|
+
var asset = (0, exports.useAsset)(name);
|
|
565
|
+
if (!asset)
|
|
566
|
+
return undefined;
|
|
567
|
+
return {
|
|
568
|
+
value: asset.url,
|
|
569
|
+
type: asset.file_type,
|
|
570
|
+
name: asset.name
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
exports.useAssetInfo = useAssetInfo;
|
|
574
|
+
// Hook to filter assets by type
|
|
575
|
+
var useAssetsByType = function (type) {
|
|
576
|
+
var assets = (0, exports.useAssets)();
|
|
577
|
+
return assets.filter(function (asset) { return asset.file_type === type; });
|
|
578
|
+
};
|
|
579
|
+
exports.useAssetsByType = useAssetsByType;
|
|
580
|
+
// Hook to get image assets
|
|
581
|
+
var useImageAssets = function () {
|
|
582
|
+
return (0, exports.useAssetsByType)('image');
|
|
583
|
+
};
|
|
584
|
+
exports.useImageAssets = useImageAssets;
|
|
585
|
+
// Hook to get video assets
|
|
586
|
+
var useVideoAssets = function () {
|
|
587
|
+
return (0, exports.useAssetsByType)('video');
|
|
588
|
+
};
|
|
589
|
+
exports.useVideoAssets = useVideoAssets;
|
|
590
|
+
// Hook to get audio assets
|
|
591
|
+
var useAudioAssets = function () {
|
|
592
|
+
return (0, exports.useAssetsByType)('audio');
|
|
593
|
+
};
|
|
594
|
+
exports.useAudioAssets = useAudioAssets;
|
|
595
|
+
// Hook to get document assets
|
|
596
|
+
var useDocumentAssets = function () {
|
|
597
|
+
return (0, exports.useAssetsByType)('document');
|
|
598
|
+
};
|
|
599
|
+
exports.useDocumentAssets = useDocumentAssets;
|
package/ui/vista/Vista.js
CHANGED
|
@@ -21,8 +21,8 @@ var getCssVariable_1 = require("../../utils/getCssVariable");
|
|
|
21
21
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
22
22
|
var Text_1 = __importDefault(require("../text/Text"));
|
|
23
23
|
var Col_1 = __importDefault(require("../grid/Col"));
|
|
24
|
-
var Button_1 = __importDefault(require("../button/Button"));
|
|
25
|
-
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
24
|
+
var Button_1 = __importDefault(require("../button/Button"));
|
|
25
|
+
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
26
26
|
var Vista = function (_a) {
|
|
27
27
|
var _b = _a.layout, layout = _b === void 0 ? 'imageRight' : _b, _c = _a.reverse, reverse = _c === void 0 ? false : _c, _d = _a.bg, bg = _d === void 0 ? '' : _d, _e = _a.padding, padding = _e === void 0 ? 'padding-lg' : _e, _f = _a.textAlign, textAlign = _f === void 0 ? 'left' : _f, _g = _a.imgPosition, imgPosition = _g === void 0 ? 'top' : _g, _h = _a.funcss, funcss = _h === void 0 ? '' : _h, _j = _a.pattern, pattern = _j === void 0 ? '' : _j, _k = _a.patternOpacity, patternOpacity = _k === void 0 ? pattern === 'grid' ? 0.15 : pattern === 'dots' ? 0.4 : pattern === 'diagonal' ? 0.2 : pattern === 'checkerboard' ? 0.2 : pattern === 'horizontal' ? 0.2 : pattern === 'vertical' ? 0.2 : 0.1 : _k,
|
|
28
28
|
// Enhanced Content
|
|
@@ -37,8 +37,8 @@ var Vista = function (_a) {
|
|
|
37
37
|
showPrimaryCTA = _19 === void 0 ? false : _19, _20 = _a.showSecondaryCTA, showSecondaryCTA = _20 === void 0 ? false : _20, _21 = _a.showAccentCTA, showAccentCTA = _21 === void 0 ? false : _21, _22 = _a.primaryButtonOutlined, primaryButtonOutlined = _22 === void 0 ? false : _22, _23 = _a.secondaryButtonOutlined, secondaryButtonOutlined = _23 === void 0 ? false : _23, _24 = _a.accentButtonOutlined, accentButtonOutlined = _24 === void 0 ? false : _24, _25 = _a.ctaPrimaryUrl, ctaPrimaryUrl = _25 === void 0 ? '' : _25, _26 = _a.ctaSecondaryUrl, ctaSecondaryUrl = _26 === void 0 ? '' : _26, _27 = _a.ctaAccentUrl, ctaAccentUrl = _27 === void 0 ? '' : _27, _28 = _a.ctaPrimaryText, ctaPrimaryText = _28 === void 0 ? 'Primary Action' : _28, _29 = _a.ctaSecondaryText, ctaSecondaryText = _29 === void 0 ? 'Secondary Action' : _29, _30 = _a.ctaAccentText, ctaAccentText = _30 === void 0 ? 'Accent Action' : _30, _31 = _a.ctaGap, ctaGap = _31 === void 0 ? 1 : _31, _32 = _a.ctaFlexJustify, ctaFlexJustify = _32 === void 0 ? 'center' : _32, _33 = _a.ctaPrimaryRounded, ctaPrimaryRounded = _33 === void 0 ? false : _33, _34 = _a.ctaPrimaryFlat, ctaPrimaryFlat = _34 === void 0 ? false : _34, _35 = _a.ctaPrimaryPrefix, ctaPrimaryPrefix = _35 === void 0 ? '' : _35, _36 = _a.ctaPrimarySuffix, ctaPrimarySuffix = _36 === void 0 ? '' : _36, _37 = _a.ctaSecondaryRounded, ctaSecondaryRounded = _37 === void 0 ? false : _37, _38 = _a.ctaSecondaryFlat, ctaSecondaryFlat = _38 === void 0 ? false : _38, _39 = _a.ctaSecondaryPrefix, ctaSecondaryPrefix = _39 === void 0 ? '' : _39, _40 = _a.ctaSecondarySuffix, ctaSecondarySuffix = _40 === void 0 ? '' : _40, _41 = _a.ctaAccentRounded, ctaAccentRounded = _41 === void 0 ? false : _41, _42 = _a.ctaAccentFlat, ctaAccentFlat = _42 === void 0 ? false : _42, _43 = _a.ctaAccentPrefix, ctaAccentPrefix = _43 === void 0 ? '' : _43, _44 = _a.ctaAccentSuffix, ctaAccentSuffix = _44 === void 0 ? '' : _44, primaryIconSize = _a.primaryIconSize, secondaryIconSize = _a.secondaryIconSize, accentIconSize = _a.accentIconSize;
|
|
38
38
|
// Use the component config hook
|
|
39
39
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Vista', variant).mergeWithLocal;
|
|
40
|
-
//
|
|
41
|
-
var
|
|
40
|
+
// Create local props object
|
|
41
|
+
var localProps = {
|
|
42
42
|
layout: layout,
|
|
43
43
|
reverse: reverse,
|
|
44
44
|
bg: bg,
|
|
@@ -117,38 +117,124 @@ var Vista = function (_a) {
|
|
|
117
117
|
primaryIconSize: primaryIconSize,
|
|
118
118
|
secondaryIconSize: secondaryIconSize,
|
|
119
119
|
accentIconSize: accentIconSize,
|
|
120
|
-
}
|
|
120
|
+
};
|
|
121
|
+
// Merge config with local props - local props override config
|
|
122
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
123
|
+
// Extract final values - use NULLISH COALESCING to ensure local props take precedence
|
|
124
|
+
var final = {
|
|
125
|
+
// Layout & styling
|
|
126
|
+
layout: layout !== null && layout !== void 0 ? layout : mergedProps.layout,
|
|
127
|
+
reverse: reverse !== null && reverse !== void 0 ? reverse : mergedProps.reverse,
|
|
128
|
+
bg: bg !== null && bg !== void 0 ? bg : mergedProps.bg,
|
|
129
|
+
padding: padding !== null && padding !== void 0 ? padding : mergedProps.padding,
|
|
130
|
+
textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : mergedProps.textAlign,
|
|
131
|
+
imgPosition: imgPosition !== null && imgPosition !== void 0 ? imgPosition : mergedProps.imgPosition,
|
|
132
|
+
funcss: funcss !== null && funcss !== void 0 ? funcss : mergedProps.funcss,
|
|
133
|
+
pattern: pattern !== null && pattern !== void 0 ? pattern : mergedProps.pattern,
|
|
134
|
+
patternOpacity: patternOpacity !== null && patternOpacity !== void 0 ? patternOpacity : mergedProps.patternOpacity,
|
|
135
|
+
// Gradient & effects
|
|
136
|
+
showGradient: showGradient !== null && showGradient !== void 0 ? showGradient : mergedProps.showGradient,
|
|
137
|
+
gradientPosition: gradientPosition !== null && gradientPosition !== void 0 ? gradientPosition : mergedProps.gradientPosition,
|
|
138
|
+
gradientSize: gradientSize !== null && gradientSize !== void 0 ? gradientSize : mergedProps.gradientSize,
|
|
139
|
+
blurry: blurry !== null && blurry !== void 0 ? blurry : mergedProps.blurry,
|
|
140
|
+
opacity: opacity !== null && opacity !== void 0 ? opacity : mergedProps.opacity,
|
|
141
|
+
gradientColors: gradientColors !== null && gradientColors !== void 0 ? gradientColors : mergedProps.gradientColors,
|
|
142
|
+
fade: fade !== null && fade !== void 0 ? fade : mergedProps.fade,
|
|
143
|
+
fadeDirection: fadeDirection !== null && fadeDirection !== void 0 ? fadeDirection : mergedProps.fadeDirection,
|
|
144
|
+
fadeRadial: fadeRadial !== null && fadeRadial !== void 0 ? fadeRadial : mergedProps.fadeRadial,
|
|
145
|
+
fadeOverlayDarken: fadeOverlayDarken !== null && fadeOverlayDarken !== void 0 ? fadeOverlayDarken : mergedProps.fadeOverlayDarken,
|
|
146
|
+
backgroundImage: backgroundImage !== null && backgroundImage !== void 0 ? backgroundImage : mergedProps.backgroundImage,
|
|
147
|
+
// Classes
|
|
148
|
+
sectionClass: sectionClass !== null && sectionClass !== void 0 ? sectionClass : mergedProps.sectionClass,
|
|
149
|
+
containerClass: containerClass !== null && containerClass !== void 0 ? containerClass : mergedProps.containerClass,
|
|
150
|
+
textWrapperClass: textWrapperClass !== null && textWrapperClass !== void 0 ? textWrapperClass : mergedProps.textWrapperClass,
|
|
151
|
+
imageWrapperClass: imageWrapperClass !== null && imageWrapperClass !== void 0 ? imageWrapperClass : mergedProps.imageWrapperClass,
|
|
152
|
+
gap: gap !== null && gap !== void 0 ? gap : mergedProps.gap,
|
|
153
|
+
// Content
|
|
154
|
+
heading: heading !== null && heading !== void 0 ? heading : mergedProps.heading,
|
|
155
|
+
headingSize: headingSize !== null && headingSize !== void 0 ? headingSize : mergedProps.headingSize,
|
|
156
|
+
headingWeight: headingWeight !== null && headingWeight !== void 0 ? headingWeight : mergedProps.headingWeight,
|
|
157
|
+
headingColor: headingColor !== null && headingColor !== void 0 ? headingColor : mergedProps.headingColor,
|
|
158
|
+
headingClass: headingClass !== null && headingClass !== void 0 ? headingClass : mergedProps.headingClass,
|
|
159
|
+
subheading: subheading !== null && subheading !== void 0 ? subheading : mergedProps.subheading,
|
|
160
|
+
subheadingSize: subheadingSize !== null && subheadingSize !== void 0 ? subheadingSize : mergedProps.subheadingSize,
|
|
161
|
+
subheadingWeight: subheadingWeight !== null && subheadingWeight !== void 0 ? subheadingWeight : mergedProps.subheadingWeight,
|
|
162
|
+
subheadingColor: subheadingColor !== null && subheadingColor !== void 0 ? subheadingColor : mergedProps.subheadingColor,
|
|
163
|
+
subheadingClass: subheadingClass !== null && subheadingClass !== void 0 ? subheadingClass : mergedProps.subheadingClass,
|
|
164
|
+
content: content !== null && content !== void 0 ? content : mergedProps.content,
|
|
165
|
+
contentSize: contentSize !== null && contentSize !== void 0 ? contentSize : mergedProps.contentSize,
|
|
166
|
+
contentWeight: contentWeight !== null && contentWeight !== void 0 ? contentWeight : mergedProps.contentWeight,
|
|
167
|
+
contentColor: contentColor !== null && contentColor !== void 0 ? contentColor : mergedProps.contentColor,
|
|
168
|
+
contentClass: contentClass !== null && contentClass !== void 0 ? contentClass : mergedProps.contentClass,
|
|
169
|
+
image: image !== null && image !== void 0 ? image : mergedProps.image,
|
|
170
|
+
imageUrl: imageUrl !== null && imageUrl !== void 0 ? imageUrl : mergedProps.imageUrl,
|
|
171
|
+
imageAlt: imageAlt !== null && imageAlt !== void 0 ? imageAlt : mergedProps.imageAlt,
|
|
172
|
+
imageClass: imageClass !== null && imageClass !== void 0 ? imageClass : mergedProps.imageClass,
|
|
173
|
+
imageSize: imageSize !== null && imageSize !== void 0 ? imageSize : mergedProps.imageSize,
|
|
174
|
+
cta: cta !== null && cta !== void 0 ? cta : mergedProps.cta,
|
|
175
|
+
ctaClass: ctaClass !== null && ctaClass !== void 0 ? ctaClass : mergedProps.ctaClass,
|
|
176
|
+
// CTA Buttons
|
|
177
|
+
showPrimaryCTA: showPrimaryCTA !== null && showPrimaryCTA !== void 0 ? showPrimaryCTA : mergedProps.showPrimaryCTA,
|
|
178
|
+
showSecondaryCTA: showSecondaryCTA !== null && showSecondaryCTA !== void 0 ? showSecondaryCTA : mergedProps.showSecondaryCTA,
|
|
179
|
+
showAccentCTA: showAccentCTA !== null && showAccentCTA !== void 0 ? showAccentCTA : mergedProps.showAccentCTA,
|
|
180
|
+
primaryButtonOutlined: primaryButtonOutlined !== null && primaryButtonOutlined !== void 0 ? primaryButtonOutlined : mergedProps.primaryButtonOutlined,
|
|
181
|
+
secondaryButtonOutlined: secondaryButtonOutlined !== null && secondaryButtonOutlined !== void 0 ? secondaryButtonOutlined : mergedProps.secondaryButtonOutlined,
|
|
182
|
+
accentButtonOutlined: accentButtonOutlined !== null && accentButtonOutlined !== void 0 ? accentButtonOutlined : mergedProps.accentButtonOutlined,
|
|
183
|
+
ctaPrimaryUrl: ctaPrimaryUrl !== null && ctaPrimaryUrl !== void 0 ? ctaPrimaryUrl : mergedProps.ctaPrimaryUrl,
|
|
184
|
+
ctaSecondaryUrl: ctaSecondaryUrl !== null && ctaSecondaryUrl !== void 0 ? ctaSecondaryUrl : mergedProps.ctaSecondaryUrl,
|
|
185
|
+
ctaAccentUrl: ctaAccentUrl !== null && ctaAccentUrl !== void 0 ? ctaAccentUrl : mergedProps.ctaAccentUrl,
|
|
186
|
+
ctaPrimaryText: ctaPrimaryText !== null && ctaPrimaryText !== void 0 ? ctaPrimaryText : mergedProps.ctaPrimaryText,
|
|
187
|
+
ctaSecondaryText: ctaSecondaryText !== null && ctaSecondaryText !== void 0 ? ctaSecondaryText : mergedProps.ctaSecondaryText,
|
|
188
|
+
ctaAccentText: ctaAccentText !== null && ctaAccentText !== void 0 ? ctaAccentText : mergedProps.ctaAccentText,
|
|
189
|
+
ctaGap: ctaGap !== null && ctaGap !== void 0 ? ctaGap : mergedProps.ctaGap,
|
|
190
|
+
ctaFlexJustify: ctaFlexJustify !== null && ctaFlexJustify !== void 0 ? ctaFlexJustify : mergedProps.ctaFlexJustify,
|
|
191
|
+
ctaPrimaryRounded: ctaPrimaryRounded !== null && ctaPrimaryRounded !== void 0 ? ctaPrimaryRounded : mergedProps.ctaPrimaryRounded,
|
|
192
|
+
ctaPrimaryFlat: ctaPrimaryFlat !== null && ctaPrimaryFlat !== void 0 ? ctaPrimaryFlat : mergedProps.ctaPrimaryFlat,
|
|
193
|
+
ctaPrimaryPrefix: ctaPrimaryPrefix !== null && ctaPrimaryPrefix !== void 0 ? ctaPrimaryPrefix : mergedProps.ctaPrimaryPrefix,
|
|
194
|
+
ctaPrimarySuffix: ctaPrimarySuffix !== null && ctaPrimarySuffix !== void 0 ? ctaPrimarySuffix : mergedProps.ctaPrimarySuffix,
|
|
195
|
+
ctaSecondaryRounded: ctaSecondaryRounded !== null && ctaSecondaryRounded !== void 0 ? ctaSecondaryRounded : mergedProps.ctaSecondaryRounded,
|
|
196
|
+
ctaSecondaryFlat: ctaSecondaryFlat !== null && ctaSecondaryFlat !== void 0 ? ctaSecondaryFlat : mergedProps.ctaSecondaryFlat,
|
|
197
|
+
ctaSecondaryPrefix: ctaSecondaryPrefix !== null && ctaSecondaryPrefix !== void 0 ? ctaSecondaryPrefix : mergedProps.ctaSecondaryPrefix,
|
|
198
|
+
ctaSecondarySuffix: ctaSecondarySuffix !== null && ctaSecondarySuffix !== void 0 ? ctaSecondarySuffix : mergedProps.ctaSecondarySuffix,
|
|
199
|
+
ctaAccentRounded: ctaAccentRounded !== null && ctaAccentRounded !== void 0 ? ctaAccentRounded : mergedProps.ctaAccentRounded,
|
|
200
|
+
ctaAccentFlat: ctaAccentFlat !== null && ctaAccentFlat !== void 0 ? ctaAccentFlat : mergedProps.ctaAccentFlat,
|
|
201
|
+
ctaAccentPrefix: ctaAccentPrefix !== null && ctaAccentPrefix !== void 0 ? ctaAccentPrefix : mergedProps.ctaAccentPrefix,
|
|
202
|
+
ctaAccentSuffix: ctaAccentSuffix !== null && ctaAccentSuffix !== void 0 ? ctaAccentSuffix : mergedProps.ctaAccentSuffix,
|
|
203
|
+
primaryIconSize: primaryIconSize !== null && primaryIconSize !== void 0 ? primaryIconSize : mergedProps.primaryIconSize,
|
|
204
|
+
secondaryIconSize: secondaryIconSize !== null && secondaryIconSize !== void 0 ? secondaryIconSize : mergedProps.secondaryIconSize,
|
|
205
|
+
accentIconSize: accentIconSize !== null && accentIconSize !== void 0 ? accentIconSize : mergedProps.accentIconSize,
|
|
206
|
+
};
|
|
121
207
|
var layoutClass = [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"text-".concat(
|
|
208
|
+
final.layout,
|
|
209
|
+
final.reverse ? 'reverse' : '',
|
|
210
|
+
"text-".concat(final.textAlign),
|
|
125
211
|
]
|
|
126
212
|
.filter(Boolean)
|
|
127
213
|
.join(' ');
|
|
128
214
|
// CTA Buttons Component
|
|
129
215
|
var CTAButtons = function () {
|
|
130
|
-
var hasCTAs =
|
|
216
|
+
var hasCTAs = final.showPrimaryCTA || final.showSecondaryCTA || final.showAccentCTA;
|
|
131
217
|
if (!hasCTAs)
|
|
132
218
|
return null;
|
|
133
|
-
return (react_1.default.createElement(Flex_1.default, { gap:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
219
|
+
return (react_1.default.createElement(Flex_1.default, { gap: final.ctaGap, justify: final.ctaFlexJustify, className: "mt-6 ".concat(final.ctaClass), wrap: "wrap", width: '100%' },
|
|
220
|
+
final.showPrimaryCTA && (react_1.default.createElement(Button_1.default, { bg: "primary", outlined: final.primaryButtonOutlined, onClick: function () { return final.ctaPrimaryUrl && (window.location.href = final.ctaPrimaryUrl); }, rounded: final.ctaPrimaryRounded, flat: final.ctaPrimaryFlat, stringPrefix: final.ctaPrimaryPrefix, stringSuffix: final.ctaPrimarySuffix, iconSize: final.primaryIconSize }, final.ctaPrimaryText)),
|
|
221
|
+
final.showSecondaryCTA && (react_1.default.createElement(Button_1.default, { bg: "secondary", outlined: final.secondaryButtonOutlined, onClick: function () { return final.ctaSecondaryUrl && (window.location.href = final.ctaSecondaryUrl); }, rounded: final.ctaSecondaryRounded, flat: final.ctaSecondaryFlat, stringPrefix: final.ctaSecondaryPrefix, stringSuffix: final.ctaSecondarySuffix, iconSize: final.secondaryIconSize }, final.ctaSecondaryText)),
|
|
222
|
+
final.showAccentCTA && (react_1.default.createElement(Button_1.default, { bg: "accent", outlined: final.accentButtonOutlined, onClick: function () { return final.ctaAccentUrl && (window.location.href = final.ctaAccentUrl); }, rounded: final.ctaAccentRounded, flat: final.ctaAccentFlat, stringPrefix: final.ctaAccentPrefix, stringSuffix: final.ctaAccentSuffix, iconSize: final.accentIconSize }, final.ctaAccentText))));
|
|
137
223
|
};
|
|
138
224
|
// Enhanced Text Content with flexible styling
|
|
139
|
-
var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
225
|
+
var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(final.layout === 'centered' ? "text-center" : "", " ").concat(final.textWrapperClass) },
|
|
226
|
+
final.heading && (react_1.default.createElement(Text_1.default, { block: true, size: final.headingSize, weight: final.headingWeight, color: final.headingColor, funcss: final.headingClass }, final.heading)),
|
|
227
|
+
final.subheading && (react_1.default.createElement(Text_1.default, { block: true, size: final.subheadingSize, weight: final.subheadingWeight, color: final.subheadingColor, funcss: "mt-2 ".concat(final.subheadingClass) }, final.subheading)),
|
|
228
|
+
final.content && (react_1.default.createElement(Text_1.default, { block: true, size: final.contentSize, weight: final.contentWeight, color: final.contentColor, funcss: "mt-4 ".concat(final.contentClass), article: true }, children || (typeof final.content === 'string' ? react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: final.content } }) : final.content))),
|
|
229
|
+
final.cta ? (react_1.default.createElement("div", { className: "mt-6 ".concat(final.ctaClass) }, final.cta)) : (react_1.default.createElement(CTAButtons, null))));
|
|
144
230
|
// Enhanced Image Content - uses imageUrl if no image component provided
|
|
145
|
-
var ImageContent = (
|
|
231
|
+
var ImageContent = (final.image || final.imageUrl) && (react_1.default.createElement("div", { className: "vista-image ".concat(final.imageWrapperClass) }, final.image ? (final.image) : (react_1.default.createElement("img", { src: final.imageUrl, alt: final.imageAlt || 'Vista image', className: "".concat(final.imageClass), style: {
|
|
146
232
|
objectFit: 'cover',
|
|
147
|
-
maxWidth:
|
|
233
|
+
maxWidth: final.imageSize,
|
|
148
234
|
borderRadius: 'inherit'
|
|
149
235
|
} }))));
|
|
150
|
-
var isCentered =
|
|
151
|
-
var isStacked =
|
|
236
|
+
var isCentered = final.layout === 'centered';
|
|
237
|
+
var isStacked = final.layout === 'stacked';
|
|
152
238
|
var positionStyles = {
|
|
153
239
|
'top-left': { top: '-100px', left: '-100px' },
|
|
154
240
|
'top-right': { top: '-100px', right: '-100px' },
|
|
@@ -158,61 +244,61 @@ var Vista = function (_a) {
|
|
|
158
244
|
};
|
|
159
245
|
var primaryColor = (0, getCssVariable_1.getCssVariableValue)('primary');
|
|
160
246
|
var secondaryColor = (0, getCssVariable_1.getCssVariableValue)('secondary');
|
|
161
|
-
var gradientStyle = __assign({ position: 'absolute', width:
|
|
247
|
+
var gradientStyle = __assign({ position: 'absolute', width: final.gradientSize, height: final.gradientSize, background: final.gradientColors || "radial-gradient(circle, ".concat(primaryColor, ", ").concat(secondaryColor, ")"), opacity: final.opacity, filter: "blur(".concat(final.blurry, "px)"), pointerEvents: 'none', zIndex: 0 }, positionStyles[final.gradientPosition]);
|
|
162
248
|
return (react_1.default.createElement(ScrollInView_1.default, null,
|
|
163
|
-
react_1.default.createElement("div", { className: "vista \n ".concat(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
249
|
+
react_1.default.createElement("div", { className: "vista \n ".concat(final.pattern === 'grid' ? 'grid-bg' :
|
|
250
|
+
final.pattern === 'dots' ? 'bg-pattern-dots' :
|
|
251
|
+
final.pattern === 'diagonal' ? 'bg-pattern-diagonal' :
|
|
252
|
+
final.pattern === 'checkerboard' ? 'bg-pattern-checkerboard' :
|
|
253
|
+
final.pattern === 'horizontal' ? 'bg-pattern-horizontal' :
|
|
254
|
+
final.pattern === 'vertical' ? 'bg-pattern-vertical' : '', " \n ").concat(final.bg, " p-").concat(final.padding, " ").concat(layoutClass, " ").concat(final.sectionClass, " ").concat(final.funcss), style: {
|
|
169
255
|
position: 'relative',
|
|
170
256
|
overflow: 'hidden',
|
|
171
257
|
minHeight: "90vh",
|
|
172
|
-
backgroundImage:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
258
|
+
backgroundImage: final.pattern === 'grid' ? "linear-gradient(to right, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px),\n linear-gradient(to bottom, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 1px, transparent 1px)") :
|
|
259
|
+
final.pattern === 'dots' ? "radial-gradient(rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") :
|
|
260
|
+
final.pattern === 'diagonal' ? "repeating-linear-gradient(45deg, rgba(var(--borderRgb), ".concat(final.patternOpacity, "), rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 1px, transparent 1px, transparent 10px)") :
|
|
261
|
+
final.pattern === 'checkerboard' ? "linear-gradient(45deg, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 25%, transparent 25%), linear-gradient(-45deg, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 75%), linear-gradient(-45deg, transparent 75%, rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 75%)") :
|
|
262
|
+
final.pattern === 'horizontal' ? "linear-gradient(to bottom, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") :
|
|
263
|
+
final.pattern === 'vertical' ? "linear-gradient(to right, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") : ''
|
|
178
264
|
} },
|
|
179
|
-
|
|
180
|
-
react_1.default.createElement("div", { className: "vista-container ".concat(
|
|
181
|
-
(
|
|
265
|
+
final.showGradient && react_1.default.createElement("div", { style: gradientStyle }),
|
|
266
|
+
react_1.default.createElement("div", { className: "vista-container ".concat(final.containerClass), style: { position: 'relative', zIndex: 1, gap: final.gap || "2rem" } }, isCentered || isStacked ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
267
|
+
(final.imgPosition === 'top') && ImageContent,
|
|
182
268
|
TextContent,
|
|
183
|
-
(
|
|
269
|
+
(final.imgPosition === 'bottom') && ImageContent)) : final.reverse ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
184
270
|
ImageContent,
|
|
185
271
|
TextContent)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
186
|
-
(
|
|
272
|
+
(final.layout === 'imageLeft') && react_1.default.createElement(Col_1.default, null, ImageContent),
|
|
187
273
|
TextContent,
|
|
188
|
-
(
|
|
189
|
-
|
|
274
|
+
(final.layout === 'imageRight') && react_1.default.createElement(Col_1.default, null, ImageContent)))),
|
|
275
|
+
final.fade && (react_1.default.createElement("div", { style: {
|
|
190
276
|
position: 'absolute',
|
|
191
277
|
inset: 0,
|
|
192
278
|
width: '100%',
|
|
193
279
|
height: '100%',
|
|
194
|
-
background:
|
|
195
|
-
? "radial-gradient(circle, transparent 0%, ".concat((0, getCssVariable_1.getCssVariableValue)(
|
|
196
|
-
: "linear-gradient(to ".concat(
|
|
280
|
+
background: final.fadeRadial
|
|
281
|
+
? "radial-gradient(circle, transparent 0%, ".concat((0, getCssVariable_1.getCssVariableValue)(final.bg || 'page-bg'), " 100%)")
|
|
282
|
+
: "linear-gradient(to ".concat(final.fadeDirection || 'bottom', ", ").concat((0, getCssVariable_1.getCssVariableValue)(final.bg || 'page-bg'), " 0%, transparent 100%)"),
|
|
197
283
|
zIndex: 0,
|
|
198
284
|
pointerEvents: 'none'
|
|
199
285
|
} })),
|
|
200
|
-
|
|
286
|
+
final.backgroundImage && (react_1.default.createElement("div", { style: {
|
|
201
287
|
position: 'absolute',
|
|
202
288
|
inset: 0,
|
|
203
|
-
backgroundImage: "url(".concat(
|
|
289
|
+
backgroundImage: "url(".concat(final.backgroundImage, ")"),
|
|
204
290
|
backgroundSize: 'cover',
|
|
205
291
|
backgroundPosition: 'center',
|
|
206
292
|
zIndex: -1,
|
|
207
293
|
width: '100%',
|
|
208
294
|
height: '100%',
|
|
209
295
|
} })),
|
|
210
|
-
|
|
296
|
+
final.backgroundImage && final.fadeOverlayDarken !== undefined && (react_1.default.createElement("div", { style: {
|
|
211
297
|
position: 'absolute',
|
|
212
298
|
width: '100%',
|
|
213
299
|
height: '100%',
|
|
214
300
|
inset: 0,
|
|
215
|
-
backgroundColor: "rgba(0, 0, 0, ".concat(
|
|
301
|
+
backgroundColor: "rgba(0, 0, 0, ".concat(final.fadeOverlayDarken, ")"),
|
|
216
302
|
zIndex: -1,
|
|
217
303
|
} })))));
|
|
218
304
|
};
|
package/utils/componentUtils.js
CHANGED
|
@@ -14,6 +14,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.getAvailableVariants = exports.hasComponentVariant = exports.useComponentProps = exports.useComponentConfiguration = exports.mergeComponentConfig = exports.getComponentConfig = void 0;
|
|
15
15
|
var theme_1 = require("../ui/theme/theme");
|
|
16
16
|
var react_1 = require("react");
|
|
17
|
+
/**
|
|
18
|
+
* Check if a variant name is valid (not empty or whitespace only)
|
|
19
|
+
*/
|
|
20
|
+
var isValidVariantName = function (variantName) {
|
|
21
|
+
return !!variantName && variantName.trim() !== '';
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Filter out empty string and undefined values from component props
|
|
25
|
+
*/
|
|
26
|
+
var filterEmptyProps = function (props) {
|
|
27
|
+
var filtered = {};
|
|
28
|
+
for (var key in props) {
|
|
29
|
+
var value = props[key];
|
|
30
|
+
// Only include props that are not undefined and not empty strings
|
|
31
|
+
if (value !== undefined && value !== '') {
|
|
32
|
+
filtered[key] = value;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return filtered;
|
|
36
|
+
};
|
|
17
37
|
/**
|
|
18
38
|
* Universal component config getter
|
|
19
39
|
*
|
|
@@ -61,8 +81,10 @@ var getComponentConfig = function (projectData, componentName, variantName) {
|
|
|
61
81
|
}
|
|
62
82
|
}
|
|
63
83
|
var variantData = component[targetVariant];
|
|
84
|
+
// Filter out empty string and undefined props from config
|
|
85
|
+
var filteredComponentProps = filterEmptyProps((variantData === null || variantData === void 0 ? void 0 : variantData.componentProps) || {});
|
|
64
86
|
return {
|
|
65
|
-
componentProps:
|
|
87
|
+
componentProps: filteredComponentProps,
|
|
66
88
|
variantExists: variantExists,
|
|
67
89
|
actualVariant: targetVariant,
|
|
68
90
|
availableVariants: availableVariants,
|
|
@@ -135,7 +157,8 @@ var useComponentConfiguration = function (componentName, variantName) {
|
|
|
135
157
|
var projectData = (0, theme_1.useTheme)().projectData;
|
|
136
158
|
// Memoize config computation - only recompute when dependencies change
|
|
137
159
|
var config = (0, react_1.useMemo)(function () {
|
|
138
|
-
|
|
160
|
+
// Check for valid variant name (not empty or whitespace only)
|
|
161
|
+
if (!isValidVariantName(variantName)) {
|
|
139
162
|
return {
|
|
140
163
|
componentProps: {},
|
|
141
164
|
variantExists: false,
|
|
@@ -150,8 +173,8 @@ var useComponentConfiguration = function (componentName, variantName) {
|
|
|
150
173
|
var mergeWithLocal = (0, react_1.useMemo)(function () {
|
|
151
174
|
return function (localProps) {
|
|
152
175
|
if (localProps === void 0) { localProps = {}; }
|
|
153
|
-
// If no variant name was provided, return local props as-is
|
|
154
|
-
if (!variantName) {
|
|
176
|
+
// If no valid variant name was provided, return local props as-is
|
|
177
|
+
if (!isValidVariantName(variantName)) {
|
|
155
178
|
return {
|
|
156
179
|
props: localProps,
|
|
157
180
|
variant: '',
|