funuicss 3.6.10 → 3.6.11

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.10",
2
+ "version": "3.6.11",
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",
@@ -1,10 +1,12 @@
1
1
  import React, { ReactNode } from 'react';
2
- interface CarouselProps {
2
+ interface CarouselProps extends React.HTMLAttributes<HTMLDivElement> {
3
3
  scrollNumber?: number;
4
4
  gap?: number;
5
5
  funcss?: string;
6
6
  children: ReactNode;
7
7
  showDashes?: boolean;
8
+ allowVerticalOverflow?: boolean;
9
+ itemPadding?: string;
8
10
  }
9
11
  declare const Carousel: React.FC<CarouselProps>;
10
12
  export default Carousel;
@@ -1,5 +1,16 @@
1
1
  "use strict";
2
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
+ };
3
14
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
15
  if (k2 === undefined) k2 = k;
5
16
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -33,6 +44,17 @@ var __importStar = (this && this.__importStar) || (function () {
33
44
  return result;
34
45
  };
35
46
  })();
47
+ var __rest = (this && this.__rest) || function (s, e) {
48
+ var t = {};
49
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
+ t[p] = s[p];
51
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
+ t[p[i]] = s[p[i]];
55
+ }
56
+ return t;
57
+ };
36
58
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
59
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
60
  };
@@ -43,11 +65,11 @@ var Circle_1 = __importDefault(require("../specials/Circle"));
43
65
  var RowFlex_1 = __importDefault(require("../specials/RowFlex"));
44
66
  var Functions_1 = require("../../utils/Functions");
