@i-rent/component-library 0.0.1
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 +180 -0
- package/dist/component-library.js +16457 -0
- package/dist/component-library.umd.cjs +20 -0
- package/nuxt.ts +30 -0
- package/package.json +95 -0
- package/src/scss/_colors.scss +75 -0
- package/src/scss/_themes.scss +69 -0
- package/src/scss/_typography.scss +38 -0
- package/src/scss/_utilities.scss +144 -0
- package/src/scss/_variables.scss +84 -0
- package/src/scss/main.scss +5 -0
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @i-rent/component-library
|
|
2
|
+
|
|
3
|
+
Librería de componentes Vue 3 con doble modo de uso: como componentes Vue normales o como Web Components nativos. Diseñada para ser personalizable sin interferir con estilos externos.
|
|
4
|
+
|
|
5
|
+
## Instalación
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Comandos
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm dev # Servidor de desarrollo
|
|
15
|
+
pnpm storybook # Storybook en puerto 6006
|
|
16
|
+
pnpm build # Type check + build de producción
|
|
17
|
+
pnpm test # Vitest en modo watch
|
|
18
|
+
pnpm test:run # Vitest single run (CI)
|
|
19
|
+
pnpm lint # ESLint con auto-fix
|
|
20
|
+
pnpm type-check # vue-tsc
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Componentes
|
|
24
|
+
|
|
25
|
+
| Componente | Descripción |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `IButton` | Botón con variantes, iconos y tamaños |
|
|
28
|
+
| `IInput` | Campo de texto con validación y estados |
|
|
29
|
+
| `ICalendar` | Calendario con selección de rangos |
|
|
30
|
+
| `IOccupancyCalendar` | Calendario especializado para reservas |
|
|
31
|
+
| `IDatePicker` | Selector de fechas con calendario integrado |
|
|
32
|
+
| `ITooltip` | Tooltip contextual |
|
|
33
|
+
| `IIcon` | Sistema de iconos |
|
|
34
|
+
| `IMap` | Mapa con marcadores, clustering y precios |
|
|
35
|
+
|
|
36
|
+
## Uso
|
|
37
|
+
|
|
38
|
+
### Como plugin Vue
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { ComponentLibrary } from '@i-rent/component-library'
|
|
42
|
+
import '@i-rent/component-library/scss/main'
|
|
43
|
+
|
|
44
|
+
app.use(ComponentLibrary)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Como Web Components
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { defineCustomElements } from '@i-rent/component-library'
|
|
51
|
+
|
|
52
|
+
defineCustomElements() // registra <i-button>, <i-map>, etc.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<i-button label="Hola" variant="outline"></i-button>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Sistema de colores
|
|
60
|
+
|
|
61
|
+
La librería expone un único tema base vía CSS custom properties. Todos los shades del primary se derivan automáticamente usando `oklch` — el consumer solo sobreescribe una variable.
|
|
62
|
+
|
|
63
|
+
### Variables disponibles
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
--i-theme-primary /* color base — el único que necesitás setear */
|
|
67
|
+
|
|
68
|
+
/* shades derivados automáticamente */
|
|
69
|
+
--i-theme-primary-lighten-5
|
|
70
|
+
--i-theme-primary-lighten-4
|
|
71
|
+
--i-theme-primary-lighten-3
|
|
72
|
+
--i-theme-primary-lighten-2
|
|
73
|
+
--i-theme-primary-lighten-1
|
|
74
|
+
--i-theme-primary-darken-1
|
|
75
|
+
--i-theme-primary-darken-2
|
|
76
|
+
--i-theme-primary-darken-3
|
|
77
|
+
--i-theme-primary-darken-4
|
|
78
|
+
|
|
79
|
+
/* tokens fijos */
|
|
80
|
+
--i-theme-success /* #23c197 */
|
|
81
|
+
--i-theme-warning /* #ffc964 */
|
|
82
|
+
--i-theme-error /* #ff3838 */
|
|
83
|
+
--i-theme-disabled /* #a4abb6 */
|
|
84
|
+
--i-font-color
|
|
85
|
+
--i-font-color-shade
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Override del primary
|
|
89
|
+
|
|
90
|
+
Acepta cualquier formato de color válido en CSS:
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
/* Vue component — aplica globalmente */
|
|
94
|
+
:root {
|
|
95
|
+
--i-theme-primary: #e74c3c;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Vue component — aplica solo en un scope */
|
|
99
|
+
.mi-seccion {
|
|
100
|
+
--i-theme-primary: hsl(6 78% 57%);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Web Component */
|
|
104
|
+
i-button {
|
|
105
|
+
--i-theme-primary: oklch(0.63 0.18 26);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Los shades (`lighten-1` a `lighten-5`, `darken-1` a `darken-4`) se recalculan solos en el browser.
|
|
110
|
+
|
|
111
|
+
### Dark mode
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<div data-theme="dark">...</div>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Override de tokens fijos
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
:root {
|
|
121
|
+
--i-theme-success: #00b894;
|
|
122
|
+
--i-theme-error: #d63031;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Personalización SCSS
|
|
127
|
+
|
|
128
|
+
Las variables SASS permiten deshabilitar o modificar modificadores antes de importar los estilos:
|
|
129
|
+
|
|
130
|
+
```scss
|
|
131
|
+
@use '@i-rent/component-library/scss/variables' as * with (
|
|
132
|
+
$i-border-pill: 0, // deshabilitar border pill
|
|
133
|
+
$i-calendar-today-color: #ff0000, // color de hoy en calendario
|
|
134
|
+
$i-font-family: 'Inter', sans-serif,
|
|
135
|
+
$i-font-import-url: null, // deshabilitar import de fuente
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
@use '@i-rent/component-library/scss/main';
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Estructura SCSS
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
src/scss/
|
|
145
|
+
├── main.scss # Punto de entrada
|
|
146
|
+
├── _variables.scss # Variables SASS de modificadores
|
|
147
|
+
├── _colors.scss # CSS custom properties del tema
|
|
148
|
+
├── _typography.scss # Tipografía
|
|
149
|
+
└── _utilities.scss # Clases de utilidad (scrollbar, ripple, etc.)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Estructura de componentes
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
src/stories/i-button/
|
|
156
|
+
├── IButton.vue # Componente (<script setup lang="ts">)
|
|
157
|
+
├── IBtn.scss # Estilos BEM con prefijo .i-btn
|
|
158
|
+
├── _modifiers.scss # Variables SASS sobreescribibles
|
|
159
|
+
├── IButton.stories.ts # Stories CSF
|
|
160
|
+
└── IButton.mdx # Documentación
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Convenciones
|
|
164
|
+
|
|
165
|
+
| Cosa | Patrón | Ejemplo |
|
|
166
|
+
|---|---|---|
|
|
167
|
+
| Clases CSS | `.i-{component}` | `.i-btn`, `.i-btn--outline` |
|
|
168
|
+
| CSS custom properties | `--i-theme-*` | `--i-theme-primary` |
|
|
169
|
+
| Variables SASS | `$i-*` | `$i-btn-outline` |
|
|
170
|
+
| Interface de props | `I{Component}Props` | `IButtonProps` |
|
|
171
|
+
|
|
172
|
+
## Requisitos
|
|
173
|
+
|
|
174
|
+
- Node >= 18
|
|
175
|
+
- pnpm >= 9
|
|
176
|
+
- Browser con soporte de CSS `oklch` relative color syntax (Chrome 119+, Firefox 128+, Safari 16.4+)
|
|
177
|
+
|
|
178
|
+
## IDE
|
|
179
|
+
|
|
180
|
+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar). Deshabilitar Vetur si está instalado.
|