@mgdis/mg-components 5.6.0 → 5.8.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 (203) hide show
  1. package/dist/cjs/{index-4dcc1812.js → index-5e7ede97.js} +109 -3
  2. package/dist/cjs/loader.cjs.js +4 -3
  3. package/dist/cjs/{mg-badge_30.cjs.entry.js → mg-action-more_31.cjs.entry.js} +490 -661
  4. package/dist/cjs/mg-components.cjs.js +7 -3
  5. package/dist/cjs/mg-item-more.cjs.entry.js +273 -0
  6. package/dist/cjs/mg-menu.conf-9afe6571.js +242 -0
  7. package/dist/collection/collection-manifest.json +7 -5
  8. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
  9. package/dist/collection/components/atoms/mg-button/mg-button.css +7 -21
  10. package/dist/collection/components/atoms/mg-button/mg-button.js +25 -1
  11. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +35 -27
  12. package/dist/collection/components/atoms/mg-icon/mg-icon.js +3 -3
  13. package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
  14. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +18 -17
  15. package/dist/collection/components/molecules/inputs/MgInput.js +6 -1
  16. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
  17. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +3 -2
  18. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +4 -0
  19. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  20. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +4 -0
  21. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
  22. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +4 -0
  23. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
  24. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +2 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +4 -0
  26. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  27. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +4 -0
  28. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +4 -0
  29. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  30. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -4
  31. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +0 -13
  32. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +41 -70
  33. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +5 -4
  34. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +160 -61
  35. package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
  36. package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +38 -0
  37. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +252 -0
  38. package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
  39. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
  40. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +30 -0
  41. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +200 -0
  42. package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
  43. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
  44. package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -2
  45. package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -1
  46. package/dist/collection/components/molecules/mg-popover/mg-popover.js +17 -4
  47. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -1
  48. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +2 -3
  49. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +9 -8
  50. package/dist/collection/locales/en/messages.json +6 -1
  51. package/dist/collection/locales/fr/messages.json +6 -1
  52. package/dist/collection/locales/index.js +1 -1
  53. package/dist/collection/styles/mg-icon-animation.scss +6 -0
  54. package/dist/collection/styles/navigation-button.scss +3 -2
  55. package/dist/collection/utils/behaviors.utils.js +38 -52
  56. package/dist/collection/utils/components.utils.js +3 -1
  57. package/dist/collection/utils/locale.utils.js +9 -9
  58. package/dist/collection/utils/unit.test.utils.js +32 -4
  59. package/dist/collection/variables.css +2 -1
  60. package/dist/components/MgInput.js +6 -1
  61. package/dist/components/components.utils.js +3 -1
  62. package/dist/components/index.d.ts +11 -0
  63. package/dist/components/index.js +3 -1
  64. package/dist/components/index2.js +26 -14
  65. package/dist/components/mg-action-more.d.ts +11 -0
  66. package/dist/components/mg-action-more.js +216 -0
  67. package/dist/components/mg-badge2.js +1 -1
  68. package/dist/components/mg-button2.js +6 -3
  69. package/dist/components/mg-form.js +2 -2
  70. package/dist/components/mg-icon2.js +38 -30
  71. package/dist/components/mg-input-checkbox.js +3 -3
  72. package/dist/components/mg-input-date.js +2 -2
  73. package/dist/components/mg-input-numeric.js +2 -2
  74. package/dist/components/mg-input-password.js +1 -1
  75. package/dist/components/mg-input-radio.js +2 -2
  76. package/dist/components/mg-input-select2.js +2 -2
  77. package/dist/components/mg-input-text2.js +1 -1
  78. package/dist/components/mg-input-textarea.js +2 -2
  79. package/dist/components/mg-input-toggle.js +1 -1
  80. package/dist/components/mg-item-more.d.ts +11 -0
  81. package/dist/components/mg-item-more.js +336 -0
  82. package/dist/components/mg-menu-item2.js +137 -250
  83. package/dist/components/mg-menu.conf.js +14 -0
  84. package/dist/components/mg-menu.js +1 -246
  85. package/dist/components/mg-menu2.js +180 -0
  86. package/dist/components/mg-message.js +1 -1
  87. package/dist/components/mg-pagination.js +3 -1
  88. package/dist/components/mg-panel.js +2 -2
  89. package/dist/components/mg-popover2.js +17 -3
  90. package/dist/components/mg-skip-links.js +1 -1
  91. package/dist/components/mg-tabs.js +10 -9
  92. package/dist/components/mg-tag.js +1 -1
  93. package/dist/components/mg-tooltip2.js +18 -17
  94. package/dist/esm/{index-dc9a2348.js → index-03cceb11.js} +109 -4
  95. package/dist/esm/loader.js +4 -3
  96. package/dist/esm/{mg-badge_30.entry.js → mg-action-more_31.entry.js} +464 -636
  97. package/dist/esm/mg-components.js +4 -3
  98. package/dist/esm/mg-item-more.entry.js +269 -0
  99. package/dist/esm/mg-menu.conf-881fbd82.js +235 -0
  100. package/dist/mg-components/locales/en/messages.json +6 -1
  101. package/dist/mg-components/locales/fr/messages.json +6 -1
  102. package/dist/mg-components/mg-components.css +1 -1
  103. package/dist/mg-components/mg-components.esm.js +1 -1
  104. package/dist/mg-components/p-1221773c.entry.js +1 -0
  105. package/dist/mg-components/p-367f92d2.js +1 -0
  106. package/dist/mg-components/p-6aeded97.entry.js +1 -0
  107. package/dist/mg-components/p-e126dd84.js +2 -0
  108. package/dist/mg-components/styles/mg-icon-animation.scss +6 -0
  109. package/dist/mg-components/styles/navigation-button.scss +3 -2
  110. package/dist/mg-components/variables.css +2 -1
  111. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -0
  112. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
  113. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +3 -27
  114. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +9 -27
  115. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -0
  116. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +66 -11
  117. package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +42 -0
  118. package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +81 -0
  119. package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +26 -0
  120. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +74 -0
  121. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
  122. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
  123. package/dist/types/components.d.ts +120 -12
  124. package/dist/types/locales/index.d.ts +12 -2
  125. package/dist/types/stencil-public-runtime.d.ts +9 -0
  126. package/dist/types/utils/behaviors.utils.d.ts +12 -11
  127. package/dist/types/utils/locale.utils.d.ts +5 -5
  128. package/dist/types/utils/unit.test.utils.d.ts +20 -2
  129. package/loader/index.d.ts +9 -0
  130. package/package.json +17 -16
  131. package/readme.md +0 -18
  132. package/dist/.storybook/utils.js +0 -24
  133. package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -27
  134. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -38
  135. package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +0 -18
  136. package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +0 -20
  137. package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +0 -18
  138. package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +0 -41
  139. package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +0 -21
  140. package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +0 -22
  141. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -50
  142. package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +0 -50
  143. package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +0 -43
  144. package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +0 -68
  145. package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +0 -46
  146. package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +0 -59
  147. package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +0 -77
  148. package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +0 -110
  149. package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +0 -54
  150. package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +0 -51
  151. package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +0 -119
  152. package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +0 -34
  153. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +0 -24
  154. package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +0 -47
  155. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +0 -19
  156. package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +0 -39
  157. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +0 -39
  158. package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +0 -20
  159. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +0 -22
  160. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -34
  161. package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +0 -24
  162. package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +0 -53
  163. package/dist/collection/stories/grids.stories.js +0 -7
  164. package/dist/collection/stories/helpers.stories.js +0 -23
  165. package/dist/collection/stories/icons.stories.js +0 -25
  166. package/dist/collection/stories/typography.stories.js +0 -24
  167. package/dist/mg-components/p-182bd802.js +0 -2
  168. package/dist/mg-components/p-f7da9dd2.entry.js +0 -1
  169. package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -13
  170. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -16
  171. package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +0 -6
  172. package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -6
  173. package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +0 -6
  174. package/dist/types/components/atoms/mg-icon/doc/mg-icon.stories.d.ts +0 -26
  175. package/dist/types/components/atoms/mg-input-title/doc/mg-input-title.stories.d.ts +0 -6
  176. package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -6
  177. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -18
  178. package/dist/types/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.d.ts +0 -11
  179. package/dist/types/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.d.ts +0 -12
  180. package/dist/types/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.d.ts +0 -32
  181. package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +0 -22
  182. package/dist/types/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.d.ts +0 -20
  183. package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +0 -34
  184. package/dist/types/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.d.ts +0 -39
  185. package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +0 -19
  186. package/dist/types/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.d.ts +0 -12
  187. package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +0 -22
  188. package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +0 -12
  189. package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +0 -11
  190. package/dist/types/components/molecules/mg-form/doc/mg-form.stories.d.ts +0 -11
  191. package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +0 -6
  192. package/dist/types/components/molecules/mg-message/doc/mg-message.stories.d.ts +0 -26
  193. package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +0 -13
  194. package/dist/types/components/molecules/mg-pagination/doc/mg-pagination.stories.d.ts +0 -11
  195. package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +0 -11
  196. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -22
  197. package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +0 -11
  198. package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +0 -20
  199. package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +0 -1
  200. package/dist/types/stories/grids.stories.d.ts +0 -5
  201. package/dist/types/stories/helpers.stories.d.ts +0 -13
  202. package/dist/types/stories/icons.stories.d.ts +0 -13
  203. package/dist/types/stories/typography.stories.d.ts +0 -5
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A11Y
3
+ */
4
+ .sr-only {
5
+ border: 0 !important;
6
+ clip: rect(1px, 1px, 1px, 1px) !important;
7
+ -webkit-clip-path: inset(50%) !important;
8
+ clip-path: inset(50%) !important;
9
+ height: 1px !important;
10
+ margin: -1px !important;
11
+ overflow: hidden !important;
12
+ padding: 0 !important;
13
+ position: absolute !important;
14
+ width: 1px !important;
15
+ white-space: nowrap !important;
16
+ }
17
+
18
+ *:focus:not(:focus-visible) {
19
+ outline: none;
20
+ }
21
+
22
+ @media (prefers-reduced-motion) {
23
+ .mg-a11y-animation {
24
+ animation: none !important;
25
+ transition: none !important;
26
+ }
27
+ }
28
+ :host {
29
+ display: flex;
30
+ }
@@ -0,0 +1,200 @@
1
+ import { h, Host } from '@stencil/core';
2
+ import { initLocales } from '../../../locales';
3
+ import { OverflowBehavior } from '../../../utils/behaviors.utils';
4
+ import { Direction } from '../menu/mg-menu/mg-menu.conf';
5
+ export class MgItemMore {
6
+ constructor() {
7
+ /************
8
+ * Internal *
9
+ ************/
10
+ this.name = 'mg-item-more';
11
+ /***********
12
+ * Methods *
13
+ ***********/
14
+ /**
15
+ * render mg-item-more overflow element
16
+ *
17
+ * @returns {HTMLMgItemMoreElement} mg-item-more element
18
+ */
19
+ this.renderMgMenuItemOverflowElement = () => {
20
+ // create menu items proxy element from item clones
21
+ const moreElementMenuItem = this.element.shadowRoot.querySelector('mg-menu-item');
22
+ this.menuItems.forEach((child) => {
23
+ moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
24
+ });
25
+ const allMenuItem = Array.from(this.parentMenu.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
26
+ Array.from(moreElementMenuItem.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
27
+ // manage click on proxy to mirror it on initial element
28
+ proxy.addEventListener('click', () => {
29
+ (allMenuItem[index].shadowRoot.querySelector('a') || allMenuItem[index].shadowRoot.querySelector('button')).dispatchEvent(new MouseEvent('click', { bubbles: true }));
30
+ });
31
+ // add id suffix to prevent duplicate key. default html id is: '';
32
+ if (proxy.id.trim() !== '')
33
+ proxy.id = `${proxy.id}-proxy`;
34
+ // manage status change miror in proxy
35
+ allMenuItem[index].addEventListener('status-change', (event) => {
36
+ proxy.setAttribute('status', event.detail);
37
+ });
38
+ });
39
+ return this.element;
40
+ };
41
+ this.icon = { icon: 'ellipsis-vertical' };
42
+ this.slotlabel = { display: false };
43
+ this.size = undefined;
44
+ this.parentMenu = undefined;
45
+ }
46
+ validateIcon(newValue) {
47
+ if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
48
+ throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type.`);
49
+ }
50
+ validateSlotLabel(newValue) {
51
+ if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
52
+ throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type.`);
53
+ else if (typeof newValue.label !== 'string')
54
+ this.slotlabel.label = this.messages.moreLabel;
55
+ }
56
+ validateSize(newValue) {
57
+ if (newValue && typeof newValue !== 'string')
58
+ throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type.`);
59
+ }
60
+ /*************
61
+ * Lifecycle *
62
+ *************/
63
+ /**
64
+ * Disconnect overflow ResizeObserver
65
+ *
66
+ * @returns {void} run overflow resize obeserver disconnexion
67
+ */
68
+ disconnectedCallback() {
69
+ this.overflowBehavior.disconnect();
70
+ }
71
+ /**
72
+ * Set variables and validate props
73
+ *
74
+ * @returns {void}
75
+ */
76
+ componentWillLoad() {
77
+ // init variables
78
+ this.messages = initLocales(this.element).messages.plusMenu;
79
+ this.parentMenu = this.element.closest('mg-menu');
80
+ this.menuItems = Array.from(this.parentMenu.children).filter(item => item.nodeName === 'MG-MENU-ITEM');
81
+ // validate props
82
+ this.validateIcon(this.icon);
83
+ this.validateSlotLabel(this.slotlabel);
84
+ this.validateSize(this.size);
85
+ }
86
+ /**
87
+ * Add overflow behavior
88
+ *
89
+ * @returns {void}
90
+ */
91
+ componentDidLoad() {
92
+ this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
93
+ }
94
+ /**
95
+ * Render
96
+ *
97
+ * @returns {HTMLElement} HTML Element
98
+ */
99
+ render() {
100
+ return (h(Host, { role: "menuitem", "aria-haspopup": "true" }, h("mg-menu-item", { "data-overflow-more": true, "data-size": this.parentMenu.size }, h("mg-icon", { icon: this.icon.icon, slot: "image" }), h("span", { class: { 'sr-only': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: this.size }))));
101
+ }
102
+ static get is() { return "mg-item-more"; }
103
+ static get encapsulation() { return "shadow"; }
104
+ static get originalStyleUrls() {
105
+ return {
106
+ "$": ["mg-item-more.scss"]
107
+ };
108
+ }
109
+ static get styleUrls() {
110
+ return {
111
+ "$": ["mg-item-more.css"]
112
+ };
113
+ }
114
+ static get properties() {
115
+ return {
116
+ "icon": {
117
+ "type": "unknown",
118
+ "mutable": false,
119
+ "complexType": {
120
+ "original": "IconType",
121
+ "resolved": "{ icon: string; }",
122
+ "references": {
123
+ "IconType": {
124
+ "location": "import",
125
+ "path": "./mg-item-more.conf"
126
+ }
127
+ }
128
+ },
129
+ "required": false,
130
+ "optional": false,
131
+ "docs": {
132
+ "tags": [],
133
+ "text": "Define icon\nDefault: {icon: 'ellipsis-vertical'}"
134
+ },
135
+ "defaultValue": "{ icon: 'ellipsis-vertical' }"
136
+ },
137
+ "slotlabel": {
138
+ "type": "unknown",
139
+ "mutable": false,
140
+ "complexType": {
141
+ "original": "SlotLabelType",
142
+ "resolved": "{ label?: string; display?: boolean; }",
143
+ "references": {
144
+ "SlotLabelType": {
145
+ "location": "import",
146
+ "path": "./mg-item-more.conf"
147
+ }
148
+ }
149
+ },
150
+ "required": false,
151
+ "optional": false,
152
+ "docs": {
153
+ "tags": [],
154
+ "text": "Define slot label element\nDefault: {display: false}"
155
+ },
156
+ "defaultValue": "{ display: false }"
157
+ },
158
+ "size": {
159
+ "type": "string",
160
+ "mutable": false,
161
+ "complexType": {
162
+ "original": "SizeType",
163
+ "resolved": "\"large\" | \"medium\" | \"regular\"",
164
+ "references": {
165
+ "SizeType": {
166
+ "location": "import",
167
+ "path": "./mg-item-more.conf"
168
+ }
169
+ }
170
+ },
171
+ "required": false,
172
+ "optional": false,
173
+ "docs": {
174
+ "tags": [],
175
+ "text": "Define component child menu size."
176
+ },
177
+ "attribute": "size",
178
+ "reflect": false
179
+ }
180
+ };
181
+ }
182
+ static get states() {
183
+ return {
184
+ "parentMenu": {}
185
+ };
186
+ }
187
+ static get elementRef() { return "element"; }
188
+ static get watchers() {
189
+ return [{
190
+ "propName": "icon",
191
+ "methodName": "validateIcon"
192
+ }, {
193
+ "propName": "slotlabel",
194
+ "methodName": "validateSlotLabel"
195
+ }, {
196
+ "propName": "size",
197
+ "methodName": "validateSize"
198
+ }];
199
+ }
200
+ }
@@ -91,7 +91,7 @@ export class MgMessage {
91
91
  }
92
92
  validateVariant(newValue, oldValue) {
93
93
  if (!variants.includes(newValue)) {
94
- throw new Error(`<mg-message> prop "variant" must be one of : ${variants.join(', ')}`);
94
+ throw new Error(`<mg-message> prop "variant" must be one of: ${variants.join(', ')}`);
95
95
  }
96
96
  else {
97
97
  if (oldValue !== undefined) {
@@ -59,6 +59,7 @@ export class MgPagination {
59
59
  };
60
60
  this.identifier = createID('mg-pagination');
61
61
  this.label = undefined;
62
+ this.hideNavigationLabels = undefined;
62
63
  this.totalPages = 1;
63
64
  this.currentPage = 1;
64
65
  }
@@ -103,7 +104,7 @@ export class MgPagination {
103
104
  render() {
104
105
  const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
105
106
  // eslint-disable-next-line react/jsx-no-bind
106
- onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
107
+ onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
107
108
  return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
108
109
  }
109
110
  static get is() { return "mg-pagination"; }
@@ -155,6 +156,23 @@ export class MgPagination {
155
156
  "attribute": "label",
156
157
  "reflect": false
157
158
  },
159
+ "hideNavigationLabels": {
160
+ "type": "boolean",
161
+ "mutable": false,
162
+ "complexType": {
163
+ "original": "boolean",
164
+ "resolved": "boolean",
165
+ "references": {}
166
+ },
167
+ "required": false,
168
+ "optional": false,
169
+ "docs": {
170
+ "tags": [],
171
+ "text": "Hide navigation label"
172
+ },
173
+ "attribute": "hide-navigation-labels",
174
+ "reflect": false
175
+ },
158
176
  "totalPages": {
159
177
  "type": "number",
160
178
  "mutable": false,
@@ -76,13 +76,13 @@ export class MgPanel {
76
76
  if (this.titleEditable && !this.isEditing) {
77
77
  return [
78
78
  collapseButton(),
79
- h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
79
+ h("mg-button", { key: "edit-button", "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
80
80
  ];
81
81
  }
82
82
  if (this.titleEditable && this.isEditing) {
83
83
  return [
84
84
  collapseButton(),
85
- 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) }, 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` }, h("mg-icon", { icon: "cross" })), 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` }, h("mg-icon", { icon: "check" }))),
85
+ h("mg-input-text", { key: "edition-input", 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) }, 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` }, h("mg-icon", { icon: "cross" })), 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` }, h("mg-icon", { icon: "check" }))),
86
86
  ];
87
87
  }
88
88
  return collapseButton();
@@ -18,7 +18,6 @@
18
18
  }
19
19
  .mg-popover mg-card {
20
20
  position: relative;
21
- z-index: -1;
22
21
  }
23
22
  .mg-popover[data-show] {
24
23
  display: block;
@@ -1,7 +1,6 @@
1
1
  import { Host, h } from '@stencil/core';
2
- import { createID, isTagName } from '../../../utils/components.utils';
2
+ import { createID, isTagName, getWindows, ClassList } from '../../../utils/components.utils';
3
3
  import { createPopper } from '@popperjs/core';
4
- import { getWindows, ClassList } from '../../../utils/components.utils';
5
4
  import { initLocales } from '../../../locales';
6
5
  export class MgPopover {
7
6
  constructor() {
@@ -15,7 +14,10 @@ export class MgPopover {
15
14
  * @returns {void}
16
15
  */
17
16
  this.clickOutside = (event) => {
18
- if (!this.disabled && event.target.closest(`mg-popover`) !== this.element) {
17
+ var _a;
18
+ if (!this.disabled &&
19
+ event.target.closest('mg-popover') !== this.element &&
20
+ !(((_a = event.target.closest(`[data-mg-popover-guard]`)) === null || _a === void 0 ? void 0 : _a.dataset.mgPopoverGuard) === this.identifier)) {
19
21
  this.display = false;
20
22
  }
21
23
  };
@@ -26,7 +28,7 @@ export class MgPopover {
26
28
  */
27
29
  this.show = () => {
28
30
  // Make the popover visible
29
- this.popover.setAttribute('data-show', '');
31
+ this.popover.dataset.show = '';
30
32
  // Enable the event listeners
31
33
  this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
32
34
  // Update its position
@@ -135,6 +137,17 @@ export class MgPopover {
135
137
  },
136
138
  ],
137
139
  });
140
+ if (this.resizeObserver === undefined) {
141
+ // add resize observer
142
+ this.resizeObserver = new ResizeObserver(entries => {
143
+ if (entries.some(entrie => entrie.target.getAttribute('slot') !== null)) {
144
+ this.popper.update();
145
+ }
146
+ });
147
+ Array.from(this.element.querySelectorAll('[slot]')).forEach(element => {
148
+ this.resizeObserver.observe(element);
149
+ });
150
+ }
138
151
  // Add events to toggle display
139
152
  interactiveElement.addEventListener('click', () => {
140
153
  if (!this.disabled)
@@ -1,3 +1,4 @@
1
+ /* eslint-disable jsx-a11y/no-redundant-roles */
1
2
  import { h } from '@stencil/core';
2
3
  import { initLocales } from '../../../locales';
3
4
  export class MgSkipLinks {
@@ -42,7 +43,7 @@ export class MgSkipLinks {
42
43
  * @returns {HTMLElement} HTML Element
43
44
  */
44
45
  render() {
45
- return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list" }, this.links.map(link => (h("li", null, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
46
+ return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
46
47
  }
47
48
  static get is() { return "mg-skip-links"; }
48
49
  static get encapsulation() { return "shadow"; }
@@ -1,7 +1,6 @@
1
1
  .mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,
2
2
  .mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular {
3
3
  padding: 1rem 2rem;
4
- height: calc();
5
4
  }
6
5
  .mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,
7
6
  .mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=label]),
@@ -23,7 +22,6 @@
23
22
  .mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,
24
23
  .mg-tabs__navigation-button.mg-tabs__navigation-button--size-large {
25
24
  padding: 1.5rem 3rem;
26
- height: calc();
27
25
  }
28
26
  .mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,
29
27
  .mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button ::slotted([slot=label]),
@@ -49,6 +47,7 @@
49
47
  background-color: unset;
50
48
  border: none;
51
49
  font-family: var(--font-family);
50
+ font-weight: 400;
52
51
  color: hsl(var(--mg-tabs-color-hsl, var(--color-dark)));
53
52
  line-height: var(--line-height);
54
53
  text-decoration: none;
@@ -58,7 +57,7 @@
58
57
  }
59
58
  .mg-tabs__navigation-button:disabled, .mg-tabs__navigation-button--disabled {
60
59
  cursor: default;
61
- opacity: 0.3;
60
+ opacity: var(--mg-disabled-opacity);
62
61
  }
63
62
  .mg-tabs__navigation-button:focus-visible {
64
63
  z-index: 10;
@@ -52,7 +52,7 @@ export class MgTabs {
52
52
  * @param {MouseEvent} event mouse event
53
53
  */
54
54
  this.handleClick = (event) => {
55
- const tabId = event.currentTarget.getAttribute('data-index');
55
+ const tabId = event.currentTarget.dataset.index;
56
56
  const tab = this.tabs[Number(tabId) - this.startIndex];
57
57
  if (this.tabHasStatus(tab, Status.HIDDEN) || this.tabHasStatus(tab, Status.DISABLED)) {
58
58
  event.preventDefault();
@@ -78,7 +78,7 @@ export class MgTabs {
78
78
  this.handleKeydown = (event) => {
79
79
  const parent = event.target.parentElement;
80
80
  if (['ArrowRight', 'ArrowLeft'].includes(event.key)) {
81
- this.tabFocus = Number(event.target.getAttribute('data-index'));
81
+ this.tabFocus = Number(event.target.dataset.index);
82
82
  parent.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute('tabindex', '-1');
83
83
  // Move right
84
84
  if (event.key === 'ArrowRight') {
@@ -94,14 +94,15 @@ export class MgTabs {
94
94
  if (this.tabFocus < this.startIndex)
95
95
  this.tabFocus = this.tabs.length;
96
96
  }
97
+ const parentButtonElement = parent.querySelector(`[data-index="${this.tabFocus}"]`);
97
98
  // if focus item is ['hidden'] we recursively repeat action
98
99
  if (this.tabHasStatus(this.tabs[this.tabFocus - 1], Status.HIDDEN)) {
99
- parent.querySelector(`[data-index="${this.tabFocus}"]`).dispatchEvent(new KeyboardEvent('keydown', { key: event.key, bubbles: true }));
100
+ parentButtonElement.dispatchEvent(new KeyboardEvent('keydown', { key: event.key, bubbles: true }));
100
101
  // else run focus methods on tabFocus element
101
102
  }
102
103
  else {
103
- parent.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute('tabindex', '0');
104
- parent.querySelector(`[data-index="${this.tabFocus}"]`).focus();
104
+ parentButtonElement.setAttribute('tabindex', '0');
105
+ parentButtonElement.focus();
105
106
  }
106
107
  }
107
108
  else if (event.key === 'Tab') {
@@ -145,7 +146,7 @@ export class MgTabs {
145
146
  }
146
147
  validateSize(newValue) {
147
148
  if (!sizes.includes(newValue)) {
148
- throw new Error(`<mg-tabs> prop "size" must be one of : ${sizes.join(', ')}`);
149
+ throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}`);
149
150
  }
