funuicss 3.8.7 → 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.
@@ -121,12 +121,25 @@ var FeatureIcon = function (_a) {
121
121
  }
122
122
  return null;
123
123
  };
124
+ // Helper function to convert shorthand flex values to proper CSS values
125
+ var convertFlexValue = function (value) {
126
+ if (!value)
127
+ return undefined;
128
+ var flexMap = {
129
+ 'start': 'flex-start',
130
+ 'end': 'flex-end',
131
+ 'center': 'center',
132
+ 'between': 'space-between',
133
+ 'around': 'space-around',
134
+ 'stretch': 'stretch',
135
+ };
136
+ return flexMap[value] || value;
137
+ };
124
138
  var Feature = function (localProps) {
125
139
  var mergeWithLocal = (0, componentUtils_1.useComponentConfiguration)('Feature', localProps.variant).mergeWithLocal;
126
140
  var mergedProps = mergeWithLocal(localProps).props;
127
141
  var final = mergedProps;
128
142
  var _a = (0, react_1.useState)([]), featuresArray = _a[0], setFeaturesArray = _a[1];
129
- var _b = (0, react_1.useState)({}), responsiveColumns = _b[0], setResponsiveColumns = _b[1];
130
143
  // Parse features
131
144
  (0, react_1.useEffect)(function () {
132
145
  if (typeof final.features === 'string') {
@@ -146,21 +159,6 @@ var Feature = function (localProps) {
146
159
  setFeaturesArray([]);
147
160
  }
148
161
  }, [final.features]);
149
- // Parse responsive columns
150
- (0, react_1.useEffect)(function () {
151
- if (final.responsiveColumns) {
152
- try {
153
- var parsed = JSON.parse(final.responsiveColumns);
154
- if (parsed && typeof parsed === 'object') {
155
- setResponsiveColumns(parsed);
156
- }
157
- }
158
- catch (error) {
159
- console.error('Error parsing responsive columns:', error);
160
- setResponsiveColumns({});
161
- }
162
- }
163
- }, [final.responsiveColumns]);
164
162
  var getSpacingValue = function (value, defaultValue) {
165
163
  if (defaultValue === void 0) { defaultValue = '0'; }
166
164
  if (!value)
@@ -170,33 +168,20 @@ var Feature = function (localProps) {
170
168
  }
171
169
  return value;
172
170
  };
173
- var getButtonVariantClass = function (variant) {
174
- if (!variant)
175
- return '';
176
- var variantClasses = {
177
- 'primary': 'btn-primary',
178
- 'secondary': 'btn-secondary',
179
- 'accent': 'btn-accent',
180
- 'text': 'btn-text',
181
- 'outline': 'btn-outline',
182
- };
183
- return variantClasses[variant] || "btn-".concat(variant);
184
- };
185
171
  var renderItemCTA = function (item) {
186
172
  if (!item.ctaText)
187
173
  return null;
188
- var ctaVariant = item.ctaVariant || 'text';
189
- var ctaClassName = item.ctaClassName || '';
190
- var ctaCss = item.ctaCss || '';
191
- var buttonClass = getButtonVariantClass(ctaVariant);
192
- return (react_1.default.createElement("a", { href: item.ctaUrl, onClick: item.ctaOnClick, className: "btn ".concat(buttonClass, " ").concat(ctaClassName, " ").concat(ctaCss, " feature-section__item-cta text-sm"), style: {
174
+ return (react_1.default.createElement("a", { href: item.ctaUrl, onClick: item.ctaOnClick, className: "feature-section__item-cta ".concat(item.ctaClassName || ''), style: {
193
175
  marginTop: '1rem',
194
176
  display: 'inline-block',
195
177
  textDecoration: 'none',
178
+ color: 'var(--primary)',
179
+ fontWeight: 500,
180
+ fontSize: '0.875rem',
196
181
  } }, item.ctaText));
197
182
  };
198
183
  var renderFeatureItem = function (item, index) {
199
- var _a, _b;
184
+ var _a;
200
185
  if (item.customRender) {
201
186
  return item.customRender();
202
187
  }
@@ -207,138 +192,64 @@ var Feature = function (localProps) {
207
192
  var checkmarkColor = final.checkmarkColor || 'success';
208
193
  var checkmarkSize = final.checkmarkSize || 20;
209
194
  var checkmarkClassName = final.checkmarkClassName || '';
210
- var cardBg = item.cardBg || final.cardBg;
211
- var cardPadding = item.cardPadding || final.cardPadding || '1.5rem';
212
- var cardRounded = item.cardRounded || final.cardRounded || '0.5rem';
213
- var cardShadow = item.cardShadow || final.cardShadow || 'md';
214
- var cardBorder = (_b = (_a = item.cardBorder) !== null && _a !== void 0 ? _a : final.cardBorder) !== null && _b !== void 0 ? _b : true;
215
- var cardBorderColor = item.cardBorderColor || final.cardBorderColor || 'var(--borderRgb)';
216
- var cardHoverEffect = item.cardHoverEffect || final.cardHoverEffect || 'none';
195
+ var cardPadding = final.cardPadding || '1.5rem';
196
+ var cardRounded = final.cardRounded || '0.5rem';
197
+ var cardShadow = final.cardShadow || 'md';
198
+ var cardBorder = (_a = final.cardBorder) !== null && _a !== void 0 ? _a : true;
199
+ var cardBorderColor = final.cardBorderColor || 'var(--borderRgb)';
200
+ var cardHoverEffect = final.cardHoverEffect || 'none';
217
201
  var titleSize = item.titleSize || final.itemTitleSize || '1.125rem';
218
202
  var titleWeight = item.titleWeight || final.itemTitleWeight || 600;
219
203
  var titleColor = item.titleColor || final.itemTitleColor || 'var(--text-color)';
220
204
  var titleClassName = item.titleClassName || '';
221
- var titleVariant = item.titleVariant || final.itemTitleVariant; // Updated
222
205
  var descriptionSize = item.descriptionSize || final.itemDescriptionSize || '0.875rem';
223
206
  var descriptionWeight = item.descriptionWeight || final.itemDescriptionWeight || 400;
224
207
  var descriptionColor = item.descriptionColor || final.itemDescriptionColor || 'var(--text-muted)';
225
208
  var descriptionClassName = item.descriptionClassName || '';
226
- var descriptionVariant = item.descriptionVariant || final.itemDescriptionVariant; // Updated
227
- var isGridLayout = final.layout === 'grid';
228
209
  var featureContent = (react_1.default.createElement("div", { className: "feature-section__item ".concat(item.className || ''), style: item.style },
229
- (item.icon || item.imageUrl || final.layout === 'checklist') && (react_1.default.createElement("div", { className: "feature-section__icon-container", style: { marginBottom: '1rem' } }, item.imageUrl ? (react_1.default.createElement("img", { src: item.imageUrl, alt: item.imageAlt || '', className: "feature-section__image ".concat(item.imageClassName || final.imageClassName || ''), style: __assign(__assign({ width: "".concat(iconSize, "px"), height: "".concat(iconSize, "px"), objectFit: 'cover', borderRadius: '50%' }, item.imageStyle), final.imageStyle) })) : (react_1.default.createElement("div", { className: "feature-section__icon-wrapper" },
210
+ (item.icon || item.imageUrl || final.layout === 'checklist') && (react_1.default.createElement("div", { className: "feature-section__icon-container", style: { marginBottom: '1rem' } }, item.imageUrl ? (react_1.default.createElement("img", { src: item.imageUrl, alt: item.imageAlt || '', className: "feature-section__image ".concat(item.imageClassName || ''), style: __assign({ width: "".concat(iconSize, "px"), height: "".concat(iconSize, "px"), objectFit: 'cover', borderRadius: '50%' }, item.imageStyle) })) : (react_1.default.createElement("div", { className: "feature-section__icon-wrapper" },
230
211
  react_1.default.createElement(FeatureIcon, { icon: item.icon, iconColor: iconColor, iconSize: iconSize, iconClassName: iconClassName, layout: final.layout, checklistIcon: checkmarkIcon, checklistColor: checkmarkColor, checklistSize: checkmarkSize, checklistClassName: checkmarkClassName }))))),
231
- item.title && (react_1.default.createElement(Text_1.default, { variant: titleVariant, block: true, size: titleSize, weight: titleWeight, color: titleColor, funcss: "feature-section__title ".concat(titleClassName), style: { marginBottom: '0.75rem' } }, item.title)),
232
- item.description && (react_1.default.createElement(Text_1.default, { variant: descriptionVariant, block: true, size: descriptionSize, weight: descriptionWeight, color: descriptionColor, funcss: "feature-section__description ".concat(descriptionClassName) }, item.description)),
212
+ item.title && (react_1.default.createElement(Text_1.default, { block: true, size: titleSize, weight: titleWeight, color: titleColor, funcss: "feature-section__title ".concat(titleClassName), style: { marginBottom: '0.75rem' } }, item.title)),
213
+ item.description && (react_1.default.createElement(Text_1.default, { block: true, size: descriptionSize, weight: descriptionWeight, color: descriptionColor, funcss: "feature-section__description ".concat(descriptionClassName) }, item.description)),
233
214
  item.content && (react_1.default.createElement("div", { className: "feature-section__additional-content", style: { marginTop: '1rem' } }, item.content)),
234
215
  renderItemCTA(item)));
235
- // For grid layout with cards
236
- if (isGridLayout && cardBg) {
216
+ // Apply card styling if card prop is true
217
+ if (final.card) {
237
218
  var cardClasses = [
238
219
  'feature-section__card',
239
- cardHoverEffect !== 'none' ? "feature-section__card--hover-".concat(cardHoverEffect) : '',
220
+ 'card',
221
+ cardHoverEffect !== 'none' ? "card--hover-".concat(cardHoverEffect) : '',
240
222
  item.className || '',
223
+ final.cardClassName || '',
241
224
  ].filter(Boolean).join(' ');
242
- var cardStyles = __assign({ padding: getSpacingValue(cardPadding, '1.5rem'), borderRadius: cardRounded, backgroundColor: cardBg ? (0, getCssVariable_1.getCssVariableValue)(cardBg) || cardBg : undefined, boxShadow: cardShadow !== 'none' ? (0, getCssVariable_1.getCssVariableValue)("shadow-".concat(cardShadow)) || undefined : undefined, border: cardBorder ? "1px solid ".concat((0, getCssVariable_1.getCssVariableValue)(cardBorderColor) || cardBorderColor) : 'none', height: '100%' }, item.style);
225
+ var cardStyles = __assign({ padding: getSpacingValue(cardPadding, '1.5rem'), borderRadius: cardRounded, boxShadow: cardShadow !== 'none' ? (0, getCssVariable_1.getCssVariableValue)("shadow-".concat(cardShadow)) || undefined : undefined, border: cardBorder ? "1px solid ".concat((0, getCssVariable_1.getCssVariableValue)(cardBorderColor) || cardBorderColor) : 'none', height: '100%', maxWidth: final.itemMaxWidth || '100%' }, item.style);
243
226
  return (react_1.default.createElement("div", { key: index, className: cardClasses, style: cardStyles }, featureContent));
244
227
  }
245
- return featureContent;
246
- };
247
- var getResponsiveGridColumns = function () {
248
- var defaultColumns = final.columns || 3;
249
- if (Object.keys(responsiveColumns).length === 0) {
250
- return "repeat(".concat(defaultColumns, ", 1fr)");
251
- }
252
- return {
253
- base: "repeat(".concat(responsiveColumns.sm || defaultColumns, ", 1fr)"),
254
- sm: "repeat(".concat(responsiveColumns.sm || defaultColumns, ", 1fr)"),
255
- md: "repeat(".concat(responsiveColumns.md || responsiveColumns.sm || defaultColumns, ", 1fr)"),
256
- lg: "repeat(".concat(responsiveColumns.lg || responsiveColumns.md || responsiveColumns.sm || defaultColumns, ", 1fr)"),
257
- xl: "repeat(".concat(responsiveColumns.xl || responsiveColumns.lg || responsiveColumns.md || responsiveColumns.sm || defaultColumns, ", 1fr)"),
258
- };
259
- };
260
- var getGridStyles = function () {
261
- var gap = getSpacingValue(final.gap, '2rem');
262
- var itemGap = getSpacingValue(final.itemGap, '1rem');
263
- var baseStyle = {
264
- display: 'grid',
265
- gap: gap,
266
- alignItems: final.align || 'stretch',
267
- justifyContent: final.justify || 'start',
268
- };
269
- var columns = getResponsiveGridColumns();
270
- if (typeof columns === 'string') {
271
- return __assign(__assign({}, baseStyle), { gridTemplateColumns: columns });
272
- }
273
- return baseStyle;
274
- };
275
- var getPatternStyle = function () {
276
- if (!final.pattern || final.pattern === 'none')
277
- return {};
278
- var opacity = final.patternOpacity || 0.05;
279
- var color = final.patternColor || 'borderRgb';
280
- var size = final.patternSize || '20px';
281
- var colorValue = (0, getCssVariable_1.getCssVariableValue)(color) || 'rgba(var(--borderRgb), 0.1)';
282
- var backgroundImage = '';
283
- var backgroundSize = size;
284
- switch (final.pattern) {
285
- case 'grid':
286
- backgroundImage = "linear-gradient(to right, ".concat(colorValue, " ").concat(opacity, " 1px, transparent 1px),\n linear-gradient(to bottom, ").concat(colorValue, " ").concat(opacity, " 1px, transparent 1px)");
287
- backgroundSize = "".concat(size, " ").concat(size);
288
- break;
289
- case 'dots':
290
- backgroundImage = "radial-gradient(".concat(colorValue, " ").concat(opacity, " 1px, transparent 1px)");
291
- backgroundSize = "".concat(size, " ").concat(size);
292
- break;
293
- case 'diagonal':
294
- backgroundImage = "repeating-linear-gradient(45deg, ".concat(colorValue, " ").concat(opacity, ", ").concat(colorValue, " ").concat(opacity, " 1px, transparent 1px, transparent 20px)");
295
- backgroundSize = "".concat(size, " ").concat(size);
296
- break;
297
- }
298
- return {
299
- backgroundImage: backgroundImage,
300
- backgroundSize: backgroundSize,
301
- };
302
- };
303
- var getFadeStyle = function () {
304
- if (!final.fade)
305
- return {};
306
- var color = final.fadeColor || 'page-bg';
307
- var fadeColor = (0, getCssVariable_1.getCssVariableValue)(color) || color;
308
- if (final.fadeRadial) {
309
- return {
310
- background: "radial-gradient(ellipse at center, transparent 30%, ".concat(fadeColor, " 70%)"),
311
- };
312
- }
313
- var direction = final.fadeDirection || 'bottom';
314
- var gradients = {
315
- top: 'to top',
316
- bottom: 'to bottom',
317
- left: 'to left',
318
- right: 'to right',
319
- };
320
- return {
321
- background: "linear-gradient(".concat(gradients[direction], ", transparent 0%, ").concat(fadeColor, " 90%)"),
322
- };
323
- };
324
- var getTextAlign = function (align) {
325
- return {
326
- textAlign: align || 'center',
327
- };
228
+ // Regular item without card
229
+ return (react_1.default.createElement("div", { key: index, className: "feature-section__item-wrapper ".concat(item.className || ''), style: __assign({ maxWidth: final.itemMaxWidth || '100%' }, item.style) }, featureContent));
328
230
  };
329
231
  var renderFeaturesContent = function () {
330
232
  if (featuresArray.length === 0)
331
233
  return null;
332
- var gridStyles = getGridStyles();
333
- var isCentered = final.layout === 'centered';
334
- var maxWidth = final.maxWidth || (isCentered ? '48rem' : '100%');
335
- if (isCentered) {
234
+ var gapValue = final.gap !== undefined ? "".concat(final.gap * 0.25, "rem") : '2rem';
235
+ var flexGap = gapValue;
236
+ if (final.layout === 'centered') {
237
+ var maxWidth = final.maxWidth || '48rem';
336
238
  return (react_1.default.createElement("div", { className: "feature-section__centered-container", style: {
337
239
  maxWidth: maxWidth,
338
240
  margin: '0 auto',
339
241
  } }, featuresArray.map(function (item, index) { return renderFeatureItem(item, index); })));
340
242
  }
341
- return (react_1.default.createElement("div", { className: "feature-section__grid", style: __assign(__assign({}, gridStyles), { maxWidth: final.maxWidth || '100%', margin: '0 auto' }) }, featuresArray.map(function (item, index) { return (react_1.default.createElement("div", { key: index, className: "feature-section__grid-item" }, renderFeatureItem(item, index))); })));
243
+ // Use Flex layout with proper flexbox values
244
+ return (react_1.default.createElement("div", { className: "feature-section__flex-container", style: {
245
+ display: 'flex',
246
+ flexWrap: final.wrap !== false ? 'wrap' : 'nowrap',
247
+ gap: flexGap,
248
+ alignItems: convertFlexValue(final.align) || 'stretch',
249
+ justifyContent: convertFlexValue(final.justify) || 'flex-start',
250
+ maxWidth: final.maxWidth || '100%',
251
+ margin: '0 auto',
252
+ } }, featuresArray.map(function (item, index) { return (react_1.default.createElement("div", { key: index, className: "feature-section__flex-item" }, renderFeatureItem(item, index))); })));
342
253
  };
343
254
  var getLayoutClasses = function () {
344
255
  var classes = ['feature-section'];
@@ -358,23 +269,27 @@ var Feature = function (localProps) {
358
269
  };
359
270
  var getContainerStyles = function () {
360
271
  var padding = getSpacingValue(final.padding, '3rem 0');
361
- return __assign(__assign({ position: 'relative', padding: padding, backgroundColor: final.bg ? (0, getCssVariable_1.getCssVariableValue)(final.bg) || final.bg : undefined, overflow: 'hidden' }, getPatternStyle()), final.style);
272
+ return __assign({ padding: padding }, final.style);
273
+ };
274
+ var getTextAlign = function (align) {
275
+ return {
276
+ textAlign: align || 'center',
277
+ };
362
278
  };
363
279
  return (react_1.default.createElement("section", { id: final.id, className: getLayoutClasses(), style: getContainerStyles() },
364
- final.fade && (react_1.default.createElement("div", { className: "feature-section__fade-overlay", style: __assign(__assign({ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, width: '100%', height: '100%' }, getFadeStyle()), { zIndex: 0, pointerEvents: 'none' }) })),
365
- react_1.default.createElement("div", { className: "feature-section__container ".concat(final.containerClassName || ''), style: __assign({ position: 'relative', zIndex: 1, maxWidth: final.maxWidth || '1280px', margin: '0 auto', padding: '0 1rem' }, final.containerStyle) },
280
+ react_1.default.createElement("div", { className: "feature-section__container ".concat(final.containerClassName || ''), style: __assign({ maxWidth: final.maxWidth || '1280px', margin: '0 auto', padding: '0 1rem' }, final.containerStyle) },
366
281
  (final.title || final.subtitle || final.description) && (react_1.default.createElement("div", { className: "feature-section__header", style: __assign({ marginBottom: '3rem', maxWidth: final.layout === 'centered' ? '48rem' : '100%', marginLeft: 'auto', marginRight: 'auto' }, getTextAlign(final.titleAlign)) },
367
- final.subtitle && (react_1.default.createElement(Text_1.default, { variant: final.subtitleVariant, block: true, size: final.subtitleSize || 'sm', weight: final.subtitleWeight || 600, color: final.subtitleColor || 'var(--primary)', funcss: "feature-section__subtitle ".concat(final.subtitleClassName || ''), style: {
282
+ final.subtitle && (react_1.default.createElement(Text_1.default, { block: true, size: final.subtitleSize || 'sm', weight: final.subtitleWeight || 600, color: final.subtitleColor || 'var(--primary)', funcss: "feature-section__subtitle ".concat(final.subtitleClassName || ''), style: {
368
283
  textTransform: 'uppercase',
369
284
  letterSpacing: '0.05em',
370
285
  marginBottom: '0.5rem',
371
- }, text: final.subtitle })),
372
- final.title && (react_1.default.createElement(Text_1.default, { variant: final.titleVariant, block: true, size: final.titleSize || 'xl', weight: final.titleWeight || 700, color: final.titleColor || 'var(--text-color)', funcss: "feature-section__main-title ".concat(final.titleClassName || ''), style: { marginBottom: '1rem' }, text: final.title })),
373
- final.description && (react_1.default.createElement(Text_1.default, { variant: final.descriptionVariant, block: true, size: final.descriptionSize || 'sm', weight: final.descriptionWeight || 400, color: final.descriptionColor || 'var(--text-muted)', funcss: "feature-section__section-description ".concat(final.descriptionClassName || ''), text: final.description })))),
286
+ } }, final.subtitle)),
287
+ final.title && (react_1.default.createElement(Text_1.default, { block: true, size: final.titleSize || 'xl', weight: final.titleWeight || 700, color: final.titleColor || 'var(--text-color)', funcss: "feature-section__main-title ".concat(final.titleClassName || ''), style: { marginBottom: '1rem' } }, final.title)),
288
+ final.description && (react_1.default.createElement(Text_1.default, { block: true, size: final.descriptionSize || 'sm', weight: final.descriptionWeight || 400, color: final.descriptionColor || 'var(--text-muted)', funcss: "feature-section__section-description ".concat(final.descriptionClassName || '') }, final.description)))),
374
289
  react_1.default.createElement("div", { className: "feature-section__content" },
375
290
  renderFeaturesContent(),
376
291
  final.children),
377
292
  final.ctaText && (react_1.default.createElement("div", { className: "feature-section__cta-container", style: __assign({ marginTop: '2.5rem' }, getTextAlign(final.ctaAlign)) },
378
- react_1.default.createElement(Button_1.default, { variant: final.ctaVariant, onClick: final.ctaOnClick || (function () { return final.ctaUrl && (window.location.href = final.ctaUrl); }), funcss: "feature-section__cta ".concat(final.ctaClassName || '', " ").concat(final.ctaCss || ''), stringPrefix: final.ctaStringPrefix, stringSuffix: final.ctaStringSuffix, startIcon: final.ctaStartIcon, endIcon: final.ctaEndIcon, iconSize: final.ctaIconSize, isLoading: final.ctaIsLoading, status: final.ctaStatus, url: final.ctaUrl }, final.ctaText))))));
293
+ react_1.default.createElement(Button_1.default, { onClick: final.ctaOnClick || (function () { return final.ctaUrl && (window.location.href = final.ctaUrl); }), funcss: "feature-section__cta ".concat(final.ctaClassName || ''), stringPrefix: final.ctaStringPrefix, stringSuffix: final.ctaStringSuffix, startIcon: final.ctaStartIcon, endIcon: final.ctaEndIcon, iconSize: final.ctaIconSize, bg: final.ctaBg || 'primary', isLoading: final.ctaIsLoading, status: final.ctaStatus, url: final.ctaUrl }, final.ctaText))))));
379
294
  };
380
295
  exports.default = Feature;
package/ui/flex/Flex.d.ts CHANGED
@@ -5,21 +5,22 @@ interface FlexProps {
5
5
  id?: string;
6
6
  children?: React.ReactNode;
7
7
  style?: React.CSSProperties;
8
- direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
9
- wrap?: 'wrap' | 'nowrap' | 'wrap-reverse';
10
- justify?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
11
- alignItems?: 'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline';
12
- alignContent?: 'stretch' | 'center' | 'flex-start' | 'flex-end' | 'space-between' | 'space-around';
8
+ direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse' | 'col';
9
+ wrap?: 'wrap' | 'nowrap' | 'wrap-reverse' | 'no-wrap';
10
+ justify?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'start' | 'end' | 'between' | 'around' | 'evenly';
11
+ alignItems?: 'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'start' | 'end' | 'normal';
12
+ alignContent?: 'stretch' | 'center' | 'flex-start' | 'flex-end' | 'space-between' | 'space-around' | 'start' | 'end' | 'between' | 'around';
13
13
  gap?: number | string;
14
- gapX?: number;
15
- gapY?: number;
16
- gapUnit?: 'rem' | 'px' | 'em';
14
+ gapX?: number | string;
15
+ gapY?: number | string;
16
+ gapUnit?: 'rem' | 'px' | 'em' | '%';
17
17
  responsiveSmall?: boolean;
18
18
  responsiveMedium?: boolean;
19
19
  responsiveLarge?: boolean;
20
20
  width?: string;
21
21
  height?: string;
22
- fit?: Boolean;
22
+ fit?: boolean;
23
+ inline?: boolean;
23
24
  }
24
- export default function Flex({ className, funcss, id, children, style, direction, wrap, justify, alignItems, alignContent, gap, gapX, gapY, gapUnit, responsiveSmall, responsiveMedium, responsiveLarge, fit, width, height, ...rest }: FlexProps): React.JSX.Element;
25
+ export default function Flex({ className, funcss, id, children, style, direction, wrap, justify, alignItems, alignContent, gap, gapX, gapY, gapUnit, responsiveSmall, responsiveMedium, responsiveLarge, fit, inline, width, height, ...rest }: FlexProps): React.JSX.Element;
25
26
  export {};
package/ui/flex/Flex.js CHANGED
@@ -37,17 +37,113 @@ function Flex(_a) {
37
37
  // Gap
38
38
  gap = _a.gap, gapX = _a.gapX, gapY = _a.gapY, _e = _a.gapUnit, gapUnit = _e === void 0 ? 'rem' : _e,
39
39
  // Responsive
40
- responsiveSmall = _a.responsiveSmall, responsiveMedium = _a.responsiveMedium, responsiveLarge = _a.responsiveLarge, fit = _a.fit,
40
+ responsiveSmall = _a.responsiveSmall, responsiveMedium = _a.responsiveMedium, responsiveLarge = _a.responsiveLarge, fit = _a.fit, inline = _a.inline,
41
41
  // Size
42
- width = _a.width, height = _a.height, rest = __rest(_a, ["className", "funcss", "id", "children", "style", "direction", "wrap", "justify", "alignItems", "alignContent", "gap", "gapX", "gapY", "gapUnit", "responsiveSmall", "responsiveMedium", "responsiveLarge", "fit", "width", "height"]);
42
+ width = _a.width, height = _a.height, rest = __rest(_a, ["className", "funcss", "id", "children", "style", "direction", "wrap", "justify", "alignItems", "alignContent", "gap", "gapX", "gapY", "gapUnit", "responsiveSmall", "responsiveMedium", "responsiveLarge", "fit", "inline", "width", "height"]);
43
+ // Helper function to normalize flex values
44
+ var normalizeFlexValue = function (value, type) {
45
+ if (type === void 0) { type = 'justify'; }
46
+ if (!value)
47
+ return undefined;
48
+ var mapping = {
49
+ // Justify content mapping
50
+ 'start': 'flex-start',
51
+ 'end': 'flex-end',
52
+ 'between': 'space-between',
53
+ 'around': 'space-around',
54
+ 'evenly': 'space-evenly',
55
+ // Align items/content mapping
56
+ 'normal': 'normal',
57
+ // For alignContent, 'between' and 'around' are already correct
58
+ };
59
+ // If it's a shorthand, return the mapped value
60
+ if (mapping[value]) {
61
+ return mapping[value];
62
+ }
63
+ // If it's already a valid CSS value, return it as is
64
+ return value;
65
+ };
66
+ // Normalize direction shorthand
67
+ var getDirection = function () {
68
+ if (direction === 'col')
69
+ return 'column';
70
+ return direction;
71
+ };
72
+ // Normalize wrap shorthand
73
+ var getWrap = function () {
74
+ if (wrap === 'no-wrap')
75
+ return 'nowrap';
76
+ return wrap;
77
+ };
78
+ // Helper to format gap values
79
+ var formatGapValue = function (value) {
80
+ if (value === undefined || value === null)
81
+ return undefined;
82
+ // If it's already a string with unit, return as is
83
+ if (typeof value === 'string' && (value.includes('px') || value.includes('rem') || value.includes('em') || value.includes('%'))) {
84
+ return value;
85
+ }
86
+ // Otherwise, add the specified unit
87
+ return "".concat(value).concat(gapUnit);
88
+ };
43
89
  var combinedClassName = [
44
90
  className,
45
91
  funcss,
46
- responsiveSmall && 'responsiveSmall',
47
- responsiveMedium && 'responsiveMedium',
48
- responsiveLarge && 'responsiveLarge',
92
+ responsiveSmall && 'responsive-small',
93
+ responsiveMedium && 'responsive-medium',
94
+ responsiveLarge && 'responsive-large',
95
+ inline && 'inline-flex',
49
96
  ]
50
97
  .filter(Boolean)
51
98
  .join(' ');
52
- return (react_1.default.createElement("div", __assign({ id: id, className: combinedClassName, style: __assign({ display: 'flex', flexDirection: direction, flexWrap: wrap, justifyContent: justify, alignItems: alignItems, alignContent: alignContent, gap: gap ? "".concat(gap).concat(gapUnit) : 0, columnGap: gapX ? "".concat(gapX).concat(gapUnit) : gap ? "".concat(gap).concat(gapUnit) : 0, rowGap: gapY ? "".concat(gapY).concat(gapUnit) : gap ? "".concat(gap).concat(gapUnit) : 0, width: fit ? "100%" : width ? width : 'fit-content', height: fit ? "100%" : height ? height : 'fit-content' }, style) }, rest), children));
99
+ // Build styles dynamically
100
+ var flexStyles = {
101
+ display: inline ? 'inline-flex' : 'flex',
102
+ flexDirection: getDirection(),
103
+ flexWrap: getWrap(),
104
+ };
105
+ // Only add justify if provided
106
+ if (justify) {
107
+ flexStyles.justifyContent = normalizeFlexValue(justify, 'justify');
108
+ }
109
+ // Only add alignItems if provided
110
+ if (alignItems) {
111
+ flexStyles.alignItems = normalizeFlexValue(alignItems, 'align');
112
+ }
113
+ // Only add alignContent if provided
114
+ if (alignContent) {
115
+ flexStyles.alignContent = normalizeFlexValue(alignContent, 'align');
116
+ }
117
+ // Handle gap properties
118
+ var formattedGap = formatGapValue(gap);
119
+ var formattedGapX = formatGapValue(gapX);
120
+ var formattedGapY = formatGapValue(gapY);
121
+ if (formattedGap) {
122
+ flexStyles.gap = formattedGap;
123
+ }
124
+ // Only set columnGap/rowGap if explicitly provided or if gap is set but gapX/gapY not
125
+ if (formattedGapX !== undefined) {
126
+ flexStyles.columnGap = formattedGapX;
127
+ }
128
+ else if (formattedGap) {
129
+ flexStyles.columnGap = formattedGap;
130
+ }
131
+ if (formattedGapY !== undefined) {
132
+ flexStyles.rowGap = formattedGapY;
133
+ }
134
+ else if (formattedGap) {
135
+ flexStyles.rowGap = formattedGap;
136
+ }
137
+ // Handle width and height
138
+ if (fit) {
139
+ flexStyles.width = '100%';
140
+ flexStyles.height = '100%';
141
+ }
142
+ else {
143
+ if (width)
144
+ flexStyles.width = width;
145
+ if (height)
146
+ flexStyles.height = height;
147
+ }
148
+ return (react_1.default.createElement("div", __assign({ id: id, className: combinedClassName, style: __assign(__assign({}, flexStyles), style) }, rest), children));
53
149
  }
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+ export type InputType = 'text' | 'email' | 'number' | 'tel' | 'textarea' | 'password' | 'date' | 'select' | 'checkbox' | 'radio' | 'file';
3
+ export interface FieldOption {
4
+ label: string;
5
+ value: string;
6
+ disabled?: boolean;
7
+ }
8
+ export interface FormField {
9
+ name: string;
10
+ label?: string;
11
+ type: InputType;
12
+ required?: boolean;
13
+ placeholder?: string;
14
+ options?: FieldOption[];
15
+ multiple?: boolean;
16
+ value?: any;
17
+ disabled?: boolean;
18
+ helperText?: string;
19
+ inputProps?: {
20
+ startIcon?: React.ReactNode;
21
+ endIcon?: React.ReactNode;
22
+ prefix?: React.ReactNode;
23
+ suffix?: React.ReactNode;
24
+ stringPrefix?: string;
25
+ stringSuffix?: string;
26
+ iconicBg?: string;
27
+ funcss?: string;
28
+ bg?: string;
29
+ flat?: boolean;
30
+ bordered?: boolean;
31
+ borderless?: boolean;
32
+ rounded?: boolean;
33
+ leftRounded?: boolean;
34
+ rightRounded?: boolean;
35
+ rows?: number;
36
+ noBorder?: boolean;
37
+ variant?: string;
38
+ id?: string;
39
+ autocomplete?: string;
40
+ pattern?: string;
41
+ min?: string | number;
42
+ max?: string | number;
43
+ minLength?: number;
44
+ maxLength?: number;
45
+ step?: string | number;
46
+ };
47
+ }
48
+ export interface FormProps {
49
+ fields: FormField[] | string;
50
+ onSubmit?: (values: Record<string, any>, viaWhatsApp?: boolean) => void;
51
+ defaultValues?: Record<string, any> | string;
52
+ submitText?: string;
53
+ submitBg?: string;
54
+ submitPrefix?: React.ReactNode | string;
55
+ submitSuffix?: React.ReactNode | string;
56
+ resetText?: string;
57
+ showReset?: boolean;
58
+ isLoading?: boolean;
59
+ className?: string;
60
+ layout?: 'vertical' | 'horizontal';
61
+ gap?: number;
62
+ title?: string;
63
+ titleSize?: string;
64
+ titleColor?: string;
65
+ description?: string;
66
+ descriptionSize?: string;
67
+ descriptionColor?: string;
68
+ whatsappContact?: string;
69
+ whatsappHeader?: string;
70
+ whatsappFooter?: string;
71
+ fullWidth?: boolean;
72
+ width?: string;
73
+ centered?: boolean;
74
+ variant?: string;
75
+ }
76
+ declare const Form: React.FC<FormProps>;
77
+ export default Form;