@mgdis/mg-components 5.10.0 → 5.11.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 (159) hide show
  1. package/dist/cjs/{index-9e1091ab.js → index-03d2557d.js} +3 -0
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/mg-action-more_31.cjs.entry.js +444 -455
  4. package/dist/cjs/mg-components.cjs.js +2 -2
  5. package/dist/cjs/mg-item-more.cjs.entry.js +20 -29
  6. package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-05ec32a3.js} +30 -16
  7. package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
  8. package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
  9. package/dist/collection/components/atoms/mg-card/mg-card.css +2 -0
  10. package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
  11. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
  12. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  13. package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
  14. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
  15. package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
  16. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +20 -25
  17. package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
  18. package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
  19. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -1
  20. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +18 -1
  21. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +126 -19
  22. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +1 -1
  23. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
  24. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
  26. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
  28. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +1 -1
  29. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
  30. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +1 -1
  31. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
  32. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +1 -1
  33. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
  34. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +1 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
  36. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -1
  37. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
  38. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
  39. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
  40. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
  41. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
  42. package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
  43. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
  44. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
  45. package/dist/collection/components/molecules/mg-message/mg-message.css +1 -0
  46. package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
  47. package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
  48. package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
  49. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
  50. package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
  51. package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
  52. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
  53. package/dist/collection/components/molecules/mg-popover/mg-popover.js +16 -16
  54. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
  55. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
  56. package/dist/collection/locales/en/messages.json +7 -0
  57. package/dist/collection/locales/fr/messages.json +7 -0
  58. package/dist/collection/locales/index.js +2 -2
  59. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
  60. package/dist/collection/utils/behaviors.utils.js +16 -22
  61. package/dist/collection/utils/components.utils.js +21 -23
  62. package/dist/collection/utils/locale.utils.js +14 -14
  63. package/dist/collection/utils/unit.test.utils.js +7 -10
  64. package/dist/components/MgInput.js +30 -18
  65. package/dist/components/components.utils.js +21 -23
  66. package/dist/components/index2.js +30 -16
  67. package/dist/components/mg-action-more.js +9 -13
  68. package/dist/components/mg-badge2.js +8 -9
  69. package/dist/components/mg-button2.js +16 -20
  70. package/dist/components/mg-card2.js +9 -11
  71. package/dist/components/mg-character-left2.js +1 -2
  72. package/dist/components/mg-details.js +1 -3
  73. package/dist/components/mg-divider.js +1 -1
  74. package/dist/components/mg-form.js +7 -15
  75. package/dist/components/mg-icon2.js +17 -19
  76. package/dist/components/mg-illustrated-message.js +1 -2
  77. package/dist/components/mg-input-checkbox.js +126 -21
  78. package/dist/components/mg-input-date.js +7 -9
  79. package/dist/components/mg-input-numeric.js +14 -19
  80. package/dist/components/mg-input-password.js +6 -7
  81. package/dist/components/mg-input-radio.js +10 -15
  82. package/dist/components/mg-input-select2.js +21 -29
  83. package/dist/components/mg-input-text2.js +15 -24
  84. package/dist/components/mg-input-textarea.js +13 -14
  85. package/dist/components/mg-input-title2.js +1 -2
  86. package/dist/components/mg-input-toggle.js +17 -20
  87. package/dist/components/mg-item-more.js +18 -27
  88. package/dist/components/mg-menu-item2.js +17 -26
  89. package/dist/components/mg-menu2.js +9 -16
  90. package/dist/components/mg-message.js +12 -15
  91. package/dist/components/mg-modal.js +8 -12
  92. package/dist/components/mg-pagination.js +11 -13
  93. package/dist/components/mg-panel.js +7 -16
  94. package/dist/components/mg-popover2.js +17 -17
  95. package/dist/components/mg-skip-links.js +2 -4
  96. package/dist/components/mg-tabs.js +20 -24
  97. package/dist/components/mg-tag.js +11 -13
  98. package/dist/components/mg-tooltip2.js +20 -25
  99. package/dist/esm/{index-3249671d.js → index-407d5211.js} +3 -0
  100. package/dist/esm/loader.js +3 -3
  101. package/dist/esm/mg-action-more_31.entry.js +444 -455
  102. package/dist/esm/mg-components.js +3 -3
  103. package/dist/esm/mg-item-more.entry.js +20 -29
  104. package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-c8aa56ce.js} +30 -16
  105. package/dist/mg-components/locales/en/messages.json +7 -0
  106. package/dist/mg-components/locales/fr/messages.json +7 -0
  107. package/dist/mg-components/mg-components.css +1 -1
  108. package/dist/mg-components/mg-components.esm.js +1 -1
  109. package/dist/mg-components/p-3bf533f7.js +2 -0
  110. package/dist/mg-components/p-51c2def3.entry.js +1 -0
  111. package/dist/mg-components/p-b14be68b.js +1 -0
  112. package/dist/mg-components/{p-a56a3157.entry.js → p-d3ed97d3.entry.js} +1 -1
  113. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
  114. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -3
  115. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
  116. package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
  117. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
  118. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
  119. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
  120. package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
  121. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
  122. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +15 -21
  123. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
  124. package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
  125. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
  126. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +40 -7
  127. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
  128. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
  129. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
  130. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
  131. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
  132. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -13
  133. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
  134. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
  135. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
  136. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
  137. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
  138. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
  139. package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
  140. package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
  141. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
  142. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
  143. package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
  144. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
  145. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
  146. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
  147. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +7 -9
  148. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
  149. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
  150. package/dist/types/components.d.ts +31 -35
  151. package/dist/types/locales/index.d.ts +16 -2
  152. package/dist/types/utils/behaviors.utils.d.ts +14 -20
  153. package/dist/types/utils/components.utils.d.ts +18 -20
  154. package/dist/types/utils/locale.utils.d.ts +14 -14
  155. package/dist/types/utils/unit.test.utils.d.ts +11 -17
  156. package/package.json +4 -4
  157. package/dist/mg-components/p-73156ac9.js +0 -1
  158. package/dist/mg-components/p-8fbc0d87.js +0 -2
  159. package/dist/mg-components/p-eb32bb18.entry.js +0 -1
