@sector.siit/mlz-components 1.0.0
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/README.md +206 -0
- package/dist/components/Button/Button.d.ts +18 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.stories.d.ts +16 -0
- package/dist/components/Button/Button.stories.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +1408 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +1410 -0
- package/dist/index.js.map +1 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# MLZ Components
|
|
2
|
+
|
|
3
|
+
Una librería moderna de componentes React con Tailwind CSS y variables CSS customizables.
|
|
4
|
+
|
|
5
|
+
## 🚀 Características
|
|
6
|
+
|
|
7
|
+
- ⚛️ **React 18** - Componentes modernos con TypeScript
|
|
8
|
+
- 🎨 **Tailwind CSS** - Sistema de diseño utility-first
|
|
9
|
+
- 🎯 **Variables CSS** - Personalización completa desde tu proyecto
|
|
10
|
+
- 📚 **Storybook** - Documentación interactiva
|
|
11
|
+
- 📦 **Tree-shakeable** - Importa solo lo que necesitas
|
|
12
|
+
- 🔧 **TypeScript** - Tipado completo
|
|
13
|
+
- ✅ **Probado** - Tests unitarios incluidos
|
|
14
|
+
|
|
15
|
+
## 📦 Instalación
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @sector.siit/mlz-components
|
|
19
|
+
# o
|
|
20
|
+
yarn add @sector.siit/mlz-components
|
|
21
|
+
# o
|
|
22
|
+
bun add @sector.siit/mlz-components
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 🎯 Uso Básico
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Button } from '@sector.siit/mlz-components';
|
|
29
|
+
|
|
30
|
+
function App() {
|
|
31
|
+
return (
|
|
32
|
+
<Button variant="primary" size="md">
|
|
33
|
+
¡Hola Mundo!
|
|
34
|
+
</Button>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 🎨 Personalización con Variables CSS
|
|
40
|
+
|
|
41
|
+
La librería utiliza variables CSS que puedes sobrescribir en tu proyecto:
|
|
42
|
+
|
|
43
|
+
```css
|
|
44
|
+
/* En tu archivo CSS global */
|
|
45
|
+
:root {
|
|
46
|
+
/* Colores primarios */
|
|
47
|
+
--mlz-primary-500: #10b981;
|
|
48
|
+
--mlz-primary-600: #059669;
|
|
49
|
+
--mlz-primary-700: #047857;
|
|
50
|
+
|
|
51
|
+
/* Espaciado */
|
|
52
|
+
--mlz-spacing-sm: 0.75rem;
|
|
53
|
+
--mlz-spacing-md: 1.25rem;
|
|
54
|
+
--mlz-spacing-lg: 2rem;
|
|
55
|
+
|
|
56
|
+
/* Border radius */
|
|
57
|
+
--mlz-border-radius-md: 0.5rem;
|
|
58
|
+
|
|
59
|
+
/* Tamaños de fuente */
|
|
60
|
+
--mlz-font-size-base: 1.125rem;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Variables Disponibles
|
|
65
|
+
|
|
66
|
+
#### Colores
|
|
67
|
+
- `--mlz-primary-[50-950]`: Paleta de colores primarios
|
|
68
|
+
- `--mlz-secondary-[50-950]`: Paleta de colores secundarios
|
|
69
|
+
|
|
70
|
+
#### Espaciado
|
|
71
|
+
- `--mlz-spacing-xs`: 0.25rem (por defecto)
|
|
72
|
+
- `--mlz-spacing-sm`: 0.5rem (por defecto)
|
|
73
|
+
- `--mlz-spacing-md`: 1rem (por defecto)
|
|
74
|
+
- `--mlz-spacing-lg`: 1.5rem (por defecto)
|
|
75
|
+
- `--mlz-spacing-xl`: 2rem (por defecto)
|
|
76
|
+
- `--mlz-spacing-2xl`: 3rem (por defecto)
|
|
77
|
+
|
|
78
|
+
#### Border Radius
|
|
79
|
+
- `--mlz-border-radius-sm`: 0.25rem (por defecto)
|
|
80
|
+
- `--mlz-border-radius-md`: 0.375rem (por defecto)
|
|
81
|
+
- `--mlz-border-radius-lg`: 0.5rem (por defecto)
|
|
82
|
+
- `--mlz-border-radius-xl`: 0.75rem (por defecto)
|
|
83
|
+
|
|
84
|
+
#### Tamaños de Fuente
|
|
85
|
+
- `--mlz-font-size-xs`: 0.75rem (por defecto)
|
|
86
|
+
- `--mlz-font-size-sm`: 0.875rem (por defecto)
|
|
87
|
+
- `--mlz-font-size-base`: 1rem (por defecto)
|
|
88
|
+
- `--mlz-font-size-lg`: 1.125rem (por defecto)
|
|
89
|
+
- `--mlz-font-size-xl`: 1.25rem (por defecto)
|
|
90
|
+
|
|
91
|
+
## 📚 Componentes
|
|
92
|
+
|
|
93
|
+
### Button
|
|
94
|
+
|
|
95
|
+
Un componente de botón versatil con múltiples variantes y tamaños.
|
|
96
|
+
|
|
97
|
+
#### Props
|
|
98
|
+
|
|
99
|
+
| Prop | Tipo | Default | Descripción |
|
|
100
|
+
|------|------|---------|-------------|
|
|
101
|
+
| `variant` | `'primary' \| 'secondary' \| 'outline' \| 'ghost'` | `'primary'` | Variante visual del botón |
|
|
102
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Tamaño del botón |
|
|
103
|
+
| `children` | `React.ReactNode` | - | Contenido del botón |
|
|
104
|
+
| `disabled` | `boolean` | `false` | Estado deshabilitado |
|
|
105
|
+
| `onClick` | `(event: MouseEvent) => void` | - | Función de click |
|
|
106
|
+
|
|
107
|
+
#### Ejemplos
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
// Variantes
|
|
111
|
+
<Button variant="primary">Primario</Button>
|
|
112
|
+
<Button variant="secondary">Secundario</Button>
|
|
113
|
+
<Button variant="outline">Outline</Button>
|
|
114
|
+
<Button variant="ghost">Ghost</Button>
|
|
115
|
+
|
|
116
|
+
// Tamaños
|
|
117
|
+
<Button size="sm">Pequeño</Button>
|
|
118
|
+
<Button size="md">Mediano</Button>
|
|
119
|
+
<Button size="lg">Grande</Button>
|
|
120
|
+
|
|
121
|
+
// Estados
|
|
122
|
+
<Button disabled>Deshabilitado</Button>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 🛠️ Desarrollo
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# Instalar dependencias
|
|
129
|
+
npm install
|
|
130
|
+
|
|
131
|
+
# Desarrollo con Storybook
|
|
132
|
+
npm run storybook
|
|
133
|
+
|
|
134
|
+
# Build de la librería
|
|
135
|
+
npm run build
|
|
136
|
+
|
|
137
|
+
# Lint
|
|
138
|
+
npm run lint
|
|
139
|
+
|
|
140
|
+
# Type check
|
|
141
|
+
npm run typecheck
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 🚀 Despliegue
|
|
145
|
+
|
|
146
|
+
El proyecto incluye GitHub Actions para:
|
|
147
|
+
|
|
148
|
+
1. **Despliegue automático a NPM** cuando cambia la versión en `package.json`
|
|
149
|
+
2. **Despliegue de Storybook a GitHub Pages** en cada push a main
|
|
150
|
+
|
|
151
|
+
### Configuración necesaria:
|
|
152
|
+
|
|
153
|
+
1. **NPM Token**: Añade `NPM_TOKEN` a los secrets de GitHub
|
|
154
|
+
2. **GitHub Pages**: Habilita GitHub Pages en la configuración del repositorio
|
|
155
|
+
|
|
156
|
+
## 📄 Licencia
|
|
157
|
+
|
|
158
|
+
MIT
|
|
159
|
+
|
|
160
|
+
## 🚀 Release Process
|
|
161
|
+
|
|
162
|
+
### 📦 Stable Releases (main branch)
|
|
163
|
+
Cuando haces push a `main` con una nueva versión en `package.json`:
|
|
164
|
+
1. **Publicación automática** a NPM como `@sector.siit/mlz-components`
|
|
165
|
+
2. **GitHub Release** creado con tag (`v1.0.0`, `v1.0.1`, etc.)
|
|
166
|
+
3. **Storybook** desplegado a GitHub Pages
|
|
167
|
+
4. **Release notes** generadas automáticamente
|
|
168
|
+
|
|
169
|
+
### 🧪 Release Candidates (develop branch)
|
|
170
|
+
Cuando haces push a `develop`:
|
|
171
|
+
1. **Release Candidate** creado con timestamp (`v1.0.0-rc.202408071234`)
|
|
172
|
+
2. **Artifacts incluidos**: dist files + Storybook build
|
|
173
|
+
3. **Pre-release** marcado para testing
|
|
174
|
+
4. **NO se publica** a NPM (solo para testing)
|
|
175
|
+
|
|
176
|
+
### 🔄 Workflow de desarrollo:
|
|
177
|
+
```bash
|
|
178
|
+
# Para nuevas features
|
|
179
|
+
git checkout develop
|
|
180
|
+
# ... desarrolla tu feature ...
|
|
181
|
+
git push origin develop # ✨ Crea RC automáticamente
|
|
182
|
+
|
|
183
|
+
# Para release estable
|
|
184
|
+
git checkout main
|
|
185
|
+
git merge develop
|
|
186
|
+
# Actualiza version en package.json
|
|
187
|
+
git push origin main # 🚀 Publica a NPM + GitHub Release
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## 🤝 Contribuir
|
|
191
|
+
|
|
192
|
+
1. Fork el proyecto
|
|
193
|
+
2. Crea una rama para tu feature desde `develop` (`git checkout -b feature/AmazingFeature`)
|
|
194
|
+
3. Commit tus cambios (`git commit -m 'Add some AmazingFeature'`)
|
|
195
|
+
4. Push a tu rama (`git push origin feature/AmazingFeature`)
|
|
196
|
+
5. Abre un Pull Request hacia `develop`
|
|
197
|
+
|
|
198
|
+
## 📈 Roadmap
|
|
199
|
+
|
|
200
|
+
- [ ] Componente Input
|
|
201
|
+
- [ ] Componente Card
|
|
202
|
+
- [ ] Componente Modal
|
|
203
|
+
- [ ] Componente Dropdown
|
|
204
|
+
- [ ] Sistema de themes predefenidos
|
|
205
|
+
- [ ] Componentes de formulario
|
|
206
|
+
- [ ] Componentes de navegación
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Contenido del botón
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Variante del botón
|
|
9
|
+
*/
|
|
10
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
11
|
+
/**
|
|
12
|
+
* Tamaño del botón
|
|
13
|
+
*/
|
|
14
|
+
size?: 'sm' | 'md' | 'lg';
|
|
15
|
+
}
|
|
16
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
17
|
+
export default Button;
|
|
18
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IAChF;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IACxD;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC3B;AAeD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4BxC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
declare const meta: Meta<typeof Button>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
export declare const Secondary: Story;
|
|
8
|
+
export declare const Outline: Story;
|
|
9
|
+
export declare const Ghost: Story;
|
|
10
|
+
export declare const Small: Story;
|
|
11
|
+
export declare const Medium: Story;
|
|
12
|
+
export declare const Large: Story;
|
|
13
|
+
export declare const Disabled: Story;
|
|
14
|
+
export declare const AllVariants: Story;
|
|
15
|
+
export declare const CustomColors: Story;
|
|
16
|
+
//# sourceMappingURL=Button.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAgC7B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAKpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAmBzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAgC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Contenido del botón
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Variante del botón
|
|
10
|
+
*/
|
|
11
|
+
variant?: 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
12
|
+
/**
|
|
13
|
+
* Tamaño del botón
|
|
14
|
+
*/
|
|
15
|
+
size?: 'sm' | 'md' | 'lg';
|
|
16
|
+
}
|
|
17
|
+
declare const Button: React.FC<ButtonProps>;
|
|
18
|
+
|
|
19
|
+
export { Button };
|
|
20
|
+
export type { ButtonProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,CAAC;AAGtB,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|