@moni-labs/moni-ui 0.4.13 → 0.4.16

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.
Files changed (104) hide show
  1. package/custom-elements.json +101 -81
  2. package/dist/browser/moni-ui.iife.min.js +1538 -1384
  3. package/dist/browser/moni-ui.iife.min.js.br +0 -0
  4. package/dist/browser/moni-ui.iife.min.js.gz +0 -0
  5. package/dist/browser/moni-ui.iife.min.js.map +1 -1
  6. package/dist/browser/moni-ui.min.js +2751 -2501
  7. package/dist/browser/moni-ui.min.js.br +0 -0
  8. package/dist/browser/moni-ui.min.js.gz +0 -0
  9. package/dist/browser/moni-ui.min.js.map +1 -1
  10. package/dist/cdn/chunks/{class-map-DsL1Jr2T.js → class-map-QyT9W7rZ.js} +1 -1
  11. package/dist/cdn/chunks/{decorate-DxJYS4gw.js → decorate-B7wZvwrn.js} +629 -543
  12. package/dist/cdn/chunks/if-defined-5hr_ccFw.js +1 -0
  13. package/dist/cdn/chunks/{live-D52JqeKf.js → live-Hm1Di_ND.js} +1 -1
  14. package/dist/cdn/components/moni-app-bar.js +1 -1
  15. package/dist/cdn/components/moni-badge.js +1 -1
  16. package/dist/cdn/components/moni-bottom-sheet.js +2 -1
  17. package/dist/cdn/components/moni-button-group.js +1 -1
  18. package/dist/cdn/components/moni-button-segment.js +1 -1
  19. package/dist/cdn/components/moni-button.js +1 -1
  20. package/dist/cdn/components/moni-card.js +1 -1
  21. package/dist/cdn/components/moni-carousel.js +1 -1
  22. package/dist/cdn/components/moni-checkbox.js +1 -1
  23. package/dist/cdn/components/moni-chip.js +1 -1
  24. package/dist/cdn/components/moni-color-field.js +1 -1
  25. package/dist/cdn/components/moni-context-menu.js +1 -1
  26. package/dist/cdn/components/moni-dialog.js +1 -1
  27. package/dist/cdn/components/moni-divider.js +1 -1
  28. package/dist/cdn/components/moni-expansion.js +1 -1
  29. package/dist/cdn/components/moni-fab-menu.js +1 -1
  30. package/dist/cdn/components/moni-fab.js +1 -1
  31. package/dist/cdn/components/moni-file-field.js +1 -1
  32. package/dist/cdn/components/moni-icon.js +1 -1
  33. package/dist/cdn/components/moni-list-item.js +1 -1
  34. package/dist/cdn/components/moni-list.js +1 -1
  35. package/dist/cdn/components/moni-loading-indicator.js +1 -1
  36. package/dist/cdn/components/moni-menu-item.js +1 -1
  37. package/dist/cdn/components/moni-menu.js +1 -1
  38. package/dist/cdn/components/moni-morph-modal.js +3 -2
  39. package/dist/cdn/components/moni-nav-item.js +1 -1
  40. package/dist/cdn/components/moni-nav.js +1 -1
  41. package/dist/cdn/components/moni-progress.js +1 -1
  42. package/dist/cdn/components/moni-radio.js +1 -1
  43. package/dist/cdn/components/moni-ripple.js +1 -1
  44. package/dist/cdn/components/moni-segmented-button.js +1 -1
  45. package/dist/cdn/components/moni-select-option.js +1 -1
  46. package/dist/cdn/components/moni-select.js +512 -473
  47. package/dist/cdn/components/moni-shape.js +1 -1
  48. package/dist/cdn/components/moni-side-sheet.js +1 -1
  49. package/dist/cdn/components/moni-slider.js +1 -1
  50. package/dist/cdn/components/moni-snackbar.js +1 -1
  51. package/dist/cdn/components/moni-split-button.js +1 -1
  52. package/dist/cdn/components/moni-step.js +1 -1
  53. package/dist/cdn/components/moni-stepper.js +1 -1
  54. package/dist/cdn/components/moni-switch.js +1 -1
  55. package/dist/cdn/components/moni-tab.js +1 -1
  56. package/dist/cdn/components/moni-tabs.js +1 -1
  57. package/dist/cdn/components/moni-text-field.js +122 -95
  58. package/dist/cdn/components/moni-textarea.js +52 -52
  59. package/dist/cdn/components/moni-time-picker.js +1 -1
  60. package/dist/cdn/components/moni-toolbar.js +1 -1
  61. package/dist/cdn/components/moni-tooltip.js +1 -1
  62. package/dist/cdn/components/moni-typography.js +1 -1
  63. package/dist/cdn/importmap.json +98 -98
  64. package/dist/components/_base/field-styles.d.ts.map +1 -1
  65. package/dist/components/_base/field-styles.js +662 -576
  66. package/dist/components/moni-bottom-sheet.d.ts +19 -5
  67. package/dist/components/moni-bottom-sheet.d.ts.map +1 -1
  68. package/dist/components/moni-bottom-sheet.js +111 -30
  69. package/dist/components/moni-morph-modal.d.ts +10 -0
  70. package/dist/components/moni-morph-modal.d.ts.map +1 -1
  71. package/dist/components/moni-morph-modal.js +323 -217
  72. package/dist/components/moni-select.d.ts +16 -16
  73. package/dist/components/moni-select.d.ts.map +1 -1
  74. package/dist/components/moni-select.js +797 -727
  75. package/dist/components/moni-text-field.d.ts +15 -15
  76. package/dist/components/moni-text-field.d.ts.map +1 -1
  77. package/dist/components/moni-text-field.js +224 -180
  78. package/dist/components/moni-textarea.d.ts +13 -13
  79. package/dist/components/moni-textarea.d.ts.map +1 -1
  80. package/dist/components/moni-textarea.js +127 -122
  81. package/docs/api.json +109 -89
  82. package/docs/assets/moni-color-field/shape--square.png +0 -0
  83. package/docs/assets/moni-file-field/shape--square.png +0 -0
  84. package/docs/assets/moni-morph-modal/autoHeight--false.png +0 -0
  85. package/docs/assets/moni-morph-modal/autoHeight--true.png +0 -0
  86. package/docs/components/bottom-sheet.md +2 -1
  87. package/docs/components/morph-modal.md +16 -7
  88. package/docs/components/select.md +74 -74
  89. package/docs/components/text-field.md +75 -66
  90. package/docs/components/textarea.md +51 -51
  91. package/docs/llms.txt +3 -3
  92. package/package.json +1 -1
  93. package/src/components/_base/field-styles.ts +723 -637
  94. package/src/components/moni-bottom-sheet.test.ts +331 -0
  95. package/src/components/moni-bottom-sheet.ts +117 -29
  96. package/src/components/moni-morph-modal.test.ts +490 -413
  97. package/src/components/moni-morph-modal.ts +2274 -2162
  98. package/src/components/moni-select.test.ts +489 -466
  99. package/src/components/moni-select.ts +1963 -1815
  100. package/src/components/moni-text-field.test.ts +366 -342
  101. package/src/components/moni-text-field.ts +717 -645
  102. package/src/components/moni-textarea.test.ts +201 -197
  103. package/src/components/moni-textarea.ts +476 -460
  104. package/dist/cdn/chunks/if-defined-DdzvcoI7.js +0 -1
