my-animated-components 1.0.4 → 1.0.5

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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import path from 'path';
1
+ import React, { useState, useRef, useEffect } from 'react';
2
+ import { motion, AnimatePresence } from 'framer-motion';
3
3
 
4
4
  function styleInject(css, ref) {
5
5
  if ( ref === undefined ) ref = {};
@@ -31,51 +31,485 @@ function styleInject(css, ref) {
31
31
  var css_248z = "@tailwind base;\r\n@tailwind components;\r\n@tailwind utilities;\r\n";
32
32
  styleInject(css_248z);
33
33
 
34
- // Dynamically import and load components, returning them for export
35
- const loadComponents = (componentsPath) => {
36
- return new Promise((resolve, reject) => {
37
- fs.readdir(componentsPath, { withFileTypes: true }, async (err, files) => {
38
- if (err) {
39
- reject('Error reading components directory:');
40
- return;
34
+ const Button = ({ children, className = '', color = 'primary', size = 'md', onClick, disabled = false, variant = 'solid', }) => {
35
+ const baseClasses = 'font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2';
36
+ const colorClasses = {
37
+ primary: {
38
+ solid: 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500',
39
+ outline: 'border border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500',
40
+ ghost: 'text-blue-600 hover:bg-blue-50 focus:ring-blue-500',
41
+ },
42
+ secondary: {
43
+ solid: 'bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500',
44
+ outline: 'border border-gray-600 text-gray-600 hover:bg-gray-50 focus:ring-gray-500',
45
+ ghost: 'text-gray-600 hover:bg-gray-50 focus:ring-gray-500',
46
+ },
47
+ };
48
+ const sizeClasses = {
49
+ xs: 'px-2.5 py-1.5 text-xs',
50
+ sm: 'px-3 py-2 text-sm',
51
+ md: 'px-4 py-2 text-base',
52
+ lg: 'px-4 py-2 text-lg',
53
+ xl: 'px-6 py-3 text-xl',
54
+ };
55
+ return (React.createElement(motion.button, { className: `${baseClasses} ${colorClasses[color][variant]} ${sizeClasses[size]} ${className}`, onClick: onClick, disabled: disabled, whileHover: { scale: 1.05 }, whileTap: { scale: 0.95 } }, children));
56
+ };
57
+
58
+ const IconButton = ({ className = '', color = 'primary', size = 'md', icon, onClick, disabled = false, variant = 'solid', }) => {
59
+ const baseClasses = 'rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2';
60
+ const colorClasses = {
61
+ primary: {
62
+ solid: 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500',
63
+ outline: 'border border-blue-600 text-blue-600 hover:bg-blue-50 focus:ring-blue-500',
64
+ ghost: 'text-blue-600 hover:bg-blue-50 focus:ring-blue-500',
65
+ },
66
+ secondary: {
67
+ solid: 'bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500',
68
+ outline: 'border border-gray-600 text-gray-600 hover:bg-gray-50 focus:ring-gray-500',
69
+ ghost: 'text-gray-600 hover:bg-gray-50 focus:ring-gray-500',
70
+ },
71
+ };
72
+ const sizeClasses = {
73
+ xs: 'p-1',
74
+ sm: 'p-1.5',
75
+ md: 'p-2',
76
+ lg: 'p-2.5',
77
+ xl: 'p-3',
78
+ };
79
+ return (React.createElement(motion.button, { className: `${baseClasses} ${colorClasses[color][variant]} ${sizeClasses[size]} ${className}`, onClick: onClick, disabled: disabled, whileHover: { scale: 1.05 }, whileTap: { scale: 0.95 } }, icon));
80
+ };
81
+
82
+ const Accordion = ({ className = '', items }) => {
83
+ const [openIndex, setOpenIndex] = useState(null);
84
+ const toggleItem = (index) => {
85
+ setOpenIndex(openIndex === index ? null : index);
86
+ };
87
+ return (React.createElement("div", { className: `space-y-2 ${className}` }, items.map((item, index) => (React.createElement("div", { key: index, className: "border border-gray-200 rounded-md" },
88
+ React.createElement("button", { className: "flex justify-between items-center w-full px-4 py-2 text-left", onClick: () => toggleItem(index) },
89
+ React.createElement("span", null, item.title),
90
+ React.createElement(motion.svg, { className: "w-5 h-5", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", animate: { rotate: openIndex === index ? 180 : 0 }, transition: { duration: 0.3 } },
91
+ React.createElement("path", { fillRule: "evenodd", d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z", clipRule: "evenodd" }))),
92
+ React.createElement(AnimatePresence, null, openIndex === index && (React.createElement(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: 'auto', opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.3 }, className: "px-4 py-2 border-t border-gray-200" }, item.content))))))));
93
+ };
94
+
95
+ const Alert = ({ children, className = '', color = 'primary', onClose }) => {
96
+ const colorClasses = {
97
+ primary: 'bg-blue-100 text-blue-700',
98
+ secondary: 'bg-gray-100 text-gray-700',
99
+ success: 'bg-green-100 text-green-700',
100
+ danger: 'bg-red-100 text-red-700',
101
+ warning: 'bg-yellow-100 text-yellow-700',
102
+ info: 'bg-indigo-100 text-indigo-700',
103
+ };
104
+ return (React.createElement(motion.div, { className: `p-4 rounded-md ${colorClasses[color]} ${className}`, role: "alert", initial: { opacity: 0, y: -20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -20 }, transition: { duration: 0.3 } },
105
+ React.createElement("div", { className: "flex" },
106
+ React.createElement("div", { className: "flex-grow" }, children),
107
+ onClose && (React.createElement("button", { type: "button", className: "ml-auto -mx-1.5 -my-1.5 rounded-lg focus:ring-2 focus:ring-blue-400 p-1.5 inline-flex h-8 w-8", onClick: onClose, "aria-label": "Close" },
108
+ React.createElement("span", { className: "sr-only" }, "Close"),
109
+ React.createElement("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg" },
110
+ React.createElement("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" })))))));
111
+ };
112
+
113
+ const Avatar = ({ className = '', size = 'md', src, alt, initials }) => {
114
+ const sizeClasses = {
115
+ xs: 'w-6 h-6 text-xs',
116
+ sm: 'w-8 h-8 text-sm',
117
+ md: 'w-10 h-10 text-base',
118
+ lg: 'w-12 h-12 text-lg',
119
+ xl: 'w-14 h-14 text-xl',
120
+ };
121
+ return (React.createElement("div", { className: `relative inline-flex items-center justify-center ${sizeClasses[size]} ${className} rounded-full bg-gray-200 overflow-hidden` }, src ? (React.createElement("img", { src: src, alt: alt || 'Avatar', className: "w-full h-full object-cover" })) : (React.createElement("span", { className: "font-medium text-gray-600" }, initials))));
122
+ };
123
+
124
+ const Badge = ({ children, className = '', color = 'primary', size = 'md' }) => {
125
+ const colorClasses = {
126
+ primary: 'bg-blue-100 text-blue-800',
127
+ secondary: 'bg-gray-100 text-gray-800',
128
+ success: 'bg-green-100 text-green-800',
129
+ danger: 'bg-red-100 text-red-800',
130
+ warning: 'bg-yellow-100 text-yellow-800',
131
+ info: 'bg-indigo-100 text-indigo-800',
132
+ };
133
+ const sizeClasses = {
134
+ xs: 'px-2 py-0.5 text-xs',
135
+ sm: 'px-2.5 py-0.5 text-sm',
136
+ md: 'px-3 py-1 text-sm',
137
+ lg: 'px-3.5 py-1.5 text-base',
138
+ xl: 'px-4 py-2 text-lg',
139
+ };
140
+ return (React.createElement(motion.span, { className: `inline-flex items-center font-medium rounded-full ${colorClasses[color]} ${sizeClasses[size]} ${className}`, initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, transition: { duration: 0.3 } }, children));
141
+ };
142
+
143
+ const Breadcrumb = ({ className = '', items }) => {
144
+ return (React.createElement("nav", { className: `flex ${className}`, "aria-label": "Breadcrumb" },
145
+ React.createElement("ol", { className: "inline-flex items-center space-x-1 md:space-x-3" }, items.map((item, index) => (React.createElement("li", { key: index, className: "inline-flex items-center" },
146
+ index > 0 && (React.createElement("svg", { className: "w-6 h-6 text-gray-400", fill: "currentColor", viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg" },
147
+ React.createElement("path", { fillRule: "evenodd", d: "M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z", clipRule: "evenodd" }))),
148
+ React.createElement("a", { href: item.href, className: `ml-1 text-sm font-medium ${index === items.length - 1
149
+ ? 'text-gray-500 hover:text-gray-700'
150
+ : 'text-blue-600 hover:text-blue-800'}` }, item.label)))))));
151
+ };
152
+
153
+ const Card = ({ children, className = '' }) => {
154
+ return (React.createElement(motion.div, { className: `bg-white shadow rounded-lg overflow-hidden ${className}`, initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3 } }, children));
155
+ };
156
+
157
+ const CardBody = ({ children, className = '' }) => {
158
+ return (React.createElement("div", { className: `px-4 py-5 sm:p-6 ${className}` }, children));
159
+ };
160
+
161
+ const CardFooter = ({ children, className = '' }) => {
162
+ return (React.createElement("div", { className: `px-4 py-4 sm:px-6 ${className}` }, children));
163
+ };
164
+
165
+ const CardHeader = ({ children, className = '' }) => {
166
+ return (React.createElement("div", { className: `px-4 py-5 sm:px-6 ${className}` }, children));
167
+ };
168
+
169
+ const Dropdown = ({ children, className = '', trigger }) => {
170
+ const [isOpen, setIsOpen] = useState(false);
171
+ const dropdownRef = useRef(null);
172
+ useEffect(() => {
173
+ const handleClickOutside = (event) => {
174
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
175
+ setIsOpen(false);
41
176
  }
42
- const componentPromises = files.map(async (file) => {
43
- if (file.isDirectory()) {
44
- console.log(`Folder: ${file.name}`);
45
- }
46
- else {
47
- console.log(`Importing: ${file.name}`);
48
- try {
49
- const component = await import(path.join(componentsPath, file.name));
50
- return { name: file.name.replace('.tsx', ''), component };
51
- }
52
- catch (error) {
53
- console.error(`Error importing component ${file.name}:`, error);
54
- return null;
55
- }
56
- }
57
- });
58
- const components = await Promise.all(componentPromises);
59
- resolve(components.filter((comp) => comp !== null));
60
- });
61
- });
62
- };
63
-
64
- // Set the path to your components directory
65
- const componentsPath = './components';
66
- let componentsExports = {};
67
- // Dynamically load the components
68
- loadComponents(componentsPath)
69
- .then((components) => {
70
- components.forEach(({ name, component }) => {
71
- if (component) {
72
- // Dynamically assign each component to the componentsExports object
73
- componentsExports[name] = component;
74
- }
75
- });
76
- })
77
- .catch((err) => {
78
- console.error('Error loading components:', err);
79
- });
80
-
81
- export { componentsExports };
177
+ };
178
+ document.addEventListener('mousedown', handleClickOutside);
179
+ return () => {
180
+ document.removeEventListener('mousedown', handleClickOutside);
181
+ };
182
+ }, []);
183
+ return (React.createElement("div", { className: `relative inline-block text-left ${className}`, ref: dropdownRef },
184
+ React.createElement("div", null,
185
+ React.createElement("button", { type: "button", onClick: () => setIsOpen(prev => !prev) }, trigger),
186
+ React.createElement(AnimatePresence, null, isOpen && (React.createElement(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.3 } }, children))))));
187
+ };
188
+
189
+ const DropdownItem = ({ children, className = '' }) => {
190
+ return (React.createElement("a", { href: "#", className: `block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 ${className}`, role: "menuitem" }, children));
191
+ };
192
+
193
+ const Checkbox = ({ className = '', label, checked, onChange, }) => {
194
+ return (React.createElement(motion.label, { className: `inline-flex items-center ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
195
+ React.createElement("input", { type: "checkbox", className: "form-checkbox h-5 w-5 text-blue-600", checked: checked, onChange: onChange }),
196
+ React.createElement("span", { className: "ml-2 text-gray-700" }, label)));
197
+ };
198
+
199
+ const FileUpload = ({ className = '', onChange, accept, multiple }) => {
200
+ const fileInputRef = useRef(null);
201
+ const handleClick = () => {
202
+ fileInputRef.current?.click();
203
+ };
204
+ const handleChange = (event) => {
205
+ const file = event.target.files?.[0] || null;
206
+ onChange(file);
207
+ };
208
+ return (React.createElement(motion.div, { className: `flex items-center ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
209
+ React.createElement("button", { type: "button", onClick: handleClick, className: "px-4 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" }, "Choose File"),
210
+ React.createElement("input", { type: "file", ref: fileInputRef, onChange: handleChange, accept: accept, multiple: multiple, className: "hidden" })));
211
+ };
212
+
213
+ const Input = ({ className = '', size = 'md', type = 'text', placeholder, value, onChange, }) => {
214
+ const sizeClasses = {
215
+ xs: 'px-2 py-1 text-xs',
216
+ sm: 'px-3 py-2 text-sm',
217
+ md: 'px-4 py-2 text-base',
218
+ lg: 'px-4 py-3 text-lg',
219
+ xl: 'px-5 py-4 text-xl',
220
+ };
221
+ return (React.createElement(motion.div, { initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
222
+ React.createElement("input", { type: type, className: `w-full border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${sizeClasses[size]} ${className}`, placeholder: placeholder, value: value, onChange: onChange })));
223
+ };
224
+
225
+ const Radio = ({ className = '', label, name, value, checked, onChange, }) => {
226
+ return (React.createElement(motion.label, { className: `inline-flex items-center ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
227
+ React.createElement("input", { type: "radio", className: "form-radio h-5 w-5 text-blue-600", name: name, value: value, checked: checked, onChange: onChange }),
228
+ React.createElement("span", { className: "ml-2 text-gray-700" }, label)));
229
+ };
230
+
231
+ const Select = ({ className = '', size = 'md', options, value, onChange, }) => {
232
+ const sizeClasses = {
233
+ xs: 'px-2 py-1 text-xs',
234
+ sm: 'px-3 py-2 text-sm',
235
+ md: 'px-4 py-2 text-base',
236
+ lg: 'px-4 py-3 text-lg',
237
+ xl: 'px-5 py-4 text-xl',
238
+ };
239
+ return (React.createElement(motion.div, { initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
240
+ React.createElement("select", { className: `w-full border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${sizeClasses[size]} ${className}`, value: value, onChange: onChange }, options.map((option) => (React.createElement("option", { key: option.value, value: option.value }, option.label))))));
241
+ };
242
+
243
+ const Switch = ({ className = '', checked, onChange, label }) => {
244
+ return (React.createElement(motion.label, { className: `inline-flex items-center cursor-pointer ${className}`, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
245
+ React.createElement("div", { className: "relative" },
246
+ React.createElement("input", { type: "checkbox", className: "sr-only", checked: checked, onChange: (e) => onChange(e.target.checked) }),
247
+ React.createElement("div", { className: `w-10 h-6 bg-gray-200 rounded-full shadow-inner ${checked ? 'bg-blue-600' : ''}` }),
248
+ React.createElement("div", { className: `absolute w-4 h-4 bg-white rounded-full shadow inset-y-1 left-1 transition-transform duration-200 ease-in-out ${checked ? 'transform translate-x-4' : ''}` })),
249
+ label && React.createElement("span", { className: "ml-3 text-sm font-medium text-gray-900" }, label)));
250
+ };
251
+
252
+ const Textarea = ({ className = '', size = 'md', placeholder, value, onChange, rows = 4, }) => {
253
+ const sizeClasses = {
254
+ xs: 'px-2 py-1 text-xs',
255
+ sm: 'px-3 py-2 text-sm',
256
+ md: 'px-4 py-2 text-base',
257
+ lg: 'px-4 py-3 text-lg',
258
+ xl: 'px-5 py-4 text-xl',
259
+ };
260
+ return (React.createElement(motion.div, { initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } },
261
+ React.createElement("textarea", { className: `w-full border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 ${sizeClasses[size]} ${className}`, placeholder: placeholder, value: value, onChange: onChange, rows: rows })));
262
+ };
263
+
264
+ const Container = ({ children, className = '', fluid = false }) => {
265
+ const containerClass = fluid ? 'w-full' : 'max-w-7xl mx-auto px-4 sm:px-6 lg:px-8';
266
+ return (React.createElement("div", { className: `${containerClass} ${className}` }, children));
267
+ };
268
+
269
+ const Flex = ({ children, className = '', direction = 'row', justify = 'start', align = 'start', wrap = false, }) => {
270
+ const flexClass = `
271
+ flex
272
+ ${direction === 'col' ? 'flex-col' : 'flex-row'}
273
+ ${`justify-${justify}`}
274
+ ${`items-${align}`}
275
+ ${wrap ? 'flex-wrap' : 'flex-nowrap'}
276
+ `;
277
+ return (React.createElement("div", { className: `${flexClass} ${className}` }, children));
278
+ };
279
+
280
+ const Grid = ({ children, className = '', cols = 3, gap = 4 }) => {
281
+ return (React.createElement("div", { className: `grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-${cols} gap-${gap} ${className}` }, children));
282
+ };
283
+
284
+ const List = ({ children, className = '', as = 'ul' }) => {
285
+ const Tag = as;
286
+ return (React.createElement(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3 } },
287
+ React.createElement(Tag, { className: `space-y-1 ${className}` }, children)));
288
+ };
289
+
290
+ const ListItem = ({ children, className = '' }) => {
291
+ return (React.createElement(motion.li, { className: className, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } }, children));
292
+ };
293
+
294
+ const Modal = ({ children, className = '', isOpen, onClose }) => {
295
+ return (React.createElement(AnimatePresence, null, isOpen && (React.createElement(motion.div, { className: "fixed inset-0 z-50 overflow-y-auto", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 } },
296
+ React.createElement("div", { className: "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" },
297
+ React.createElement("div", { className: "fixed inset-0 transition-opacity", "aria-hidden": "true" },
298
+ React.createElement("div", { className: "absolute inset-0 bg-gray-500 opacity-75", onClick: onClose })),
299
+ React.createElement("span", { className: "hidden sm:inline-block sm:align-middle sm:h-screen", "aria-hidden": "true" }, "\u200B"),
300
+ React.createElement(motion.div, { className: `inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full ${className}`, initial: { opacity: 0, scale: 0.95 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.95 } }, children))))));
301
+ };
302
+
303
+ const ModalBody = ({ children, className = '' }) => {
304
+ return (React.createElement("div", { className: `px-4 pt-5 pb-4 sm:p-6 sm:pb-4 ${className}` }, children));
305
+ };
306
+
307
+ const ModalFooter = ({ children, className = '' }) => {
308
+ return (React.createElement("div", { className: `px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse ${className}` }, children));
309
+ };
310
+
311
+ const ModalHeader = ({ children, className = '' }) => {
312
+ return (React.createElement("div", { className: `px-4 pt-5 pb-4 sm:p-6 sm:pb-4 ${className}` },
313
+ React.createElement("h3", { className: "text-lg leading-6 font-medium text-gray-900" }, children)));
314
+ };
315
+
316
+ const NavItem = ({ children, className = '', href, active = false }) => {
317
+ const activeClass = active ? 'text-gray-900 border-b-2 border-blue-500' : 'text-gray-500 hover:text-gray-700';
318
+ return (React.createElement(motion.a, { href: href, className: `inline-flex items-center px-1 pt-1 text-sm font-medium ${activeClass} ${className}`, whileHover: { scale: 1.05 }, whileTap: { scale: 0.95 } }, children));
319
+ };
320
+
321
+ const Navbar = ({ children, className = '', brand }) => {
322
+ return (React.createElement(motion.nav, { className: `bg-white shadow ${className}`, initial: { opacity: 0, y: -50 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5 } },
323
+ React.createElement("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8" },
324
+ React.createElement("div", { className: "flex justify-between h-16" },
325
+ React.createElement("div", { className: "flex-shrink-0 flex items-center" }, brand),
326
+ React.createElement("div", { className: "flex items-center" }, children)))));
327
+ };
328
+
329
+ const Offcanvas = ({ children, className = '', isOpen, onClose, position = 'left' }) => {
330
+ const positionClasses = {
331
+ left: 'left-0 top-0 h-full',
332
+ right: 'right-0 top-0 h-full',
333
+ top: 'top-0 left-0 w-full',
334
+ bottom: 'bottom-0 left-0 w-full',
335
+ };
336
+ const variants = {
337
+ left: { x: '-100%' },
338
+ right: { x: '100%' },
339
+ top: { y: '-100%' },
340
+ bottom: { y: '100%' },
341
+ };
342
+ return (React.createElement(AnimatePresence, null, isOpen && (React.createElement("div", { className: "fixed inset-0 z-50 overflow-hidden" },
343
+ React.createElement("div", { className: "absolute inset-0 overflow-hidden" },
344
+ React.createElement(motion.div, { className: "absolute inset-0 bg-gray-500 bg-opacity-75 transition-opacity", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, onClick: onClose }),
345
+ React.createElement("section", { className: `absolute ${positionClasses[position]} max-w-md` },
346
+ React.createElement(motion.div, { className: `h-full w-full transform transition ease-in-out duration-300 ${className}`, initial: variants[position], animate: { x: 0, y: 0 }, exit: variants[position], transition: { duration: 0.3 } },
347
+ React.createElement("div", { className: "h-full bg-white shadow-xl" }, children))))))));
348
+ };
349
+
350
+ const OffcanvasBody = ({ children, className = '' }) => {
351
+ return (React.createElement("div", { className: `p-4 overflow-y-auto ${className}` }, children));
352
+ };
353
+
354
+ const OffcanvasHeader = ({ children, className = '', onClose }) => {
355
+ return (React.createElement("div", { className: `px-4 py-3 border-b border-gray-200 flex items-center justify-between ${className}` },
356
+ React.createElement("h2", { className: "text-lg font-semibold" }, children),
357
+ React.createElement("button", { onClick: onClose, className: "text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500" },
358
+ React.createElement("span", { className: "sr-only" }, "Close panel"),
359
+ React.createElement("svg", { className: "h-6 w-6", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor" },
360
+ React.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" })))));
361
+ };
362
+
363
+ const Pagination = ({ className = '', currentPage, totalPages, onPageChange }) => {
364
+ const pageNumbers = [];
365
+ for (let i = 1; i <= totalPages; i++) {
366
+ pageNumbers.push(i);
367
+ }
368
+ return (React.createElement("nav", { className: `flex justify-center ${className}` },
369
+ React.createElement("ul", { className: "flex items-center -space-x-px" },
370
+ React.createElement("li", null,
371
+ React.createElement("button", { onClick: () => onPageChange(currentPage - 1), disabled: currentPage === 1, className: "block px-3 py-2 ml-0 leading-tight text-gray-500 bg-white border border-gray-300 rounded-l-lg hover:bg-gray-100 hover:text-gray-700" }, "Previous")),
372
+ pageNumbers.map((number) => (React.createElement("li", { key: number },
373
+ React.createElement("button", { onClick: () => onPageChange(number), className: `px-3 py-2 leading-tight border border-gray-300 ${currentPage === number
374
+ ? 'text-blue-600 bg-blue-50 hover:bg-blue-100 hover:text-blue-700'
375
+ : 'text-gray-500 bg-white hover:bg-gray-100 hover:text-gray-700'}` }, number)))),
376
+ React.createElement("li", null,
377
+ React.createElement("button", { onClick: () => onPageChange(currentPage + 1), disabled: currentPage === totalPages, className: "block px-3 py-2 leading-tight text-gray-500 bg-white border border-gray-300 rounded-r-lg hover:bg-gray-100 hover:text-gray-700" }, "Next")))));
378
+ };
379
+
380
+ const ProgressBar = ({ className = '', color = 'primary', value, max = 100 }) => {
381
+ const percentage = Math.min(100, Math.max(0, (value / max) * 100));
382
+ const colorClasses = {
383
+ primary: 'bg-blue-600',
384
+ secondary: 'bg-gray-600',
385
+ success: 'bg-green-600',
386
+ danger: 'bg-red-600',
387
+ warning: 'bg-yellow-600',
388
+ info: 'bg-indigo-600',
389
+ };
390
+ return (React.createElement("div", { className: `w-full bg-gray-200 rounded-full h-2.5 ${className}` },
391
+ React.createElement(motion.div, { className: `h-2.5 rounded-full ${colorClasses[color]}`, style: { width: `${percentage}%` }, initial: { width: 0 }, animate: { width: `${percentage}%` }, transition: { duration: 0.5 }, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max })));
392
+ };
393
+
394
+ const Skeleton = ({ className = '', width = '100%', height = '20px' }) => {
395
+ return (React.createElement("div", { className: `animate-pulse bg-gray-200 rounded ${className}`, style: { width, height } }));
396
+ };
397
+
398
+ const Slider = ({ className = '', min, max, value, onChange, step = 1 }) => {
399
+ const percentage = ((value - min) / (max - min)) * 100;
400
+ return (React.createElement("div", { className: `relative w-full h-2 bg-gray-200 rounded-full ${className}` },
401
+ React.createElement(motion.div, { className: "absolute h-full bg-blue-600 rounded-full", style: { width: `${percentage}%` }, initial: { width: 0 }, animate: { width: `${percentage}%` }, transition: { duration: 0.3 } }),
402
+ React.createElement("input", { type: "range", min: min, max: max, value: value, onChange: (e) => onChange(Number(e.target.value)), step: step, className: "absolute w-full h-full opacity-0 cursor-pointer" })));
403
+ };
404
+
405
+ const RangeSlider = ({ className = '', min, max, values, onChange, step = 1 }) => {
406
+ const [minValue, maxValue] = values;
407
+ const minPercentage = ((minValue - min) / (max - min)) * 100;
408
+ const maxPercentage = ((maxValue - min) / (max - min)) * 100;
409
+ const handleMinChange = (e) => {
410
+ const newMinValue = Math.min(Number(e.target.value), maxValue - step);
411
+ onChange([newMinValue, maxValue]);
412
+ };
413
+ const handleMaxChange = (e) => {
414
+ const newMaxValue = Math.max(Number(e.target.value), minValue + step);
415
+ onChange([minValue, newMaxValue]);
416
+ };
417
+ return (React.createElement("div", { className: `relative w-full h-2 bg-gray-200 rounded-full ${className}` },
418
+ React.createElement(motion.div, { className: "absolute h-full bg-blue-600 rounded-full", style: { left: `${minPercentage}%`, right: `${100 - maxPercentage}%` }, initial: { left: 0, right: '100%' }, animate: { left: `${minPercentage}%`, right: `${100 - maxPercentage}%` }, transition: { duration: 0.3 } }),
419
+ React.createElement("input", { type: "range", min: min, max: max, value: minValue, onChange: handleMinChange, step: step, className: "absolute w-full h-full opacity-0 cursor-pointer" }),
420
+ React.createElement("input", { type: "range", min: min, max: max, value: maxValue, onChange: handleMaxChange, step: step, className: "absolute w-full h-full opacity-0 cursor-pointer" })));
421
+ };
422
+
423
+ const Stepper = ({ className = '', steps, currentStep }) => {
424
+ return (React.createElement("div", { className: `flex items-center ${className}` }, steps.map((step, index) => (React.createElement(React.Fragment, { key: index },
425
+ React.createElement("div", { className: "flex items-center" },
426
+ React.createElement("div", { className: `flex items-center justify-center w-8 h-8 rounded-full ${index < currentStep
427
+ ? 'bg-blue-600 text-white'
428
+ : index === currentStep
429
+ ? 'bg-blue-200 text-blue-600'
430
+ : 'bg-gray-200 text-gray-600'}` }, index < currentStep ? (React.createElement("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20" },
431
+ React.createElement("path", { fillRule: "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", clipRule: "evenodd" }))) : (index + 1)),
432
+ index < steps.length - 1 && (React.createElement("div", { className: `flex-1 h-1 mx-2 ${index < currentStep ? 'bg-blue-600' : 'bg-gray-200'}` }))),
433
+ index < steps.length - 1 && (React.createElement("div", { className: "hidden sm:block text-xs text-center text-gray-500 mt-2" }, step)))))));
434
+ };
435
+
436
+ const Table = ({ children, className = '' }) => {
437
+ return (React.createElement(motion.div, { className: "overflow-x-auto", initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3 } },
438
+ React.createElement("table", { className: `min-w-full divide-y divide-gray-200 ${className}` }, children)));
439
+ };
440
+
441
+ const TableBody = ({ children, className = '' }) => {
442
+ return (React.createElement("tbody", { className: `bg-white divide-y divide-gray-200 ${className}` }, children));
443
+ };
444
+
445
+ const TableCell = ({ children, className = '', as = 'td' }) => {
446
+ const Tag = as;
447
+ const baseClass = as === 'th' ? 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider' : 'px-6 py-4 whitespace-nowrap text-sm text-gray-500';
448
+ return (React.createElement(Tag, { className: `${baseClass} ${className}` }, children));
449
+ };
450
+
451
+ const TableHead = ({ children, className = '' }) => {
452
+ return (React.createElement("thead", { className: `bg-gray-50 ${className}` }, children));
453
+ };
454
+
455
+ const TableRow = ({ children, className = '' }) => {
456
+ return (React.createElement(motion.tr, { className: className, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { duration: 0.3 } }, children));
457
+ };
458
+
459
+ const Tabs = ({ className = '', tabs }) => {
460
+ const [activeTab, setActiveTab] = useState(0);
461
+ return (React.createElement("div", { className: className },
462
+ React.createElement("div", { className: "border-b border-gray-200" },
463
+ React.createElement("nav", { className: "-mb-px flex space-x-8", "aria-label": "Tabs" }, tabs.map((tab, index) => (React.createElement("button", { key: index, className: `
464
+ whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm
465
+ ${activeTab === index
466
+ ? 'border-blue-500 text-blue-600'
467
+ : 'border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300'}
468
+ `, onClick: () => setActiveTab(index) }, tab.label))))),
469
+ React.createElement(motion.div, { key: activeTab, initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.3 }, className: "mt-4" }, tabs[activeTab].content)));
470
+ };
471
+
472
+ const Tooltip = ({ children, className = '', content, position = 'top' }) => {
473
+ const [isVisible, setIsVisible] = useState(false);
474
+ const positionClasses = {
475
+ top: 'bottom-full left-1/2 transform -translate-x-1/2 mb-2',
476
+ right: 'left-full top-1/2 transform -translate-y-1/2 ml-2',
477
+ bottom: 'top-full left-1/2 transform -translate-x-1/2 mt-2',
478
+ left: 'right-full top-1/2 transform -translate-y-1/2 mr-2',
479
+ };
480
+ return (React.createElement("div", { className: "relative inline-block" },
481
+ React.createElement("div", { onMouseEnter: () => setIsVisible(true), onMouseLeave: () => setIsVisible(false) }, children),
482
+ React.createElement(AnimatePresence, null, isVisible && (React.createElement(motion.div, { className: `absolute z-10 px-3 py-2 text-sm font-medium text-white bg-gray-900 rounded-lg shadow-sm ${positionClasses[position]} ${className}`, initial: { opacity: 0, scale: 0.8 }, animate: { opacity: 1, scale: 1 }, exit: { opacity: 0, scale: 0.8 }, transition: { duration: 0.2 } }, content)))));
483
+ };
484
+
485
+ const Heading = ({ children, className = '', as = 'h2', size = 'md' }) => {
486
+ const Tag = as;
487
+ const sizeClasses = {
488
+ xs: 'text-lg',
489
+ sm: 'text-xl',
490
+ md: 'text-2xl',
491
+ lg: 'text-3xl',
492
+ xl: 'text-4xl',
493
+ };
494
+ return (React.createElement(motion.div, { initial: { opacity: 0, y: -20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5 } },
495
+ React.createElement(Tag, { className: `font-bold ${sizeClasses[size]} ${className}` }, children)));
496
+ };
497
+
498
+ const Text = ({ children, className = '', size = 'md', weight = 'normal' }) => {
499
+ const sizeClasses = {
500
+ xs: 'text-xs',
501
+ sm: 'text-sm',
502
+ md: 'text-base',
503
+ lg: 'text-lg',
504
+ xl: 'text-xl',
505
+ };
506
+ const weightClasses = {
507
+ normal: 'font-normal',
508
+ medium: 'font-medium',
509
+ semibold: 'font-semibold',
510
+ bold: 'font-bold',
511
+ };
512
+ return (React.createElement("p", { className: `${sizeClasses[size]} ${weightClasses[weight]} ${className}` }, children));
513
+ };
514
+
515
+ export { Accordion, Alert, Avatar, Badge, Breadcrumb, Button, Card, CardBody, CardFooter, CardHeader, Checkbox, Container, Dropdown, DropdownItem, FileUpload, Flex, Grid, Heading, IconButton, Input, List, ListItem, Modal, ModalBody, ModalFooter, ModalHeader, NavItem, Navbar, Offcanvas, OffcanvasBody, OffcanvasHeader, Pagination, ProgressBar, Radio, RangeSlider, Select, Skeleton, Slider, Stepper, Switch, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Text, Textarea, Tooltip };
@@ -1,3 +1,51 @@
1
1
  import './styles/tailwind.css';
2
- declare let componentsExports: Record<string, any>;
3
- export { componentsExports };
2
+ import { Button } from './components/buttons/Button';
3
+ import { IconButton } from './components/buttons/IconButton';
4
+ import { Accordion } from './components/accordion/Accordion';
5
+ import { Alert } from './components/alert/Alert';
6
+ import { Avatar } from './components/avatar/Avatar';
7
+ import { Badge } from './components/badge/Badge';
8
+ import { Breadcrumb } from './components/breadcrumb/Breadcrumb';
9
+ import { Card } from './components/card/Card';
10
+ import { CardBody } from './components/card/CardBody';
11
+ import { CardFooter } from './components/card/CardFooter';
12
+ import { CardHeader } from './components/card/CardHeader';
13
+ import { Dropdown } from './components/dropdown/Dropdown';
14
+ import { DropdownItem } from './components/dropdown/DropdownItem';
15
+ import { Checkbox } from './components/form/Checkbox';
16
+ import { FileUpload } from './components/form/FileUpload';
17
+ import { Input } from './components/form/Input';
18
+ import { Radio } from './components/form/Radio';
19
+ import { Select } from './components/form/Select';
20
+ import { Switch } from './components/form/Switch';
21
+ import { Textarea } from './components/form/Textarea';
22
+ import { Container } from './components/layout/Container';
23
+ import { Flex } from './components/layout/Flex';
24
+ import { Grid } from './components/layout/Grid';
25
+ import { List } from './components/list/List';
26
+ import { ListItem } from './components/list/ListItem';
27
+ import { Modal } from './components/modal/Modal';
28
+ import { ModalBody } from './components/modal/ModalBody';
29
+ import { ModalFooter } from './components/modal/ModalFooter';
30
+ import { ModalHeader } from './components/modal/ModalHeader';
31
+ import { NavItem } from './components/navigation/NavItem';
32
+ import { Navbar } from './components/navigation/Navbar';
33
+ import { Offcanvas } from './components/offcanvas/Offcanvas';
34
+ import { OffcanvasBody } from './components/offcanvas/OffcanvasBody';
35
+ import { OffcanvasHeader } from './components/offcanvas/OffcanvasHeader';
36
+ import { Pagination } from './components/pagination/Pagination';
37
+ import { ProgressBar } from './components/progress/ProgressBar';
38
+ import { Skeleton } from './components/skeleton/Skeleton';
39
+ import { Slider } from './components/slider/Slider';
40
+ import { RangeSlider } from './components/slider/RangeSlider';
41
+ import { Stepper } from './components/stepper/Stepper';
42
+ import { Table } from './components/table/Table';
43
+ import { TableBody } from './components/table/TableBody';
44
+ import { TableCell } from './components/table/TableCell';
45
+ import { TableHead } from './components/table/TableHead';
46
+ import { TableRow } from './components/table/TableRow';
47
+ import { Tabs } from './components/tabs/Tabs';
48
+ import { Tooltip } from './components/tooltip/Tooltip';
49
+ import { Heading } from './components/typography/Heading';
50
+ import { Text } from './components/typography/Text';
51
+ export { Button, IconButton, Accordion, Alert, Avatar, Badge, Breadcrumb, Card, CardBody, CardFooter, CardHeader, Dropdown, DropdownItem, Checkbox, FileUpload, Input, Radio, Select, Switch, Textarea, Container, Flex, Grid, List, ListItem, Modal, ModalBody, ModalFooter, ModalHeader, NavItem, Navbar, Offcanvas, OffcanvasBody, OffcanvasHeader, Pagination, ProgressBar, Skeleton, Slider, RangeSlider, Stepper, Table, TableBody, TableCell, TableHead, TableRow, Tabs, Tooltip, Heading, Text };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my-animated-components",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
package/readme.md CHANGED
@@ -1,20 +1,102 @@
1
- # Animated Components
1
+ # MY Animated Components
2
2
 
3
- **Animated Components** is a collection of customizable React components built with Framer Motion for smooth animations. It provides buttons and icon buttons with different styles, sizes, and interactive animations.
3
+ **My Animated Components** is a collection of customizable React components built with Framer Motion for smooth animations. It provides buttons and icon buttons with different styles, sizes, and interactive animations.
4
4
 
5
5
  ---
6
6
 
7
7
  ## Features
8
8
 
9
- - **Customizable Buttons**: Supports different variants (`solid`, `outline`, `ghost`) and colors (`primary`, `secondary`).
10
- - **Icon Button**: Use any custom icon inside the button.
11
- - **Framer Motion Animations**: Interactive hover and tap animations to enhance user experience.
9
+ Animated Components
10
+ Animated Components is a collection of customizable React components built with Framer Motion for smooth animations. It provides buttons, icon buttons, and other interactive UI elements with different styles, sizes, and animations.
11
+
12
+ Features
13
+ Customizable Buttons: Supports different variants (solid, outline, ghost) and colors (primary, secondary, etc.).
14
+ Icon Button: Use any custom icon inside the button for more flexibility.
15
+ Framer Motion Animations: Interactive hover and tap animations to enhance user experience.
16
+ Various UI Elements: Includes components like Accordion, Alert, Badge, Modal, Dropdown, and more.
17
+ Available Components
18
+ Button
19
+ IconButton
20
+ Accordion
21
+ Alert
22
+ Avatar
23
+ Badge
24
+ Breadcrumb
25
+ Card
26
+ Dropdown
27
+ Checkbox
28
+ FileUpload
29
+ Input
30
+ Radio
31
+ Select
32
+ Switch
33
+ Textarea
34
+ Modal
35
+ Navbar
36
+ Pagination
37
+ ProgressBar
38
+ Slider
39
+ Table
40
+ Tabs
41
+ Tooltip
42
+ Heading
43
+ Text
44
+
45
+ ## props
46
+ color (optional): Sets the color of the component. Available values: primary, secondary, success, danger, warning, info.
47
+ className
48
+ children
49
+
50
+ ## Example Usage
51
+ import { Button } from 'my-animated-components';
52
+
53
+ const MyComponent = () => {
54
+ return (
55
+ <Button color="primary" size="md" className="my-custom-class">
56
+ Click Me
57
+ </Button>
58
+ );
59
+ };
60
+
61
+ ## other example
62
+
63
+ import { IconButton } from 'my-animated-components';
64
+ import { FaBeer } from 'react-icons/fa';
65
+
66
+ const MyComponent = () => {
67
+ return (
68
+ <IconButton color="secondary" size="lg">
69
+ <FaBeer />
70
+ </IconButton>
71
+ );
72
+ };
73
+
12
74
 
13
- ---
14
75
 
15
76
  ## Installation
77
+ To install my-animated-components in your React project, you also need to install Tailwind CSS and Framer Motion as dependencies. Run the following commands:
16
78
 
17
- To install **my-animated-components** in your React project, run the following command:
79
+ Install my-animated-components:
80
+ bash
81
+ Copy code
82
+ npm install my-animated-components
83
+ Install Tailwind CSS (if not already installed in your project):
84
+ bash
85
+ Copy code
86
+ npm install -D tailwindcss
87
+ Install Framer Motion (for animations):
88
+ bash
89
+ Copy code
90
+ npm install framer-motion
91
+ Add Tailwind to your CSS file (e.g., src/index.css):
92
+ css
93
+ Copy code
94
+ @tailwind base;
95
+ @tailwind components;
96
+ @tailwind utilities;
97
+ Make sure to configure Tailwind in your tailwind.config.js file if it is not already set up:
98
+ bash
99
+ Copy code
100
+ npx tailwindcss init
18
101
 
19
- ```bash
20
102
  npm install my-animated-components
package/rollup.config.js CHANGED
@@ -9,7 +9,7 @@ export default defineConfig({
9
9
  format: 'es',
10
10
  name: 'my-animated-components',
11
11
  },
12
- external: ['react', 'react-dom', 'tailwindcss', 'framer-motion','fs', 'path'],
12
+ external: ['react', 'react-dom', 'tailwindcss', 'framer-motion'],
13
13
  plugins: [
14
14
  typescript({ tsconfig: 'tsconfig.json' }),
15
15
  postcss({
package/src/index.ts CHANGED
@@ -1,24 +1,104 @@
1
1
  import './styles/tailwind.css';
2
- import { loadComponents } from './utils/Listfiles';
3
2
 
4
- // Set the path to your components directory
5
- const componentsPath = './components';
3
+ import { Button } from './components/buttons/Button';
4
+ import { IconButton } from './components/buttons/IconButton';
5
+ import { Accordion } from './components/accordion/Accordion';
6
+ import { Alert } from './components/alert/Alert';
7
+ import { Avatar } from './components/avatar/Avatar';
8
+ import { Badge } from './components/badge/Badge';
9
+ import { Breadcrumb } from './components/breadcrumb/Breadcrumb';
10
+ import { Card } from './components/card/Card';
11
+ import { CardBody } from './components/card/CardBody';
12
+ import { CardFooter } from './components/card/CardFooter';
13
+ import { CardHeader } from './components/card/CardHeader';
14
+ import { Dropdown } from './components/dropdown/Dropdown';
15
+ import { DropdownItem } from './components/dropdown/DropdownItem';
16
+ import { Checkbox } from './components/form/Checkbox';
17
+ import { FileUpload } from './components/form/FileUpload';
18
+ import { Input } from './components/form/Input';
19
+ import { Radio } from './components/form/Radio';
20
+ import { Select } from './components/form/Select';
21
+ import { Switch } from './components/form/Switch';
22
+ import { Textarea } from './components/form/Textarea';
23
+ import { Container } from './components/layout/Container';
24
+ import { Flex } from './components/layout/Flex';
25
+ import { Grid } from './components/layout/Grid';
26
+ import { List } from './components/list/List';
27
+ import { ListItem } from './components/list/ListItem';
28
+ import { Modal } from './components/modal/Modal';
29
+ import { ModalBody } from './components/modal/ModalBody';
30
+ import { ModalFooter } from './components/modal/ModalFooter';
31
+ import { ModalHeader } from './components/modal/ModalHeader';
32
+ import { NavItem } from './components/navigation/NavItem';
33
+ import { Navbar } from './components/navigation/Navbar';
34
+ import { Offcanvas } from './components/offcanvas/Offcanvas';
35
+ import { OffcanvasBody } from './components/offcanvas/OffcanvasBody';
36
+ import { OffcanvasHeader } from './components/offcanvas/OffcanvasHeader';
37
+ import { Pagination } from './components/pagination/Pagination';
38
+ import { ProgressBar } from './components/progress/ProgressBar';
39
+ import { Skeleton } from './components/skeleton/Skeleton';
40
+ import { Slider } from './components/slider/Slider';
41
+ import { RangeSlider } from './components/slider/RangeSlider';
42
+ import { Stepper } from './components/stepper/Stepper';
43
+ import { Table } from './components/table/Table';
44
+ import { TableBody } from './components/table/TableBody';
45
+ import { TableCell } from './components/table/TableCell';
46
+ import { TableHead } from './components/table/TableHead';
47
+ import { TableRow } from './components/table/TableRow';
48
+ import { Tabs } from './components/tabs/Tabs';
49
+ import { Tooltip } from './components/tooltip/Tooltip';
50
+ import { Heading } from './components/typography/Heading';
51
+ import { Text } from './components/typography/Text';
6
52
 
7
- let componentsExports: Record<string, any> = {};
8
-
9
- // Dynamically load the components
10
- loadComponents(componentsPath)
11
- .then((components) => {
12
- components.forEach(({ name, component }: any) => {
13
- if (component) {
14
- // Dynamically assign each component to the componentsExports object
15
- componentsExports[name] = component;
16
- }
17
- });
18
- })
19
- .catch((err) => {
20
- console.error('Error loading components:', err);
21
- });
22
-
23
- // After loading, export all components from the componentsExports object
24
- export { componentsExports };
53
+ // Export all components
54
+ export {
55
+ Button,
56
+ IconButton,
57
+ Accordion,
58
+ Alert,
59
+ Avatar,
60
+ Badge,
61
+ Breadcrumb,
62
+ Card,
63
+ CardBody,
64
+ CardFooter,
65
+ CardHeader,
66
+ Dropdown,
67
+ DropdownItem,
68
+ Checkbox,
69
+ FileUpload,
70
+ Input,
71
+ Radio,
72
+ Select,
73
+ Switch,
74
+ Textarea,
75
+ Container,
76
+ Flex,
77
+ Grid,
78
+ List,
79
+ ListItem,
80
+ Modal,
81
+ ModalBody,
82
+ ModalFooter,
83
+ ModalHeader,
84
+ NavItem,
85
+ Navbar,
86
+ Offcanvas,
87
+ OffcanvasBody,
88
+ OffcanvasHeader,
89
+ Pagination,
90
+ ProgressBar,
91
+ Skeleton,
92
+ Slider,
93
+ RangeSlider,
94
+ Stepper,
95
+ Table,
96
+ TableBody,
97
+ TableCell,
98
+ TableHead,
99
+ TableRow,
100
+ Tabs,
101
+ Tooltip,
102
+ Heading,
103
+ Text
104
+ };
@@ -1 +0,0 @@
1
- export declare const loadComponents: (componentsPath: string) => Promise<any[]>;
@@ -1,36 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
-
4
- // TypeScript type for file and folder entries
5
- type FileOrFolder = fs.Dirent;
6
-
7
- // Dynamically import and load components, returning them for export
8
- export const loadComponents = (componentsPath: string): Promise<any[]> => {
9
- return new Promise((resolve, reject) => {
10
- fs.readdir(componentsPath, { withFileTypes: true }, async (err, files: FileOrFolder[]) => {
11
- if (err) {
12
- reject('Error reading components directory:');
13
- return;
14
- }
15
-
16
- const componentPromises = files.map(async (file) => {
17
- if (file.isDirectory()) {
18
- console.log(`Folder: ${file.name}`);
19
- } else {
20
- console.log(`Importing: ${file.name}`);
21
-
22
- try {
23
- const component = await import(path.join(componentsPath, file.name));
24
- return { name: file.name.replace('.tsx', ''), component };
25
- } catch (error) {
26
- console.error(`Error importing component ${file.name}:`, error);
27
- return null;
28
- }
29
- }
30
- });
31
-
32
- const components = await Promise.all(componentPromises);
33
- resolve(components.filter((comp) => comp !== null));
34
- });
35
- });
36
- };