@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
@@ -26,23 +26,23 @@ export class MgInputTextarea {
26
26
  * Handle focus event
27
27
  */
28
28
  this.handleFocus = () => {
29
- this.classList.add(this.classFocus);
30
- this.classList = new ClassList(this.classList.classes);
29
+ this.classCollection.add(this.classFocus);
30
+ this.classCollection = new ClassList(this.classCollection.classes);
31
31
  };
32
32
  /**
33
33
  * Handle blur event
34
34
  */
35
35
  this.handleBlur = () => {
36
36
  // Manage focus
37
- this.classList.delete(this.classFocus);
38
- this.classList = new ClassList(this.classList.classes);
37
+ this.classCollection.delete(this.classFocus);
38
+ this.classCollection = new ClassList(this.classCollection.classes);
39
39
  // Display Error
40
40
  this.displayError();
41
41
  };
42
42
  /**
43
43
  * Get pattern validity
44
44
  * Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
45
- * @returns {boolean} is pattern valid
45
+ * @returns is pattern valid
46
46
  */
47
47
  this.getPatternValidity = () => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);
48
48
  /**
@@ -102,7 +102,7 @@ export class MgInputTextarea {
102
102
  this.valid = undefined;
103
103
  this.invalid = undefined;
104
104
  this.resizable = 'none';
105
- this.classList = new ClassList(['mg-input--textarea']);
105
+ this.classCollection = new ClassList(['mg-input--textarea']);
106
106
  this.errorMessage = undefined;
107
107
  }
108
108
  handleValue(newValue) {
@@ -121,15 +121,14 @@ export class MgInputTextarea {
121
121
  }
122
122
  validateDisplayCharacterLeft(newValue) {
123
123
  if (newValue) {
124
- this.classList.add(this.classHasDisplayCharacterLeft);
124
+ this.classCollection.add(this.classHasDisplayCharacterLeft);
125
125
  }
126
126
  else {
127
- this.classList.delete(this.classHasDisplayCharacterLeft);
127
+ this.classCollection.delete(this.classHasDisplayCharacterLeft);
128
128
  }
129
129
  }
130
130
  /**
131
131
  * Public method to display errors
132
- * @returns {Promise<void>}
133
132
  */