150
151
  this.classList.add(`mg-tabs--size-${this.size}`);
151
152
  }
@@ -218,13 +219,13 @@ export class MgTabs {
218
219
  * @returns {HTMLElement} HTML Element
219
220
  */
220
221
  render() {
221
- return (h("div", { class: this.classList.join() }, 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: {
222
+ return (h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
222
223
  [`${this.buttonTabBaseClass}`]: true,
223
224
  [`${this.buttonTabBaseClass}--horizontal`]: true,
224
225
  [`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
225
226
  [`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasStatus(tab, Status.DISABLED),
226
227
  [`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasStatus(tab, Status.HIDDEN),
227
- }, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
228
+ }, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
228
229
  }
229
230
  static get is() { return "mg-tabs"; }
230
231
  static get encapsulation() { return "shadow"; }
@@ -21,7 +21,9 @@
21
21
  },
22
22
  "form": {
23
23
  "required": "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
24
- "allRequired": "All fields are required"
24
+ "requiredSingle": "Field with a <strong class=\"is-asterisk\">*</strong> is required",
25
+ "allRequired": "All fields are required",
26
+ "allRequiredSingle": "The field is required"
25
27
  },
26
28
  "message": {
27
29
  "closeButton": "Close message"
@@ -53,5 +55,8 @@
53
55
  "plusMenu": {
54
56
  "moreLabel": "Additional menu",
55
57
  "badgeLabel": "Include notification(s)"
58
+ },
59
+ "actionMore": {
60
+ "label": "Actions"
56
61
  }
57
62
  }
@@ -21,7 +21,9 @@
21
21
  },
22
22
  "form": {
23
23
  "required": "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
24
- "allRequired": "Tous les champs sont obligatoires"
24
+ "requiredSingle": "Le champ marqué d'un <strong class=\"is-asterisk\">*</strong> est obligatoire",
25
+ "allRequired": "Tous les champs sont obligatoires",
26
+ "allRequiredSingle": "Le champ est obligatoire"
25
27
  },
26
28
  "message": {
27
29
  "closeButton": "Fermer le message"
@@ -53,5 +55,8 @@
53
55
  "plusMenu": {
54
56
  "moreLabel": "Menu complémentaire",
55
57
  "badgeLabel": "Notification(s) incluse(s)"
58
+ },
59
+ "actionMore": {
60
+ "label": "Actions"
56
61
  }
57
62
  }
@@ -7,6 +7,6 @@ const messages = { en, fr };
7
7
  * Get Intl object
8
8
  *
9
9
  * @param {HTMLElement} element element we need to get the language
10
- * @returns {{ locale: string; messages: unknown }} messages object
10
+ * @returns {{ locale: string; messages: Record<string, unknown> }} messages object
11
11
  */
12
12
  export const initLocales = (element) => getLocaleMessages(element, messages, defaultLocale);
@@ -0,0 +1,6 @@
1
+ @mixin rotate($selector, $duration) {
2
+ transition: $duration;
3
+ &--rotate#{$selector} {
4
+ transform: rotate(180deg);
5
+ }
6
+ }
@@ -9,7 +9,7 @@ $navigation-button-column-gap: 1rem;
9
9
  .#{$element}.#{$element}--size-#{$name} .#{$element}__navigation-button,
10
10
  .#{$element}__navigation-button.#{$element}__navigation-button--size-#{$name} {
11
11
  padding: #{map.get($size, 'vertical')} #{map.get($size, 'horizontal')};
12
- height: calc(#{map.get($size, 'height')});
12
+ height: #{map.get($size, 'height')};
13
13
  &,
14
14
  ::slotted([slot='label']),
15
15
  ::slotted([slot='metadata']) {
@@ -35,6 +35,7 @@ $navigation-button-column-gap: 1rem;
35
35
  background-color: unset;
36
36
  border: none;
37
37
  font-family: var(--font-family);
38
+ font-weight: 400;
38
39
  color: hsl(var(--#{$element}-color-hsl, var(--color-dark)));
39
40
  line-height: var(--line-height);
40
41
  text-decoration: none;
@@ -44,7 +45,7 @@ $navigation-button-column-gap: 1rem;
44
45
  &:disabled,
45
46
  &--disabled {
46
47
  cursor: default;
47
- opacity: 0.3;
48
+ opacity: var(--mg-disabled-opacity);
48
49
  }
49
50
  &:focus-visible {
50
51
  z-index: 10;