@mgdis/mg-components 5.4.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/cjs/{index-94497267.js → index-4dcc1812.js} +11 -1
  2. package/dist/cjs/loader.cjs.js +3 -3
  3. package/dist/cjs/{mg-badge_29.cjs.entry.js → mg-badge_30.cjs.entry.js} +1112 -859
  4. package/dist/cjs/mg-components.cjs.js +3 -3
  5. package/dist/collection/collection-manifest.json +5 -4
  6. package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -7
  7. package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
  8. package/dist/collection/components/atoms/mg-badge/mg-badge.css +13 -0
  9. package/dist/collection/components/atoms/mg-badge/mg-badge.js +7 -10
  10. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -7
  11. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
  12. package/dist/collection/components/atoms/mg-button/mg-button.css +15 -1
  13. package/dist/collection/components/atoms/mg-button/mg-button.js +12 -29
  14. package/dist/collection/components/atoms/mg-card/mg-card.css +17 -5
  15. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +2 -3
  16. package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -6
  17. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +13 -3
  18. package/dist/collection/components/atoms/mg-icon/mg-icon.js +5 -12
  19. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +4 -8
  20. package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +1 -9
  21. package/dist/collection/components/atoms/mg-tag/mg-tag.css +58 -0
  22. package/dist/collection/components/atoms/mg-tag/mg-tag.js +61 -16
  23. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +2 -0
  24. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -22
  25. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +17 -33
  26. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +3 -3
  27. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +21 -26
  28. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +3 -3
  29. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +24 -47
  30. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +3 -3
  31. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -29
  32. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +18 -33
  33. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +3 -3
  34. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +30 -36
  35. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +3 -3
  36. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +23 -41
  37. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +3 -3
  38. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +23 -45
  39. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -33
  40. package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +43 -11
  41. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +17 -0
  42. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +27 -0
  43. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +145 -25
  44. package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +7 -5
  45. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +0 -4
  46. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +51 -21
  47. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +129 -92
  48. package/dist/collection/components/molecules/mg-details/mg-details.js +4 -8
  49. package/dist/collection/components/molecules/mg-form/mg-form.js +8 -22
  50. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +2 -2
  51. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +4 -9
  52. package/dist/collection/components/molecules/mg-message/mg-message.css +20 -19
  53. package/dist/collection/components/molecules/mg-message/mg-message.js +55 -33
  54. package/dist/collection/components/molecules/mg-modal/mg-modal.css +20 -8
  55. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -26
  56. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -13
  57. package/dist/collection/components/molecules/mg-panel/mg-panel.css +17 -5
  58. package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -22
  59. package/dist/collection/components/molecules/mg-popover/mg-popover.css +82 -20
  60. package/dist/collection/components/molecules/mg-popover/mg-popover.js +54 -26
  61. package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +24 -0
  62. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js +1 -0
  63. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +28 -0
  64. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +108 -0
  65. package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +5 -3
  66. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +11 -7
  67. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +109 -75
  68. package/dist/collection/locales/en/messages.json +7 -0
  69. package/dist/collection/locales/fr/messages.json +7 -0
  70. package/dist/collection/locales/index.js +2 -25
  71. package/dist/collection/styles/a11y.scss +32 -0
  72. package/dist/collection/styles/components.scss +3 -0
  73. package/dist/collection/styles/fonts.scss +21 -0
  74. package/dist/collection/styles/form.scss +3 -0
  75. package/dist/collection/styles/global.scss +87 -0
  76. package/dist/collection/styles/layout.scss +29 -0
  77. package/dist/collection/styles/main.scss +23 -0
  78. package/dist/collection/styles/navigation-button.scss +76 -0
  79. package/dist/collection/styles/reset-mg-card-slotted-variables.scss +9 -0
  80. package/dist/collection/styles/typography.scss +75 -0
  81. package/dist/collection/styles/utilities.scss +21 -0
  82. package/dist/collection/utils/behaviors.utils.js +169 -0
  83. package/dist/collection/utils/components.utils.js +50 -0
  84. package/dist/collection/utils/locale.utils.js +22 -0
  85. package/dist/collection/utils/unit.test.utils.js +37 -32
  86. package/dist/collection/variables.css +9 -9
  87. package/dist/components/components.utils.js +51 -1
  88. package/dist/components/index.d.ts +1 -0
  89. package/dist/components/index.js +1 -0
  90. package/dist/components/index2.js +73 -18
  91. package/dist/components/mg-badge2.js +8 -11
  92. package/dist/components/mg-button2.js +13 -30
  93. package/dist/components/mg-card.js +1 -37
  94. package/dist/components/mg-card2.js +39 -0
  95. package/dist/components/mg-character-left2.js +2 -3
  96. package/dist/components/mg-details.js +4 -8
  97. package/dist/components/mg-divider.js +0 -6
  98. package/dist/components/mg-form.js +8 -22
  99. package/dist/components/mg-icon2.js +18 -15
  100. package/dist/components/mg-illustrated-message.js +5 -10
  101. package/dist/components/mg-input-checkbox.js +17 -33
  102. package/dist/components/mg-input-date.js +23 -29
  103. package/dist/components/mg-input-numeric.js +26 -50
  104. package/dist/components/mg-input-password.js +18 -30
  105. package/dist/components/mg-input-radio.js +18 -33
  106. package/dist/components/mg-input-select2.js +32 -38
  107. package/dist/components/mg-input-text2.js +24 -42
  108. package/dist/components/mg-input-textarea.js +24 -46
  109. package/dist/components/mg-input-title2.js +4 -8
  110. package/dist/components/mg-input-toggle.js +16 -33
  111. package/dist/components/mg-menu-item.js +1 -264
  112. package/dist/components/mg-menu-item2.js +517 -0
  113. package/dist/components/mg-menu.js +142 -28
  114. package/dist/components/mg-message.js +64 -36
  115. package/dist/components/mg-modal.js +18 -30
  116. package/dist/components/mg-pagination.js +4 -13
  117. package/dist/components/mg-panel.js +20 -25
  118. package/dist/components/mg-popover.js +1 -200
  119. package/dist/components/mg-popover2.js +212 -0
  120. package/dist/components/mg-skip-links.d.ts +11 -0
  121. package/dist/components/mg-skip-links.js +80 -0
  122. package/dist/components/mg-tabs.js +108 -73
  123. package/dist/components/mg-tag.js +35 -13
  124. package/dist/components/mg-tooltip2.js +10 -23
  125. package/dist/esm/{index-aad0184c.js → index-dc9a2348.js} +11 -1
  126. package/dist/esm/loader.js +3 -3
  127. package/dist/esm/{mg-badge_29.entry.js → mg-badge_30.entry.js} +1112 -860
  128. package/dist/esm/mg-components.js +3 -3
  129. package/dist/esm/polyfills/core-js.js +0 -0
  130. package/dist/esm/polyfills/css-shim.js +1 -1
  131. package/dist/esm/polyfills/dom.js +0 -0
  132. package/dist/esm/polyfills/es5-html-element.js +0 -0
  133. package/dist/esm/polyfills/index.js +0 -0
  134. package/dist/esm/polyfills/system.js +0 -0
  135. package/dist/mg-components/locales/en/messages.json +7 -0
  136. package/dist/mg-components/locales/fr/messages.json +7 -0
  137. package/dist/mg-components/mg-components.css +1 -1
  138. package/dist/mg-components/mg-components.esm.js +1 -1
  139. package/dist/mg-components/{p-3899d5d2.js → p-182bd802.js} +2 -2
  140. package/dist/mg-components/p-f7da9dd2.entry.js +1 -0
  141. package/dist/mg-components/styles/a11y.scss +32 -0
  142. package/dist/mg-components/styles/components.scss +3 -0
  143. package/dist/mg-components/styles/fonts.scss +21 -0
  144. package/dist/mg-components/styles/form.scss +3 -0
  145. package/dist/mg-components/styles/global.scss +87 -0
  146. package/dist/mg-components/styles/layout.scss +29 -0
  147. package/dist/mg-components/styles/main.scss +23 -0
  148. package/dist/mg-components/styles/navigation-button.scss +76 -0
  149. package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +9 -0
  150. package/dist/mg-components/styles/typography.scss +75 -0
  151. package/dist/mg-components/styles/utilities.scss +21 -0
  152. package/dist/mg-components/variables.css +9 -9
  153. package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -11
  154. package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -2
  155. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -1
  156. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -11
  157. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +4 -4
  158. package/dist/types/components/atoms/mg-button/mg-button.d.ts +6 -6
  159. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +2 -2
  160. package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -13
  161. package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +5 -1
  162. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +27 -6
  163. package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -2
  164. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +2 -2
  165. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
  166. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
  167. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf.d.ts +1 -1
  168. package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +5 -0
  169. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +37 -0
  170. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +51 -3
  171. package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +1 -0
  172. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +0 -8
  173. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +55 -15
  174. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  175. package/dist/types/components/molecules/mg-message/mg-message.d.ts +22 -5
  176. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -1
  177. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +12 -0
  178. package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +11 -0
  179. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +7 -0
  180. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +49 -0
  181. package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +5 -3
  182. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +24 -14
  183. package/dist/types/components.d.ts +81 -18
  184. package/dist/types/locales/index.d.ts +16 -9
  185. package/dist/types/stencil-public-runtime.d.ts +44 -3
  186. package/dist/types/utils/behaviors.utils.d.ts +83 -0
  187. package/dist/types/utils/components.utils.d.ts +14 -0
  188. package/dist/types/utils/locale.utils.d.ts +13 -0
  189. package/dist/types/utils/unit.test.utils.d.ts +78 -0
  190. package/package.json +51 -46
  191. package/readme.md +25 -14
  192. package/dist/components/locale.utils.js +0 -40
  193. package/dist/components/mg-menu.conf.js +0 -10
  194. package/dist/mg-components/p-059a9a59.entry.js +0 -1
