@mgdis/mg-components 5.9.1 → 5.10.0

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 (126) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mg-action-more_31.cjs.entry.js +31 -225
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-item-more.cjs.entry.js +1 -16
  5. package/dist/cjs/{mg-menu.conf-9afe6571.js → mg-menu.conf-1942ac70.js} +0 -5
  6. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -3
  7. package/dist/collection/components/atoms/mg-button/mg-button.js +2 -7
  8. package/dist/collection/components/atoms/mg-card/mg-card.js +13 -4
  9. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +0 -2
  10. package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -1
  11. package/dist/collection/components/atoms/mg-icon/mg-icon.js +10 -5
  12. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +0 -2
  13. package/dist/collection/components/atoms/mg-tag/mg-tag.js +0 -3
  14. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -13
  15. package/dist/collection/components/molecules/inputs/MgInput.js +0 -6
  16. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +0 -6
  17. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +0 -5
  18. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +0 -12
  19. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +0 -3
  20. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +0 -9
  21. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +0 -13
  22. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -12
  23. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -5
  24. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +0 -5
  25. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +0 -11
  26. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +0 -18
  27. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +0 -8
  28. package/dist/collection/components/molecules/mg-details/mg-details.js +0 -3
  29. package/dist/collection/components/molecules/mg-form/mg-form.js +0 -8
  30. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +0 -2
  31. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +0 -5
  32. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -7
  33. package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -6
  34. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +0 -6
  35. package/dist/collection/components/molecules/mg-panel/mg-panel.js +5 -15
  36. package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -8
  37. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -4
  38. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +0 -12
  39. package/dist/collection/locales/index.js +0 -1
  40. package/dist/collection/utils/behaviors.utils.js +0 -10
  41. package/dist/collection/utils/components.utils.js +1 -10
  42. package/dist/collection/utils/locale.utils.js +0 -4
  43. package/dist/collection/utils/unit.test.utils.js +0 -5
  44. package/dist/components/MgInput.js +0 -6
  45. package/dist/components/components.utils.js +1 -10
  46. package/dist/components/index2.js +0 -5
  47. package/dist/components/mg-action-more.js +0 -8
  48. package/dist/components/mg-badge2.js +1 -3
  49. package/dist/components/mg-button2.js +2 -7
  50. package/dist/components/mg-card2.js +13 -4
  51. package/dist/components/mg-character-left2.js +0 -2
  52. package/dist/components/mg-details.js +0 -3
  53. package/dist/components/mg-divider.js +0 -1
  54. package/dist/components/mg-form.js +0 -8
  55. package/dist/components/mg-icon2.js +10 -5
  56. package/dist/components/mg-illustrated-message.js +0 -2
  57. package/dist/components/mg-input-checkbox.js +0 -6
  58. package/dist/components/mg-input-date.js +0 -5
  59. package/dist/components/mg-input-numeric.js +0 -12
  60. package/dist/components/mg-input-password.js +0 -3
  61. package/dist/components/mg-input-radio.js +0 -9
  62. package/dist/components/mg-input-select2.js +0 -13
  63. package/dist/components/mg-input-text2.js +1 -12
  64. package/dist/components/mg-input-textarea.js +1 -5
  65. package/dist/components/mg-input-title2.js +0 -2
  66. package/dist/components/mg-input-toggle.js +0 -5
  67. package/dist/components/mg-item-more.js +0 -15
  68. package/dist/components/mg-menu-item2.js +0 -18
  69. package/dist/components/mg-menu2.js +0 -11
  70. package/dist/components/mg-message.js +2 -7
  71. package/dist/components/mg-modal.js +1 -6
  72. package/dist/components/mg-pagination.js +0 -6
  73. package/dist/components/mg-panel.js +5 -15
  74. package/dist/components/mg-popover2.js +1 -8
  75. package/dist/components/mg-skip-links.js +1 -4
  76. package/dist/components/mg-tabs.js +0 -12
  77. package/dist/components/mg-tag.js +0 -3
  78. package/dist/components/mg-tooltip2.js +1 -13
  79. package/dist/esm/loader.js +1 -1
  80. package/dist/esm/mg-action-more_31.entry.js +31 -225
  81. package/dist/esm/mg-components.js +1 -1
  82. package/dist/esm/mg-item-more.entry.js +1 -16
  83. package/dist/esm/{mg-menu.conf-881fbd82.js → mg-menu.conf-2cc1bb67.js} +0 -5
  84. package/dist/mg-components/mg-components.esm.js +1 -1
  85. package/dist/mg-components/{p-67ce7cb8.entry.js → p-a56a3157.entry.js} +1 -1
  86. package/dist/mg-components/{p-9a93b7af.entry.js → p-eb32bb18.entry.js} +1 -1
  87. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +0 -2
  88. package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -5
  89. package/dist/types/components/atoms/mg-card/mg-card.d.ts +10 -3
  90. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +0 -2
  91. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +0 -1
  92. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +6 -3
  93. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +0 -2
  94. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +0 -3
  95. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +0 -12
  96. package/dist/types/components/molecules/inputs/MgInput.d.ts +0 -1
  97. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +0 -5
  98. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +0 -5
  99. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +0 -12
  100. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +0 -3
  101. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -8
  102. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -9
  103. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +0 -11
  104. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +0 -4
  105. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +0 -5
  106. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +0 -11
  107. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +0 -18
  108. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +0 -5
  109. package/dist/types/components/molecules/mg-details/mg-details.d.ts +0 -3
  110. package/dist/types/components/molecules/mg-form/mg-form.d.ts +0 -8
  111. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +0 -2
  112. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +0 -5
  113. package/dist/types/components/molecules/mg-message/mg-message.d.ts +1 -6
  114. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +0 -5
  115. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +0 -5
  116. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +0 -10
  117. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +0 -7
  118. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +0 -3
  119. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +0 -11
  120. package/dist/types/locales/index.d.ts +0 -1
  121. package/dist/types/utils/behaviors.utils.d.ts +0 -9
  122. package/dist/types/utils/components.utils.d.ts +1 -9
  123. package/dist/types/utils/locale.utils.d.ts +0 -4
  124. package/dist/types/utils/unit.test.utils.d.ts +0 -7
  125. package/package.json +11 -12
  126. /package/dist/mg-components/{p-367f92d2.js → p-73156ac9.js} +0 -0
