funuicss 3.7.14 → 3.7.16
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 +665 -0
- package/index.d.ts +2 -0
- package/index.js +5 -1
- package/package.json +1 -1
- package/ui/feature/Feature.d.ts +130 -0
- package/ui/feature/Feature.js +380 -0
- package/ui/footer/Footer.d.ts +89 -0
- package/ui/footer/Footer.js +329 -0
- package/ui/icons/Dynamic.d.ts +12 -0
- package/ui/icons/Dynamic.js +163 -0
- package/ui/theme/theme.d.ts +1 -0
- package/ui/theme/theme.js +571 -23
- package/ui/vista/Vista.js +8 -12
- package/utils/componentUtils.d.ts +126 -19
- package/utils/componentUtils.js +994 -57
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
47
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
52
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
73
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
|
+
if (ar || !(i in from)) {
|
|
75
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
76
|
+
ar[i] = from[i];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
|
+
};
|
|
81
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
82
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
|
+
};
|
|
84
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
+
var react_1 = __importStar(require("react"));
|
|
86
|
+
var pi_1 = require("react-icons/pi");
|
|
87
|
+
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
88
|
+
var componentUtils_1 = require("../../utils/componentUtils");
|
|
89
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
90
|
+
var Footer = function (localProps) {
|
|
91
|
+
// Use component configuration with variant
|
|
92
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Footer', localProps.variant).mergeWithLocal;
|
|
93
|
+
var final = mergeWithLocal(localProps).props;
|
|
94
|
+
var currentYear = final.year || new Date().getFullYear();
|
|
95
|
+
// State for dynamic icons
|
|
96
|
+
var _a = (0, react_1.useState)({}), loadedIcons = _a[0], setLoadedIcons = _a[1];
|
|
97
|
+
// Parse sections if it's a JSON string
|
|
98
|
+
var sections = react_1.default.useMemo(function () {
|
|
99
|
+
if (!final.sections)
|
|
100
|
+
return [];
|
|
101
|
+
if (typeof final.sections === 'string') {
|
|
102
|
+
try {
|
|
103
|
+
return JSON.parse(final.sections);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
console.error('Failed to parse sections JSON:', e);
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return final.sections;
|
|
111
|
+
}, [final.sections]);
|
|
112
|
+
// Helper function to check if something is a React element
|
|
113
|
+
function isReactElement(node) {
|
|
114
|
+
return react_1.default.isValidElement(node);
|
|
115
|
+
}
|
|
116
|
+
// Load dynamic icons
|
|
117
|
+
(0, react_1.useEffect)(function () {
|
|
118
|
+
var iconsToLoad = {};
|
|
119
|
+
// Social icons
|
|
120
|
+
if (typeof final.facebookIcon === 'string')
|
|
121
|
+
iconsToLoad.facebook = final.facebookIcon;
|
|
122
|
+
if (typeof final.instagramIcon === 'string')
|
|
123
|
+
iconsToLoad.instagram = final.instagramIcon;
|
|
124
|
+
if (typeof final.twitterIcon === 'string')
|
|
125
|
+
iconsToLoad.twitter = final.twitterIcon;
|
|
126
|
+
if (typeof final.xIcon === 'string')
|
|
127
|
+
iconsToLoad.x = final.xIcon;
|
|
128
|
+
if (typeof final.youtubeIcon === 'string')
|
|
129
|
+
iconsToLoad.youtube = final.youtubeIcon;
|
|
130
|
+
if (typeof final.linkedinIcon === 'string')
|
|
131
|
+
iconsToLoad.linkedin = final.linkedinIcon;
|
|
132
|
+
if (typeof final.githubIcon === 'string')
|
|
133
|
+
iconsToLoad.github = final.githubIcon;
|
|
134
|
+
// Contact icons
|
|
135
|
+
if (typeof final.emailIcon === 'string')
|
|
136
|
+
iconsToLoad.email = final.emailIcon;
|
|
137
|
+
if (typeof final.phoneIcon === 'string')
|
|
138
|
+
iconsToLoad.phone = final.phoneIcon;
|
|
139
|
+
if (typeof final.addressIcon === 'string')
|
|
140
|
+
iconsToLoad.address = final.addressIcon;
|
|
141
|
+
// Social media object
|
|
142
|
+
if (final.socialMedia) {
|
|
143
|
+
Object.entries(final.socialMedia).forEach(function (_a) {
|
|
144
|
+
var key = _a[0], value = _a[1];
|
|
145
|
+
if (typeof value === 'string') {
|
|
146
|
+
iconsToLoad["socialMedia_".concat(key)] = value;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
// Load all dynamic icons
|
|
151
|
+
var loadIcons = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
152
|
+
var loaded, _i, _a, _b, key, iconString, icon;
|
|
153
|
+
return __generator(this, function (_c) {
|
|
154
|
+
switch (_c.label) {
|
|
155
|
+
case 0:
|
|
156
|
+
loaded = {};
|
|
157
|
+
_i = 0, _a = Object.entries(iconsToLoad);
|
|
158
|
+
_c.label = 1;
|
|
159
|
+
case 1:
|
|
160
|
+
if (!(_i < _a.length)) return [3 /*break*/, 4];
|
|
161
|
+
_b = _a[_i], key = _b[0], iconString = _b[1];
|
|
162
|
+
return [4 /*yield*/, (0, getDynamicIcon_1.getDynamicIcon)(iconString)];
|
|
163
|
+
case 2:
|
|
164
|
+
icon = _c.sent();
|
|
165
|
+
if (icon) {
|
|
166
|
+
loaded[key] = icon;
|
|
167
|
+
}
|
|
168
|
+
_c.label = 3;
|
|
169
|
+
case 3:
|
|
170
|
+
_i++;
|
|
171
|
+
return [3 /*break*/, 1];
|
|
172
|
+
case 4:
|
|
173
|
+
setLoadedIcons(loaded);
|
|
174
|
+
return [2 /*return*/];
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}); };
|
|
178
|
+
if (Object.keys(iconsToLoad).length > 0) {
|
|
179
|
+
loadIcons();
|
|
180
|
+
}
|
|
181
|
+
}, [final.facebookIcon, final.instagramIcon, final.twitterIcon, final.xIcon, final.youtubeIcon, final.linkedinIcon, final.githubIcon, final.emailIcon, final.phoneIcon, final.addressIcon, final.socialMedia]);
|
|
182
|
+
// Get icon - either from prop (ReactNode), dynamic loaded icon, or default
|
|
183
|
+
var getIcon = function (iconProp, iconKey, defaultIcon) {
|
|
184
|
+
if (isReactElement(iconProp)) {
|
|
185
|
+
return iconProp;
|
|
186
|
+
}
|
|
187
|
+
if (typeof iconProp === 'string' && loadedIcons[iconKey]) {
|
|
188
|
+
return loadedIcons[iconKey];
|
|
189
|
+
}
|
|
190
|
+
return defaultIcon;
|
|
191
|
+
};
|
|
192
|
+
// Build social links array
|
|
193
|
+
var socialLinks = react_1.default.useMemo(function () {
|
|
194
|
+
var links = [];
|
|
195
|
+
if (final.facebookUrl) {
|
|
196
|
+
links.push({
|
|
197
|
+
url: final.facebookUrl,
|
|
198
|
+
icon: getIcon(final.facebookIcon, 'facebook', react_1.default.createElement(pi_1.PiFacebookLogo, null)),
|
|
199
|
+
label: 'Facebook'
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (final.instagramUrl) {
|
|
203
|
+
links.push({
|
|
204
|
+
url: final.instagramUrl,
|
|
205
|
+
icon: getIcon(final.instagramIcon, 'instagram', react_1.default.createElement(pi_1.PiInstagramLogo, null)),
|
|
206
|
+
label: 'Instagram'
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if (final.twitterUrl) {
|
|
210
|
+
links.push({
|
|
211
|
+
url: final.twitterUrl,
|
|
212
|
+
icon: getIcon(final.twitterIcon, 'twitter', react_1.default.createElement(pi_1.PiTwitterLogo, null)),
|
|
213
|
+
label: 'Twitter'
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
if (final.xUrl) {
|
|
217
|
+
links.push({
|
|
218
|
+
url: final.xUrl,
|
|
219
|
+
icon: getIcon(final.xIcon, 'x', react_1.default.createElement(pi_1.PiTwitterLogo, null)),
|
|
220
|
+
label: 'X'
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (final.youtubeUrl) {
|
|
224
|
+
links.push({
|
|
225
|
+
url: final.youtubeUrl,
|
|
226
|
+
icon: getIcon(final.youtubeIcon, 'youtube', react_1.default.createElement(pi_1.PiYoutubeLogo, null)),
|
|
227
|
+
label: 'YouTube'
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
if (final.linkedinUrl) {
|
|
231
|
+
links.push({
|
|
232
|
+
url: final.linkedinUrl,
|
|
233
|
+
icon: getIcon(final.linkedinIcon, 'linkedin', react_1.default.createElement(pi_1.PiLinkedinLogo, null)),
|
|
234
|
+
label: 'LinkedIn'
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
if (final.githubUrl) {
|
|
238
|
+
links.push({
|
|
239
|
+
url: final.githubUrl,
|
|
240
|
+
icon: getIcon(final.githubIcon, 'github', react_1.default.createElement(pi_1.PiGithubLogo, null)),
|
|
241
|
+
label: 'GitHub'
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
// Add socialMedia object links
|
|
245
|
+
if (final.socialMedia) {
|
|
246
|
+
Object.entries(final.socialMedia).forEach(function (_a) {
|
|
247
|
+
var key = _a[0], value = _a[1];
|
|
248
|
+
if (typeof value === 'string' && value.startsWith('http')) {
|
|
249
|
+
var iconKey = "socialMedia_".concat(key);
|
|
250
|
+
var icon = loadedIcons[iconKey] || react_1.default.createElement(pi_1.PiGithubLogo, null);
|
|
251
|
+
links.push({
|
|
252
|
+
url: value,
|
|
253
|
+
icon: icon,
|
|
254
|
+
label: key.charAt(0).toUpperCase() + key.slice(1)
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
return links;
|
|
260
|
+
}, [
|
|
261
|
+
final.facebookUrl, final.instagramUrl, final.twitterUrl, final.xUrl, final.youtubeUrl, final.linkedinUrl, final.githubUrl,
|
|
262
|
+
final.facebookIcon, final.instagramIcon, final.twitterIcon, final.xIcon, final.youtubeIcon, final.linkedinIcon, final.githubIcon,
|
|
263
|
+
final.socialMedia, loadedIcons
|
|
264
|
+
]);
|
|
265
|
+
var legalLinks = __spreadArray(__spreadArray(__spreadArray([], (final.privacyUrl ? [{ url: final.privacyUrl, text: final.privacyText }] : []), true), (final.termsUrl ? [{ url: final.termsUrl, text: final.termsText }] : []), true), (final.cookiesUrl ? [{ url: final.cookiesUrl, text: final.cookiesText }] : []), true);
|
|
266
|
+
var getCopyrightText = function () {
|
|
267
|
+
if (final.copyrightText)
|
|
268
|
+
return final.copyrightText;
|
|
269
|
+
var text = '';
|
|
270
|
+
if (final.showYear)
|
|
271
|
+
text += "\u00A9 ".concat(currentYear, " ");
|
|
272
|
+
text += final.companyName || 'Company';
|
|
273
|
+
if (final.showRightsReserved)
|
|
274
|
+
text += '. All rights reserved.';
|
|
275
|
+
return text;
|
|
276
|
+
};
|
|
277
|
+
// Get layout classes
|
|
278
|
+
var getLayoutClasses = function () {
|
|
279
|
+
var classes = ['funui-footer'];
|
|
280
|
+
if (final.layout)
|
|
281
|
+
classes.push("funui-footer--".concat(final.layout));
|
|
282
|
+
if (final.funcss)
|
|
283
|
+
classes.push(final.funcss);
|
|
284
|
+
return classes.join(' ');
|
|
285
|
+
};
|
|
286
|
+
return (react_1.default.createElement("footer", { className: getLayoutClasses(), style: {
|
|
287
|
+
backgroundColor: final.bg,
|
|
288
|
+
color: final.textColor,
|
|
289
|
+
padding: final.padding,
|
|
290
|
+
}, "data-testid": "footer" },
|
|
291
|
+
react_1.default.createElement("div", { className: "funui-footer__container ".concat(final.containerClass || ''), style: {
|
|
292
|
+
maxWidth: final.maxWidth,
|
|
293
|
+
'--link-hover-color': final.linkHoverColor,
|
|
294
|
+
} },
|
|
295
|
+
react_1.default.createElement("div", { className: "funui-footer__top ".concat(final.topSectionClass || ''), "data-testid": "footer-top" },
|
|
296
|
+
react_1.default.createElement("div", { className: "funui-footer__brand" },
|
|
297
|
+
(final.logo || final.logoUrl) && (react_1.default.createElement("a", { href: final.logoLinkUrl || '/', className: "funui-footer__logo-link ".concat(final.logoClass || ''), "aria-label": final.companyName || 'Home' }, final.logo ? (react_1.default.createElement("div", { className: "funui-footer__logo-custom" }, final.logo)) : final.logoUrl ? (react_1.default.createElement("img", { src: final.logoUrl, width: final.logoSize || 100, alt: "".concat(final.companyName || 'Company', " logo"), className: "funui-footer__logo-image", loading: "lazy" })) : null)),
|
|
298
|
+
final.description && (react_1.default.createElement("div", { className: "funui-footer__description ".concat(final.descriptionClass || ''), "data-testid": "footer-description" },
|
|
299
|
+
react_1.default.createElement(Text_1.default, { variant: final.descriptionVariant || "", text: typeof final.description === 'string' ? (react_1.default.createElement("p", null, final.description)) : (final.description) }))),
|
|
300
|
+
final.showContactInfo && (final.email || final.phone || final.address) && (react_1.default.createElement("div", { className: "funui-footer__contact", "data-testid": "footer-contact" },
|
|
301
|
+
final.email && (react_1.default.createElement("div", { className: "funui-footer__contact-item" },
|
|
302
|
+
react_1.default.createElement("span", { className: "funui-footer__contact-icon" }, getIcon(final.emailIcon, 'email', react_1.default.createElement(pi_1.PiEnvelope, null))),
|
|
303
|
+
react_1.default.createElement("a", { href: "mailto:".concat(final.email), className: "funui-footer__contact-link" }, final.email))),
|
|
304
|
+
final.phone && (react_1.default.createElement("div", { className: "funui-footer__contact-item" },
|
|
305
|
+
react_1.default.createElement("span", { className: "funui-footer__contact-icon" }, getIcon(final.phoneIcon, 'phone', react_1.default.createElement(pi_1.PiPhone, null))),
|
|
306
|
+
react_1.default.createElement("a", { href: "tel:".concat(final.phone), className: "funui-footer__contact-link" }, final.phone))),
|
|
307
|
+
final.address && (react_1.default.createElement("div", { className: "funui-footer__contact-item" },
|
|
308
|
+
react_1.default.createElement("span", { className: "funui-footer__contact-icon" }, getIcon(final.addressIcon, 'address', react_1.default.createElement(pi_1.PiMapPin, null))),
|
|
309
|
+
react_1.default.createElement("span", { className: "funui-footer__contact-text" }, final.address))))),
|
|
310
|
+
socialLinks.length > 0 && (react_1.default.createElement("div", { className: "funui-footer__socials ".concat(final.socialContainerClass || ''), "data-testid": "footer-socials" }, socialLinks.map(function (social, index) { return (react_1.default.createElement("a", { key: index, href: social.url, target: "_blank", rel: "noopener noreferrer", "aria-label": social.label, className: "funui-footer__social-link" },
|
|
311
|
+
react_1.default.createElement("span", { className: "funui-footer__social-icon" }, react_1.default.isValidElement(social.icon)
|
|
312
|
+
? react_1.default.cloneElement(social.icon, {
|
|
313
|
+
size: final.socialIconSize || 20
|
|
314
|
+
})
|
|
315
|
+
: social.icon),
|
|
316
|
+
react_1.default.createElement("span", { className: "funui-footer__social-label sr-only" }, social.label))); })))),
|
|
317
|
+
sections.length > 0 && sections.map(function (section, sectionIndex) { return (react_1.default.createElement("div", { key: sectionIndex, className: "funui-footer__section", "data-testid": "footer-section-".concat(sectionIndex) },
|
|
318
|
+
react_1.default.createElement("div", { className: "funui-footer__section-title ".concat(final.sectionTitleClass || '') }, section.title),
|
|
319
|
+
react_1.default.createElement("ul", { className: "funui-footer__links" }, section.links.map(function (link, linkIndex) { return (react_1.default.createElement("li", { key: linkIndex, className: "funui-footer__link-item" },
|
|
320
|
+
react_1.default.createElement("a", { href: link.url, target: link.external ? '_blank' : undefined, rel: link.external ? 'noopener noreferrer' : undefined, className: "funui-footer__link ".concat(final.linkClass || '') },
|
|
321
|
+
link.icon && (react_1.default.createElement("span", { className: "funui-footer__link-icon" }, link.icon)),
|
|
322
|
+
react_1.default.createElement("span", { className: "funui-footer__link-text" }, link.label)))); })))); }),
|
|
323
|
+
final.children && (react_1.default.createElement("div", { className: "funui-footer__children" }, final.children))),
|
|
324
|
+
final.showDivider && (react_1.default.createElement("div", { className: "funui-footer__divider", "data-testid": "footer-divider" })),
|
|
325
|
+
react_1.default.createElement("div", { className: "funui-footer__bottom ".concat(final.bottomSectionClass || ''), "data-testid": "footer-bottom" },
|
|
326
|
+
react_1.default.createElement("div", { className: "funui-footer__copyright" }, getCopyrightText()),
|
|
327
|
+
legalLinks.length > 0 && (react_1.default.createElement("div", { className: "funui-footer__legal ".concat(final.legalLinksClass || ''), "data-testid": "footer-legal" }, legalLinks.map(function (link, index) { return (react_1.default.createElement("a", { key: index, href: link.url, className: "funui-footer__legal-link" }, link.text)); })))))));
|
|
328
|
+
};
|
|
329
|
+
exports.default = Footer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DynamicIconProps {
|
|
3
|
+
iconName?: string | React.ReactNode;
|
|
4
|
+
size?: number | string;
|
|
5
|
+
color?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
funcss?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
declare const DynamicIcon: React.FC<DynamicIconProps>;
|
|
12
|
+
export default DynamicIcon;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
48
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
49
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
50
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
51
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
52
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
53
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
57
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
58
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
59
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
60
|
+
function step(op) {
|
|
61
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
63
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
64
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
65
|
+
switch (op[0]) {
|
|
66
|
+
case 0: case 1: t = op; break;
|
|
67
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
68
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
69
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
70
|
+
default:
|
|
71
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
72
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
73
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
74
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
75
|
+
if (t[2]) _.ops.pop();
|
|
76
|
+
_.trys.pop(); continue;
|
|
77
|
+
}
|
|
78
|
+
op = body.call(thisArg, _);
|
|
79
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
80
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
84
|
+
var t = {};
|
|
85
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
86
|
+
t[p] = s[p];
|
|
87
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
88
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
89
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
90
|
+
t[p[i]] = s[p[i]];
|
|
91
|
+
}
|
|
92
|
+
return t;
|
|
93
|
+
};
|
|
94
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
95
|
+
var react_1 = __importStar(require("react"));
|
|
96
|
+
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
97
|
+
var DynamicIcon = function (_a) {
|
|
98
|
+
var iconName = _a.iconName, size = _a.size, color = _a.color, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.funcss, funcss = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d, rest = __rest(_a, ["iconName", "size", "color", "className", "funcss", "style"]);
|
|
99
|
+
var _e = (0, react_1.useState)(null), IconComponent = _e[0], setIconComponent = _e[1];
|
|
100
|
+
var _f = (0, react_1.useState)(false), isLoading = _f[0], setIsLoading = _f[1];
|
|
101
|
+
(0, react_1.useEffect)(function () {
|
|
102
|
+
var loadIcon = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
103
|
+
var Icon, error_1;
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
if (!iconName || typeof iconName !== 'string') {
|
|
108
|
+
setIconComponent(null);
|
|
109
|
+
setIsLoading(false);
|
|
110
|
+
return [2 /*return*/];
|
|
111
|
+
}
|
|
112
|
+
setIsLoading(true);
|
|
113
|
+
_a.label = 1;
|
|
114
|
+
case 1:
|
|
115
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
116
|
+
return [4 /*yield*/, (0, getDynamicIcon_1.getDynamicIcon)(iconName)];
|
|
117
|
+
case 2:
|
|
118
|
+
Icon = _a.sent();
|
|
119
|
+
setIconComponent(Icon);
|
|
120
|
+
return [3 /*break*/, 5];
|
|
121
|
+
case 3:
|
|
122
|
+
error_1 = _a.sent();
|
|
123
|
+
console.error("Failed to load icon \"".concat(iconName, "\":"), error_1);
|
|
124
|
+
setIconComponent(null);
|
|
125
|
+
return [3 /*break*/, 5];
|
|
126
|
+
case 4:
|
|
127
|
+
setIsLoading(false);
|
|
128
|
+
return [7 /*endfinally*/];
|
|
129
|
+
case 5: return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); };
|
|
133
|
+
loadIcon();
|
|
134
|
+
}, [iconName]);
|
|
135
|
+
// Helper function to handle React elements
|
|
136
|
+
var handleReactElement = function (element) {
|
|
137
|
+
var _a, _b;
|
|
138
|
+
var combinedClassName = "dynamic-icon ".concat(funcss, " ").concat(className, " ").concat(((_a = element.props) === null || _a === void 0 ? void 0 : _a.className) || '').trim();
|
|
139
|
+
var combinedStyle = __assign(__assign(__assign(__assign({}, (((_b = element.props) === null || _b === void 0 ? void 0 : _b.style) || {})), style), (size && { fontSize: typeof size === 'number' ? "".concat(size, "px") : size })), (color && { color: color }));
|
|
140
|
+
var mergedProps = __assign(__assign(__assign({}, element.props), rest), { className: combinedClassName, style: combinedStyle });
|
|
141
|
+
return react_1.default.cloneElement(element, mergedProps);
|
|
142
|
+
};
|
|
143
|
+
// If no icon is provided
|
|
144
|
+
if (!iconName)
|
|
145
|
+
return null;
|
|
146
|
+
// Handle React elements
|
|
147
|
+
if (react_1.default.isValidElement(iconName)) {
|
|
148
|
+
return handleReactElement(iconName);
|
|
149
|
+
}
|
|
150
|
+
// Handle string icons
|
|
151
|
+
if (typeof iconName === 'string') {
|
|
152
|
+
// Loading or error state
|
|
153
|
+
if (isLoading || !IconComponent) {
|
|
154
|
+
return (react_1.default.createElement("span", { className: "dynamic-icon-placeholder ".concat(funcss, " ").concat(className).trim(), style: __assign(__assign({}, style), { display: 'inline-block', width: size ? (typeof size === 'number' ? "".concat(size, "px") : size) : '1em', height: size ? (typeof size === 'number' ? "".concat(size, "px") : size) : '1em' }), "aria-label": isLoading ? 'Loading icon' : 'Icon not found' }));
|
|
155
|
+
}
|
|
156
|
+
var combinedClassName = "dynamic-icon ".concat(funcss, " ").concat(className).trim();
|
|
157
|
+
var combinedStyle = __assign(__assign(__assign({}, style), (size && { fontSize: typeof size === 'number' ? "".concat(size, "px") : size })), (color && { color: color }));
|
|
158
|
+
return react_1.default.createElement(IconComponent, __assign({ className: combinedClassName, style: combinedStyle }, rest));
|
|
159
|
+
}
|
|
160
|
+
// Handle other React nodes (fallback)
|
|
161
|
+
return iconName;
|
|
162
|
+
};
|
|
163
|
+
exports.default = DynamicIcon;
|