@moni-labs/moni-ui 0.4.6 → 0.4.8
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/custom-elements.json +211 -1
- package/dist/browser/moni-ui.iife.min.js +303 -275
- package/dist/browser/moni-ui.iife.min.js.br +0 -0
- package/dist/browser/moni-ui.iife.min.js.gz +0 -0
- package/dist/browser/moni-ui.iife.min.js.map +1 -1
- package/dist/browser/moni-ui.min.js +1398 -1277
- package/dist/browser/moni-ui.min.js.br +0 -0
- package/dist/browser/moni-ui.min.js.gz +0 -0
- package/dist/browser/moni-ui.min.js.map +1 -1
- package/dist/cdn/components/moni-color-field.js +1 -0
- package/dist/cdn/components/moni-morph-modal.js +17 -4
- package/dist/cdn/components/moni-select.js +3 -3
- package/dist/cdn/components/moni-text-field.js +12 -2
- package/dist/cdn/components/moni-textarea.js +6 -2
- package/dist/cdn/importmap.json +98 -98
- package/dist/components/moni-color-field.d.ts.map +1 -1
- package/dist/components/moni-color-field.js +1 -0
- package/dist/components/moni-morph-modal.d.ts +7 -0
- package/dist/components/moni-morph-modal.d.ts.map +1 -1
- package/dist/components/moni-morph-modal.js +37 -1
- package/dist/components/moni-select.d.ts +28 -0
- package/dist/components/moni-select.d.ts.map +1 -1
- package/dist/components/moni-select.js +48 -0
- package/dist/components/moni-text-field.d.ts +45 -2
- package/dist/components/moni-text-field.d.ts.map +1 -1
- package/dist/components/moni-text-field.js +113 -1
- package/dist/components/moni-textarea.d.ts +27 -0
- package/dist/components/moni-textarea.d.ts.map +1 -1
- package/dist/components/moni-textarea.js +61 -0
- package/docs/api.json +205 -5
- package/docs/assets/moni-context-menu/placement--top.png +0 -0
- package/docs/assets/moni-select/required--false.png +0 -0
- package/docs/assets/moni-select/required--true.png +0 -0
- package/docs/assets/moni-text-field/autocomplete--default.png +0 -0
- package/docs/assets/moni-text-field/inputmode--default.png +0 -0
- package/docs/assets/moni-text-field/max--default.png +0 -0
- package/docs/assets/moni-text-field/maxlength--default.png +0 -0
- package/docs/assets/moni-text-field/min--default.png +0 -0
- package/docs/assets/moni-text-field/minlength--default.png +0 -0
- package/docs/assets/moni-text-field/pattern--default.png +0 -0
- package/docs/assets/moni-text-field/readonly--false.png +0 -0
- package/docs/assets/moni-text-field/readonly--true.png +0 -0
- package/docs/assets/moni-text-field/required--false.png +0 -0
- package/docs/assets/moni-text-field/required--true.png +0 -0
- package/docs/assets/moni-text-field/step--default.png +0 -0
- package/docs/assets/moni-text-field/type--color.png +0 -0
- package/docs/assets/moni-text-field/type--date.png +0 -0
- package/docs/assets/moni-text-field/type--datetime-local.png +0 -0
- package/docs/assets/moni-text-field/type--month.png +0 -0
- package/docs/assets/moni-text-field/type--time.png +0 -0
- package/docs/assets/moni-text-field/type--week.png +0 -0
- package/docs/assets/moni-textarea/autocomplete--default.png +0 -0
- package/docs/assets/moni-textarea/minlength--default.png +0 -0
- package/docs/assets/moni-textarea/readonly--false.png +0 -0
- package/docs/assets/moni-textarea/readonly--true.png +0 -0
- package/docs/assets/moni-textarea/required--false.png +0 -0
- package/docs/assets/moni-textarea/required--true.png +0 -0
- package/docs/components/morph-modal.md +3 -0
- package/docs/components/select.md +15 -1
- package/docs/components/text-field.md +89 -1
- package/docs/components/textarea.md +34 -1
- package/package.json +90 -90
- package/src/components/moni-color-field.ts +1 -0
- package/src/components/moni-morph-modal.test.ts +26 -0
- package/src/components/moni-morph-modal.ts +33 -1
- package/src/components/moni-select.test.ts +34 -0
- package/src/components/moni-select.ts +54 -0
- package/src/components/moni-text-field.test.ts +78 -0
- package/src/components/moni-text-field.ts +109 -2
- package/src/components/moni-textarea.ts +62 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -65,6 +65,9 @@ Las utilities aplicadas directamente al tag afectan su caja anfitriona. No uses
|
|
|
65
65
|
| `hide-target` | `hideTarget` | `boolean` | `false` | Si es true, oculta el elemento disparador (target) mientras el modal está abierto. |
|
|
66
66
|
| `cover-target` | `coverTarget` | `boolean` | `false` | Si es true, fuerza al modal a cubrir visualmente la ubicación original del target antes de expandirse. |
|
|
67
67
|
| `auto-size` | `autoSize` | `boolean` | `false` | Si es true, el modal calcula automáticamente su tamaño final basándose en el contenido interno (ignora expandedWidth y expandedHeight). |
|
|
68
|
+
| `fullscreen` | `fullscreen` | `boolean` | `false` | Fuerza al modal expandido a ocupar todo el viewport. |
|
|
69
|
+
| `responsive-fullscreen` | `responsiveFullscreen` | `boolean` | `false` | Activa fullscreen únicamente cuando el viewport no supera el breakpoint configurado. |
|
|
70
|
+
| `fullscreen-breakpoint` | `fullscreenBreakpoint` | `number` | `600` | Ancho máximo del viewport, en píxeles, para aplicar responsive-fullscreen. |
|
|
68
71
|
| `blur-content` | `blurContent` | `boolean` | `false` | Si es true, aplica un efecto de desenfoque (blur) al contenido durante la animación de entrada y salida. |
|
|
69
72
|
| `debug` | `debug` | `boolean` | `false` | Muestra en consola el origen, geometría y estrategia usada por cada morph. |
|
|
70
73
|
|
|
@@ -96,6 +96,7 @@ Las utilities aplicadas directamente al tag afectan su caja anfitriona. No uses
|
|
|
96
96
|
| `size` | `size` | `'small' \| 'medium' \| 'large' \| 'extra'` | `'medium'` | Define las dimensiones del campo select. |
|
|
97
97
|
| `shape` | `shape` | `'round' \| 'square' \| 'no-round'` | `'no-round'` | Forma (radio de borde) del campo. |
|
|
98
98
|
| `disabled` | `disabled` | `boolean` | `false` | Deshabilita el campo select. |
|
|
99
|
+
| `required` | `required` | `boolean` | `false` | Obliga a elegir una opción antes de enviar el formulario. El `<input>` visible es de sólo lectura, así que la validación nativa no se aplica sobre él: la restricción se declara en el host con `ElementInternals.setValidity`, que es lo que mira el formulario. |
|
|
99
100
|
| `loading` | `loading` | `boolean` | `false` | Si es verdadero, muestra un indicador de carga (progreso lineal). |
|
|
100
101
|
| `helper` | `helper` | `string` | `''` | Texto de ayuda mostrado debajo del campo. |
|
|
101
102
|
| `error-text` | `errorText` | `string` | `''` | Texto de error mostrado debajo del campo cuando `error` es true. Reemplaza al texto de ayuda. |
|
|
@@ -122,7 +123,8 @@ No declara eventos propios.
|
|
|
122
123
|
|
|
123
124
|
## Métodos públicos
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
- `checkValidity(): boolean` — Método público checkValidity.
|
|
127
|
+
- `reportValidity(): boolean` — Método público reportValidity.
|
|
126
128
|
|
|
127
129
|
## CSS Parts
|
|
128
130
|
|
|
@@ -205,6 +207,18 @@ Deshabilita el campo select.
|
|
|
205
207
|
|
|
206
208
|

