funuicss 3.7.1 → 3.7.3
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 +619 -75
- package/index.d.ts +2 -1
- package/index.js +8 -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 +235 -42
- package/ui/chart/Line.js +19 -124
- package/ui/chart/Pie.d.ts +61 -7
- package/ui/chart/Pie.js +204 -41
- package/ui/drop/Dropdown.d.ts +4 -3
- package/ui/drop/Dropdown.js +24 -29
- 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 -136
- 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 +2 -1
- package/ui/text/Text.js +51 -50
- package/ui/theme/theme.d.ts +34 -0
- package/ui/theme/theme.js +198 -18
- package/ui/vista/Vista.js +58 -141
- 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,134 +21,51 @@ 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"));
|
|
26
|
-
var Vista = function (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Use the component config hook
|
|
39
|
-
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Vista', variant).mergeWithLocal;
|
|
40
|
-
// Merge config with local props - local props should override config
|
|
41
|
-
var mergedProps = mergeWithLocal({
|
|
42
|
-
layout: layout,
|
|
43
|
-
reverse: reverse,
|
|
44
|
-
bg: bg,
|
|
45
|
-
padding: padding,
|
|
46
|
-
textAlign: textAlign,
|
|
47
|
-
imgPosition: imgPosition,
|
|
48
|
-
funcss: funcss,
|
|
49
|
-
pattern: pattern,
|
|
50
|
-
patternOpacity: patternOpacity,
|
|
51
|
-
showGradient: showGradient,
|
|
52
|
-
gradientPosition: gradientPosition,
|
|
53
|
-
gradientSize: gradientSize,
|
|
54
|
-
blurry: blurry,
|
|
55
|
-
opacity: opacity,
|
|
56
|
-
gradientColors: gradientColors,
|
|
57
|
-
fade: fade,
|
|
58
|
-
fadeDirection: fadeDirection,
|
|
59
|
-
fadeRadial: fadeRadial,
|
|
60
|
-
fadeOverlayDarken: fadeOverlayDarken,
|
|
61
|
-
backgroundImage: backgroundImage,
|
|
62
|
-
sectionClass: sectionClass,
|
|
63
|
-
containerClass: containerClass,
|
|
64
|
-
textWrapperClass: textWrapperClass,
|
|
65
|
-
imageWrapperClass: imageWrapperClass,
|
|
66
|
-
gap: gap,
|
|
67
|
-
// Enhanced content props
|
|
68
|
-
heading: heading,
|
|
69
|
-
headingSize: headingSize,
|
|
70
|
-
headingWeight: headingWeight,
|
|
71
|
-
headingColor: headingColor,
|
|
72
|
-
headingClass: headingClass,
|
|
73
|
-
subheading: subheading,
|
|
74
|
-
subheadingSize: subheadingSize,
|
|
75
|
-
subheadingWeight: subheadingWeight,
|
|
76
|
-
subheadingColor: subheadingColor,
|
|
77
|
-
subheadingClass: subheadingClass,
|
|
78
|
-
content: content,
|
|
79
|
-
contentSize: contentSize,
|
|
80
|
-
contentWeight: contentWeight,
|
|
81
|
-
contentColor: contentColor,
|
|
82
|
-
contentClass: contentClass,
|
|
83
|
-
image: image,
|
|
84
|
-
imageUrl: imageUrl,
|
|
85
|
-
imageSize: imageSize,
|
|
86
|
-
imageAlt: imageAlt,
|
|
87
|
-
imageClass: imageClass,
|
|
88
|
-
cta: cta,
|
|
89
|
-
ctaClass: ctaClass,
|
|
90
|
-
// CTA Button props
|
|
91
|
-
showPrimaryCTA: showPrimaryCTA,
|
|
92
|
-
showSecondaryCTA: showSecondaryCTA,
|
|
93
|
-
showAccentCTA: showAccentCTA,
|
|
94
|
-
primaryButtonOutlined: primaryButtonOutlined,
|
|
95
|
-
secondaryButtonOutlined: secondaryButtonOutlined,
|
|
96
|
-
accentButtonOutlined: accentButtonOutlined,
|
|
97
|
-
ctaPrimaryUrl: ctaPrimaryUrl,
|
|
98
|
-
ctaSecondaryUrl: ctaSecondaryUrl,
|
|
99
|
-
ctaAccentUrl: ctaAccentUrl,
|
|
100
|
-
ctaPrimaryText: ctaPrimaryText,
|
|
101
|
-
ctaSecondaryText: ctaSecondaryText,
|
|
102
|
-
ctaAccentText: ctaAccentText,
|
|
103
|
-
ctaGap: ctaGap,
|
|
104
|
-
ctaFlexJustify: ctaFlexJustify,
|
|
105
|
-
ctaPrimaryRounded: ctaPrimaryRounded,
|
|
106
|
-
ctaPrimaryFlat: ctaPrimaryFlat,
|
|
107
|
-
ctaPrimaryPrefix: ctaPrimaryPrefix,
|
|
108
|
-
ctaPrimarySuffix: ctaPrimarySuffix,
|
|
109
|
-
ctaSecondaryRounded: ctaSecondaryRounded,
|
|
110
|
-
ctaSecondaryFlat: ctaSecondaryFlat,
|
|
111
|
-
ctaSecondaryPrefix: ctaSecondaryPrefix,
|
|
112
|
-
ctaSecondarySuffix: ctaSecondarySuffix,
|
|
113
|
-
ctaAccentRounded: ctaAccentRounded,
|
|
114
|
-
ctaAccentFlat: ctaAccentFlat,
|
|
115
|
-
ctaAccentPrefix: ctaAccentPrefix,
|
|
116
|
-
ctaAccentSuffix: ctaAccentSuffix,
|
|
117
|
-
primaryIconSize: primaryIconSize,
|
|
118
|
-
secondaryIconSize: secondaryIconSize,
|
|
119
|
-
accentIconSize: accentIconSize,
|
|
120
|
-
}).props;
|
|
24
|
+
var Button_1 = __importDefault(require("../button/Button"));
|
|
25
|
+
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
26
|
+
var Vista = function (localProps) {
|
|
27
|
+
// Use the component config hook with the variant from localProps
|
|
28
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Vista', localProps.variant).mergeWithLocal;
|
|
29
|
+
// Merge config with local props - local props override config
|
|
30
|
+
var mergedProps = mergeWithLocal(localProps).props;
|
|
31
|
+
// Use mergedProps directly - they already have the correct merge logic applied
|
|
32
|
+
var final = mergedProps;
|
|
33
|
+
// Debug: Log what props are actually coming through
|
|
34
|
+
react_1.default.useEffect(function () {
|
|
35
|
+
console.log('Vista merged props:', mergedProps);
|
|
36
|
+
console.log('Vista config available:', Object.keys(mergedProps).length > 0);
|
|
37
|
+
}, [mergedProps]);
|
|
121
38
|
var layoutClass = [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
"text-".concat(
|
|
39
|
+
final.layout,
|
|
40
|
+
final.reverse ? 'reverse' : '',
|
|
41
|
+
"text-".concat(final.textAlign),
|
|
125
42
|
]
|
|
126
43
|
.filter(Boolean)
|
|
127
44
|
.join(' ');
|
|
128
45
|
// CTA Buttons Component
|
|
129
46
|
var CTAButtons = function () {
|
|
130
|
-
var hasCTAs =
|
|
47
|
+
var hasCTAs = final.showPrimaryCTA || final.showSecondaryCTA || final.showAccentCTA;
|
|
131
48
|
if (!hasCTAs)
|
|
132
49
|
return null;
|
|
133
|
-
return (react_1.default.createElement(Flex_1.default, { gap:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
50
|
+
return (react_1.default.createElement(Flex_1.default, { gap: final.ctaGap, justify: final.ctaFlexJustify, className: "mt-6 ".concat(final.ctaClass), wrap: "wrap", width: '100%' },
|
|
51
|
+
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)),
|
|
52
|
+
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)),
|
|
53
|
+
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
54
|
};
|
|
138
55
|
// Enhanced Text Content with flexible styling
|
|
139
|
-
var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
56
|
+
var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(final.layout === 'centered' ? "text-center" : "", " ").concat(final.textWrapperClass) },
|
|
57
|
+
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)),
|
|
58
|
+
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)),
|
|
59
|
+
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 }, localProps.children || (typeof final.content === 'string' ? react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: final.content } }) : final.content))),
|
|
60
|
+
final.cta ? (react_1.default.createElement("div", { className: "mt-6 ".concat(final.ctaClass) }, final.cta)) : (react_1.default.createElement(CTAButtons, null))));
|
|
144
61
|
// Enhanced Image Content - uses imageUrl if no image component provided
|
|
145
|
-
var ImageContent = (
|
|
62
|
+
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
63
|
objectFit: 'cover',
|
|
147
|
-
maxWidth:
|
|
64
|
+
maxWidth: final.imageSize,
|
|
148
65
|
borderRadius: 'inherit'
|
|
149
66
|
} }))));
|
|
150
|
-
var isCentered =
|
|
151
|
-
var isStacked =
|
|
67
|
+
var isCentered = final.layout === 'centered';
|
|
68
|
+
var isStacked = final.layout === 'stacked';
|
|
152
69
|
var positionStyles = {
|
|
153
70
|
'top-left': { top: '-100px', left: '-100px' },
|
|
154
71
|
'top-right': { top: '-100px', right: '-100px' },
|
|
@@ -158,61 +75,61 @@ var Vista = function (_a) {
|
|
|
158
75
|
};
|
|
159
76
|
var primaryColor = (0, getCssVariable_1.getCssVariableValue)('primary');
|
|
160
77
|
var secondaryColor = (0, getCssVariable_1.getCssVariableValue)('secondary');
|
|
161
|
-
var gradientStyle = __assign({ position: 'absolute', width:
|
|
78
|
+
var gradientStyle = __assign({ position: 'absolute', width: final.gradientSize || "200px", height: final.gradientSize || "200px", background: final.gradientColors || "radial-gradient(circle, ".concat(primaryColor, ", ").concat(secondaryColor, ")"), opacity: final.opacity, filter: "blur(".concat(final.blurry || 4, "rem)"), pointerEvents: 'none', zIndex: 0 }, positionStyles[final.gradientPosition]);
|
|
162
79
|
return (react_1.default.createElement(ScrollInView_1.default, null,
|
|
163
|
-
react_1.default.createElement("div", { className: "vista \n ".concat(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
80
|
+
react_1.default.createElement("div", { className: "vista \n ".concat(final.pattern === 'grid' ? 'grid-bg' :
|
|
81
|
+
final.pattern === 'dots' ? 'bg-pattern-dots' :
|
|
82
|
+
final.pattern === 'diagonal' ? 'bg-pattern-diagonal' :
|
|
83
|
+
final.pattern === 'checkerboard' ? 'bg-pattern-checkerboard' :
|
|
84
|
+
final.pattern === 'horizontal' ? 'bg-pattern-horizontal' :
|
|
85
|
+
final.pattern === 'vertical' ? 'bg-pattern-vertical' : '', " \n ").concat(final.bg, " p-").concat(final.padding, " ").concat(layoutClass, " ").concat(final.sectionClass, " ").concat(final.funcss), style: {
|
|
169
86
|
position: 'relative',
|
|
170
87
|
overflow: 'hidden',
|
|
171
88
|
minHeight: "90vh",
|
|
172
|
-
backgroundImage:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
89
|
+
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)") :
|
|
90
|
+
final.pattern === 'dots' ? "radial-gradient(rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") :
|
|
91
|
+
final.pattern === 'diagonal' ? "repeating-linear-gradient(45deg, rgba(var(--borderRgb), ".concat(final.patternOpacity, "), rgba(var(--borderRgb), ").concat(final.patternOpacity, ") 1px, transparent 1px, transparent 10px)") :
|
|
92
|
+
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%)") :
|
|
93
|
+
final.pattern === 'horizontal' ? "linear-gradient(to bottom, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") :
|
|
94
|
+
final.pattern === 'vertical' ? "linear-gradient(to right, rgba(var(--borderRgb), ".concat(final.patternOpacity, ") 1px, transparent 1px)") : ''
|
|
178
95
|
} },
|
|
179
|
-
|
|
180
|
-
react_1.default.createElement("div", { className: "vista-container ".concat(
|
|
181
|
-
(
|
|
96
|
+
final.showGradient && react_1.default.createElement("div", { style: gradientStyle }),
|
|
97
|
+
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,
|
|
98
|
+
(final.imgPosition === 'top') && ImageContent,
|
|
182
99
|
TextContent,
|
|
183
|
-
(
|
|
100
|
+
(final.imgPosition === 'bottom') && ImageContent)) : final.reverse ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
184
101
|
ImageContent,
|
|
185
102
|
TextContent)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
186
|
-
(
|
|
103
|
+
(final.layout === 'imageLeft') && react_1.default.createElement(Col_1.default, null, ImageContent),
|
|
187
104
|
TextContent,
|
|
188
|
-
(
|
|
189
|
-
|
|
105
|
+
(final.layout === 'imageRight') && react_1.default.createElement(Col_1.default, null, ImageContent)))),
|
|
106
|
+
final.fade && (react_1.default.createElement("div", { style: {
|
|
190
107
|
position: 'absolute',
|
|
191
108
|
inset: 0,
|
|
192
109
|
width: '100%',
|
|
193
110
|
height: '100%',
|
|
194
|
-
background:
|
|
195
|
-
? "radial-gradient(circle, transparent 0%, ".concat((0, getCssVariable_1.getCssVariableValue)(
|
|
196
|
-
: "linear-gradient(to ".concat(
|
|
111
|
+
background: final.fadeRadial
|
|
112
|
+
? "radial-gradient(circle, transparent 0%, ".concat((0, getCssVariable_1.getCssVariableValue)(final.bg || 'page-bg'), " 100%)")
|
|
113
|
+
: "linear-gradient(to ".concat(final.fadeDirection || 'bottom', ", ").concat((0, getCssVariable_1.getCssVariableValue)(final.bg || 'page-bg'), " 0%, transparent 100%)"),
|
|
197
114
|
zIndex: 0,
|
|
198
115
|
pointerEvents: 'none'
|
|
199
116
|
} })),
|
|
200
|
-
|
|
117
|
+
final.backgroundImage && (react_1.default.createElement("div", { style: {
|
|
201
118
|
position: 'absolute',
|
|
202
119
|
inset: 0,
|
|
203
|
-
backgroundImage: "url(".concat(
|
|
120
|
+
backgroundImage: "url(".concat(final.backgroundImage, ")"),
|
|
204
121
|
backgroundSize: 'cover',
|
|
205
122
|
backgroundPosition: 'center',
|
|
206
123
|
zIndex: -1,
|
|
207
124
|
width: '100%',
|
|
208
125
|
height: '100%',
|
|
209
126
|
} })),
|
|
210
|
-
|
|
127
|
+
final.backgroundImage && final.fadeOverlayDarken !== undefined && (react_1.default.createElement("div", { style: {
|
|
211
128
|
position: 'absolute',
|
|
212
129
|
width: '100%',
|
|
213
130
|
height: '100%',
|
|
214
131
|
inset: 0,
|
|
215
|
-
backgroundColor: "rgba(0, 0, 0, ".concat(
|
|
132
|
+
backgroundColor: "rgba(0, 0, 0, ".concat(final.fadeOverlayDarken, ")"),
|
|
216
133
|
zIndex: -1,
|
|
217
134
|
} })))));
|
|
218
135
|
};
|
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: '',
|