funuicss 3.8.8 → 3.8.9

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.
@@ -99,75 +99,170 @@ function Button(_a) {
99
99
  stringPrefix: stringPrefix !== null && stringPrefix !== void 0 ? stringPrefix : mergedProps.stringPrefix,
100
100
  stringSuffix: stringSuffix !== null && stringSuffix !== void 0 ? stringSuffix : mergedProps.stringSuffix,
101
101
  };
102
- var _g = (0, react_1.useState)(null), prefixNode = _g[0], setPrefixNode = _g[1];
103
- var _h = (0, react_1.useState)(null), suffixNode = _h[0], setSuffixNode = _h[1];
104
- var _j = (0, react_1.useState)(false), hasValidStringPrefix = _j[0], setHasValidStringPrefix = _j[1];
105
- var _k = (0, react_1.useState)(false), hasValidStringSuffix = _k[0], setHasValidStringSuffix = _k[1];
106
- function isReactElement(node) {
107
- return react_1.default.isValidElement(node);
108
- }
109
- // Handle stringPrefix - only load if we have a valid string
102
+ // State for dynamic icons
103
+ var _g = (0, react_1.useState)(null), dynamicStartIcon = _g[0], setDynamicStartIcon = _g[1];
104
+ var _h = (0, react_1.useState)(null), dynamicEndIcon = _h[0], setDynamicEndIcon = _h[1];
105
+ var _j = (0, react_1.useState)(null), dynamicPrefix = _j[0], setDynamicPrefix = _j[1];
106
+ var _k = (0, react_1.useState)(null), dynamicSuffix = _k[0], setDynamicSuffix = _k[1];
107
+ var _l = (0, react_1.useState)(null), dynamicStringPrefix = _l[0], setDynamicStringPrefix = _l[1];
108
+ var _m = (0, react_1.useState)(null), dynamicStringSuffix = _m[0], setDynamicStringSuffix = _m[1];
109
+ // Function to check if a value is a string (dynamic icon)
110
+ var isStringIcon = function (icon) {
111
+ return typeof icon === 'string' && icon.trim() !== '';
112
+ };
113
+ // Function to check if a value is a ReactNode (static icon)
114
+ var isReactNodeIcon = function (icon) {
115
+ return icon !== undefined && !isStringIcon(icon) && react_1.default.isValidElement(icon);
116
+ };
117
+ // Load dynamic icons from string props
110
118
  (0, react_1.useEffect)(function () {
111
- var effectiveStringPrefix = final.stringPrefix;
112
- if (!effectiveStringPrefix || effectiveStringPrefix.trim() === '') {
113
- setPrefixNode(null);
114
- setHasValidStringPrefix(false);
115
- return;
116
- }
117
- (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringPrefix).then(function (node) {
118
- if (node) {
119
- setPrefixNode(node);
120
- setHasValidStringPrefix(true);
121
- }
122
- else {
123
- setPrefixNode(null);
124
- setHasValidStringPrefix(false);
125
- }
126
- });
127
- }, [final.stringPrefix]);
128
- // Handle stringSuffix - only load if we have a valid string
119
+ // Handle startIcon if it's a string
120
+ if (isStringIcon(startIcon)) {
121
+ (0, getDynamicIcon_1.getDynamicIcon)(startIcon).then(function (node) {
122
+ if (node) {
123
+ setDynamicStartIcon(node);
124
+ }
125
+ else {
126
+ setDynamicStartIcon(null);
127
+ }
128
+ });
129
+ }
130
+ else {
131
+ setDynamicStartIcon(null);
132
+ }
133
+ // Handle endIcon if it's a string
134
+ if (isStringIcon(endIcon)) {
135
+ (0, getDynamicIcon_1.getDynamicIcon)(endIcon).then(function (node) {
136
+ if (node) {
137
+ setDynamicEndIcon(node);
138
+ }
139
+ else {
140
+ setDynamicEndIcon(null);
141
+ }
142
+ });
143
+ }
144
+ else {
145
+ setDynamicEndIcon(null);
146
+ }
147
+ // Handle prefix if it's a string
148
+ if (isStringIcon(prefix)) {
149
+ (0, getDynamicIcon_1.getDynamicIcon)(prefix).then(function (node) {
150
+ if (node) {
151
+ setDynamicPrefix(node);
152
+ }
153
+ else {
154
+ setDynamicPrefix(null);
155
+ }
156
+ });
157
+ }
158
+ else {
159
+ setDynamicPrefix(null);
160
+ }
161
+ // Handle suffix if it's a string
162
+ if (isStringIcon(suffix)) {
163
+ (0, getDynamicIcon_1.getDynamicIcon)(suffix).then(function (node) {
164
+ if (node) {
165
+ setDynamicSuffix(node);
166
+ }
167
+ else {
168
+ setDynamicSuffix(null);
169
+ }
170
+ });
171
+ }
172
+ else {
173
+ setDynamicSuffix(null);
174
+ }
175
+ }, [startIcon, endIcon, prefix, suffix]);
176
+ // Load dynamic icons from stringPrefix and stringSuffix (backward compatibility)
129
177
  (0, react_1.useEffect)(function () {
130
- var effectiveStringSuffix = final.stringSuffix;
131
- if (!effectiveStringSuffix || effectiveStringSuffix.trim() === '') {
132
- setSuffixNode(null);
133
- setHasValidStringSuffix(false);
134
- return;
135
- }
136
- (0, getDynamicIcon_1.getDynamicIcon)(effectiveStringSuffix).then(function (node) {
137
- if (node) {
138
- setSuffixNode(node);
139
- setHasValidStringSuffix(true);
140
- }
141
- else {
142
- setSuffixNode(null);
143
- setHasValidStringSuffix(false);
178
+ if (final.stringPrefix && final.stringPrefix.trim() !== '') {
179
+ (0, getDynamicIcon_1.getDynamicIcon)(final.stringPrefix).then(function (node) {
180
+ if (node) {
181
+ setDynamicStringPrefix(node);
182
+ }
183
+ else {
184
+ setDynamicStringPrefix(null);
185
+ }
186
+ });
187
+ }
188
+ else {
189
+ setDynamicStringPrefix(null);
190
+ }
191
+ if (final.stringSuffix && final.stringSuffix.trim() !== '') {
192
+ (0, getDynamicIcon_1.getDynamicIcon)(final.stringSuffix).then(function (node) {
193
+ if (node) {
194
+ setDynamicStringSuffix(node);
195
+ }
196
+ else {
197
+ setDynamicStringSuffix(null);
198
+ }
199
+ });
200
+ }
201
+ else {
202
+ setDynamicStringSuffix(null);
203
+ }
204
+ }, [final.stringPrefix, final.stringSuffix]);
205
+ // Determine which start icon to show with proper priority
206
+ var actualStartIcon = (0, react_1.useMemo)(function () {
207
+ if (final.status) {
208
+ // Status icons have highest priority for start position
209
+ switch (final.status) {
210
+ case 'success':
211
+ return react_1.default.createElement(pi_1.PiCheck, { size: iconSize });
212
+ case 'info':
213
+ return react_1.default.createElement(pi_1.PiInfo, { size: iconSize });
214
+ case 'warning':
215
+ return react_1.default.createElement(pi_1.PiWarning, { size: iconSize });
216
+ case 'error':
217
+ return react_1.default.createElement(pi_1.PiX, { size: iconSize });
218
+ default:
219
+ return null;
144
220
  }
145
- });
146
- }, [final.stringSuffix]);
147
- // Determine which prefix to show with proper priority
148
- var showPrefix = react_1.default.useMemo(function () {
149
- // Priority order: status > startIcon (local) > prefix (local) > stringPrefix (dynamic)
150
- if (final.status)
151
- return true;
152
- if (startIcon)
153
- return true;
154
- if (prefix)
155
- return true;
156
- if (hasValidStringPrefix && prefixNode)
157
- return true;
158
- return false;
159
- }, [final.status, startIcon, prefix, hasValidStringPrefix, prefixNode]);
160
- // Determine which suffix to show with proper priority
161
- var showSuffix = react_1.default.useMemo(function () {
162
- // Priority order: endIcon (local) > suffix (local) > stringSuffix (dynamic)
163
- if (endIcon)
164
- return true;
165
- if (suffix)
166
- return true;
167
- if (hasValidStringSuffix && suffixNode)
168
- return true;
169
- return false;
170
- }, [endIcon, suffix, hasValidStringSuffix, suffixNode]);
221
+ }
222
+ if (isStringIcon(startIcon)) {
223
+ return dynamicStartIcon;
224
+ }
225
+ if (isReactNodeIcon(startIcon)) {
226
+ return startIcon;
227
+ }
228
+ if (isStringIcon(prefix)) {
229
+ return dynamicPrefix;
230
+ }
231
+ if (isReactNodeIcon(prefix)) {
232
+ return prefix;
233
+ }
234
+ if (dynamicStringPrefix) {
235
+ return dynamicStringPrefix;
236
+ }
237
+ return null;
238
+ }, [
239
+ final.status,
240
+ startIcon,
241
+ prefix,
242
+ dynamicStartIcon,
243
+ dynamicPrefix,
244
+ dynamicStringPrefix,
245
+ iconSize,
246
+ ]);
247
+ // Determine which end icon to show with proper priority
248
+ var actualEndIcon = (0, react_1.useMemo)(function () {
249
+ if (isStringIcon(endIcon)) {
250
+ return dynamicEndIcon;
251
+ }
252
+ if (isReactNodeIcon(endIcon)) {
253
+ return endIcon;
254
+ }
255
+ if (isStringIcon(suffix)) {
256
+ return dynamicSuffix;
257
+ }
258
+ if (isReactNodeIcon(suffix)) {
259
+ return suffix;
260
+ }
261
+ if (dynamicStringSuffix) {
262
+ return dynamicStringSuffix;
263
+ }
264
+ return null;
265
+ }, [endIcon, suffix, dynamicEndIcon, dynamicSuffix, dynamicStringSuffix]);
171
266
  var textColorClass = final.bg