@@ -240,10 +240,18 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
240
240
  this.__attachShadow();
241
241
  /**
242
242
  * getIcon
243
- *
244
243
  * @returns {HTMLElement} icon html
245
244
  */
246
245
  this.getIcon = () => icons[this.icon]();
246
+ /**
247
+ * Method to set default varianStyle props
248
+ * needeed has stencil doesn't know that props is mutated when updated in prop watcher
249
+ * @returns {void}
250
+ */
251
+ this.setDefaultVariantStyle = () => {
252
+ if (this.variantStyle === undefined)
253
+ this.variantStyle = 'background';
254
+ };
247
255
  this.icon = undefined;
248
256
  this.size = 'regular';
249
257
  this.variant = undefined;
@@ -274,8 +282,7 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
274
282
  if (!variants.includes(newValue))
275
283
  throw new Error(`<mg-icon> prop "variant" must be one of: ${variants.join(', ')}`);
276
284
  else {
277
- if (this.variantStyle === undefined)
278
- this.variantStyle = 'background';
285
+ this.setDefaultVariantStyle();
279
286
  if (oldValue !== undefined)
280
287
  this.classList.delete(`mg-icon--variant-${oldValue}`);
281
288
  this.classList.add(`mg-icon--variant-${newValue}`);
@@ -305,7 +312,6 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
305
312
  }
306
313
  /**
307
314
  * Check if props are well configured on init
308
- *
309
315
  * @returns {void}
310
316
  */
311
317
  componentWillLoad() {
@@ -317,7 +323,6 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
317
323
  }
318
324
  /**
319
325
  * Render component
320
- *
321
326
  * @returns {HTMLElement} HTML Element
322
327
  */