|
|
207
209
|
|
|
210
|
+
### `required`
|
|
211
|
+
|
|
212
|
+
Obliga a elegir una opción antes de enviar el formulario.
|
|
213
|
+
|
|
214
|
+
El `<input>` visible es de sólo lectura, así que la validación nativa no
|
|
215
|
+
se aplica sobre él: la restricción se declara en el host con
|
|
216
|
+
`ElementInternals.setValidity`, que es lo que mira el formulario.
|
|
217
|
+
|
|
218
|
+

|
|
219
|
+
|
|
220
|
+

|
|
221
|
+
|
|
208
222
|
### `loading`
|
|
209
223
|
|
|
210
224
|
Si es verdadero, muestra un indicador de carga (progreso lineal).
|
|
@@ -92,7 +92,7 @@ Las utilities aplicadas directamente al tag afectan su caja anfitriona. No uses
|
|
|
92
92
|
| `variant` | `variant` | `'filled' \| 'outlined' \| 'underlined'` | `'filled'` | Variante visual del campo de texto. |
|
|
93
93
|
| `size` | `size` | `'small' \| 'medium' \| 'large' \| 'extra'` | `'medium'` | Define las dimensiones del campo de texto. |
|
|
94
94
|
| `shape` | `shape` | `'round' \| 'no-round'` | `'no-round'` | Forma del radio del borde (border-radius) del campo. |
|
|
95
|
-
| `type` | `type` | `'text' \| 'password' \| 'email' \| 'number' \| 'tel' \| 'url' \| 'search'` | `'text'` | El tipo de input HTML nativo. |
|
|
95
|
+
| `type` | `type` | `'text' \| 'password' \| 'email' \| 'number' \| 'tel' \| 'url' \| 'search' \| 'date' \| 'time' \| 'datetime-local' \| 'month' \| 'week' \| 'color'` | `'text'` | El tipo de input HTML nativo. |
|
|
96
96
|
| `icon` | `icon` | `string` | `''` | Nombre del icono inicial (leading) (Material Symbols). |
|
|
97
97
|
| `trailing-icon` | `trailingIcon` | `string` | `''` | Nombre del icono final (trailing) (Material Symbols). |
|
|
98
98
|
| `prefix` | `prefix` | `string` | `''` | Prefijo de texto corto mostrado antes del valor del input. |
|
|
@@ -106,6 +106,16 @@ Las utilities aplicadas directamente al tag afectan su caja anfitriona. No uses
|
|
|
106
106
|
| `disabled` | `disabled` | `boolean` | `false` | Deshabilita el campo de texto. |
|
|
107
107
|
| `value` | `value` | `string` | `''` | El valor actual del input. |
|
|
108
108
|
| `placeholder` | `placeholder` | `string` | `''` | Texto de marcador de posición (placeholder) mostrado cuando el input está vacío y la etiqueta es flotante. |
|
|
109
|
+
| `required` | `required` | `boolean` | `false` | Marca el campo como obligatorio y lo integra en la validación del formulario. |
|
|
110
|
+
| `readonly` | `readonly` | `boolean` | `false` | Impide editar el valor sin sacarlo del envío ni atenuarlo como `disabled`. |
|
|
111
|
+
| `autocomplete` | `autocomplete` | `string` | `''` | Pista de autocompletado del navegador, por ejemplo `email` o `current-password`. |
|
|
112
|
+
| `inputmode` | `inputmode` | `string` | `''` | Teclado virtual a mostrar en móvil, por ejemplo `numeric` o `tel`. |
|
|
113
|
+
| `maxlength` | `maxlength` | `number \| null` | `null` | Máximo de caracteres aceptados. |
|
|
114
|
+
| `minlength` | `minlength` | `number \| null` | `null` | Mínimo de caracteres aceptados. |
|
|
115
|
+
| `min` | `min` | `string` | `''` | Valor mínimo para `number` y los tipos de fecha y hora. |
|
|
116
|
+
| `max` | `max` | `string` | `''` | Valor máximo para `number` y los tipos de fecha y hora. |
|
|
117
|
+
| `step` | `step` | `string` | `''` | Incremento para `number` y los tipos de fecha y hora. |
|
|
118
|
+
| `pattern` | `pattern` | `string` | `''` | Expresión regular que debe cumplir el valor. |
|
|
109
119
|
| `mask` | `mask` | `string` | `''` | Patrón Inputmask. Admite opcionales `[]`, grupos `()`, alternadores `\|`, cuantificadores `{n,m}` y los tokens `9`, `a`, `*` y `K` (RUT). |
|
|
110
120
|
| `mask-alias` | `maskAlias` | `string` | `''` | Alias integrado de Inputmask, por ejemplo `email`, `datetime`, `numeric`, `currency` o `ip`. |
|
|
111
121
|
| `mask-options` | `maskOptions` | `InputmaskOptions` | `{}` | Opciones avanzadas de Inputmask. También acepta JSON mediante el atributo `mask-options`. |
|
|
@@ -131,6 +141,8 @@ Este componente no declara slots públicos.
|
|
|
131
141
|
- `formatWithMask(value: string, metadata = false): string |` — Método público formatWithMask.
|
|
132
142
|
- `setMaskedValue(value: string): void` — Método público setMaskedValue.
|
|
133
143
|
- `removeMask(): void` — Método público removeMask.
|
|
144
|
+
- `checkValidity(): boolean` — Método público checkValidity.
|
|
145
|
+
- `reportValidity(): boolean` — Método público reportValidity.
|
|
134
146
|
|
|
135
147
|
## CSS Parts
|
|
136
148
|
|
|
@@ -216,6 +228,18 @@ El tipo de input HTML nativo.
|
|
|
216
228
|
|
|
217
229
|

