groovinads-ui 1.0.5 → 1.0.6

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groovinads-ui",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "repository": "git@bitbucket.org:groovinads/react-components.git",
@@ -29,8 +29,10 @@
29
29
  "rollup-plugin-peer-deps-external": "^2.2.4",
30
30
  "rollup-plugin-postcss": "^4.0.2",
31
31
  "rollup-plugin-terser": "^7.0.2",
32
+ "rollup-plugin-typescript2": "^0.36.0",
32
33
  "sass": "^1.72.0",
33
34
  "storybook": "^8.0.4",
35
+ "typescript": "^5.4.4",
34
36
  "vite": "^5.2.2"
35
37
  },
36
38
  "peerDependencies": {
package/rollup.config.mjs CHANGED
@@ -3,6 +3,7 @@ import resolve from '@rollup/plugin-node-resolve';
3
3
  import external from 'rollup-plugin-peer-deps-external';
4
4
  import { terser } from 'rollup-plugin-terser';
5
5
  import postcss from 'rollup-plugin-postcss';
6
+ import typescript from 'rollup-plugin-typescript2';
6
7
 
7
8
  export default [
8
9
  {
@@ -28,7 +29,8 @@ export default [
28
29
  presets: ['@babel/preset-react']
29
30
  }),
30
31
  external(),
31
- resolve({extensions: ['.mjs', '.js', '.jsx', '.json']}),
32
+ typescript(), // Añade esto para procesar archivos TypeScript
33
+ resolve({extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json']}),
32
34
  terser(),
33
35
  ]
34
36
  }
@@ -1,21 +1,32 @@
1
1
  import React from 'react';
2
- import * as PropTypes from 'prop-types';
3
2
 
4
- const Button = ({
5
- variant,
6
- size,
7
- onClick,
8
- children,
3
+ type ButtonProps = {
4
+ variant?: 'primary' | 'secondary' | 'terciary' | 'outline';
5
+ size?: 'xs' | 'md' | 'lg';
6
+ onClick?: () => void;
7
+ children: React.ReactNode;
8
+ icon?: string | undefined;
9
+ iconPosition?: 'start' | 'end';
10
+ className?: string;
11
+ style?: 'default' | 'success' | 'danger' | 'warning' | 'link';
12
+ processing?: boolean;
13
+ }
14
+
15
+ const Button = ({
16
+ variant = 'primary',
17
+ size = 'md',
18
+ onClick = () => {},
19
+ children = null,
9
20
  icon,
10
- iconPosition,
11
- className,
12
- style,
13
- processing,
14
- }) => {
21
+ iconPosition = 'start',
22
+ className = '',
23
+ style = 'default',
24
+ processing = false,
25
+ }: ButtonProps) => {
15
26
  let classes = `btn ${className}`;
16
27
 
17
28
  // Variant
18
- if (variant !== 'default') {
29
+ if (variant !== 'primary') {
19
30
  classes += ` btn-${variant}`;
20
31
  }
21
32
 
@@ -63,27 +74,5 @@ const Button = ({
63
74
  );
64
75
  };
65
76
 
66
- Button.propTypes = {
67
- variant: PropTypes.oneOf(['primary', 'secondary', 'terciary', 'outline']),
68
- size: PropTypes.oneOf(['xs', 'md', 'lg']),
69
- onClick: PropTypes.func,
70
- children: PropTypes.node,
71
- icon: PropTypes.node,
72
- iconPosition: PropTypes.oneOf(['start', 'end']),
73
- className: PropTypes.string,
74
- style: PropTypes.oneOf(['default', 'success', 'danger', 'warning', 'link']),
75
- processing: PropTypes.bool,
76
- };
77
-
78
- Button.defaultProps = {
79
- variant: 'primary',
80
- size: 'md',
81
- onClick: null,
82
- icon: null,
83
- iconPosition: 'start',
84
- className: '',
85
- style: 'default',
86
- processing: false,
87
- };
88
77
 
89
78
  export default Button;