@mgdis/mg-components 5.10.0 → 5.10.1

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 (131) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mg-action-more_31.cjs.entry.js +318 -427
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-item-more.cjs.entry.js +19 -28
  5. package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-196151fe.js} +16 -16
  6. package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
  7. package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
  8. package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
  9. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
  10. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  11. package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
  12. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
  13. package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
  14. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +11 -21
  15. package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
  16. package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +10 -14
  18. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
  19. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
  20. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
  21. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
  22. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
  23. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
  24. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
  25. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
  26. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
  27. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
  28. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
  29. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
  30. package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
  31. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
  32. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
  33. package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
  34. package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
  35. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
  36. package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
  37. package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -13
  38. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
  39. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
  40. package/dist/collection/locales/index.js +2 -2
  41. package/dist/collection/utils/behaviors.utils.js +16 -22
  42. package/dist/collection/utils/components.utils.js +21 -23
  43. package/dist/collection/utils/locale.utils.js +14 -14
  44. package/dist/collection/utils/unit.test.utils.js +7 -10
  45. package/dist/components/MgInput.js +30 -18
  46. package/dist/components/components.utils.js +21 -23
  47. package/dist/components/index2.js +16 -16
  48. package/dist/components/mg-action-more.js +9 -13
  49. package/dist/components/mg-badge2.js +8 -9
  50. package/dist/components/mg-button2.js +16 -20
  51. package/dist/components/mg-card2.js +8 -10
  52. package/dist/components/mg-character-left2.js +1 -2
  53. package/dist/components/mg-details.js +1 -3
  54. package/dist/components/mg-divider.js +1 -1
  55. package/dist/components/mg-form.js +7 -15
  56. package/dist/components/mg-icon2.js +17 -19
  57. package/dist/components/mg-illustrated-message.js +1 -2
  58. package/dist/components/mg-input-checkbox.js +9 -10
  59. package/dist/components/mg-input-date.js +6 -8
  60. package/dist/components/mg-input-numeric.js +13 -18
  61. package/dist/components/mg-input-password.js +5 -6
  62. package/dist/components/mg-input-radio.js +9 -14
  63. package/dist/components/mg-input-select2.js +20 -28
  64. package/dist/components/mg-input-text2.js +14 -23
  65. package/dist/components/mg-input-textarea.js +12 -13
  66. package/dist/components/mg-input-title2.js +1 -2
  67. package/dist/components/mg-input-toggle.js +16 -19
  68. package/dist/components/mg-item-more.js +18 -27
  69. package/dist/components/mg-menu-item2.js +17 -26
  70. package/dist/components/mg-menu2.js +9 -16
  71. package/dist/components/mg-message.js +11 -14
  72. package/dist/components/mg-modal.js +7 -11
  73. package/dist/components/mg-pagination.js +11 -13
  74. package/dist/components/mg-panel.js +6 -15
  75. package/dist/components/mg-popover2.js +7 -13
  76. package/dist/components/mg-skip-links.js +2 -4
  77. package/dist/components/mg-tabs.js +20 -24
  78. package/dist/components/mg-tag.js +11 -13
  79. package/dist/components/mg-tooltip2.js +11 -21
  80. package/dist/esm/loader.js +1 -1
  81. package/dist/esm/mg-action-more_31.entry.js +318 -427
  82. package/dist/esm/mg-components.js +1 -1
  83. package/dist/esm/mg-item-more.entry.js +19 -28
  84. package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-9ca023ee.js} +16 -16
  85. package/dist/mg-components/mg-components.esm.js +1 -1
  86. package/dist/mg-components/{p-a56a3157.entry.js → p-97aaca3e.entry.js} +1 -1
  87. package/dist/mg-components/p-d891e707.entry.js +1 -0
  88. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -3
  89. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
  90. package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
  91. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
  92. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
  93. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
  94. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
  95. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
  96. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -21
  97. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
  98. package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
  99. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -6
  100. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
  101. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
  102. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
  103. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
  104. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
  105. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -13
  106. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
  107. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
  108. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
  109. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
  110. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
  111. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
  112. package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
  113. package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
  114. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
  115. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
  116. package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
  117. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
  118. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
  119. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
  120. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -9
  121. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
  122. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
  123. package/dist/types/components.d.ts +22 -34
  124. package/dist/types/locales/index.d.ts +2 -2
  125. package/dist/types/utils/behaviors.utils.d.ts +14 -20
  126. package/dist/types/utils/components.utils.d.ts +18 -20
  127. package/dist/types/utils/locale.utils.d.ts +14 -14
  128. package/dist/types/utils/unit.test.utils.d.ts +11 -17
  129. package/package.json +1 -1
  130. package/dist/mg-components/p-eb32bb18.entry.js +0 -1
  131. /package/dist/mg-components/{p-73156ac9.js → p-0d3146d9.js} +0 -0