172
267
  ? final.color
173
268
  ? final.color
@@ -208,27 +303,37 @@ function Button(_a) {
208
303
  };
209
304
  // Helper function to render icon with proper size
210
305
  var renderIcon = function (icon, className) {
306
+ var _a;
211
307
  if (className === void 0) { className = ''; }
212
308
  if (!icon)
213
309
  return null;
214
- return (react_1.default.createElement("span", { className: className, style: iconWrapperStyle }, isReactElement(icon) ? react_1.default.cloneElement(icon, { size: iconSize }) : icon));
310
+ // If it's a React element that we know accepts size prop
311
+ if (react_1.default.isValidElement(icon)) {
312
+ // Create a wrapper span and clone the icon with size prop if needed
313
+ var iconProps = {};
314
+ // Only add size prop if iconSize is provided and not already set
315
+ if (iconSize && !((_a = icon.props) === null || _a === void 0 ? void 0 : _a.size)) {
316
+ iconProps.size = iconSize;
317
+ }
318
+ // Only clone with props if we have props to add
319
+ if (Object.keys(iconProps).length > 0) {
320
+ return (react_1.default.createElement("span", { className: className, style: iconWrapperStyle }, react_1.default.cloneElement(icon, iconProps)));
321
+ }
322
+ else {
323
+ // Otherwise just render the icon in a span
324
+ return (react_1.default.createElement("span", { className: className, style: iconWrapperStyle }, icon));
325
+ }
326
+ }
327
+ // If it's not a valid React element, just render it as is
328
+ return (react_1.default.createElement("span", { className: className, style: iconWrapperStyle }, icon));
215
329
  };
