my-animated-components 1.2.1 → 1.2.2
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 +31 -44
- package/package.json +1 -1
- package/tailwind.config.js +1 -1
package/dist/index.js
CHANGED
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
3
3
|
|
|
4
|
-
function styleInject(css, ref) {
|
|
5
|
-
if ( ref === undefined ) ref = {};
|
|
6
|
-
var insertAt = ref.insertAt;
|
|
7
|
-
|
|
8
|
-
if (typeof document === 'undefined') { return; }
|
|
9
|
-
|
|
10
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
11
|
-
var style = document.createElement('style');
|
|
12
|
-
style.type = 'text/css';
|
|
13
|
-
|
|
14
|
-
if (insertAt === 'top') {
|
|
15
|
-
if (head.firstChild) {
|
|
16
|
-
head.insertBefore(style, head.firstChild);
|
|
17
|
-
} else {
|
|
18
|
-
head.appendChild(style);
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
head.appendChild(style);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (style.styleSheet) {
|
|
25
|
-
style.styleSheet.cssText = css;
|
|
26
|
-
} else {
|
|
27
|
-
style.appendChild(document.createTextNode(css));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var css_248z = "@tailwind base;\r\n@tailwind components;\r\n@tailwind utilities;\r\n";
|
|
32
|
-
styleInject(css_248z);
|
|
33
|
-
|
|
34
4
|
const motionVariants = {
|
|
35
5
|
null: {},
|
|
36
6
|
fadeIn: {
|
|
@@ -675,22 +645,39 @@ const Avatar = ({ className = '', size = 'md', src, alt, initials }) => {
|
|
|
675
645
|
|
|
676
646
|
const Badge = ({ children, className = '', color = 'primary', size = 'md', motionVariant = 'fadeIn', // Default motion variant
|
|
677
647
|
}) => {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
648
|
+
// Define the colors
|
|
649
|
+
const colorStyles = {
|
|
650
|
+
primary: '#E0F7FA', // bg-blue-100
|
|
651
|
+
secondary: '#F1F1F1', // bg-gray-100
|
|
652
|
+
success: '#E8F5E9', // bg-green-100
|
|
653
|
+
danger: '#FFEBEE', // bg-red-100
|
|
654
|
+
warning: '#FFFDE7', // bg-yellow-100
|
|
655
|
+
info: '#E8EAF6', // bg-indigo-100
|
|
685
656
|
};
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
657
|
+
const textColor = {
|
|
658
|
+
primary: '#00796B', // text-blue-800
|
|
659
|
+
secondary: '#757575', // text-gray-800
|
|
660
|
+
success: '#388E3C', // text-green-800
|
|
661
|
+
danger: '#C62828', // text-red-800
|
|
662
|
+
warning: '#FBC02D', // text-yellow-800
|
|
663
|
+
info: '#1976D2', // text-indigo-800
|
|
664
|
+
};
|
|
665
|
+
// Define the sizes
|
|
666
|
+
const sizeStyles = {
|
|
667
|
+
xs: { padding: '0.125rem 0.5rem', fontSize: '0.75rem' },
|
|
668
|
+
sm: { padding: '0.25rem 0.75rem', fontSize: '0.875rem' },
|
|
669
|
+
md: { padding: '0.375rem 1rem', fontSize: '1rem' },
|
|
670
|
+
lg: { padding: '0.5rem 1.25rem', fontSize: '1.125rem' },
|
|
671
|
+
xl: { padding: '0.625rem 1.5rem', fontSize: '1.25rem' },
|
|
672
|
+
};
|
|
673
|
+
// Generate custom styles dynamically
|
|
674
|
+
const customStyle = {
|
|
675
|
+
backgroundColor: colorStyles[color] || colorStyles.primary,
|
|
676
|
+
color: textColor[color] || textColor.primary,
|
|
677
|
+
padding: sizeStyles[size].padding,
|
|
678
|
+
fontSize: sizeStyles[size].fontSize,
|
|
692
679
|
};
|
|
693
|
-
return (React.createElement(motion.span, { className: `inline-flex items-center font-medium rounded-full ${
|
|
680
|
+
return (React.createElement(motion.span, { className: `inline-flex items-center font-medium rounded-full ${className}`, style: customStyle, variants: motionVariants[motionVariant], initial: "hidden", animate: "visible", exit: "hidden", transition: { duration: 0.3 } }, children));
|
|
694
681
|
};
|
|
695
682
|
|
|
696
683
|
const Breadcrumb = ({ className = '', items, motionVariant = 'fadeIn' }) => {
|
package/package.json
CHANGED