@@ -13,7 +13,7 @@ export class MgItemMore {
13
13
  ***********/
14
14
  /**
15
15
  * render mg-item-more overflow element
16
- * @returns {HTMLMgItemMoreElement} mg-item-more element
16
+ * @returns mg-item-more element
17
17
  */
18
18
  this.renderMgMenuItemOverflowElement = () => {
19
19
  // create menu items proxy element from item clones
@@ -62,14 +62,12 @@ export class MgItemMore {
62
62
  *************/
63
63
  /**
64
64
  * Disconnect overflow ResizeObserver
65
- * @returns {void} run overflow resize obeserver disconnexion
66
65
  */
67
66
  disconnectedCallback() {
68
67
  this.overflowBehavior.disconnect();
69
68
  }
70
69
  /**
71
70
  * Set variables and validate props
72
- * @returns {void}
73
71
  */
74
72
  componentWillLoad() {
75
73
  // init variables
@@ -83,14 +81,13 @@ export class MgItemMore {
83
81
  }
84
82
  /**
85
83
  * Add overflow behavior
86
- * @returns {void}
87
84
  */
88
85
  componentDidLoad() {
89
86
  this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
90
87
  }
91
88
  /**
92
89
  * Render
93
- * @returns {HTMLElement} HTML Element
90
+ * @returns HTML Element
94
91
  */
95
92
  render() {
96
93
  return (h(Host, { role: "menuitem", "aria-haspopup": "true" }, h("mg-menu-item", { "data-overflow-more": true, "data-size": this.parentMenu.size }, h("mg-icon", { icon: this.icon.icon, slot: "image" }), h("span", { class: { 'sr-only': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: this.size }))));
@@ -126,7 +123,7 @@ export class MgItemMore {
126
123
  "optional": false,
127
124
  "docs": {
128
125
  "tags": [],
129
- "text": "Define icon\nDefault: {icon: 'ellipsis-vertical'}"
126
+ "text": "Define icon"
130
127
  },
131
128
  "defaultValue": "{ icon: 'ellipsis-vertical' }"
132
129
  },
@@ -147,7 +144,7 @@ export class MgItemMore {
147
144
  "optional": false,
148
145
  "docs": {
149
146
  "tags": [],
150
- "text": "Define slot label element\nDefault: {display: false}"
147
+ "text": "Define slot label element"
151
148
  },
152
149
  "defaultValue": "{ display: false }"
153
150
  },
@@ -69,6 +69,7 @@
69
69
  --mg-card-background: var(--mg-card-background-default);
70
70
  --mg-card-box-shadow: var(--mg-card-box-shadow-default);
71
71
  --mg-card-max-width: unset;
72
+ --mg-card-min-width: unset;
72
73
  }
73
74
 
74
75
  .mg-message,
@@ -18,22 +18,19 @@ export class MgMessage {
18
18
  this.isHovered = false;
19
19
  /**
20
20
  * Set timer
21
- * @returns {void}
22
21
  */
23
22
  this.setTimer = () => {
24
23
  this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
25
24
  };
26
25
  /**
27
26
  * Clear timer
28
- * @returns {void}
29
27
  */
30
28
  this.clearTimer = () => {
31
29
  clearTimeout(this.storedTimer);
32
30
  };
33
31
  /**
34
32
  * Event to add on element
35
- * @param {MouseEvent | FocusEvent} event event
36
- * @returns {void}
33
+ * @param event - event
37
34
  */
38
35
  this.timerEvents = (event) => {
39
36
  this.clearTimer();
@@ -56,7 +53,7 @@ export class MgMessage {
56
53
  };
57
54
  /**
58
55
  * Get icon corresponding to variant
59
- * @returns {MgIcon['icon'] | undefined} icon
56
+ * @returns icon
60
57
  */
61
58
  this.getIcon = () => {
62
59
  switch (this.variant) {
@@ -77,7 +74,7 @@ export class MgMessage {
77
74
  this.variant = variants[0];
78
75
  this.closeButton = false;
79
76
  this.hide = false;
80
- this.classList = new ClassList(['mg-message']);
77
+ this.classCollection = new ClassList(['mg-message']);
81
78
  this.hasActions = false;
82
79
  }
83
80
  validateDelay(newValue) {
@@ -91,9 +88,9 @@ export class MgMessage {
91
88
  }
92
89
  else {
93
90
  if (oldValue !== undefined) {
94
- this.classList.delete(`mg-message--${oldValue}`);
91
+ this.classCollection.delete(`mg-message--${oldValue}`);
95
92
  }
96
- this.classList.add(`mg-message--${newValue}`);
93
+ this.classCollection.add(`mg-message--${newValue}`);
97
94
  }
98
95
  }
99
96
  validateCloseButton(newValue) {
@@ -105,7 +102,7 @@ export class MgMessage {
105
102
  validateHide(newValue) {
106
103
  if (newValue) {
107
104
  this.componentHide.emit();
108
- this.classList.add(this.classHide);
105
+ this.classCollection.add(this.classHide);
109
106
  // Remove event Listener
110
107
  ['focusin', 'mouseenter'].forEach(event => {
111
108
  this.element.removeEventListener(event, this.timerEvents);
@@ -115,7 +112,7 @@ export class MgMessage {
115
112
  }
116
113
  else {
117
114
  this.componentShow.emit();
118
- this.classList.delete(this.classHide);
115
+ this.classCollection.delete(this.classHide);
119
116
  // If delay is set
120
117
  if (this.delay > 1) {
121
118
  // Start timer
@@ -142,7 +139,7 @@ export class MgMessage {
142
139
  this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
143
140
  this.validateCloseButton(this.closeButton);
144
141
  if (this.closeButton) {
145
- this.classList.add('mg-message--close-button');
142
+ this.classCollection.add('mg-message--close-button');
146
143
  this.closeButtonId = `${this.identifier}-close-button`;
147
144
  }
148
145
  this.validateDelay(this.delay);
@@ -150,10 +147,10 @@ export class MgMessage {
150
147
  }
151
148
  /**
152
149
  * Render
153
- * @returns {HTMLElement} HTML Element
150
+ * @returns HTML Element
154
151
  */
155
152
  render() {
156
- return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card", { variant: this.variant, "variant-style": "bar-left" }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))))));
153
+ return (h("div", { id: this.identifier, class: this.classCollection.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card", { variant: this.variant, "variant-style": "bar-left" }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))))));
157
154
  }
158
155
  static get is() { return "mg-message"; }
159
156
  static get encapsulation() { return "shadow"; }
@@ -267,7 +264,7 @@ export class MgMessage {
267
264
  }
268
265
  static get states() {
269
266
  return {
270
- "classList": {},
267
+ "classCollection": {},
271
268
  "hasActions": {}
272
269
  };
273
270
  }
@@ -63,4 +63,5 @@
63
63
  --mg-card-background: var(--mg-card-background-default);
64
64
  --mg-card-box-shadow: var(--mg-card-box-shadow-default);
65
65
  --mg-card-max-width: unset;
66
+ --mg-card-min-width: unset;
66
67
  }
@@ -44,7 +44,6 @@ export class MgModal {
44
44
  *************/
45
45
  /**
46
46
  * Handle close button
47
- * @returns {void}
48
47
  */
49
48
  this.handleClose = () => {
50
49
  this.hide = true;
@@ -55,7 +54,7 @@ export class MgModal {
55
54
  this.hide = false;
56
55
  this.hasActions = false;
57
56
  this.hasContent = false;
58
- this.classList = new ClassList(['mg-modal']);
57
+ this.classCollection = new ClassList(['mg-modal']);
59
58
  }
60
59
  validateModalTitle(newValue) {
61
60
  if (typeof newValue !== 'string' || newValue.trim() === '') {
@@ -65,19 +64,18 @@ export class MgModal {
65
64
  validateHide(newValue) {
66
65
  if (newValue) {
67
66
  this.componentHide.emit();
68
- this.classList.add(this.classHide);
67
+ this.classCollection.add(this.classHide);
69
68
  document.body.style.overflow = this.bodyOverflow;
70
69
  }
71
70
  else {
72
71
  this.componentShow.emit();
73
- this.classList.delete(this.classHide);
72
+ this.classCollection.delete(this.classHide);
74
73
  document.body.style.overflow = 'hidden';
75
74
  }
76
75
  }
77
76
  /**
78
77
  * Handle 'escape' key down
79
- * @param {KeyboardEvent} event keydown event
80
- * @returns {void}
78
+ * @param event - keydown event
81
79
  */
82
80
  handleKeyDown(event) {
83
81
  // we can use 'Escape button" when this not a blocking modal, induced by closeButton value.
@@ -90,7 +88,6 @@ export class MgModal {
90
88
  *************/
91
89
  /**
92
90
  * Check if component props are well configured on init
93
- * @returns {void}
94
91
  */
95
92
  componentWillLoad() {
96
93
  // Store body overflow
@@ -109,7 +106,6 @@ export class MgModal {
109
106
  }
110
107
  /**
111
108
  * Add observer on component to set focus when displayed
112
- * @returns {void}
113
109
  */
114
110
  componentDidLoad() {
115
111
  new MutationObserver(mutationList => {
@@ -124,10 +120,10 @@ export class MgModal {
124
120
  }
125
121
  /**
126
122
  * Render
127
- * @returns {HTMLElement} HTML Element
123
+ * @returns HTML Element
128
124
  */
129
125
  render() {
130
- return (h("div", { role: "alertdialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" })))))));
126
+ return (h("div", { role: "alertdialog", id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" })))))));
131
127
  }
132
128
  static get is() { return "mg-modal"; }
133
129
  static get encapsulation() { return "shadow"; }
@@ -220,7 +216,7 @@ export class MgModal {
220
216
  return {
221
217
  "hasActions": {},
222
218
  "hasContent": {},
223
- "classList": {}
219
+ "classCollection": {}
224
220
  };
225
221
  }
226
222
  static get events() {
@@ -5,6 +5,7 @@ import { initLocales } from './../../../locales';
5
5
  /**
6
6
  * Range generator
7
7
  *
8
+ * ```
8
9
  * start by get the range length, add "+ 1" to include last value, ex: Math.ceil((3 + 1 - 1) / 1) => 3
9
10
  * then with Array(Math.ceil...) we get the final array with empty values, ex: Array(Math.ceil(2 + 1 - 1) / 1)) => [empty, empty, empty]
10
11
  * then with Array(Math.ceil...).keys() we get the Array Iterator from empty values
@@ -12,22 +13,22 @@ import { initLocales } from './../../../locales';
12
13
  * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()) => [0, 1, 2]
13
14
  * finaly we map values from "start" range and apply the "step" coefficiant,
14
15
  * ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()).map(x => 1 + x * 1) => [1, 2, 3]
16
+ * ```
15
17
  *
16
18
  * range(1, 1) = [1]
17
19
  * range(1, 5) = [1, 2, 3, 4, 5]
18
20
  * range(10, 20, 2) = [10, 12, 14, 16, 18, 20]
19
- * @param {number} start start range
20
- * @param {number} end start end
21
- * @param {number} step step size
22
- * @returns {number[]} range numbers
21
+ * @param start - start range
22
+ * @param end - start end
23
+ * @param step - step size
24
+ * @returns range numbers
23
25
  */
24
26
  const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
25
27
  export class MgPagination {
26
28
  constructor() {
27
29
  /**
28
30
  * Change current page from target
29
- * @param {number} target target page
30
- * @returns {void}
31
+ * @param target - target page
31
32
  */
32
33
  this.goToPage = (target) => {
33
34
  this.currentPage = target;
@@ -37,8 +38,7 @@ export class MgPagination {
37
38
  ************/
38
39
  /**
39
40
  * select handler
40
- * @param {InputEvent} event value change event
41
- * @returns {void}
41
+ * @param event - value change event
42
42
  */
43
43
  this.handleSelect = (event) => {
44
44
  const to = Number(event.target.value);
@@ -46,9 +46,8 @@ export class MgPagination {
46
46
  };
47
47
  /**
48
48
  * Go to 'previous/next' page button handler
49
- * @param {string} action navigation action
50
- * @param {boolean} disabled button disable state
51
- * @returns {void}
49
+ * @param action - navigation action
50
+ * @param disabled - button disable state
52
51
  */
53
52
  this.handleGoToPage = (action, disabled) => {
54
53
  !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
@@ -78,7 +77,6 @@ export class MgPagination {
78
77
  *************/
79
78
  /**
80
79
  * Check if props are well configured on init
81
- * @returns {void}
82
80
  */
83
81
  componentWillLoad() {
84
82
  // Get locales
@@ -93,7 +91,7 @@ export class MgPagination {
93
91
  }
94
92
  /**
95
93
  * Render
96
- * @returns {HTMLElement} HTML Element
94
+ * @returns HTML Element
97
95
  */
98
96
  render() {
99
97
  const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
@@ -53,4 +53,5 @@
53
53
  --mg-card-background: var(--mg-card-background-default);
54
54
  --mg-card-box-shadow: var(--mg-card-box-shadow-default);
55
55
  --mg-card-max-width: unset;
56
+ --mg-card-min-width: unset;
56
57
  }
@@ -8,7 +8,6 @@ export class MgPanel {
8
8
  ************/
9
9
  /**
10
10
  * Toggle is editing state
11
- * @returns {void}
12
11
  */
13
12
  this.toggleIsEditing = () => {
14
13
  this.isEditing = !this.isEditing;
@@ -18,7 +17,6 @@ export class MgPanel {
18
17
  ************/
19
18
  /**
20
19
  * Collapse button click handler
21
- * @returns {void}
22
20
  */
23
21
  this.handleCollapseButton = () => {
24
22
  if (!this.expandToggleDisabled) {
@@ -27,22 +25,19 @@ export class MgPanel {
27
25
  };
28
26
  /**
29
27
  * Edit button click handler
30
- * @returns {void}
31
28
  */
32
29
  this.handleEditButton = () => {
33
30
  this.toggleIsEditing();
34
31
  };
35
32
  /**
36
33
  * Update title handler
37
- * @param {CustomEvent<string>} event input value change event
38
- * @returns {void}
34
+ * @param event - input value change event
39
35
  */
40
36
  this.handleUpdateTitle = (event) => {
41
37
  this.updatedPanelTitle = event.detail;
42
38
  };
43
39
  /**
44
40
  * Cancel edition button handler
45
- * @returns {void}
46
41
  */
47
42
  this.handleCancelEditButton = () => {
48
43
  this.updatedPanelTitle = undefined;
@@ -50,7 +45,6 @@ export class MgPanel {
50
45
  };
51
46
  /**
52
47
  * Validate edition button handler
53
- * @returns {void}
54
48
  */
55
49
  this.handleValidateEditButton = () => {
56
50
  if (this.editInputElement.valid) {
@@ -61,8 +55,7 @@ export class MgPanel {
61
55
  };
62
56
  /**
63
57
  * Header left conditional render
64
- * @typedef {HTMLElement} HTMLMgButtonElement
65
- * @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
58
+ * @returns header left element
66
59
  */
67
60
  this.headerLeft = () => {
68
61
  const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("span", { class: "mg-panel__collapse-button-content" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle)));
@@ -87,7 +80,7 @@ export class MgPanel {
87
80
  this.expanded = false;
88
81
  this.expandToggleDisabled = undefined;
89
82
  this.titleEditable = false;
90
- this.classList = new ClassList(['mg-panel']);
83
+ this.classCollection = new ClassList(['mg-panel']);
91
84
  this.isEditing = false;
92
85
  this.updatedPanelTitle = undefined;
93
86
  }
@@ -113,7 +106,6 @@ export class MgPanel {
113
106
  *************/
114
107
  /**
115
108
  * Check if props are well configured on init
116
- * @returns {void}
117
109
  */
118
110
  componentWillLoad() {
119
111
  // Get locales
@@ -124,7 +116,6 @@ export class MgPanel {
124
116
  }
125
117
  /**
126
118
  * Edit DOM after render
127
- * @returns {void}
128
119
  */
129
120
  componentDidRender() {
130
121
  // when we are editing we get focus on edition input
@@ -134,10 +125,10 @@ export class MgPanel {
134
125
  }
135
126
  /**
136
127
  * Render component
137
- * @returns {HTMLElement} html element
128
+ * @returns html element
138
129
  */
139
130
  render() {
140
- return (h("section", { class: this.classList.join(), id: this.identifier }, h("mg-card", null, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null)))));
131
+ return (h("section", { class: this.classCollection.join(), id: this.identifier }, h("mg-card", null, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null)))));
141
132
  }
142
133
  static get is() { return "mg-panel"; }
143
134
  static get encapsulation() { return "shadow"; }
@@ -279,7 +270,7 @@ export class MgPanel {
279
270
  }
280
271
  static get states() {
281
272
  return {
282
- "classList": {},
273
+ "classCollection": {},
283
274
  "isEditing": {},
284
275
  "updatedPanelTitle": {}
285
276
  };
@@ -18,6 +18,7 @@
18
18
  }
19
19
  .mg-popover mg-card {
20
20
  --mg-card-max-width: var(--mg-popover-max-width);
21
+ --mg-card-min-width: var(--mg-popover-min-width);
21
22
  position: relative;
22
23
  }
23
24
  .mg-popover[data-show] {
@@ -117,4 +118,5 @@
117
118
  --mg-card-background: var(--mg-card-background-default);
118
119
  --mg-card-box-shadow: var(--mg-card-box-shadow-default);
119
120
  --mg-card-max-width: unset;
121
+ --mg-card-min-width: unset;
120
122
  }
@@ -9,8 +9,7 @@ export class MgPopover {
9
9
  this.classArrowHide = `mg-popover--arrow-hide`;
10
10
  /**
11
11
  * Check if clicked outside of component
12
- * @param {MouseEvent} event mouse event
13
- * @returns {void}
12
+ * @param event - mouse event
14
13
  */
15
14
  this.clickOutside = (event) => {
16
15
  var _a;
@@ -22,15 +21,12 @@ export class MgPopover {
22
21
  };
23
22
  /**
24
23
  * Show popover
25
- * @returns {void}
26
24
  */
27
25
  this.show = () => {
28
26
  // Make the popover visible
29
27
  this.popover.dataset.show = '';
30
28
  // Enable the event listeners
31
29
  this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
32
- // Update its position
33
- this.popper.update();
34
30
  // hide when click outside
35
31
  // setTimeout is used to prevent event to trigger after creation
36
32
  setTimeout(() => {
@@ -41,7 +37,6 @@ export class MgPopover {
41
37
  };
42
38
  /**
43
39
  * Hide popover
44
- * @returns {void}
45
40
  */
46
41
  this.hide = () => {
47
42
  // Hide the popover
@@ -55,7 +50,6 @@ export class MgPopover {
55
50
  };
56
51
  /**
57
52
  * Handle action for close button
58
- * @returns {void}
59
53
  */
60
54
  this.handleCloseButton = () => {
61
55
  this.display = false;
@@ -66,13 +60,13 @@ export class MgPopover {
66
60
  this.closeButton = false;
67
61
  this.display = false;
68
62
  this.disabled = false;
69
- this.classList = new ClassList(['mg-popover']);
63
+ this.classCollection = new ClassList(['mg-popover']);
70
64
  }
71
65
  validateArrowHide(newValue) {
72
66
  if (newValue)
73
- this.classList.add(this.classArrowHide);
67
+ this.classCollection.add(this.classArrowHide);
74
68
  else
75
- this.classList.delete(this.classArrowHide);
69
+ this.classCollection.delete(this.classArrowHide);
76
70
  }
77
71
  handleDisplay(newValue) {
78
72
  if (newValue) {
@@ -86,9 +80,14 @@ export class MgPopover {
86
80
  /*************
87
81
  * Lifecycle *
88
82
  *************/
83
+ /**
84
+ * update popper position after props change on component did update hook to benefit from render ended
85
+ */
86
+ componentDidUpdate() {
87
+ this.popper.update();
88
+ }
89
89
  /**
90
90
  * Check if component props are well configured on init
91
- * @returns {void} timeout
92
91
  */
93
92
  componentWillLoad() {
94
93
  // Get windows to attach events
@@ -99,7 +98,6 @@ export class MgPopover {
99
98
  }
100
99
  /**
101
100
  * Check if component props are well configured on init
102
- * @returns {void}
103
101
  */
104
102
  componentDidLoad() {
105
103
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
@@ -149,17 +147,19 @@ export class MgPopover {
149
147
  });
150
148
  // Add events to hide popover
151
149
  this.element.addEventListener('keydown', e => {
152
- if (!this.disabled && e.code === 'Escape')
150
+ if (!this.disabled && e.code === 'Escape') {
153
151
  this.display = false;
152
+ interactiveElement.focus();
153
+ }
154
154
  });
155
155
  this.handleDisplay(this.display);
156
156
  }
157
157
  /**
158
158
  * Render
159
- * @returns {HTMLElement} HTML Element
159
+ * @returns HTML Element
160
160
  */
161
161
  render() {
162
- return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: this.classList.join() }, h("mg-card", null, this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), !this.arrowHide && h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
162
+ return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: this.classCollection.join() }, h("mg-card", null, this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), !this.arrowHide && h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
163
163
  }
164
164
  static get is() { return "mg-popover"; }
165
165
  static get encapsulation() { return "shadow"; }
@@ -292,7 +292,7 @@ export class MgPopover {
292
292
  }
293
293
  static get states() {
294
294
  return {
295
- "classList": {}
295
+ "classCollection": {}
296
296
  };
297
297
  }
298
298
  static get events() {
@@ -8,8 +8,7 @@ export class MgSkipLinks {
8
8
  **********/
9
9
  /**
10
10
  * Handle link click and emit go-to-anchor event
11
- * @param {MouseEvent} event mouse event
12
- * @returns {void}
11
+ * @param event - mouse event
13
12
  */
14
13
  this.handleLinkCLick = (event) => {
15
14
  event.currentTarget.blur();
@@ -29,7 +28,6 @@ export class MgSkipLinks {
29
28
  *************/
30
29
  /**
31
30
  * Check if props are well configured on init
32
- * @returns {void}
33
31
  */
34
32
  componentWillLoad() {
35
33
  this.validateLinks(this.links);
@@ -37,7 +35,7 @@ export class MgSkipLinks {
37
35
  }
38
36
  /**
39
37
  * Render
40
- * @returns {HTMLElement} HTML Element
38
+ * @returns HTML Element
41
39
  */
42
40
  render() {
43
41
  return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));