330
+ // Determine if we should show icons on left or right
331
+ var hasStartIcon = Boolean(actualStartIcon);
332
+ var hasEndIcon = Boolean(actualEndIcon);
216
333
  return (react_1.default.createElement("span", null,
217
- react_1.default.createElement("button", __assign({ type: final.type || 'button', disabled: disabled || final.isLoading || false, className: "".concat(classNames, " ").concat((showPrefix || showSuffix || final.isLoading) ? 'iconic' : ''), style: __assign({ height: (_b = height !== null && height !== void 0 ? height : mergedProps.height) !== null && _b !== void 0 ? _b : '', width: final.fullWidth ? '100%' : (_c = width !== null && width !== void 0 ? width : mergedProps.width) !== null && _c !== void 0 ? _c : '', borderRadius: final.flat ? '0rem' : '' }, style), onClick: onClick || (url ? function () { return (window.location.href = url); } : undefined) }, mergedProps),
218
- final.isLoading ? (renderIcon(react_1.default.createElement(pi_1.PiSpinner, { className: "rotate" }), 'btn_left_icon')) : (react_1.default.createElement(react_1.default.Fragment, null,
219
- final.status && (react_1.default.createElement("span", { className: "btn_left_icon", style: iconWrapperStyle },
220
- final.status === 'success' && react_1.default.createElement(pi_1.PiCheck, { size: iconSize }),
221
- final.status === 'info' && react_1.default.createElement(pi_1.PiInfo, { size: iconSize }),
222
- final.status === 'warning' && react_1.default.createElement(pi_1.PiWarning, { size: iconSize }),
223
- final.status === 'error' && react_1.default.createElement(pi_1.PiX, { size: iconSize }))),
224
- !final.status && showPrefix && (react_1.default.createElement(react_1.default.Fragment, null,
225
- startIcon && renderIcon(startIcon, 'btn_left_icon'),
226
- !startIcon && prefix && renderIcon(prefix, 'btn_left_icon'),
227
- !startIcon && !prefix && hasValidStringPrefix && renderIcon(prefixNode, 'btn_left_icon'))))),
334
+ react_1.default.createElement("button", __assign({ type: final.type || 'button', disabled: disabled || final.isLoading || false, className: "".concat(classNames, " ").concat((hasStartIcon || hasEndIcon || final.isLoading) ? 'iconic' : ''), style: __assign({ height: (_b = height !== null && height !== void 0 ? height : mergedProps.height) !== null && _b !== void 0 ? _b : '', width: final.fullWidth ? '100%' : (_c = width !== null && width !== void 0 ? width : mergedProps.width) !== null && _c !== void 0 ? _c : '', borderRadius: final.flat ? '0rem' : '' }, style), onClick: onClick || (url ? function () { return (window.location.href = url); } : undefined) }, mergedProps),
335
+ final.isLoading ? (renderIcon(react_1.default.createElement(pi_1.PiSpinner, { className: "rotate" }), 'btn_left_icon')) : (react_1.default.createElement(react_1.default.Fragment, null, hasStartIcon && renderIcon(actualStartIcon, 'btn_left_icon'))),
228
336
  final.fillAnimation && react_1.default.createElement("span", { className: "button_fill_span ".concat(effectiveBg) }),
229
337
  children ? children : final.text ? final.text : "",
230
- showSuffix && (react_1.default.createElement(react_1.default.Fragment, null,
231
- endIcon && renderIcon(endIcon, 'btn_right_icon'),
232
- !endIcon && suffix && renderIcon(suffix, 'btn_right_icon'),
233
- !endIcon && !suffix && hasValidStringSuffix && renderIcon(suffixNode, 'btn_right_icon'))))));
338
+ hasEndIcon && !final.isLoading && renderIcon(actualEndIcon, 'btn_right_icon'))));
234
339
  }
