@mgdis/mg-components 5.0.0 → 5.1.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 (72) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{mg-badge_24.cjs.entry.js → mg-badge_27.cjs.entry.js} +543 -64
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +2 -0
  5. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +1 -0
  6. package/dist/collection/components/atoms/mg-button/mg-button.css +8 -0
  7. package/dist/collection/components/atoms/mg-button/mg-button.js +39 -1
  8. package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +18 -0
  9. package/dist/collection/components/atoms/mg-card/mg-card.css +7 -0
  10. package/dist/collection/components/atoms/mg-card/mg-card.js +26 -0
  11. package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +18 -0
  12. package/dist/collection/components/atoms/mg-divider/mg-divider.css +9 -0
  13. package/dist/collection/components/atoms/mg-divider/mg-divider.js +57 -0
  14. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -5
  15. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -20
  16. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +1 -1
  17. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +2 -1
  18. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -0
  19. package/dist/collection/components/molecules/mg-details/mg-details.css +29 -0
  20. package/dist/collection/components/molecules/mg-details/mg-details.js +26 -4
  21. package/dist/collection/components/molecules/mg-modal/mg-modal.css +2 -1
  22. package/dist/collection/components/molecules/mg-modal/mg-modal.js +52 -4
  23. package/dist/collection/components/molecules/mg-panel/mg-panel.css +5 -14
  24. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -5
  25. package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
  26. package/dist/collection/components/molecules/mg-popover/mg-popover.js +3 -2
  27. package/dist/collection/utils/components.utils.js +10 -6
  28. package/dist/collection/variables.css +17 -2
  29. package/dist/components/components.utils.js +11 -7
  30. package/dist/components/index.d.ts +2 -0
  31. package/dist/components/index.js +2 -0
  32. package/dist/components/mg-button2.js +21 -2
  33. package/dist/components/mg-card.d.ts +11 -0
  34. package/dist/components/mg-card.js +42 -0
  35. package/dist/components/mg-details.js +8 -3
  36. package/dist/components/mg-divider.d.ts +11 -0
  37. package/dist/components/mg-divider.js +51 -0
  38. package/dist/components/mg-modal.js +53 -5
  39. package/dist/components/mg-panel.js +1 -1
  40. package/dist/components/mg-popover.js +3 -2
  41. package/dist/components/mg-tooltip2.js +2 -4
  42. package/dist/esm/loader.js +1 -1
  43. package/dist/esm/{mg-badge_24.entry.js → mg-badge_27.entry.js} +490 -14
  44. package/dist/esm/mg-components.js +1 -1
  45. package/dist/mg-components/mg-components.css +1 -1
  46. package/dist/mg-components/mg-components.esm.js +1 -1
  47. package/dist/mg-components/p-e131701a.entry.js +1 -0
  48. package/dist/mg-components/variables.css +17 -2
  49. package/dist/types/components/atoms/mg-button/mg-button.d.ts +6 -0
  50. package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +6 -0
  51. package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -0
  52. package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +6 -0
  53. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +15 -0
  54. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -6
  55. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -8
  56. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -1
  57. package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
  58. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +8 -0
  59. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -6
  60. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  61. package/dist/types/components.d.ts +55 -6
  62. package/dist/types/utils/components.utils.d.ts +7 -3
  63. package/package.json +4 -3
  64. package/dist/cjs/index-179621c8.js +0 -244
  65. package/dist/cjs/mg-modal.cjs.entry.js +0 -128
  66. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -20
  67. package/dist/esm/index-7efedd97.js +0 -238
  68. package/dist/esm/mg-modal.entry.js +0 -124
  69. package/dist/mg-components/p-5f89600c.js +0 -1
  70. package/dist/mg-components/p-b60a4c53.entry.js +0 -1
  71. package/dist/mg-components/p-df947fa5.entry.js +0 -1
  72. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -8
@@ -3,13 +3,101 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-94497267.js');
6
- const index$1 = require('./index-179621c8.js');
7
6
 
8
7
  /**
9
8
  * List of all possibles variants
10
9
  */
11
10
  const variants$4 = ['info', 'primary', 'secondary', 'success', 'warning', 'danger'];
12
11
 
12
+ /**
13
+ * Create random ID
14
+ *
15
+ * @param {string} prefix add prefix to created ID
16
+ * @param {number} length ID length
17
+ * @returns {string} ID
18
+ */
19
+ const createID = (prefix = '', length = 10) => {
20
+ let ID = '';
21
+ const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
22
+ const charsLength = chars.length;
23
+ for (let i = 0; i < length; i++) {
24
+ ID += chars.charAt(Math.floor(Math.random() * charsLength));
25
+ }
26
+ return (prefix !== '' ? `${prefix}-` : '') + ID;
27
+ };
28
+ /**
29
+ * Class to manage component classlist
30
+ * Set() are not working when imported in project
31
+ */
32
+ class ClassList {
33
+ constructor(classlist = []) {
34
+ /**
35
+ * Add class
36
+ *
37
+ * @param {string} className class name to add
38
+ * @returns {void}
39
+ */
40
+ this.add = (className) => {
41
+ if (!this.has(className)) {
42
+ this.classes.push(className);
43
+ }
44
+ };
45
+ /**
46
+ * Delete class
47
+ *
48
+ * @param {string} className class name to delete
49
+ * @returns {void}
50
+ */
51
+ this.delete = (className) => {
52
+ const index = this.classes.indexOf(className);
53
+ if (index > -1) {
54
+ this.classes.splice(index, 1);
55
+ }
56
+ };
57
+ /**
58
+ * Check if class exist in list
59
+ *
60
+ * @param {string} className class name to check
61
+ * @returns {boolean} class name is in the list
62
+ */
63
+ this.has = (className) => {
64
+ return this.classes.includes(className);
65
+ };
66
+ /**
67
+ * Join classes seperated by spaces
68
+ *
69
+ * @returns {string} joined values
70
+ */
71
+ this.join = () => {
72
+ return this.classes.join(' ');
73
+ };
74
+ this.classes = classlist;
75
+ }
76
+ }
77
+ /**
78
+ * Check if all items are string
79
+ *
80
+ * @param {string[]} items items to check
81
+ * @returns {boolean} all items are string
82
+ */
83
+ const allItemsAreString = (items) => {
84
+ return items && items.every(item => typeof item === 'string');
85
+ };
86
+ /**
87
+ * Check if element is a heading
88
+ *
89
+ * @param {Element} element slotted element
90
+ * @param {string[]} tagNames allowed tag names list
91
+ * @returns {boolean} element is a heading
92
+ */
93
+ const isTagName = (element, tagNames) => {
94
+ return tagNames.includes(element === null || element === void 0 ? void 0 : element.tagName.toLowerCase());
95
+ };
96
+ /**
97
+ * Focusable elements query selector
98
+ */
99
+ const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
100
+
13
101
  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}";
14
102
 
