@mgdis/mg-components 5.3.0 → 5.5.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 (144) hide show
  1. package/dist/cjs/{index-94497267.js → index-c3450336.js} +0 -0
  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} +517 -715
  4. package/dist/cjs/mg-components.cjs.js +3 -3
  5. package/dist/collection/collection-manifest.json +3 -2
  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.css +6 -0
  8. package/dist/collection/components/atoms/mg-badge/mg-badge.js +5 -8
  9. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -7
  10. package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
  11. package/dist/collection/components/atoms/mg-button/mg-button.css +19 -1
  12. package/dist/collection/components/atoms/mg-button/mg-button.js +13 -30
  13. package/dist/collection/components/atoms/mg-card/mg-card.css +6 -1
  14. package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +2 -3
  15. package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -6
  16. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +20 -4
  17. package/dist/collection/components/atoms/mg-icon/mg-icon.css +27 -0
  18. package/dist/collection/components/atoms/mg-icon/mg-icon.js +7 -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 +60 -15
  23. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +97 -68
  24. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +7 -0
  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 +7 -0
  27. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +17 -25
  28. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +6 -0
  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 +7 -0
  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.css +7 -0
  33. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +18 -33
  34. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +6 -0
  35. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +23 -33
  36. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +6 -0
  37. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +23 -41
  38. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +6 -0
  39. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +23 -45
  40. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +6 -0
  41. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -33
  42. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +1 -1
  43. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +8 -23
  44. package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +8 -1
  45. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +55 -24
  46. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +18 -33
  47. package/dist/collection/components/molecules/mg-details/mg-details.css +6 -0
  48. package/dist/collection/components/molecules/mg-details/mg-details.js +4 -8
  49. package/dist/collection/components/molecules/mg-form/mg-form.js +9 -23
  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 +0 -6
  52. package/dist/collection/components/molecules/mg-message/mg-message.css +13 -19
  53. package/dist/collection/components/molecules/mg-message/mg-message.js +8 -27
  54. package/dist/collection/components/molecules/mg-modal/mg-modal.css +12 -7
  55. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -26
  56. package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +6 -0
  57. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -13
  58. package/dist/collection/components/molecules/mg-panel/mg-panel.css +10 -5
  59. package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -22
  60. package/dist/collection/components/molecules/mg-popover/mg-popover.css +13 -9
  61. package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -23
  62. package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +24 -0
  63. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js +1 -0
  64. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +28 -0
  65. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +77 -0
  66. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +10 -23
  67. package/dist/collection/locales/en/messages.json +3 -0
  68. package/dist/collection/locales/fr/messages.json +3 -0
  69. package/dist/components/index.d.ts +1 -0
  70. package/dist/components/index.js +1 -0
  71. package/dist/components/index2.js +8 -0
  72. package/dist/components/mg-badge2.js +6 -9
  73. package/dist/components/mg-button2.js +14 -31
  74. package/dist/components/mg-card.js +1 -37
  75. package/dist/components/mg-card2.js +39 -0
  76. package/dist/components/mg-character-left2.js +2 -3
  77. package/dist/components/mg-details.js +5 -9
  78. package/dist/components/mg-divider.js +0 -6
  79. package/dist/components/mg-form.js +9 -23
  80. package/dist/components/mg-icon2.js +28 -17
  81. package/dist/components/mg-illustrated-message.js +1 -7
  82. package/dist/components/mg-input-checkbox.js +18 -34
  83. package/dist/components/mg-input-date.js +18 -26
  84. package/dist/components/mg-input-numeric.js +25 -48
  85. package/dist/components/mg-input-password.js +18 -30
  86. package/dist/components/mg-input-radio.js +19 -34
  87. package/dist/components/mg-input-select2.js +25 -35
  88. package/dist/components/mg-input-text2.js +24 -42
  89. package/dist/components/mg-input-textarea.js +24 -46
  90. package/dist/components/mg-input-title2.js +4 -8
  91. package/dist/components/mg-input-toggle.js +17 -34
  92. package/dist/components/mg-menu-item.js +18 -33
  93. package/dist/components/mg-menu.js +9 -24
  94. package/dist/components/mg-message.js +17 -30
  95. package/dist/components/mg-modal.js +18 -30
  96. package/dist/components/mg-pagination.js +5 -14
  97. package/dist/components/mg-panel.js +20 -25
  98. package/dist/components/mg-popover.js +16 -26
  99. package/dist/components/mg-skip-links.d.ts +11 -0
  100. package/dist/components/mg-skip-links.js +66 -0
  101. package/dist/components/mg-tabs.js +10 -23
  102. package/dist/components/mg-tag.js +34 -12
  103. package/dist/components/mg-tooltip2.js +97 -68
  104. package/dist/esm/{index-aad0184c.js → index-78edde1d.js} +0 -0
  105. package/dist/esm/loader.js +3 -3
  106. package/dist/esm/{mg-badge_29.entry.js → mg-badge_30.entry.js} +517 -716
  107. package/dist/esm/mg-components.js +3 -3
  108. package/dist/esm/polyfills/core-js.js +0 -0
  109. package/dist/esm/polyfills/dom.js +0 -0
  110. package/dist/esm/polyfills/es5-html-element.js +0 -0
  111. package/dist/esm/polyfills/index.js +0 -0
  112. package/dist/esm/polyfills/system.js +0 -0
  113. package/dist/mg-components/locales/en/messages.json +3 -0
  114. package/dist/mg-components/locales/fr/messages.json +3 -0
  115. package/dist/mg-components/mg-components.css +1 -1
  116. package/dist/mg-components/mg-components.esm.js +1 -1
  117. package/dist/mg-components/{p-3899d5d2.js → p-125c54ca.js} +0 -0
  118. package/dist/mg-components/p-4961c96c.entry.js +1 -0
  119. package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -11
  120. package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -1
  121. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -11
  122. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -2
  123. package/dist/types/components/atoms/mg-button/mg-button.d.ts +6 -6
  124. package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -13
  125. package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +5 -1
  126. package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +27 -6
  127. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +15 -0
  128. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +0 -5
  129. package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +1 -0
  130. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +0 -4
  131. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  132. package/dist/types/components/molecules/mg-message/mg-message.d.ts +1 -1
  133. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -1
  134. package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +11 -0
  135. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +7 -0
  136. package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +34 -0
  137. package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +2 -2
  138. package/dist/types/components.d.ts +37 -6
  139. package/dist/types/locales/index.d.ts +6 -0
  140. package/dist/types/stencil-public-runtime.d.ts +5 -0
  141. package/dist/types/utils/unit.test.utils.d.ts +42 -0
  142. package/package.json +36 -31
  143. package/readme.md +3 -1
  144. package/dist/mg-components/p-204af46f.entry.js +0 -1