@@ -9,13 +9,11 @@ type FeatureItem = {
9
9
  titleWeight?: number;
10
10
  titleColor?: string;
11
11
  titleClassName?: string;
12
- titleVariant?: string;
13
12
  description?: React.ReactNode;
14
13
  descriptionSize?: string;
15
14
  descriptionWeight?: number;
16
15
  descriptionColor?: string;
17
16
  descriptionClassName?: string;
18
- descriptionVariant?: string;
19
17
  imageUrl?: string;
20
18
  imageAlt?: string;
21
19
  imageClassName?: string;
@@ -23,18 +21,9 @@ type FeatureItem = {
23
21
  content?: React.ReactNode;
24
22
  className?: string;
25
23
  style?: React.CSSProperties;
26
- cardBg?: string;
27
- cardPadding?: string;
28
- cardRounded?: string;
29
- cardShadow?: 'sm' | 'md' | 'lg' | 'xl' | 'none';
30
- cardBorder?: boolean;
31
- cardBorderColor?: string;
32
- cardHoverEffect?: 'lift' | 'glow' | 'scale' | 'none';
33
24
  ctaText?: string;
34
25
  ctaUrl?: string;
35
- ctaVariant?: 'primary' | 'secondary' | 'accent' | 'text' | 'outline';
36
26
  ctaOnClick?: () => void;
37
- ctaCss?: string;
38
27
  ctaClassName?: string;
39
28
  customRender?: () => React.ReactNode;
40
29
  };
@@ -47,33 +36,23 @@ type FeatureProps = {
47
36
  titleColor?: string;
48
37
  titleClassName?: string;
49
38
  titleAlign?: 'left' | 'center' | 'right';
50
- titleVariant?: string;
51
39
  subtitle?: React.ReactNode;
52
40
  subtitleSize?: string;
53
41
  subtitleWeight?: number;
54
42
  subtitleColor?: string;
55
43
  subtitleClassName?: string;
56
- subtitleVariant?: string;
57
44
  description?: React.ReactNode;
58
45
  descriptionSize?: string;
59
46
  descriptionWeight?: number;
60
47
  descriptionColor?: string;
61
48
  descriptionClassName?: string;
62
- descriptionVariant?: string;
63
49
  features?: FeatureItem[] | string;
64
- columns?: number;
65
- gap?: string;
66
- itemGap?: string;
50
+ gap?: number;
51
+ itemMaxWidth?: string;
67
52
  align?: 'start' | 'center' | 'end' | 'stretch';
68
53
  justify?: 'start' | 'center' | 'end' | 'between' | 'around';
69
54
  wrap?: boolean;
70
- bg?: string;
71
- padding?: string;
72
- className?: string;
73
- style?: React.CSSProperties;
74
- containerClassName?: string;
75
- containerStyle?: React.CSSProperties;
76
- cardBg?: string;
55
+ card?: boolean;
77
56
  cardPadding?: string;
78
57
  cardRounded?: string;
79
58
  cardShadow?: 'sm' | 'md' | 'lg' | 'xl' | 'none';
@@ -81,27 +60,28 @@ type FeatureProps = {
81
60
  cardBorderColor?: string;
82
61
  cardHoverEffect?: 'lift' | 'glow' | 'scale' | 'none';
83
62
  cardClassName?: string;
63
+ padding?: string;
64
+ className?: string;
65
+ style?: React.CSSProperties;
66
+ containerClassName?: string;
67
+ containerStyle?: React.CSSProperties;
84
68
  iconColor?: string;
85
69
  iconSize?: number;
86
70
  iconClassName?: string;
87
71
  itemTitleSize?: string;
88
72
  itemTitleWeight?: number;
89
73
  itemTitleColor?: string;
90
- itemTitleVariant?: string;
91
74
  itemDescriptionSize?: string;
92
75
  itemDescriptionWeight?: number;
93
76
  itemDescriptionColor?: string;
94
- itemDescriptionVariant?: string;
95
77
  checkmarkIcon?: string;
96
78
  checkmarkColor?: string;
97
79
  checkmarkSize?: number;
98
80
  checkmarkClassName?: string;
99
81
  ctaText?: string;
100
82
  ctaUrl?: string;
101
- ctaVariant?: 'primary' | 'secondary' | 'accent' | 'text' | 'outline';
102
83
  ctaOnClick?: () => void;
103
84
  ctaClassName?: string;
104
- ctaCss?: string;
105
85
  ctaAlign?: 'left' | 'center' | 'right';
106
86
  ctaStringPrefix?: string;
107
87
  ctaStringSuffix?: string;
@@ -110,21 +90,12 @@ type FeatureProps = {
110
90
  ctaIconSize?: number;
111
91
  ctaIsLoading?: boolean;
112
92
  ctaStatus?: 'success' | 'warning' | 'info' | 'error';
113
- pattern?: 'grid' | 'dots' | 'diagonal' | 'none';
114
- patternOpacity?: number;
115
- patternColor?: string;
116
- patternSize?: string;
117
- fade?: boolean;
118
- fadeColor?: string;
119
- fadeDirection?: 'top' | 'bottom' | 'left' | 'right';
120
- fadeRadial?: boolean;
121
- hoverEffect?: 'lift' | 'glow' | 'scale' | 'none';
93
+ ctaBg?: string;
122
94
  children?: React.ReactNode;
123
95
  id?: string;
124
96
  funcss?: string;
125
97
  sectionClass?: string;
126
98
  maxWidth?: string;
127
- responsiveColumns?: string;
128
99
  };
129
100
  declare const Feature: React.FC<FeatureProps>;
130
101
  export default Feature;