45
67
  var Carousel = function (_a) {
46
- var _b = _a.scrollNumber, scrollNumber = _b === void 0 ? 320 : _b, _c = _a.gap, gap = _c === void 0 ? 0.5 : _c, _d = _a.funcss, funcss = _d === void 0 ? '' : _d, _e = _a.showDashes, showDashes = _e === void 0 ? true : _e, children = _a.children;
68
+ var _b = _a.scrollNumber, scrollNumber = _b === void 0 ? 320 : _b, _c = _a.gap, gap = _c === void 0 ? 0.5 : _c, _d = _a.funcss, funcss = _d === void 0 ? '' : _d, _e = _a.showDashes, showDashes = _e === void 0 ? true : _e, _f = _a.allowVerticalOverflow, allowVerticalOverflow = _f === void 0 ? false : _f, _g = _a.itemPadding, itemPadding = _g === void 0 ? '0rem' : _g, children = _a.children, rest = __rest(_a, ["scrollNumber", "gap", "funcss", "showDashes", "allowVerticalOverflow", "itemPadding", "children"]);
47
69
  var scrollRef = (0, react_1.useRef)(null);
48
- var _f = (0, react_1.useState)('start'), scrollPosition = _f[0], setScrollPosition = _f[1];
49
- var _g = (0, react_1.useState)(false), isPhone = _g[0], setIsPhone = _g[1];
50
- var _h = (0, react_1.useState)(false), isScrollable = _h[0], setIsScrollable = _h[1];
70
+ var _h = (0, react_1.useState)('start'), scrollPosition = _h[0], setScrollPosition = _h[1];
71
+ var _j = (0, react_1.useState)(false), isPhone = _j[0], setIsPhone = _j[1];
72
+ var _k = (0, react_1.useState)(false), isScrollable = _k[0], setIsScrollable = _k[1];
51
73
  var checkScrollable = function () {
52
74
  var container = scrollRef.current;
53
75
  if (container) {
@@ -100,7 +122,7 @@ var Carousel = function (_a) {
100
122
  return function () { return container.removeEventListener('scroll', handleScroll); };
101
123
  }
102
124
  }, []);
103
- return (react_1.default.createElement("div", { className: "carousel-wrapper ".concat(funcss) },
125
+ return (react_1.default.createElement("div", __assign({ className: "carousel-wrapper ".concat(funcss) }, rest),
104
126
  react_1.default.createElement(RowFlex_1.default, { gap: 1, wrap: "nowrap", alignItems: "center" },
105
127
  !isPhone && isScrollable && (react_1.default.createElement("div", null,
106
128
  react_1.default.createElement(Circle_1.default, { onClick: function () { return scroll('left'); } },
@@ -109,10 +131,12 @@ var Carousel = function (_a) {
109
131
  width: '100%',
110
132
  gap: gap + 'rem',
111
133
  overflowX: 'auto',
134
+ overflowY: 'visible',
112
135
  display: 'flex',
113
136
  justifyItems: (isScrollable || isPhone) ? 'flex-start' : 'center',
114
137
  scrollSnapType: 'x mandatory',
115
138
  scrollBehavior: 'smooth',
139
+ padding: itemPadding || "0.5rem"
116
140
  } }, react_1.default.Children.map(children, function (child) { return (react_1.default.createElement("div", { className: "carousel-item", style: { flexShrink: 0 } },
117
141
  react_1.default.createElement("div", { className: "carousel-card" }, child))); })),
118
142
  !isPhone && isScrollable && (react_1.default.createElement("div", null,
package/ui/vista/Vista.js CHANGED
@@ -57,25 +57,30 @@ var Vista = function (_a) {
57
57
  containerClass: containerClass,
58
58
  textWrapperClass: textWrapperClass,
59
59
  imageWrapperClass: imageWrapperClass,
60
+ gap: gap,
60
61
  // Enhanced content props
62
+ heading: heading,
61
63
  headingSize: headingSize,
62
64
  headingWeight: headingWeight,
63
65
  headingColor: headingColor,
64
66
  headingClass: headingClass,
67
+ subheading: subheading,
65
68
  subheadingSize: subheadingSize,
66
69
  subheadingWeight: subheadingWeight,
67
70
  subheadingColor: subheadingColor,
68
71
  subheadingClass: subheadingClass,
72
+ content: content,
69
73
  contentSize: contentSize,
70
74
  contentWeight: contentWeight,
71
75
  contentColor: contentColor,
72
76
  contentClass: contentClass,
77
+ image: image,
73
78
  imageUrl: imageUrl,
74
79
  imageSize: imageSize,
75
80
  imageAlt: imageAlt,
76
81
  imageClass: imageClass,
77
- gap: gap,
78
- ctaClass: ctaClass
82
+ cta: cta,
83
+ ctaClass: ctaClass,
79
84
  }).props;
80
85
  var layoutClass = [
81
86
  mergedProps.layout,
@@ -86,14 +91,14 @@ var Vista = function (_a) {
86
91
  .join(' ');
87
92
  // Enhanced Text Content with flexible styling
88
93
  var TextContent = (react_1.default.createElement("div", { className: "vista-text ".concat(mergedProps.layout === 'centered' ? "text-center" : "", " ").concat(mergedProps.textWrapperClass) },
89
- heading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.headingSize, weight: mergedProps.headingWeight, color: mergedProps.headingColor, funcss: mergedProps.headingClass }, heading)),
90
- subheading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.subheadingSize, weight: mergedProps.subheadingWeight, color: mergedProps.subheadingColor, funcss: "mt-2 ".concat(mergedProps.subheadingClass) }, subheading)),
91
- content && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.contentSize, weight: mergedProps.contentWeight, color: mergedProps.contentColor, funcss: "mt-4 ".concat(mergedProps.contentClass), article: true }, content || children)),
92
- cta && (react_1.default.createElement("div", { className: "mt-6 ".concat(mergedProps.ctaClass) }, cta))));
94
+ mergedProps.heading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.headingSize, weight: mergedProps.headingWeight, color: mergedProps.headingColor, funcss: mergedProps.headingClass }, mergedProps.heading)),
95
+ mergedProps.subheading && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.subheadingSize, weight: mergedProps.subheadingWeight, color: mergedProps.subheadingColor, funcss: "mt-2 ".concat(mergedProps.subheadingClass) }, mergedProps.subheading)),
96
+ mergedProps.content && (react_1.default.createElement(Text_1.default, { block: true, size: mergedProps.contentSize, weight: mergedProps.contentWeight, color: mergedProps.contentColor, funcss: "mt-4 ".concat(mergedProps.contentClass), article: true }, mergedProps.content || children)),
97
+ mergedProps.cta && (react_1.default.createElement("div", { className: "mt-6 ".concat(mergedProps.ctaClass) }, mergedProps.cta))));
93
98
  // Enhanced Image Content - uses imageUrl if no image component provided