@@ -10,15 +10,15 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
10
10
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11
11
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12
12
  };
13
- import { css, html, nothing } from 'lit';
14
- import { customElement, property, query, state } from 'lit/decorators.js';
15
- import { ifDefined } from 'lit/directives/if-defined.js';
16
- import { classMap } from 'lit/directives/class-map.js';
17
- import Inputmask from 'inputmask';
18
- import { MoniElement, sharedStyles, fieldStyles } from './_base/index.js';
19
- import { emitMoniEvent } from '../utils/event-emitter.js';
20
- import './moni-icon.js';
21
- import './moni-progress.js';
13
+ import { css, html, nothing } from "lit";
14
+ import { customElement, property, query, state } from "lit/decorators.js";
15
+ import { ifDefined } from "lit/directives/if-defined.js";
16
+ import { classMap } from "lit/directives/class-map.js";
17
+ import Inputmask from "inputmask";
18
+ import { MoniElement, sharedStyles, fieldStyles } from "./_base/index.js";
19
+ import { emitMoniEvent } from "../utils/event-emitter.js";
20
+ import "./moni-icon.js";
21
+ import "./moni-progress.js";
22
22
  /**
23
23
  * Componente Material Design 3 Text Field (Campo de texto).
24
24
  *
@@ -78,72 +78,72 @@ let MoniTextField = class MoniTextField extends MoniElement {
78
78
  * El nombre del input, enviado con los datos del formulario.
79
79
  * @type {string}
80
80
  */
