@mgdis/mg-components 3.2.0 → 4.0.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 (228) hide show
  1. package/dist/cjs/{index-bead7dbd.js → index-88560a66.js} +47 -48
  2. package/dist/cjs/{index-369388eb.js → index-a39c5567.js} +97 -10
  3. package/dist/cjs/loader.cjs.js +3 -17
  4. package/dist/cjs/mg-badge_21.cjs.entry.js +519 -294
  5. package/dist/cjs/mg-components.cjs.js +3 -7
  6. package/dist/cjs/mg-modal.cjs.entry.js +12 -6
  7. package/dist/cjs/mg-popover.cjs.entry.js +15 -10
  8. package/dist/cjs/{popper-0c3964e7.js → popper-71bf3058.js} +6 -2
  9. package/dist/collection/collection-manifest.json +1 -1
  10. package/dist/collection/components/atoms/mg-badge/{mg-badge.stories.js → doc/mg-badge.stories.js} +1 -1
  11. package/dist/collection/components/atoms/mg-badge/mg-badge.css +0 -2
  12. package/dist/collection/components/atoms/mg-badge/mg-badge.js +15 -3
  13. package/dist/collection/components/atoms/mg-button/{mg-button.stories.js → doc/mg-button.stories.js} +2 -2
  14. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
  15. package/dist/collection/components/atoms/mg-button/mg-button.css +20 -32
  16. package/dist/collection/components/atoms/mg-button/mg-button.js +8 -3
  17. package/dist/collection/components/atoms/mg-character-left/{mg-character-left.stories.js → doc/mg-character-left.stories.js} +1 -1
  18. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +10 -47
  19. package/dist/collection/components/atoms/mg-icon/{mg-icon.stories.js → doc/mg-icon.stories.js} +1 -1
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +97 -10
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.css +4 -0
  22. package/dist/collection/components/atoms/mg-icon/mg-icon.js +22 -6
  23. package/dist/collection/components/atoms/mg-input-title/{mg-input-title.stories.js → doc/mg-input-title.stories.js} +0 -0
  24. package/dist/collection/components/atoms/mg-tag/{mg-tag.stories.js → doc/mg-tag.stories.js} +1 -1
  25. package/dist/collection/components/atoms/mg-tag/mg-tag.js +19 -4
  26. package/dist/collection/components/atoms/mg-tooltip/{mg-tooltip.stories.js → doc/mg-tooltip.stories.js} +14 -1
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +20 -0
  28. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +7 -2
  29. package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -7
  30. package/dist/collection/components/molecules/inputs/MgInput.js +5 -15
  31. package/dist/collection/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.js → doc/mg-input-checkbox.stories.js} +0 -0
  32. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +19 -13
  33. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +8 -21
  34. package/dist/collection/components/molecules/inputs/mg-input-date/{mg-input-date.stories.js → doc/mg-input-date.stories.js} +0 -0
  35. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +19 -18
  36. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +19 -18
  37. package/dist/collection/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.js → doc/mg-input-numeric.stories.js} +9 -2
  38. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +20 -19
  39. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +43 -19
  40. package/dist/collection/components/molecules/inputs/mg-input-password/{mg-input-password.stories.js → doc/mg-input-password.stories.js} +10 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +19 -18
  42. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -22
  43. package/dist/collection/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.js → doc/mg-input-radio.stories.js} +0 -0
  44. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +19 -13
  45. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +8 -15
  46. package/dist/collection/components/molecules/inputs/mg-input-select/{mg-input-select.stories.js → doc/mg-input-select.stories.js} +10 -3
  47. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +20 -18
  48. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +24 -31
  49. package/dist/collection/components/molecules/inputs/mg-input-text/{mg-input-text.stories.js → doc/mg-input-text.stories.js} +11 -7
  50. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +51 -28
  51. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +42 -43
  52. package/dist/collection/components/molecules/inputs/mg-input-textarea/{mg-input-textarea.stories.js → doc/mg-input-textarea.stories.js} +10 -4
  53. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +51 -22
  54. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +66 -39
  55. package/dist/collection/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.js → doc/mg-input-toggle.stories.js} +0 -0
  56. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +18 -9
  57. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +10 -4
  58. package/dist/collection/components/molecules/mg-form/{mg-form.stories.js → doc/mg-form.stories.js} +0 -0
  59. package/dist/collection/components/molecules/mg-form/mg-form.css +4 -0
  60. package/dist/collection/components/molecules/mg-form/mg-form.js +5 -3
  61. package/dist/collection/components/molecules/mg-message/{mg-message.stories.js → doc/mg-message.stories.js} +1 -1
  62. package/dist/collection/components/molecules/mg-message/mg-message.js +15 -7
  63. package/dist/collection/components/molecules/mg-modal/{mg-modal.stories.js → doc/mg-modal.stories.js} +0 -0
  64. package/dist/collection/components/molecules/mg-modal/mg-modal.css +5 -7
  65. package/dist/collection/components/molecules/mg-modal/mg-modal.js +12 -5
  66. package/dist/collection/components/molecules/mg-pagination/{mg-pagination.stories.js → doc/mg-pagination.stories.js} +0 -0
  67. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -18
  68. package/dist/collection/components/molecules/mg-panel/{mg-panel.stories.js → doc/mg-panel.stories.js} +9 -1
  69. package/dist/collection/components/molecules/mg-panel/mg-panel.css +13 -4
  70. package/dist/collection/components/molecules/mg-panel/mg-panel.js +119 -18
  71. package/dist/collection/components/molecules/mg-popover/{mg-popover.stories.js → doc/mg-popover.stories.js} +10 -0
  72. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +20 -0
  73. package/dist/collection/components/molecules/mg-popover/mg-popover.js +19 -9
  74. package/dist/collection/components/molecules/mg-tabs/{mg-tabs.stories.js → doc/mg-tabs.stories.js} +12 -5
  75. package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +7 -0
  76. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +3 -0
  77. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +92 -27
  78. package/dist/collection/locales/index.js +33 -4
  79. package/dist/collection/stories/helpers.stories.js +33 -0
  80. package/dist/collection/utils/locale.utils.js +7 -4
  81. package/dist/collection/variables.css +9 -4
  82. package/dist/collection/variables.scss +9 -4
  83. package/dist/components/MgInput.js +6 -23
  84. package/dist/components/index.d.ts +23 -5
  85. package/dist/components/index.js +23 -0
  86. package/dist/components/index2.js +97 -8
  87. package/dist/components/locale.utils.js +7 -5
  88. package/dist/components/mg-badge2.js +16 -4
  89. package/dist/components/mg-button2.js +10 -5
  90. package/dist/components/mg-character-left2.js +4 -27
  91. package/dist/components/mg-form.js +6 -4
  92. package/dist/components/mg-icon2.js +120 -17
  93. package/dist/components/mg-input-checkbox.js +11 -27
  94. package/dist/components/mg-input-date.js +21 -25
  95. package/dist/components/mg-input-numeric.js +28 -26
  96. package/dist/components/mg-input-password.js +18 -28
  97. package/dist/components/mg-input-radio.js +10 -22
  98. package/dist/components/mg-input-select2.js +24 -35
  99. package/dist/components/mg-input-text2.js +38 -26
  100. package/dist/components/mg-input-textarea.js +44 -21
  101. package/dist/components/mg-input-toggle.js +11 -11
  102. package/dist/components/mg-message.js +16 -8
  103. package/dist/components/mg-modal.js +11 -5
  104. package/dist/components/mg-pagination.js +16 -22
  105. package/dist/components/mg-panel.js +51 -17
  106. package/dist/components/mg-popover.js +13 -8
  107. package/dist/components/mg-tabs.js +80 -22
  108. package/dist/components/mg-tag.js +20 -5
  109. package/dist/components/mg-tooltip2.js +1 -1
  110. package/dist/components/popper.js +6 -2
  111. package/dist/esm/{index-9e877561.js → index-bca81100.js} +48 -46
  112. package/dist/esm/{index-c346f52d.js → index-e51ae032.js} +97 -8
  113. package/dist/esm/loader.js +3 -17
  114. package/dist/esm/mg-badge_21.entry.js +516 -291
  115. package/dist/esm/mg-components.js +3 -7
  116. package/dist/esm/mg-modal.entry.js +12 -6
  117. package/dist/esm/mg-popover.entry.js +15 -10
  118. package/dist/esm/{popper-8874fd6c.js → popper-93ecb064.js} +6 -2
  119. package/dist/index.js +1 -1
  120. package/dist/mg-components/mg-components.css +1 -1
  121. package/dist/mg-components/mg-components.esm.js +1 -1
  122. package/dist/mg-components/p-462d648a.entry.js +1 -0
  123. package/dist/mg-components/p-4c66f794.js +1 -0
  124. package/dist/mg-components/p-5126ab10.entry.js +1 -0
  125. package/dist/mg-components/p-766c918b.entry.js +1 -0
  126. package/dist/mg-components/p-780bd52d.js +1 -0
  127. package/dist/mg-components/p-b14a3443.js +2 -0
  128. package/dist/mg-components/variables.css +9 -4
  129. package/dist/mg-components/variables.scss +9 -4
  130. package/dist/types/components/atoms/mg-badge/{mg-badge.stories.d.ts → doc/mg-badge.stories.d.ts} +0 -0
  131. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -1
  132. package/dist/types/components/atoms/mg-button/{mg-button.stories.d.ts → doc/mg-button.stories.d.ts} +0 -0
  133. package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
  134. package/dist/types/components/atoms/mg-character-left/{mg-character-left.stories.d.ts → doc/mg-character-left.stories.d.ts} +0 -0
  135. package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +5 -13
  136. package/dist/types/components/atoms/mg-icon/{mg-icon.stories.d.ts → doc/mg-icon.stories.d.ts} +0 -0
  137. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -3
  138. package/dist/types/components/atoms/mg-input-title/{mg-input-title.stories.d.ts → doc/mg-input-title.stories.d.ts} +0 -0
  139. package/dist/types/components/atoms/mg-tag/{mg-tag.stories.d.ts → doc/mg-tag.stories.d.ts} +0 -0
  140. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +8 -1
  141. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +29 -0
  142. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +8 -0
  143. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +2 -1
  144. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +0 -6
  145. package/dist/types/components/molecules/inputs/MgInput.d.ts +2 -4
  146. package/dist/types/components/molecules/inputs/mg-input-checkbox/{mg-input-checkbox.stories.d.ts → doc/mg-input-checkbox.stories.d.ts} +0 -0
  147. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -2
  148. package/dist/types/components/molecules/inputs/mg-input-date/{mg-input-date.stories.d.ts → doc/mg-input-date.stories.d.ts} +0 -0
  149. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +7 -1
  150. package/dist/types/components/molecules/inputs/mg-input-numeric/{mg-input-numeric.stories.d.ts → doc/mg-input-numeric.stories.d.ts} +6 -0
  151. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +8 -2
  152. package/dist/types/components/molecules/inputs/mg-input-password/{mg-input-password.stories.d.ts → doc/mg-input-password.stories.d.ts} +8 -0
  153. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +7 -2
  154. package/dist/types/components/molecules/inputs/mg-input-radio/{mg-input-radio.stories.d.ts → doc/mg-input-radio.stories.d.ts} +0 -0
  155. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
  156. package/dist/types/components/molecules/inputs/mg-input-select/{mg-input-select.stories.d.ts → doc/mg-input-select.stories.d.ts} +11 -5
  157. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +7 -2
  158. package/dist/types/components/molecules/inputs/mg-input-text/{mg-input-text.stories.d.ts → doc/mg-input-text.stories.d.ts} +8 -0
  159. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +7 -7
  160. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +19 -0
  161. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +15 -7
  162. package/dist/types/components/molecules/inputs/mg-input-toggle/{mg-input-toggle.stories.d.ts → doc/mg-input-toggle.stories.d.ts} +0 -0
  163. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -0
  164. package/dist/types/components/molecules/mg-form/{mg-form.stories.d.ts → doc/mg-form.stories.d.ts} +0 -0
  165. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -0
  166. package/dist/types/components/molecules/mg-message/{mg-message.stories.d.ts → doc/mg-message.stories.d.ts} +0 -0
  167. package/dist/types/components/molecules/mg-message/mg-message.d.ts +2 -0
  168. package/dist/types/components/molecules/mg-modal/{mg-modal.stories.d.ts → doc/mg-modal.stories.d.ts} +0 -0
  169. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
  170. package/dist/types/components/molecules/mg-pagination/{mg-pagination.stories.d.ts → doc/mg-pagination.stories.d.ts} +0 -0
  171. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +8 -0
  172. package/dist/types/components/molecules/{inputs/mg-input-textarea/mg-input-textarea.stories.d.ts → mg-panel/doc/mg-panel.stories.d.ts} +1 -1
  173. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +29 -0
  174. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +25 -0
  175. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +8 -0
  176. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +9 -1
  177. package/dist/types/components/molecules/mg-tabs/{mg-tabs.stories.d.ts → doc/mg-tabs.stories.d.ts} +5 -0
  178. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +7 -1
  179. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +49 -0
  180. package/dist/types/components.d.ts +181 -151
  181. package/dist/types/locales/index.d.ts +109 -46
  182. package/dist/types/stories/{buttons.stories.d.ts → helpers.stories.d.ts} +1 -1
  183. package/dist/types/utils/locale.utils.d.ts +7 -3
  184. package/loader/index.js +1 -1
  185. package/package.json +14 -14
  186. package/readme.md +6 -35
  187. package/dist/cjs/css-shim-629916b0.js +0 -6
  188. package/dist/cjs/shadow-css-546083ef.js +0 -390
  189. package/dist/collection/stories/buttons.stories.js +0 -43
  190. package/dist/collection/stories/messages.stories.js +0 -44
  191. package/dist/collection/stories/tags.stories.js +0 -13
  192. package/dist/esm/css-shim-0993aa3b.js +0 -4
  193. package/dist/esm/shadow-css-dfa0587f.js +0 -388
  194. package/dist/esm-es5/css-shim-0993aa3b.js +0 -1
  195. package/dist/esm-es5/index-9e877561.js +0 -1
  196. package/dist/esm-es5/index-c346f52d.js +0 -1
  197. package/dist/esm-es5/index.js +0 -0
  198. package/dist/esm-es5/loader.js +0 -1
  199. package/dist/esm-es5/mg-badge_21.entry.js +0 -2
  200. package/dist/esm-es5/mg-components.js +0 -1
  201. package/dist/esm-es5/mg-modal.entry.js +0 -1
  202. package/dist/esm-es5/mg-popover.entry.js +0 -1
  203. package/dist/esm-es5/popper-8874fd6c.js +0 -1
  204. package/dist/esm-es5/shadow-css-dfa0587f.js +0 -12
  205. package/dist/mg-components/mg-components.js +0 -132
  206. package/dist/mg-components/p-3633e9e1.system.entry.js +0 -2
  207. package/dist/mg-components/p-3c14153d.js +0 -1
  208. package/dist/mg-components/p-50ea2036.system.js +0 -1
  209. package/dist/mg-components/p-55a22b35.system.js +0 -1
  210. package/dist/mg-components/p-5e796581.js +0 -12
  211. package/dist/mg-components/p-656b5efb.system.js +0 -1
  212. package/dist/mg-components/p-68d6f104.js +0 -1
  213. package/dist/mg-components/p-6d49ed95.js +0 -1
  214. package/dist/mg-components/p-70177194.entry.js +0 -1
  215. package/dist/mg-components/p-8b2d8a2a.system.js +0 -13
  216. package/dist/mg-components/p-8cb61c3f.system.js +0 -1
  217. package/dist/mg-components/p-ace173b1.js +0 -1
  218. package/dist/mg-components/p-c46fbd54.entry.js +0 -1
  219. package/dist/mg-components/p-c90cc4bf.system.js +0 -1
  220. package/dist/mg-components/p-cd2a4acc.system.entry.js +0 -1
  221. package/dist/mg-components/p-de1164fa.system.entry.js +0 -1
  222. package/dist/mg-components/p-dfe25da3.entry.js +0 -1
  223. package/dist/mg-components/p-e4a502b5.system.js +0 -1
  224. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.stories.d.ts +0 -11
  225. package/dist/types/components/molecules/mg-panel/mg-panel.stories.d.ts +0 -6
  226. package/dist/types/components/molecules/mg-popover/mg-popover.stories.d.ts +0 -12
  227. package/dist/types/stories/messages.stories.d.ts +0 -13
  228. package/dist/types/stories/tags.stories.d.ts +0 -5
