easy-forms-core 1.0.3 → 1.0.5
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 +51 -0
- package/dist/easy-form.d.ts +1 -0
- package/dist/easy-form.js +15 -4
- package/dist/easy-form.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,6 +59,55 @@ form.addEventListener('submit', (event) => {
|
|
|
59
59
|
})
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
### Con Rows y Datos Iniciales
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<easy-form
|
|
66
|
+
id="form"
|
|
67
|
+
initialData='{"firstName": "Juan", "lastName": "Pérez", "email": "juan@example.com"}'>
|
|
68
|
+
</easy-form>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
import 'easy-forms-core'
|
|
73
|
+
|
|
74
|
+
const form = document.querySelector('#form')
|
|
75
|
+
|
|
76
|
+
form.schema = {
|
|
77
|
+
fields: [
|
|
78
|
+
{
|
|
79
|
+
type: 'row',
|
|
80
|
+
name: 'nameRow',
|
|
81
|
+
fields: [
|
|
82
|
+
{
|
|
83
|
+
type: 'text',
|
|
84
|
+
name: 'firstName',
|
|
85
|
+
label: 'Nombre',
|
|
86
|
+
validations: [{ type: 'required' }]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'text',
|
|
90
|
+
name: 'lastName',
|
|
91
|
+
label: 'Apellido',
|
|
92
|
+
validations: [{ type: 'required' }]
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
gap: '1rem',
|
|
96
|
+
align: 'stretch'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'email',
|
|
100
|
+
name: 'email',
|
|
101
|
+
label: 'Email',
|
|
102
|
+
validations: [
|
|
103
|
+
{ type: 'required' },
|
|
104
|
+
{ type: 'email' }
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
62
111
|
### React
|
|
63
112
|
|
|
64
113
|
```tsx
|
|
@@ -104,6 +153,8 @@ const schema = {
|
|
|
104
153
|
- Steps / wizard forms
|
|
105
154
|
- Formularios anidados
|
|
106
155
|
- Arrays dinámicos
|
|
156
|
+
- **Rows (filas horizontales)** - Agrupa campos en filas
|
|
157
|
+
- **Datos iniciales** - Carga valores iniciales desde datos externos
|
|
107
158
|
- Componentes visuales personalizables
|
|
108
159
|
- Eventos de submit, change y error
|
|
109
160
|
- Testing friendly
|
package/dist/easy-form.d.ts
CHANGED
package/dist/easy-form.js
CHANGED
|
@@ -168,6 +168,7 @@ var defaultColors = {
|
|
|
168
168
|
error: "#dc3545",
|
|
169
169
|
success: "#28a745",
|
|
170
170
|
text: "#212529",
|
|
171
|
+
labelColor: "#212529",
|
|
171
172
|
border: "#ddd",
|
|
172
173
|
background: "#ffffff"
|
|
173
174
|
};
|
|
@@ -188,6 +189,7 @@ function getBaseStyles(colors) {
|
|
|
188
189
|
--easy-form-error: ${colors.error};
|
|
189
190
|
--easy-form-success: ${colors.success};
|
|
190
191
|
--easy-form-text: ${colors.text};
|
|
192
|
+
--easy-form-label-color: ${colors.labelColor};
|
|
191
193
|
--easy-form-border: ${colors.border};
|
|
192
194
|
--easy-form-background: ${colors.background};
|
|
193
195
|
}
|
|
@@ -198,7 +200,7 @@ function getBaseStyles(colors) {
|
|
|
198
200
|
display: block;
|
|
199
201
|
margin-bottom: 0.5rem;
|
|
200
202
|
font-weight: 500;
|
|
201
|
-
color: var(--easy-form-
|
|
203
|
+
color: var(--easy-form-label-color);
|
|
202
204
|
}
|
|
203
205
|
.easy-form-required {
|
|
204
206
|
color: var(--easy-form-error);
|
|
@@ -303,7 +305,7 @@ function getBaseStyles(colors) {
|
|
|
303
305
|
.easy-form-radio-label {
|
|
304
306
|
cursor: pointer;
|
|
305
307
|
user-select: none;
|
|
306
|
-
color: var(--easy-form-
|
|
308
|
+
color: var(--easy-form-label-color);
|
|
307
309
|
font-weight: 400;
|
|
308
310
|
}
|
|
309
311
|
.easy-form-label-checkbox,
|
|
@@ -316,7 +318,7 @@ function getBaseStyles(colors) {
|
|
|
316
318
|
padding: 0.5rem;
|
|
317
319
|
border-radius: 6px;
|
|
318
320
|
transition: background-color 0.2s ease;
|
|
319
|
-
color: var(--easy-form-
|
|
321
|
+
color: var(--easy-form-label-color);
|
|
320
322
|
}
|
|
321
323
|
.easy-form-label-checkbox input[type="checkbox"],
|
|
322
324
|
.easy-form-label-switch input[type="checkbox"] {
|
|
@@ -390,6 +392,9 @@ function getThemeSpecificStyles(theme, colors) {
|
|
|
390
392
|
}
|
|
391
393
|
function getPlanoStyles(_colors) {
|
|
392
394
|
return `
|
|
395
|
+
.easy-form-label {
|
|
396
|
+
color: var(--easy-form-label-color);
|
|
397
|
+
}
|
|
393
398
|
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
|
|
394
399
|
border: none;
|
|
395
400
|
border-bottom: 2px solid var(--easy-form-border);
|
|
@@ -422,6 +427,9 @@ function getPlanoStyles(_colors) {
|
|
|
422
427
|
}
|
|
423
428
|
function getTradicionalStyles(_colors) {
|
|
424
429
|
return `
|
|
430
|
+
.easy-form-label {
|
|
431
|
+
color: var(--easy-form-label-color);
|
|
432
|
+
}
|
|
425
433
|
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
|
|
426
434
|
border: 2px solid var(--easy-form-border);
|
|
427
435
|
border-radius: 4px;
|
|
@@ -461,7 +469,7 @@ function getMaterialStyles(_colors) {
|
|
|
461
469
|
font-size: 0.875rem;
|
|
462
470
|
font-weight: 500;
|
|
463
471
|
margin-bottom: 0.25rem;
|
|
464
|
-
color:
|
|
472
|
+
color: var(--easy-form-label-color);
|
|
465
473
|
}
|
|
466
474
|
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
|
|
467
475
|
border: none;
|
|
@@ -506,6 +514,9 @@ function getMaterialStyles(_colors) {
|
|
|
506
514
|
}
|
|
507
515
|
function getRoundedShadowStyles(_colors) {
|
|
508
516
|
return `
|
|
517
|
+
.easy-form-label {
|
|
518
|
+
color: var(--easy-form-label-color);
|
|
519
|
+
}
|
|
509
520
|
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
|
|
510
521
|
border: 1px solid var(--easy-form-border);
|
|
511
522
|
border-radius: 12px;
|