@@ -8,31 +8,6 @@ export class MgModal {
8
8
  // IDs
9
9
  this.closeButtonId = '';
10
10
  this.titleId = '';
11
- /**
12
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
13
- * If not set, it will be created.
14
- */
15
- this.identifier = createID('mg-modal');
16
- /**
17
- * Define if modal has a cross button
18
- */
19
- this.closeButton = false;
20
- /**
21
- * Define if modal is hidden
22
- */
23
- this.hide = false;
24
- /**
25
- * Define if component is using actions slot
26
- */
27
- this.hasActions = false;
28
- /**
29
- * Define if component is using content slot
30
- */
31
- this.hasContent = false;
32
- /**
33
- * Component classes
34
- */
35
- this.classList = new ClassList(['mg-modal']);
36
11
  this.setFocus = () => {
37
12
  // Get all focusable elements
38
13
  this.modalFocusableElements = Array.from(this.element.querySelectorAll(focusableElements)).reduce((acc, focusableElement) => {
@@ -75,6 +50,13 @@ export class MgModal {
75
50
  this.handleClose = () => {
76
51
  this.hide = true;
77
52
  };
53
+ this.identifier = createID('mg-modal');
54
+ this.modalTitle = undefined;
55
+ this.closeButton = false;
56
+ this.hide = false;
57
+ this.hasActions = false;
58
+ this.hasContent = false;
59
+ this.classList = new ClassList(['mg-modal']);
78
60
  }
79
61
  validateModalTitle(newValue) {
80
62
  if (typeof newValue !== 'string' || newValue.trim() === '') {
@@ -150,7 +132,7 @@ export class MgModal {
150
132
  * @returns {HTMLElement} HTML Element
151
133
  */
152
134
  render() {
153
- 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" }))))));
135
+ 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" })))))));
154
136
  }
155
137
  static get is() { return "mg-modal"; }
156
138
  static get encapsulation() { return "shadow"; }
@@ -19,6 +19,12 @@
19
19
  outline: none;
20
20
  }
21
21
 
22
+ @media (prefers-reduced-motion) {
23
+ .mg-a11y-animation {
24
+ animation: none !important;
25
+ transition: none !important;
26
+ }
27
+ }
22
28
  .mg-pagination {
23
29
  display: flex;
24
30
  align-items: center;
@@ -25,19 +25,6 @@ import { initLocales } from './../../../locales';
25
25
  const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
26
26
  export class MgPagination {
27
27
  constructor() {
28
- /**
29
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
30
- * If not set, it will be created.
31
- */
32
- this.identifier = createID('mg-pagination');
33
- /**
34
- * Component total pages
35
- */
36
- this.totalPages = 1;
37
- /**
38
- * Component current page
39
- */
40
- this.currentPage = 1;
41
28
  /**
42
29
  * Change current page from target
43
30
  *
@@ -70,6 +57,10 @@ export class MgPagination {
70
57
  this.handleGoToPage = (action, disabled) => {
71
58
  !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
72
59
  };
60
+ this.identifier = createID('mg-pagination');
61
+ this.label = undefined;
62
+ this.totalPages = 1;
63
+ this.currentPage = 1;
73
64
  }
74
65
  validateTotalPages(newValue) {
75
66
  if (newValue < 1) {
@@ -1,8 +1,11 @@
1
- .mg-panel {
2
- background-color: hsl(var(--mg-panel-background));
3
- border-radius: var(--mg-panel-border-radius);
4
- box-shadow: var(--mg-panel-box-shadow);
5
- }
1
+ :host {
2
+ --mg-card-border: none;
3
+ --mg-card-padding: 0;
4
+ --mg-card-border-radius: var(--mg-panel-border-radius);
5
+ --mg-card-background: hsl(var(--mg-panel-background));
6
+ --mg-card-box-shadow: var(--mg-panel-box-shadow);
7
+ }
8
+
6
9
  .mg-panel__header {
7
10
  display: flex;
8
11
  flex-wrap: wrap;
@@ -17,6 +20,8 @@
17
20
  .mg-panel__header-right {
18
21
  padding-left: 0.3rem;
19
22
  flex: 1 auto;
23
+ min-height: var(--default-size);
24
+ align-items: center;
20
25
  }
21
26
  .mg-panel__header-left mg-input-text {
22
27
  flex-grow: 1;
@@ -3,27 +3,6 @@ import { createID, ClassList } from '../../../utils/components.utils';
3
3
  import { initLocales } from '../../../locales';
4
4
  export class MgPanel {
5
5
  constructor() {
6
- /**
7
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
8
- * If not set, it will be created.
9
- */
10
- this.identifier = createID('mg-panel');
11
- /**
12
- * Panel is opened
13
- */
14
- this.expanded = false;
15
- /**
16
- * Panel title is editabled
17
- */
18
- this.titleEditable = false;
19
- /**
20
- * Component classes
21
- */
22
- this.classList = new ClassList(['mg-panel']);
23
- /**
24
- * Title is in edition mode
25
- */
26
- this.isEditing = false;
27
6
  /************
28
7
  * Methods *
29
8
  ************/
@@ -108,6 +87,16 @@ export class MgPanel {
108
87
  }
109
88
  return collapseButton();
110
89
  };
90
+ this.identifier = createID('mg-panel');
91
+ this.panelTitle = undefined;
92
+ this.titlePattern = undefined;
93
+ this.titlePatternErrorMessage = undefined;
94
+ this.expanded = false;
95
+ this.expandToggleDisabled = undefined;
96
+ this.titleEditable = false;
97
+ this.classList = new ClassList(['mg-panel']);
98
+ this.isEditing = false;
99
+ this.updatedPanelTitle = undefined;
111
100
  }
112
101
  validatePanelTitle(newValue) {
113
102
  if (typeof newValue !== 'string' || newValue.trim() === '') {
@@ -158,7 +147,7 @@ export class MgPanel {
158
147
  * @returns {HTMLElement} html element
159
148
  */
160
149
  render() {
161
- 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))));
150
+ 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)))));
162
151
  }
163
152
  static get is() { return "mg-panel"; }
164
153
  static get encapsulation() { return "shadow"; }
@@ -1,19 +1,23 @@
1
- mg-popover {
1
+ :host {
2
+ --mg-card-padding: 1.5rem;
3
+ --mg-card-border: none;
4
+ --mg-card-border-radius: 0.5rem;
5
+ --mg-card-background: hsl(var(--mg-popover-background-color));
6
+ position: relative;
2
7
  display: contents;
3
8
  }
4
- mg-popover::slotted(*) {
9
+ :host::slotted(*) {
5
10
  display: inline-block;
6
11
  }
7
12
 
8
13
  .mg-popover {
9
14
  display: none;
10
- padding: 1.5rem;
11
- z-index: 1000;
12
- border-radius: 0.5rem;
13
- background-color: hsl(var(--mg-popover-background-color));
14
- box-shadow: var(--box-shadow);
15
+ z-index: 2000;
15
16
  color: hsl(var(--mg-popover-font-color));
16
17
  }
18
+ .mg-popover mg-card {
19
+ z-index: -1;
20
+ }
17
21
  .mg-popover[data-show] {
18
22
  display: block;
19
23
  }
@@ -27,8 +31,8 @@ mg-popover::slotted(*) {
27
31
  position: absolute;
28
32
  width: 2rem;
29
33
  height: 2rem;
30
- z-index: -1;
31
- background: inherit;
34
+ z-index: 2000;
35
+ background: hsl(var(--mg-popover-background-color));
32
36
  }
33
37
  .mg-popover__arrow {
34
38
  visibility: hidden;
@@ -5,27 +5,6 @@ import { initLocales } from '../../../locales';
5
5
  export class MgPopover {
6
6
  constructor() {
7
7
  this.closeButtonId = '';
8
- /**
9
- * Sets an `id` attribute.
10
- * Needed by the input for accessibility `aria-decribedby`.
11
- */
12
- this.identifier = createID('mg-popover');
13
- /**
14
- * Popover placement
15
- */
16
- this.placement = 'bottom';
17
- /**
18
- * Define if popover has a cross button
19
- */
20
- this.closeButton = false;
21
- /**
22
- * Display popover
23
- */
24
- this.display = false;
25
- /**
26
- * Disable popover
27
- */
28
- this.disabled = false;
29
8
  /**
30
9
  * Check if clicked outside of component
31
10
  *
@@ -76,6 +55,11 @@ export class MgPopover {
76
55
  this.handleCloseButton = () => {
77
56
  this.display = false;
78
57
  };
58
+ this.identifier = createID('mg-popover');
59
+ this.placement = 'bottom';
60
+ this.closeButton = false;
61
+ this.display = false;
62
+ this.disabled = false;
79
63
  }
80
64
  handleDisplay(newValue) {
81
65
  if (newValue) {
@@ -114,7 +98,7 @@ export class MgPopover {
114
98
  this.closeButtonId = `${this.identifier}-close-button`;
115
99
  }
116
100
  // Get popover content
117
- this.popover = this.element.shadowRoot.querySelector(`#${this.identifier}`);
101
+ this.popover = this.element.shadowRoot.getElementById(this.identifier);
118
102
  //Get interactive element (first element without slot attribute)
119
103
  const interactiveElement = this.element.querySelector(':not([slot])');
120
104
  // Add aria attributes
@@ -151,7 +135,7 @@ export class MgPopover {
151
135
  * @returns {HTMLElement} HTML Element
152
136
  */
153
137
  render() {
154
- return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" }), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
138
+ return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, h("mg-card", null, !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
155
139
  }
156
140
  static get is() { return "mg-popover"; }
157
141
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,24 @@
1
+ import { h } from '@stencil/core';
2
+ import { filterArgs } from '../../../../../.storybook/utils';
3
+ export default {
4
+ component: 'mg-skip-links',
5
+ title: 'Molecules/mg-skip-links',
6
+ parameters: { actions: { handles: ['expanded-change'] } },
7
+ };
8
+ /**
9
+ * Template
10
+ *
11
+ * @param {any} args component arguments
12
+ * @returns {HTMLElement} HTMLElement
13
+ */
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ const Template = (args) => h("mg-skip-links", Object.assign({}, filterArgs(args)));
16
+ export const MgSkipLinks = Template.bind({});
17
+ MgSkipLinks.args = {
18
+ links: [
19
+ { href: '#content', label: 'Content' },
20
+ { href: '#menu', label: 'Menu' },
21
+ { href: '#search', label: 'Search' },
22
+ { href: '#footer', label: 'Footer' },
23
+ ],
24
+ };
@@ -0,0 +1,28 @@
1
+ .mg-skip-links {
2
+ position: absolute;
3
+ transform: translateY(-100%);
4
+ opacity: 0;
5
+ background: hsl(var(--color-light));
6
+ }
7
+ .mg-skip-links:focus-within {
8
+ position: relative;
9
+ transform: translateY(0);
10
+ opacity: 1;
11
+ }
12
+ .mg-skip-links__list {
13
+ display: flex;
14
+ flex-wrap: wrap;
15
+ align-items: center;
16
+ gap: 0.6rem;
17
+ margin: 0;
18
+ padding: 0.64rem 1.8rem;
19
+ list-style: none;
20
+ }
21
+ .mg-skip-links__link {
22
+ display: inline-block;
23
+ padding: 1.2rem;
24
+ color: hsl(var(--color-dark));
25
+ }
26
+ .mg-skip-links__link:hover {
27
+ background: hsl(var(--color-dark), 0.1);
28
+ }
@@ -0,0 +1,77 @@
1
+ import { h } from '@stencil/core';
2
+ import { initLocales } from '../../../locales';
3
+ export class MgSkipLinks {
4
+ constructor() {
5
+ this.links = undefined;
6
+ }
7
+ validateLinks(links) {
8
+ if (links === undefined ||
9
+ links.length === 0 ||
10
+ links.some(link => link.href === undefined || !link.href.startsWith('#') || link.label === undefined || link.label.trim() === '')) {
11
+ throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
12
+ }
13
+ }
14
+ /*************
15
+ * Lifecycle *
16
+ *************/
17
+ /**
18
+ * Check if props are well configured on init
19
+ *
20
+ * @returns {void}
21
+ */
22
+ componentWillLoad() {
23
+ this.validateLinks(this.links);
24
+ this.messages = initLocales(this.element).messages;
25
+ }
26
+ /**
27
+ * Render
28
+ *
29
+ * @returns {HTMLElement} HTML Element
30
+ */
31
+ render() {
32
+ 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 }, link.label)))))));
33
+ }
34
+ static get is() { return "mg-skip-links"; }
35
+ static get encapsulation() { return "shadow"; }
36
+ static get originalStyleUrls() {
37
+ return {
38
+ "$": ["mg-skip-links.scss"]
39
+ };
40
+ }
41
+ static get styleUrls() {
42
+ return {
43
+ "$": ["mg-skip-links.css"]
44
+ };
45
+ }
46
+ static get properties() {
47
+ return {
48
+ "links": {
49
+ "type": "unknown",
50
+ "mutable": true,
51
+ "complexType": {
52
+ "original": "SkipLink[]",
53
+ "resolved": "SkipLink[]",
54
+ "references": {
55
+ "SkipLink": {
56
+ "location": "import",
57
+ "path": "./mg-skip-links.conf"
58
+ }
59
+ }
60
+ },
61
+ "required": false,
62
+ "optional": false,
63
+ "docs": {
64
+ "tags": [],
65
+ "text": "Skip links"
66
+ }
67
+ }
68
+ };
69
+ }
70
+ static get elementRef() { return "element"; }
71
+ static get watchers() {
72
+ return [{
73
+ "propName": "links",
74
+ "methodName": "validateLinks"
75
+ }];
76
+ }
77
+ }
@@ -13,31 +13,11 @@ export class MgTabs {
13
13
  /************
14
14
  * Internal *
15
15
  ************/
16
+ // classes
16
17
  this.tabPanel = 'panel';
17
- this.startIndex = 1;
18
18
  this.buttonTabBaseClass = 'mg-tabs__navigation-button';
19
- /**
20
- * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
21
- * If not set, it will be created.
22
- */
23
- this.identifier = createID('mg-tabs');
24
- /**
25
- * Define tabs size
26
- */
27
- this.size = 'regular';
28
- /**
29
- * Active tab number
30
- * default: first is 1
31
- */
32
- this.activeTab = 1;
33
- /**
34
- * Component tabs
35
- */
36
- this.tabs = [];
37
- /**
38
- * Component classes
39
- */
40
- this.classList = new ClassList(['mg-tabs']);
19
+ // variables
20
+ this.startIndex = 1;
41
21
  /**
42
22
  * Method to set active tab
43
23
  *
@@ -128,6 +108,13 @@ export class MgTabs {
128
108
  throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
129
109
  }
130
110
  };
111
+ this.identifier = createID('mg-tabs');
112
+ this.label = undefined;
113
+ this.size = 'regular';
114
+ this.items = undefined;
115
+ this.activeTab = 1;
116
+ this.tabs = [];
117
+ this.classList = new ClassList(['mg-tabs']);
131
118
  }
132
119
  validateLabel(newValue) {
133
120
  if (typeof newValue !== 'string' || newValue.trim() === '') {
@@ -40,6 +40,9 @@
40
40
  "panel": {
41
41
  "editLabel": "Edit section title."
42
42
  },
43
+ "skipLinks": {
44
+ "navLabel": "Quick access"
45
+ },
43
46
  "general": {
44
47
  "confirm": "Confirm",
45
48
  "cancel": "Cancel",
@@ -40,6 +40,9 @@
40
40
  "panel": {
41
41
  "editLabel": "Modifier le titre de la section."
42
42
  },
43
+ "skipLinks": {
44
+ "navLabel": "Accès rapide"
45
+ },
43
46
  "general": {
44
47
  "confirm": "Valider",
45
48
  "cancel": "Annuler",
@@ -25,6 +25,7 @@ export { MgModal as MgModal } from '../types/components/molecules/mg-modal/mg-mo
25
25
  export { MgPagination as MgPagination } from '../types/components/molecules/mg-pagination/mg-pagination';
26
26
  export { MgPanel as MgPanel } from '../types/components/molecules/mg-panel/mg-panel';
27
27
  export { MgPopover as MgPopover } from '../types/components/molecules/mg-popover/mg-popover';
28
+ export { MgSkipLinks as MgSkipLinks } from '../types/components/molecules/mg-skip-links/mg-skip-links';
28
29
  export { MgTabs as MgTabs } from '../types/components/molecules/mg-tabs/mg-tabs';
29
30
  export { MgTag as MgTag } from '../types/components/atoms/mg-tag/mg-tag';
30
31
  export { MgTooltip as MgTooltip } from '../types/components/atoms/mg-tooltip/mg-tooltip';
@@ -25,6 +25,7 @@ export { MgModal, defineCustomElement as defineCustomElementMgModal } from './mg
25
25
  export { MgPagination, defineCustomElement as defineCustomElementMgPagination } from './mg-pagination.js';
26
26
  export { MgPanel, defineCustomElement as defineCustomElementMgPanel } from './mg-panel.js';
27
27
  export { MgPopover, defineCustomElement as defineCustomElementMgPopover } from './mg-popover.js';
28
+ export { MgSkipLinks, defineCustomElement as defineCustomElementMgSkipLinks } from './mg-skip-links.js';
28
29
  export { MgTabs, defineCustomElement as defineCustomElementMgTabs } from './mg-tabs.js';
29
30
  export { MgTag, defineCustomElement as defineCustomElementMgTag } from './mg-tag.js';
30
31
  export { MgTooltip, defineCustomElement as defineCustomElementMgTooltip } from './mg-tooltip.js';
@@ -39,6 +39,9 @@ const pagination$1 = {
39
39
  const panel$1 = {
40
40
  editLabel: "Edit section title."
41
41
  };
42
+ const skipLinks$1 = {
43
+ navLabel: "Quick access"
44
+ };
42
45
  const general$1 = {
43
46
  confirm: "Confirm",
44
47
  cancel: "Cancel",
@@ -55,6 +58,7 @@ const en = {
55
58
  modal: modal$1,
56
59
  pagination: pagination$1,
57
60
  panel: panel$1,
61
+ skipLinks: skipLinks$1,
58
62
  general: general$1
59
63
  };
60
64
 
@@ -99,6 +103,9 @@ const pagination = {
99
103
  const panel = {
100
104
  editLabel: "Modifier le titre de la section."
101
105
  };
106
+ const skipLinks = {
107
+ navLabel: "Accès rapide"
108
+ };
102
109
  const general = {
103
110
  confirm: "Valider",
104
111
  cancel: "Annuler",
@@ -115,6 +122,7 @@ const fr = {
115
122
  modal: modal,
116
123
  pagination: pagination,
117
124
  panel: panel,
125
+ skipLinks: skipLinks,
118
126
  general: general
119
127
  };
120
128
 
@@ -6,7 +6,7 @@ import { C as ClassList } from './components.utils.js';
6
6
  */
7
7
  const variants = ['info', 'primary', 'secondary', 'success', 'warning', 'danger'];
8
8
 
9
- const mgBadgeCss = ".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}.mg-badge{padding:0 0.4rem;height:var(--mg-badge-size);min-width:var(--mg-badge-size);box-sizing:border-box;border:0.1rem solid;border-radius:calc(var(--mg-badge-size) / 2);font-size:var(--mg-badge-font-size);font-weight:600;text-align:center;line-height:var(--mg-badge-size)}.mg-badge.mg-badge--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-badge.mg-badge--primary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-badge.mg-badge--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-badge.mg-badge--success.mg-badge--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-badge.mg-badge--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-badge.mg-badge--warning.mg-badge--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-badge.mg-badge--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-badge.mg-badge--danger.mg-badge--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-badge.mg-badge--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-badge.mg-badge--info.mg-badge--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-badge,mg-badge{display:inline-flex;align-items:center;justify-content:center}";
9
+ const mgBadgeCss = ".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}}.mg-badge{padding:0 0.4rem;height:var(--mg-badge-size);min-width:var(--mg-badge-size);box-sizing:border-box;border:0.1rem solid;border-radius:calc(var(--mg-badge-size) / 2);font-size:var(--mg-badge-font-size);font-weight:600;text-align:center;line-height:var(--mg-badge-size)}.mg-badge.mg-badge--primary{background-color:hsl(var(--color-dark));border-color:hsl(var(--color-dark));color:hsl(var(--color-light))}.mg-badge.mg-badge--primary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary{background-color:hsl(var(--color-light));border-color:hsl(var(--color-light));color:hsl(var(--color-dark))}.mg-badge.mg-badge--secondary.mg-badge--outline{background-color:transparent;color:hsl(var(--color-light))}.mg-badge.mg-badge--success{background-color:hsl(var(--color-success));border-color:hsl(var(--color-success));color:hsl(var(--color-dark))}.mg-badge.mg-badge--success.mg-badge--outline{background-color:transparent;color:hsl(var(--color-success))}.mg-badge.mg-badge--warning{background-color:hsl(var(--color-warning));border-color:hsl(var(--color-warning));color:hsl(var(--color-dark))}.mg-badge.mg-badge--warning.mg-badge--outline{background-color:transparent;color:hsl(var(--color-warning))}.mg-badge.mg-badge--danger{background-color:hsl(var(--color-danger));border-color:hsl(var(--color-danger));color:hsl(var(--color-light))}.mg-badge.mg-badge--danger.mg-badge--outline{background-color:transparent;color:hsl(var(--color-danger))}.mg-badge.mg-badge--info{background-color:hsl(var(--color-info));border-color:hsl(var(--color-info));color:hsl(var(--color-light))}.mg-badge.mg-badge--info.mg-badge--outline{background-color:transparent;color:hsl(var(--color-info))}.mg-badge,mg-badge{display:inline-flex;align-items:center;justify-content:center}";
10
10
 
11
11
  const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
12
12
  constructor() {
@@ -18,17 +18,14 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
18
18
  ************/
19
19
  // Classes
20
20
  this.classOutline = `mg-badge--outline`;
21
- /**
22
- * Define button variant
23
- */
24
- this.variant = variants[0]; // info
25
- /**
26
- * Component classes
27
- */
21
+ this.value = undefined;
22
+ this.label = undefined;
23
+ this.variant = variants[0];
24
+ this.outline = undefined;
28
25
  this.classList = new ClassList(['mg-badge']);
29
26
  }
30
27
  validateValue(newValue) {
31
- if (`${newValue}`.match(/^(\d+|[?*!a-z])$/i) === null) {
28
+ if (`${newValue}`.match(/^(\d+\+*|[?*!a-z])$/i) === null) {
32
29
  throw new Error('<mg-badge> prop "value" must be interger or ponctuation character.');
33
30
  }
34
31
  }