@mgdis/mg-components 5.9.1 → 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 +345 -648
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-item-more.cjs.entry.js +19 -43
  5. package/dist/cjs/{mg-menu.conf-9afe6571.js → mg-menu.conf-196151fe.js} +16 -21
  6. package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -12
  7. package/dist/collection/components/atoms/mg-button/mg-button.js +18 -27
  8. package/dist/collection/components/atoms/mg-card/mg-card.js +22 -15
  9. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -4
  10. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -2
  11. package/dist/collection/components/atoms/mg-icon/mg-icon.js +26 -23
  12. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -4
  13. package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -16
  14. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +12 -34
  15. package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
  16. package/dist/collection/components/molecules/inputs/MgInput.js +26 -24
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +10 -20
  18. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -17
  19. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -34
  20. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -13
  21. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -27
  22. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -45
  23. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +17 -43
  24. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +14 -22
  25. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -28
  26. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -29
  27. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -47
  28. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -23
  29. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -6
  30. package/dist/collection/components/molecules/mg-form/mg-form.js +8 -27
  31. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -4
  32. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -12
  33. package/dist/collection/components/molecules/mg-message/mg-message.js +12 -20
  34. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -17
  35. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -19
  36. package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -30
  37. package/dist/collection/components/molecules/mg-popover/mg-popover.js +8 -21
  38. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +3 -8
  39. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -36
  40. package/dist/collection/locales/index.js +2 -3
  41. package/dist/collection/utils/behaviors.utils.js +16 -32
  42. package/dist/collection/utils/components.utils.js +22 -33
  43. package/dist/collection/utils/locale.utils.js +14 -18
  44. package/dist/collection/utils/unit.test.utils.js +7 -15
  45. package/dist/components/MgInput.js +30 -24
  46. package/dist/components/components.utils.js +22 -33
  47. package/dist/components/index2.js +16 -21
  48. package/dist/components/mg-action-more.js +9 -21
  49. package/dist/components/mg-badge2.js +9 -12
  50. package/dist/components/mg-button2.js +18 -27
  51. package/dist/components/mg-card2.js +20 -13
  52. package/dist/components/mg-character-left2.js +1 -4
  53. package/dist/components/mg-details.js +1 -6
  54. package/dist/components/mg-divider.js +1 -2
  55. package/dist/components/mg-form.js +7 -23
  56. package/dist/components/mg-icon2.js +26 -23
  57. package/dist/components/mg-illustrated-message.js +1 -4
  58. package/dist/components/mg-input-checkbox.js +9 -16
  59. package/dist/components/mg-input-date.js +6 -13
  60. package/dist/components/mg-input-numeric.js +13 -30
  61. package/dist/components/mg-input-password.js +5 -9
  62. package/dist/components/mg-input-radio.js +9 -23
  63. package/dist/components/mg-input-select2.js +20 -41
  64. package/dist/components/mg-input-text2.js +15 -35
  65. package/dist/components/mg-input-textarea.js +13 -18
  66. package/dist/components/mg-input-title2.js +1 -4
  67. package/dist/components/mg-input-toggle.js +16 -24
  68. package/dist/components/mg-item-more.js +18 -42
  69. package/dist/components/mg-menu-item2.js +17 -44
  70. package/dist/components/mg-menu2.js +9 -27
  71. package/dist/components/mg-message.js +12 -20
  72. package/dist/components/mg-modal.js +8 -17
  73. package/dist/components/mg-pagination.js +11 -19
  74. package/dist/components/mg-panel.js +11 -30
  75. package/dist/components/mg-popover2.js +8 -21
  76. package/dist/components/mg-skip-links.js +3 -8
  77. package/dist/components/mg-tabs.js +20 -36
  78. package/dist/components/mg-tag.js +11 -16
  79. package/dist/components/mg-tooltip2.js +12 -34
  80. package/dist/esm/loader.js +1 -1
  81. package/dist/esm/mg-action-more_31.entry.js +345 -648
  82. package/dist/esm/mg-components.js +1 -1
  83. package/dist/esm/mg-item-more.entry.js +19 -43
  84. package/dist/esm/{mg-menu.conf-881fbd82.js → mg-menu.conf-9ca023ee.js} +16 -21
  85. package/dist/mg-components/mg-components.esm.js +1 -1
  86. package/dist/mg-components/{p-67ce7cb8.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 -5
  89. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -14
  90. package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -8
  91. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -4
  92. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -2
  93. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +8 -7
  94. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -4
  95. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -8
  96. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -33
  97. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
  98. package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -6
  99. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -11
  100. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -11
  101. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -26
  102. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -7
  103. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -18
  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 -22
  106. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -23
  107. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -9
  108. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -11
  109. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -29
  110. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -49
  111. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -15
  112. package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -6
  113. package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -19
  114. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -4
  115. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -12
  116. package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -12
  117. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -12
  118. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -14
  119. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -23
  120. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -16
  121. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -7
  122. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -30
  123. package/dist/types/components.d.ts +22 -34
  124. package/dist/types/locales/index.d.ts +2 -3
  125. package/dist/types/utils/behaviors.utils.d.ts +14 -29
  126. package/dist/types/utils/components.utils.d.ts +19 -29
  127. package/dist/types/utils/locale.utils.d.ts +14 -18
  128. package/dist/types/utils/unit.test.utils.d.ts +11 -24
  129. package/package.json +11 -12
  130. package/dist/mg-components/p-9a93b7af.entry.js +0 -1
  131. /package/dist/mg-components/{p-367f92d2.js → p-0d3146d9.js} +0 -0
@@ -14,9 +14,8 @@ const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
14
14
 
15
15
  /**
16
16
  * MgActionMore['items'] type guard
17
- *
18
- * @param {unknown} prop commponent items prop
19
- * @returns {boolean} return true if type is valid
17
+ * @param prop - commponent items prop
18
+ * @returns return true if type is valid
20
19
  */
21
20
  const isMgActionMoreItems = (prop) => {
22
21
  const items = prop;
@@ -24,9 +23,8 @@ const isMgActionMoreItems = (prop) => {
24
23
  };
25
24
  /**
26
25
  * MgActionMore['button'] type guard
27
- *
28
- * @param {unknown} prop commponent button prop
29
- * @returns {boolean} return true if type is valid
26
+ * @param prop - commponent button prop
27
+ * @returns return true if type is valid
30
28
  */
31
29
  const isMgActionMoreButton = (prop) => {
32
30
  const button = prop;
@@ -34,9 +32,8 @@ const isMgActionMoreButton = (prop) => {
34
32
  };
35
33
  /**
36
34
  * MgActionMore['icon'] type guard
37
- *
38
- * @param {unknown} prop commponent icon prop
39
- * @returns {boolean} return true if type is valid
35
+ * @param prop - commponent icon prop
36
+ * @returns return true if type is valid
40
37
  */
41
38
  const isMgActionMoreIcon = (prop) => {
42
39
  const icon = prop;
@@ -57,26 +54,20 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
57
54
  ***********/
58
55
  /**
59
56
  * Toogle expanded props
60
- *
61
- * @returns {void}
62
57
  */
63
58
  this.toggleExpanded = () => {
64
59
  this.expanded = !this.expanded;
65
60
  };
66
61
  /**
67
62
  * Button click handler
68
- *
69
- * @returns {void}
70
63
  */
71
64
  this.handleButton = () => {
72
65
  this.toggleExpanded();
73
66
  };
74
67
  /**
75
68
  * Item click handler
76
- *
77
- * @param {MouseEvent} event click event
78
- * @param {MgActionMoreItemType['mouseEventHandler']} customHandler item['mouseEventHandler']
79
- * @returns {void}
69
+ * @param event - click event
70
+ * @param customHandler - item['mouseEventHandler']
80
71
  */
81
72
  this.handleItemClick = (event, customHandler) => {
82
73
  this.expanded = false;
@@ -113,8 +104,6 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
113
104
  *************/
114
105
  /**
115
106
  * Validate props
116
- *
117
- * @returns {void}
118
107
  */
119
108
  componentWillLoad() {
120
109
  this.messages = initLocales(this.element).messages.actionMore;
@@ -125,8 +114,7 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
125
114
  }
126
115
  /**
127
116
  * Render
128
- *
129
- * @returns {HTMLElement} HTML Element
117
+ * @returns HTML Element
130
118
  */
131
119
  render() {
132
120
  const buttonLabel = this.button.label || this.messages.label;
@@ -22,7 +22,7 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
22
22
  this.label = undefined;
23
23
  this.variant = variants[0];
24
24
  this.outline = undefined;
25
- this.classList = new ClassList(['mg-badge']);
25
+ this.classCollection = new ClassList(['mg-badge']);
26
26
  }
27
27
  validateValue(newValue) {
28
28
  if (`${newValue}`.match(/^(\d+\+*|[?*!a-z])$/i) === null) {
@@ -40,21 +40,19 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
40
40
  }
41
41
  else {
42
42
  if (oldValue !== undefined) {
43
- this.classList.delete(`mg-badge--${oldValue}`);
43
+ this.classCollection.delete(`mg-badge--${oldValue}`);
44
44
  }
45
- this.classList.add(`mg-badge--${newValue}`);
45
+ this.classCollection.add(`mg-badge--${newValue}`);
46
46
  }
47
47
  }
48
48
  validateOutline(newValue) {
49
49
  if (newValue)
50
- this.classList.add(this.classOutline);
50
+ this.classCollection.add(this.classOutline);
51
51
  else
52
- this.classList.delete(this.classOutline);
52
+ this.classCollection.delete(this.classOutline);
53
53
  }
54
54
  /**
55
55
  * Check if props are well configured on init
56
- *
57
- * @returns {void}
58
56
  */
59
57
  componentWillLoad() {
60
58
  this.validateValue(this.value);
@@ -64,11 +62,10 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
64
62
  }
65
63
  /**
66
64
  * Render
67
- *
68
- * @returns {HTMLElement} HTML Element
65
+ * @returns HTML Element
69
66
  */
70
67
  render() {
71
- return (h("span", { class: this.classList.join() }, h("span", { class: "mg-badge__value" }, this.value), h("span", { class: "sr-only" }, this.label)));
68
+ return (h("span", { class: this.classCollection.join() }, h("span", { class: "mg-badge__value" }, this.value), h("span", { class: "sr-only" }, this.label)));
72
69
  }
73
70
  static get watchers() { return {
74
71
  "value": ["validateValue"],
@@ -78,11 +75,11 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
78
75
  }; }
79
76
  static get style() { return mgBadgeCss; }
80
77
  }, [1, "mg-badge", {
81
- "value": [1032],
78
+ "value": [8],
82
79
  "label": [1],
83
80
  "variant": [1],
84
81
  "outline": [4],
85
- "classList": [32]
82
+ "classCollection": [32]
86
83
  }]);
87
84
  function defineCustomElement() {
88
85
  if (typeof customElements === "undefined") {
@@ -24,9 +24,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
24
24
  this.classFullWidth = 'mg-button--full-width';
25
25
  /**
26
26
  * Trigger actions onClick event
27
- *
28
- * @param {MouseEvent} event click event
29
- * @returns {void}
27
+ * @param event - click event
30
28
  */
31
29
  this.handleClick = (event) => {
32
30
  if (this.disabled)
@@ -39,9 +37,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
39
37
  };
40
38
  /**
41
39
  * Handle onKeydown event
42
- *
43
- * @param {KeyboardEvent} event keyboard event
44
- * @returns {void}
40
+ * @param event - keyboard event
45
41
  */
46
42
  this.handleKeydown = (event) => {
47
43
  if (!this.disabled && event.key === ' ') {
@@ -54,9 +50,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
54
50
  };
55
51
  /**
56
52
  * Handle onKeyup event
57
- *
58
- * @param {KeyboardEvent} event keyboard event
59
- * @returns {void}
53
+ * @param event - keyboard event
60
54
  */
61
55
  this.handleKeyup = (event) => {
62
56
  if (!this.disabled && event.key === ' ') {
@@ -74,7 +68,7 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
74
68
  this.isIcon = false;
75
69
  this.disableOnClick = false;
76
70
  this.loading = false;
77
- this.classList = new ClassList(['mg-button']);
71
+ this.classCollection = new ClassList(['mg-button']);
78
72
  }
79
73
  validateVariant(newValue, oldValue) {
80
74
  if (!variants.includes(newValue)) {
@@ -82,9 +76,9 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
82
76
  }
83
77
  else {
84
78
  if (oldValue !== undefined) {
85
- this.classList.delete(`mg-button--${oldValue}`);
79
+ this.classCollection.delete(`mg-button--${oldValue}`);
86
80
  }
87
- this.classList.add(`mg-button--${newValue}`);
81
+ this.classCollection.add(`mg-button--${newValue}`);
88
82
  }
89
83
  }
90
84
  validateFullWidth(newValue) {
@@ -92,10 +86,10 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
92
86
  throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');
93
87
  }
94
88
  else if (newValue) {
95
- this.classList.add(this.classFullWidth);
89
+ this.classCollection.add(this.classFullWidth);
96
90
  }
97
91
  else {
98
- this.classList.delete(this.classFullWidth);
92
+ this.classCollection.delete(this.classFullWidth);
99
93
  }
100
94
  }
101
95
  disabledHandler(isDisabled) {
@@ -108,10 +102,10 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
108
102
  this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
109
103
  // apply style
110
104
  if (isDisabled) {
111
- this.classList.add(this.classDisabled);
105
+ this.classCollection.add(this.classDisabled);
112
106
  }
113
107
  else {
114
- this.classList.delete(this.classDisabled);
108
+ this.classCollection.delete(this.classDisabled);
115
109
  }
116
110
  // emit value update
117
111
  this.disabledChange.emit(isDisabled);
@@ -119,22 +113,20 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
119
113
  loadingHandler(newValue) {
120
114
  // we add loading style if it newvalue is true else we remove it
121
115
  if (newValue) {
122
- this.classList.add(this.classLoading);
116
+ this.classCollection.add(this.classLoading);
123
117
  }
124
118
  else {
125
- this.classList.delete(this.classLoading);
119
+ this.classCollection.delete(this.classLoading);
126
120
  }
127
121
  }
128
122
  /**
129
123
  * Check if props are well configured on init
130
- *
131
- * @returns {void}
132
124
  */
133
125
  componentWillLoad() {
134
126
  this.validateVariant(this.variant);
135
127
  this.validateFullWidth(this.fullWidth);
136
128
  if (this.isIcon) {
137
- this.classList.add(`mg-button--icon`);
129
+ this.classCollection.add(`mg-button--icon`);
138
130
  if (typeof this.label !== 'string' || this.label.trim() === '') {
139
131
  throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
140
132
  }
@@ -145,11 +137,10 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
145
137
  }
146
138
  /**
147
139
  * Render component
148
- *
149
- * @returns {HTMLElement} html element
140
+ * @returns html element
150
141
  */
151
142
  render() {
152
- return (h(Host, { role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
143
+ return (h(Host, { role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { class: this.classCollection.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
153
144
  }
154
145
  get element() { return this; }
155
146
  static get watchers() { return {
@@ -164,13 +155,13 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
164
155
  "identifier": [1],
165
156
  "label": [1],
166
157
  "type": [1],
167
- "fullWidth": [1028, "full-width"],
168
- "form": [1025],
158
+ "fullWidth": [4, "full-width"],
159
+ "form": [1],
169
160
  "disabled": [1028],
170
161
  "isIcon": [4, "is-icon"],
171
162
  "disableOnClick": [4, "disable-on-click"],
172
163
  "loading": [32],
173
- "classList": [32]
164
+ "classCollection": [32]
174
165
  }]);
175
166
  function defineCustomElement() {
176
167
  if (typeof customElements === "undefined") {
@@ -22,20 +22,27 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
22
22
  *************/
23
23
  this.name = 'mg-card';
24
24
  this.baseClass = this.name;
25
+ /**
26
+ * Methode to set default varianStyle props
27
+ * needeed has stencil doesn't know that props is mutated when updated in prop watcher
28
+ */
29
+ this.setDefaultVariantStyle = () => {
30
+ if (this.variantStyle === undefined)
31
+ this.variantStyle = 'bar-left';
32
+ };
25
33
  this.variant = undefined;
26
34
  this.variantStyle = undefined;
27
- this.classList = new ClassList([this.baseClass]);
35
+ this.classCollection = new ClassList([this.baseClass]);
28
36
  }
29
37
  validateVariant(newValue, oldValue) {
30
38
  if (newValue && !variants.includes(newValue))
31
39
  throw new Error(`<${this.name}> prop "variant" must match VariantType type.`);
32
40
  if (Boolean(newValue)) {
33
- if (this.variantStyle === undefined)
34
- this.variantStyle = 'bar-left';
35
- this.classList.add(`${this.baseClass}--${newValue}`);
41
+ this.setDefaultVariantStyle();
42
+ this.classCollection.add(`${this.baseClass}--${newValue}`);
36
43
  }
37
44
  if (Boolean(oldValue))
38
- this.classList.delete(`${this.baseClass}--${oldValue}`);
45
+ this.classCollection.delete(`${this.baseClass}--${oldValue}`);
39
46
  }
40
47
  validateVariantStyle(newValue, oldValue) {
41
48
  if (newValue && !variantStyles.includes(newValue))
@@ -43,14 +50,15 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
43
50
  else if (Boolean(newValue) && !variants.includes(this.variant))
44
51
  throw new Error(`<${this.name}> prop "variantStyle" must be paired with ${JSON.stringify(variants)} "variant" prop.`);
45
52
  if (Boolean(newValue))
46
- this.classList.add(`${this.baseClass}--${newValue}`);
53
+ this.classCollection.add(`${this.baseClass}--${newValue}`);
47
54
  if (Boolean(oldValue))
48
- this.classList.delete(`${this.baseClass}--${oldValue}`);
55
+ this.classCollection.delete(`${this.baseClass}--${oldValue}`);
49
56
  }
57
+ /*************
58
+ * Lifecycle *
59
+ *************/
50
60
  /**
51
61
  * Check if props are well configured on init
52
- *
53
- * @returns {void}
54
62
  */
55
63
  componentWillLoad() {
56
64
  this.validateVariant(this.variant);
@@ -58,12 +66,11 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
58
66
  }
59
67
  /**
60
68
  * Render
61
- *
62
- * @returns {HTMLElement} HTML Element
69
+ * @returns HTML Element
63
70
  */
64
71
  render() {
65
72
  var _a;
66
- return (h("div", { class: this.classList.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-card__bar" }), h("slot", null)));
73
+ return (h("div", { class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-card__bar" }), h("slot", null)));
67
74
  }
68
75
  static get watchers() { return {
69
76
  "variant": ["validateVariant"],
@@ -73,7 +80,7 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
73
80
  }, [1, "mg-card", {
74
81
  "variant": [1],
75
82
  "variantStyle": [1025, "variant-style"],
76
- "classList": [32]
83
+ "classCollection": [32]
77
84
  }]);
78
85
  function defineCustomElement() {
79
86
  if (typeof customElements === "undefined") {
@@ -21,8 +21,6 @@ const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
21
21
  *************/
22
22
  /**
23
23
  * Check if props are well configured on init
24
- *
25
- * @returns {void}
26
24
  */
27
25
  componentWillLoad() {
28
26
  this.validateMaxlength(this.maxlength);
@@ -30,8 +28,7 @@ const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
30
28
  }
31
29
  /**
32
30
  * Render component
33
- *
34
- * @returns {HTMLElement} HTML Element
31
+ * @returns HTML Element
35
32
  */
36
33
  render() {
37
34
  return (h("span", { id: this.identifier, "aria-live": "polite" }, h("span", { "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), h("span", { class: "sr-only" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
@@ -11,8 +11,6 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
11
11
  this.expandedChange = createEvent(this, "expanded-change", 7);
12
12
  /**
13
13
  * Handle details toggle
14
- *
15
- * @returns {void}
16
14
  */
17
15
  this.handleToggle = () => {
18
16
  this.expanded = this.details.open;
@@ -35,8 +33,6 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
35
33
  *************/
36
34
  /**
37
35
  * Check if component props are well configured on init
38
- *
39
- * @returns {void}
40
36
  */
41
37
  componentWillLoad() {
42
38
  this.validateTitles(this.toggleClosed);
@@ -44,8 +40,7 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
44
40
  }
45
41
  /**
46
42
  * Render
47
- *
48
- * @returns {HTMLElement} HTML Element
43
+ * @returns HTML Element
49
44
  */
50
45
  render() {
51
46
  return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
@@ -11,8 +11,7 @@ const MgDivider$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
11
11
  }
12
12
  /**
13
13
  * Render
14
- *
15
- * @returns {HTMLElement} HTML Element
14
+ * @returns HTML Element
16
15
  */
17
16
  render() {
18
17
  return (h("div", { class: {
@@ -15,14 +15,11 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
15
  this.classAllRequired = 'mg-form--all-required';
16
16
  /**
17
17
  * Define required message based on mg-inputs required elements
18
- * Also
19
- *
20
- * @returns {void}
21
18
  */
22
19
  this.setRequiredMessage = () => {
23
20
  // init required message
24
21
  this.requiredMessage = null;
25
- this.classList.delete(this.classAllRequired);
22
+ this.classCollection.delete(this.classAllRequired);
26
23
  // If the form is disabled or readonly none of them are required
27
24
  // Check if all fields are not editable (readonly or disabled)
28
25
  if (!this.disabled && !this.readonly && !this.mgInputs.every(input => input.disabled || input.readonly)) {
@@ -32,7 +29,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
32
29
  // mg-input-toggle can not be required
33
30
  if (requiredInputs.length > 0 && requiredInputs.length === this.mgInputs.filter(input => input.nodeName !== 'MG-INPUT-TOGGLE').length) {
34
31
  this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.allRequiredSingle : this.messages.form.allRequired;
35
- this.classList.add(this.classAllRequired);
32
+ this.classCollection.add(this.classAllRequired);
36
33
  }
37
34
  // Some fields are required
38
35
  else if (requiredInputs.length > 0) {
@@ -42,8 +39,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
42
39
  };
43
40
  /**
44
41
  * Check if form is valid
45
- *
46
- * @returns {void}
47
42
  */
48
43
  this.checkValidity = () => {
49
44
  // Update required on input event
@@ -55,9 +50,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
55
50
  };
56
51
  /**
57
52
  * Handle Form Submit
58
- *
59
- * @param {SubmitEvent} event submit event
60
- * @returns {void}
53
+ * @param event - submit event
61
54
  */
62
55
  this.handleFormSubmit = (event) => {
63
56
  event.preventDefault();
@@ -65,8 +58,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
65
58
  };
66
59
  /**
67
60
  * Set mgInputs
68
- *
69
- * @returns {void}
70
61
  */
71
62
  this.setMgInputs = () => {
72
63
  // Get slotted mgInputs
@@ -88,7 +79,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
88
79
  this.disabled = false;
89
80
  this.valid = undefined;
90
81
  this.invalid = undefined;
91
- this.classList = new ClassList(['mg-form']);
82
+ this.classCollection = new ClassList(['mg-form']);
92
83
  this.requiredMessage = undefined;
93
84
  }
94
85
  handleAttributeChange() {
@@ -97,8 +88,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
97
88
  }
98
89
  /**
99
90
  * Public method to display errors
100
- *
101
- * @returns {Promise<void>}
102
91
  */
103
92
  async displayError() {
104
93
  if (!this.readonly) {
@@ -113,8 +102,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
113
102
  *************/
114
103
  /**
115
104
  * Check if component props are well configured on init
116
- *
117
- * @returns {void}
118
105
  */
119
106
  componentWillLoad() {
120
107
  // Get locales
@@ -141,8 +128,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
141
128
  }
142
129
  /**
143
130
  * Add slot listeners
144
- *
145
- * @returns {void}
146
131
  */
147
132
  componentDidLoad() {
148
133
  this.mgButtons.forEach(mgButton => {
@@ -160,11 +145,10 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
160
145
  }
161
146
  /**
162
147
  * Render
163
- *
164
- * @returns {HTMLElement} HTML Element
148
+ * @returns HTML Element
165
149
  */
166
150
  render() {
167
- return (h("form", { class: this.classList.join(), id: this.identifier, name: this.name, ref: el => (this.form = el), onSubmit: this.handleFormSubmit }, this.requiredMessage && h("p", { innerHTML: this.requiredMessage }), h("slot", null), !this.readonly && !this.disabled && h("slot", { name: "actions" })));
151
+ return (h("form", { class: this.classCollection.join(), id: this.identifier, name: this.name, ref: el => (this.form = el), onSubmit: this.handleFormSubmit }, this.requiredMessage && h("p", { innerHTML: this.requiredMessage }), h("slot", null), !this.readonly && !this.disabled && h("slot", { name: "actions" })));
168
152
  }
169
153
  get element() { return this; }
170
154
  static get watchers() { return {
@@ -179,7 +163,7 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
179
163
  "disabled": [4],
180
164
  "valid": [1028],
181
165
  "invalid": [1028],
182
- "classList": [32],
166
+ "classCollection": [32],
183
167
  "requiredMessage": [32],
184
168
  "displayError": [64]
185
169
  }]);
@@ -240,24 +240,31 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
240
240
  this.__attachShadow();
241
241
  /**
242
242
  * getIcon
243
- *
244
- * @returns {HTMLElement} icon html
243
+ * @returns 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
+ */
250
+ this.setDefaultVariantStyle = () => {
251
+ if (this.variantStyle === undefined)
252
+ this.variantStyle = 'background';
253
+ };
247
254
  this.icon = undefined;
248
255
  this.size = 'regular';
249
256
  this.variant = undefined;
250
257
  this.variantStyle = undefined;
251
258
  this.spin = false;
252
- this.classList = new ClassList(['mg-icon']);
259
+ this.classCollection = new ClassList(['mg-icon']);
253
260
  }
254
261
  validateIcon(newValue, oldValue) {
255
262
  if (!Object.keys(icons).includes(newValue))
256
263
  throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}`);
257
264
  else {
258
265
  if (oldValue !== undefined)
259
- this.classList.delete(`mg-icon--${oldValue}`);
260
- this.classList.add(`mg-icon--${newValue}`);
266
+ this.classCollection.delete(`mg-icon--${oldValue}`);
267
+ this.classCollection.add(`mg-icon--${newValue}`);
261
268
  }
262
269
  }
263
270
  validateSize(newValue, oldValue) {
@@ -265,8 +272,8 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
265
272
  throw new Error(`<mg-icon> prop "size" must be one of: ${sizes.join(', ')}`);
266
273
  else {
267
274
  if (oldValue !== undefined)
268
- this.classList.delete(`mg-icon--size-${oldValue}`);
269
- this.classList.add(`mg-icon--size-${newValue}`);
275
+ this.classCollection.delete(`mg-icon--size-${oldValue}`);
276
+ this.classCollection.add(`mg-icon--size-${newValue}`);
270
277
  }
271
278
  }
272
279
  validateVariant(newValue, oldValue) {
@@ -274,11 +281,10 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
274
281
  if (!variants.includes(newValue))
275
282
  throw new Error(`<mg-icon> prop "variant" must be one of: ${variants.join(', ')}`);
276
283
  else {
277
- if (this.variantStyle === undefined)
278
- this.variantStyle = 'background';
284
+ this.setDefaultVariantStyle();
279
285
  if (oldValue !== undefined)
280
- this.classList.delete(`mg-icon--variant-${oldValue}`);
281
- this.classList.add(`mg-icon--variant-${newValue}`);
286
+ this.classCollection.delete(`mg-icon--variant-${oldValue}`);
287
+ this.classCollection.add(`mg-icon--variant-${newValue}`);
282
288
  }
283
289
  }
284
290
  }
@@ -288,25 +294,23 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
288
294
  throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles.join(', ')}`);
289
295
  else {
290
296
  if (oldValue !== undefined)
291
- this.classList.delete(`mg-icon--variant-style-${oldValue}`);
292
- this.classList.add(`mg-icon--variant-style-${newValue}`);
297
+ this.classCollection.delete(`mg-icon--variant-style-${oldValue}`);
298
+ this.classCollection.add(`mg-icon--variant-style-${newValue}`);
293
299
  }
294
300
  }
295
301
  }
296
302
  handleSpin(newValue) {
297
303
  if (newValue) {
298
- this.classList.add('mg-icon--spin');
299
- this.classList.add('mg-a11y-animation');
304
+ this.classCollection.add('mg-icon--spin');
305
+ this.classCollection.add('mg-a11y-animation');
300
306
  }
301
307
  else {
302
- this.classList.delete('mg-icon--spin');
303
- this.classList.delete('mg-a11y-animation');
308
+ this.classCollection.delete('mg-icon--spin');
309
+ this.classCollection.delete('mg-a11y-animation');
304
310
  }
305
311
  }
306
312
  /**
307
313
  * Check if props are well configured on init
308
- *
309
- * @returns {void}
310
314
  */
311
315
  componentWillLoad() {
312
316
  this.validateIcon(this.icon);
@@ -317,11 +321,10 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
317
321
  }
318
322
  /**
319
323
  * Render component
320
- *
321
- * @returns {HTMLElement} HTML Element
324
+ * @returns HTML Element
322
325
  */
323
326
  render() {
324
- return (h("svg", { class: this.classList.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" }, this.getIcon()));
327
+ return (h("svg", { class: this.classCollection.join(), "aria-hidden": "true", focusable: "false", viewBox: "0 0 16 16" }, this.getIcon()));
325
328
  }
326
329
  static get watchers() { return {
327
330
  "icon": ["validateIcon"],
@@ -337,7 +340,7 @@ const MgIcon = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
337
340
  "variant": [1],
338
341
  "variantStyle": [1025, "variant-style"],
339
342
  "spin": [4],
340
- "classList": [32]
343
+ "classCollection": [32]
341
344
  }]);
342
345
  function defineCustomElement() {
343
346
  if (typeof customElements === "undefined") {
@@ -16,8 +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
- * @returns {void}
21
19
  */
22
20
  componentDidLoad() {
23
21
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
@@ -32,8 +30,7 @@ const MgIllustratedMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HT
32
30
  }
33
31
  /**
34
32
  * Render
35
- *
36
- * @returns {HTMLElement} HTML Element
33
+ * @returns HTML Element
37
34
  */
38
35
  render() {
39
36
  return (h("div", { class: {