@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
@@ -7,13 +7,11 @@ export class MgForm {
7
7
  this.classAllRequired = 'mg-form--all-required';
8
8
  /**
9
9
  * Define required message based on mg-inputs required elements
10
- * Also
11
- * @returns {void}
12
10
  */
13
11
  this.setRequiredMessage = () => {
14
12
  // init required message
15
13
  this.requiredMessage = null;
16
- this.classList.delete(this.classAllRequired);
14
+ this.classCollection.delete(this.classAllRequired);
17
15
  // If the form is disabled or readonly none of them are required
18
16
  // Check if all fields are not editable (readonly or disabled)
19
17
  if (!this.disabled && !this.readonly && !this.mgInputs.every(input => input.disabled || input.readonly)) {
@@ -23,7 +21,7 @@ export class MgForm {
23
21
  // mg-input-toggle can not be required
24
22
  if (requiredInputs.length > 0 && requiredInputs.length === this.mgInputs.filter(input => input.nodeName !== 'MG-INPUT-TOGGLE').length) {
25
23
  this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.allRequiredSingle : this.messages.form.allRequired;
26
- this.classList.add(this.classAllRequired);
24
+ this.classCollection.add(this.classAllRequired);
27
25
  }
28
26
  // Some fields are required
29
27
  else if (requiredInputs.length > 0) {
@@ -33,7 +31,6 @@ export class MgForm {
33
31
  };
34
32
  /**
35
33
  * Check if form is valid
36
- * @returns {void}
37
34
  */
38
35
  this.checkValidity = () => {
39
36
  // Update required on input event
@@ -45,8 +42,7 @@ export class MgForm {
45
42
  };
46
43
  /**
47
44
  * Handle Form Submit
48
- * @param {SubmitEvent} event submit event
49
- * @returns {void}
45
+ * @param event - submit event
50
46
  */
51
47
  this.handleFormSubmit = (event) => {
52
48
  event.preventDefault();
@@ -54,7 +50,6 @@ export class MgForm {
54
50
  };
55
51
  /**
56
52
  * Set mgInputs
57
- * @returns {void}
58
53
  */
59
54
  this.setMgInputs = () => {
60
55
  // Get slotted mgInputs
@@ -76,7 +71,7 @@ export class MgForm {
76
71
  this.disabled = false;
77
72
  this.valid = undefined;
78
73
  this.invalid = undefined;
79
- this.classList = new ClassList(['mg-form']);
74
+ this.classCollection = new ClassList(['mg-form']);
80
75
  this.requiredMessage = undefined;
81
76
  }
82
77
  handleAttributeChange() {
@@ -85,7 +80,6 @@ export class MgForm {
85
80
  }
86
81
  /**
87
82
  * Public method to display errors
88
- * @returns {Promise<void>}
89
83
  */
90
84
  async displayError() {
91
85
  if (!this.readonly) {
@@ -100,7 +94,6 @@ export class MgForm {
100
94
  *************/
101
95
  /**
102
96
  * Check if component props are well configured on init
103
- * @returns {void}
104
97
  */
105
98
  componentWillLoad() {
106
99
  // Get locales
@@ -127,7 +120,6 @@ export class MgForm {
127
120
  }
128
121
  /**
129
122
  * Add slot listeners
130
- * @returns {void}
131
123
  */
132
124
  componentDidLoad() {
133
125
  this.mgButtons.forEach(mgButton => {
@@ -145,10 +137,10 @@ export class MgForm {
145
137
  }
146
138
  /**
147
139
  * Render
148
- * @returns {HTMLElement} HTML Element
140
+ * @returns HTML Element
149
141
  */
150
142
  render() {
151
- 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" })));
143
+ 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" })));
152
144
  }
153
145
  static get is() { return "mg-form"; }
154
146
  static get encapsulation() { return "shadow"; }
@@ -274,7 +266,7 @@ export class MgForm {
274
266
  }
275
267
  static get states() {
276
268
  return {
277
- "classList": {},
269
+ "classCollection": {},
278
270
  "requiredMessage": {}
279
271
  };
280
272
  }
@@ -326,10 +318,7 @@ export class MgForm {
326
318
  },
327
319
  "docs": {
328
320
  "text": "Public method to display errors",
329
- "tags": [{
330
- "name": "returns",
331
- "text": undefined
332
- }]
321
+ "tags": []
333
322
  }
334
323
  }
335
324
  };
@@ -10,7 +10,6 @@ export class MgIllustratedMessage {
10
10
  *************/
11
11
  /**
12
12
  * Check if component props are well configured on init
13
- * @returns {void}
14
13
  */
15
14
  componentDidLoad() {
16
15
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
@@ -25,7 +24,7 @@ export class MgIllustratedMessage {
25
24
  }
26
25
  /**
27
26
  * Render
28
- * @returns {HTMLElement} HTML Element
27
+ * @returns HTML Element
29
28
  */
30
29
  render() {
31
30
  return (h("div", { class: {
@@ -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
  },
@@ -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
  }
@@ -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`],
@@ -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
  };
@@ -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,7 +21,6 @@ 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
@@ -41,7 +39,6 @@ export class MgPopover {
41
39
  };
42
40
  /**
43
41
  * Hide popover
44
- * @returns {void}
45
42
  */
46
43
  this.hide = () => {
47
44
  // Hide the popover
@@ -55,7 +52,6 @@ export class MgPopover {
55
52
  };
56
53
  /**
57
54
  * Handle action for close button
58
- * @returns {void}
59
55
  */
60
56
  this.handleCloseButton = () => {
61
57
  this.display = false;
@@ -66,13 +62,13 @@ export class MgPopover {
66
62
  this.closeButton = false;
67
63
  this.display = false;
68
64
  this.disabled = false;
69
- this.classList = new ClassList(['mg-popover']);
65
+ this.classCollection = new ClassList(['mg-popover']);
70
66
  }
71
67
  validateArrowHide(newValue) {
72
68
  if (newValue)
73
- this.classList.add(this.classArrowHide);
69
+ this.classCollection.add(this.classArrowHide);
74
70
  else
75
- this.classList.delete(this.classArrowHide);
71
+ this.classCollection.delete(this.classArrowHide);
76
72
  }
77
73
  handleDisplay(newValue) {
78
74
  if (newValue) {
@@ -88,7 +84,6 @@ export class MgPopover {
88
84
  *************/
89
85
  /**
90
86
  * Check if component props are well configured on init
91
- * @returns {void} timeout
92
87
  */
93
88
  componentWillLoad() {
94
89
  // Get windows to attach events
@@ -99,7 +94,6 @@ export class MgPopover {
99
94
  }
100
95
  /**
101
96
  * Check if component props are well configured on init
102
- * @returns {void}
103
97
  */
104
98
  componentDidLoad() {
105
99
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
@@ -156,10 +150,10 @@ export class MgPopover {
156
150
  }
157
151
  /**
158
152
  * Render
159
- * @returns {HTMLElement} HTML Element
153
+ * @returns HTML Element
160
154
  */
161
155
  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 }))));
156
+ 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
157
  }
164
158
  static get is() { return "mg-popover"; }
165
159
  static get encapsulation() { return "shadow"; }
@@ -292,7 +286,7 @@ export class MgPopover {
292
286
  }
293
287
  static get states() {
294
288
  return {
295
- "classList": {}
289
+ "classCollection": {}
296
290
  };
297
291
  }
298
292
  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)))))));