323
328
  render() {
@@ -16,7 +16,6 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
16
16
  *************/
17
17
  /**
18
18
  * Check if component props are well configured on init
19
- *
20
19
  * @returns {void}
21
20
  */
22
21
  componentDidLoad() {
@@ -32,7 +31,6 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
32
31
  }
33
32
  /**
34
33
  * Render
35
- *
36
34
  * @returns {HTMLElement} HTML Element
37
35
  */
38
36
  render() {
@@ -10,7 +10,6 @@ const mgInputCheckboxCss = ":host{display:block}.mg-input{display:flex;align-ite
10
10
 
11
11
  /**
12
12
  * type CheckboxItem validation function
13
- *
14
13
  * @param {unknown} items Checkbox item
15
14
  * @returns {boolean} match item type
16
15
  */
@@ -32,7 +31,6 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
32
31
  this.hasDisplayedError = false;
33
32
  /**
34
33
  * Handle input event
35
- *
36
34
  * @param {InputEvent} event input event
37
35
  */
38
36
  this.handleInput = (event) => {
@@ -55,7 +53,6 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
55
53
  };
56
54
  /**
57
55
  * get invalid element
58
- *
59
56
  * @returns {HTMLInputElement} element
60
57
  */
61
58
  this.getInvalidElement = () => this.inputs.find((input) => input !== null && !input.disabled && !input.checkValidity());
@@ -123,7 +120,6 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
123
120
  }
124
121
  /**
125
122
  * Public method to display errors
126
- *
127
123
  * @returns {Promise<void>}
128
124
  */
129
125
  async displayError() {
@@ -136,7 +132,6 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
136
132
  *************/
137
133
  /**
138
134
  * Check if component props are well configured on init
139
- *
140
135
  * @returns {ReturnType<typeof setTimeout>} timeout
141
136
  */
142
137
  componentWillLoad() {
@@ -153,7 +148,6 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
153
148
  }
154
149
  /**
155
150
  * Render
156
- *
157
151
  * @returns {HTMLElement} HTML Element
158
152
  */
159
153
  render() {
@@ -53,7 +53,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
53
53
  };
54
54
  /**
55
55
  * get input error code
56
- *
57
56
  * @returns {null | InputError} error code
58
57
  */
59
58
  this.getInputError = () => {
@@ -79,7 +78,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
79
78
  };
80
79
  /**
81
80
  * Check input errors
82
- *
83
81
  * @returns {void}
84
82
  */
85
83
  this.setErrorMessage = () => {
@@ -149,7 +147,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
149
147
  }
150
148
  /**
151
149
  * Public method to display errors
152
- *
153
150
  * @returns {Promise<void>}
154
151
  */
155
152
  async displayError() {
@@ -162,7 +159,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
162
159
  *************/
163
160
  /**
164
161
  * Check if component props are well configured on init
165
- *
166
162
  * @returns {ReturnType<typeof setTimeout>} timeout
167
163
  */
168
164
  componentWillLoad() {
@@ -183,7 +179,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
183
179
  }
184
180
  /**
185
181
  * Render
186
- *
187
182
  * @returns {HTMLElement} HTML Element
188
183
  */
189
184
  render() {
@@ -31,7 +31,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
31
31
  this.hasDisplayedError = false;
32
32
  /**
33
33
  * Handle input event
34
- *
35
34
  * @returns {void}
36
35
  */
37
36
  this.handleInput = () => {
@@ -44,7 +43,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
44
43
  };
45
44
  /**
46
45
  * Handle focus event
47
- *
48
46
  * @returns {void}
49
47
  */
50
48
  this.handleFocus = () => {
@@ -52,7 +50,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
52
50
  };
53
51
  /**
54
52
  * Handle blur event
55
- *
56
53
  * @returns {void}
57
54
  */
58
55
  this.handleBlur = () => {
@@ -62,7 +59,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
62
59
  };
63
60
  /**
64
61
  * Check if input is valid
65
- *
66
62
  * @returns {void}
67
63
  */
68
64
  this.checkValidity = () => {
@@ -73,7 +69,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
73
69
  };
74
70
  /**
75
71
  * Set input error message
76
- *
77
72
  * @returns {void}
78
73
  */
79
74
  this.setErrorMessage = () => {
@@ -91,7 +86,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
91
86
  };
92
87
  /**
93
88
  * Get input error code
94
- *
95
89
  * @returns {null | InputError} error code
96
90
  */
97
91
  this.getInputError = () => {
@@ -120,14 +114,12 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
120
114
  };
121
115
  /**
122
116
  * Format value based on type
123
- *
124
117
  * @param {number} value value to format
125
118
  * @returns {string} formated local value
126
119
  */
127
120
  this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value, this.locale, this.currency) : localeNumber(value, this.locale));
128
121
  /**
129
122
  * Validate append slot
130
- *
131
123
  * @returns {void}
132
124
  */
133
125
  this.validateAppendSlot = () => {
@@ -216,7 +208,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
216
208
  }
217
209
  /**
218
210
  * Public method to display errors
219
- *
220
211
  * @returns {Promise<void>}
221
212
  */
222
213
  async displayError() {
@@ -227,7 +218,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
227
218
  /**
228
219
  * Displayed value in input
229
220
  * Change on focus/blur
230
- *
231
221
  * @returns {MgInputNumeric['value'] | MgInputNumeric['readonlyValue']} display value
232
222
  */
233
223
  displayValue() {
@@ -238,7 +228,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
238
228
  *************/
239
229
  /**
240
230
  * Check if component props are well configured on init
241
- *
242
231
  * @returns {ReturnType<typeof setTimeout>} timeout
243
232
  */
244
233
  componentWillLoad() {
@@ -262,7 +251,6 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
262
251
  }
263
252
  /**
264
253
  * Render
265
- *
266
254
  * @returns {HTMLElement} HTML Element
267
255
  */
268
256
  render() {
@@ -87,7 +87,6 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
87
87
  }
88
88
  /**
89
89
  * Public method to display errors
90
- *
91
90
  * @returns {Promise<void>}
92
91
  */
93
92
  async displayError() {
@@ -100,7 +99,6 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
100
99
  *************/
101
100
  /**
102
101
  * Check if component props are well configured on init
103
- *
104
102
  * @returns {ReturnType<typeof setTimeout>} timeout
105
103
  */
106
104
  componentWillLoad() {
@@ -115,7 +113,6 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
115
113
  }
116
114
  /**
117
115
  * Render
118
- *
119
116
  * @returns {HTMLElement} HTML Element
120
117
  */
121
118
  render() {
@@ -10,7 +10,6 @@ const mgInputRadioCss = ":host{display:block}.mg-input{display:flex;align-items:
10
10
 
11
11
  /**
12
12
  * type Option validation function
13
- *
14
13
  * @param {RadioOption} option radio option
15
14
  * @returns {boolean} radio option type is valid
16
15
  */
@@ -31,7 +30,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
31
30
  this.hasDisplayedError = false;
32
31
  /**
33
32
  * Handle input event
34
- *
35
33
  * @param {event} event input event
36
34
  * @returns {void}
37
35
  */
@@ -41,7 +39,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
41
39
  };
42
40
  /**
43
41
  * Handle blur event
44
- *
45
42
  * @returns {void}
46
43
  */
47
44
  this.handleBlur = () => {
@@ -50,7 +47,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
50
47
  };
51
48
  /**
52
49
  * Check if input is valid
53
- *
54
50
  * @returns {void}
55
51
  */
56
52
  this.checkValidity = () => {
@@ -61,7 +57,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
61
57
  };
62
58
  /**
63
59
  * Set input error message
64
- *
65
60
  * @returns {void}
66
61
  */
67
62
  this.setErrorMessage = () => {
@@ -74,7 +69,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
74
69
  };
75
70
  /**
76
71
  * get invalid element
77
- *
78
72
  * @returns {HTMLInputElement} element
79
73
  */
80
74
  this.getInvalidElement = () => this.inputs.find((input) => !input.disabled && !input.readOnly && !input.checkValidity());
@@ -129,7 +123,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
129
123
  }
130
124
  /**
131
125
  * Public method to display errors
132
- *
133
126
  * @returns {Promise<void>}
134
127
  */
135
128
  async displayError() {
@@ -142,7 +135,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
142
135
  *************/
143
136
  /**
144
137
  * Check if component props are well configured on init
145
- *
146
138
  * @returns {ReturnType<typeof setTimeout>} timeout
147
139
  */
148
140
  componentWillLoad() {
@@ -159,7 +151,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
159
151
  }
160
152
  /**
161
153
  * Render
162
- *
163
154
  * @returns {HTMLElement} HTML Element
164
155
  */
165
156
  render() {
@@ -10,28 +10,24 @@ const mgInputSelectCss = ":host{display:block}.mg-input{display:flex;align-items
10
10
 
11
11
  /**
12
12
  * Check if item is a well configured option
13
- *
14
13
  * @param {unknown} option select option
15
14
  * @returns {boolean} select option type is valid
16
15
  */
17
16
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string';
18
17
  /**
19
18
  * Check if items[] is SelectOption
20
- *
21
19
  * @param {unknown[]} items select option
22
20
  * @returns {boolean} select option array type is valid
23
21
  */
24
22
  const allItemsAreOptions = (items) => Array.isArray(items) && items.every(item => isOption(item));
25
23
  /**
26
24
  * Check if item is a well configured optgroup
27
- *
28
25
  * @param {unknown} optgroup select option
29
26
  * @returns {boolean} select optgroup type is valid
30
27
  */
31
28
  const isOptGroup = (optgroup) => typeof optgroup === 'object' && typeof optgroup.group === 'string' && allItemsAreOptions(optgroup.options);
32
29
  /**
33
30
  * Group options
34
- *
35
31
  * @param {(SelectOption | OptGroup)[]} acc reduce accumulator
36
32
  * @param {SelectOption} item item to add
37
33
  * @param {string} item.group item group
@@ -69,7 +65,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
69
65
  this.hasDisplayedError = false;
70
66
  /**
71
67
  * Handle input event
72
- *
73
68
  * @returns {void}
74
69
  */
75
70
  this.handleInput = () => {
@@ -79,14 +74,12 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
79
74
  };
80
75
  /**
81
76
  * Method to compare item.title with input.value
82
- *
83
77
  * @param {SelectOption} item item to compare with
84
78
  * @returns {boolean} truthy if input.value is an item
85
79
  */
86
80
  this.isInputValue = (item) => { var _a; return item.title === ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value); };
87
81
  /**
88
82
  * value props setter
89
- *
90
83
  * @param {MgInputSelect['value']} newValue value to update with
91
84
  * @returns {void}
92
85
  */
@@ -96,7 +89,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
96
89
  };
97
90
  /**
98
91
  * Update value from input.value
99
- *
100
92
  * @returns {void}
101
93
  */
102
94
  this.updateValue = () => {
@@ -123,7 +115,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
123
115
  };
124
116
  /**
125
117
  * Input value is disabled
126
- *
127
118
  * @returns {boolean} truthy if input value is disabled
128
119
  */
129
120
  this.isDisabledValue = () => { var _a; return allItemsAreOptions(this.options) && ((_a = this.options.find(this.isInputValue)) === null || _a === void 0 ? void 0 : _a.disabled) === true; };
@@ -149,7 +140,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
149
140
  };
150
141
  /**
151
142
  * Render option
152
- *
153
143
  * @param {SelectOption} option to render
154
144
  * @returns {HTMLElement} render option
155
145
  */
@@ -230,7 +220,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
230
220
  }
231
221
  /**
232
222
  * Public method to display errors
233
- *
234
223
  * @returns {Promise<void>}
235
224
  */
236
225
  async displayError() {
@@ -243,7 +232,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
243
232
  *************/
244
233
  /**
245
234
  * Check if component props are well configured on init
246
- *
247
235
  * @returns {ReturnType<typeof setTimeout>} timeout
248
236
  */
249
237
  componentWillLoad() {
@@ -265,7 +253,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
265
253
  }
266
254
  /**
267
255
  * Render
268
- *
269
256
  * @returns {HTMLElement} HTML Element
270
257
  */
271
258
  render() {
@@ -27,7 +27,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
27
27
  this.hasDisplayedError = false;
28
28
  /**
29
29
  * Handle input event
30
- *
31
30
  * @returns {void}
32
31
  */
33
32
  this.handleInput = () => {
@@ -39,7 +38,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
39
38
  };
40
39
  /**
41
40
  * Handle focus event
42
- *
43
41
  * @returns {void}
44
42
  */
45
43
  this.handleFocus = () => {
@@ -48,7 +46,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
48
46
  };
49
47
  /**
50
48
  * Handle blur event
51
- *
52
49
  * @returns {void}
53
50
  */
54
51
  this.handleBlur = () => {
@@ -60,7 +57,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
60
57
  };
61
58
  /**
62
59
  * Check if input is valid
63
- *
64
60
  * @returns {void}
65
61
  */
66
62
  this.checkValidity = () => {
@@ -72,7 +68,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
72
68
  };
73
69
  /**
74
70
  * Set input error message
75
- *
76
71
  * @returns {void}
77
72
  */
78
73
  this.setErrorMessage = () => {
@@ -89,11 +84,10 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
89
84
  };
90
85
  /**
91
86
  * Validate pattern configuration
92
- *
93
87
  * @returns {void}
94
88
  */
95
89
  this.validatePattern = () => {
96
- if (this.pattern &&
90
+ if (this.pattern !== undefined &&
97
91
  typeof this.pattern === 'string' &&
98
92
  this.pattern !== '' &&
99
93
  (this.patternErrorMessage === undefined || typeof this.patternErrorMessage !== 'string' || this.patternErrorMessage === '')) {
@@ -102,7 +96,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
102
96
  };
103
97
  /**
104
98
  * Validate append slot
105
- *
106
99
  * @returns {void}
107
100
  */
108
101
  this.validateAppendSlot = () => {
@@ -162,7 +155,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
162
155
  }
163
156
  /**
164
157
  * Public method to play input focus
165
- *
166
158
  * @returns {Promise<void>}
167
159
  */
168
160
  async setFocus() {
@@ -170,7 +162,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
170
162
  }
171
163
  /**
172
164
  * Public method to display errors
173
- *
174
165
  * @returns {Promise<void>}
175
166
  */
176
167
  async displayError() {
@@ -183,7 +174,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
183
174
  *************/
184
175
  /**
185
176
  * Check if component props are well configured on init
186
- *
187
177
  * @returns {ReturnType<typeof setTimeout>} timeout
188
178
  */
189
179
  componentWillLoad() {
@@ -203,7 +193,6 @@ const MgInputText = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
203
193
  }
204
194
  /**
205
195
  * Render
206
- *
207
196
  * @returns {HTMLElement} HTML Element
208
197
  */
209
198
  render() {
@@ -54,7 +54,6 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
54
54
  /**
55
55
  * Get pattern validity
56
56
  * Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
57
- *
58
57
  * @returns {boolean} is pattern valid
59
58
  */
60
59
  this.getPatternValidity = () => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);
@@ -87,7 +86,7 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
87
86
  * Validate pattern configuration
88
87
  */
89
88
  this.validatePattern = () => {
90
- if (this.pattern &&
89
+ if (this.pattern !== undefined &&
91
90
  typeof this.pattern === 'string' &&
92
91
  this.pattern !== '' &&
93
92
  (this.patternErrorMessage === undefined || typeof this.patternErrorMessage !== 'string' || this.patternErrorMessage === '')) {
@@ -142,7 +141,6 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
142
141
  }
143
142
  /**
144
143
  * Public method to display errors
145
- *
146
144
  * @returns {Promise<void>}
147
145
  */
148
146
  async displayError() {
@@ -155,7 +153,6 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
155
153
  *************/
156
154
  /**
157
155
  * Check if component props are well configured on init
158
- *
159
156
  * @returns {ReturnType<typeof setTimeout>} timeout
160
157
  */
161
158
  componentWillLoad() {
@@ -174,7 +171,6 @@ const MgInputTextarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
174
171
  }
175
172
  /**
176
173
  * Render
177
- *
178
174
  * @returns {HTMLElement} HTML Element
179
175
  */
180
176
  render() {
@@ -24,7 +24,6 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
24
24
  *************/
25
25
  /**
26
26
  * Init tag name
27
- *
28
27
  * @returns {void}
29
28
  */
30
29
  componentWillLoad() {
@@ -33,7 +32,6 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
33
32
  }
34
33
  /**
35
34
  * Render
36
- *
37
35
  * @returns {HTMLElement} HTML Element
38
36
  */
39
37
  render() {
@@ -9,7 +9,6 @@ const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items
9
9
 
10
10
  /**
11
11
  * type Option validation function
12
- *
13
12
  * @param {ToggleValue} option radio option
14
13
  * @returns {boolean} toggle option type is valid
15
14
  */
@@ -32,7 +31,6 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
32
31
  this.classIcon = 'mg-input--toggle-icon';
33
32
  /**
34
33
  * Change checked value
35
- *
36
34
  * @returns {void}
37
35
  */
38
36
  this.toggleChecked = () => {
@@ -40,7 +38,6 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
40
38
  };
41
39
  /**
42
40
  * Slots validation
43
- *
44
41
  * @returns {void}
45
42
  */
46
43
  this.validateSlots = () => {
@@ -128,7 +125,6 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
128
125
  }
129
126
  /**
130
127
  * set checked state
131
- *
132
128
  * @returns {void}
133
129
  */
134
130
  setChecked() {
@@ -171,7 +167,6 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
171
167
  }
172
168
  /**
173
169
  * Render
174
- *
175
170
  * @returns {HTMLElement} HTML Element
176
171
  */
177
172
  render() {