@@ -9,25 +9,34 @@
9
9
  flex-wrap: wrap;
10
10
  justify-content: space-between;
11
11
  padding: 0 1rem 0 0.3rem;
12
- align-items: center;
12
+ align-items: flex-start;
13
13
  }
14
14
 
15
15
  .mg-panel__header-left,
16
16
  .mg-panel__header-right {
17
17
  display: flex;
18
- flex-grow: 1;
19
18
  margin: 0.3rem 0;
20
19
  }
21
20
 
21
+ .mg-panel__header-left--full {
22
+ flex: 1 1 auto;
23
+ }
24
+
25
+ .mg-panel__header-right {
26
+ flex: 1 auto;
27
+ }
28
+
22
29
  .mg-panel__header-left mg-input-text {
23
30
  flex-grow: 1;
24
31
  }
25
32
 
26
- .mg-panel__collapse-button {
33
+ .mg-panel__header-left mg-button:not([slot=append-input]) {
34
+ margin: 0 0.3rem 0 0;
35
+ }
36
+ .mg-panel__header-left mg-button:not([slot=append-input]) > *:first-of-type {
27
37
  font-family: var(--font-family-heading);
28
38
  font-size: 1.4rem;
29
39
  font-weight: 500;
30
- margin: 0 0.3rem 0 0;
31
40
  }
32
41
 
33
42
  .mg-panel__content {
@@ -1,11 +1,8 @@
1
- import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
1
+ import { Component, Element, h, Prop, State, Watch, Event } from '@stencil/core';
2
2
  import { createID, ClassList } from '../../../utils/components.utils';
3
- import { messages } from '../../../locales';
3
+ import { initLocales } from '../../../locales';
4
4
  export class MgPanel {
5
5
  constructor() {
6
- /**************
7
- * Decorators *
8
- **************/
9
6
  /**
10
7
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
11
8
  * If not set, it will be created.
@@ -15,6 +12,10 @@ export class MgPanel {
15
12
  * Panel is opened
16
13
  */
17
14
  this.expanded = false;
15
+ /**
16
+ * Disable possibility to toggle expand
17
+ */
18
+ this.expandToggleDisabled = false;
18
19
  /**
19
20
  * Panel title is editabled
20
21
  */
@@ -47,7 +48,9 @@ export class MgPanel {
47
48
  * @returns {void}
48
49
  */
49
50
  this.handleCollapseButton = () => {
50
- this.expanded = !this.expanded;
51
+ if (!this.expandToggleDisabled) {
52
+ this.expanded = !this.expanded;
53
+ }
51
54
  };
52
55
  /**
53
56
  * Edit button click handler
@@ -81,13 +84,12 @@ export class MgPanel {
81
84
  * @returns {void}
82
85
  */
83
86
  this.handleValidateEditButton = () => {
84
- if (this.updatedPanelTitle !== undefined)
85
- this.panelTitle = this.updatedPanelTitle;
86
- this.toggleIsEditing();
87
+ if (this.editInputElement.valid) {
88
+ if (this.updatedPanelTitle !== undefined)
89
+ this.panelTitle = this.updatedPanelTitle;
90
+ this.toggleIsEditing();
91
+ }
87
92
  };
88
- /*************
89
- * Lifecycle *
90
- *************/
91
93
  /**
92
94
  * Header left conditional render
93
95
  *
@@ -95,23 +97,23 @@ export class MgPanel {
95
97
  * @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
96
98
  */
97
99
  this.headerLeft = () => {
98
- const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", class: "mg-panel__collapse-button", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content` },
100
+ const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled },
99
101
  h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }),
100
102
  !this.isEditing && this.panelTitle));
101
103
  if (this.titleEditable && !this.isEditing) {
102
104
  return [
103
105
  collapseButton(),
104
- h("mg-button", { "is-icon": true, variant: "secondary", label: messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` },
106
+ h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` },
105
107
  h("mg-icon", { icon: "pen" })),
106
108
  ];
107
109
  }
108
110
  if (this.titleEditable && this.isEditing) {
109
111
  return [
110
112
  collapseButton(),
111
- h("mg-input-text", { label: messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) },
112
- h("mg-button", { slot: "append-input", label: messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` },
113
+ h("mg-input-text", { label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) },
114
+ h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` },
113
115
  h("mg-icon", { icon: "cross" })),
114
- h("mg-button", { slot: "append-input", label: messages.general.validate, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` },
116
+ h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` },
115
117
  h("mg-icon", { icon: "check" }))),
116
118
  ];
117
119
  }