|
|
218
230
|
|
|
231
|
+

|
|
232
|
+
|
|
233
|
+

|
|
234
|
+
|
|
235
|
+

|
|
236
|
+
|
|
237
|
+

|
|
238
|
+
|
|
239
|
+

|
|
240
|
+
|
|
241
|
+

|
|
242
|
+
|
|
219
243
|
### `icon`
|
|
220
244
|
|
|
221
245
|
Nombre del icono inicial (leading) (Material Symbols).
|
|
@@ -301,6 +325,70 @@ Texto de marcador de posición (placeholder) mostrado cuando el input está vac
|
|
|
301
325
|
|
|
302
326
|

|
|
303
327
|
|
|
328
|
+
### `required`
|
|
329
|
+
|
|
330
|
+
Marca el campo como obligatorio y lo integra en la validación del formulario.
|
|
331
|
+
|
|
332
|
+

|
|
333
|
+
|
|
334
|
+

|
|
335
|
+
|
|
336
|
+
### `readonly`
|
|
337
|
+
|
|
338
|
+
Impide editar el valor sin sacarlo del envío ni atenuarlo como `disabled`.
|
|
339
|
+
|
|
340
|
+

|
|
341
|
+
|
|
342
|
+

|
|
343
|
+
|
|
344
|
+
### `autocomplete`
|
|
345
|
+
|
|
346
|
+
Pista de autocompletado del navegador, por ejemplo `email` o `current-password`.
|
|
347
|
+
|
|
348
|
+

