mg-library 1.0.659 → 1.0.661

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.
Files changed (2) hide show
  1. package/components.js +36 -7
  2. package/package.json +1 -1
package/components.js CHANGED
@@ -59,14 +59,37 @@ export function MGCard({ children, header = null, footer = null, style = {}, ...
59
59
  );
60
60
  }
61
61
 
62
- export function MGButton({ title, icon, callback, ...props }) {
62
+ export function MGButton({
63
+ title,
64
+ icon,
65
+ callback,
66
+ variant = 'solid',
67
+ action = 'primary',
68
+ isDisabled,
69
+ disabled,
70
+ isLoading,
71
+ style,
72
+ textProps = {},
73
+ ...rest
74
+ }) {
75
+ const effectiveDisabled = !!(isDisabled || disabled || isLoading);
76
+ const isSolid = variant === 'solid' || variant === 'filled';
77
+ const gsVariant = variant === 'ghost' ? 'link' : variant; // mapeo opcional
78
+ const textColor = isSolid ? '$white' : `$${action}700`;
79
+ const iconColor = textColor;
80
+ const bgColor = isSolid ? `$${action}500` : 'transparent';
81
+ const borderColor = isSolid ? `$${action}500` : `$${action}500`;
63
82
  return (
64
83
  <Button
65
- action="primary"
66
- variant="solid"
67
- py="$4"
84
+ action={action}
85
+ variant={gsVariant}
86
+ isDisabled={effectiveDisabled}
68
87
  onPress={callback}
69
- {...props}
88
+ py="$4"
89
+ bg={bgColor}
90
+ borderColor={borderColor}
91
+ style={[!effectiveDisabled && { opacity: 1 }, style]}
92
+ {...rest}
70
93
  >
71
94
  {icon ? (
72
95
  <ButtonIcon
@@ -74,11 +97,17 @@ export function MGButton({ title, icon, callback, ...props }) {
74
97
  asIcon={MaterialCommunityIcons}
75
98
  name={icon}
76
99
  mr="$2"
77
- color="$white"
100
+ color={iconColor}
78
101
  />
79
102
  ) : null}
80
103
  {title ? (
81
- <ButtonText color="$white">
104
+ <ButtonText
105
+ color={textColor}
106
+ size="md"
107
+ fontWeight="$semibold"
108
+ textTransform="none"
109
+ {...textProps}
110
+ >
82
111
  {title}
83
112
  </ButtonText>
84
113
  ) : null}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.659",
3
+ "version": "1.0.661",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {