funuicss 3.6.14 → 3.6.15
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 +6677 -6679
- package/package.json +1 -1
- package/ui/button/Button.d.ts +8 -2
- package/ui/button/Button.js +123 -86
- package/ui/card/Card.d.ts +51 -1
- package/ui/card/Card.js +184 -16
- package/ui/richtext/RichText.d.ts +0 -1
- package/ui/richtext/RichText.js +20 -15
- package/ui/select/Select.d.ts +2 -0
- package/ui/select/Select.js +12 -2
- package/ui/text/Text.d.ts +2 -0
- package/ui/text/Text.js +6 -4
- package/ui/vista/Vista.d.ts +15 -0
- package/ui/vista/Vista.js +20 -5
- package/utils/getDynamicIcon.d.ts +2 -0
- package/utils/getDynamicIcon.js +112 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.6.
|
|
2
|
+
"version": "3.6.15",
|
|
3
3
|
"name": "funuicss",
|
|
4
4
|
"description": "React and Next.js component UI Library for creating Easy and good looking websites with fewer lines of code. Elevate your web development experience with our cutting-edge React/Next.js component UI Library. Craft stunning websites effortlessly, boasting both seamless functionality and aesthetic appeal—all achieved with minimal lines of code. Unleash the power of simplicity and style in your projects!",
|
|
5
5
|
"main": "index.js",
|
package/ui/button/Button.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ interface ButtonProps {
|
|
|
5
5
|
funcss?: string;
|
|
6
6
|
startIcon?: ReactNode;
|
|
7
7
|
endIcon?: ReactNode;
|
|
8
|
+
stringPrefix?: string;
|
|
9
|
+
stringSuffix?: string;
|
|
10
|
+
prefix?: ReactNode;
|
|
11
|
+
suffix?: ReactNode;
|
|
12
|
+
iconSize?: number | string;
|
|
13
|
+
iconLineHeight?: string | number;
|
|
8
14
|
text?: string;
|
|
9
15
|
rounded?: boolean;
|
|
10
16
|
raised?: boolean;
|
|
@@ -15,6 +21,7 @@ interface ButtonProps {
|
|
|
15
21
|
fullWidth?: boolean;
|
|
16
22
|
outlined?: boolean;
|
|
17
23
|
small?: boolean;
|
|
24
|
+
hoverless?: boolean;
|
|
18
25
|
smaller?: boolean;
|
|
19
26
|
big?: boolean;
|
|
20
27
|
bigger?: boolean;
|
|
@@ -23,7 +30,6 @@ interface ButtonProps {
|
|
|
23
30
|
hoverNone?: boolean;
|
|
24
31
|
fillAnimation?: boolean;
|
|
25
32
|
bold?: boolean;
|
|
26
|
-
hoverless?: boolean;
|
|
27
33
|
fillDirection?: string;
|
|
28
34
|
fillTextColor?: string;
|
|
29
35
|
buttonFillStyle?: React.CSSProperties;
|
|
@@ -36,5 +42,5 @@ interface ButtonProps {
|
|
|
36
42
|
style?: React.CSSProperties;
|
|
37
43
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
38
44
|
}
|
|
39
|
-
export default function Button({ variant, color, bg, funcss, startIcon, endIcon, text, rounded, raised, height, width, float, hoverUp, fullWidth, outlined, small, hoverless, smaller, big, bigger, jumbo, flat, hoverNone, fillAnimation, fillDirection, fillTextColor, outlineSize, isLoading, status,
|
|
45
|
+
export default function Button({ variant, color, bg, funcss, startIcon, endIcon, stringPrefix, stringSuffix, prefix, suffix, iconSize, iconLineHeight, text, rounded, raised, height, width, float, hoverUp, fullWidth, outlined, small, hoverless, smaller, big, bigger, jumbo, flat, hoverNone, fillAnimation, fillDirection, fillTextColor, outlineSize, isLoading, status, bold, children, style, url, onClick, ...rest }: ButtonProps): React.JSX.Element;
|
|
40
46
|
export {};
|
package/ui/button/Button.js
CHANGED
|
@@ -11,6 +11,39 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
return __assign.apply(this, arguments);
|
|
13
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
|
+
})();
|
|
14
47
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
15
48
|
var t = {};
|
|
16
49
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -22,103 +55,107 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
55
|
}
|
|
23
56
|
return t;
|
|
24
57
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
59
|
exports.default = Button;
|
|
30
|
-
var react_1 =
|
|
60
|
+
var react_1 = __importStar(require("react"));
|
|
31
61
|
var pi_1 = require("react-icons/pi");
|
|
32
62
|
var componentUtils_1 = require("../../utils/componentUtils");
|
|
63
|
+
var getDynamicIcon_1 = require("../../utils/getDynamicIcon");
|
|
33
64
|
function Button(_a) {
|
|
34
|
-
var _b
|
|
35
|
-
|
|
65
|
+
var _b;
|
|
66
|
+
var _c = _a.variant, variant = _c === void 0 ? '' : _c, color = _a.color, bg = _a.bg, funcss = _a.funcss, startIcon = _a.startIcon, endIcon = _a.endIcon, stringPrefix = _a.stringPrefix, stringSuffix = _a.stringSuffix, prefix = _a.prefix, suffix = _a.suffix, iconSize = _a.iconSize, _d = _a.iconLineHeight, iconLineHeight = _d === void 0 ? 0 : _d, text = _a.text, rounded = _a.rounded, raised = _a.raised, height = _a.height, width = _a.width, float = _a.float, hoverUp = _a.hoverUp, fullWidth = _a.fullWidth, outlined = _a.outlined, small = _a.small, hoverless = _a.hoverless, smaller = _a.smaller, big = _a.big, bigger = _a.bigger, jumbo = _a.jumbo, flat = _a.flat, hoverNone = _a.hoverNone, fillAnimation = _a.fillAnimation, fillDirection = _a.fillDirection, fillTextColor = _a.fillTextColor, outlineSize = _a.outlineSize, isLoading = _a.isLoading, status = _a.status, bold = _a.bold, children = _a.children, style = _a.style, url = _a.url, onClick = _a.onClick, rest = __rest(_a, ["variant", "color", "bg", "funcss", "startIcon", "endIcon", "stringPrefix", "stringSuffix", "prefix", "suffix", "iconSize", "iconLineHeight", "text", "rounded", "raised", "height", "width", "float", "hoverUp", "fullWidth", "outlined", "small", "hoverless", "smaller", "big", "bigger", "jumbo", "flat", "hoverNone", "fillAnimation", "fillDirection", "fillTextColor", "outlineSize", "isLoading", "status", "bold", "children", "style", "url", "onClick"]);
|
|
36
67
|
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Button', variant).mergeWithLocal;
|
|
37
|
-
// Merge config with local props - local props should override config
|
|
38
68
|
var mergedProps = mergeWithLocal(__assign({ color: color, bg: bg, funcss: funcss, text: text, rounded: rounded, raised: raised, height: height, width: width, float: float, hoverUp: hoverUp, fullWidth: fullWidth, outlined: outlined, small: small, hoverless: hoverless, smaller: smaller, big: big, bigger: bigger, jumbo: jumbo, flat: flat, hoverNone: hoverNone, fillAnimation: fillAnimation, fillDirection: fillDirection, fillTextColor: fillTextColor, outlineSize: outlineSize, isLoading: isLoading, status: status, bold: bold }, rest)).props;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
function hasNumberAbove(text) {
|
|
69
|
-
if (!text)
|
|
70
|
-
return false;
|
|
71
|
-
var matches = text.match(/\d+/g);
|
|
72
|
-
if (!matches)
|
|
73
|
-
return false;
|
|
74
|
-
return matches.some(function (num) { return parseInt(num) >= 400; });
|
|
75
|
-
}
|
|
76
|
-
function hasNumber(text) {
|
|
77
|
-
if (!text)
|
|
78
|
-
return false;
|
|
79
|
-
return /\d/.test(text);
|
|
69
|
+
var final = {
|
|
70
|
+
isLoading: mergedProps.isLoading,
|
|
71
|
+
status: mergedProps.status,
|
|
72
|
+
text: mergedProps.text,
|
|
73
|
+
outlined: mergedProps.outlined,
|
|
74
|
+
bg: mergedProps.bg,
|
|
75
|
+
color: mergedProps.color,
|
|
76
|
+
rounded: mergedProps.rounded,
|
|
77
|
+
hoverless: mergedProps.hoverless,
|
|
78
|
+
bold: mergedProps.bold,
|
|
79
|
+
float: mergedProps.float,
|
|
80
|
+
raised: mergedProps.raised,
|
|
81
|
+
hoverUp: mergedProps.hoverUp,
|
|
82
|
+
flat: mergedProps.flat,
|
|
83
|
+
hoverNone: mergedProps.hoverNone,
|
|
84
|
+
small: mergedProps.small,
|
|
85
|
+
smaller: mergedProps.smaller,
|
|
86
|
+
big: mergedProps.big,
|
|
87
|
+
bigger: mergedProps.bigger,
|
|
88
|
+
jumbo: mergedProps.jumbo,
|
|
89
|
+
fillAnimation: mergedProps.fillAnimation,
|
|
90
|
+
fillDirection: mergedProps.fillDirection,
|
|
91
|
+
fillTextColor: mergedProps.fillTextColor,
|
|
92
|
+
funcss: mergedProps.funcss,
|
|
93
|
+
};
|
|
94
|
+
var _e = (0, react_1.useState)(null), prefixNode = _e[0], setPrefixNode = _e[1];
|
|
95
|
+
var _f = (0, react_1.useState)(null), suffixNode = _f[0], setSuffixNode = _f[1];
|
|
96
|
+
function isReactElement(node) {
|
|
97
|
+
return react_1.default.isValidElement(node);
|
|
80
98
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
(0, react_1.useEffect)(function () {
|
|
100
|
+
if (stringPrefix)
|
|
101
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringPrefix).then(function (node) { return setPrefixNode(node); });
|
|
102
|
+
if (stringSuffix)
|
|
103
|
+
(0, getDynamicIcon_1.getDynamicIcon)(stringSuffix).then(function (node) { return setSuffixNode(node); });
|
|
104
|
+
}, [stringPrefix, stringSuffix]);
|
|
105
|
+
var textColorClass = final.bg
|
|
106
|
+
? final.color
|
|
107
|
+
? final.color
|
|
108
|
+
: !/\d/.test(final.bg) && !final.outlined
|
|
109
|
+
? ''
|
|
110
|
+
: /[4-9]\d{2,}/.test(final.bg) && !final.outlined
|
|
111
|
+
? 'white'
|
|
112
|
+
: final.bg.replace(/[0-9]/g, '')
|
|
113
|
+
: final.color;
|
|
91
114
|
var classNames = [
|
|
92
115
|
'button',
|
|
93
116
|
"text-".concat(textColorClass),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
final.funcss || '',
|
|
118
|
+
final.rounded ? 'roundBtn' : '',
|
|
119
|
+
final.hoverless ? 'hoverless' : '',
|
|
120
|
+
final.bold ? 'text-bold' : '',
|
|
121
|
+
final.float ? 'floatBtn' : '',
|
|
122
|
+
final.raised ? 'raisedBtn' : '',
|
|
123
|
+
final.hoverUp ? 'hover-up' : '',
|
|
124
|
+
final.flat ? 'flat' : '',
|
|
125
|
+
final.hoverNone ? 'hoverNone' : '',
|
|
126
|
+
final.small ? 'smallBtn' : final.smaller ? 'smallerBtn' : '',
|
|
127
|
+
final.big ? 'bigBtn' : '',
|
|
128
|
+
final.bigger ? 'biggerBtn' : '',
|
|
129
|
+
final.jumbo ? 'jumboBtn' : '',
|
|
130
|
+
final.outlined
|
|
131
|
+
? "outlined outline-".concat(final.bg || '', " text-").concat(final.color ? final.color : (_b = final.bg) === null || _b === void 0 ? void 0 : _b.replace(/[0-9]/g, ''))
|
|
132
|
+
: final.bg || '',
|
|
133
|
+
"".concat(final.fillAnimation ? "".concat(final.fillTextColor ? "hover-text-".concat(final.fillTextColor) : '', " button-fill fill-").concat(final.fillDirection || 'left') : ''),
|
|
110
134
|
].join(' ');
|
|
135
|
+
var iconWrapperStyle = {
|
|
136
|
+
lineHeight: iconLineHeight,
|
|
137
|
+
display: 'inline-flex',
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
justifyContent: 'center',
|
|
140
|
+
};
|
|
111
141
|
return (react_1.default.createElement("span", null,
|
|
112
|
-
react_1.default.createElement("button", __assign({ className: "".concat(classNames, " ").concat(startIcon || endIcon ||
|
|
113
|
-
|
|
114
|
-
react_1.default.createElement(pi_1.PiSpinner,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
startIcon && react_1.default.createElement("span", { className: "btn_left_icon", style: {
|
|
122
|
-
|
|
123
|
-
|
|
142
|
+
react_1.default.createElement("button", __assign({ className: "".concat(classNames, " ").concat((startIcon || endIcon || prefix || suffix || prefixNode || suffixNode || final.status || final.isLoading) ? 'iconic' : ''), style: __assign({ height: mergedProps.height || '', width: mergedProps.fullWidth ? '100%' : mergedProps.width || '', borderRadius: final.flat ? '0rem' : '' }, style), onClick: onClick || (url ? function () { return (window.location.href = url); } : undefined) }, mergedProps),
|
|
143
|
+
final.isLoading && (react_1.default.createElement("span", { className: "btn_left_icon rotate", style: iconWrapperStyle },
|
|
144
|
+
react_1.default.createElement(pi_1.PiSpinner, { size: iconSize }))),
|
|
145
|
+
final.status && (react_1.default.createElement("span", { className: "btn_left_icon", style: iconWrapperStyle },
|
|
146
|
+
final.status === 'success' && react_1.default.createElement(pi_1.PiCheck, { size: iconSize }),
|
|
147
|
+
final.status === 'info' && react_1.default.createElement(pi_1.PiInfo, { size: iconSize }),
|
|
148
|
+
final.status === 'warning' && react_1.default.createElement(pi_1.PiWarning, { size: iconSize }),
|
|
149
|
+
final.status === 'danger' && react_1.default.createElement(pi_1.PiX, { size: iconSize }))),
|
|
150
|
+
final.fillAnimation && react_1.default.createElement("span", { className: "button_fill_span ".concat(final.bg) }),
|
|
151
|
+
(prefix || startIcon || prefixNode) && (react_1.default.createElement("span", { className: "btn_left_icon", style: iconWrapperStyle }, isReactElement(startIcon) ? react_1.default.cloneElement(startIcon, { size: iconSize })
|
|
152
|
+
: isReactElement(prefix) ? react_1.default.cloneElement(prefix, { size: iconSize })
|
|
153
|
+
: isReactElement(prefixNode) ? react_1.default.cloneElement(prefixNode, { size: iconSize })
|
|
154
|
+
: prefix || startIcon || prefixNode // fallback for string/number, rendered as-is
|
|
155
|
+
)),
|
|
156
|
+
final.text ? final.text : children,
|
|
157
|
+
(suffix || endIcon || suffixNode) && (react_1.default.createElement("span", { className: "btn_right_icon", style: iconWrapperStyle }, isReactElement(endIcon) ? react_1.default.cloneElement(endIcon, { size: iconSize })
|
|
158
|
+
: isReactElement(suffix) ? react_1.default.cloneElement(suffix, { size: iconSize })
|
|
159
|
+
: isReactElement(suffixNode) ? react_1.default.cloneElement(suffixNode, { size: iconSize })
|
|
160
|
+
: suffix || endIcon || suffixNode)))));
|
|
124
161
|
}
|
package/ui/card/Card.d.ts
CHANGED
|
@@ -27,6 +27,56 @@ interface CardProps {
|
|
|
27
27
|
responsiveMedium?: boolean;
|
|
28
28
|
xl?: boolean;
|
|
29
29
|
style?: React.CSSProperties;
|
|
30
|
+
pattern?: 'none' | 'grid' | 'dots' | 'diagonal' | 'checkerboard' | 'horizontal' | 'vertical';
|
|
31
|
+
patternOpacity?: number;
|
|
32
|
+
gradient?: string;
|
|
33
|
+
opacity?: number;
|
|
34
|
+
border?: string;
|
|
35
|
+
hoverEffect?: 'none' | 'lift' | 'glow';
|
|
36
|
+
heading?: ReactNode;
|
|
37
|
+
headingSize?: string;
|
|
38
|
+
headingWeight?: number;
|
|
39
|
+
headingColor?: string;
|
|
40
|
+
headingClass?: string;
|
|
41
|
+
headingLineHeight?: string;
|
|
42
|
+
subheading?: ReactNode;
|
|
43
|
+
subheadingSize?: string;
|
|
44
|
+
subheadingWeight?: number;
|
|
45
|
+
subheadingColor?: string;
|
|
46
|
+
subheadingClass?: string;
|
|
47
|
+
subheadingLineHeight?: string;
|
|
48
|
+
content?: ReactNode;
|
|
49
|
+
contentSize?: string;
|
|
50
|
+
contentWeight?: number;
|
|
51
|
+
contentColor?: string;
|
|
52
|
+
contentClass?: string;
|
|
53
|
+
contentLineHeight?: string;
|
|
54
|
+
imageUrl?: string;
|
|
55
|
+
imageAlt?: string;
|
|
56
|
+
imageClass?: string;
|
|
57
|
+
imageSize?: string;
|
|
58
|
+
showPrimaryCTA?: boolean;
|
|
59
|
+
showSecondaryCTA?: boolean;
|
|
60
|
+
showAccentCTA?: boolean;
|
|
61
|
+
primaryButtonOutlined?: boolean;
|
|
62
|
+
secondaryButtonOutlined?: boolean;
|
|
63
|
+
accentButtonOutlined?: boolean;
|
|
64
|
+
ctaPrimaryUrl?: string;
|
|
65
|
+
ctaSecondaryUrl?: string;
|
|
66
|
+
ctaAccentUrl?: string;
|
|
67
|
+
ctaPrimaryText?: string;
|
|
68
|
+
ctaSecondaryText?: string;
|
|
69
|
+
ctaAccentText?: string;
|
|
70
|
+
ctaGap?: number;
|
|
71
|
+
ctaFlexJustify?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around';
|
|
72
|
+
ctaClass?: string;
|
|
73
|
+
headerStyle?: React.CSSProperties;
|
|
74
|
+
headerClass?: string;
|
|
75
|
+
bodyStyle?: React.CSSProperties;
|
|
76
|
+
bodyClass?: string;
|
|
77
|
+
footerStyle?: React.CSSProperties;
|
|
78
|
+
footerClass?: string;
|
|
79
|
+
variant?: string;
|
|
30
80
|
}
|
|
31
|
-
export default function Card({ color, bg, width, height, minHeight, minWidth, margin, padding, funcss, children, roundEdge, maxHeight, maxWidth, horizontal, id, header, body, footer, noGap, fab, image, shadowless, flat, responsiveMedium, xl, responsiveSmall, style, ...rest }: CardProps): React.JSX.Element;
|
|
81
|
+
export default function Card({ color, bg, width, height, minHeight, minWidth, margin, padding, funcss, children, roundEdge, maxHeight, maxWidth, horizontal, id, header, body, footer, noGap, fab, image, shadowless, flat, responsiveMedium, xl, responsiveSmall, style, pattern, patternOpacity, gradient, opacity, border, hoverEffect, heading, headingSize, headingWeight, headingColor, headingClass, headingLineHeight, subheading, subheadingSize, subheadingWeight, subheadingColor, subheadingClass, subheadingLineHeight, content, contentSize, contentWeight, contentColor, contentClass, contentLineHeight, imageUrl, imageAlt, imageClass, imageSize, showPrimaryCTA, showSecondaryCTA, showAccentCTA, primaryButtonOutlined, secondaryButtonOutlined, accentButtonOutlined, ctaPrimaryUrl, ctaSecondaryUrl, ctaAccentUrl, ctaPrimaryText, ctaSecondaryText, ctaAccentText, ctaGap, ctaFlexJustify, ctaClass, headerStyle, headerClass, bodyStyle, bodyClass, footerStyle, footerClass, variant, ...rest }: CardProps): React.JSX.Element;
|
|
32
82
|
export {};
|
package/ui/card/Card.js
CHANGED
|
@@ -32,24 +32,192 @@ var CardHeader_1 = __importDefault(require("./CardHeader"));
|
|
|
32
32
|
var CardBody_1 = __importDefault(require("./CardBody"));
|
|
33
33
|
var CardFooter_1 = __importDefault(require("./CardFooter"));
|
|
34
34
|
var theme_1 = require("../theme/theme");
|
|
35
|
+
var componentUtils_1 = require("../../utils/componentUtils");
|
|
36
|
+
var Button_1 = __importDefault(require("../button/Button"));
|
|
37
|
+
var Flex_1 = __importDefault(require("../flex/Flex"));
|
|
38
|
+
var Text_1 = __importDefault(require("../text/Text"));
|
|
35
39
|
function Card(_a) {
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
var
|
|
41
|
+
// Original Props
|
|
42
|
+
color = _a.color, bg = _a.bg, width = _a.width, height = _a.height, minHeight = _a.minHeight, minWidth = _a.minWidth, margin = _a.margin, padding = _a.padding, funcss = _a.funcss, children = _a.children, roundEdge = _a.roundEdge, maxHeight = _a.maxHeight, maxWidth = _a.maxWidth, horizontal = _a.horizontal, id = _a.id, header = _a.header, body = _a.body, footer = _a.footer, noGap = _a.noGap, fab = _a.fab, image = _a.image, shadowless = _a.shadowless, flat = _a.flat, responsiveMedium = _a.responsiveMedium, xl = _a.xl, responsiveSmall = _a.responsiveSmall, style = _a.style,
|
|
43
|
+
// Pattern Props
|
|
44
|
+
_b = _a.pattern,
|
|
45
|
+
// Pattern Props
|
|
46
|
+
pattern = _b === void 0 ? 'none' : _b, _c = _a.patternOpacity, patternOpacity = _c === void 0 ? 0.1 : _c, gradient = _a.gradient, _d = _a.opacity, opacity = _d === void 0 ? 1 : _d, border = _a.border, _e = _a.hoverEffect, hoverEffect = _e === void 0 ? 'none' : _e,
|
|
47
|
+
// Enhanced Content Props
|
|
48
|
+
heading = _a.heading, _f = _a.headingSize, headingSize = _f === void 0 ? 'xl' : _f, _g = _a.headingWeight, headingWeight = _g === void 0 ? 700 : _g, headingColor = _a.headingColor, headingClass = _a.headingClass, headingLineHeight = _a.headingLineHeight, subheading = _a.subheading, _h = _a.subheadingSize, subheadingSize = _h === void 0 ? 'base' : _h, _j = _a.subheadingWeight, subheadingWeight = _j === void 0 ? 400 : _j, _k = _a.subheadingColor, subheadingColor = _k === void 0 ? 'light' : _k, subheadingClass = _a.subheadingClass, subheadingLineHeight = _a.subheadingLineHeight, content = _a.content, _l = _a.contentSize, contentSize = _l === void 0 ? 'base' : _l, _m = _a.contentWeight, contentWeight = _m === void 0 ? 400 : _m, contentColor = _a.contentColor, contentClass = _a.contentClass, contentLineHeight = _a.contentLineHeight,
|
|
49
|
+
// Image Props
|
|
50
|
+
imageUrl = _a.imageUrl, _o = _a.imageAlt, imageAlt = _o === void 0 ? '' : _o, _p = _a.imageClass, imageClass = _p === void 0 ? '' : _p, _q = _a.imageSize, imageSize = _q === void 0 ? '100%' : _q,
|
|
51
|
+
// Enhanced Footer/CTA Props
|
|
52
|
+
_r = _a.showPrimaryCTA,
|
|
53
|
+
// Enhanced Footer/CTA Props
|
|
54
|
+
showPrimaryCTA = _r === void 0 ? false : _r, _s = _a.showSecondaryCTA, showSecondaryCTA = _s === void 0 ? false : _s, _t = _a.showAccentCTA, showAccentCTA = _t === void 0 ? false : _t, _u = _a.primaryButtonOutlined, primaryButtonOutlined = _u === void 0 ? false : _u, _v = _a.secondaryButtonOutlined, secondaryButtonOutlined = _v === void 0 ? false : _v, _w = _a.accentButtonOutlined, accentButtonOutlined = _w === void 0 ? false : _w, _x = _a.ctaPrimaryUrl, ctaPrimaryUrl = _x === void 0 ? '' : _x, _y = _a.ctaSecondaryUrl, ctaSecondaryUrl = _y === void 0 ? '' : _y, _z = _a.ctaAccentUrl, ctaAccentUrl = _z === void 0 ? '' : _z, _0 = _a.ctaPrimaryText, ctaPrimaryText = _0 === void 0 ? 'Primary Action' : _0, _1 = _a.ctaSecondaryText, ctaSecondaryText = _1 === void 0 ? 'Secondary Action' : _1, _2 = _a.ctaAccentText, ctaAccentText = _2 === void 0 ? 'Accent Action' : _2, _3 = _a.ctaGap, ctaGap = _3 === void 0 ? 1 : _3, _4 = _a.ctaFlexJustify, ctaFlexJustify = _4 === void 0 ? 'center' : _4, _5 = _a.ctaClass, ctaClass = _5 === void 0 ? '' : _5,
|
|
55
|
+
// Section Styling Props
|
|
56
|
+
headerStyle = _a.headerStyle, headerClass = _a.headerClass, bodyStyle = _a.bodyStyle, bodyClass = _a.bodyClass, footerStyle = _a.footerStyle, footerClass = _a.footerClass,
|
|
57
|
+
// Configuration
|
|
58
|
+
variant = _a.variant, rest = __rest(_a, ["color", "bg", "width", "height", "minHeight", "minWidth", "margin", "padding", "funcss", "children", "roundEdge", "maxHeight", "maxWidth", "horizontal", "id", "header", "body", "footer", "noGap", "fab", "image", "shadowless", "flat", "responsiveMedium", "xl", "responsiveSmall", "style", "pattern", "patternOpacity", "gradient", "opacity", "border", "hoverEffect", "heading", "headingSize", "headingWeight", "headingColor", "headingClass", "headingLineHeight", "subheading", "subheadingSize", "subheadingWeight", "subheadingColor", "subheadingClass", "subheadingLineHeight", "content", "contentSize", "contentWeight", "contentColor", "contentClass", "contentLineHeight", "imageUrl", "imageAlt", "imageClass", "imageSize", "showPrimaryCTA", "showSecondaryCTA", "showAccentCTA", "primaryButtonOutlined", "secondaryButtonOutlined", "accentButtonOutlined", "ctaPrimaryUrl", "ctaSecondaryUrl", "ctaAccentUrl", "ctaPrimaryText", "ctaSecondaryText", "ctaAccentText", "ctaGap", "ctaFlexJustify", "ctaClass", "headerStyle", "headerClass", "bodyStyle", "bodyClass", "footerStyle", "footerClass", "variant"]);
|
|
59
|
+
// Use the component config hook
|
|
60
|
+
var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Card', variant).mergeWithLocal;
|
|
61
|
+
// Merge config with local props
|
|
62
|
+
var mergedProps = mergeWithLocal({
|
|
63
|
+
// Original props
|
|
64
|
+
color: color,
|
|
65
|
+
bg: bg,
|
|
66
|
+
width: width,
|
|
67
|
+
height: height,
|
|
68
|
+
minHeight: minHeight,
|
|
69
|
+
minWidth: minWidth,
|
|
70
|
+
margin: margin,
|
|
71
|
+
padding: padding,
|
|
72
|
+
funcss: funcss,
|
|
73
|
+
children: children,
|
|
74
|
+
roundEdge: roundEdge,
|
|
75
|
+
maxHeight: maxHeight,
|
|
76
|
+
maxWidth: maxWidth,
|
|
77
|
+
horizontal: horizontal,
|
|
78
|
+
id: id,
|
|
79
|
+
header: header,
|
|
80
|
+
body: body,
|
|
81
|
+
footer: footer,
|
|
82
|
+
noGap: noGap,
|
|
83
|
+
fab: fab,
|
|
84
|
+
image: image,
|
|
85
|
+
shadowless: shadowless,
|
|
86
|
+
flat: flat,
|
|
87
|
+
responsiveMedium: responsiveMedium,
|
|
88
|
+
xl: xl,
|
|
89
|
+
responsiveSmall: responsiveSmall,
|
|
90
|
+
style: style,
|
|
91
|
+
// Pattern props
|
|
92
|
+
pattern: pattern,
|
|
93
|
+
patternOpacity: patternOpacity,
|
|
94
|
+
gradient: gradient,
|
|
95
|
+
opacity: opacity,
|
|
96
|
+
border: border,
|
|
97
|
+
hoverEffect: hoverEffect,
|
|
98
|
+
// Enhanced content props
|
|
99
|
+
heading: heading,
|
|
100
|
+
headingSize: headingSize,
|
|
101
|
+
headingWeight: headingWeight,
|
|
102
|
+
headingColor: headingColor,
|
|
103
|
+
headingClass: headingClass,
|
|
104
|
+
headingLineHeight: headingLineHeight,
|
|
105
|
+
subheading: subheading,
|
|
106
|
+
subheadingSize: subheadingSize,
|
|
107
|
+
subheadingWeight: subheadingWeight,
|
|
108
|
+
subheadingColor: subheadingColor,
|
|
109
|
+
subheadingClass: subheadingClass,
|
|
110
|
+
subheadingLineHeight: subheadingLineHeight,
|
|
111
|
+
content: content,
|
|
112
|
+
contentSize: contentSize,
|
|
113
|
+
contentWeight: contentWeight,
|
|
114
|
+
contentColor: contentColor,
|
|
115
|
+
contentClass: contentClass,
|
|
116
|
+
contentLineHeight: contentLineHeight,
|
|
117
|
+
// Image props
|
|
118
|
+
imageUrl: imageUrl,
|
|
119
|
+
imageAlt: imageAlt,
|
|
120
|
+
imageClass: imageClass,
|
|
121
|
+
imageSize: imageSize,
|
|
122
|
+
// CTA props
|
|
123
|
+
showPrimaryCTA: showPrimaryCTA,
|
|
124
|
+
showSecondaryCTA: showSecondaryCTA,
|
|
125
|
+
showAccentCTA: showAccentCTA,
|
|
126
|
+
primaryButtonOutlined: primaryButtonOutlined,
|
|
127
|
+
secondaryButtonOutlined: secondaryButtonOutlined,
|
|
128
|
+
accentButtonOutlined: accentButtonOutlined,
|
|
129
|
+
ctaPrimaryUrl: ctaPrimaryUrl,
|
|
130
|
+
ctaSecondaryUrl: ctaSecondaryUrl,
|
|
131
|
+
ctaAccentUrl: ctaAccentUrl,
|
|
132
|
+
ctaPrimaryText: ctaPrimaryText,
|
|
133
|
+
ctaSecondaryText: ctaSecondaryText,
|
|
134
|
+
ctaAccentText: ctaAccentText,
|
|
135
|
+
ctaGap: ctaGap,
|
|
136
|
+
ctaFlexJustify: ctaFlexJustify,
|
|
137
|
+
ctaClass: ctaClass,
|
|
138
|
+
// Section styling props
|
|
139
|
+
headerStyle: headerStyle,
|
|
140
|
+
headerClass: headerClass,
|
|
141
|
+
bodyStyle: bodyStyle,
|
|
142
|
+
bodyClass: bodyClass,
|
|
143
|
+
footerStyle: footerStyle,
|
|
144
|
+
footerClass: footerClass,
|
|
145
|
+
}).props;
|
|
146
|
+
var themeVariant = (0, theme_1.useVariant)().variant;
|
|
147
|
+
// Handle content - if string, use dangerouslySetInnerHTML, otherwise render as is
|
|
148
|
+
var renderContent = function (content) {
|
|
149
|
+
if (typeof content === 'string') {
|
|
150
|
+
return react_1.default.createElement("div", { dangerouslySetInnerHTML: { __html: content } });
|
|
151
|
+
}
|
|
152
|
+
return content;
|
|
153
|
+
};
|
|
154
|
+
// Enhanced Text Content with flexible styling
|
|
155
|
+
var EnhancedTextContent = (react_1.default.createElement("div", { className: "card-enhanced-content" },
|
|
156
|
+
mergedProps.heading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.headingSize, weight: mergedProps.headingWeight, color: mergedProps.headingColor, funcss: mergedProps.headingClass, lineHeight: mergedProps.headingLineHeight }, renderContent(mergedProps.heading))),
|
|
157
|
+
mergedProps.subheading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.subheadingSize, weight: mergedProps.subheadingWeight, color: mergedProps.subheadingColor, funcss: "mt-1 ".concat(mergedProps.subheadingClass), lineHeight: mergedProps.subheadingLineHeight }, renderContent(mergedProps.subheading))),
|
|
158
|
+
mergedProps.content && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.contentSize, weight: mergedProps.contentWeight, color: mergedProps.contentColor, funcss: "mt-3 ".concat(mergedProps.contentClass), lineHeight: mergedProps.contentLineHeight, article: true }, renderContent(mergedProps.content)))));
|
|
159
|
+
// Image Content - uses imageUrl if no image component provided
|
|
160
|
+
var ImageContent = (mergedProps.image || mergedProps.imageUrl) && (react_1.default.createElement("div", { className: "card-image-content" }, mergedProps.image ? (mergedProps.image) : (mergedProps.imageUrl && (react_1.default.createElement("img", { src: mergedProps.imageUrl, alt: mergedProps.imageAlt, className: mergedProps.imageClass, style: {
|
|
161
|
+
width: mergedProps.imageSize,
|
|
162
|
+
height: 'auto',
|
|
163
|
+
objectFit: 'cover',
|
|
164
|
+
borderRadius: 'inherit'
|
|
165
|
+
} })))));
|
|
166
|
+
// CTA Buttons Component
|
|
167
|
+
var CTAButtons = function () {
|
|
168
|
+
var hasCTAs = mergedProps.showPrimaryCTA || mergedProps.showSecondaryCTA || mergedProps.showAccentCTA;
|
|
169
|
+
if (!hasCTAs)
|
|
170
|
+
return null;
|
|
171
|
+
return (react_1.default.createElement(Flex_1.default, { gap: mergedProps.ctaGap, justify: mergedProps.ctaFlexJustify, className: "mt-4 ".concat(mergedProps.ctaClass), wrap: "wrap", width: '100%' },
|
|
172
|
+
mergedProps.showPrimaryCTA && (react_1.default.createElement(Button_1.default, { bg: "primary", outlined: mergedProps.primaryButtonOutlined, onClick: function () { return mergedProps.ctaPrimaryUrl && (window.location.href = mergedProps.ctaPrimaryUrl); } }, mergedProps.ctaPrimaryText)),
|
|
173
|
+
mergedProps.showSecondaryCTA && (react_1.default.createElement(Button_1.default, { bg: "secondary", outlined: mergedProps.secondaryButtonOutlined, onClick: function () { return mergedProps.ctaSecondaryUrl && (window.location.href = mergedProps.ctaSecondaryUrl); } }, mergedProps.ctaSecondaryText)),
|
|
174
|
+
mergedProps.showAccentCTA && (react_1.default.createElement(Button_1.default, { bg: "accent", outlined: mergedProps.accentButtonOutlined, onClick: function () { return mergedProps.ctaAccentUrl && (window.location.href = mergedProps.ctaAccentUrl); } }, mergedProps.ctaAccentText))));
|
|
175
|
+
};
|
|
176
|
+
// Determine if we should use enhanced content
|
|
177
|
+
var hasEnhancedContent = mergedProps.heading || mergedProps.subheading || mergedProps.content;
|
|
178
|
+
var hasEnhancedFooter = mergedProps.showPrimaryCTA || mergedProps.showSecondaryCTA || mergedProps.showAccentCTA;
|
|
179
|
+
var hasImageContent = mergedProps.image || mergedProps.imageUrl;
|
|
180
|
+
return (react_1.default.createElement("div", __assign({ id: mergedProps.id || '', className: "\n card \n card_flex\n ".concat(!image && !imageUrl ? "p" : "", "\n ").concat(mergedProps.noGap ? 'no-gap' : '', " \n ").concat(mergedProps.xl ? 'xl' : '', " \n text-").concat(mergedProps.color || '', " \n ").concat(mergedProps.bg || '', " \n ").concat(mergedProps.funcss || '', " \n ").concat(mergedProps.roundEdge ? 'round-edge' : '', " \n ").concat(mergedProps.shadowless ? 'shadowless' : '', " \n ").concat(mergedProps.flat ? 'flat' : '', " \n ").concat(mergedProps.horizontal ? 'horizontalCard' : '', "\n ").concat(mergedProps.responsiveMedium ? 'responsiveMedium' : '', "\n ").concat(mergedProps.responsiveSmall ? 'responsiveSmall' : '', "\n ").concat(mergedProps.pattern !== 'none' ? "pattern-".concat(mergedProps.pattern) : '', "\n ").concat(mergedProps.hoverEffect !== 'none' ? "hover-".concat(mergedProps.hoverEffect) : '', "\n ").concat(themeVariant === "standard" ? "border" : "", "\n "), style: __assign({ width: "".concat(mergedProps.width || ''), height: "".concat(mergedProps.height || ''), minHeight: "".concat(mergedProps.minHeight || ''), minWidth: "".concat(mergedProps.minWidth || ''), maxHeight: mergedProps.maxHeight || '', maxWidth: mergedProps.maxWidth || '', margin: "".concat(mergedProps.margin || ''), padding: "".concat(mergedProps.padding || ''), background: mergedProps.gradient, opacity: mergedProps.opacity, border: mergedProps.border, position: 'relative', overflow: 'hidden' }, mergedProps.style) }, rest),
|
|
181
|
+
mergedProps.pattern !== 'none' && (react_1.default.createElement("div", { className: "card-pattern-overlay", style: {
|
|
182
|
+
position: 'absolute',
|
|
183
|
+
top: 0,
|
|
184
|
+
left: 0,
|
|
185
|
+
right: 0,
|
|
186
|
+
bottom: 0,
|
|
187
|
+
pointerEvents: 'none',
|
|
188
|
+
opacity: mergedProps.patternOpacity,
|
|
189
|
+
mixBlendMode: 'multiply',
|
|
190
|
+
backgroundImage: mergedProps.pattern === 'grid' ?
|
|
191
|
+
"linear-gradient(to right, rgba(var(--borderRgb), 1) 1px, transparent 1px),\n linear-gradient(to bottom, rgba(var(--borderRgb), 1) 1px, transparent 1px)" :
|
|
192
|
+
mergedProps.pattern === 'dots' ?
|
|
193
|
+
"radial-gradient(rgba(var(--borderRgb), 1) 1px, transparent 1px)" :
|
|
194
|
+
mergedProps.pattern === 'diagonal' ?
|
|
195
|
+
"repeating-linear-gradient(45deg, rgba(var(--borderRgb), 1), rgba(var(--borderRgb), 1) 1px, transparent 1px, transparent 10px)" :
|
|
196
|
+
mergedProps.pattern === 'checkerboard' ?
|
|
197
|
+
"linear-gradient(45deg, rgba(var(--borderRgb), 1) 25%, transparent 25%), \n linear-gradient(-45deg, rgba(var(--borderRgb), 1) 25%, transparent 25%), \n linear-gradient(45deg, transparent 75%, rgba(var(--borderRgb), 1) 75%), \n linear-gradient(-45deg, transparent 75%, rgba(var(--borderRgb), 1) 75%)" :
|
|
198
|
+
mergedProps.pattern === 'horizontal' ?
|
|
199
|
+
"linear-gradient(to bottom, rgba(var(--borderRgb), 1) 1px, transparent 1px)" :
|
|
200
|
+
mergedProps.pattern === 'vertical' ?
|
|
201
|
+
"linear-gradient(to right, rgba(var(--borderRgb), 1) 1px, transparent 1px)" : 'none',
|
|
202
|
+
backgroundSize: mergedProps.pattern === 'grid' ? '20px 20px' :
|
|
203
|
+
mergedProps.pattern === 'dots' ? '10px 10px' :
|
|
204
|
+
mergedProps.pattern === 'diagonal' ? '20px 20px' :
|
|
205
|
+
mergedProps.pattern === 'checkerboard' ? '20px 20px' :
|
|
206
|
+
mergedProps.pattern === 'horizontal' ? '100% 10px' :
|
|
207
|
+
mergedProps.pattern === 'vertical' ? '10px 100%' : 'auto'
|
|
208
|
+
} })),
|
|
209
|
+
hasImageContent ? (ImageContent) : (mergedProps.image ? react_1.default.createElement("div", { className: "".concat(mergedProps.fab ? 'relative' : '') },
|
|
210
|
+
mergedProps.image,
|
|
41
211
|
" ",
|
|
42
|
-
fab ? fab : '') : '',
|
|
43
|
-
header && !horizontal ? react_1.default.createElement(CardHeader_1.default,
|
|
44
|
-
body ?
|
|
212
|
+
mergedProps.fab ? mergedProps.fab : '') : ''),
|
|
213
|
+
hasEnhancedContent ? (react_1.default.createElement(CardHeader_1.default, { style: mergedProps.headerStyle, className: mergedProps.headerClass }, EnhancedTextContent)) : (mergedProps.header && !mergedProps.horizontal ? (react_1.default.createElement(CardHeader_1.default, { style: mergedProps.headerStyle, className: mergedProps.headerClass }, renderContent(mergedProps.header))) : ''),
|
|
214
|
+
mergedProps.body ?
|
|
45
215
|
react_1.default.createElement("div", null,
|
|
46
|
-
horizontal ? react_1.default.createElement(CardHeader_1.default,
|
|
47
|
-
react_1.default.createElement(CardBody_1.default,
|
|
48
|
-
|
|
49
|
-
body,
|
|
50
|
-
" "),
|
|
51
|
-
horizontal ? react_1.default.createElement(CardFooter_1.default, null, footer) : '')
|
|
216
|
+
mergedProps.horizontal && !hasEnhancedContent ? (react_1.default.createElement(CardHeader_1.default, { style: mergedProps.headerStyle, className: mergedProps.headerClass }, renderContent(mergedProps.header))) : '',
|
|
217
|
+
react_1.default.createElement(CardBody_1.default, { style: mergedProps.bodyStyle, className: mergedProps.bodyClass }, hasEnhancedContent ? EnhancedTextContent : renderContent(mergedProps.body)),
|
|
218
|
+
mergedProps.horizontal && !hasEnhancedFooter ? (react_1.default.createElement(CardFooter_1.default, { style: mergedProps.footerStyle, className: mergedProps.footerClass }, renderContent(mergedProps.footer))) : '')
|
|
52
219
|
: '',
|
|
53
|
-
children && react_1.default.createElement(CardBody_1.default,
|
|
54
|
-
|
|
220
|
+
mergedProps.children && (react_1.default.createElement(CardBody_1.default, { style: mergedProps.bodyStyle, className: mergedProps.bodyClass }, renderContent(mergedProps.children))),
|
|
221
|
+
hasEnhancedFooter ? (react_1.default.createElement(CardFooter_1.default, { style: mergedProps.footerStyle, className: mergedProps.footerClass },
|
|
222
|
+
react_1.default.createElement(CTAButtons, null))) : (mergedProps.footer && !mergedProps.horizontal ? (react_1.default.createElement(CardFooter_1.default, { style: mergedProps.footerStyle, className: mergedProps.footerClass }, renderContent(mergedProps.footer))) : '')));
|
|
55
223
|
}
|