@@ -1,7 +1,13 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { D as Direction } from './mg-menu.conf.js';
2
+ import { O as OverflowBehaviorElements, D as Direction, i as isMoreItem, s as sizes, a as OverflowBehavior, d as defineCustomElement$3 } from './mg-menu-item2.js';
3
+ import { i as initLocales } from './index2.js';
4
+ import { d as defineCustomElement$7 } from './mg-badge2.js';
5
+ import { d as defineCustomElement$6 } from './mg-button2.js';
6
+ import { d as defineCustomElement$5 } from './mg-card2.js';
7
+ import { d as defineCustomElement$4 } from './mg-icon2.js';
8
+ import { d as defineCustomElement$2 } from './mg-popover2.js';
3
9
 
4
- const mgMenuCss = ":host{display:flex;background-color:hsl(var(--mg-menu-background-color-hsl, var(--color-light)))}:host([direction=vertical]){flex-direction:column;height:100%;overflow-y:auto}";
10
+ const mgMenuCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{display:flex;background-color:hsl(var(--mg-menu-background-color-hsl, var(--color-light)))}:host([direction=vertical]){flex-direction:column;height:100%;overflow-y:auto}";
5
11
 
6
12
  const MgMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
7
13
  constructor() {
@@ -12,15 +18,12 @@ const MgMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
12
18
  * Internal *
13
19
  ************/
14
20
  this.name = 'mg-menu';
21
+ this.menuItems = [];
15
22
  this.focusedMenuItem = 0;
16
- /**
17
- * Component display direction. Default: "horizontal"
18
- */
19
- this.direction = Direction.HORIZONTAL;
20
23
  /**
21
24
  * Close matching menu-item
22
25
  *
23
- * @param {HTMLMgMenuItemElement} item menu-item to close
26
+ * @param {HTMLElement} item menu-item to close
24
27
  * @param {boolean} condition addionnal condition
25
28
  * @returns {void}
26
29
  */
@@ -29,18 +32,19 @@ const MgMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
29
32
  item.expanded = false;
30
33
  }