@@ -121,6 +123,31 @@ export class MgPanel {
121
123
  handelTileChange(newValue) {
122
124
  this.titleChange.emit(newValue);
123
125
  }
126
+ validatetitlePattern(newValue) {
127
+ if (newValue && !this.titleEditable) {
128
+ throw new Error('<mg-panel> prop "titleEditable" must be set to `true`.');
129
+ }
130
+ if (newValue && this.titlePatternErrorMessage === undefined) {
131
+ throw new Error('<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".');
132
+ }
133
+ }
134
+ handleExpanded(newValue) {
135
+ this.expandedChange.emit(newValue);
136
+ }
137
+ /*************
138
+ * Lifecycle *
139
+ *************/
140
+ /**
141
+ * Check if props are well configured on init
142
+ *
143
+ * @returns {void}
144
+ */
145
+ componentWillLoad() {
146
+ // Get locales
147
+ this.messages = initLocales(this.element).messages;
148
+ // Validate
149
+ this.validatetitlePattern(this.titlePattern);
150
+ }
124
151
  /**
125
152
  * Edit DOM after render
126
153
  *
@@ -140,7 +167,7 @@ export class MgPanel {
140
167
  render() {
141
168
  return (h("section", { class: this.classList.join(), id: this.identifier },
142
169
  h("header", { class: "mg-panel__header", id: `${this.identifier}-header` },
143
- h("div", { class: "mg-panel__header-left" }, this.headerLeft()),
170
+ h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()),
144
171
  h("div", { class: "mg-panel__header-right" },
145
172
  h("slot", { name: "header-right" }))),
146
173
  h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded },
@@ -190,6 +217,40 @@ export class MgPanel {
190
217
  "attribute": "panel-title",
191
218
  "reflect": false
192
219
  },
220
+ "titlePattern": {
221
+ "type": "string",
222
+ "mutable": true,
223
+ "complexType": {
224
+ "original": "string",
225
+ "resolved": "string",
226
+ "references": {}
227
+ },
228
+ "required": false,
229
+ "optional": false,
230
+ "docs": {
231
+ "tags": [],
232
+ "text": "Panel title pattern"
233
+ },
234
+ "attribute": "title-pattern",
235
+ "reflect": false
236
+ },
237
+ "titlePatternErrorMessage": {
238
+ "type": "string",
239
+ "mutable": true,
240
+ "complexType": {
241
+ "original": "string",
242
+ "resolved": "string",
243
+ "references": {}
244
+ },
245
+ "required": false,
246
+ "optional": false,
247
+ "docs": {
248
+ "tags": [],
249
+ "text": "Panel title pattern error message"
250
+ },
251
+ "attribute": "title-pattern-error-message",
252
+ "reflect": false
253
+ },
193
254
  "expanded": {
194
255
  "type": "boolean",
195
256
  "mutable": true,
@@ -208,6 +269,24 @@ export class MgPanel {
208
269
  "reflect": false,
209
270
  "defaultValue": "false"
210
271
  },
272
+ "expandToggleDisabled": {
273
+ "type": "boolean",
274
+ "mutable": true,
275
+ "complexType": {
276
+ "original": "boolean",
277
+ "resolved": "boolean",
278
+ "references": {}
279
+ },
280
+ "required": false,
281
+ "optional": false,
282
+ "docs": {
283
+ "tags": [],
284
+ "text": "Disable possibility to toggle expand"
285
+ },
286
+ "attribute": "expand-toggle-disabled",
287
+ "reflect": false,
288
+ "defaultValue": "false"
289
+ },
211
290
  "titleEditable": {
212
291
  "type": "boolean",
213
292
  "mutable": false,
@@ -247,9 +326,31 @@ export class MgPanel {
247
326
  "resolved": "string",
248
327
  "references": {}
249
328
  }
329
+ }, {
330
+ "method": "expandedChange",
331
+ "name": "expanded-change",
332
+ "bubbles": true,
333
+ "cancelable": true,
334
+ "composed": true,
335
+ "docs": {
336
+ "tags": [],
337
+ "text": "Emmited event when expanded change"
338
+ },
339
+ "complexType": {
340
+ "original": "boolean",
341
+ "resolved": "boolean",
342
+ "references": {}
343
+ }
250
344
  }]; }
345
+ static get elementRef() { return "element"; }
251
346
  static get watchers() { return [{
252
347
  "propName": "panelTitle",
253
348
  "methodName": "handelTileChange"
349
+ }, {
350
+ "propName": "titlePattern",
351
+ "methodName": "validatetitlePattern"
352
+ }, {
353
+ "propName": "expanded",
354
+ "methodName": "handleExpanded"
254
355
  }]; }
255
356
  }
@@ -1,4 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
+ import { placements } from '../mg-popover.conf';
2
3
  export default {
3
4
  component: 'mg-popover',
4
5
  title: 'Molecules/mg-popover',
@@ -6,6 +7,15 @@ export default {
6
7
  layout: 'centered',
7
8
  docs: { iframeHeight: 600 },
8
9
  },
10
+ argTypes: {
11
+ placement: {
12
+ options: placements,
13
+ control: { type: 'select' },
14
+ table: {
15
+ defaultValue: { summary: placements[0] },
16
+ },
17
+ },
18
+ },
9
19
  };
10
20
  /**
11
21
  * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * List of all possibles placements
3
+ */
4
+ export const placements = [
5
+ 'auto',
6
+ 'auto-start',
7
+ 'auto-end',
8
+ 'top',
9
+ 'top-start',
10
+ 'top-end',
11
+ 'bottom',
12
+ 'bottom-start',
13
+ 'bottom-end',
14
+ 'right',
15
+ 'right-start',
16
+ 'right-end',
17
+ 'left',
18
+ 'left-start',
19
+ 'left-end',
20
+ ];
@@ -1,7 +1,7 @@
1
1
  import { Component, Element, Host, h, Prop, Watch } from '@stencil/core';
2
2
  import { createID } from '../../../utils/components.utils';
3
3
  import { createPopper } from '@popperjs/core';
4
- import { messages } from '../../../locales';
4
+ import { initLocales } from '../../../locales';
5
5
  export class MgPopover {
6
6
  constructor() {
7
7
  this.closeButtonId = '';
@@ -32,8 +32,6 @@ export class MgPopover {
32
32
  * @param {MouseEvent} event mouse event
33
33
  * @returns {void}
34
34
  */
35
- // Unable to trigger document events in unit tests: https://gitlab.mgdis.fr/core/core-ui/mg-components/-/issues/57
36
- /* istanbul ignore next */
37
35
  this.clickOutside = (event) => {
38
36
  var _a;
39
37
  if (!this.disabled && ((_a = event.target.closest(`#${this.identifier}`)) === null || _a === void 0 ? void 0 : _a.parentElement.nodeName) !== 'MG-POPOVER') {
@@ -55,8 +53,6 @@ export class MgPopover {
55
53
  // hide when click outside
56
54
  // setTimeout is used to prevent event to trigger after creation
57
55
  setTimeout(() => {
58
- // Unable to trigger document events in unit tests: https://gitlab.mgdis.fr/core/core-ui/mg-components/-/issues/57
59
- /* istanbul ignore next */
60
56
  document.addEventListener('click', this.clickOutside, false);
61
57
  }, 0);
62
58
  };
@@ -70,7 +66,7 @@ export class MgPopover {
70
66
  this.popover.removeAttribute('data-show');
71
67
  // Disable the event listeners
72
68
  this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
73
- // Remove even listener
69
+ // Remove event listener
74
70
  document.removeEventListener('click', this.clickOutside, false);
75
71
  };
76
72
  /**
@@ -93,6 +89,15 @@ export class MgPopover {
93
89
  /*************
94
90
  * Lifecycle *
95
91
  *************/
92
+ /**
93
+ * Check if component props are well configured on init
94
+ *
95
+ * @returns {void} timeout
96
+ */
97
+ componentWillLoad() {
98
+ // Get locales
99
+ this.messages = initLocales(this.element).messages;
100
+ }
96
101
  /**
97
102
  * Check if component props are well configured on init
98
103
  *
@@ -149,7 +154,7 @@ export class MgPopover {
149
154
  return (h(Host, null,
150
155
  h("slot", null),
151
156
  h("div", { id: this.identifier, class: "mg-popover" },
152
- !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: messages.general.close, onClick: this.handleCloseButton },
157
+ !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton },
153
158
  h("mg-icon", { icon: "cross" }))),
154
159
  h("div", { class: "mg-popover__title" },
155
160
  h("slot", { name: "title" })),
@@ -187,9 +192,14 @@ export class MgPopover {
187
192
  "type": "string",
188
193
  "mutable": false,
189
194
  "complexType": {
190
- "original": "| 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end'",
195
+ "original": "Placement",
191
196
  "resolved": "\"auto\" | \"auto-end\" | \"auto-start\" | \"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
192
- "references": {}
197
+ "references": {
198
+ "Placement": {
199
+ "location": "import",
200
+ "path": "./mg-popover.conf"
201
+ }
202
+ }
193
203
  },
194
204
  "required": false,
195
205
  "optional": false,
@@ -1,5 +1,5 @@
1
1
  import { h } from '@stencil/core';
2
- import { sizes } from './mg-tabs.conf';
2
+ import { sizes, Status } from '../mg-tabs.conf';
3
3
  export default {
4
4
  component: 'mg-tabs',
5
5
  title: 'Molecules/mg-tabs',
@@ -9,6 +9,7 @@ export default {
9
9
  control: { type: 'select' },
10
10
  },
11
11
  },
12
+ parameters: { actions: { handles: ['active-tab-change'] } },
12
13
  };
13
14
  /**
14
15
  * 1. camelCase arguments must be written in the template, for exemple labelOnTop must be placed in the template as label-on-top={args.labelOnTop}
@@ -21,17 +22,18 @@ const Template = args => {
21
22
  return (h("mg-tabs", Object.assign({}, args, { "active-tab": activeTab }),
22
23
  h("div", { slot: "tab_content-1" }, "Content 1"),
23
24
  h("div", { slot: "tab_content-2" }, "Content 2"),
24
- h("div", { slot: "tab_content-3" }, "Content 3")));
25
+ h("div", { slot: "tab_content-3" }, "Content 3"),
26
+ h("div", { slot: "tab_content-4" }, "Content 4")));
25
27
  };
26
28
  export const MgTabs = Template.bind({});
27
29
  MgTabs.args = {
28
- items: ['Tab 1', 'Tab 2', 'Tab 3'],
30
+ items: ['Tab 1', 'Tab 2', 'Tab 3', 'Tab 4'],
29
31
  label: 'Short tabs description. Needed for accessibility',
30
32
  activeTab: undefined,
31
33
  size: sizes[0], // regular
32
34
  };
33
35
  export const MgTabsItems = Template.bind({});
34
- MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { items: [
36
+ MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { activeTab: 3, items: [
35
37
  {
36
38
  label: 'Tab 1',
37
39
  icon: 'check',
@@ -40,10 +42,15 @@ MgTabsItems.args = Object.assign(Object.assign({}, MgTabs.args), { items: [
40
42
  {
41
43
  label: 'Tab 2',
42
44
  badge: { value: 5, label: 'messages' },
43
- disabled: true,
45
+ status: Status.DISABLED,
44
46
  },
45
47
  {
46
48
  label: 'Tab 3',
47
49
  icon: 'cross',
48
50
  },
51
+ {
52
+ label: 'Tab 4',
53
+ icon: 'trash',
54
+ status: Status.HIDDEN,
55
+ },
49
56
  ] });
@@ -1,3 +1,10 @@
1
+ export var Status;
2
+ (function (Status) {
3
+ Status["VISIBLE"] = "visible";
4
+ Status["HIDDEN"] = "hidden";
5
+ Status["DISABLED"] = "disabled";
6
+ Status["ACTIVE"] = "active";
7
+ })(Status || (Status = {}));
1
8
  /**
2
9
  * List of all possibles sizes
3
10
  */
@@ -35,6 +35,9 @@
35
35
  border-bottom-color: hsl(var(--color-info));
36
36
  font-weight: 700;
37
37
  }
38
+ .mg-tabs__navigation-button.mg-tabs__navigation-button--hidden {
39
+ display: none;
40
+ }
38
41
 
39
42
  .mg-tabs__content-container:focus-visible {
40
43
  outline: none;
@@ -1,6 +1,6 @@
1
- import { Component, h, Host, Prop, State, Element, Watch } from '@stencil/core';
1
+ import { Component, Event, h, Host, Prop, State, Element, Watch } from '@stencil/core';
2
2
  import { createID, ClassList, allItemsAreString } from '../../../utils/components.utils';
3
- import { sizes } from './mg-tabs.conf';
3
+ import { sizes, Status } from './mg-tabs.conf';
4
4
  /**
5
5
  * type TabItem validation function
6
6
  *
@@ -10,6 +10,12 @@ import { sizes } from './mg-tabs.conf';
10
10
  const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
11
11
  export class MgTabs {
12
12
  constructor() {
13
+ /************
14
+ * Internal *
15
+ ************/
16
+ this.tabPanel = 'panel';
17
+ this.startIndex = 1;
18
+ this.buttonTabBaseClass = 'mg-tabs__navigation-button';
13
19
  /**
14
20
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
15
21
  * If not set, it will be created.
@@ -32,6 +38,46 @@ export class MgTabs {
32
38
  * Component classes
33
39
  */
34
40
  this.classList = new ClassList(['mg-tabs']);
41
+ /**
42
+ * Method to set active tab
43
+ *
44
+ * @param {number} tabKey item tab key to set to ACTIVE status
45
+ * @returns {void}
46
+ */
47
+ this.setActiveTab = (tabKey) => {
48
+ // reset active tabs
49
+ this.tabs.forEach(tab => {
50
+ if (this.tabHasGivenStatus(tab, Status.ACTIVE))
51
+ tab.status = Status.VISIBLE;
52
+ });
53
+ // set active tab from given tab key
54
+ this.tabs[tabKey - this.startIndex].status = Status.ACTIVE;
55
+ // emit change active tab key event
56
+ this.activeTabChange.emit(tabKey);
57
+ };
58
+ /**
59
+ * Method to know if given tab has the given status
60
+ *
61
+ * @param {TabItem} tab item tab key to set to ACTIVE status
62
+ * @param {Status} status status to valide
63
+ * @returns {boolean} status comparaison
64
+ */
65
+ this.tabHasGivenStatus = (tab, status) => tab.status === status;
66
+ /**
67
+ * Method to get element id from index
68
+ *
69
+ * @param {string} element to get id
70
+ * @param {number} index to generate id
71
+ * @returns {string} generated element id
72
+ */
73
+ this.getElementId = (element, index) => `${element}-${this.getTabIndex(index)}`;
74
+ /**
75
+ * Method to get tab index
76
+ *
77
+ * @param {number} index to get
78
+ * @returns {number} index
79
+ */
80
+ this.getTabIndex = (index) => index + this.startIndex;
35
81
  /**
36
82
  * Handle click events on tabs
37
83
  *
@@ -41,6 +87,14 @@ export class MgTabs {
41
87
  const tabId = event.currentTarget.getAttribute('data-index');
42
88
  this.activeTab = Number(tabId);
43
89
  };
90
+ /**
91
+ * get navigation button class from given status
92
+ *
93
+ * @param {Status} status button tab status
94
+ * @param {boolean} isSelector set if we need a CSS selector with the dot '.' at the begin. default value = false.
95
+ * @returns {string} button class/selector variant
96
+ */
97
+ this.getNavigationButtonClass = (status, isSelector = false) => `${isSelector ? '.' : ''}${this.buttonTabBaseClass}--${status}`;
44
98
  /**
45
99
  * Handle keyboard event on tabs
46
100
  *
@@ -51,16 +105,14 @@ export class MgTabs {
51
105
  let tabId = Number(event.target.getAttribute('data-index'));
52
106
  const parent = event.target.parentElement;
53
107
  // change selected id from key code
54
- // /* IE FIX */ delete 'Right'
55
- if (['ArrowRight', 'Right'].includes(event.key)) {
108
+ if (event.key === 'ArrowRight') {
56
109
  tabId++;
57
- // /* IE FIX */ delete 'Left'
58
110
  }
59
- else if (['ArrowLeft', 'Left'].includes(event.key)) {
111
+ else if (event.key === 'ArrowLeft') {
60
112
  tabId--;
61
113
  }
62
- // get selected tab
63
- const selectedTab = parent.querySelector(`[data-index="${tabId}"]`);
114
+ // get selected tab if NOT hidden, disabled
115
+ const selectedTab = parent.querySelector(`[data-index="${tabId}"]:not(${[this.getNavigationButtonClass(Status.HIDDEN, true), this.getNavigationButtonClass(Status.DISABLED, true)].join()})`);
64
116
  // apply selected tab if exist
65
117
  if (selectedTab !== null) {
66
118
  selectedTab.focus();
@@ -86,7 +138,7 @@ export class MgTabs {
86
138
  validateItems(newValue) {
87
139
  // String array
88
140
  if (allItemsAreString(newValue)) {
89
- this.tabs = newValue.map(item => ({ label: item, disabled: false }));
141
+ this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
90
142
  }
91
143
  // Object array
92
144
  else if (newValue && newValue.every(item => isTabItem(item))) {
@@ -97,9 +149,12 @@ export class MgTabs {
97
149
  }
98
150
  }
99
151
  validateActiveTab(newValue) {
100
- if (Number(newValue) < 1 || Number(newValue) > this.tabs.length) {
152
+ if (newValue < 1 || newValue > this.tabs.length) {
101
153
  throw new Error('<mg-tabs> prop "activeTab" must be between 1 and tabs length.');
102
154
  }
155
+ else {
156
+ this.setActiveTab(newValue);
157
+ }
103
158
  }
104
159
  /*************
105
160
  * Lifecycle *
@@ -124,25 +179,19 @@ export class MgTabs {
124
179
  render() {
125
180
  return (h(Host, null,
126
181
  h("div", { class: this.classList.join() },
127
- h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => {
128
- const tabIndex = index + 1;
129
- return (h("button", { role: "tab", id: `${this.identifier}-${tabIndex}`, class: {
130
- 'mg-tabs__navigation-button': true,
131
- 'mg-tabs__navigation-button--active': tabIndex === this.activeTab,
132
- 'mg-tabs__navigation-button--disabled': tab.disabled,
133
- }, tabindex: tabIndex === this.activeTab ? 0 : -1, "aria-selected": (tabIndex === this.activeTab).toString(), "aria-controls": `pannel-${tabIndex}`, onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": tabIndex, disabled: tab.disabled },
134
- tab.icon !== undefined && h("mg-icon", { icon: tab.icon }),
135
- tab.label,
136
- tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label })));
137
- })),
138
- this.tabs.map((_tab, index) => {
139
- const tabIndex = index + 1;
140
- return (h("article", { role: "tabpanel", id: `pannel-${tabIndex}`, hidden: tabIndex !== this.activeTab, "aria-labelledby": `${this.identifier}-${this.activeTab}`, tabindex: tabIndex === this.activeTab ? 0 : -1, class: "mg-tabs__content-container" },
141
- h("slot", { name: `tab_content-${tabIndex}` })));
142
- }))));
182
+ h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
183
+ [`${this.buttonTabBaseClass}`]: true,
184
+ [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasGivenStatus(tab, Status.ACTIVE),
185
+ [`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasGivenStatus(tab, Status.DISABLED),
186
+ [`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasGivenStatus(tab, Status.HIDDEN),
187
+ }, tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasGivenStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabIndex(index), disabled: this.tabHasGivenStatus(tab, Status.DISABLED) },
188
+ tab.icon !== undefined && h("mg-icon", { icon: tab.icon }),
189
+ tab.label,
190
+ tab.badge !== undefined && h("mg-badge", { variant: "info", value: tab.badge.value, label: tab.badge.label }))))),
191
+ this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasGivenStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasGivenStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" },
192
+ h("slot", { name: this.getElementId('tab_content', index) })))))));
143
193
  }
144
194
  static get is() { return "mg-tabs"; }
145
- static get encapsulation() { return "scoped"; }
146
195
  static get originalStyleUrls() { return {
147
196
  "$": ["mg-tabs.scss"]
148
197
  }; }
@@ -246,6 +295,22 @@ export class MgTabs {
246
295
  "tabs": {},
247
296
  "classList": {}
248
297
  }; }
298
+ static get events() { return [{
299
+ "method": "activeTabChange",
300
+ "name": "active-tab-change",
301
+ "bubbles": true,
302
+ "cancelable": true,
303
+ "composed": true,
304
+ "docs": {
305
+ "tags": [],
306
+ "text": "Emited event when active tab change"
307
+ },
308
+ "complexType": {
309
+ "original": "number",
310
+ "resolved": "number",
311
+ "references": {}
312
+ }
313
+ }]; }
249
314
  static get elementRef() { return "element"; }
250
315
  static get watchers() { return [{
251
316
  "propName": "size",