15
103
  const MgBadge = class {
@@ -27,7 +115,7 @@ const MgBadge = class {
27
115
  /**
28
116
  * Component classes
29
117
  */
30
- this.classList = new index$1.ClassList(['mg-badge']);
118
+ this.classList = new ClassList(['mg-badge']);
31
119
  }
32
120
  validateValue(newValue) {
33
121
  if (`${newValue}`.match(/^(\d+|[?*!a-z])$/i) === null) {
@@ -89,7 +177,7 @@ MgBadge.style = mgBadgeCss;
89
177
  */
90
178
  const variants$3 = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success'];
91
179
 
92
- const mgButtonCss = ":host{display:inline-block;vertical-align:middle;max-width:100%}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-button:not(.mg-button--disabled){outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:0.2rem}:host(:hover) .mg-button--flat:not(.mg-button--disabled),:host(:focus) .mg-button--flat:not(.mg-button--disabled),:host(:active) .mg-button--flat:not(.mg-button--disabled){background:hsla(var(--color-dark), 0.1)}.mg-button.mg-button--primary{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-primary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--primary:not(.mg-button--disabled),:host(:focus) .mg-button--primary:not(.mg-button--disabled),:host(:active) .mg-button--primary:not(.mg-button--disabled){background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-button.mg-button--secondary{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-secondary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--secondary:not(.mg-button--disabled),:host(:focus) .mg-button--secondary:not(.mg-button--disabled),:host(:active) .mg-button--secondary:not(.mg-button--disabled){background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-button.mg-button--danger{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger:not(.mg-button--disabled),:host(:focus) .mg-button--danger:not(.mg-button--disabled),:host(:active) .mg-button--danger:not(.mg-button--disabled){background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-danger));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger-alt:not(.mg-button--disabled),:host(:focus) .mg-button--danger-alt:not(.mg-button--disabled),:host(:active) .mg-button--danger-alt:not(.mg-button--disabled){background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--info:not(.mg-button--disabled),:host(:focus) .mg-button--info:not(.mg-button--disabled),:host(:active) .mg-button--info:not(.mg-button--disabled){background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--success{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-dark));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--success:not(.mg-button--disabled),:host(:focus) .mg-button--success:not(.mg-button--disabled),:host(:active) .mg-button--success:not(.mg-button--disabled){background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-button{position:relative;display:inline-flex;align-items:center;column-gap:0.6rem;padding:calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;min-height:var(--default-size);box-sizing:border-box;border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));cursor:pointer;background-image:none;border-top-width:var(--mg-button-border-top-width, 0.1rem);border-right-width:var(--mg-button-border-right-width, 0.1rem);border-bottom-width:var(--mg-button-border-bottom-width, 0.1rem);border-left-width:var(--mg-button-border-left-width, 0.1rem);border-style:solid;text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);touch-action:manipulation}.mg-button.mg-button--disabled{opacity:var(--mg-button-disabled-opacity);cursor:default}.mg-button.mg-button--icon{padding:0;justify-content:center;width:var(--default-size);height:var(--default-size);border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-button.mg-button--flat{background:none;border:none}.mg-button.mg-button--loading>mg-icon:first-of-type{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.mg-button.mg-button--loading .mg-button__content{opacity:0}.mg-button mg-icon:only-child,.mg-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;line-height:1;margin:auto 0}.mg-button slot,.mg-button ::slotted(*:not(mg-icon)){text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);display:flex;align-items:center;column-gap:0.6rem}";
180
+ const mgButtonCss = ":host{display:inline-block;vertical-align:middle;max-width:100%}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-button:not(.mg-button--disabled){outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:0.2rem}:host(:hover) .mg-button--flat:not(.mg-button--disabled),:host(:focus) .mg-button--flat:not(.mg-button--disabled),:host(:active) .mg-button--flat:not(.mg-button--disabled){background:hsla(var(--color-dark), 0.1)}:host([full-width]){display:block}.mg-button.mg-button--primary{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-primary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--primary:not(.mg-button--disabled),:host(:focus) .mg-button--primary:not(.mg-button--disabled),:host(:active) .mg-button--primary:not(.mg-button--disabled){background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-button.mg-button--secondary{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-secondary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--secondary:not(.mg-button--disabled),:host(:focus) .mg-button--secondary:not(.mg-button--disabled),:host(:active) .mg-button--secondary:not(.mg-button--disabled){background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-button.mg-button--danger{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger:not(.mg-button--disabled),:host(:focus) .mg-button--danger:not(.mg-button--disabled),:host(:active) .mg-button--danger:not(.mg-button--disabled){background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-danger));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger-alt:not(.mg-button--disabled),:host(:focus) .mg-button--danger-alt:not(.mg-button--disabled),:host(:active) .mg-button--danger-alt:not(.mg-button--disabled){background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--info:not(.mg-button--disabled),:host(:focus) .mg-button--info:not(.mg-button--disabled),:host(:active) .mg-button--info:not(.mg-button--disabled){background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--success{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-dark));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--success:not(.mg-button--disabled),:host(:focus) .mg-button--success:not(.mg-button--disabled),:host(:active) .mg-button--success:not(.mg-button--disabled){background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-button{position:relative;display:inline-flex;align-items:center;column-gap:0.6rem;padding:calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;min-height:var(--default-size);box-sizing:border-box;border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));cursor:pointer;background-image:none;border-top-width:var(--mg-button-border-top-width, 0.1rem);border-right-width:var(--mg-button-border-right-width, 0.1rem);border-bottom-width:var(--mg-button-border-bottom-width, 0.1rem);border-left-width:var(--mg-button-border-left-width, 0.1rem);border-style:solid;text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);touch-action:manipulation}.mg-button.mg-button--disabled{opacity:var(--mg-button-disabled-opacity);cursor:default}.mg-button.mg-button--icon{padding:0;justify-content:center;width:var(--default-size);height:var(--default-size);border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-button.mg-button--flat{background:none;border:none}.mg-button.mg-button--full-width{display:flex;justify-content:center}.mg-button.mg-button--loading>mg-icon:first-of-type{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.mg-button.mg-button--loading .mg-button__content{opacity:0}.mg-button mg-icon:only-child,.mg-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;line-height:1;margin:auto 0}.mg-button slot,.mg-button ::slotted(*:not(mg-icon)){text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);display:flex;align-items:center;column-gap:0.6rem}";
93
181
 
94
182
  const MgButton = class {
95
183
  constructor(hostRef) {
@@ -100,10 +188,15 @@ const MgButton = class {
100
188
  this.onClickElementFn = null;
101
189
  this.classDisabled = 'mg-button--disabled';
102
190
  this.classLoading = 'mg-button--loading';
191
+ this.classFullWidth = 'mg-button--full-width';
103
192
  /**
104
193
  * Define button variant
105
194
  */
106
195
  this.variant = variants$3[0]; // Primary
196
+ /**
197
+ * Set button to full-width
198
+ */
199
+ this.fullWidth = false;
107
200
  /**
108
201
  * Define if button is round.
109
202
  * Used for icon button.
@@ -123,7 +216,7 @@ const MgButton = class {
123
216
  /**
124
217
  * Component classes
125
218
  */
126
- this.classList = new index$1.ClassList(['mg-button']);
219
+ this.classList = new ClassList(['mg-button']);
127
220
  /**
128
221
  * Trigger actions onClick event
129
222
  *
@@ -178,6 +271,17 @@ const MgButton = class {
178
271
  this.classList.add(`mg-button--${newValue}`);
179
272
  }
180
273
  }
274
+ validateFullWidth(newValue) {
275
+ if (newValue && this.isIcon) {
276
+ throw new Error('<mg-button> prop "fullWidth" cannot be used with prop "isIcon".');
277
+ }
278
+ else if (newValue) {
279
+ this.classList.add(this.classFullWidth);
280
+ }
281
+ else {
282
+ this.classList.delete(this.classFullWidth);
283
+ }
284
+ }
181
285
  disabledHandler(isDisabled) {
182
286
  // Remove loading when enable
183
287
  // Will be set back onclick
@@ -210,6 +314,7 @@ const MgButton = class {
210
314
  */
211
315
  componentWillLoad() {
212
316
  this.validateVariant(this.variant);
317
+ this.validateFullWidth(this.fullWidth);
213
318
  if (this.isIcon) {
214
319
  this.classList.add(`mg-button--icon`);
215
320
  if (typeof this.label !== 'string' || this.label.trim() === '') {
@@ -226,17 +331,190 @@ const MgButton = class {
226
331
  * @returns {HTMLElement} html element
227
332
  */
228
333
  render() {
229
- return (index.h(index.Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyUp: this.handleKeyup, onKeyDown: this.handleKeydown }, index.h("div", { class: this.classList.join(), id: this.identifier }, this.loading && index.h("mg-icon", { icon: "loader", spin: true }), index.h("div", { class: "mg-button__content" }, index.h("slot", null)))));
334
+ return (index.h(index.Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyUp: this.handleKeyup, onKeyDown: this.handleKeydown }, index.h("div", { class: this.classList.join(), id: this.identifier }, this.loading && index.h("mg-icon", { icon: "loader", spin: true }), index.h("div", { class: "mg-button__content" }, index.h("slot", null)))));
230
335
  }
231
336
  get element() { return index.getElement(this); }
232
337
  static get watchers() { return {
233
338
  "variant": ["validateVariant"],
339
+ "fullWidth": ["validateFullWidth"],
234
340
  "disabled": ["disabledHandler"],
235
341
  "loading": ["loadingHandler"]
236
342
  }; }
237
343
  };
238
344
  MgButton.style = mgButtonCss;
239
345
 
346
+ const mgCardCss = ".mg-card{padding:var(--mg-card-padding);border-radius:var(--mg-card-border-radius);background:var(--mg-card-background);border:var(--mg-card-border);box-shadow:var(--mg-card-box-shadow)}";
347
+
348
+ const MgCard = class {
349
+ constructor(hostRef) {
350
+ index.registerInstance(this, hostRef);
351
+ }
352
+ /*************
353
+ * Lifecycle *
354
+ *************/
355
+ /**
356
+ * Render
357
+ *
358
+ * @returns {HTMLElement} HTML Element
359
+ */
360
+ render() {
361
+ return (index.h("div", { class: "mg-card" }, index.h("slot", null)));
362
+ }
363
+ };
364
+ MgCard.style = mgCardCss;
365
+
366
+ const errors$1 = {
367
+ required: "This field is required.",
368
+ date: {
369
+ badInput: "The date format must be <span aria-hidden=\"true\">mm/dd/yyyy</span><span class=\"sr-only\">m m / d d / y y y y</span> and the date must be greater than {min}",
370
+ min: "The date cannot be earlier than {min}",
371
+ max: "The date cannot be later than {max}",
372
+ minMax: "The date must be between {min} and {max}"
373
+ },
374
+ numeric: {
375
+ min: "The value cannot be less than {min}",
376
+ max: "The value cannot be greater than {max}",
377
+ minMax: "The value must be between {min} et {max}"
378
+ }
379
+ };
380
+ const nbCharLeft$1 = "{counter} characters left.";
381
+ const input$1 = {
382
+ select: {
383
+ placeholder: "Select a value"
384
+ }
385
+ };
386
+ const form$1 = {
387
+ required: "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
388
+ allRequired: "All fields are required"
389
+ };
390
+ const message$1 = {
391
+ closeButton: "Close message"
392
+ };
393
+ const modal$1 = {
394
+ closeButton: "Close modal"
395
+ };
396
+ const pagination$1 = {
397
+ label: "Pagination",
398
+ page: "page",
399
+ pages: "pages",
400
+ nextPage: "Next page",
401
+ previousPage: "Previous page",
402
+ selectPage: "Select the page to display."
403
+ };
404
+ const panel$1 = {
405
+ editLabel: "Edit section title."
406
+ };
407
+ const general$1 = {
408
+ confirm: "Confirm",
409
+ cancel: "Cancel",
410
+ close: "Close",
411
+ next: "next",
412
+ previous: "previous"
413
+ };
414
+ const en = {
415
+ errors: errors$1,
416
+ nbCharLeft: nbCharLeft$1,
417
+ input: input$1,
418
+ form: form$1,
419
+ message: message$1,
420
+ modal: modal$1,
421
+ pagination: pagination$1,
422
+ panel: panel$1,
423
+ general: general$1
424
+ };
425
+
426
+ const errors = {
427
+ required: "Ce champ est obligatoire.",
428
+ date: {
429
+ badInput: "Le format de la date doit être du type <span aria-hidden=\"true\">jj/mm/aaaa</span><span class=\"sr-only\">j j / m m / a a a a</span> et la date supérieure au {min}",
430
+ min: "La date ne peut pas être antérieure au {min}",
431
+ max: "La date ne peut pas être postérieure au {max}",
432
+ minMax: "La date doit être comprise entre le {min} et le {max}"
433
+ },
434
+ numeric: {
435
+ min: "La valeur ne peut pas être inférieure à {min}",
436
+ max: "La valeur ne peut pas être supérieure à {max}",
437
+ minMax: "La valeur doit être comprise entre {min} et {max}"
438
+ }
439
+ };
440
+ const nbCharLeft = "{counter} caractères disponibles.";
441
+ const input = {
442
+ select: {
443
+ placeholder: "Sélectionnez une valeur"
444
+ }
445
+ };
446
+ const form = {
447
+ required: "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
448
+ allRequired: "Tous les champs sont obligatoires"
449
+ };
450
+ const message = {
451
+ closeButton: "Fermer le message"
452
+ };
453
+ const modal = {
454
+ closeButton: "Fermer la modale"
455
+ };
456
+ const pagination = {
457
+ label: "Pagination",
458
+ page: "page",
459
+ pages: "pages",
460
+ nextPage: "Page suivante",
461
+ previousPage: "Page précédente",
462
+ selectPage: "Sélectionner la page à afficher."
463
+ };
464
+ const panel = {
465
+ editLabel: "Modifier le titre de la section."
466
+ };
467
+ const general = {
468
+ confirm: "Valider",
469
+ cancel: "Annuler",
470
+ close: "Fermer",
471
+ next: "suivant",
472
+ previous: "précédent"
473
+ };
474
+ const fr = {
475
+ errors: errors,
476
+ nbCharLeft: nbCharLeft,
477
+ input: input,
478
+ form: form,
479
+ message: message,
480
+ modal: modal,
481
+ pagination: pagination,
482
+ panel: panel,
483
+ general: general
484
+ };
485
+
486
+ const defaultLocale = 'en';
487
+ const messages = { en, fr };
488
+ /**
489
+ * Get locale
490
+ *
491
+ * @param {HTMLElement} element element that needs to know the locale to use
492
+ * @returns {string} locale
493
+ */
494
+ const getLocale = (element) => {
495
+ var _a;
496
+ return ((_a = element.closest('[lang]')) === null || _a === void 0 ? void 0 : _a.lang) || navigator.language || defaultLocale;
497
+ };
498
+ /**
499
+ * Get Intl object
500
+ * We load the defined locale but for now we only support the first subtag for messages
501
+ *
502
+ * @param {HTMLElement} element element we need to get the language
503
+ * @returns {{ locale: string; messages: unknown }} messages object
504
+ */
505
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
506
+ const initLocales = (element) => {
507
+ // Get local
508
+ const locale = getLocale(element);
509
+ // Only keep first subtag
510
+ const localeSubtag = locale.split('-').shift();
511
+ // Return
512
+ return {
513
+ locale,
514
+ messages: messages[localeSubtag] || messages[defaultLocale],
515
+ };
516
+ };
517
+
240
518
  const mgCharacterLeftCss = "mg-character-left.sc-mg-character-left{display:block}";
241
519
 
242
520
  const MgCharacterLeft = class {
@@ -262,7 +540,7 @@ const MgCharacterLeft = class {
262
540
  */
263
541
  componentWillLoad() {
264
542
  this.validateMaxlength(this.maxlength);
265
- this.messages = index$1.initLocales(this.element).messages;
543
+ this.messages = initLocales(this.element).messages;
266
544
  }
267
545
  /**
268
546
  * Render component
@@ -279,12 +557,16 @@ const MgCharacterLeft = class {
279
557
  };
280
558
  MgCharacterLeft.style = mgCharacterLeftCss;
281
559
 
282
- const mgDetailsCss = ".mg-details summary{display:flex;align-items:baseline;cursor:pointer}.mg-details__toggle{margin-left:1.5rem;flex-shrink:0}.mg-details__details{margin-top:1.5rem}";
560
+ const mgDetailsCss = ".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-details summary{display:flex;align-items:baseline;cursor:pointer}.mg-details__toggle{margin-left:1.5rem;flex-shrink:0;display:flex;align-items:center;align-self:flex-start;gap:0.6rem;min-height:calc(var(--font-size) * var(--line-height))}.mg-details__toggle mg-icon{align-self:self-end}.mg-details__details{margin-top:1.5rem}";
283
561
 
284
562
  const MgDetails = class {
285
563
  constructor(hostRef) {
286
564
  index.registerInstance(this, hostRef);
287
565
  this.expandedChange = index.createEvent(this, "expanded-change", 7);
566
+ /**
567
+ * Hide summary element
568
+ */
569
+ this.hideSummary = false;
288
570
  /**
289
571
  * Define if details are diplayed
290
572
  */
@@ -299,7 +581,7 @@ const MgDetails = class {
299
581
  };
300
582
  }
301
583
  validateTitles(newValue) {
302
- if (newValue === undefined || newValue === '') {
584
+ if (newValue === undefined || newValue.trim() === '') {
303
585
  throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
304
586
  }
305
587
  }
@@ -324,7 +606,7 @@ const MgDetails = class {
324
606
  * @returns {HTMLElement} HTML Element
325
607
  */
326
608
  render() {
327
- return (index.h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, index.h("summary", null, index.h("slot", { name: "summary" }), index.h("span", { class: "mg-details__toggle" }, index.h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), " ", this.expanded ? this.toggleOpened : this.toggleClosed)), index.h("div", { class: "mg-details__details" }, index.h("slot", { name: "details" }))));
609
+ return (index.h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, index.h("summary", null, index.h("slot", { name: "summary" }), index.h("span", { class: "mg-details__toggle" }, index.h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), index.h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), index.h("div", { class: "mg-details__details" }, index.h("slot", { name: "details" }))));
328
610
  }
329
611
  static get watchers() { return {
330
612
  "toggleClosed": ["validateTitles"],
@@ -334,6 +616,33 @@ const MgDetails = class {
334
616
  };
335
617
  MgDetails.style = mgDetailsCss;
336
618
 
619
+ const mgDividerCss = ".mg-divider{margin:var(--mg-divider-vertical-spacing) auto;width:12rem;height:var(--mg-divider-thickness);background-color:var(--mg-divider-background-color)}.mg-divider.mg-divider--full{width:100%}";
620
+
621
+ const MgDivider = class {
622
+ constructor(hostRef) {
623
+ index.registerInstance(this, hostRef);
624
+ /**************
625
+ * Decorators *
626
+ **************/
627
+ /**
628
+ * Define component size
629
+ */
630
+ this.size = 'regular';
631
+ }
632
+ /**
633
+ * Render
634
+ *
635
+ * @returns {HTMLElement} HTML Element
636
+ */
637
+ render() {
638
+ return (index.h("div", { class: {
639
+ 'mg-divider': true,
640
+ 'mg-divider--full': this.size === 'full',
641
+ } }));
642
+ }
643
+ };
644
+ MgDivider.style = mgDividerCss;
645
+
337
646
  const mgFormCss = ".is-asterisk{color:hsl(var(--color-danger))}.mg-form,.mg-form-group{--mg-inputs-title-width:var(--mg-form-inputs-title-width, 15rem);--mg-inputs-margin-bottom:1.5rem;--mg-inputs-title-horizontal-space:3rem;--mg-inputs-shrink:0}.mg-form.mg-form--all-required,.mg-form-group.mg-form--all-required{--mg-input-title-display:none}.mg-form>p,.mg-form-group>p{font-size:1.2rem}";
338
647
 
339
648
  const MgForm = class {
@@ -345,7 +654,7 @@ const MgForm = class {
345
654
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
346
655
  * If not set, it will be created.
347
656
  */
348
- this.identifier = index$1.createID('mg-form');
657
+ this.identifier = createID('mg-form');
349
658
  /**
350
659
  * Input name
351
660
  * If not set the value equals the identifier
@@ -362,7 +671,7 @@ const MgForm = class {
362
671
  /**
363
672
  * Component classes
364
673
  */
365
- this.classList = new index$1.ClassList(['mg-form']);
674
+ this.classList = new ClassList(['mg-form']);
366
675
  /**
367
676
  * Define required message based on mg-inputs required elements
368
677
  * Also
@@ -422,7 +731,7 @@ const MgForm = class {
422
731
  */
423
732
  componentWillLoad() {
424
733
  // Get locales
425
- this.messages = index$1.initLocales(this.element).messages;
734
+ this.messages = initLocales(this.element).messages;
426
735
  // Get slotted mgInputs
427
736
  this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT-'));
428
737
  // Get slotted mgButtons
@@ -659,7 +968,7 @@ const MgIcon = class {
659
968
  /**
660
969
  * Component classes
661
970
  */
662
- this.classList = new index$1.ClassList(['mg-icon']);
971
+ this.classList = new ClassList(['mg-icon']);
663
972
  /**
664
973
  * getIcon
665
974
  *
@@ -761,10 +1070,10 @@ const MgIllustratedMessage = class {
761
1070
  componentDidLoad() {
762
1071
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
763
1072
  const imageTags = ['img', 'svg'];
764
- if (!index$1.isTagName(this.element.querySelector('[slot="title"]'), headingTags)) {
1073
+ if (!isTagName(this.element.querySelector('[slot="title"]'), headingTags)) {
765
1074
  throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
766
1075
  }
767
- else if (!index$1.isTagName(this.element.querySelector('[slot="illustration"]'), imageTags)) {
1076
+ else if (!isTagName(this.element.querySelector('[slot="illustration"]'), imageTags)) {
768
1077
  throw new Error(`<mg-illustrated-message> Slotted illustration must be an image: ${imageTags.join(', ')}`);
769
1078
  }
770
1079
  }
@@ -962,7 +1271,7 @@ const MgInputCheckbox = class {
962
1271
  /**
963
1272
  * Component classes
964
1273
  */
965
- this.classList = new index$1.ClassList(['mg-input--checkbox']);
1274
+ this.classList = new ClassList(['mg-input--checkbox']);
966
1275
  /**
967
1276
  * Formated value for display
968
1277
  */
@@ -1054,7 +1363,7 @@ const MgInputCheckbox = class {
1054
1363
  */
1055
1364
  componentWillLoad() {
1056
1365
  // Get locales
1057
- this.messages = index$1.initLocales(this.element).messages;
1366
+ this.messages = initLocales(this.element).messages;
1058
1367
  // Validate
1059
1368
  this.validateValue(this.value);
1060
1369
  // Check validity when component is ready
@@ -1163,7 +1472,7 @@ const MgInputDate = class {
1163
1472
  /**
1164
1473
  * Component classes
1165
1474
  */
1166
- this.classList = new index$1.ClassList(['mg-input--date']);
1475
+ this.classList = new ClassList(['mg-input--date']);
1167
1476
  /**
1168
1477
  * Handle input event
1169
1478
  */
@@ -1287,7 +1596,7 @@ const MgInputDate = class {
1287
1596
  */
1288
1597
  componentWillLoad() {
1289
1598
  // Get locales
1290
- const locales = index$1.initLocales(this.element);
1599
+ const locales = initLocales(this.element);
1291
1600
  this.locale = locales.locale;
1292
1601
  this.messages = locales.messages;
1293
1602
  // Validate
@@ -1381,7 +1690,7 @@ const MgInputNumeric = class {
1381
1690
  /**
1382
1691
  * Component classes
1383
1692
  */
1384
- this.classList = new index$1.ClassList(['mg-input--numeric']);
1693
+ this.classList = new ClassList(['mg-input--numeric']);
1385
1694
  /**
1386
1695
  * Define if input has focus
1387
1696
  */
@@ -1577,7 +1886,7 @@ const MgInputNumeric = class {
1577
1886
  */
1578
1887
  componentWillLoad() {
1579
1888
  // Get locales
1580
- const locales = index$1.initLocales(this.element);
1889
+ const locales = initLocales(this.element);
1581
1890
  this.locale = locales.locale;
1582
1891
  this.messages = locales.messages;
1583
1892
  // Validate
@@ -1648,7 +1957,7 @@ const MgInputPassword = class {
1648
1957
  /**
1649
1958
  * Component classes
1650
1959
  */
1651
- this.classList = new index$1.ClassList(['mg-input--password']);
1960
+ this.classList = new ClassList(['mg-input--password']);
1652
1961
  /**
1653
1962
  * Handle input event
1654
1963
  */
@@ -1713,7 +2022,7 @@ const MgInputPassword = class {
1713
2022
  */
1714
2023
  componentWillLoad() {
1715
2024
  // Get locales
1716
- this.messages = index$1.initLocales(this.element).messages;
2025
+ this.messages = initLocales(this.element).messages;
1717
2026
  // Check validity when component is ready
1718
2027
  // return a promise to process action only in the FIRST render().
1719
2028
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
@@ -1787,7 +2096,7 @@ const MgInputRadio = class {
1787
2096
  /**
1788
2097
  * Component classes
1789
2098
  */
1790
- this.classList = new index$1.ClassList(['mg-input--radio']);
2099
+ this.classList = new ClassList(['mg-input--radio']);
1791
2100
  /**
1792
2101
  * Handle input event
1793
2102
  *
@@ -1851,7 +2160,7 @@ const MgInputRadio = class {
1851
2160
  throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
1852
2161
  }
1853
2162
  // String array
1854
- else if (index$1.allItemsAreString(newValue)) {
2163
+ else if (allItemsAreString(newValue)) {
1855
2164
  this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
1856
2165
  }
1857
2166
  // Object array
@@ -1881,7 +2190,7 @@ const MgInputRadio = class {
1881
2190
  */
1882
2191
  componentWillLoad() {
1883
2192
  // Get locales
1884
- this.messages = index$1.initLocales(this.element).messages;
2193
+ this.messages = initLocales(this.element).messages;
1885
2194
  // Validate
1886
2195
  this.validateItems(this.items);
1887
2196
  // Check validity when component is ready
@@ -1984,7 +2293,7 @@ const MgInputSelect = class {
1984
2293
  /**
1985
2294
  * Component classes
1986
2295
  */
1987
- this.classList = new index$1.ClassList(['mg-input--select']);
2296
+ this.classList = new ClassList(['mg-input--select']);
1988
2297
  /**
1989
2298
  * Handle input event
1990
2299
  */
@@ -1994,7 +2303,7 @@ const MgInputSelect = class {
1994
2303
  this.checkError();
1995
2304
  }
1996
2305
  if (this.input.value !== '') {
1997
- this.value = index$1.allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.title === this.input.value).value;
2306
+ this.value = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.title === this.input.value).value;
1998
2307
  }
1999
2308
  else {
2000
2309
  this.value = null;
@@ -2032,7 +2341,7 @@ const MgInputSelect = class {
2032
2341
  }
2033
2342
  handleValue(newValue) {
2034
2343
  if (newValue !== null) {
2035
- this.readonlyValue = index$1.allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.value === newValue).title;
2344
+ this.readonlyValue = allItemsAreString(this.items) ? this.input.value : this.items.find(item => item.value === newValue).title;
2036
2345
  }
2037
2346
  else {
2038
2347
  this.readonlyValue = null;
@@ -2041,7 +2350,7 @@ const MgInputSelect = class {
2041
2350
  }
2042
2351
  validateItems(newValue) {
2043
2352
  // String array
2044
- if (index$1.allItemsAreString(newValue)) {
2353
+ if (allItemsAreString(newValue)) {
2045
2354
  this.valueExist = newValue.includes(this.value);
2046
2355
  this.options = newValue.map((item) => ({ title: item, value: item }));
2047
2356
  }
@@ -2081,7 +2390,7 @@ const MgInputSelect = class {
2081
2390
  */
2082
2391
  componentWillLoad() {
2083
2392
  // Get locales
2084
- this.messages = index$1.initLocales(this.element).messages;
2393
+ this.messages = initLocales(this.element).messages;
2085
2394
  // Validate
2086
2395
  this.validateItems(this.items);
2087
2396
  // Set default placeholder
@@ -2168,7 +2477,7 @@ const MgInputText = class {
2168
2477
  /**
2169
2478
  * Component classes
2170
2479
  */
2171
- this.classList = new index$1.ClassList(['mg-input--text']);
2480
+ this.classList = new ClassList(['mg-input--text']);
2172
2481
  /**
2173
2482
  * Handle input event
2174
2483
  *
@@ -2188,7 +2497,7 @@ const MgInputText = class {
2188
2497
  */
2189
2498
  this.handleFocus = () => {
2190
2499
  this.classList.add(this.classFocus);
2191
- this.classList = new index$1.ClassList(this.classList.classes);
2500
+ this.classList = new ClassList(this.classList.classes);
2192
2501
  };
2193
2502
  /**
2194
2503
  * Handle blur event
@@ -2198,7 +2507,7 @@ const MgInputText = class {
2198
2507
  this.handleBlur = () => {
2199
2508
  // Manage focus
2200
2509
  this.classList.delete(this.classFocus);
2201
- this.classList = new index$1.ClassList(this.classList.classes);
2510
+ this.classList = new ClassList(this.classList.classes);
2202
2511
  // Display Error
2203
2512
  this.displayError();
2204
2513
  };
@@ -2302,7 +2611,7 @@ const MgInputText = class {
2302
2611
  */
2303
2612
  componentWillLoad() {
2304
2613
  // Get locales
2305
- this.messages = index$1.initLocales(this.element).messages;
2614
+ this.messages = initLocales(this.element).messages;
2306
2615
  this.characterLeftId = `${this.identifier}-character-left`;
2307
2616
  // Validate
2308
2617
  this.validateIcon(this.icon);
@@ -2394,7 +2703,7 @@ const MgInputTextarea = class {
2394
2703
  /**
2395
2704
  * Component classes
2396
2705
  */
2397
- this.classList = new index$1.ClassList(['mg-input--textarea']);
2706
+ this.classList = new ClassList(['mg-input--textarea']);
2398
2707
  /**
2399
2708
  * Handle input event
2400
2709
  */
@@ -2410,7 +2719,7 @@ const MgInputTextarea = class {
2410
2719
  */
2411
2720
  this.handleFocus = () => {
2412
2721
  this.classList.add(this.classFocus);
2413
- this.classList = new index$1.ClassList(this.classList.classes);
2722
+ this.classList = new ClassList(this.classList.classes);
2414
2723
  };
2415
2724
  /**
2416
2725
  * Handle blur event
@@ -2418,7 +2727,7 @@ const MgInputTextarea = class {
2418
2727
  this.handleBlur = () => {
2419
2728
  // Manage focus
2420
2729
  this.classList.delete(this.classFocus);
2421
- this.classList = new index$1.ClassList(this.classList.classes);
2730
+ this.classList = new ClassList(this.classList.classes);
2422
2731
  // Display Error
2423
2732
  this.displayError();
2424
2733
  };
@@ -2501,7 +2810,7 @@ const MgInputTextarea = class {
2501
2810
  */
2502
2811
  componentWillLoad() {
2503
2812
  // Get locales
2504
- this.messages = index$1.initLocales(this.element).messages;
2813
+ this.messages = initLocales(this.element).messages;
2505
2814
  this.characterLeftId = `${this.identifier}-character-left`;
2506
2815
  // Validate
2507
2816
  this.validateDisplayCharacterLeft(this.displayCharacterLeft);
@@ -2635,7 +2944,7 @@ const MgInputToggle = class {
2635
2944
  /**
2636
2945
  * Component classes
2637
2946
  */
2638
- this.classList = new index$1.ClassList(['mg-input--toggle']);
2947
+ this.classList = new ClassList(['mg-input--toggle']);
2639
2948
  /**
2640
2949
  * Checked internal value
2641
2950
  */
@@ -2676,7 +2985,7 @@ const MgInputToggle = class {
2676
2985
  throw new Error('<mg-input-toggle> prop "items" require 2 items.');
2677
2986
  }
2678
2987
  // String array
2679
- else if (index$1.allItemsAreString(newValue)) {
2988
+ else if (allItemsAreString(newValue)) {
2680
2989
  this.options = newValue.map(item => ({ title: item, value: item }));
2681
2990
  }
2682
2991
  // Object array
@@ -2809,7 +3118,7 @@ const MgMessage = class {
2809
3118
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
2810
3119
  * If not set, it will be created.
2811
3120
  */
2812
- this.identifier = index$1.createID('mg-message');
3121
+ this.identifier = createID('mg-message');
2813
3122
  /**
2814
3123
  * Message variant
2815
3124
  */
@@ -2826,7 +3135,7 @@ const MgMessage = class {
2826
3135
  /**
2827
3136
  * Component classes
2828
3137
  */
2829
- this.classList = new index$1.ClassList(['mg-message']);
3138
+ this.classList = new ClassList(['mg-message']);
2830
3139
  /**
2831
3140
  * Define if component is using actions slot
2832
3141
  */
@@ -2907,7 +3216,7 @@ const MgMessage = class {
2907
3216
  */
2908
3217
  componentWillLoad() {
2909
3218
  // Get locales
2910
- this.messages = index$1.initLocales(this.element).messages;
3219
+ this.messages = initLocales(this.element).messages;
2911
3220
  // Validate
2912
3221
  this.validateVariant(this.variant);
2913
3222
  // Check if close button is an can be activated
@@ -2938,6 +3247,174 @@ const MgMessage = class {
2938
3247
  };
2939
3248
  MgMessage.style = mgMessageCss;
2940
3249
 
3250
+ 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}";
3251
+
3252
+ const MgModal = class {
3253
+ constructor(hostRef) {
3254
+ index.registerInstance(this, hostRef);
3255
+ this.componentShow = index.createEvent(this, "component-show", 7);
3256
+ this.componentHide = index.createEvent(this, "component-hide", 7);
3257
+ // Classes
3258
+ this.classHide = 'mg-modal--hide';
3259
+ // IDs
3260
+ this.closeButtonId = '';
3261
+ this.titleId = '';
3262
+ /**
3263
+ * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
3264
+ * If not set, it will be created.
3265
+ */
3266
+ this.identifier = createID('mg-modal');
3267
+ /**
3268
+ * Define if modal has a cross button
3269
+ */
3270
+ this.closeButton = false;
3271
+ /**
3272
+ * Define if modal is hidden
3273
+ */
3274
+ this.hide = false;
3275
+ /**
3276
+ * Define if component is using actions slot
3277
+ */
3278
+ this.hasActions = false;
3279
+ /**
3280
+ * Define if component is using content slot
3281
+ */
3282
+ this.hasContent = false;
3283
+ /**
3284
+ * Component classes
3285
+ */
3286
+ this.classList = new ClassList(['mg-modal']);
3287
+ this.setFocus = () => {
3288
+ // Get all focusable elements
3289
+ this.modalFocusableElements = Array.from(this.element.querySelectorAll(focusableElements)).reduce((acc, focusableElement) => {
3290
+ acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(focusableElements) || focusableElement : focusableElement);
3291
+ return acc;
3292
+ }, []);
3293
+ // When close button is enabled it's the first focusable element.
3294
+ if (this.closeButton) {
3295
+ this.modalFocusableElements.unshift(this.element.shadowRoot.querySelector(`.mg-modal__close-button mg-button`));
3296
+ }
3297
+ // It at least one
3298
+ if (this.modalFocusableElements.length >= 1) {
3299
+ // Set focus on first element
3300
+ this.modalFocusableElements[0].focus();
3301
+ // Add event listener on last element
3302
+ const lastFocusableElement = this.modalFocusableElements[this.modalFocusableElements.length - 1];
3303
+ lastFocusableElement.addEventListener('keydown', event => {
3304
+ if (event.key === 'Tab' && !event.shiftKey) {
3305
+ event.preventDefault();
3306
+ this.modalFocusableElements[0].focus();
3307
+ }
3308
+ });
3309
+ // Add event listener on first element (case shift + tab)
3310
+ this.modalFocusableElements[0].addEventListener('keydown', event => {
3311
+ if (event.key === 'Tab' && event.shiftKey) {
3312
+ event.preventDefault();
3313
+ lastFocusableElement.focus();
3314
+ }
3315
+ });
3316
+ }
3317
+ };
3318
+ /*************
3319
+ * Handlers *
3320
+ *************/
3321
+ /**
3322
+ * Handle close button
3323
+ *
3324
+ * @returns {void}
3325
+ */
3326
+ this.handleClose = () => {
3327
+ this.hide = true;
3328
+ };
3329
+ }
3330
+ validateModalTitle(newValue) {
3331
+ if (typeof newValue !== 'string' || newValue.trim() === '') {
3332
+ throw new Error('<mg-modal> prop "modalTitle" is required.');
3333
+ }
3334
+ }
3335
+ validateHide(newValue) {
3336
+ if (newValue) {
3337
+ this.componentHide.emit();
3338
+ this.classList.add(this.classHide);
3339
+ document.body.style.overflow = this.bodyOverflow;
3340
+ }
3341
+ else {
3342
+ this.componentShow.emit();
3343
+ this.classList.delete(this.classHide);
3344
+ document.body.style.overflow = 'hidden';
3345
+ }
3346
+ }
3347
+ /**
3348
+ * Handle 'escape' key down
3349
+ *
3350
+ * @param {KeyboardEvent} event keydown event
3351
+ * @returns {void}
3352
+ */
3353
+ handleKeyDown(event) {
3354
+ // we can use 'Escape button" when this not a blocking modal, induced by closeButton value.
3355
+ if (this.closeButton && event.key === 'Escape') {
3356
+ this.hide = true;
3357
+ }
3358
+ }
3359
+ /*************
3360
+ * Lifecycle *
3361
+ *************/
3362
+ /**
3363
+ * Check if component props are well configured on init
3364
+ *
3365
+ * @returns {void}
3366
+ */
3367
+ componentWillLoad() {
3368
+ // Store body overflow
3369
+ this.bodyOverflow = document.body.style.overflow;
3370
+ // Get locales
3371
+ this.messages = initLocales(this.element).messages;
3372
+ // Validate
3373
+ this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
3374
+ this.hasContent = this.element.querySelector('[slot="content"]') !== null;
3375
+ if (this.closeButton) {
3376
+ this.closeButtonId = `${this.identifier}-close-button`;
3377
+ }
3378
+ this.titleId = `${this.identifier}-title`;
3379
+ this.validateModalTitle(this.modalTitle);
3380
+ this.validateHide(this.hide);
3381
+ }
3382
+ /**
3383
+ * Add observer on component to set focus when displayed
3384
+ *
3385
+ * @returns {void}
3386
+ */
3387
+ componentDidLoad() {
3388
+ new MutationObserver(mutationList => {
3389
+ /*
3390
+ TODO find a way to cover this callback
3391
+ */
3392
+ /* istanbul ignore next */
3393
+ if (mutationList.some(mutation => mutation.attributeName === 'aria-hidden' && mutation.target.ariaHidden === null)) {
3394
+ this.setFocus();
3395
+ }
3396
+ }).observe(this.element.shadowRoot.getElementById(this.identifier), { attributes: true });
3397
+ // Set focus if display on load
3398
+ if (!this.hide) {
3399
+ this.setFocus();
3400
+ }
3401
+ }
3402
+ /**
3403
+ * Render
3404
+ *
3405
+ * @returns {HTMLElement} HTML Element
3406
+ */
3407
+ render() {
3408
+ return (index.h("section", { role: "dialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, index.h("article", { class: "mg-modal__dialog" }, index.h("header", { class: "mg-modal__header" }, this.closeButton && (index.h("span", { class: "mg-modal__close-button" }, index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, index.h("mg-icon", { icon: "cross" })))), index.h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (index.h("article", { class: "mg-modal__content" }, index.h("slot", { name: "content" }))), this.hasActions && (index.h("footer", { class: "mg-modal__footer" }, index.h("slot", { name: "actions" }))))));
3409
+ }
3410
+ get element() { return index.getElement(this); }
3411
+ static get watchers() { return {
3412
+ "modalTitle": ["validateModalTitle"],
3413
+ "hide": ["validateHide"]
3414
+ }; }
3415
+ };
3416
+ MgModal.style = mgModalCss;
3417
+
2941
3418
  var NavigationAction;
2942
3419
  (function (NavigationAction) {
2943
3420
  NavigationAction["NEXT"] = "next";
@@ -2975,7 +3452,7 @@ const MgPagination = class {
2975
3452
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
2976
3453
  * If not set, it will be created.
2977
3454
  */
2978
- this.identifier = index$1.createID('mg-pagination');
3455
+ this.identifier = createID('mg-pagination');
2979
3456
  /**
2980
3457
  * Component total pages
2981
3458
  */
@@ -3041,7 +3518,7 @@ const MgPagination = class {
3041
3518
  */
3042
3519
  componentWillLoad() {
3043
3520
  // Get locales
3044
- this.messages = index$1.initLocales(this.element).messages;
3521
+ this.messages = initLocales(this.element).messages;
3045
3522
  // Validate
3046
3523
  this.validateTotalPages(this.totalPages);
3047
3524
  this.validateCurrentPage(this.currentPage);
@@ -3069,7 +3546,7 @@ const MgPagination = class {
3069
3546
  };
3070
3547
  MgPagination.style = mgPaginationCss;
3071
3548
 
3072
- const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--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-left--full{flex:1 1 auto}.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__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}";
3549
+ 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}";
3073
3550
 
3074
3551
  const MgPanel = class {
3075
3552
  constructor(hostRef) {
@@ -3080,7 +3557,7 @@ const MgPanel = class {
3080
3557
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
3081
3558
  * If not set, it will be created.
3082
3559
  */
3083
- this.identifier = index$1.createID('mg-panel');
3560
+ this.identifier = createID('mg-panel');
3084
3561
  /**
3085
3562
  * Panel is opened
3086
3563
  */
@@ -3092,7 +3569,7 @@ const MgPanel = class {
3092
3569
  /**
3093
3570
  * Component classes
3094
3571
  */
3095
- this.classList = new index$1.ClassList(['mg-panel']);
3572
+ this.classList = new ClassList(['mg-panel']);
3096
3573
  /**
3097
3574
  * Title is in edition mode
3098
3575
  */
@@ -3209,7 +3686,7 @@ const MgPanel = class {
3209
3686
  */
3210
3687
  componentWillLoad() {
3211
3688
  // Get locales
3212
- this.messages = index$1.initLocales(this.element).messages;
3689
+ this.messages = initLocales(this.element).messages;
3213
3690
  // Validate
3214
3691
  this.validatetitlePattern(this.titlePattern);
3215
3692
  this.validatePanelTitle(this.panelTitle);
@@ -5040,7 +5517,7 @@ var createPopper = /*#__PURE__*/popperGenerator({
5040
5517
  defaultModifiers: defaultModifiers
5041
5518
  }); // eslint-disable-next-line import/no-unused-modules
5042
5519
 
5043
- const mgPopoverCss = "mg-popover{display:contents}mg-popover::slotted(*){display:inline-block}.mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show]{display:block}.mg-popover mg-button{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow,.mg-popover__arrow::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover__arrow{visibility:hidden}.mg-popover__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow{bottom:-6px}.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow{top:-6px}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow{right:-6px}.mg-popover[data-popper-placement^=right]>.mg-popover__arrow{left:-6px}.mg-popover__title ::slotted([slot=title]){margin:0 0 1rem !important;font-size:var(--mg-popover-title-font-size) !important;font-weight:600}";
5520
+ const mgPopoverCss = "mg-popover{display:contents}mg-popover::slotted(*){display:inline-block}.mg-popover{display:none;padding:1.5rem;z-index:1000;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show]{display:block}.mg-popover mg-button{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow,.mg-popover__arrow::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover__arrow{visibility:hidden}.mg-popover__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow{bottom:-6px}.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow{top:-6px}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow{right:-6px}.mg-popover[data-popper-placement^=right]>.mg-popover__arrow{left:-6px}.mg-popover__title ::slotted([slot=title]){margin:0 0 1rem !important;font-size:var(--mg-popover-title-font-size) !important;font-weight:600}";
5044
5521
 
5045
5522
  const MgPopover = class {
5046
5523
  constructor(hostRef) {
@@ -5051,7 +5528,7 @@ const MgPopover = class {
5051
5528
  * Sets an `id` attribute.
5052
5529
  * Needed by the input for accessibility `aria-decribedby`.
5053
5530
  */
5054
- this.identifier = index$1.createID('mg-popover');
5531
+ this.identifier = createID('mg-popover');
5055
5532
  /**
5056
5533
  * Popover placement
5057
5534
  */
@@ -5138,7 +5615,7 @@ const MgPopover = class {
5138
5615
  */
5139
5616
  componentWillLoad() {
5140
5617
  // Get locales
5141
- this.messages = index$1.initLocales(this.element).messages;
5618
+ this.messages = initLocales(this.element).messages;
5142
5619
  }
5143
5620
  /**
5144
5621
  * Check if component props are well configured on init
@@ -5148,7 +5625,7 @@ const MgPopover = class {
5148
5625
  componentDidLoad() {
5149
5626
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
5150
5627
  const slottedTitleElement = this.element.querySelector('[slot="title"]');
5151
- if (slottedTitleElement && !index$1.isTagName(slottedTitleElement, headingTags)) {
5628
+ if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {
5152
5629
  throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
5153
5630
  }
5154
5631
  // Set close button id
@@ -5165,6 +5642,7 @@ const MgPopover = class {
5165
5642
  // Create popperjs popover
5166
5643
  this.popper = createPopper(interactiveElement, this.popover, {
5167
5644
  placement: this.placement,
5645
+ strategy: 'fixed',
5168
5646
  modifiers: [
5169
5647
  {
5170
5648
  name: 'offset',
@@ -5192,7 +5670,7 @@ const MgPopover = class {
5192
5670
  * @returns {HTMLElement} HTML Element
5193
5671
  */
5194
5672
  render() {
5195
- return (index.h(index.Host, null, index.h("slot", null), index.h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { icon: "cross" }))), index.h("div", { class: "mg-popover__title" }, index.h("slot", { name: "title" })), index.h("slot", { name: "content" }), index.h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
5673
+ return (index.h(index.Host, null, index.h("slot", null), index.h("div", { id: this.identifier, class: "mg-popover" }, this.closeButton && (index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { icon: "cross" }))), index.h("div", { class: "mg-popover__title" }, index.h("slot", { name: "title" })), index.h("slot", { name: "content" }), index.h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
5196
5674
  }
5197
5675
  get element() { return index.getElement(this); }
5198
5676
  static get watchers() { return {
@@ -5236,7 +5714,7 @@ const MgTabs = class {
5236
5714
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
5237
5715
  * If not set, it will be created.
5238
5716
  */
5239
- this.identifier = index$1.createID('mg-tabs');
5717
+ this.identifier = createID('mg-tabs');
5240
5718
  /**
5241
5719
  * Define tabs size
5242
5720
  */
@@ -5253,7 +5731,7 @@ const MgTabs = class {
5253
5731
  /**
5254
5732
  * Component classes
5255
5733
  */
5256
- this.classList = new index$1.ClassList(['mg-tabs']);
5734
+ this.classList = new ClassList(['mg-tabs']);
5257
5735
  /**
5258
5736
  * Method to set active tab
5259
5737
  *
@@ -5358,7 +5836,7 @@ const MgTabs = class {
5358
5836
  }
5359
5837
  validateItems(newValue) {
5360
5838
  // String array
5361
- if (index$1.allItemsAreString(newValue)) {
5839
+ if (allItemsAreString(newValue)) {
5362
5840
  this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
5363
5841
  }
5364
5842
  // Object array
@@ -5441,7 +5919,7 @@ const MgTag = class {
5441
5919
  /**
5442
5920
  * Component classes
5443
5921
  */
5444
- this.classList = new index$1.ClassList(['mg-tag']);
5922
+ this.classList = new ClassList(['mg-tag']);
5445
5923
  }
5446
5924
  validateVariant(newValue, oldValue) {
5447
5925
  if (!variants.includes(newValue)) {
@@ -5487,9 +5965,6 @@ const MgTag = class {
5487
5965
  };
5488
5966
  MgTag.style = mgTagCss;
5489
5967
 
5490
- /**
5491
- * List of all possibles placements
5492
- */
5493
5968
  var Guard;
5494
5969
  (function (Guard) {
5495
5970
  Guard["FOCUS"] = "focus";
@@ -5497,7 +5972,7 @@ var Guard;
5497
5972
  Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
5498
5973
  })(Guard || (Guard = {}));
5499
5974
 
5500
- const mgTooltipCss = ":host{display:inline-block}.mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:9999;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}.mg-tooltip[data-show]{display:block}.mg-tooltip .mg-tooltip__arrow,.mg-tooltip .mg-tooltip__arrow::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip .mg-tooltip__arrow{visibility:hidden}.mg-tooltip .mg-tooltip__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top]>.mg-tooltip__arrow{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom]>.mg-tooltip__arrow{top:-4px}.mg-tooltip[data-popper-placement^=left]>.mg-tooltip__arrow{right:-4px}.mg-tooltip[data-popper-placement^=right]>.mg-tooltip__arrow{left:-4px}";
5975
+ const mgTooltipCss = ":host{display:inline-block}.mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:1000;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}.mg-tooltip[data-show]{display:block}.mg-tooltip .mg-tooltip__arrow,.mg-tooltip .mg-tooltip__arrow::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip .mg-tooltip__arrow{visibility:hidden}.mg-tooltip .mg-tooltip__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top]>.mg-tooltip__arrow{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom]>.mg-tooltip__arrow{top:-4px}.mg-tooltip[data-popper-placement^=left]>.mg-tooltip__arrow{right:-4px}.mg-tooltip[data-popper-placement^=right]>.mg-tooltip__arrow{left:-4px}";
5501
5976
 
5502
5977
  const MgTooltip = class {
5503
5978
  constructor(hostRef) {
@@ -5506,7 +5981,7 @@ const MgTooltip = class {
5506
5981
  * Sets an `id` attribute.
5507
5982
  * Needed by the input for accessibility `aria-decribedby`.
5508
5983
  */
5509
- this.identifier = index$1.createID('mg-tooltip');
5984
+ this.identifier = createID('mg-tooltip');
5510
5985
  /**
5511
5986
  * Tooltip placement
5512
5987
  */
@@ -5634,6 +6109,7 @@ const MgTooltip = class {
5634
6109
  // Create popperjs tooltip
5635
6110
  this.popper = createPopper(tooltipedElement, this.tooltip, {
5636
6111
  placement: this.placement,
6112
+ strategy: 'fixed',
5637
6113
  modifiers: [
5638
6114
  {
5639
6115
  name: 'offset',
@@ -5691,8 +6167,10 @@ MgTooltip.style = mgTooltipCss;
5691
6167
 
5692
6168
  exports.mg_badge = MgBadge;
5693
6169
  exports.mg_button = MgButton;
6170
+ exports.mg_card = MgCard;
5694
6171
  exports.mg_character_left = MgCharacterLeft;
5695
6172
  exports.mg_details = MgDetails;
6173
+ exports.mg_divider = MgDivider;
5696
6174
  exports.mg_form = MgForm;
5697
6175
  exports.mg_icon = MgIcon;
5698
6176
  exports.mg_illustrated_message = MgIllustratedMessage;
@@ -5707,6 +6185,7 @@ exports.mg_input_textarea = MgInputTextarea;
5707
6185
  exports.mg_input_title = MgInputTitle;
5708
6186
  exports.mg_input_toggle = MgInputToggle;
5709
6187
  exports.mg_message = MgMessage;
6188
+ exports.mg_modal = MgModal;
5710
6189
  exports.mg_pagination = MgPagination;
5711
6190
  exports.mg_panel = MgPanel;
5712
6191
  exports.mg_popover = MgPopover;