94
- var ImageContent = (image || mergedProps.imageUrl) && (react_1.default.createElement("div", { className: "vista-image ".concat(mergedProps.imageWrapperClass) }, image ? (image) : (react_1.default.createElement("img", { src: mergedProps.imageUrl, alt: mergedProps.imageAlt || 'Vista image', className: "".concat(mergedProps.imageClass), style: {
99
+ var ImageContent = (mergedProps.image || mergedProps.imageUrl) && (react_1.default.createElement("div", { className: "vista-image ".concat(mergedProps.imageWrapperClass) }, mergedProps.image ? (mergedProps.image) : (react_1.default.createElement("img", { src: mergedProps.imageUrl, alt: mergedProps.imageAlt || 'Vista image', className: "".concat(mergedProps.imageClass), style: {
95
100
  objectFit: 'cover',
96
- maxWidth: imageSize,
101
+ maxWidth: mergedProps.imageSize,
97
102
  borderRadius: 'inherit'
98
103
  } }))));
99
104
  var isCentered = mergedProps.layout === 'centered';
@@ -33,16 +33,42 @@ export interface MergedConfig {
33
33
  export interface UseComponentConfigReturn extends ComponentConfig {
34
34
  mergeWithLocal: (localProps?: ComponentProps) => MergedConfig;
35
35
  getProp: <T = any>(propName: string, defaultValue?: T) => T;
36
+ hasVariant: boolean;
37
+ isDefaultVariant: boolean;
36
38
  }
37
39
  /**
38
40
  * Universal component config getter
41
+ *
42
+ * @param projectData - The project configuration data
43
+ * @param componentName - Name of the component to get config for
44
+ * @param variantName - Name of the variant (defaults to 'default')
45
+ * @returns Component configuration with metadata
39
46
  */
40
47
  export declare const getComponentConfig: (projectData: ProjectData | null | undefined, componentName: string, variantName?: string) => ComponentConfig;
41
48
  /**
42
49
  * Merge component config with local props - only applies config if variant exists
50
+ *
51
+ * @param config - Component configuration from getComponentConfig
52
+ * @param localProps - Props passed directly to the component
53
+ * @returns Merged configuration with metadata
43
54
  */
44
55
  export declare const mergeComponentConfig: (config: ComponentConfig, localProps?: ComponentProps) => MergedConfig;
45
56
  /**
46
57
  * Hook for easy component config usage - only applies if variant is provided and exists
58
+ * Uses useMemo to prevent unnecessary re-computation
59
+ *
60
+ * @param componentName - Name of the component
61
+ * @param variantName - Optional variant name
62
+ * @returns Configuration object with helper methods
47
63
  */
48
64
  export declare const useComponentConfiguration: (componentName: string, variantName?: string) => UseComponentConfigReturn;
65
+ /**
66
+ * Utility function to check if a component variant exists
67
+ * Useful for conditional rendering logic
68
+ */
69
+ export declare const hasComponentVariant: (projectData: ProjectData | null | undefined, componentName: string, variantName: string) => boolean;
70
+ /**
71
+ * Get all available variants for a component
72
+ * Useful for variant selectors/dropdowns
73
+ */
74
+ export declare const getAvailableVariants: (projectData: ProjectData | null | undefined, componentName: string) => string[];
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // import { useTheme } from "../ui/theme/theme"
2
3
  var __assign = (this && this.__assign) || function () {
3
4
  __assign = Object.assign || function(t) {
4
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -11,14 +12,168 @@ var __assign = (this && this.__assign) || function () {
11
12
  return __assign.apply(this, arguments);
12
13
  };
13
14
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.useComponentConfiguration = exports.mergeComponentConfig = exports.getComponentConfig = void 0;
15
+ exports.getAvailableVariants = exports.hasComponentVariant = exports.useComponentConfiguration = exports.mergeComponentConfig = exports.getComponentConfig = void 0;
16
+ // // utils/componentUtils.ts
17
+ // // Type definitions
18
+ // export interface ComponentProps {
19
+ // [key: string]: any
20
+ // }
21
+ // export interface ComponentMetadata {
22
+ // createdAt?: Date
23
+ // updatedAt?: Date
24
+ // isCustom?: boolean
25
+ // baseVariant?: string
26
+ // }
27
+ // export interface ComponentVariant {
28
+ // componentProps: ComponentProps
29
+ // metadata?: ComponentMetadata
30
+ // }
31
+ // export interface ComponentConfig {
32
+ // componentProps: ComponentProps
33
+ // variantExists: boolean
34
+ // actualVariant: string
35
+ // availableVariants: string[]
36
+ // metadata: ComponentMetadata
37
+ // }
38
+ // export interface ProjectData {
39
+ // components?: {
40
+ // [componentName: string]: {
41
+ // [variantName: string]: ComponentVariant
42
+ // }
43
+ // }
44
+ // }
45
+ // export interface MergedConfig {
46
+ // props: ComponentProps
47
+ // variant: string
48
+ // hasConfig: boolean
49
+ // }
50
+ // export interface UseComponentConfigReturn extends ComponentConfig {
51
+ // mergeWithLocal: (localProps?: ComponentProps) => MergedConfig
52
+ // getProp: <T = any>(propName: string, defaultValue?: T) => T
53
+ // }
54
+ // /**
55
+ // * Universal component config getter
56
+ // */
57
+ // export const getComponentConfig = (
58
+ // projectData: ProjectData | null | undefined,
59
+ // componentName: string,
60
+ // variantName: string = 'default'
61
+ // ): ComponentConfig => {
62
+ // if (!projectData?.components?.[componentName]) {
63
+ // return {
64
+ // componentProps: {},
65
+ // variantExists: false,
66
+ // actualVariant: variantName,
67
+ // availableVariants: [],
68
+ // metadata: {}
69
+ // }
70
+ // }
71
+ // const component = projectData.components[componentName]
72
+ // const availableVariants = Object.keys(component)
73
+ // // Find the best variant match
74
+ // let targetVariant = variantName
75
+ // if (!availableVariants.includes(variantName)) {
76
+ // if (availableVariants.includes('default')) {
77
+ // targetVariant = 'default'
78
+ // } else if (availableVariants.length > 0) {
79
+ // targetVariant = availableVariants[0]
80
+ // } else {
81
+ // return {
82
+ // componentProps: {},
83
+ // variantExists: false,
84
+ // actualVariant: variantName,
85
+ // availableVariants: [],
86
+ // metadata: {}
87
+ // }
88
+ // }
89
+ // }
90
+ // const variantData = component[targetVariant] || {}
91
+ // return {
92
+ // componentProps: variantData.componentProps || {},
93
+ // variantExists: true,
94
+ // actualVariant: targetVariant,
95
+ // availableVariants,
96
+ // metadata: variantData.metadata || {}
97
+ // }
98
+ // }
99
+ // /**
100
+ // * Merge component config with local props - only applies config if variant exists
101
+ // */
102
+ // export const mergeComponentConfig = (
103
+ // config: ComponentConfig,
104
+ // localProps: ComponentProps = {}
105
+ // ): MergedConfig => {
106
+ // // Only apply config if variant exists and has actual configuration
107
+ // const hasValidConfig = config.variantExists && Object.keys(config.componentProps).length > 0
108
+ // if (!hasValidConfig) {
109
+ // return {
110
+ // props: localProps,
111
+ // variant: config.actualVariant,
112
+ // hasConfig: false
113
+ // }
114
+ // }
115
+ // return {
116
+ // // Props: config overrides local only if variant exists
117
+ // props: {
118
+ // ...localProps,
119
+ // ...config.componentProps
120
+ // },
121
+ // // Metadata
122
+ // variant: config.actualVariant,
123
+ // hasConfig: true
124
+ // }
125
+ // }
126
+ // /**
127
+ // * Hook for easy component config usage - only applies if variant is provided and exists
128
+ // */
129
+ // export const useComponentConfiguration = (
130
+ // componentName: string,
131
+ // variantName?: string // Make variantName optional
132
+ // ): UseComponentConfigReturn => {
133
+ // const { projectData } = useTheme()
134
+ // // Only get config if variantName is provided
135
+ // const config = variantName ? getComponentConfig(projectData, componentName, variantName) : {
136
+ // componentProps: {},
137
+ // variantExists: false,
138
+ // actualVariant: '',
139
+ // availableVariants: [],
140
+ // metadata: {}
141
+ // }
142
+ // const mergeWithLocal = (
143
+ // localProps: ComponentProps = {}
144
+ // ): MergedConfig => {
145
+ // // If no variant name was provided, return local props as-is
146
+ // if (!variantName) {
147
+ // return {
148
+ // props: localProps,
149
+ // variant: '',
150
+ // hasConfig: false
151
+ // }
152
+ // }
153
+ // return mergeComponentConfig(config, localProps)
154
+ // }
155
+ // const getProp = <T = any>(propName: string, defaultValue?: T): T =>
156
+ // (config.componentProps[propName] ?? defaultValue) as T
157
+ // return {
158
+ // ...config,
159
+ // mergeWithLocal,
160
+ // getProp
161
+ // }
162
+ // }
15
163
  var theme_1 = require("../ui/theme/theme");
164
+ var react_1 = require("react");
16
165
  /**
17
166
  * Universal component config getter
167
+ *
168
+ * @param projectData - The project configuration data
169
+ * @param componentName - Name of the component to get config for
170
+ * @param variantName - Name of the variant (defaults to 'default')
171
+ * @returns Component configuration with metadata
18
172
  */
19
173
  var getComponentConfig = function (projectData, componentName, variantName) {
20
174
  var _a;
21
175
  if (variantName === void 0) { variantName = 'default'; }
176
+ // Early return if no component exists
22
177
  if (!((_a = projectData === null || projectData === void 0 ? void 0 : projectData.components) === null || _a === void 0 ? void 0 : _a[componentName])) {
23
178
  return {
24
179
  componentProps: {},
@@ -30,14 +185,18 @@ var getComponentConfig = function (projectData, componentName, variantName) {
30
185
  }
31
186
  var component = projectData.components[componentName];
32
187
  var availableVariants = Object.keys(component);
33
- // Find the best variant match
188
+ // Find the best variant match with fallback chain
34
189
  var targetVariant = variantName;
35
- if (!availableVariants.includes(variantName)) {
190
+ var variantExists = availableVariants.includes(variantName);
191
+ if (!variantExists) {
192
+ // Fallback priority: default → first available → none
36
193
  if (availableVariants.includes('default')) {
37
194
  targetVariant = 'default';
195
+ variantExists = true;
38
196
  }
39
197
  else if (availableVariants.length > 0) {
40
198
  targetVariant = availableVariants[0];
199
+ variantExists = true;
41
200
  }
42
201
  else {
43
202
  return {
@@ -49,18 +208,41 @@ var getComponentConfig = function (projectData, componentName, variantName) {
49
208
  };
50
209
  }
51
210
  }
52
- var variantData = component[targetVariant] || {};
211
+ var variantData = component[targetVariant];
53
212
  return {
54
- componentProps: variantData.componentProps || {},
55
- variantExists: true,
213
+ componentProps: (variantData === null || variantData === void 0 ? void 0 : variantData.componentProps) || {},
214
+ variantExists: variantExists,
56
215
  actualVariant: targetVariant,
57
216
  availableVariants: availableVariants,
58
- metadata: variantData.metadata || {}
217
+ metadata: (variantData === null || variantData === void 0 ? void 0 : variantData.metadata) || {}
59
218
  };
60
219
  };
61
220
  exports.getComponentConfig = getComponentConfig;
221
+ /**
222
+ * Deep merge utility for nested objects
223
+ * Config props override local props, but we preserve nested structure
224
+ */
225
+ var deepMerge = function (target, source) {
226
+ var result = __assign({}, target);
227
+ for (var key in source) {
228
+ if (source[key] !== undefined) {
229
+ // For objects, do shallow merge (we don't go too deep to avoid complexity)
230
+ if (typeof source[key] === 'object' && !Array.isArray(source[key]) && source[key] !== null) {
231
+ result[key] = __assign(__assign({}, (target[key] || {})), source[key]);
232
+ }
233
+ else {
234
+ result[key] = source[key];
235
+ }
236
+ }
237
+ }
238
+ return result;
239
+ };
62
240
  /**
63
241
  * Merge component config with local props - only applies config if variant exists
242
+ *
243
+ * @param config - Component configuration from getComponentConfig
244
+ * @param localProps - Props passed directly to the component
245
+ * @returns Merged configuration with metadata
64
246
  */
65
247
  var mergeComponentConfig = function (config, localProps) {
66
248
  if (localProps === void 0) { localProps = {}; }
@@ -74,9 +256,9 @@ var mergeComponentConfig = function (config, localProps) {
74
256
  };
75
257
  }
76
258
  return {
77
- // FIXED: Local props should override config (correct order)
78
- props: __assign(__assign({}, config.componentProps), localProps // Local props second (higher priority)
79
- ),
259
+ // Props: config overrides local, with deep merge for nested objects
260
+ props: deepMerge(localProps, config.componentProps),
261
+ // Metadata
80
262
  variant: config.actualVariant,
81
263
  hasConfig: true
82
264
  };
@@ -84,31 +266,64 @@ var mergeComponentConfig = function (config, localProps) {
84
266
  exports.mergeComponentConfig = mergeComponentConfig;
85
267
  /**
86
268
  * Hook for easy component config usage - only applies if variant is provided and exists
269
+ * Uses useMemo to prevent unnecessary re-computation
270
+ *
271
+ * @param componentName - Name of the component
272
+ * @param variantName - Optional variant name
273
+ * @returns Configuration object with helper methods
87
274
  */
88
- var useComponentConfiguration = function (componentName, variantName // Make variantName optional
89
- ) {
275
+ var useComponentConfiguration = function (componentName, variantName) {
90
276
  var projectData = (0, theme_1.useTheme)().projectData;
91
- // Only get config if variantName is provided
92
- var config = variantName ? (0, exports.getComponentConfig)(projectData, componentName, variantName) : {
93
- componentProps: {},
94
- variantExists: false,
95
- actualVariant: '',
96
- availableVariants: [],
97
- metadata: {}
98
- };
99
- var mergeWithLocal = function (localProps) {
100
- if (localProps === void 0) { localProps = {}; }
101
- // If no variant name was provided, return local props as-is
277
+ // Memoize config computation - only recompute when dependencies change
278
+ var config = (0, react_1.useMemo)(function () {
102
279
  if (!variantName) {
103
280
  return {
104
- props: localProps,
105
- variant: '',
106
- hasConfig: false
281
+ componentProps: {},
282
+ variantExists: false,
283
+ actualVariant: '',
284
+ availableVariants: [],
285
+ metadata: {}
107
286
  };
108
287
  }
109
- return (0, exports.mergeComponentConfig)(config, localProps);
110
- };
111
- var getProp = function (propName, defaultValue) { var _a; return ((_a = config.componentProps[propName]) !== null && _a !== void 0 ? _a : defaultValue); };
112
- return __assign(__assign({}, config), { mergeWithLocal: mergeWithLocal, getProp: getProp });
288
+ return (0, exports.getComponentConfig)(projectData, componentName, variantName);
289
+ }, [projectData, componentName, variantName]);
290
+ // Memoize merge function
291
+ var mergeWithLocal = (0, react_1.useMemo)(function () {
292
+ return function (localProps) {
293
+ if (localProps === void 0) { localProps = {}; }
294
+ // If no variant name was provided, return local props as-is
295
+ if (!variantName) {
296
+ return {
297
+ props: localProps,
298
+ variant: '',
299
+ hasConfig: false
300
+ };
301
+ }
302
+ return (0, exports.mergeComponentConfig)(config, localProps);
303
+ };
304
+ }, [config, variantName]);
305
+ // Memoize getProp function
306
+ var getProp = (0, react_1.useMemo)(function () {
307
+ return function (propName, defaultValue) { var _a; return ((_a = config.componentProps[propName]) !== null && _a !== void 0 ? _a : defaultValue); };
308
+ }, [config.componentProps]);
309
+ return __assign(__assign({}, config), { mergeWithLocal: mergeWithLocal, getProp: getProp, hasVariant: config.variantExists, isDefaultVariant: config.actualVariant === 'default' });
113
310
  };
114
311
  exports.useComponentConfiguration = useComponentConfiguration;
312
+ /**
313
+ * Utility function to check if a component variant exists
314
+ * Useful for conditional rendering logic
315
+ */
316
+ var hasComponentVariant = function (projectData, componentName, variantName) {
317
+ var _a, _b;
318
+ return !!((_b = (_a = projectData === null || projectData === void 0 ? void 0 : projectData.components) === null || _a === void 0 ? void 0 : _a[componentName]) === null || _b === void 0 ? void 0 : _b[variantName]);
319
+ };
320
+ exports.hasComponentVariant = hasComponentVariant;
321
+ /**
322
+ * Get all available variants for a component
323
+ * Useful for variant selectors/dropdowns
324
+ */
325
+ var getAvailableVariants = function (projectData, componentName) {
326
+ var _a;
327
+ return Object.keys(((_a = projectData === null || projectData === void 0 ? void 0 : projectData.components) === null || _a === void 0 ? void 0 : _a[componentName]) || {});
328
+ };
329
+ exports.getAvailableVariants = getAvailableVariants;