@@ -10,7 +10,6 @@ export class MgInputNumeric {
10
10
  this.hasDisplayedError = false;
11
11
  /**
12
12
  * Handle input event
13
- * @returns {void}
14
13
  */
15
14
  this.handleInput = () => {
16
15
  // Check validity
@@ -22,23 +21,22 @@ export class MgInputNumeric {
22
21
  };
23
22
  /**
24
23
  * Handle focus event
25
- * @returns {void}
26
24
  */
27
25
  this.handleFocus = () => {
28
26
  this.hasFocus = true;
29
27
  };
30
28
  /**
31
29
  * Handle blur event
32
- * @returns {void}
33
30
  */
34
31
  this.handleBlur = () => {
32
+ if (this.value === '-')
33
+ this.value = '';
35
34
  // Display Error
36
35
  this.displayError();
37
36
  this.hasFocus = false;
38
37
  };
39
38
  /**
40
39
  * Check if input is valid
41
- * @returns {void}
42
40
  */
43
41
  this.checkValidity = () => {
44
42
  this.valid = this.readonly || this.disabled || this.getInputError() === null;
@@ -48,7 +46,6 @@ export class MgInputNumeric {
48
46
  };
49
47
  /**
50
48
  * Set input error message
51
- * @returns {void}
52
49
  */
53
50
  this.setErrorMessage = () => {
54
51
  // Set error message
@@ -65,7 +62,7 @@ export class MgInputNumeric {
65
62
  };
66
63
  /**
67
64
  * Get input error code
68
- * @returns {null | InputError} error code
65
+ * @returns error code
69
66
  */
70
67
  this.getInputError = () => {
71
68
  let inputError = null;
@@ -93,18 +90,17 @@ export class MgInputNumeric {
93
90
  };
94
91
  /**
95
92
  * Format value based on type
96
- * @param {number} value value to format
97
- * @returns {string} formated local value
93
+ * @param value - value to format
94
+ * @returns formated local value
98
95
  */
99
96
  this.formatValue = (value) => (this.type === 'currency' ? localeCurrency(value, this.locale, this.currency) : localeNumber(value, this.locale));
100
97
  /**
101
98
  * Validate append slot
102
- * @returns {void}
103
99
  */
104
100
  this.validateAppendSlot = () => {
105
101
  const slotAppendInput = this.element.querySelector('[slot="append-input"]');
106
102
  if (slotAppendInput !== null) {
107
- this.classList.add(slotAppendInput.nodeName === 'MG-BUTTON' ? 'mg-input--is-input-group-append' : 'mg-input--is-append-input-slot-content');
103
+ this.classCollection.add(slotAppendInput.nodeName === 'MG-BUTTON' ? 'mg-input--is-input-group-append' : 'mg-input--is-append-input-slot-content');
108
104
  }
109
105
  };
110
106
  this.value = undefined;
@@ -128,7 +124,7 @@ export class MgInputNumeric {
128
124
  this.decimalLength = 2;
129
125
  this.valid = undefined;
130
126
  this.invalid = undefined;
131
- this.classList = new ClassList(['mg-input--numeric']);
127
+ this.classCollection = new ClassList(['mg-input--numeric']);
132
128
  this.errorMessage = undefined;
133
129
  this.hasFocus = false;
134
130
  }
@@ -140,7 +136,7 @@ export class MgInputNumeric {
140
136
  // Regex
141
137
  const regex = this.type === 'integer' ? /^-?\d+$/ : /^-?\d+[.,]?\d*$/;
142
138
  // Filter input
143
- if (newValue === '' || (newValue.match(regex) && integer.length <= this.integerLength && decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength))) {
139
+ if (['', '-'].includes(newValue) || (newValue.match(regex) && integer.length <= this.integerLength && decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength))) {
144
140
  this.storedValue = newValue;
145
141
  }
146
142
  else if (this.storedValue !== undefined) {
@@ -187,7 +183,6 @@ export class MgInputNumeric {
187
183
  }
188
184
  /**
189
185
  * Public method to display errors
190
- * @returns {Promise<void>}
191
186
  */
192
187
  async displayError() {
193
188
  this.checkValidity();
@@ -197,7 +192,7 @@ export class MgInputNumeric {
197
192
  /**
198
193
  * Displayed value in input
199
194
  * Change on focus/blur
200
- * @returns {MgInputNumeric['value'] | MgInputNumeric['readonlyValue']} display value
195
+ * @returns display value
201
196
  */
202
197
  displayValue() {
203
198
  return this.hasFocus ? this.value : this.readonlyValue;
@@ -207,7 +202,7 @@ export class MgInputNumeric {
207
202
  *************/
208
203
  /**
209
204
  * Check if component props are well configured on init
210
- * @returns {ReturnType<typeof setTimeout>} timeout
205
+ * @returns timeout
211
206
  */
212
207
  componentWillLoad() {
213
208
  // Get locales
@@ -230,10 +225,10 @@ export class MgInputNumeric {
230
225
  }
231
226
  /**
232
227
  * Render
233
- * @returns {HTMLElement} HTML Element
228
+ * @returns HTML Element
234
229
  */
235
230
  render() {
236
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "text", class: "mg-input__box", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => {
231
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "text", class: "mg-input__box", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: el => {
237
232
  if (el !== null)
238
233
  this.input = el;
239
234
  } }), h("slot", { name: "append-input" })));
@@ -627,7 +622,7 @@ export class MgInputNumeric {
627
622
  }
628
623
  static get states() {
629
624
  return {
630
- "classList": {},
625
+ "classCollection": {},
631
626
  "errorMessage": {},
632
627
  "hasFocus": {}
633
628
  };
@@ -680,10 +675,7 @@ export class MgInputNumeric {
680
675
  },
681
676
  "docs": {
682
677
  "text": "Public method to display errors",
683
- "tags": [{
684
- "name": "returns",
685
- "text": undefined
686
- }]
678
+ "tags": []
687
679
  }
688
680
  }
689
681
  };
@@ -58,7 +58,7 @@ export class MgInputPassword {
58
58
  this.helpText = undefined;
59
59
  this.valid = undefined;
60
60
  this.invalid = undefined;
61
- this.classList = new ClassList(['mg-input--password']);
61
+ this.classCollection = new ClassList(['mg-input--password']);
62
62
  this.errorMessage = undefined;
63
63
  }
64
64
  handleValue(newValue) {
@@ -76,7 +76,6 @@ export class MgInputPassword {
76
76
  }
77
77
  /**
78
78
  * Public method to display errors
79
- * @returns {Promise<void>}
80
79
  */
81
80
  async displayError() {
82
81
  this.checkValidity();
@@ -88,7 +87,7 @@ export class MgInputPassword {
88
87
  *************/
89
88
  /**
90
89
  * Check if component props are well configured on init
91
- * @returns {ReturnType<typeof setTimeout>} timeout
90
+ * @returns timeout
92
91
  */
93
92
  componentWillLoad() {
94
93
  // Get locales
@@ -102,10 +101,10 @@ export class MgInputPassword {
102
101
  }
103
102
  /**
104
103
  * Render
105
- * @returns {HTMLElement} HTML Element
104
+ * @returns HTML Element
106
105
  */
107
106
  render() {
108
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.value !== undefined ? '•'.repeat(this.value.length) : undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "password", class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
107
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.value !== undefined ? '•'.repeat(this.value.length) : undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "password", class: "mg-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
109
108
  if (el !== null)
110
109
  this.input = el;
111
110
  } })));
@@ -394,7 +393,7 @@ export class MgInputPassword {
394
393
  }
395
394
  static get states() {
396
395
  return {
397
- "classList": {},
396
+ "classCollection": {},
398
397
  "errorMessage": {}
399
398
  };
400
399
  }
@@ -446,10 +445,7 @@ export class MgInputPassword {
446
445
  },
447
446
  "docs": {
448
447
  "text": "Public method to display errors",
449
- "tags": [{
450
- "name": "returns",
451
- "text": undefined
452
- }]
448
+ "tags": []
453
449
  }
454
450
  }
455
451
  };
@@ -7,8 +7,8 @@ import { ClassList, allItemsAreString } from '../../../../utils/components.utils
7
7
  import { initLocales } from '../../../../locales';
8
8
  /**
9
9
  * type Option validation function
10
- * @param {RadioOption} option radio option
11
- * @returns {boolean} radio option type is valid
10
+ * @param option - radio option
11
+ * @returns radio option type is valid
12
12
  */
13
13
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
14
14
  export class MgInputRadio {
@@ -22,8 +22,7 @@ export class MgInputRadio {
22
22
  this.hasDisplayedError = false;
23
23
  /**
24
24
  * Handle input event
25
- * @param {event} event input event
26
- * @returns {void}
25
+ * @param event - input event
27
26
  */
28
27
  this.handleInput = (event) => {
29
28
  this.checkValidity();
@@ -31,7 +30,6 @@ export class MgInputRadio {
31
30
  };
32
31
  /**
33
32
  * Handle blur event
34
- * @returns {void}
35
33
  */
36
34
  this.handleBlur = () => {
37
35
  this.checkValidity();
@@ -39,7 +37,6 @@ export class MgInputRadio {
39
37
  };
40
38
  /**
41
39
  * Check if input is valid
42
- * @returns {void}
43
40
  */
44
41
  this.checkValidity = () => {
45
42
  this.valid = this.readonly || this.disabled || this.getInvalidElement() === undefined;
@@ -49,7 +46,6 @@ export class MgInputRadio {
49
46
  };
50
47
  /**
51
48
  * Set input error message
52
- * @returns {void}
53
49
  */
54
50
  this.setErrorMessage = () => {
55
51
  const invalidElement = this.getInvalidElement();
@@ -61,7 +57,7 @@ export class MgInputRadio {
61
57
  };
62
58
  /**
63
59
  * get invalid element
64
- * @returns {HTMLInputElement} element
60
+ * @returns element
65
61
  */
66
62
  this.getInvalidElement = () => this.inputs.find((input) => !input.disabled && !input.readOnly && !input.checkValidity());
67
63
  this.value = undefined;
@@ -79,7 +75,7 @@ export class MgInputRadio {
79
75
  this.helpText = undefined;
80
76
  this.valid = undefined;
81
77
  this.invalid = undefined;
82
- this.classList = new ClassList(['mg-input--radio']);
78
+ this.classCollection = new ClassList(['mg-input--radio']);
83
79
  this.errorMessage = undefined;
84
80
  this.options = undefined;
85
81
  }
@@ -115,7 +111,6 @@ export class MgInputRadio {
115
111
  }
116
112
  /**
117
113
  * Public method to display errors
118
- * @returns {Promise<void>}
119
114
  */
120
115
  async displayError() {
121
116
  this.checkValidity();
@@ -127,7 +122,7 @@ export class MgInputRadio {
127
122
  *************/
128
123
  /**
129
124
  * Check if component props are well configured on init
130
- * @returns {ReturnType<typeof setTimeout>} timeout
125
+ * @returns timeout
131
126
  */
132
127
  componentWillLoad() {
133
128
  // Get locales
@@ -143,10 +138,10 @@ export class MgInputRadio {
143
138
  }
144
139
  /**
145
140
  * Render
146
- * @returns {HTMLElement} HTML Element
141
+ * @returns HTML Element
147
142
  */
148
143
  render() {
149
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => {
144
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: el => {
150
145
  if (el !== null)
151
146
  this.inputs[index] = el;
152
147
  } }), h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
@@ -434,7 +429,7 @@ export class MgInputRadio {
434
429
  }
435
430
  static get states() {
436
431
  return {
437
- "classList": {},
432
+ "classCollection": {},
438
433
  "errorMessage": {},
439
434
  "options": {}
440
435
  };
@@ -487,10 +482,7 @@ export class MgInputRadio {
487
482
  },
488
483
  "docs": {
489
484
  "text": "Public method to display errors",
490
- "tags": [{
491
- "name": "returns",
492
- "text": undefined
493
- }]
485
+ "tags": []
494
486
  }
495
487
  }
496
488
  };
@@ -6,31 +6,27 @@ import { ClassList, allItemsAreString } from '../../../../utils/components.utils
6
6
  import { initLocales } from '../../../../locales';
7
7
  /**
8
8
  * Check if item is a well configured option
9
- * @param {unknown} option select option
10
- * @returns {boolean} select option type is valid
9
+ * @param option - select option
10
+ * @returns select option type is valid
11
11
  */
12
12
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string';
13
13
  /**
14
14
  * Check if items[] is SelectOption
15
- * @param {unknown[]} items select option
16
- * @returns {boolean} select option array type is valid
15
+ * @param items - select option
16
+ * @returns select option array type is valid
17
17
  */
18
18
  const allItemsAreOptions = (items) => Array.isArray(items) && items.every(item => isOption(item));
19
19
  /**
20
20
  * Check if item is a well configured optgroup
21
- * @param {unknown} optgroup select option
22
- * @returns {boolean} select optgroup type is valid
21
+ * @param optgroup - select option
22
+ * @returns select optgroup type is valid
23
23
  */
24
24
  const isOptGroup = (optgroup) => typeof optgroup === 'object' && typeof optgroup.group === 'string' && allItemsAreOptions(optgroup.options);
25
25
  /**
26
26
  * Group options
27
- * @param {(SelectOption | OptGroup)[]} acc reduce accumulator
28
- * @param {SelectOption} item item to add
29
- * @param {string} item.group item group
30
- * @param {string} item.title item title
31
- * @param {unknown} item.value item value
32
- * @param {boolean} item.disabled is item disabled
33
- * @returns {(SelectOption | OptGroup)[]} grouped options
27
+ * @param acc - reduce accumulator
28
+ * @param item - item to add
29
+ * @returns grouped options
34
30
  */
35
31
  const groupOptions = (acc, { group, title, value, disabled }) => {
36
32
  if (group !== undefined) {
@@ -56,7 +52,6 @@ export class MgInputSelect {
56
52
  this.hasDisplayedError = false;
57
53
  /**
58
54
  * Handle input event
59
- * @returns {void}
60
55
  */
61
56
  this.handleInput = () => {
62
57
  this.updateValue();
@@ -65,14 +60,13 @@ export class MgInputSelect {
65
60
  };
66
61
  /**
67
62
  * Method to compare item.title with input.value
68
- * @param {SelectOption} item item to compare with
69
- * @returns {boolean} truthy if input.value is an item
63
+ * @param item - item to compare with
64
+ * @returns truthy if input.value is an item
70
65
  */
71
66
  this.isInputValue = (item) => { var _a; return item.title === ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value); };
72
67
  /**
73
68
  * value props setter
74
- * @param {MgInputSelect['value']} newValue value to update with
75
- * @returns {void}
69
+ * @param newValue - value to update with
76
70
  */
77
71
  this.setValue = (newValue) => {
78
72
  this.checkValidity();
@@ -80,7 +74,6 @@ export class MgInputSelect {
80
74
  };
81
75
  /**
82
76
  * Update value from input.value
83
- * @returns {void}
84
77
  */
85
78
  this.updateValue = () => {
86
79
  if (this.input.value === '') {
@@ -106,7 +99,7 @@ export class MgInputSelect {
106
99
  };
107
100
  /**
108
101
  * Input value is disabled
109
- * @returns {boolean} truthy if input value is disabled
102
+ * @returns truthy if input value is disabled
110
103
  */
111
104
  this.isDisabledValue = () => { var _a; return allItemsAreOptions(this.options) && ((_a = this.options.find(this.isInputValue)) === null || _a === void 0 ? void 0 : _a.disabled) === true; };
112
105
  /**
@@ -131,8 +124,8 @@ export class MgInputSelect {
131
124
  };
132
125
  /**
133
126
  * Render option
134
- * @param {SelectOption} option to render
135
- * @returns {HTMLElement} render option
127
+ * @param option - to render
128
+ * @returns render option
136
129
  */
137
130
  this.renderOption = (option) => (h("option", { key: option.title, value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title));
138
131
  this.value = undefined;
@@ -153,7 +146,7 @@ export class MgInputSelect {
153
146
  this.helpText = undefined;
154
147
  this.valid = undefined;
155
148
  this.invalid = undefined;
156
- this.classList = new ClassList(['mg-input--select']);
149
+ this.classCollection = new ClassList(['mg-input--select']);
157
150
  this.errorMessage = undefined;
158
151
  this.options = undefined;
159
152
  this.valueExist = undefined;
@@ -211,7 +204,6 @@ export class MgInputSelect {
211
204
  }
212
205
  /**
213
206
  * Public method to display errors
214
- * @returns {Promise<void>}
215
207
  */
216
208
  async displayError() {
217
209
  this.checkValidity();
@@ -223,7 +215,7 @@ export class MgInputSelect {
223
215
  *************/
224
216
  /**
225
217
  * Check if component props are well configured on init
226
- * @returns {ReturnType<typeof setTimeout>} timeout
218
+ * @returns timeout
227
219
  */
228
220
  componentWillLoad() {
229
221
  // Get locales
@@ -244,10 +236,10 @@ export class MgInputSelect {
244
236
  }
245
237
  /**
246
238
  * Render
247
- * @returns {HTMLElement} HTML Element
239
+ * @returns HTML Element
248
240
  */
249
241
  render() {
250
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: undefined, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
242
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: undefined, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
251
243
  if (el !== null)
252
244
  this.input = el;
253
245
  } }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
@@ -592,7 +584,7 @@ export class MgInputSelect {
592
584
  }
593
585
  static get states() {
594
586
  return {
595
- "classList": {},
587
+ "classCollection": {},
596
588
  "errorMessage": {},
597
589
  "options": {},
598
590
  "valueExist": {},
@@ -651,10 +643,7 @@ export class MgInputSelect {
651
643
  },
652
644
  "docs": {
653
645
  "text": "Public method to display errors",
654
- "tags": [{
655
- "name": "returns",
656
- "text": undefined
657
- }]
646
+ "tags": []
658
647
  }
659
648
  }
660
649
  };
@@ -15,7 +15,6 @@ export class MgInputText {
15
15
  this.hasDisplayedError = false;
16
16
  /**
17
17
  * Handle input event
18
- * @returns {void}
19
18
  */
20
19
  this.handleInput = () => {
21
20
  this.checkValidity();
@@ -26,26 +25,23 @@ export class MgInputText {
26
25
  };
27
26
  /**
28
27
  * Handle focus event
29
- * @returns {void}
30
28
  */
31
29
  this.handleFocus = () => {
32
- this.classList.add(this.classFocus);
33
- this.classList = new ClassList(this.classList.classes);
30
+ this.classCollection.add(this.classFocus);
31
+ this.classCollection = new ClassList(this.classCollection.classes);
34
32
  };
35
33
  /**
36
34
  * Handle blur event
37
- * @returns {void}
38
35
  */
39
36
  this.handleBlur = () => {
40
37
  // Manage focus
41
- this.classList.delete(this.classFocus);
42
- this.classList = new ClassList(this.classList.classes);
38
+ this.classCollection.delete(this.classFocus);
39
+ this.classCollection = new ClassList(this.classCollection.classes);
43
40
  // Display Error
44
41
  this.displayError();
45
42
  };
46
43
  /**
47
44
  * Check if input is valid
48
- * @returns {void}
49
45
  */
50
46
  this.checkValidity = () => {
51
47
  var _a;
@@ -56,7 +52,6 @@ export class MgInputText {
56
52
  };
57
53
  /**
58
54
  * Set input error message
59
- * @returns {void}
60
55
  */
61
56
  this.setErrorMessage = () => {
62
57
  // Set error message
@@ -72,7 +67,6 @@ export class MgInputText {
72
67
  };
73
68
  /**
74
69
  * Validate pattern configuration
75
- * @returns {void}
76
70
  */
77
71
  this.validatePattern = () => {
78
72
  if (this.pattern !== undefined &&
@@ -84,16 +78,15 @@ export class MgInputText {
84
78
  };
85
79
  /**
86
80
  * Validate append slot
87
- * @returns {void}
88
81
  */
89
82
  this.validateAppendSlot = () => {
90
83
  const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
91
84
  if (slotAppendInput.length === 1) {
92
- this.classList.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-input--is-append-input-slot-content');
85
+ this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-input--is-append-input-slot-content');
93
86
  }
94
87
  else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
95
- this.classList.add(this.classIsInputGroupAppend);
96
- this.classList.add('mg-input--has-buttons-group-append');
88
+ this.classCollection.add(this.classIsInputGroupAppend);
89
+ this.classCollection.add('mg-input--has-buttons-group-append');
97
90
  }
98
91
  };
99
92
  this.value = undefined;
@@ -117,7 +110,7 @@ export class MgInputText {
117
110
  this.helpText = undefined;
118
111
  this.valid = undefined;
119
112
  this.invalid = undefined;
120
- this.classList = new ClassList(['mg-input--text']);
113
+ this.classCollection = new ClassList(['mg-input--text']);
121
114
  this.errorMessage = undefined;
122
115
  }
123
116
  handleValue(newValue) {
@@ -125,10 +118,10 @@ export class MgInputText {
125
118
  }
126
119
  validateIcon(newValue) {
127
120
  if (newValue !== undefined) {
128
- this.classList.add(this.classHasIcon);
121
+ this.classCollection.add(this.classHasIcon);
129
122
  }
130
123
  else {
131
- this.classList.delete(this.classHasIcon);
124
+ this.classCollection.delete(this.classHasIcon);
132
125
  }
133
126
  }
134
127
  handleValidityChange(newValue, _oldValue, prop) {
@@ -143,14 +136,12 @@ export class MgInputText {
143
136
  }
144
137
  /**
145
138
  * Public method to play input focus
146
- * @returns {Promise<void>}
147
139
  */
148
140
  async setFocus() {
149
141
  this.input.focus();
150
142
  }
151
143
  /**
152
144
  * Public method to display errors
153
- * @returns {Promise<void>}
154
145
  */
155
146
  async displayError() {
156
147
  this.checkValidity();
@@ -162,7 +153,7 @@ export class MgInputText {
162
153
  *************/
163
154
  /**
164
155
  * Check if component props are well configured on init
165
- * @returns {ReturnType<typeof setTimeout>} timeout
156
+ * @returns timeout
166
157
  */
167
158
  componentWillLoad() {
168
159
  // Get locales
@@ -181,10 +172,10 @@ export class MgInputText {
181
172
  }
182
173
  /**
183
174
  * Render
184
- * @returns {HTMLElement} HTML Element
175
+ * @returns HTML Element
185
176
  */
186
177
  render() {
187
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left", style: {
178
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left", style: {
188
179
  '--mg-character-left-message-length': (this.displayCharacterLeft
189
180
  ? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
190
181
  : 0).toString(),
@@ -582,7 +573,7 @@ export class MgInputText {
582
573
  }
583
574
  static get states() {
584
575
  return {
585
- "classList": {},
576
+ "classCollection": {},
586
577
  "errorMessage": {}
587
578
  };
588
579
  }
@@ -634,10 +625,7 @@ export class MgInputText {
634
625
  },
635
626
  "docs": {
636
627
  "text": "Public method to play input focus",
637
- "tags": [{
638
- "name": "returns",
639
- "text": undefined
640
- }]
628
+ "tags": []
641
629
  }
642
630
  },
643
631
  "displayError": {
@@ -653,10 +641,7 @@ export class MgInputText {
653
641
  },
654
642
  "docs": {
655
643
  "text": "Public method to display errors",
656
- "tags": [{
657
- "name": "returns",
658
- "text": undefined
659
- }]
644
+ "tags": []
660
645
  }
661
646
  }
662
647
  };