@iaclinical/components 1.0.0 → 1.0.2
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 +389 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
# @iaclinical/components
|
|
2
|
+
|
|
3
|
+
Librería de componentes Vue 3 del IAclinical Design System, construida con Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
## 📦 Instalación
|
|
6
|
+
|
|
7
|
+
### Usando pnpm (Recomendado)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @iaclinical/components @iaclinical/tailwind-preset
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Usando npm
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @iaclinical/components @iaclinical/tailwind-preset
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Usando yarn
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
yarn add @iaclinical/components @iaclinical/tailwind-preset
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## ⚙️ Configuración
|
|
26
|
+
|
|
27
|
+
### 1. Configurar Tailwind CSS
|
|
28
|
+
|
|
29
|
+
Crea o actualiza tu `tailwind.config.js`:
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
import iaclinicalPreset from "@iaclinical/tailwind-preset";
|
|
33
|
+
|
|
34
|
+
/** @type {import('tailwindcss').Config} */
|
|
35
|
+
export default {
|
|
36
|
+
presets: [iaclinicalPreset],
|
|
37
|
+
content: [
|
|
38
|
+
"./index.html",
|
|
39
|
+
"./src/**/*.{vue,js,ts,jsx,tsx}",
|
|
40
|
+
"./node_modules/@iaclinical/components/**/*.{js,ts,vue}",
|
|
41
|
+
],
|
|
42
|
+
theme: {
|
|
43
|
+
extend: {},
|
|
44
|
+
},
|
|
45
|
+
plugins: [],
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Importar estilos
|
|
50
|
+
|
|
51
|
+
En tu archivo principal (ej. `main.ts` o `main.js`):
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { createApp } from "vue";
|
|
55
|
+
import App from "./App.vue";
|
|
56
|
+
|
|
57
|
+
// Importar estilos de la librería
|
|
58
|
+
import "@iaclinical/components/style.css";
|
|
59
|
+
|
|
60
|
+
createApp(App).mount("#app");
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 🚀 Uso Básico
|
|
64
|
+
|
|
65
|
+
### Importación de Componentes
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<script setup lang="ts">
|
|
69
|
+
import { Button, Card, Dialog, AppBar } from "@iaclinical/components";
|
|
70
|
+
import { ref } from "vue";
|
|
71
|
+
|
|
72
|
+
const isDialogOpen = ref(false);
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<div>
|
|
77
|
+
<!-- Button -->
|
|
78
|
+
<Button variant="primary" size="md"> Click me </Button>
|
|
79
|
+
|
|
80
|
+
<!-- Card -->
|
|
81
|
+
<Card title="Card Title" subtitle="Card subtitle">
|
|
82
|
+
<p>Card content goes here</p>
|
|
83
|
+
</Card>
|
|
84
|
+
|
|
85
|
+
<!-- Dialog -->
|
|
86
|
+
<Button @click="isDialogOpen = true"> Open Dialog </Button>
|
|
87
|
+
<Dialog
|
|
88
|
+
v-model:open="isDialogOpen"
|
|
89
|
+
title="Dialog Title"
|
|
90
|
+
description="Dialog description"
|
|
91
|
+
>
|
|
92
|
+
<p>Dialog content</p>
|
|
93
|
+
</Dialog>
|
|
94
|
+
</div>
|
|
95
|
+
</template>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 📚 Componentes Disponibles
|
|
99
|
+
|
|
100
|
+
### Button
|
|
101
|
+
|
|
102
|
+
Botón versátil con múltiples variantes y tamaños.
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<template>
|
|
106
|
+
<!-- Variantes -->
|
|
107
|
+
<Button variant="primary">Primary</Button>
|
|
108
|
+
<Button variant="secondary">Secondary</Button>
|
|
109
|
+
<Button variant="outline">Outline</Button>
|
|
110
|
+
<Button variant="ghost">Ghost</Button>
|
|
111
|
+
<Button variant="danger">Danger</Button>
|
|
112
|
+
|
|
113
|
+
<!-- Tamaños -->
|
|
114
|
+
<Button size="sm">Small</Button>
|
|
115
|
+
<Button size="md">Medium</Button>
|
|
116
|
+
<Button size="lg">Large</Button>
|
|
117
|
+
|
|
118
|
+
<!-- Con badge (para variant="icon") -->
|
|
119
|
+
<Button variant="icon" :badge="5" aria-label="Notifications">
|
|
120
|
+
<BellIcon class="w-5 h-5" />
|
|
121
|
+
</Button>
|
|
122
|
+
|
|
123
|
+
<!-- Deshabilitado -->
|
|
124
|
+
<Button disabled>Disabled</Button>
|
|
125
|
+
</template>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Props:**
|
|
129
|
+
|
|
130
|
+
- `variant`: `'primary' | 'secondary' | 'outline' | 'ghost' | 'danger' | 'icon'`
|
|
131
|
+
- `size`: `'sm' | 'md' | 'lg'`
|
|
132
|
+
- `radius`: `'full' | 'xl' | 'lg' | 'md' | 'sm' | 'none'`
|
|
133
|
+
- `disabled`: `boolean`
|
|
134
|
+
- `badge`: `number` (solo para variant="icon")
|
|
135
|
+
- `ariaLabel`: `string`
|
|
136
|
+
|
|
137
|
+
### AppBar
|
|
138
|
+
|
|
139
|
+
Barra de navegación flexible con slots personalizables.
|
|
140
|
+
|
|
141
|
+
```vue
|
|
142
|
+
<template>
|
|
143
|
+
<AppBar variant="default">
|
|
144
|
+
<template #left>
|
|
145
|
+
<Button variant="icon" @click="toggleMenu">
|
|
146
|
+
<MenuIcon class="w-6 h-6" />
|
|
147
|
+
</Button>
|
|
148
|
+
</template>
|
|
149
|
+
|
|
150
|
+
<template #center>
|
|
151
|
+
<h1 class="text-lg font-semibold">My App</h1>
|
|
152
|
+
</template>
|
|
153
|
+
|
|
154
|
+
<template #right>
|
|
155
|
+
<Button variant="icon" :badge="3">
|
|
156
|
+
<BellIcon class="w-5 h-5" />
|
|
157
|
+
</Button>
|
|
158
|
+
<Select v-model="selectedUser" :options="userOptions" />
|
|
159
|
+
</template>
|
|
160
|
+
</AppBar>
|
|
161
|
+
</template>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Props:**
|
|
165
|
+
|
|
166
|
+
- `variant`: `'default' | 'dark' | 'light'`
|
|
167
|
+
|
|
168
|
+
**Slots:**
|
|
169
|
+
|
|
170
|
+
- `left`: Contenido izquierdo
|
|
171
|
+
- `center`: Contenido central
|
|
172
|
+
- `right`: Contenido derecho
|
|
173
|
+
|
|
174
|
+
**Events:**
|
|
175
|
+
|
|
176
|
+
- `menu-toggle`: Emitido al hacer clic en el área del menú
|
|
177
|
+
|
|
178
|
+
### Card
|
|
179
|
+
|
|
180
|
+
Contenedor de contenido con título y subtítulo opcionales.
|
|
181
|
+
|
|
182
|
+
```vue
|
|
183
|
+
<template>
|
|
184
|
+
<Card title="Card Title" subtitle="Optional subtitle" padding="md">
|
|
185
|
+
<p>Your content here</p>
|
|
186
|
+
|
|
187
|
+
<template #actions>
|
|
188
|
+
<Button size="sm">Action</Button>
|
|
189
|
+
</template>
|
|
190
|
+
</Card>
|
|
191
|
+
</template>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Props:**
|
|
195
|
+
|
|
196
|
+
- `title`: `string`
|
|
197
|
+
- `subtitle`: `string`
|
|
198
|
+
- `padding`: `'none' | 'sm' | 'md' | 'lg'`
|
|
199
|
+
|
|
200
|
+
### Dialog
|
|
201
|
+
|
|
202
|
+
Modal/diálogo con overlay y animaciones.
|
|
203
|
+
|
|
204
|
+
```vue
|
|
205
|
+
<script setup>
|
|
206
|
+
import { ref } from "vue";
|
|
207
|
+
|
|
208
|
+
const isOpen = ref(false);
|
|
209
|
+
</script>
|
|
210
|
+
|
|
211
|
+
<template>
|
|
212
|
+
<Dialog
|
|
213
|
+
v-model:open="isOpen"
|
|
214
|
+
title="Confirm Action"
|
|
215
|
+
description="Are you sure you want to proceed?"
|
|
216
|
+
>
|
|
217
|
+
<div class="flex gap-2 justify-end mt-4">
|
|
218
|
+
<Button variant="ghost" @click="isOpen = false"> Cancel </Button>
|
|
219
|
+
<Button variant="primary" @click="handleConfirm"> Confirm </Button>
|
|
220
|
+
</div>
|
|
221
|
+
</Dialog>
|
|
222
|
+
</template>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Props:**
|
|
226
|
+
|
|
227
|
+
- `open`: `boolean` (v-model)
|
|
228
|
+
- `title`: `string`
|
|
229
|
+
- `description`: `string`
|
|
230
|
+
|
|
231
|
+
### Select
|
|
232
|
+
|
|
233
|
+
Selector con opciones y acciones personalizables.
|
|
234
|
+
|
|
235
|
+
```vue
|
|
236
|
+
<script setup>
|
|
237
|
+
import { ref } from "vue";
|
|
238
|
+
|
|
239
|
+
const selected = ref("");
|
|
240
|
+
const options = [
|
|
241
|
+
{ label: "Option 1", value: "1" },
|
|
242
|
+
{ label: "Option 2", value: "2" },
|
|
243
|
+
];
|
|
244
|
+
const actions = [{ label: "Logout", action: () => console.log("logout") }];
|
|
245
|
+
</script>
|
|
246
|
+
|
|
247
|
+
<template>
|
|
248
|
+
<Select
|
|
249
|
+
v-model="selected"
|
|
250
|
+
:options="options"
|
|
251
|
+
:actions="actions"
|
|
252
|
+
placeholder="Select an option"
|
|
253
|
+
/>
|
|
254
|
+
</template>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Props:**
|
|
258
|
+
|
|
259
|
+
- `modelValue`: `string | number`
|
|
260
|
+
- `options`: `SelectOption[]`
|
|
261
|
+
- `actions`: `ActionItem[]`
|
|
262
|
+
- `placeholder`: `string`
|
|
263
|
+
- `size`: `'sm' | 'md' | 'lg'`
|
|
264
|
+
- `disabled`: `boolean`
|
|
265
|
+
|
|
266
|
+
### Table
|
|
267
|
+
|
|
268
|
+
Tabla de datos con soporte para paginación y acciones.
|
|
269
|
+
|
|
270
|
+
```vue
|
|
271
|
+
<script setup>
|
|
272
|
+
const columns = [
|
|
273
|
+
{ key: "name", label: "Name" },
|
|
274
|
+
{ key: "email", label: "Email" },
|
|
275
|
+
{ key: "role", label: "Role" },
|
|
276
|
+
];
|
|
277
|
+
|
|
278
|
+
const data = [
|
|
279
|
+
{ id: 1, name: "John Doe", email: "john@example.com", role: "Admin" },
|
|
280
|
+
{ id: 2, name: "Jane Smith", email: "jane@example.com", role: "User" },
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
const handleEdit = (row) => console.log("Edit", row);
|
|
284
|
+
const handleDelete = (row) => console.log("Delete", row);
|
|
285
|
+
</script>
|
|
286
|
+
|
|
287
|
+
<template>
|
|
288
|
+
<Table
|
|
289
|
+
:columns="columns"
|
|
290
|
+
:data="data"
|
|
291
|
+
:actions="[
|
|
292
|
+
{ label: 'Edit', handler: handleEdit },
|
|
293
|
+
{ label: 'Delete', handler: handleDelete },
|
|
294
|
+
]"
|
|
295
|
+
/>
|
|
296
|
+
</template>
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Otros Componentes
|
|
300
|
+
|
|
301
|
+
- **FileUpload**: Carga de archivos con drag & drop
|
|
302
|
+
- **Loader**: Indicador de carga
|
|
303
|
+
- **Tabs**: Navegación por pestañas
|
|
304
|
+
- **Text**: Texto con estilos predefinidos
|
|
305
|
+
|
|
306
|
+
## 📖 Documentación Completa
|
|
307
|
+
|
|
308
|
+
Para ver la documentación completa con ejemplos interactivos, visita:
|
|
309
|
+
|
|
310
|
+
```bash
|
|
311
|
+
# Clonar el repositorio
|
|
312
|
+
git clone https://github.com/iaclinical/design-system.git
|
|
313
|
+
|
|
314
|
+
# Instalar dependencias
|
|
315
|
+
pnpm install
|
|
316
|
+
|
|
317
|
+
# Ejecutar la documentación
|
|
318
|
+
pnpm --filter @iaclinical/docs dev
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## 🎨 Personalización
|
|
322
|
+
|
|
323
|
+
### Colores del Tema
|
|
324
|
+
|
|
325
|
+
El preset de Tailwind incluye los colores del sistema de diseño:
|
|
326
|
+
|
|
327
|
+
- `primary`: Color principal (azul IAclinical)
|
|
328
|
+
- `ia-primary`: Alias del color principal
|
|
329
|
+
- `secondary`: Color secundario
|
|
330
|
+
- `danger`: Color de error/peligro
|
|
331
|
+
- `success`: Color de éxito
|
|
332
|
+
- `warning`: Color de advertencia
|
|
333
|
+
|
|
334
|
+
```vue
|
|
335
|
+
<template>
|
|
336
|
+
<!-- Usando clases de Tailwind con colores del preset -->
|
|
337
|
+
<div class="bg-primary-500 text-white p-4">Content with primary color</div>
|
|
338
|
+
|
|
339
|
+
<div class="bg-ia-primary-600 text-white p-4">
|
|
340
|
+
Content with ia-primary color
|
|
341
|
+
</div>
|
|
342
|
+
</template>
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Fuentes
|
|
346
|
+
|
|
347
|
+
El sistema de diseño incluye Roboto como fuente principal:
|
|
348
|
+
|
|
349
|
+
```css
|
|
350
|
+
/* Ya incluido en los estilos de la librería */
|
|
351
|
+
font-family: "Roboto", sans-serif;
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## 🔧 TypeScript
|
|
355
|
+
|
|
356
|
+
Todos los componentes incluyen definiciones de tipos completas:
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
import type {
|
|
360
|
+
ButtonProps,
|
|
361
|
+
CardProps,
|
|
362
|
+
DialogProps,
|
|
363
|
+
SelectOption,
|
|
364
|
+
TableColumn,
|
|
365
|
+
} from "@iaclinical/components";
|
|
366
|
+
|
|
367
|
+
// Uso con tipos
|
|
368
|
+
const buttonProps: ButtonProps = {
|
|
369
|
+
variant: "primary",
|
|
370
|
+
size: "md",
|
|
371
|
+
disabled: false,
|
|
372
|
+
};
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## 📄 Licencia
|
|
376
|
+
|
|
377
|
+
MIT © IAclinical
|
|
378
|
+
|
|
379
|
+
## 🤝 Contribuir
|
|
380
|
+
|
|
381
|
+
Para contribuir al desarrollo de esta librería, consulta el repositorio principal:
|
|
382
|
+
|
|
383
|
+
[https://github.com/iaclinical/design-system](https://github.com/iaclinical/design-system)
|
|
384
|
+
|
|
385
|
+
## 📞 Soporte
|
|
386
|
+
|
|
387
|
+
Para reportar bugs o solicitar nuevas características, abre un issue en:
|
|
388
|
+
|
|
389
|
+
[https://github.com/iaclinical/design-system/issues](https://github.com/iaclinical/design-system/issues)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iaclinical/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Librería de componentes Vue 3 del IAclinical Design System",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/iaclinical-components.cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"vue": "^3.4.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@iaclinical/tailwind-preset": "1.0.0"
|
|
37
|
+
"@iaclinical/tailwind-preset": "^1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@vitejs/plugin-vue": "^5.0.0",
|