81
- this.name = '';
81
+ this.name = "";
82
82
  /**
83
83
  * El texto de la etiqueta flotante.
84
84
  * @type {string}
85
85
  */
86
- this.label = '';
86
+ this.label = "";
87
87
  /**
88
88
  * Variante visual del campo de texto.
89
89
  * @type {'filled' | 'outlined' | 'underlined'}
90
90
  * @default 'filled'
91
91
  */
92
- this.variant = 'filled';
92
+ this.variant = "filled";
93
93
  /**
94
94
  * Define las dimensiones del campo de texto.
95
95
  * @type {'small' | 'medium' | 'large' | 'extra'}
96
96
  * @default 'medium'
97
97
  */
98
- this.size = 'medium';
98
+ this.size = "medium";
99
99
  /**
100
100
  * Forma del radio del borde (border-radius) del campo.
101
101
  * @type {'round' | 'small-round' | 'no-round'}
102
102
  * @default 'no-round'
103
103
  */
104
- this.shape = 'no-round';
104
+ this.shape = "no-round";
105
105
  /**
106
106
  * El tipo de input HTML nativo.
107
107
  * @type {'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week' | 'color'}
108
108
  * @default 'text'
109
109
  */
110
- this.type = 'text';
110
+ this.type = "text";
111
111
  /**
112
112
  * Nombre del icono inicial (leading) (Material Symbols).
113
113
  * @type {string}
114
114
  */
115
- this.icon = '';
115
+ this.icon = "";
116
116
  /**
117
117
  * Nombre del icono final (trailing) (Material Symbols).
118
118
  * @type {string}
119
119
  */
120
- this.trailingIcon = '';
120
+ this.trailingIcon = "";
121
121
  /**
122
122
  * Prefijo de texto corto mostrado antes del valor del input.
123
123
  * @type {string}
124
124
  */
125
- this.prefix = '';
125
+ this.prefix = "";
126
126
  /**
127
127
  * Sufijo de texto corto mostrado después del valor del input.
128
128
  * @type {string}
129
129
  */
130
- this.suffix = '';
130
+ this.suffix = "";
131
131
  /** Icono del botón interactivo ubicado al final del campo. */
132
- this.suffixButtonIcon = '';
132
+ this.suffixButtonIcon = "";
133
133
  /** Etiqueta accesible del botón suffix. */
134
- this.suffixButtonLabel = 'Acción del campo';
134
+ this.suffixButtonLabel = "Acción del campo";
135
135
  this._hasSuffixSlot = false;
136
136
  /**
137
137
  * Texto de ayuda mostrado debajo del campo.
138
138
  * @type {string}
139
139
  */
140
- this.helper = '';
140
+ this.helper = "";
141
141
  /**
142
142
  * Texto de error mostrado debajo del campo cuando `error` es true.
143
143
  * Sobrescribe el texto de ayuda.
144
144
  * @type {string}
145
145
  */
146
- this.errorText = '';
146
+ this.errorText = "";
147
147
  /**
148
148
  * Si es true, establece el campo en un estado de error.
149
149
  * @type {boolean}
@@ -163,12 +163,12 @@ let MoniTextField = class MoniTextField extends MoniElement {
163
163
  * El valor actual del input.
164
164
  * @type {string}
165
165
  */
166
- this.value = '';
166
+ this.value = "";
167
167
  /**
168
168
  * Texto de marcador de posición (placeholder) mostrado cuando el input está vacío y la etiqueta es flotante.
169
169
  * @type {string}
170
170
  */
171
- this.placeholder = '';
171
+ this.placeholder = "";
172
172
  /*
173
173
  * Restricciones nativas.
174
174
  *
@@ -187,29 +187,29 @@ let MoniTextField = class MoniTextField extends MoniElement {
187
187
  /** Impide editar el valor sin sacarlo del envío ni atenuarlo como `disabled`. */
188
188
  this.readonly = false;
189
189
  /** Pista de autocompletado del navegador, por ejemplo `email` o `current-password`. */
190
- this.autocomplete = '';
190
+ this.autocomplete = "";
191
191
  /** Teclado virtual a mostrar en móvil, por ejemplo `numeric` o `tel`. */
192
- this.inputmode = '';
192
+ this.inputmode = "";
193
193
  /** Máximo de caracteres aceptados. */
194
194
  this.maxlength = null;
195
195
  /** Mínimo de caracteres aceptados. */
196
196
  this.minlength = null;
197
197
  /** Valor mínimo para `number` y los tipos de fecha y hora. */