134
133
  async displayError() {
135
134
  this.checkValidity();
@@ -141,7 +140,7 @@ export class MgInputTextarea {
141
140
  *************/
142
141
  /**
143
142
  * Check if component props are well configured on init
144
- * @returns {ReturnType<typeof setTimeout>} timeout
143
+ * @returns timeout
145
144
  */
146
145
  componentWillLoad() {
147
146
  // Get locales
@@ -159,10 +158,10 @@ export class MgInputTextarea {
159
158
  }
160
159
  /**
161
160
  * Render
162
- * @returns {HTMLElement} HTML Element
161
+ * @returns HTML Element
163
162
  */
164
163
  render() {
165
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left" }, h("textarea", { class: {
164
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left" }, h("textarea", { class: {
166
165
  'mg-input__box': true,
167
166
  'mg-input__box--resizable': this.resizable === 'both',
168
167
  'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',
@@ -562,7 +561,7 @@ export class MgInputTextarea {
562
561
  }
563
562
  static get states() {
564
563
  return {
565
- "classList": {},
564
+ "classCollection": {},
566
565
  "errorMessage": {}
567
566
  };
568
567
  }
@@ -614,10 +613,7 @@ export class MgInputTextarea {
614
613
  },
615
614
  "docs": {
616
615
  "text": "Public method to display errors",
617
- "tags": [{
618
- "name": "returns",
619
- "text": undefined
620
- }]
616
+ "tags": []
621
617
  }
622
618
  }
623
619
  };
@@ -5,8 +5,8 @@ import { MgInput } from '../MgInput';
5
5
  import { ClassList, allItemsAreString } from '../../../../utils/components.utils';
6
6
  /**
7
7
  * type Option validation function
8
- * @param {ToggleValue} option radio option
9
- * @returns {boolean} toggle option type is valid
8
+ * @param option - radio option
9
+ * @returns toggle option type is valid
10
10
  */
11
11
  const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
12
12
  export class MgInputToggle {
@@ -22,14 +22,12 @@ export class MgInputToggle {
22
22
  this.classIcon = 'mg-input--toggle-icon';
23
23
  /**
24
24
  * Change checked value
25
- * @returns {void}
26
25
  */
27
26
  this.toggleChecked = () => {
28
27
  this.checked = !this.checked;
29
28
  };
30
29
  /**
31
30
  * Slots validation
32
- * @returns {void}
33
31
  */
34
32
  this.validateSlots = () => {
35
33
  const slots = Array.from(this.element.children);
@@ -55,7 +53,7 @@ export class MgInputToggle {
55
53
  this.disabled = false;
56
54
  this.tooltip = undefined;
57
55
  this.helpText = undefined;
58
- this.classList = new ClassList(['mg-input--toggle']);
56
+ this.classCollection = new ClassList(['mg-input--toggle']);
59
57
  this.options = undefined;
60
58
  this.checked = false;
61
59
  }
@@ -83,40 +81,39 @@ export class MgInputToggle {
83
81
  }
84
82
  handleIsOnOff(newValue) {
85
83
  if (newValue)
86
- this.classList.add(this.classOnOff);
84
+ this.classCollection.add(this.classOnOff);
87
85
  else
88
- this.classList.delete(this.classOnOff);
86
+ this.classCollection.delete(this.classOnOff);
89
87
  }
90
88
  handleIsIcon(newValue) {
91
89
  if (newValue)
92
- this.classList.add(this.classIcon);
90
+ this.classCollection.add(this.classIcon);
93
91
  else
94
- this.classList.delete(this.classIcon);
92
+ this.classCollection.delete(this.classIcon);
95
93
  }
96
94
  handleReadonly(newValue) {
97
95
  if (newValue)
98
- this.classList.add(this.classReadonly);
96
+ this.classCollection.add(this.classReadonly);
99
97
  else
100
- this.classList.delete(this.classReadonly);
98
+ this.classCollection.delete(this.classReadonly);
101
99
  }
102
100
  handleDisabled(newValue) {
103
101
  if (newValue)
104
- this.classList.add(this.classDisabled);
102
+ this.classCollection.add(this.classDisabled);
105
103
  else
106
- this.classList.delete(this.classDisabled);
104
+ this.classCollection.delete(this.classDisabled);
107
105
  }
108
106
  handleChecked(newValue) {
109
107
  // style
110
108
  if (newValue)
111
- this.classList.add(this.classIsActive);
109
+ this.classCollection.add(this.classIsActive);
112
110
  else
113
- this.classList.delete(this.classIsActive);
111
+ this.classCollection.delete(this.classIsActive);
114
112
  // update value
115
113
  this.value = this.options[newValue ? 1 : 0].value;
116
114
  }
117
115
  /**
118
116
  * set checked state
119
- * @returns {void}
120
117
  */
121
118
  setChecked() {
122
119
  const optionTrueValueIndex = this.options.map(option => option.value).findIndex(value => value === true);
@@ -158,10 +155,10 @@ export class MgInputToggle {
158
155
  }
159
156
  /**
160
157
  * Render
161
- * @returns {HTMLElement} HTML Element
158
+ * @returns HTML Element
162
159
  */
163
160
  render() {
164
- return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
161
+ return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: !this.readonly && this.tooltip, helpText: this.helpText, errorMessage: undefined, isFieldset: false }, h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-input__toggle-item-container" }, h("slot", { name: "item-2" })))));
165
162
  }
166
163
  static get is() { return "mg-input-toggle"; }
167
164
  static get encapsulation() { return "shadow"; }
@@ -210,10 +207,7 @@ export class MgInputToggle {
210
207
  "required": true,
211
208
  "optional": false,
212
209
  "docs": {
213
- "tags": [{
214
- "name": "returns",
215
- "text": undefined
216
- }],
210
+ "tags": [],
217
211
  "text": "Items are the possible options to select"
218
212
  }
219
213
  },
@@ -414,7 +408,7 @@ export class MgInputToggle {
414
408
  }
415
409
  static get states() {
416
410
  return {
417
- "classList": {},
411
+ "classCollection": {},
418
412
  "options": {},
419
413
  "checked": {}
420
414
  };
@@ -13,9 +13,8 @@ export class MgMenu {
13
13
  *************/
14
14
  /**
15
15
  * Close matching menu-item
16
- * @param {HTMLElement} item menu-item to close
17
- * @param {boolean} condition addionnal condition
18
- * @returns {void}
16
+ * @param item - menu-item to close
17
+ * @param condition - addionnal condition
19
18
  */
20
19
  this.closeMenuItem = (item, condition) => {
21
20
  if (!this.isChildMenu && condition) {
@@ -24,19 +23,18 @@ export class MgMenu {
24
23
  };
25
24
  /**
26
25
  * get mg-item-more element
27
- * @returns {HTMLMgItemMoreElement} mg-item-more element
26
+ * @returns mg-item-more element
28
27
  */
29
28
  this.getItemMore = () => this.element.querySelector('mg-item-more');
30
29
  /**
31
- * get mg-item-more >>> mg-menu-item element
32
- * @returns {HTMLMgMenuItemElement} mg-item-more >>> mg-menu-item element
30
+ * get mg-item-more child mg-menu-item element
31
+ * @returns mg-menu-item element
33
32
  */
34
33
  this.getItemMoreMenuItem = () => { var _a, _b; return (_b = (_a = this.getItemMore()) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item'); };
35
34
  /**
36
35
  * Set item listend
37
- * @param {HTMLMgMenuItemElement} item mg-menu-item element
38
- * @param {MgMenu['focusedMenuItem']} index number
39
- * @returns {void}
36
+ * @param item - mg-menu-item element
37
+ * @param index - number
40
38
  */
41
39
  this.setItemListener = (item, index) => {
42
40
  ['click', 'focus'].forEach(trigger => {
@@ -51,7 +49,6 @@ export class MgMenu {
51
49
  };
52
50
  /**
53
51
  * Store menu-items on component init and add listeners
54
- * @returns {void}
55
52
  */
56
53
  this.initMenuItemsListeners = () => {
57
54
  // add listeners on menu item and edit index
@@ -61,14 +58,12 @@ export class MgMenu {
61
58
  };
62
59
  /**
63
60
  * Handle item-loaded event on mg-item-more element
64
- * @returns {void}
65
61
  */
66
62
  this.handleItemLoaded = () => {
67
63
  this.setItemListener(this.getItemMoreMenuItem(), this.menuItems.length);
68
64
  };
69
65
  /**
70
66
  * render mg-item-more
71
- * @returns {void}
72
67
  */
73
68
  this.renderMgItemMore = () => {
74
69
  // /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
@@ -110,7 +105,6 @@ export class MgMenu {
110
105
  *************/
111
106
  /**
112
107
  * Validate props
113
- * @returns {void}
114
108
  */
115
109
  componentWillLoad() {
116
110
  this.validateDirection(this.direction);
@@ -120,7 +114,7 @@ export class MgMenu {
120
114
  }
121
115
  /**
122
116
  * Check if component slots configuration
123
- * @returns {ReturnType<typeof setTimeout>} timeout
117
+ * @returns timeout
124
118
  */
125
119
  componentDidLoad() {
126
120
  // update props and states after componentDidLoad hook
@@ -150,14 +144,13 @@ export class MgMenu {
150
144
  }
151
145
  /**
152
146
  * Add listeners to items
153
- * @returns {void}
154
147
  */
155
148
  componentDidRender() {
156
149
  this.initMenuItemsListeners();
157
150
  }
158
151
  /**
159
152
  * Render
160
- * @returns {HTMLElement} HTML Element
153
+ * @returns HTML Element
161
154
  */
162
155
  render() {
163
156
  return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
@@ -210,7 +203,7 @@ export class MgMenu {
210
203
  "optional": false,
211
204
  "docs": {
212
205
  "tags": [],
213
- "text": "Component display direction. Default: \"horizontal\""
206
+ "text": "Component display direction."
214
207
  },
215
208
  "attribute": "direction",
216
209
  "reflect": true,
@@ -253,7 +246,7 @@ export class MgMenu {
253
246
  "optional": false,
254
247
  "docs": {
255
248
  "tags": [],
256
- "text": "Define mg-menu size\nDefault: 'regular'"
249
+ "text": "Define mg-menu size"
257
250
  },
258
251
  "attribute": "size",
259
252
  "reflect": false,
@@ -15,29 +15,27 @@ export class MgMenuItem {
15
15
  **********/
16
16
  /**
17
17
  * Toggle expanded prop value
18
- * @returns {void}
19
18
  */
20
19
  this.toggleExpanded = () => {
21
20
  this.expanded = !this.expanded;
22
21
  };
23
22
  /**
24
23
  * Does an Element have given Status
25
- * @param {HTMLMgMenuItemElement} mgMenuItemElement to parse
26
- * @param {MgMenuItem['status']} status to check
27
- * @returns {boolean} true if element with status is found
24
+ * @param mgMenuItemElement - to parse
25
+ * @param status - to check
26
+ * @returns true if element with status is found
28
27
  */
29
28
  this.hasStatus = (mgMenuItemElement, status) => mgMenuItemElement.status === status;
30
29
  /**
31
30
  * Is component contextual direction match the given direction
32
- * @param {MgMenuItem['direction']} direction in parent menu
33
- * @param {MgMenuItem['direction']} compareWith direction to compare with. Default: `this.direction`
34
- * @returns {boolean} true is direction match the direction propertie
31
+ * @param direction - in parent menu
32
+ * @param compareWith - direction to compare with. Default: `this.direction`
33
+ * @returns true is direction match the direction propertie
35
34
  */
36
35
  this.isDirection = (direction, compareWith = this.direction) => direction === compareWith;
37
36
  /**
38
37
  * Update displayNotificationBadge
39
38
  * current component notification badge have priority over the slot badge when submenu contain badge
40
- * @returns {void} update displayNotificationBadge value
41
39
  */
42
40
  this.updateDisplayNotificationBadge = () => {
43
41
  const childMenu = this.element.querySelector('mg-menu');
@@ -47,7 +45,7 @@ export class MgMenuItem {
47
45
  };
48
46
  /**
49
47
  * Method to control if one of component children have active status
50
- * @returns {boolean} truthy if component has active child
48
+ * @returns truthy if component has active child
51
49
  */
52
50
  this.hasActiveChild = () => {
53
51
  var _a;
@@ -55,8 +53,7 @@ export class MgMenuItem {
55
53
  };
56
54
  /**
57
55
  * Validate slots
58
- * @param {boolean} guard prevent action whith guard. Default: false.
59
- * @returns {void}
56
+ * @param guard - prevent action whith guard. Default: false.
60
57
  */
61
58
  this.validateSlot = (guard = false) => {
62
59
  // slot title AND metadata validation
@@ -74,8 +71,7 @@ export class MgMenuItem {
74
71
  };
75
72
  /**
76
73
  * Update status
77
- * @param {Status[]} guard status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
78
- * @returns {void}
74
+ * @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
79
75
  */
80
76
  this.updateStatus = (guard = []) => {
81
77
  if (![Status.HIDDEN, Status.DISABLED, ...guard].includes(this.status)) {
@@ -84,7 +80,6 @@ export class MgMenuItem {
84
80
  };
85
81
  /**
86
82
  * Init event-listeners
87
- * @returns {void}
88
83
  */
89
84
  this.initListeners = () => {
90
85
  var _a;
@@ -100,12 +95,12 @@ export class MgMenuItem {
100
95
  };
101
96
  /**
102
97
  * Get mg-popover identifier
103
- * @returns {MgPopover['identifier']} generated mg-popover identifier
98
+ * @returns generated mg-popover identifier
104
99
  */
105
100
  this.getPopoverIdentifier = () => `${this.identifier}-popover`;
106
101
  /**
107
102
  * Condition to know if component should display a mg-popover
108
- * @returns {boolean} truthy if component display popover
103
+ * @returns truthy if component display popover
109
104
  */
110
105
  this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
111
106
  /************
@@ -113,8 +108,7 @@ export class MgMenuItem {
113
108
  ************/
114
109
  /**
115
110
  * Handle interacrtive element click
116
- * @param {MouseEvent} event click on element
117
- * @returns {void}
111
+ * @param event - click on element
118
112
  */
119
113
  this.handleElementCLick = (event) => {
120
114
  if ((this.hasChildren && !this.isInMainMenu) || this.status === Status.DISABLED) {
@@ -127,15 +121,14 @@ export class MgMenuItem {
127
121
  };
128
122
  /**
129
123
  * Handle popover element display-change event
130
- * @param {CustomEvent} event popover display event
131
- * @returns {void}
124
+ * @param event - popover display event
132
125
  */
133
126
  this.handlePopoverDisplay = (event) => {
134
127
  this.expanded = event.detail;
135
128
  };
136
129
  /**
137
130
  * Render slot
138
- * @returns {HTMLElement} HTML Element
131
+ * @returns HTML Element
139
132
  */
140
133
  this.renderSlot = () => h("slot", null);
141
134
  this.identifier = createID('mg-menu-item');
@@ -201,7 +194,6 @@ export class MgMenuItem {
201
194
  }
202
195
  /**
203
196
  * Render popover clickoutside guard for content slot
204
- * @returns {void}
205
197
  */
206
198
  updatePopoverGuard() {
207
199
  if (this.displayPopover())
@@ -214,7 +206,6 @@ export class MgMenuItem {
214
206
  *************/
215
207
  /**
216
208
  * Validate props
217
- * @returns {void}
218
209
  */
219
210
  componentWillLoad() {
220
211
  // has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
@@ -230,7 +221,7 @@ export class MgMenuItem {
230
221
  }
231
222
  /**
232
223
  * Check if component slots configuration
233
- * @returns {ReturnType<typeof setTimeout>} timeout
224
+ * @returns timeout
234
225
  */
235
226
  componentDidLoad() {
236
227
  // validation
@@ -269,7 +260,7 @@ export class MgMenuItem {
269
260
  }
270
261
  /**
271
262
  * Render ineractive element
272
- * @returns {HTMLElement} HTML Element
263
+ * @returns HTML Element
273
264
  */
274
265
  renderInteractiveElement() {
275
266
  const TagName = this.href !== undefined ? 'a' : 'button';
@@ -281,7 +272,7 @@ export class MgMenuItem {
281
272
  }
282
273
  /**
283
274
  * Render
284
- * @returns {HTMLElement} HTML Element
275
+ * @returns HTML Element
285
276
  */
286
277
  render() {
287
278
  const getContainerClasses = () => ({
@@ -319,7 +310,7 @@ export class MgMenuItem {
319
310
  "optional": false,
320
311
  "docs": {
321
312
  "tags": [],
322
- "text": "Identifier is used to control mg-popover\nDefault: createID('mg-menu-item');"
313
+ "text": "Identifier is used to control mg-popover"
323
314
  },
324
315
  "attribute": "identifier",
325
316
  "reflect": false,
@@ -359,7 +350,7 @@ export class MgMenuItem {
359
350
  "optional": false,
360
351
  "docs": {
361
352
  "tags": [],
362
- "text": "Define menu-item status. Default: \"visible\""
353
+ "text": "Define menu-item status."
363
354
  },
364
355
  "attribute": "status",
365
356
  "reflect": true,
@@ -377,7 +368,7 @@ export class MgMenuItem {
377
368
  "optional": false,
378
369
  "docs": {
379
370
  "tags": [],
380
- "text": "Define menu-item content expanded. Default: false."
371
+ "text": "Define menu-item content expanded."
381
372
  },
382
373
  "attribute": "expanded",
383
374
  "reflect": false,
@@ -5,8 +5,8 @@ import { Direction } from '../menu/mg-menu/mg-menu.conf';
5
5
  import { createID } from '../../../utils/components.utils';
6
6
  /**
7
7
  * MgActionMore['items'] type guard
8
- * @param {unknown} prop commponent items prop
9
- * @returns {boolean} return true if type is valid
8
+ * @param prop - commponent items prop
9
+ * @returns return true if type is valid
10
10
  */
11
11
  const isMgActionMoreItems = (prop) => {
12
12
  const items = prop;
@@ -14,8 +14,8 @@ const isMgActionMoreItems = (prop) => {
14
14
  };
15
15
  /**
16
16
  * MgActionMore['button'] type guard
17
- * @param {unknown} prop commponent button prop
18
- * @returns {boolean} return true if type is valid
17
+ * @param prop - commponent button prop
18
+ * @returns return true if type is valid
19
19
  */
20
20
  const isMgActionMoreButton = (prop) => {
21
21
  const button = prop;
@@ -23,8 +23,8 @@ const isMgActionMoreButton = (prop) => {
23
23
  };
24
24
  /**
25
25
  * MgActionMore['icon'] type guard
26
- * @param {unknown} prop commponent icon prop
27
- * @returns {boolean} return true if type is valid
26
+ * @param prop - commponent icon prop
27
+ * @returns return true if type is valid
28
28
  */
29
29
  const isMgActionMoreIcon = (prop) => {
30
30
  const icon = prop;
@@ -42,23 +42,20 @@ export class MgActionMore {
42
42
  ***********/
43
43
  /**
44
44
  * Toogle expanded props
45
- * @returns {void}
46
45
  */
47
46
  this.toggleExpanded = () => {
48
47
  this.expanded = !this.expanded;
49
48
  };
50
49
  /**
51
50
  * Button click handler
52
- * @returns {void}
53
51
  */
54
52
  this.handleButton = () => {
55
53
  this.toggleExpanded();
56
54
  };
57
55
  /**
58
56
  * Item click handler
59
- * @param {MouseEvent} event click event
60
- * @param {MgActionMoreItemType['mouseEventHandler']} customHandler item['mouseEventHandler']
61
- * @returns {void}
57
+ * @param event - click event
58
+ * @param customHandler - item['mouseEventHandler']
62
59
  */
63
60
  this.handleItemClick = (event, customHandler) => {
64
61
  this.expanded = false;
@@ -95,7 +92,6 @@ export class MgActionMore {
95
92
  *************/
96
93
  /**
97
94
  * Validate props
98
- * @returns {void}
99
95
  */
100
96
  componentWillLoad() {
101
97
  this.messages = initLocales(this.element).messages.actionMore;
@@ -106,7 +102,7 @@ export class MgActionMore {
106
102
  }
107
103
  /**
108
104
  * Render
109
- * @returns {HTMLElement} HTML Element
105
+ * @returns HTML Element
110
106
  */
111
107
  render() {
112
108
  const buttonLabel = this.button.label || this.messages.label;
@@ -156,7 +152,7 @@ export class MgActionMore {
156
152
  "optional": false,
157
153
  "docs": {
158
154
  "tags": [],
159
- "text": "Define displaied icon\nDefault: {icon: 'ellipsis'}"
155
+ "text": "Define displaied icon"
160
156
  },
161
157
  "defaultValue": "{ icon: 'ellipsis' }"
162
158
  },
@@ -177,7 +173,7 @@ export class MgActionMore {
177
173
  "optional": false,
178
174
  "docs": {
179
175
  "tags": [],
180
- "text": "Define button properties\nDefault: {variant: 'flat', isIcon: true}."
176
+ "text": "Define button properties"
181
177
  },
182
178
  "defaultValue": "{ variant: 'flat', isIcon: true }"
183
179
  },
@@ -3,7 +3,6 @@ export class MgDetails {
3
3
  constructor() {
4
4
  /**
5
5
  * Handle details toggle
6
- * @returns {void}
7
6
  */
8
7
  this.handleToggle = () => {
9
8
  this.expanded = this.details.open;
@@ -26,7 +25,6 @@ export class MgDetails {
26
25
  *************/
27
26
  /**
28
27
  * Check if component props are well configured on init
29
- * @returns {void}
30
28
  */
31
29
  componentWillLoad() {
32
30
  this.validateTitles(this.toggleClosed);
@@ -34,7 +32,7 @@ export class MgDetails {
34
32
  }
35
33
  /**
36
34
  * Render
37
- * @returns {HTMLElement} HTML Element
35
+ * @returns HTML Element
38
36
  */
39
37
  render() {
40
38
  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" }))));