31
34
  };
35
+ /*************
36
+ * Methods *
37
+ *************/
32
38
  /**
33
39
  * Store menu-items on component init and add listeners
40
+ *
41
+ * @returns {void}
34
42
  */
35
- this.initMenuItems = () => {
36
- // store all menu-items
37
- this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
43
+ this.initMenuItemsListeners = () => {
38
44
  // add listeners on menu item and edit index
39
45
  this.menuItems.forEach((item, menuItemIndex) => {
40
46
  ['click', 'focus'].forEach(trigger => {
41
- (item.shadowRoot.querySelector('button') || item.shadowRoot.querySelector('a')).addEventListener(trigger, (event) => {
42
- event.preventDefault();
43
- event.stopPropagation();
47
+ (item.shadowRoot.querySelector('button') || item.shadowRoot.querySelector('a')).addEventListener(trigger, () => {
44
48
  this.focusedMenuItem = menuItemIndex;
45
49
  // reset expanded on previous active menu item
46
50
  this.menuItems.forEach((item, index) => {
@@ -50,6 +54,47 @@ const MgMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
50
54
  });
51
55
  });
52
56
  };
57
+ /**
58
+ * render mg-menu-more
59
+ *
60
+ * @returns {HTMLElement} formated mg-menu-item element
61
+ */
62
+ this.renderMgMenuMore = () => {
63
+ const moreElement = this.element.shadowRoot.querySelector(`[${OverflowBehaviorElements.MORE}]`);
64
+ this.menuItems.forEach((child) => {
65
+ const proxy = child.cloneNode(true);
66
+ moreElement.querySelector('mg-menu').appendChild(proxy);
67
+ });
68
+ const allMenuItem = Array.from(this.element.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
69
+ Array.from(moreElement.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
70
+ // manage click on proxy to mirror it on initial element
71
+ proxy.addEventListener('click', () => {
72
+ (allMenuItem[index].shadowRoot.querySelector('a') || allMenuItem[index].shadowRoot.querySelector('button')).dispatchEvent(new MouseEvent('click', { bubbles: true }));
73
+ });
74
+ // manage status change miror in proxy
75
+ allMenuItem[index].addEventListener('status-change', (event) => {
76
+ proxy.setAttribute('status', event.detail);
77
+ this.overflowBehavior.updateActiveStatus();
78
+ });
79
+ });
80
+ this.element.appendChild(moreElement);
81
+ return this.element.querySelector(`[${OverflowBehaviorElements.MORE}]`);
82
+ };
83
+ /**
84
+ * Render mg-menu-item more element for overflow behavior
85
+ *
86
+ * @returns {HTMLElement} rendered mg-menu-item more element
87
+ */
88
+ this.renderMgMenuItemMore = () => {
89
+ var _a, _b, _c, _d, _e, _f, _g;
90
+ return (h("mg-menu-item", { "data-overflow-more": true }, h("mg-icon", { icon: ((_b = (_a = this.moreitem) === null || _a === void 0 ? void 0 : _a.mgIcon) === null || _b === void 0 ? void 0 : _b.icon) || 'ellipsis-vertical', slot: "image" }), h("span", { class: { 'sr-only': !((_d = (_c = this.moreitem) === null || _c === void 0 ? void 0 : _c.slotLabel) === null || _d === void 0 ? void 0 : _d.display) }, slot: "label" }, ((_f = (_e = this.moreitem) === null || _e === void 0 ? void 0 : _e.slotLabel) === null || _f === void 0 ? void 0 : _f.label) || this.messages.moreLabel), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: (_g = this.moreitem) === null || _g === void 0 ? void 0 : _g.size })));
91
+ };
92
+ this.label = undefined;
93
+ this.direction = Direction.HORIZONTAL;
94
+ this.moreitem = undefined;
95
+ this.size = 'regular';
96
+ this.isChildMenu = undefined;
97
+ this.hasOverflow = false;
53
98
  }
54
99
  validateLabel(newValue) {
55
100
  if (newValue === undefined) {
@@ -61,6 +106,19 @@ const MgMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
61
106
  throw new Error(`<${this.name}> prop "direction" must be one of : ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
62
107
  }
63
108
  }
109
+ validateMoreItem(newValue) {
110
+ if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
111
+ throw new Error(`<${this.name}> prop "moreitem" must be paired with direction ${Direction.HORIZONTAL}.`);
112
+ }
113
+ else if (newValue !== undefined && !isMoreItem(newValue)) {
114
+ throw new Error(`<${this.name}> prop "moreitem" must match MoreItemType.`);
115
+ }
116
+ }
117
+ validateSize(newValue) {
118
+ if (!sizes.includes(newValue)) {
119
+ throw new Error(`<${this.name}> prop "size" must be one of : ${sizes.join(', ')}.`);
120
+ }
121
+ }
64
122
  /*************
65
123
  * Lifecycle *
66
124
  *************/
@@ -70,8 +128,12 @@ const MgMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
70
128
  * @returns {void}
71
129
  */
72
130
  componentWillLoad() {
131
+ this.messages = initLocales(this.element).messages.plusMenu;
132
+ // validation
73
133
  this.validateDirection(this.direction);
74
134
  this.validateLabel(this.label);
135
+ this.validateMoreItem(this.moreitem);
136
+ this.validateSize(this.size);
75
137
  }
76
138
  /**
77
139
  * Check if component slots configuration
@@ -83,50 +145,102 @@ const MgMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
83
145
  // return a promise to process action only in the FIRST render().
84
146
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
85
147
  return setTimeout(() => {
86
- this.initMenuItems();
148
+ // store all menu-items
149
+ this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
87
150
  this.isChildMenu = this.element.closest('mg-menu-item') !== null;
88
- // click outside management for child vertical menu
89
- if (!this.isChildMenu && this.direction === Direction.HORIZONTAL) {
90
- document.addEventListener('click', (event) => {
91
- if (event.target.closest('mg-menu') === null) {
92
- this.menuItems.forEach(item => {
93
- this.closeMenuItem(item, this.direction === Direction.HORIZONTAL);
94
- });
95
- }
96
- });
97
- }
151
+ this.hasOverflow = this.direction === Direction.HORIZONTAL && !this.isChildMenu;
152
+ if (this.hasOverflow && isMoreItem(this.moreitem))
153
+ this.overflowBehavior = new OverflowBehavior(this.element, this.renderMgMenuMore);
98
154
  }, 0);
99
155
  }
156
+ /**
157
+ * Check add listeners to childs
158
+ *
159
+ * @returns {void}
160
+ */
161
+ componentDidRender() {
162
+ // add menu items listeners
163
+ this.initMenuItemsListeners();
164
+ }
165
+ /**
166
+ * Disconnect overflow ResizeObserver
167
+ *
168
+ * @returns {void} run overflow resize obeserver disconnexion
169
+ */
170
+ disconnectedCallback() {
171
+ if (this.hasOverflow)
172
+ this.overflowBehavior.disconnect();
173
+ }
100
174
  /**
101
175
  * Render
102
176
  *
103
177
  * @returns {HTMLElement} HTML Element
104
178
  */
105
179
  render() {
106
- return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
180
+ return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null), this.hasOverflow && isMoreItem(this.moreitem) && this.renderMgMenuItemMore()));
107
181
  }
108
182
  get element() { return this; }
109
183
  static get watchers() { return {
110
184
  "label": ["validateLabel"],
111
- "direction": ["validateDirection"]
185
+ "direction": ["validateDirection"],
186
+ "moreitem": ["validateMoreItem"],
187
+ "size": ["validateSize"]
112
188
  }; }
113
189
  static get style() { return mgMenuCss; }
114
190
  }, [1, "mg-menu", {
115
191
  "label": [1],
116
192
  "direction": [513],
117
- "isChildMenu": [32]
193
+ "moreitem": [16],
194
+ "size": [1],
195
+ "isChildMenu": [32],
196
+ "hasOverflow": [32]
118
197
  }]);
119
198
  function defineCustomElement$1() {
120
199
  if (typeof customElements === "undefined") {
121
200
  return;
122
201
  }
123
- const components = ["mg-menu"];
202
+ const components = ["mg-menu", "mg-badge", "mg-button", "mg-card", "mg-icon", "mg-menu", "mg-menu-item", "mg-popover"];
124
203
  components.forEach(tagName => { switch (tagName) {
125
204
  case "mg-menu":
126
205
  if (!customElements.get(tagName)) {
127
206
  customElements.define(tagName, MgMenu$1);
128
207
  }
129
208
  break;
209
+ case "mg-badge":
210
+ if (!customElements.get(tagName)) {
211
+ defineCustomElement$7();
212
+ }
213
+ break;
214
+ case "mg-button":
215
+ if (!customElements.get(tagName)) {
216
+ defineCustomElement$6();
217
+ }
218
+ break;
219
+ case "mg-card":
220
+ if (!customElements.get(tagName)) {
221
+ defineCustomElement$5();
222
+ }
223
+ break;
224
+ case "mg-icon":
225
+ if (!customElements.get(tagName)) {
226
+ defineCustomElement$4();
227
+ }
228
+ break;
229
+ case "mg-menu":
230
+ if (!customElements.get(tagName)) {
231
+ defineCustomElement$1();
232
+ }
233
+ break;
234
+ case "mg-menu-item":
235
+ if (!customElements.get(tagName)) {
236
+ defineCustomElement$3();
237
+ }
238
+ break;
239
+ case "mg-popover":
240
+ if (!customElements.get(tagName)) {
241
+ defineCustomElement$2();
242
+ }
243
+ break;
130
244
  } });
131
245
  }
132
246
  defineCustomElement$1();
@@ -1,7 +1,8 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { c as createID, C as ClassList } from './components.utils.js';
3
3
  import { i as initLocales } from './index2.js';
4
- import { d as defineCustomElement$3 } from './mg-button2.js';
4
+ import { d as defineCustomElement$4 } from './mg-button2.js';
5
+ import { d as defineCustomElement$3 } from './mg-card2.js';
5
6
  import { d as defineCustomElement$2 } from './mg-icon2.js';
6
7
 
7
8
  /**
@@ -9,7 +10,7 @@ import { d as defineCustomElement$2 } from './mg-icon2.js';
9
10
  */
10
11
  const variants = ['info', 'warning', 'success', 'danger'];
11
12
 
12
- const mgMessageCss = ".mg-message{display:inline-block;position:relative;box-sizing:border-box;min-height:var(--default-size);overflow:hidden;background-color:white;border-radius:var(--mg-message-border-radius);box-shadow:var(--box-shadow)}.mg-message::before{content:\"\";position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info::before{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning::before{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success::before{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger::before{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{padding-right:3.4rem}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message,mg-message{max-width:100%}";
13
+ const mgMessageCss = ":host{--mg-card-padding:0;--mg-card-border-radius:var(--mg-message-border-radius);--mg-card-border:none;--mg-card-overflow:hidden}.mg-message{display:inline-block;min-height:var(--default-size)}.mg-message__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info .mg-message__bar{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning .mg-message__bar{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success .mg-message__bar{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger .mg-message__bar{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{--mg-card-padding:0 3.4rem 0 0}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}.mg-message,mg-message{max-width:100%}";
13
14
 
14
15
  const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
15
16
  constructor() {
@@ -27,49 +28,50 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
27
28
  this.closeButtonId = '';
28
29
  // Stored timer setted when hide action is run from setTimeOut
29
30
  this.storedTimer = null;
31
+ // Manage hover
32
+ this.isFocused = false;
33
+ this.isHovered = false;
30
34
  /**
31
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
32
- * If not set, it will be created.
33
- */
34
- this.identifier = createID('mg-message');
35
- /**
36
- * Message variant
37
- */
38
- this.variant = variants[0]; // info
39
- /**
40
- * Define if message has a cross button
41
- * RG 01: https://jira.mgdis.fr/browse/PDA9-140
42
- */
43
- this.closeButton = false;
44
- /**
45
- * Define if message is hidden
35
+ * Set timer
36
+ *
37
+ * @returns {void}
46
38
  */
47
- this.hide = false;
39
+ this.setTimer = () => {
40
+ this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
41
+ };
48
42
  /**
49
- * Component classes
43
+ * Clear timer
44
+ *
45
+ * @returns {void}
50
46
  */
51
- this.classList = new ClassList(['mg-message']);
47
+ this.clearTimer = () => {
48
+ clearTimeout(this.storedTimer);
49
+ };
52
50
  /**
53
- * Define if component is using actions slot
51
+ * Event to add on element
52
+ *
53
+ * @param {MouseEvent | FocusEvent} event event
54
+ * @returns {void}
54
55
  */
55
- this.hasActions = false;
56
+ this.timerEvents = (event) => {
57
+ this.clearTimer();
58
+ const isMouseEvent = event.type === 'mouseenter';
59
+ // Needed to ensure we don't start the timer
60
+ this[isMouseEvent ? 'isHovered' : 'isFocused'] = true;
61
+ // Restart timer when loose focus AND mouse leave
62
+ this.element.addEventListener(isMouseEvent ? 'mouseleave' : 'focusout', eventOut => {
63
+ this[eventOut.type === 'mouseleave' ? 'isHovered' : 'isFocused'] = false;
64
+ // Start timer if needed
65
+ if (!this.isFocused && !this.isHovered)
66
+ this.setTimer();
67
+ }, { once: true });
68
+ };
56
69
  /**
57
70
  * Handle close button
58
71
  */
59
72
  this.handleClose = () => {
60
73
  this.hide = true;
61
74
  };
62
- /**
63
- * Hide component whith delay
64
- */
65
- this.hideWithDelay = () => {
66
- if (this.delay > 0 && this.hide !== true) {
67
- this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
68
- }
69
- else if (this.storedTimer !== null) {
70
- clearTimeout(this.storedTimer);
71
- }
72
- };
73
75
  /**
74
76
  * Get icon corresponding to variant
75
77
  *
@@ -87,6 +89,13 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
87
89
  return 'exclamation-circle';
88
90
  }
89
91
  };
92
+ this.identifier = createID('mg-message');
93
+ this.delay = undefined;
94
+ this.variant = variants[0];
95
+ this.closeButton = false;
96
+ this.hide = false;
97
+ this.classList = new ClassList(['mg-message']);
98
+ this.hasActions = false;
90
99
  }
91
100
  validateDelay(newValue) {
92
101
  if (newValue && newValue < 2) {
@@ -114,12 +123,26 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
114
123
  if (newValue) {
115
124
  this.componentHide.emit();
116
125
  this.classList.add(this.classHide);
126
+ // Remove event Listener
127
+ ['focusin', 'mouseenter'].forEach(event => {
128
+ this.element.removeEventListener(event, this.timerEvents);
129
+ });
130
+ // Clear Timer
131
+ this.clearTimer();
117
132
  }
118
133
  else {
119
134
  this.componentShow.emit();
120
135
  this.classList.delete(this.classHide);
136
+ // If delay is set
137
+ if (this.delay > 1) {
138
+ // Start timer
139
+ this.setTimer();
140
+ // Stop timer when get focus or mouse enter
141
+ ['focusin', 'mouseenter'].forEach(event => {
142
+ this.element.addEventListener(event, this.timerEvents);
143
+ });
144
+ }
121
145
  }
122
- this.hideWithDelay();
123
146
  }
124
147
  /*************
125
148
  * Lifecycle *
@@ -148,7 +171,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
148
171
  * @returns {HTMLElement} HTML Element
149
172
  */
150
173
  render() {
151
- return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, 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" }))))));
174
+ return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card", null, h("span", { class: "mg-message__bar" }), 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" })))))));
152
175
  }
153
176
  get element() { return this; }
154
177
  static get watchers() { return {
@@ -171,7 +194,7 @@ function defineCustomElement$1() {
171
194
  if (typeof customElements === "undefined") {
172
195
  return;
173
196
  }
174
- const components = ["mg-message", "mg-button", "mg-icon"];
197
+ const components = ["mg-message", "mg-button", "mg-card", "mg-icon"];
175
198
  components.forEach(tagName => { switch (tagName) {
176
199
  case "mg-message":
177
200
  if (!customElements.get(tagName)) {
@@ -179,6 +202,11 @@ function defineCustomElement$1() {
179
202
  }
180
203
  break;
181
204
  case "mg-button":
205
+ if (!customElements.get(tagName)) {
206
+ defineCustomElement$4();
207
+ }
208
+ break;
209
+ case "mg-card":
182
210
  if (!customElements.get(tagName)) {
183
211
  defineCustomElement$3();
184
212
  }
@@ -1,10 +1,11 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { c as createID, C as ClassList, f as focusableElements } from './components.utils.js';
2
+ import { f as focusableElements, c as createID, C as ClassList } from './components.utils.js';
3
3
  import { i as initLocales } from './index2.js';
4
- import { d as defineCustomElement$3 } from './mg-button2.js';
4
+ import { d as defineCustomElement$4 } from './mg-button2.js';
5
+ import { d as defineCustomElement$3 } from './mg-card2.js';
5
6
  import { d as defineCustomElement$2 } from './mg-icon2.js';
6
7
 
7
- const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
8
+ const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsl(var(--color-light), 0.85)}.mg-modal mg-card{display:flex;width:60rem;max-width:100%;max-height:100%}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;height:fit-content;max-height:100%}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}.mg-modal ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
8
9
 
9
10
  const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
10
11
  constructor() {
@@ -18,31 +19,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
18
19
  // IDs
19
20
  this.closeButtonId = '';
20
21
  this.titleId = '';
21
- /**
22
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
23
- * If not set, it will be created.
24
- */
25
- this.identifier = createID('mg-modal');
26
- /**
27
- * Define if modal has a cross button
28
- */
29
- this.closeButton = false;
30
- /**
31
- * Define if modal is hidden
32
- */
33
- this.hide = false;
34
- /**
35
- * Define if component is using actions slot
36
- */
37
- this.hasActions = false;
38
- /**
39
- * Define if component is using content slot
40
- */
41
- this.hasContent = false;
42
- /**
43
- * Component classes
44
- */
45
- this.classList = new ClassList(['mg-modal']);
46
22
  this.setFocus = () => {
47
23
  // Get all focusable elements
48
24
  this.modalFocusableElements = Array.from(this.element.querySelectorAll(focusableElements)).reduce((acc, focusableElement) => {
@@ -85,6 +61,13 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
85
61
  this.handleClose = () => {
86
62
  this.hide = true;
87
63
  };
64
+ this.identifier = createID('mg-modal');
65
+ this.modalTitle = undefined;
66
+ this.closeButton = false;
67
+ this.hide = false;
68
+ this.hasActions = false;
69
+ this.hasContent = false;
70
+ this.classList = new ClassList(['mg-modal']);
88
71
  }
89
72
  validateModalTitle(newValue) {
90
73
  if (typeof newValue !== 'string' || newValue.trim() === '') {
@@ -160,7 +143,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
160
143
  * @returns {HTMLElement} HTML Element
161
144
  */
162
145
  render() {
163
- return (h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("article", { 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" }))))));
146
+ 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" })))))));
164
147
  }
165
148
  get element() { return this; }
166
149
  static get watchers() { return {
@@ -181,7 +164,7 @@ function defineCustomElement$1() {
181
164
  if (typeof customElements === "undefined") {
182
165
  return;
183
166
  }
184
- const components = ["mg-modal", "mg-button", "mg-icon"];
167
+ const components = ["mg-modal", "mg-button", "mg-card", "mg-icon"];
185
168
  components.forEach(tagName => { switch (tagName) {
186
169
  case "mg-modal":
187
170
  if (!customElements.get(tagName)) {
@@ -189,6 +172,11 @@ function defineCustomElement$1() {
189
172
  }
190
173
  break;
191
174
  case "mg-button":
175
+ if (!customElements.get(tagName)) {
176
+ defineCustomElement$4();
177
+ }
178
+ break;
179
+ case "mg-card":
192
180
  if (!customElements.get(tagName)) {
193
181
  defineCustomElement$3();
194
182
  }
@@ -42,19 +42,6 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
42
42
  this.__registerHost();
43
43
  this.__attachShadow();
44
44
  this.currentPageChange = createEvent(this, "current-page-change", 7);
45
- /**
46
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
47
- * If not set, it will be created.
48
- */
49
- this.identifier = createID('mg-pagination');
50
- /**
51
- * Component total pages
52
- */
53
- this.totalPages = 1;
54
- /**
55
- * Component current page
56
- */
57
- this.currentPage = 1;
58
45
  /**
59
46
  * Change current page from target
60
47
  *
@@ -87,6 +74,10 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
87
74
  this.handleGoToPage = (action, disabled) => {
88
75
  !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
89
76
  };
77
+ this.identifier = createID('mg-pagination');
78
+ this.label = undefined;
79
+ this.totalPages = 1;
80
+ this.currentPage = 1;
90
81
  }
91
82
  validateTotalPages(newValue) {
92
83
  if (newValue < 1) {
@@ -1,14 +1,15 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { c as createID, C as ClassList } from './components.utils.js';
3
3
  import { i as initLocales } from './index2.js';
4
- import { d as defineCustomElement$7 } from './mg-button2.js';
4
+ import { d as defineCustomElement$8 } from './mg-button2.js';
5
+ import { d as defineCustomElement$7 } from './mg-card2.js';
5
6
  import { d as defineCustomElement$6 } from './mg-character-left2.js';
6
7
  import { d as defineCustomElement$5 } from './mg-icon2.js';
7
8
  import { d as defineCustomElement$4 } from './mg-input-text2.js';
8
9
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
9
10
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
10
11
 
11
- const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
12
+ const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}.mg-panel ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
12
13
 
13
14
  const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
14
15
  constructor() {
@@ -17,27 +18,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
17
18
  this.__attachShadow();
18
19
  this.titleChange = createEvent(this, "title-change", 7);
19
20
  this.expandedChange = createEvent(this, "expanded-change", 7);
20
- /**
21
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
22
- * If not set, it will be created.
23
- */
24
- this.identifier = createID('mg-panel');
25
- /**
26
- * Panel is opened
27
- */
28
- this.expanded = false;
29
- /**
30
- * Panel title is editabled
31
- */
32
- this.titleEditable = false;
33
- /**
34
- * Component classes
35
- */
36
- this.classList = new ClassList(['mg-panel']);
37
- /**
38
- * Title is in edition mode
39
- */
40
- this.isEditing = false;
41
21
  /************
42
22
  * Methods *
43
23
  ************/
@@ -122,6 +102,16 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
122
102
  }
123
103
  return collapseButton();
124
104
  };
105
+ this.identifier = createID('mg-panel');
106
+ this.panelTitle = undefined;
107
+ this.titlePattern = undefined;
108
+ this.titlePatternErrorMessage = undefined;
109
+ this.expanded = false;
110
+ this.expandToggleDisabled = undefined;
111
+ this.titleEditable = false;
112
+ this.classList = new ClassList(['mg-panel']);
113
+ this.isEditing = false;
114
+ this.updatedPanelTitle = undefined;
125
115
  }
126
116
  validatePanelTitle(newValue) {
127
117
  if (typeof newValue !== 'string' || newValue.trim() === '') {
@@ -172,7 +162,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
172
162
  * @returns {HTMLElement} html element
173
163
  */
174
164
  render() {
175
- return (h("section", { class: this.classList.join(), id: this.identifier }, 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))));
165
+ 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)))));
176
166
  }
177
167
  get element() { return this; }
178
168
  static get watchers() { return {
@@ -197,7 +187,7 @@ function defineCustomElement$1() {
197
187
  if (typeof customElements === "undefined") {
198
188
  return;
199
189
  }
200
- const components = ["mg-panel", "mg-button", "mg-character-left", "mg-icon", "mg-input-text", "mg-input-title", "mg-tooltip"];
190
+ const components = ["mg-panel", "mg-button", "mg-card", "mg-character-left", "mg-icon", "mg-input-text", "mg-input-title", "mg-tooltip"];
201
191
  components.forEach(tagName => { switch (tagName) {
202
192
  case "mg-panel":
203
193
  if (!customElements.get(tagName)) {
@@ -205,6 +195,11 @@ function defineCustomElement$1() {
205
195
  }
206
196
  break;
207
197
  case "mg-button":
198
+ if (!customElements.get(tagName)) {
199
+ defineCustomElement$8();
200
+ }
201
+ break;
202
+ case "mg-card":
208
203
  if (!customElements.get(tagName)) {
209
204
  defineCustomElement$7();
210
205
  }