198
- this.min = '';
198
+ this.min = "";
199
199
  /** Valor máximo para `number` y los tipos de fecha y hora. */
200
- this.max = '';
200
+ this.max = "";
201
201
  /** Incremento para `number` y los tipos de fecha y hora. */
202
- this.step = '';
202
+ this.step = "";
203
203
  /** Expresión regular que debe cumplir el valor. */
204
- this.pattern = '';
204
+ this.pattern = "";
205
205
  /**
206
206
  * Patrón Inputmask. Admite opcionales `[]`, grupos `()`, alternadores `|`,
207
207
  * cuantificadores `{n,m}` y los tokens `9`, `a`, `*` y `K` (RUT).
208
208
  * @example `99.999.999-K`
209
209
  */
210
- this.mask = '';
210
+ this.mask = "";
211
211
  /** Alias integrado de Inputmask, por ejemplo `email`, `datetime`, `numeric`, `currency` o `ip`. */
212
- this.maskAlias = '';
212
+ this.maskAlias = "";
213
213
  /** Opciones avanzadas de Inputmask. También acepta JSON mediante el atributo `mask-options`. */
214
214
  this.maskOptions = {};
215
215
  this._internals = this.attachInternals();
@@ -225,12 +225,12 @@ let MoniTextField = class MoniTextField extends MoniElement {
225
225
  maskOption(nameOrOptions, noRemask = false) {
226
226
  if (!this._maskInstance)
227
227
  return undefined;
228
- return typeof nameOrOptions === 'string'
228
+ return typeof nameOrOptions === "string"
229
229
  ? this._maskInstance.option(nameOrOptions)
230
230
  : this._maskInstance.option(nameOrOptions, noRemask);
231
231
  }
232
232
  getEmptyMask() {
233
- return this._maskInstance?.getemptymask() ?? '';
233
+ return this._maskInstance?.getemptymask() ?? "";
234
234
  }
235
235
  hasMaskedValue() {
236
236
  return this._maskInstance?.hasMaskedValue() ?? false;
@@ -266,13 +266,13 @@ let MoniTextField = class MoniTextField extends MoniElement {
266
266
  if (!this._input || (!this.mask && !this.maskAlias))
267
267
  return;
268
268
  const options = {
269
- placeholder: '',
269
+ placeholder: "",
270
270
  ...this.maskOptions,
271
271
  ...(this.mask ? { mask: this.mask } : {}),
272
272
  definitions: {
273
273
  ...(this.maskOptions.definitions ?? {}),
274
- K: { validator: '[0-9Kk]', casing: 'upper' }
275
- }
274
+ K: { validator: "[0-9Kk]", casing: "upper" },
275
+ },
276
276
  };
277
277
  const inputmask = this.maskAlias
278
278
  ? new Inputmask(this.maskAlias, options)
@@ -294,17 +294,19 @@ let MoniTextField = class MoniTextField extends MoniElement {
294
294
  */
295
295
  updated(changed) {
296
296
  if (this._input) {
297
- if (changed.has('mask') || changed.has('maskAlias') || changed.has('maskOptions')) {
297
+ if (changed.has("mask") ||
298
+ changed.has("maskAlias") ||
299
+ changed.has("maskOptions")) {
298
300
  this._configureMask();
299
301
  }
300
- if (changed.has('value')) {
302
+ if (changed.has("value")) {
301
303
  this._input.value = this.value;
302
304
  if (this._maskInstance && this.value !== this._input.value) {
303
305
  this.value = this._input.value;
304
306
  }
305
307
  this._internals?.setFormValue?.(this.value);
306
308
  }
307
- if (changed.has('disabled'))
309
+ if (changed.has("disabled"))
308
310
  this._input.disabled = this.disabled;
309
311
  }
310
312
  this._syncValidity();
@@ -321,12 +323,12 @@ let MoniTextField = class MoniTextField extends MoniElement {
321
323
  * el navegador tenga dónde mostrarlo y a dónde mover el foco.
322
324
  */
323
325
  /**
324
- * API de validación equivalente a la de un control nativo.
325
- *
326
- * Los elementos form-associated participan en la validación del formulario,
327
- * pero no reciben estos miembros automáticamente: hay que exponerlos para que
328
- * un `moni-text-field` se pueda interrogar igual que un `<input>`.
329
- */
326
+ * API de validación equivalente a la de un control nativo.
327
+ *
328
+ * Los elementos form-associated participan en la validación del formulario,
329
+ * pero no reciben estos miembros automáticamente: hay que exponerlos para que
330
+ * un `moni-text-field` se pueda interrogar igual que un `<input>`.
331
+ */
330
332
  get validity() {
331
333
  return this._internals.validity;
332
334
  }
@@ -350,15 +352,23 @@ let MoniTextField = class MoniTextField extends MoniElement {
350
352
  // Al teclear, `value` no siempre cambia de referencia (máscaras), así que
351
353
  // la validez se refresca aquí y no sólo desde `updated()`.
352
354
  this._syncValidity();
353
- emitMoniEvent(this, 'moni-input', {
354
- detail: { value: this.value, unmaskedValue: this.unmaskedValue, originalEvent: e }
355
+ emitMoniEvent(this, "moni-input", {
356
+ detail: {
357
+ value: this.value,
358
+ unmaskedValue: this.unmaskedValue,
359
+ originalEvent: e,
360
+ },
355
361
  });
356
362
  }
357
363
  _handleChange(e) {
358
364
  const target = e.target;
359
365
  this.value = target.value;
360
- emitMoniEvent(this, 'moni-change', {
361
- detail: { value: this.value, unmaskedValue: this.unmaskedValue, originalEvent: e }
366
+ emitMoniEvent(this, "moni-change", {
367
+ detail: {
368
+ value: this.value,
369
+ unmaskedValue: this.unmaskedValue,
370
+ originalEvent: e,
371
+ },
362
372
  });
363
373
  }
364
374
  disconnectedCallback() {
@@ -369,50 +379,77 @@ let MoniTextField = class MoniTextField extends MoniElement {
369
379
  _handleSuffixClick(event) {
370
380
  if (this.disabled)
371
381
  return;
372
- this.dispatchEvent(new CustomEvent('suffix-click', {
382
+ this.dispatchEvent(new CustomEvent("suffix-click", {
373
383
  detail: { originalEvent: event },
374
384
  bubbles: true,
375
- composed: true
385
+ composed: true,
376
386
  }));
377
387
  }
378
388
  _handleSuffixSlotChange(event) {
379
389
  const slot = event.currentTarget;
380
390
  this._hasSuffixSlot = slot.assignedElements({ flatten: true }).length > 0;
381
391
  }
382
- static { this.styles = [sharedStyles, fieldStyles, css `
383
- .suffix-action {
384
- position: absolute;
385
- inset-inline-end: .5rem;
386
- inset-block-start: calc(var(--_middle) - 1.25rem);
387
- z-index: 3;
388
- display: grid;
389
- place-items: center;
390
- inline-size: 2.5rem;
391
- block-size: 2.5rem;
392
- pointer-events: auto;
393
- }
394
- .suffix-action[hidden] { display: none; }
395
- .suffix-button {
396
- all: unset;
397
- box-sizing: border-box;
398
- display: grid;
399
- place-items: center;
400
- inline-size: 2.5rem;
401
- block-size: 2.5rem;
402
- border-radius: 50%;
403
- color: var(--on-surface-variant);
404
- cursor: pointer;
405
- transition: background-color 150ms ease, transform 150ms ease;
406
- }
407
- .suffix-button:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
408
- .suffix-button:active { background: color-mix(in srgb, currentColor 12%, transparent); transform: scale(.92); }
409
- .suffix-button:focus-visible { outline: .125rem solid var(--primary); outline-offset: .125rem; }
410
- .suffix-button:disabled { opacity: .38; cursor: default; }
411
- .suffix-button moni-icon { --moni-icon-size: 1.5rem; }
412
- ::slotted([slot='suffix']) { pointer-events: auto; }
413
- .field.suffix-action-field > input { padding-inline-end: 3.5rem; }
414
- .field.suffix-action-field > input:focus { padding-inline-end: 3.4375rem; }
415
- `]; }
392
+ static { this.styles = [
393
+ sharedStyles,
394
+ fieldStyles,
395
+ css `
396
+ .suffix-action {
397
+ position: absolute;
398
+ inset-inline-end: 0.5rem;
399
+ inset-block-start: calc(var(--_middle) - 1.25rem);
400
+ z-index: 3;
401
+ display: grid;
402
+ place-items: center;
403
+ inline-size: 2.5rem;
404
+ block-size: 2.5rem;
405
+ pointer-events: auto;
406
+ }
407
+ .suffix-action[hidden] {
408
+ display: none;
409
+ }
410
+ .suffix-button {
411
+ all: unset;
412
+ box-sizing: border-box;
413
+ display: grid;
414
+ place-items: center;
415
+ inline-size: 2.5rem;
416
+ block-size: 2.5rem;
417
+ border-radius: 50%;
418
+ color: var(--on-surface-variant);
419
+ cursor: pointer;
420
+ transition:
421
+ background-color 150ms ease,
422
+ transform 150ms ease;
423
+ }
424
+ .suffix-button:hover {
425
+ background: color-mix(in srgb, currentColor 8%, transparent);
426
+ }
427
+ .suffix-button:active {
428
+ background: color-mix(in srgb, currentColor 12%, transparent);
429
+ transform: scale(0.92);
430
+ }
431
+ .suffix-button:focus-visible {
432
+ outline: 0.125rem solid var(--primary);
433
+ outline-offset: 0.125rem;
434
+ }
435
+ .suffix-button:disabled {
436
+ opacity: 0.38;
437
+ cursor: default;
438
+ }
439
+ .suffix-button moni-icon {
440
+ --moni-icon-size: 1.5rem;
441
+ }
442
+ ::slotted([slot="suffix"]) {
443
+ pointer-events: auto;
444
+ }
445
+ .field.suffix-action-field > input {
446
+ padding-inline-end: 3.5rem;
447
+ }
448
+ .field.suffix-action-field > input:focus {
449
+ padding-inline-end: 3.4375rem;
450
+ }
451
+ `,
452
+ ]; }
416
453
  /**
417
454
  * Renderiza el campo de texto con animación de etiqueta flotante, iconos iniciales/finales, y texto de ayuda.
418
455
  *
@@ -437,107 +474,114 @@ let MoniTextField = class MoniTextField extends MoniElement {
437
474
  */
438
475
  render() {
439
476
  const hasLeading = Boolean(this.icon) || Boolean(this.prefix);
440
- const hasTrailing = Boolean(this.trailingIcon) || Boolean(this.suffix) || Boolean(this.suffixButtonIcon) || this._hasSuffixSlot;
477
+ const hasTrailing = Boolean(this.trailingIcon) ||
478
+ Boolean(this.suffix) ||
479
+ Boolean(this.suffixButtonIcon) ||
480
+ this._hasSuffixSlot;
441
481
  const isActive = Boolean(this.value) || Boolean(this.placeholder);
442
482
  const fieldClasses = {
443
483
  field: true,
444
484
  label: Boolean(this.label),
445
- fill: this.variant === 'filled',
446
- border: this.variant === 'outlined',
447
- small: this.size === 'small',
448
- large: this.size === 'large',
449
- extra: this.size === 'extra',
485
+ fill: this.variant === "filled",
486
+ border: this.variant === "outlined",
487
+ small: this.size === "small",
488
+ large: this.size === "large",
489
+ extra: this.size === "extra",
450
490
  prefix: hasLeading,
451
491
  suffix: hasTrailing,
452
- 'suffix-action-field': Boolean(this.suffixButtonIcon) || this._hasSuffixSlot,
492
+ "suffix-action-field": Boolean(this.suffixButtonIcon) || this._hasSuffixSlot,
453
493
  invalid: this.error,
454
- round: this.shape === 'round' && this.variant !== 'underlined',
455
- 'small-round': this.shape === 'small-round' && this.variant !== 'underlined',
456
- square: this.shape === 'no-round'
494
+ round: this.shape === "round" && this.variant !== "underlined",
495
+ "small-round": this.shape === "small-round" && this.variant !== "underlined",
496
+ square: this.shape === "no-round",
457
497
  };
458
- const placeholder = this.placeholder || (this.label ? ' ' : '');
498
+ const placeholder = this.placeholder || (this.label ? " " : "");
459
499
  const leading = this.icon
460
- ? html `<i class="leading-icon" part="leading-icon"
461
- ><moni-icon name="${this.icon}"></moni-icon
462
- ></i>`
500
+ ? html `<i class="leading-icon" part="leading-icon"
501
+ ><moni-icon name="${this.icon}"></moni-icon
502
+ ></i>`
463
503
  : this.prefix
464
- ? html `<span class="leading-icon" part="prefix"
465
- >${this.prefix}</span
466
- >`
504
+ ? html `<span class="leading-icon" part="prefix">${this.prefix}</span>`
467
505
  : nothing;
468
506
  const trailing = this.loading
469
- ? html `<i class="trailing-icon" part="trailing-icon"
470
- ><moni-progress
471
- variant="circular"
472
- indeterminate
473
- size="small"
474
- style="inline-size: 1.25rem; block-size: 1.25rem; color: currentColor;"
475
- ></moni-progress
476
- ></i>`
507
+ ? html `<i class="trailing-icon" part="trailing-icon"
508
+ ><moni-progress
509
+ variant="circular"
510
+ indeterminate
511
+ size="small"
512
+ style="inline-size: 1.25rem; block-size: 1.25rem; color: currentColor;"
513
+ ></moni-progress
514
+ ></i>`
477
515
  : this.suffixButtonIcon
478
- ? html `<span class="suffix-action" part="suffix-action">
479
- <button
480
- type="button"
481
- class="suffix-button"
482
- part="suffix-button"
483
- aria-label=${this.suffixButtonLabel}
484
- ?disabled=${this.disabled}
485
- @click=${this._handleSuffixClick}
486
- ><moni-icon name=${this.suffixButtonIcon}></moni-icon></button>
487
- </span>`
516
+ ? html `<span class="suffix-action" part="suffix-action">
517
+ <button
518
+ type="button"
519
+ class="suffix-button"
520
+ part="suffix-button"
521
+ aria-label=${this.suffixButtonLabel}
522
+ ?disabled=${this.disabled}
523
+ @click=${this._handleSuffixClick}
524
+ >
525
+ <moni-icon name=${this.suffixButtonIcon}></moni-icon>
526
+ </button>
527
+ </span>`
488
528
  : this.trailingIcon
489
- ? html `<i class="trailing-icon" part="trailing-icon"
490
- ><moni-icon name="${this.trailingIcon}"></moni-icon
491
- ></i>`
529
+ ? html `<i class="trailing-icon" part="trailing-icon"
530
+ ><moni-icon name="${this.trailingIcon}"></moni-icon
531
+ ></i>`
492
532
  : this.suffix
493
- ? html `<span class="trailing-icon" part="suffix"
494
- >${this.suffix}</span
495
- >`
533
+ ? html `<span class="trailing-icon" part="suffix"
534
+ >${this.suffix}</span
535
+ >`
496
536
  : nothing;
497
- return html `<div class=${classMap(fieldClasses)} part="field">
498
- ${leading}
499
- <input
500
- id="input"
501
- part="input"
502
- type=${this.type}
503
- placeholder=${placeholder}
504
- ?disabled=${this.disabled}
505
- ?required=${this.required}
506
- ?readonly=${this.readonly}
507
- autocomplete=${ifDefined(this.autocomplete || undefined)}
508
- inputmode=${ifDefined(this.inputmode || undefined)}
509
- maxlength=${ifDefined(this.maxlength ?? undefined)}
510
- minlength=${ifDefined(this.minlength ?? undefined)}
511
- min=${ifDefined(this.min || undefined)}
512
- max=${ifDefined(this.max || undefined)}
513
- step=${ifDefined(this.step || undefined)}
514
- pattern=${ifDefined(this.pattern || undefined)}
515
- .value=${this.value}
516
- name=${ifDefined(this.name || undefined)}
517
- class=${isActive ? 'active' : ''}
518
- @input=${this._handleInput}
519
- @change=${this._handleChange}
520
- />
521
- ${this.label
522
- ? html `<label
523
- for="input"
524
- part="label"
525
- class=${classMap({ active: isActive })}
526
- >${this.label}</label
527
- >`
528
- : nothing}
529
- ${trailing}
530
- <span class="suffix-action" part="suffix-action" ?hidden=${Boolean(this.suffixButtonIcon) || !this._hasSuffixSlot}>
531
- <slot name="suffix" @slotchange=${this._handleSuffixSlotChange}></slot>
532
- </span>
533
- ${this.error
534
- ? html `<output part="helper" class="invalid"
535
- >${this.errorText || this.helper}</output
536
- >`
537
+ return html `<div class=${classMap(fieldClasses)} part="field">
538
+ ${leading}
539
+ <input
540
+ id="input"
541
+ part="input"
542
+ type=${this.type}
543
+ placeholder=${placeholder}
544
+ ?disabled=${this.disabled}
545
+ ?required=${this.required}
546
+ ?readonly=${this.readonly}
547
+ autocomplete=${ifDefined(this.autocomplete || undefined)}
548
+ inputmode=${ifDefined(this.inputmode || undefined)}
549
+ maxlength=${ifDefined(this.maxlength ?? undefined)}
550
+ minlength=${ifDefined(this.minlength ?? undefined)}
551
+ min=${ifDefined(this.min || undefined)}
552
+ max=${ifDefined(this.max || undefined)}
553
+ step=${ifDefined(this.step || undefined)}
554
+ pattern=${ifDefined(this.pattern || undefined)}
555
+ .value=${this.value}
556
+ name=${ifDefined(this.name || undefined)}
557
+ class=${isActive ? "active" : ""}
558
+ @input=${this._handleInput}
559
+ @change=${this._handleChange}
560
+ />
561
+ ${this.label
562
+ ? html `<label
563
+ for="input"
564
+ part="label"
565
+ class=${classMap({ active: isActive })}
566
+ >${this.label}</label
567
+ >`
568
+ : nothing}
569
+ ${trailing}
570
+ <span
571
+ class="suffix-action"
572
+ part="suffix-action"
573
+ ?hidden=${Boolean(this.suffixButtonIcon) || !this._hasSuffixSlot}
574
+ >
575
+ <slot name="suffix" @slotchange=${this._handleSuffixSlotChange}></slot>
576
+ </span>
577
+ ${this.error
578
+ ? html `<output part="helper" class="invalid"
579
+ >${this.errorText || this.helper}</output
580
+ >`
537
581
  : this.helper
538
582
  ? html `<output part="helper">${this.helper}</output>`
539
- : nothing}
540
- </div>`;
583
+ : nothing}
584
+ </div>`;
541
585
  }
542
586
  };
543
587
  __decorate([
@@ -562,7 +606,7 @@ __decorate([
562
606
  property({ reflect: true })
563
607
  ], MoniTextField.prototype, "icon", void 0);
564
608
  __decorate([
565
- property({ reflect: true, attribute: 'trailing-icon' })
609
+ property({ reflect: true, attribute: "trailing-icon" })
566
610
  ], MoniTextField.prototype, "trailingIcon", void 0);
567
611
  __decorate([
568
612
  property({ reflect: true })
@@ -571,10 +615,10 @@ __decorate([
571
615
  property({ reflect: true })
572
616
  ], MoniTextField.prototype, "suffix", void 0);
573
617
  __decorate([
574
- property({ reflect: true, attribute: 'suffix-button-icon' })
618
+ property({ reflect: true, attribute: "suffix-button-icon" })
575
619
  ], MoniTextField.prototype, "suffixButtonIcon", void 0);
576
620
  __decorate([
577
- property({ reflect: true, attribute: 'suffix-button-label' })
621
+ property({ reflect: true, attribute: "suffix-button-label" })
578
622
  ], MoniTextField.prototype, "suffixButtonLabel", void 0);
579
623
  __decorate([
580
624
  state()
@@ -583,7 +627,7 @@ __decorate([
583
627
  property({ reflect: true })
584
628
  ], MoniTextField.prototype, "helper", void 0);
585
629
  __decorate([
586
- property({ reflect: true, attribute: 'error-text' })
630
+ property({ reflect: true, attribute: "error-text" })
587
631
  ], MoniTextField.prototype, "errorText", void 0);
588
632
  __decorate([
589
633
  property({ type: Boolean, reflect: true })
@@ -634,11 +678,11 @@ __decorate([
634
678
  property({ reflect: true })
635
679
  ], MoniTextField.prototype, "mask", void 0);
636
680
  __decorate([
637
- property({ reflect: true, attribute: 'mask-alias' })
681
+ property({ reflect: true, attribute: "mask-alias" })
638
682
  ], MoniTextField.prototype, "maskAlias", void 0);
639
683
  __decorate([
640
684
  property({
641
- attribute: 'mask-options',
685
+ attribute: "mask-options",
642
686
  converter: {
643
687
  fromAttribute: (value) => {
644
688
  if (!value)
@@ -650,15 +694,15 @@ __decorate([
650
694
  return {};
651
695
  }
652
696
  },
653
- toAttribute: (value) => JSON.stringify(value ?? {})
654
- }
697
+ toAttribute: (value) => JSON.stringify(value ?? {}),
698
+ },
655
699
  })
656
700
  ], MoniTextField.prototype, "maskOptions", void 0);
657
701
  __decorate([
658
- query('input')
702
+ query("input")
659
703
  ], MoniTextField.prototype, "_input", void 0);
660
704
  MoniTextField = __decorate([
661
- customElement('moni-text-field')
705
+ customElement("moni-text-field")
662
706
  ], MoniTextField);
663
707
  export { MoniTextField };
664
708
  export default MoniTextField;