|
|
349
|
+
|
|
350
|
+
### `inputmode`
|
|
351
|
+
|
|
352
|
+
Teclado virtual a mostrar en móvil, por ejemplo `numeric` o `tel`.
|
|
353
|
+
|
|
354
|
+

|
|
355
|
+
|
|
356
|
+
### `maxlength`
|
|
357
|
+
|
|
358
|
+
Máximo de caracteres aceptados.
|
|
359
|
+
|
|
360
|
+

|
|
361
|
+
|
|
362
|
+
### `minlength`
|
|
363
|
+
|
|
364
|
+
Mínimo de caracteres aceptados.
|
|
365
|
+
|
|
366
|
+

|
|
367
|
+
|
|
368
|
+
### `min`
|
|
369
|
+
|
|
370
|
+
Valor mínimo para `number` y los tipos de fecha y hora.
|
|
371
|
+
|
|
372
|
+

|
|
373
|
+
|
|
374
|
+
### `max`
|
|
375
|
+
|
|
376
|
+
Valor máximo para `number` y los tipos de fecha y hora.
|
|
377
|
+
|
|
378
|
+

|
|
379
|
+
|
|
380
|
+
### `step`
|
|
381
|
+
|
|
382
|
+
Incremento para `number` y los tipos de fecha y hora.
|
|
383
|
+
|
|
384
|
+

|
|
385
|
+
|
|
386
|
+
### `pattern`
|
|
387
|
+
|
|
388
|
+
Expresión regular que debe cumplir el valor.
|
|
389
|
+
|
|
390
|
+

