levannta-ui 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 +181 -0
- package/dist/components/ui/Button.d.ts +11 -0
- package/dist/components/ui/Button.stories.d.ts +11 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +705 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +31 -0
- package/dist/index.umd.cjs.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +77 -0
package/README.md
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
# Levannta UI
|
2
|
+
|
3
|
+
Una biblioteca de componentes UI moderna construida con React y CSS.
|
4
|
+
|
5
|
+
## Instalación
|
6
|
+
|
7
|
+
### Desde NPM (Recomendado)
|
8
|
+
|
9
|
+
```bash
|
10
|
+
# Si estás usando npm
|
11
|
+
npm install levannta-ui
|
12
|
+
|
13
|
+
# Si estás usando yarn
|
14
|
+
yarn add levannta-ui
|
15
|
+
|
16
|
+
# Si estás usando pnpm
|
17
|
+
pnpm add levannta-ui
|
18
|
+
```
|
19
|
+
|
20
|
+
### Desde GitHub
|
21
|
+
|
22
|
+
Para instalar la biblioteca directamente desde GitHub, agrega lo siguiente a tu `package.json`:
|
23
|
+
|
24
|
+
```json
|
25
|
+
"dependencies": {
|
26
|
+
"levannta-ui": "github:levannta/levannta-ui#main"
|
27
|
+
}
|
28
|
+
```
|
29
|
+
|
30
|
+
O usando la línea de comandos:
|
31
|
+
|
32
|
+
```bash
|
33
|
+
# Si estás usando npm
|
34
|
+
npm install github:levannta/levannta-ui#main
|
35
|
+
|
36
|
+
# Si estás usando yarn
|
37
|
+
yarn add github:levannta/levannta-ui#main
|
38
|
+
|
39
|
+
# Si estás usando pnpm
|
40
|
+
pnpm add github:levannta/levannta-ui#main
|
41
|
+
```
|
42
|
+
|
43
|
+
Puedes también especificar una versión o commit específico cambiando `#main` por `#tag`, `#semver:x.x.x` o el hash de un commit.
|
44
|
+
|
45
|
+
## Uso
|
46
|
+
|
47
|
+
### Importación de componentes
|
48
|
+
|
49
|
+
```jsx
|
50
|
+
import { Button } from 'levannta-ui';
|
51
|
+
import 'levannta-ui/style.css'; // Importar estilos
|
52
|
+
|
53
|
+
function App() {
|
54
|
+
return (
|
55
|
+
<div>
|
56
|
+
<Button>Botón por defecto</Button>
|
57
|
+
<Button variant="outlined" color="primary">Botón con bordes</Button>
|
58
|
+
<Button variant="filled" color="secondary">Botón verde</Button>
|
59
|
+
<Button variant="outlined" color="error">Botón rojo outline</Button>
|
60
|
+
<Button variant="icon" color="primary">👍</Button>
|
61
|
+
<Button pill>Botón redondo</Button>
|
62
|
+
<Button active>Botón activo</Button>
|
63
|
+
<Button size="lg" disabled>Botón grande deshabilitado</Button>
|
64
|
+
</div>
|
65
|
+
);
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
### Variantes disponibles
|
70
|
+
|
71
|
+
El componente Button tiene las siguientes variantes:
|
72
|
+
|
73
|
+
- `filled` (por defecto) - Botón con relleno completo de color
|
74
|
+
- `outlined` - Botón con borde y fondo transparente
|
75
|
+
- `icon` - Botón diseñado para contener solo iconos
|
76
|
+
|
77
|
+
### Colores disponibles
|
78
|
+
|
79
|
+
El componente Button tiene los siguientes colores:
|
80
|
+
|
81
|
+
- `primary` (por defecto) - Color principal (generalmente azul)
|
82
|
+
- `secondary` - Color secundario (generalmente verde)
|
83
|
+
- `error` - Color de error (generalmente rojo)
|
84
|
+
- `clear` - Color neutro (generalmente gris)
|
85
|
+
|
86
|
+
### Propiedades adicionales
|
87
|
+
|
88
|
+
El componente Button tiene las siguientes propiedades adicionales:
|
89
|
+
|
90
|
+
- `pill` - Para botones con bordes completamente redondeados (true/false)
|
91
|
+
- `active` - Para indicar que el botón está activo o seleccionado (true/false)
|
92
|
+
- `disabled` - Para deshabilitar el botón (true/false)
|
93
|
+
|
94
|
+
### Tamaños disponibles
|
95
|
+
|
96
|
+
El componente Button tiene los siguientes tamaños:
|
97
|
+
|
98
|
+
- `md` (por defecto) - Tamaño mediano
|
99
|
+
- `sm` - Tamaño pequeño
|
100
|
+
- `lg` - Tamaño grande
|
101
|
+
- `xl` - Tamaño extra grande
|
102
|
+
|
103
|
+
### API completa del Button
|
104
|
+
|
105
|
+
```tsx
|
106
|
+
<Button
|
107
|
+
variant="filled" // 'filled' | 'outlined' | 'icon'
|
108
|
+
color="primary" // 'primary' | 'secondary' | 'error' | 'clear'
|
109
|
+
size="md" // 'sm' | 'md' | 'lg' | 'xl'
|
110
|
+
pill={false} // boolean (para botones redondos)
|
111
|
+
active={false} // boolean (para botones activos/seleccionados)
|
112
|
+
disabled={false} // boolean
|
113
|
+
className="" // string (para estilos adicionales)
|
114
|
+
onClick={() => {}} // función
|
115
|
+
>
|
116
|
+
Texto del botón
|
117
|
+
</Button>
|
118
|
+
```
|
119
|
+
|
120
|
+
### Uso local (durante desarrollo)
|
121
|
+
|
122
|
+
Para usar la biblioteca localmente en otro proyecto:
|
123
|
+
|
124
|
+
```bash
|
125
|
+
# En el directorio de levannta-ui
|
126
|
+
npm run build
|
127
|
+
```
|
128
|
+
|
129
|
+
Luego, en tu otro proyecto:
|
130
|
+
|
131
|
+
```json
|
132
|
+
// package.json del otro proyecto
|
133
|
+
{
|
134
|
+
"dependencies": {
|
135
|
+
"levannta-ui": "file:../path/to/levannta-ui"
|
136
|
+
}
|
137
|
+
}
|
138
|
+
```
|
139
|
+
|
140
|
+
Ejecuta `npm install` y luego importa los componentes como se muestra arriba.
|
141
|
+
|
142
|
+
## Documentación con Storybook
|
143
|
+
|
144
|
+
Puedes ver todos los componentes y sus variantes en nuestro Storybook, disponible en Google Cloud Run. El despliegue se realiza automáticamente a través de GitHub Actions.
|
145
|
+
|
146
|
+
### URLs de Storybook
|
147
|
+
|
148
|
+
- **Producción**: [https://storybook-levannta-ui-XXXXX.run.app](https://storybook-levannta-ui-XXXXX.run.app) (automáticamente desplegado desde la rama `main`)
|
149
|
+
- **Previews de PRs**: Cada Pull Request recibe un URL único para probar los cambios (disponible en los comentarios del PR)
|
150
|
+
|
151
|
+
### Configuración del despliegue
|
152
|
+
|
153
|
+
Los archivos de configuración para el despliegue de Storybook se encuentran en:
|
154
|
+
- `.docker/storybook/` - Configuración de Docker y nginx
|
155
|
+
- `.github/workflows/` - Workflows de GitHub Actions
|
156
|
+
|
157
|
+
Consulta `.docker/storybook/README.md` para más detalles sobre la configuración y requisitos.
|
158
|
+
|
159
|
+
## Desarrollo
|
160
|
+
|
161
|
+
Para ejecutar el servidor de desarrollo:
|
162
|
+
|
163
|
+
```bash
|
164
|
+
npm run dev
|
165
|
+
```
|
166
|
+
|
167
|
+
Para ejecutar Storybook localmente:
|
168
|
+
|
169
|
+
```bash
|
170
|
+
npm run storybook
|
171
|
+
```
|
172
|
+
|
173
|
+
Para construir la biblioteca:
|
174
|
+
|
175
|
+
```bash
|
176
|
+
npm run build
|
177
|
+
```
|
178
|
+
|
179
|
+
## Licencia
|
180
|
+
|
181
|
+
MIT
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
3
|
+
import './Button.css';
|
4
|
+
declare const buttonVariants: (props?: ({
|
5
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
6
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
7
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
8
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
9
|
+
}
|
10
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
11
|
+
export { Button, buttonVariants };
|
@@ -0,0 +1,11 @@
|
|
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 Button>;
|
6
|
+
export declare const Default: Story;
|
7
|
+
export declare const Secondary: Story;
|
8
|
+
export declare const Destructive: Story;
|
9
|
+
export declare const Outline: Story;
|
10
|
+
export declare const Ghost: Story;
|
11
|
+
export declare const Link: Story;
|
package/dist/index.css
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.button{display:inline-flex;align-items:center;justify-content:center;border-radius:.375rem;font-size:.875rem;font-weight:500;transition:all .2s;outline:none;cursor:pointer;border:none}.button:focus-visible{outline:2px solid hsl(221.2 83.2% 53.3%);outline-offset:2px}.button:disabled{opacity:.5;pointer-events:none}.button-default{background-color:#2563eb;color:#fff}.button-default:hover{background-color:#2563ebe6}.button-destructive{background-color:#ef4444;color:#f8fafc}.button-destructive:hover{background-color:#ef4444e6}.button-outline{border:1px solid hsl(214.3 31.8% 91.4%);background-color:#fff}.button-outline:hover,.button-secondary{background-color:#f1f5f9;color:#0f172a}.button-secondary:hover{background-color:#f1f5f9cc}.button-ghost:hover{background-color:#f1f5f9;color:#0f172a}.button-link{color:#2563eb;text-decoration:none}.button-link:hover{text-decoration:underline;text-underline-offset:4px}.button-size-default{height:2.5rem;padding:.5rem 1rem}.button-size-sm{height:2.25rem;padding:0 .75rem;border-radius:.375rem}.button-size-lg{height:2.75rem;padding:0 2rem;border-radius:.375rem}
|
package/dist/index.d.ts
ADDED