|
|
391
|
+
|
|
304
392
|
### `mask`
|
|
305
393
|
|
|
306
394
|
Patrón Inputmask. Admite opcionales `[]`, grupos `()`, alternadores `|`,
|
|
@@ -97,6 +97,10 @@ Las utilities aplicadas directamente al tag afectan su caja anfitriona. No uses
|
|
|
97
97
|
| `autosize` | `autosize` | `boolean` | `false` | Hace que el textarea crezca y se reduzca según su contenido. |
|
|
98
98
|
| `max-rows` | `maxRows` | `number` | `0` | Número máximo de filas visibles cuando `autosize` está activo. Cero no impone límite. |
|
|
99
99
|
| `maxlength` | `maxlength` | `number \| null` | `null` | Número máximo de caracteres permitidos en el área de texto. También habilita la visualización del contador de caracteres a menos que `noCounter` sea true. |
|
|
100
|
+
| `required` | `required` | `boolean` | `false` | Marca el campo como obligatorio y lo integra en la validación del formulario. |
|
|
101
|
+
| `readonly` | `readonly` | `boolean` | `false` | Impide editar el valor sin sacarlo del envío ni atenuarlo como `disabled`. |
|
|
102
|
+
| `minlength` | `minlength` | `number \| null` | `null` | Mínimo de caracteres aceptados. |
|
|
103
|
+
| `autocomplete` | `autocomplete` | `string` | `''` | Pista de autocompletado del navegador. |
|
|
100
104
|
| `no-counter` | `noCounter` | `boolean` | `false` | Oculta la visualización del contador de caracteres cuando se establece `maxlength`. |
|
|
101
105
|
| `loading` | `loading` | `boolean` | `false` | Si es true, muestra un indicador de carga (progreso circular) al final. |
|
|
102
106
|
| `disabled` | `disabled` | `boolean` | `false` | Deshabilita el área de texto. |
|
|
@@ -116,7 +120,8 @@ No declara eventos propios.
|
|
|
116
120
|
|
|
117
121
|
## Métodos públicos
|
|
118
122
|
|
|
119
|
-
|
|
123
|
+
- `checkValidity(): boolean` — Método público checkValidity.
|
|
124
|
+
- `reportValidity(): boolean` — Método público reportValidity.
|
|
120
125
|
|
|
121
126
|
## CSS Parts
|
|
122
127
|
|
|
@@ -232,6 +237,34 @@ También habilita la visualización del contador de caracteres a menos que `noCo
|
|
|
232
237
|
|
|
233
238
|

|
|
234
239
|
|
|
240
|
+
### `required`
|
|
241
|
+
|
|
242
|
+
Marca el campo como obligatorio y lo integra en la validación del formulario.
|
|
243
|
+
|
|
244
|
+

|
|
245
|
+
|
|
246
|
+

|
|
247
|
+
|
|
248
|
+
### `readonly`
|
|
249
|
+
|
|
250
|
+
Impide editar el valor sin sacarlo del envío ni atenuarlo como `disabled`.
|
|
251
|
+
|
|
252
|
+

|
|
253
|
+
|
|
254
|
+

|
|
255
|
+
|
|
256
|
+
### `minlength`
|
|
257
|
+
|
|
258
|
+
Mínimo de caracteres aceptados.
|
|
259
|
+
|
|
260
|
+

|
|
261
|
+
|
|
262
|
+
### `autocomplete`
|
|
263
|
+
|
|
264
|
+
Pista de autocompletado del navegador.
|
|
265
|
+
|
|
266
|
+

|
|
267
|
+
|
|
235
268
|
### `no-counter`
|
|
236
269
|
|
|
237
270
|
Oculta la visualización del contador de caracteres cuando se establece `maxlength`.
|
package/package.json
CHANGED
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@moni-labs/moni-ui",
|
|
3
|
-
|
|
4
|
-
"private": false,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"description": "Design system unificado para Moni — Material Design 3 Expressive, mobile-first.",
|
|
7
|
-
"main": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"customElements": "custom-elements.json",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"import": "./dist/index.js"
|
|
14
|
-
},
|
|
15
|
-
"./web-components": {
|
|
16
|
-
"types": "./dist/web-components.d.ts",
|
|
17
|
-
"import": "./dist/web-components.js"
|
|
18
|
-
},
|
|
19
|
-
"./browser": "./dist/browser/moni-ui.min.js",
|
|
20
|
-
"./browser.css": "./dist/browser/moni-ui.min.css",
|
|
21
|
-
"./cdn/importmap": "./dist/cdn/importmap.json",
|
|
22
|
-
"./cdn/*": "./dist/cdn/components/moni-*.js",
|
|
23
|
-
"./styles": "./dist/styles/index.css",
|
|
24
|
-
"./styles/*": "./dist/styles/*",
|
|
25
|
-
"./components/*.ts": "./src/components/*.ts",
|
|
26
|
-
"./components/*": {
|
|
27
|
-
"types": "./dist/components/*.d.ts",
|
|
28
|
-
"import": "./dist/components/*.js"
|
|
29
|
-
},
|
|
30
|
-
"./actions/*": {
|
|
31
|
-
"types": "./dist/actions/*.d.ts",
|
|
32
|
-
"import": "./dist/actions/*.js"
|
|
33
|
-
},
|
|
34
|
-
"./utils/*": {
|
|
35
|
-
"types": "./dist/utils/*.d.ts",
|
|
36
|
-
"import": "./dist/utils/*.js"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"unpkg": "./dist/browser/moni-ui.iife.min.js",
|
|
43
|
-
"jsdelivr": "./dist/browser/moni-ui.iife.min.js",
|
|
44
|
-
"files": [
|
|
45
|
-
"dist",
|
|
46
|
-
"src",
|
|
47
|
-
"docs",
|
|
48
|
-
"custom-elements.json",
|
|
49
|
-
"README.md",
|
|
50
|
-
"package.json"
|
|
51
|
-
],
|
|
52
|
-
"repository": {
|
|
53
|
-
"type": "git",
|
|
54
|
-
"url": "git+https://github.com/moni-spa/moni-ui.git"
|
|
55
|
-
},
|
|
56
|
-
"bugs": {
|
|
57
|
-
"url": "https://github.com/moni-spa/moni-ui/issues"
|
|
58
|
-
},
|
|
59
|
-
"homepage": "https://github.com/moni-spa/moni-ui#readme",
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"svelte": "^5.55.2",
|
|
62
|
-
"tailwindcss": "^4.2.2"
|
|
63
|
-
},
|
|
64
|
-
"dependencies": {
|
|
65
|
-
"@material/material-color-utilities": "^0.4.0",
|
|
66
|
-
"gsap": "^3.12.7",
|
|
67
|
-
"inputmask": "^5.0.9",
|
|
68
|
-
"lit": "^3.3.3"
|
|
69
|
-
},
|
|
70
|
-
"devDependencies": {
|
|
71
|
-
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
72
|
-
"@tailwindcss/vite": "^4.3.1",
|
|
73
|
-
"jsdom": "^29.1.1",
|
|
74
|
-
"lightningcss": "^1.33.0",
|
|
75
|
-
"typescript": "^6.0.3",
|
|
76
|
-
"vite": "^8.0.16",
|
|
77
|
-
"vitest": "^4.1.8"
|
|
78
|
-
},
|
|
79
|
-
"scripts": {
|
|
80
|
-
"build": "node scripts/build.js",
|
|
81
|
-
"docs": "node scripts/generate-docs.mjs",
|
|
82
|
-
"docs:capture": "node scripts/capture-docs.mjs",
|
|
83
|
-
"docs:all": "npm run build && npm run docs && npm run docs:capture",
|
|
84
|
-
"docs:check": "node scripts/generate-docs.mjs --check",
|
|
85
|
-
"analyze": "custom-elements-manifest analyze",
|
|
86
|
-
"test": "vitest run",
|
|
87
|
-
"test:verbose": "vitest run --reporter=verbose",
|
|
88
|
-
"test:watch": "vitest"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@moni-labs/moni-ui",
|
|
3
|
+
"version": "0.4.8",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Design system unificado para Moni — Material Design 3 Expressive, mobile-first.",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"customElements": "custom-elements.json",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./web-components": {
|
|
16
|
+
"types": "./dist/web-components.d.ts",
|
|
17
|
+
"import": "./dist/web-components.js"
|
|
18
|
+
},
|
|
19
|
+
"./browser": "./dist/browser/moni-ui.min.js",
|
|
20
|
+
"./browser.css": "./dist/browser/moni-ui.min.css",
|
|
21
|
+
"./cdn/importmap": "./dist/cdn/importmap.json",
|
|
22
|
+
"./cdn/*": "./dist/cdn/components/moni-*.js",
|
|
23
|
+
"./styles": "./dist/styles/index.css",
|
|
24
|
+
"./styles/*": "./dist/styles/*",
|
|
25
|
+
"./components/*.ts": "./src/components/*.ts",
|
|
26
|
+
"./components/*": {
|
|
27
|
+
"types": "./dist/components/*.d.ts",
|
|
28
|
+
"import": "./dist/components/*.js"
|
|
29
|
+
},
|
|
30
|
+
"./actions/*": {
|
|
31
|
+
"types": "./dist/actions/*.d.ts",
|
|
32
|
+
"import": "./dist/actions/*.js"
|
|
33
|
+
},
|
|
34
|
+
"./utils/*": {
|
|
35
|
+
"types": "./dist/utils/*.d.ts",
|
|
36
|
+
"import": "./dist/utils/*.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"unpkg": "./dist/browser/moni-ui.iife.min.js",
|
|
43
|
+
"jsdelivr": "./dist/browser/moni-ui.iife.min.js",
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"src",
|
|
47
|
+
"docs",
|
|
48
|
+
"custom-elements.json",
|
|
49
|
+
"README.md",
|
|
50
|
+
"package.json"
|
|
51
|
+
],
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/moni-spa/moni-ui.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/moni-spa/moni-ui/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/moni-spa/moni-ui#readme",
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"svelte": "^5.55.2",
|
|
62
|
+
"tailwindcss": "^4.2.2"
|
|
63
|
+
},
|
|
64
|
+
"dependencies": {
|
|
65
|
+
"@material/material-color-utilities": "^0.4.0",
|
|
66
|
+
"gsap": "^3.12.7",
|
|
67
|
+
"inputmask": "^5.0.9",
|
|
68
|
+
"lit": "^3.3.3"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
72
|
+
"@tailwindcss/vite": "^4.3.1",
|
|
73
|
+
"jsdom": "^29.1.1",
|
|
74
|
+
"lightningcss": "^1.33.0",
|
|
75
|
+
"typescript": "^6.0.3",
|
|
76
|
+
"vite": "^8.0.16",
|
|
77
|
+
"vitest": "^4.1.8"
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build": "node scripts/build.js",
|
|
81
|
+
"docs": "node scripts/generate-docs.mjs",
|
|
82
|
+
"docs:capture": "node scripts/capture-docs.mjs",
|
|
83
|
+
"docs:all": "npm run build && npm run docs && npm run docs:capture",
|
|
84
|
+
"docs:check": "node scripts/generate-docs.mjs --check",
|
|
85
|
+
"analyze": "custom-elements-manifest analyze",
|
|
86
|
+
"test": "vitest run",
|
|
87
|
+
"test:verbose": "vitest run --reporter=verbose",
|
|
88
|
+
"test:watch": "vitest"
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -117,6 +117,32 @@ describe('moni-morph-modal', () => {
|
|
|
117
117
|
expect(el.hasAttribute('open')).toBe(true);
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
it('ocupa todo el viewport cuando fullscreen está activo', async () => {
|
|
121
|
+
el.fullscreen = true;
|
|
122
|
+
await el.updateComplete;
|
|
123
|
+
const rect = (el as unknown as { _computeFinalRect: (target: DOMRect) => DOMRect })
|
|
124
|
+
._computeFinalRect(new DOMRect(24, 700, 56, 56));
|
|
125
|
+
|
|
126
|
+
expect(el.hasAttribute('fullscreen')).toBe(true);
|
|
127
|
+
expect(rect.x).toBe(0);
|
|
128
|
+
expect(rect.y).toBe(0);
|
|
129
|
+
expect(rect.width).toBe(window.innerWidth);
|
|
130
|
+
expect(rect.height).toBe(window.innerHeight);
|
|
131
|
+
expect(el.shadowRoot?.querySelector('.panel')?.classList.contains('fullscreen')).toBe(true);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('aplica fullscreen responsive sólo bajo el breakpoint', () => {
|
|
135
|
+
el.responsiveFullscreen = true;
|
|
136
|
+
el.fullscreenBreakpoint = 600;
|
|
137
|
+
const usesFullscreen = () => (el as unknown as { _usesFullscreen: () => boolean })._usesFullscreen();
|
|
138
|
+
|
|
139
|
+
vi.stubGlobal('innerWidth', 480);
|
|
140
|
+
expect(usesFullscreen()).toBe(true);
|
|
141
|
+
vi.stubGlobal('innerWidth', 900);
|
|
142
|
+
expect(usesFullscreen()).toBe(false);
|
|
143
|
+
vi.unstubAllGlobals();
|
|
144
|
+
});
|
|
145
|
+
|
|
120
146
|
it('proyecta el contenido del slot por defecto', async () => {
|
|
121
147
|
const content = document.createElement('p');
|
|
122
148
|
content.textContent = 'Hello';
|
|
@@ -229,6 +229,18 @@ export class MoniMorphModal extends MoniElement {
|
|
|
229
229
|
@property({ type: Boolean, reflect: true, attribute: 'auto-size', converter: litBool })
|
|
230
230
|
autoSize = false;
|
|
231
231
|
|
|
232
|
+
/** Fuerza al modal expandido a ocupar todo el viewport. */
|
|
233
|
+
@property({ type: Boolean, reflect: true, converter: litBool })
|
|
234
|
+
fullscreen = false;
|
|
235
|
+
|
|
236
|
+
/** Activa fullscreen únicamente cuando el viewport no supera el breakpoint configurado. */
|
|
237
|
+
@property({ type: Boolean, reflect: true, attribute: 'responsive-fullscreen', converter: litBool })
|
|
238
|
+
responsiveFullscreen = false;
|
|
239
|
+
|
|
240
|
+
/** Ancho máximo del viewport, en píxeles, para aplicar responsive-fullscreen. */
|
|
241
|
+
@property({ type: Number, reflect: true, attribute: 'fullscreen-breakpoint' })
|
|
242
|
+
fullscreenBreakpoint = 600;
|
|
243
|
+
|
|
232
244
|
/**
|
|
233
245
|
* Si es true, aplica un efecto de desenfoque (blur) al contenido durante la animación de entrada y salida.
|
|
234
246
|
* @type {boolean}
|
|
@@ -1896,9 +1908,15 @@ export class MoniMorphModal extends MoniElement {
|
|
|
1896
1908
|
el.style.height = `${rect.height}px`;
|
|
1897
1909
|
}
|
|
1898
1910
|
|
|
1911
|
+
private _usesFullscreen(): boolean {
|
|
1912
|
+
if (this.fullscreen) return true;
|
|
1913
|
+
return this.responsiveFullscreen && typeof window !== 'undefined' && window.innerWidth <= this.fullscreenBreakpoint;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1899
1916
|
private _computeFinalRect(targetRect: DOMRect, naturalSize?: { width: number; height: number }): DOMRect {
|
|
1900
1917
|
const vw = window.innerWidth;
|
|
1901
1918
|
const vh = window.innerHeight;
|
|
1919
|
+
if (this._usesFullscreen()) return new DOMRect(0, 0, vw, vh);
|
|
1902
1920
|
const padding = 16;
|
|
1903
1921
|
|
|
1904
1922
|
let width = this.autoSize && naturalSize ? naturalSize.width : this._parseSize(this.expandedWidth, vw);
|
|
@@ -2082,6 +2100,19 @@ export class MoniMorphModal extends MoniElement {
|
|
|
2082
2100
|
z-index: var(--_z-index, 100);
|
|
2083
2101
|
}
|
|
2084
2102
|
|
|
2103
|
+
.panel.fullscreen {
|
|
2104
|
+
border-radius: 0;
|
|
2105
|
+
box-shadow: none;
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
.panel.fullscreen header {
|
|
2109
|
+
padding-block-start: max(1.25rem, env(safe-area-inset-top));
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
.panel.fullscreen footer {
|
|
2113
|
+
padding-block-end: max(1.5rem, env(safe-area-inset-bottom));
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2085
2116
|
.panel-inner {
|
|
2086
2117
|
display: flex;
|
|
2087
2118
|
flex-direction: column;
|
|
@@ -2191,6 +2222,7 @@ export class MoniMorphModal extends MoniElement {
|
|
|
2191
2222
|
override render() {
|
|
2192
2223
|
const visible = this._visible || this.open;
|
|
2193
2224
|
const headerEmpty = !this._hasHeader && !this.showCloseButton;
|
|
2225
|
+
const fullscreen = this._usesFullscreen();
|
|
2194
2226
|
return html`
|
|
2195
2227
|
${this.hasBackdrop ? html`
|
|
2196
2228
|
<div
|
|
@@ -2199,7 +2231,7 @@ export class MoniMorphModal extends MoniElement {
|
|
|
2199
2231
|
style="${!this.modal ? 'background-color: transparent;' : ''}"
|
|
2200
2232
|
></div>
|
|
2201
2233
|
` : ''}
|
|
2202
|
-
<div class="panel" part="panel">
|
|
2234
|
+
<div class="panel ${fullscreen ? 'fullscreen' : ''}" part="panel">
|
|
2203
2235
|
<div class="panel-inner" part="panel-inner">
|
|
2204
2236
|
<header
|
|
2205
2237
|
class="${headerEmpty ? 'is-empty' : ''}"
|
|
@@ -422,3 +422,37 @@ describe('moni-select · nombre accesible', () => {
|
|
|
422
422
|
el.remove();
|
|
423
423
|
});
|
|
424
424
|
})
|
|
425
|
+
|
|
426
|
+
describe('moni-select · required', () => {
|
|
427
|
+
/*
|
|
428
|
+
* Su input visible es readonly y por tanto queda fuera de la validación de
|
|
429
|
+
* restricciones, así que `required` se declara en el host.
|
|
430
|
+
*/
|
|
431
|
+
it('declara valueMissing mientras no haya valor', async () => {
|
|
432
|
+
// Igual que en text-field: jsdom no expone checkValidity() aquí.
|
|
433
|
+
const calls: Array<Record<string, unknown>> = [];
|
|
434
|
+
const originalAttach = HTMLElement.prototype.attachInternals;
|
|
435
|
+
HTMLElement.prototype.attachInternals = function spy(this: HTMLElement) {
|
|
436
|
+
const internals = originalAttach.call(this);
|
|
437
|
+
const setValidity = internals.setValidity.bind(internals);
|
|
438
|
+
internals.setValidity = ((flags, message, anchor) => {
|
|
439
|
+
calls.push({ valueMissing: flags?.valueMissing === true });
|
|
440
|
+
return setValidity(flags, message, anchor);
|
|
441
|
+
}) as typeof internals.setValidity;
|
|
442
|
+
return internals;
|
|
443
|
+
};
|
|
444
|
+
const el = document.createElement('moni-select') as MoniSelect;
|
|
445
|
+
HTMLElement.prototype.attachInternals = originalAttach;
|
|
446
|
+
|
|
447
|
+
el.required = true;
|
|
448
|
+
document.body.appendChild(el);
|
|
449
|
+
await el.updateComplete;
|
|
450
|
+
expect(calls.some((c) => c.valueMissing === true)).toBe(true);
|
|
451
|
+
|
|
452
|
+
calls.length = 0;
|
|
453
|
+
el.value = 'uno';
|
|
454
|
+
await el.updateComplete;
|
|
455
|
+
expect(calls.at(-1)).toEqual({ valueMissing: false });
|
|
456
|
+
el.remove();
|
|
457
|
+
});
|
|
458
|
+
})
|