@mgdis/mg-components 4.2.1 → 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 (105) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{mg-badge_23.cjs.entry.js → mg-badge_27.cjs.entry.js} +2590 -121
  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-badge/mg-badge.js +1 -3
  6. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +1 -2
  7. package/dist/collection/components/atoms/mg-button/mg-button.css +113 -67
  8. package/dist/collection/components/atoms/mg-button/mg-button.js +89 -64
  9. package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +18 -0
  10. package/dist/collection/components/atoms/mg-card/mg-card.css +7 -0
  11. package/dist/collection/components/atoms/mg-card/mg-card.js +26 -0
  12. package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +18 -0
  13. package/dist/collection/components/atoms/mg-divider/mg-divider.css +9 -0
  14. package/dist/collection/components/atoms/mg-divider/mg-divider.js +57 -0
  15. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +3 -0
  16. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -3
  17. package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -5
  18. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -20
  19. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +1 -1
  20. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -7
  21. package/dist/collection/components/molecules/inputs/MgInput.js +1 -3
  22. package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -0
  23. package/dist/collection/components/molecules/mg-details/mg-details.css +29 -0
  24. package/dist/collection/components/molecules/mg-details/mg-details.js +26 -4
  25. package/dist/collection/components/molecules/mg-form/mg-form.js +2 -3
  26. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -1
  27. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +15 -7
  28. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +27 -2
  29. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +1 -1
  30. package/dist/collection/components/molecules/mg-modal/mg-modal.css +2 -1
  31. package/dist/collection/components/molecules/mg-modal/mg-modal.js +53 -7
  32. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -3
  33. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -1
  34. package/dist/collection/components/molecules/mg-panel/mg-panel.css +12 -20
  35. package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -4
  36. package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -5
  37. package/dist/collection/components/molecules/mg-popover/mg-popover.css +3 -3
  38. package/dist/collection/components/molecules/mg-popover/mg-popover.js +10 -10
  39. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -3
  40. package/dist/collection/utils/components.utils.js +10 -6
  41. package/dist/collection/variables.css +22 -1
  42. package/dist/components/MgInput.js +1 -3
  43. package/dist/components/components.utils.js +11 -7
  44. package/dist/components/index.d.ts +2 -0
  45. package/dist/components/index.js +2 -0
  46. package/dist/components/mg-badge2.js +1 -3
  47. package/dist/components/mg-button2.js +63 -13
  48. package/dist/components/mg-card.d.ts +11 -0
  49. package/dist/components/mg-card.js +42 -0
  50. package/dist/components/mg-details.js +8 -3
  51. package/dist/components/mg-divider.d.ts +11 -0
  52. package/dist/components/mg-divider.js +51 -0
  53. package/dist/components/mg-form.js +2 -3
  54. package/dist/components/mg-icon2.js +3 -0
  55. package/dist/components/mg-illustrated-message.js +12 -4
  56. package/dist/components/mg-input-title2.js +1 -3
  57. package/dist/components/mg-modal.js +54 -8
  58. package/dist/components/mg-pagination.js +4 -3
  59. package/dist/components/mg-panel.js +3 -5
  60. package/dist/components/mg-popover.js +11 -10
  61. package/dist/components/mg-tabs.js +1 -3
  62. package/dist/components/mg-tooltip2.js +7 -10
  63. package/dist/esm/loader.js +1 -1
  64. package/dist/esm/{mg-badge_23.entry.js → mg-badge_27.entry.js} +2538 -73
  65. package/dist/esm/mg-components.js +1 -1
  66. package/dist/mg-components/mg-components.css +1 -1
  67. package/dist/mg-components/mg-components.esm.js +1 -1
  68. package/dist/mg-components/p-e131701a.entry.js +1 -0
  69. package/dist/mg-components/variables.css +22 -1
  70. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +2 -2
  71. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +5 -1
  72. package/dist/types/components/atoms/mg-button/mg-button.d.ts +25 -17
  73. package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +6 -0
  74. package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -0
  75. package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +6 -0
  76. package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +15 -0
  77. package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -6
  78. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -8
  79. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -1
  80. package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
  81. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +4 -0
  82. package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +8 -0
  83. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +1 -0
  84. package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -6
  85. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +1 -1
  86. package/dist/types/components.d.ts +64 -31
  87. package/dist/types/utils/components.utils.d.ts +7 -3
  88. package/package.json +4 -3
  89. package/dist/cjs/index-179621c8.js +0 -244
  90. package/dist/cjs/mg-modal.cjs.entry.js +0 -130
  91. package/dist/cjs/mg-popover.cjs.entry.js +0 -171
  92. package/dist/cjs/popper-11d5f714.js +0 -1801
  93. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -20
  94. package/dist/collection/variables.scss +0 -212
  95. package/dist/esm/index-7efedd97.js +0 -238
  96. package/dist/esm/mg-modal.entry.js +0 -126
  97. package/dist/esm/mg-popover.entry.js +0 -167
  98. package/dist/esm/popper-f860750c.js +0 -1799
  99. package/dist/mg-components/p-25452f60.entry.js +0 -1
  100. package/dist/mg-components/p-5f89600c.js +0 -1
  101. package/dist/mg-components/p-a20fc541.entry.js +0 -1
  102. package/dist/mg-components/p-e08bc19a.entry.js +0 -1
  103. package/dist/mg-components/p-ec26fc38.js +0 -1
  104. package/dist/mg-components/variables.scss +0 -212
  105. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -8
@@ -3,14 +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
- const popper = require('./popper-11d5f714.js');
8
6
 
9
7
  /**
10
8
  * List of all possibles variants
11
9
  */
12
10
  const variants$4 = ['info', 'primary', 'secondary', 'success', 'warning', 'danger'];
13
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
+
14
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}";
15
102
 
16
103
  const MgBadge = class {
@@ -28,7 +115,7 @@ const MgBadge = class {
28
115
  /**
29
116
  * Component classes
30
117
  */
31
- this.classList = new index$1.ClassList(['mg-badge']);
118
+ this.classList = new ClassList(['mg-badge']);
32
119
  }
33
120
  validateValue(newValue) {
34
121
  if (`${newValue}`.match(/^(\d+|[?*!a-z])$/i) === null) {
@@ -37,9 +124,7 @@ const MgBadge = class {
37
124
  }
38
125
  validateLabel(newValue) {
39
126
  if (typeof newValue !== 'string' || newValue.trim() === '') {
40
- // TODO: throw new Error on next major (5.0.0)
41
- // throw new Error('<mg-badge> prop "label" is required.');
42
- console.error('<mg-badge> prop "label" is required.');
127
+ throw new Error('<mg-badge> prop "label" is required.');
43
128
  }
44
129
  }
45
130
  validateVariant(newValue, oldValue) {
@@ -92,7 +177,7 @@ MgBadge.style = mgBadgeCss;
92
177
  */
93
178
  const variants$3 = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success'];
94
179
 
95
- const mgButtonCss = ".mg-button.sc-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;font-family:inherit;text-decoration:none;font-weight:normal;text-align:left;touch-action:manipulation}.mg-button[disabled].sc-mg-button,.mg-button[aria-disabled=true].sc-mg-button,.mg-button.disabled.sc-mg-button{opacity:var(--mg-button-disabled-opacity);cursor:default}.mg-button.mg-button--icon.sc-mg-button{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--primary.sc-mg-button{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%)))}.mg-button.mg-button--primary.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--primary.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--primary.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{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.sc-mg-button{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%)))}.mg-button.mg-button--secondary.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--secondary.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--secondary.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{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.sc-mg-button{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%)))}.mg-button.mg-button--danger.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt.sc-mg-button{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%)))}.mg-button.mg-button--danger-alt.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger-alt.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger-alt.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info.sc-mg-button{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%)))}.mg-button.mg-button--info.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--info.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--info.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--success.sc-mg-button{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%)))}.mg-button.mg-button--success.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--success.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--success.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-button.mg-button--flat.sc-mg-button{background:none;border:none}.mg-button.mg-button--flat.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--flat.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--flat.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsla(var(--color-dark), 0.1)}.mg-button.sc-mg-button mg-icon.sc-mg-button:only-child,.mg-button .sc-mg-button-s>mg-icon{display:inline-flex;flex-shrink:0;line-height:1;margin:auto 0}.mg-button.mg-button--loading.sc-mg-button>mg-icon.sc-mg-button{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.mg-button.mg-button--loading.sc-mg-button .mg-button__content.sc-mg-button{opacity:0}.mg-button__content.sc-mg-button{display:flex;align-items:center;column-gap:0.6rem}mg-button.sc-mg-button{display:inline-block}.mg-button.sc-mg-button,mg-button.sc-mg-button{vertical-align:middle;max-width:100%}";
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}";
96
181
 
97
182
  const MgButton = class {
98
183
  constructor(hostRef) {
@@ -101,10 +186,17 @@ const MgButton = class {
101
186
  * Internal *
102
187
  ************/
103
188
  this.onClickElementFn = null;
189
+ this.classDisabled = 'mg-button--disabled';
190
+ this.classLoading = 'mg-button--loading';
191
+ this.classFullWidth = 'mg-button--full-width';
104
192
  /**
105
193
  * Define button variant
106
194
  */
107
195
  this.variant = variants$3[0]; // Primary
196
+ /**
197
+ * Set button to full-width
198
+ */
199
+ this.fullWidth = false;
108
200
  /**
109
201
  * Define if button is round.
110
202
  * Used for icon button.
@@ -124,7 +216,7 @@ const MgButton = class {
124
216
  /**
125
217
  * Component classes
126
218
  */
127
- this.classList = new index$1.ClassList(['mg-button']);
219
+ this.classList = new ClassList(['mg-button']);
128
220
  /**
129
221
  * Trigger actions onClick event
130
222
  *
@@ -135,11 +227,38 @@ const MgButton = class {
135
227
  if (this.disabled)
136
228
  event.stopPropagation();
137
229
  // Used to prevent multi-click.
138
- if (this.disableOnClick && !this.disabled) {
230
+ else if (this.disableOnClick) {
139
231
  this.loading = true;
140
232
  this.disabled = true;
141
233
  }
142
234
  };
235
+ /**
236
+ * Handle onKeyDown event
237
+ *
238
+ * @param {KeyboardEvent} event keyboard event
239
+ * @returns {void}
240
+ */
241
+ this.handleKeydown = (event) => {
242
+ if (!this.disabled && event.key === ' ') {
243
+ event.preventDefault();
244
+ }
245
+ else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {
246
+ event.preventDefault();
247
+ this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
248
+ }
249
+ };
250
+ /**
251
+ * Handle onKeyUp event
252
+ *
253
+ * @param {KeyboardEvent} event keyboard event
254
+ * @returns {void}
255
+ */
256
+ this.handleKeyup = (event) => {
257
+ if (!this.disabled && event.key === ' ') {
258
+ event.preventDefault();
259
+ this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
260
+ }
261
+ };
143
262
  }
144
263
  validateVariant(newValue, oldValue) {
145
264
  if (!variants$3.includes(newValue)) {
@@ -152,6 +271,17 @@ const MgButton = class {
152
271
  this.classList.add(`mg-button--${newValue}`);
153
272
  }
154
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
+ }
155
285
  disabledHandler(isDisabled) {
156
286
  // Remove loading when enable
157
287
  // Will be set back onclick
@@ -160,14 +290,21 @@ const MgButton = class {
160
290
  }
161
291
  // Manage if onclick
162
292
  this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
293
+ // apply style
294
+ if (isDisabled) {
295
+ this.classList.add(this.classDisabled);
296
+ }
297
+ else {
298
+ this.classList.delete(this.classDisabled);
299
+ }
163
300
  }
164
301
  loadingHandler(newValue) {
165
302
  // we add loading style if it newvalue is true else we remove it
166
303
  if (newValue) {
167
- this.classList.add('mg-button--loading');
304
+ this.classList.add(this.classLoading);
168
305
  }
169
306
  else {
170
- this.classList.delete('mg-button--loading');
307
+ this.classList.delete(this.classLoading);
171
308
  }
172
309
  }
173
310
  /**
@@ -177,6 +314,7 @@ const MgButton = class {
177
314
  */
178
315
  componentWillLoad() {
179
316
  this.validateVariant(this.variant);
317
+ this.validateFullWidth(this.fullWidth);
180
318
  if (this.isIcon) {
181
319
  this.classList.add(`mg-button--icon`);
182
320
  if (typeof this.label !== 'string' || this.label.trim() === '') {
@@ -193,20 +331,190 @@ const MgButton = class {
193
331
  * @returns {HTMLElement} html element
194
332
  */
195
333
  render() {
196
- return (index.h("button", { id: this.identifier, class: this.classList.join(), type: this.type, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": this.controls, "aria-haspopup": this.haspopup !== undefined && this.haspopup.toString(), onClick: this.handleClick,
197
- // has stencil does not support form attribute on button, we set the attribute from the ref
198
- // https://github.com/ionic-team/stencil/issues/2703#issuecomment-1050943715
199
- ref: btn => this.form && btn.setAttribute('form', this.form) }, 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)))));
200
335
  }
201
336
  get element() { return index.getElement(this); }
202
337
  static get watchers() { return {
203
338
  "variant": ["validateVariant"],
339
+ "fullWidth": ["validateFullWidth"],
204
340
  "disabled": ["disabledHandler"],
205
341
  "loading": ["loadingHandler"]
206
342
  }; }
207
343
  };
208
344
  MgButton.style = mgButtonCss;
209
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
+
210
518
  const mgCharacterLeftCss = "mg-character-left.sc-mg-character-left{display:block}";
211
519
 
212
520
  const MgCharacterLeft = class {
@@ -232,7 +540,7 @@ const MgCharacterLeft = class {
232
540
  */
233
541
  componentWillLoad() {
234
542
  this.validateMaxlength(this.maxlength);
235
- this.messages = index$1.initLocales(this.element).messages;
543
+ this.messages = initLocales(this.element).messages;
236
544
  }
237
545
  /**
238
546
  * Render component
@@ -249,12 +557,16 @@ const MgCharacterLeft = class {
249
557
  };
250
558
  MgCharacterLeft.style = mgCharacterLeftCss;
251
559
 
252
- 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}";
253
561
 
254
562
  const MgDetails = class {
255
563
  constructor(hostRef) {
256
564
  index.registerInstance(this, hostRef);
257
565
  this.expandedChange = index.createEvent(this, "expanded-change", 7);
566
+ /**
567
+ * Hide summary element
568
+ */
569
+ this.hideSummary = false;
258
570
  /**
259
571
  * Define if details are diplayed
260
572
  */
@@ -269,7 +581,7 @@ const MgDetails = class {
269
581
  };
270
582
  }
271
583
  validateTitles(newValue) {
272
- if (newValue === undefined || newValue === '') {
584
+ if (newValue === undefined || newValue.trim() === '') {
273
585
  throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
274
586
  }
275
587
  }
@@ -294,7 +606,7 @@ const MgDetails = class {
294
606
  * @returns {HTMLElement} HTML Element
295
607
  */
296
608
  render() {
297
- 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" }))));
298
610
  }
299
611
  static get watchers() { return {
300
612
  "toggleClosed": ["validateTitles"],
@@ -304,6 +616,33 @@ const MgDetails = class {
304
616
  };
305
617
  MgDetails.style = mgDetailsCss;
306
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
+
307
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}";
308
647
 
309
648
  const MgForm = class {
@@ -315,7 +654,7 @@ const MgForm = class {
315
654
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
316
655
  * If not set, it will be created.
317
656
  */
318
- this.identifier = index$1.createID('mg-form');
657
+ this.identifier = createID('mg-form');
319
658
  /**
320
659
  * Input name
321
660
  * If not set the value equals the identifier
@@ -332,7 +671,7 @@ const MgForm = class {
332
671
  /**
333
672
  * Component classes
334
673
  */
335
- this.classList = new index$1.ClassList(['mg-form']);
674
+ this.classList = new ClassList(['mg-form']);
336
675
  /**
337
676
  * Define required message based on mg-inputs required elements
338
677
  * Also
@@ -392,7 +731,7 @@ const MgForm = class {
392
731
  */
393
732
  componentWillLoad() {
394
733
  // Get locales
395
- this.messages = index$1.initLocales(this.element).messages;
734
+ this.messages = initLocales(this.element).messages;
396
735
  // Get slotted mgInputs
397
736
  this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT-'));
398
737
  // Get slotted mgButtons
@@ -428,9 +767,8 @@ const MgForm = class {
428
767
  */
429
768
  componentDidLoad() {
430
769
  this.mgButtons.forEach(mgButton => {
431
- // submit buttons should trigger form submition
432
- const button = mgButton.querySelector('button');
433
- if (['submit', null].includes(button.getAttribute('type'))) {
770
+ // submit buttons should trigger form submition;
771
+ if (['submit', null].includes(mgButton.getAttribute('type'))) {
434
772
  mgButton.addEventListener('click', () => {
435
773
  this.form.dispatchEvent(new CustomEvent('submit', { bubbles: true }));
436
774
  });
@@ -500,6 +838,8 @@ const icons = {
500
838
  'dashboard': () => index.h("path", { fill: "currentColor", d: "M1.67 8.7H7.3V1.67H1.67v7.04Zm0 5.63H7.3v-4.22H1.67v4.22Zm7.04 0h5.63V7.3H8.71v7.04Zm0-12.67v4.23h5.63V1.67H8.71Z" }),
501
839
  'dashboard-outline': () => (index.h("path", { fill: "currentColor", d: "M13.33 2.67v2.22H9.7V2.67h3.63m-7.04 0V7.7H2.67V2.67H6.3m7.04 5.63v5.04H9.71V8.3h3.63M6.3 11.11v2.22H2.67v-2.22H6.3m8.03-9.44H8.7v4.22h5.63V1.67Zm-7.04 0H1.67v7.04H7.3V1.67Zm7.04 5.63H8.7v7.04h5.63V7.3Zm-7.04 2.81H1.67v4.22H7.3v-4.22Z" })),
502
840
  'download': () => (index.h("path", { fill: "currentColor", d: "M6.4 2v4.1c0 .2-.1.3-.3.3H4c-.2 0-.3.1-.3.3 0 .1 0 .2.1.2l4 4c.1.1.3.1.4 0l4-4c.1-.1.1-.3 0-.4-.1-.1-.1-.1-.2-.1H9.9c-.2 0-.3-.1-.3-.3V2c0-.2-.1-.3-.3-.3H6.7c-.1 0-.3.1-.3.3zm7.9 11v1c0 .2-.1.3-.3.3H2c-.2 0-.3-.1-.3-.3v-1c0-.2.1-.3.3-.3h12c.2 0 .3.1.3.3z" })),
841
+ 'ellipsis': () => (index.h("path", { fill: "currentColor", d: "M2.5 6.17A1.83 1.83 0 1 0 4.33 8c0-1.01-.82-1.83-1.83-1.83Zm11 0A1.83 1.83 0 1 0 15.33 8c0-1.01-.82-1.83-1.83-1.83Zm-5.5 0A1.83 1.83 0 1 0 9.83 8c0-1.01-.82-1.83-1.83-1.83Z" })),
842
+ 'ellipsis-vertical': () => (index.h("path", { fill: "currentColor", d: "M6.17 13.5A1.83 1.83 0 1 0 8 11.67c-1.01 0-1.83.82-1.83 1.83Zm0-11A1.83 1.83 0 1 0 8 .67c-1.01 0-1.83.82-1.83 1.83Zm0 5.5A1.83 1.83 0 1 0 8 6.17c-1.01 0-1.83.82-1.83 1.83Z" })),
503
843
  'euro': () => (index.h("path", { fill: "currentColor", d: "M13 13.14a.4.4 0 0 0-.47-.31A7.79 7.79 0 0 1 11 13a4.31 4.31 0 0 1-4-2.79h3.8a.41.41 0 0 0 .39-.31l.19-.9a.39.39 0 0 0-.3-.47H6.51a7.07 7.07 0 0 1 0-1.38h4.89a.4.4 0 0 0 .39-.31l.22-1a.4.4 0 0 0-.3-.47H7a4.2 4.2 0 0 1 3.92-2.45 6.57 6.57 0 0 1 1.26.14.41.41 0 0 0 .47-.29l.4-1.45a.4.4 0 0 0-.28-.48A9.43 9.43 0 0 0 11 .67a7.12 7.12 0 0 0-6.83 4.7h-1.1a.4.4 0 0 0-.4.39v1a.4.4 0 0 0 .4.39h.72a9.08 9.08 0 0 0 0 1.38h-.72a.39.39 0 0 0-.4.39v.93a.4.4 0 0 0 .4.39h1A7 7 0 0 0 11 15.3a8.7 8.7 0 0 0 2-.25.39.39 0 0 0 .3-.46l-.3-1.45Z" })),
504
844
  'euro-circle': () => (index.h("path", { fill: "currentColor", d: "M8 .67C3.95.67.67 3.95.67 8S3.95 15.33 8 15.33s7.33-3.28 7.33-7.33S12.05.67 8 .67Zm2.27 11.4c-.38.09-.76.14-1.15.14a4.038 4.038 0 0 1-3.99-2.92h-.58c-.13 0-.23-.1-.23-.22v-.54c0-.12.11-.22.23-.22h.41a5.34 5.34 0 0 1 0-.8h-.41c-.13 0-.23-.1-.23-.22v-.58c0-.13.11-.22.23-.22h.63c.6-1.65 2.18-2.74 3.94-2.71.34 0 .68.03 1.02.1.12.03.19.16.16.28l-.23.84c-.03.12-.15.19-.27.17-.24-.05-.48-.08-.73-.08A2.42 2.42 0 0 0 6.81 6.5h2.71c.12.03.2.15.17.27l-.13.58c-.02.1-.12.18-.22.18H6.52c-.03.26-.03.53 0 .8h2.63c.12.03.2.15.17.27l-.11.52c-.03.1-.12.18-.22.18H6.8c.36.96 1.28 1.6 2.31 1.61.3 0 .59-.04.88-.1.12-.02.24.05.27.18l.17.84c.02.12-.05.24-.17.27v-.03Z" })),
505
845
  'exclamation-circle': () => (index.h("path", { fill: "currentColor", d: "M8 15.33c4.05 0 7.33-3.28 7.33-7.33S12.05.67 8 .67.67 3.95.67 8 3.95 15.33 8 15.33Zm.95-3.3c0 .15-.12.27-.28.27h-1.4c-.15 0-.28-.12-.28-.27v-1.31c0-.15.12-.28.28-.28h1.4c.15 0 .28.12.28.28v1.31ZM7 3.96c0-.14.11-.25.25-.25H8.7c.14 0 .25.11.25.25v4.8c0 .14-.11.25-.25.25H7.25c-.14 0-.25-.11-.25-.25V3.95Z" })),
@@ -599,6 +939,7 @@ const icons = {
599
939
  'user-group': () => (index.h("path", { fill: "currentColor", d: "M13.15 4.12c-.81-.01-1.47.65-1.48 1.46 0 .82.65 1.47 1.46 1.48s1.47-.65 1.48-1.46-.65-1.47-1.46-1.48Zm-10.04.01a1.47 1.47 0 0 0-1.58 1.59c.06.71.62 1.28 1.34 1.34.81.07 1.52-.53 1.59-1.34.06-.81-.54-1.52-1.35-1.59Zm7.36.39c-.22-.84-.87-1.51-1.71-1.75-1.36-.41-2.8.36-3.22 1.72-.18.61-.13 1.27.14 1.85.41.9 1.33 1.48 2.32 1.45 1.41.01 2.56-1.14 2.57-2.55 0-.24-.03-.49-.1-.72Zm-.71 4h-.19c-.99.49-2.14.49-3.13 0h-.19c-1.46 0-2.64 1.18-2.64 2.64v2.69c1.23.93 2.74 1.47 4.39 1.47s3.17-.55 4.4-1.48v-2.68c0-1.46-1.18-2.64-2.64-2.64Zm5.52.25a7.282 7.282 0 0 1-1.65 3.91c-.08.1-.16.19-.25.28-.08.09-.17.18-.25.27v-.55h.03v-.72s.01-.07 0-.1v-.66c.01-1.25-.66-2.4-1.76-3 .27-.26.63-.41 1-.41h1.51c.63.01 1.17.41 1.37.98ZM2.86 11.16v1.52h.01v.55l-.28-.31c-.08-.08-.15-.16-.22-.24A7.238 7.238 0 0 1 .74 8.86c.16-.62.72-1.07 1.4-1.07h1.47c.37-.01.73.12 1.01.37-1.1.6-1.77 1.75-1.76 3Z" })),
600
940
  'user-plus': () => (index.h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
601
941
  'user-question-outline': () => (index.h("path", { fill: "currentColor", d: "M5.23 11.14c.86-.66 1.01-1.9.35-2.75s-1.9-1.01-2.75-.35a1.96 1.96 0 0 0 0 3.1c-.72.42-1.16 1.2-1.16 2.03v.8c0 .2.17.37.37.37h3.98c.2 0 .37-.17.37-.37v-.8c0-.83-.44-1.61-1.16-2.03ZM2.81 9.59c0-.67.55-1.22 1.22-1.22s1.22.55 1.22 1.22-.55 1.22-1.22 1.22-1.22-.55-1.22-1.22Zm2.83 4H2.41v-.42c0-.89.72-1.62 1.62-1.62s1.62.72 1.62 1.62v.42h-.01Zm7.13-11.93H8c-.86 0-1.56.7-1.56 1.56v7.16c0 .21.17.37.37.37.08 0 .16-.03.22-.07l1.49-1.12h4.25c.86 0 1.56-.7 1.56-1.56V3.22c0-.86-.7-1.56-1.56-1.56Zm.82 6.33c0 .45-.37.82-.82.82H8.4a.41.41 0 0 0-.22.07l-1 .75V3.22c0-.45.37-.82.82-.82h4.77c.45 0 .82.37.82.82v4.77Zm-2.8-.42c0 .23-.18.41-.41.41s-.41-.18-.41-.41.18-.41.41-.41c.23 0 .41.18.41.41Zm-.41-4.34c-.83 0-1.5.67-1.5 1.5 0 .23.18.41.41.41s.41-.18.41-.41c0-.38.31-.68.69-.68.38 0 .68.31.68.69 0 .38-.31.68-.68.68-.23 0-.41.18-.41.41v.44c0 .23.18.41.41.41s.41-.18.41-.41v-.09c.8-.23 1.26-1.06 1.04-1.85-.18-.65-.77-1.09-1.44-1.09Z" })),
942
+ 'user-shield-outline': () => (index.h("path", { fill: "currentColor", d: "M8 8.92c-1.5 0-2.72-1.22-2.72-2.72S6.5 3.48 8 3.48s2.72 1.22 2.72 2.72S9.5 8.92 8 8.92Zm0-4.64a1.92 1.92 0 1 0 .001 3.841A1.92 1.92 0 0 0 8 4.28Zm4.97-1.84L8.56.78C8.2.65 7.81.65 7.45.78L3.03 2.43C2.41 2.66 2 3.26 2 3.92V8c0 3.82 4.23 6.47 5.52 7.2.15.08.31.13.48.13s.33-.04.48-.13C9.78 14.48 14 11.82 14 8V3.92c0-.66-.41-1.25-1.03-1.48ZM8.08 14.5c-.05.03-.12.03-.17 0-.49-.28-2.12-1.24-3.4-2.68.62-.82 1.94-1.39 3.47-1.39s2.84.61 3.49 1.4c-1.29 1.43-2.9 2.39-3.39 2.67ZM13.19 8c0 1.2-.51 2.28-1.22 3.22-.83-.91-2.34-1.59-4-1.59s-3.16.64-3.98 1.58c-.7-.93-1.2-2.01-1.2-3.2V3.93c0-.33.21-.62.51-.74l4.43-1.66c.09-.03.18-.05.27-.05s.19.02.27.05l4.42 1.66c.3.11.51.41.51.73V8Z" })),
602
943
  'users': () => (index.h("path", { fill: "currentColor", d: "M12,8.76h-.2a5.24,5.24,0,0,1-3.93,0H7.61a3.05,3.05,0,0,0-3.3,2.75v.69a1.28,1.28,0,0,0,1.38,1.14H14a1.27,1.27,0,0,0,1.37-1.14v-.69A3.07,3.07,0,0,0,12,8.75Zm-6.4-.32A2,2,0,0,0,4.31,8H2.48A1.69,1.69,0,0,0,.65,9.53v.76a.85.85,0,0,0,.91.76H3.45A3.58,3.58,0,0,1,5.61,8.44ZM9.81,2.66A2.65,2.65,0,1,1,7.16,5.31h0A2.65,2.65,0,0,1,9.81,2.66ZM3.31,4.18A1.51,1.51,0,1,1,1.8,5.69,1.51,1.51,0,0,1,3.31,4.18Z" })),
603
944
  'wallet': () => (index.h("path", { fill: "currentColor", d: "M13.88 5H3a.43.43 0 0 1-.46-.38.43.43 0 0 1 .46-.43h11a.43.43 0 0 0 .46-.38A1.28 1.28 0 0 0 13 2.67H2.5A1.7 1.7 0 0 0 .67 4.19v7.62a1.7 1.7 0 0 0 1.83 1.52h11.38a1.32 1.32 0 0 0 1.45-1.14V6.1A1.33 1.33 0 0 0 13.88 5Zm-1.21 5.29a1.1 1.1 0 1 1 1.1-1.1 1.1 1.1 0 0 1-1.1 1.05Z" })),
604
945
  };
@@ -627,7 +968,7 @@ const MgIcon = class {
627
968
  /**
628
969
  * Component classes
629
970
  */
630
- this.classList = new index$1.ClassList(['mg-icon']);
971
+ this.classList = new ClassList(['mg-icon']);
631
972
  /**
632
973
  * getIcon
633
974
  *
@@ -704,7 +1045,7 @@ const MgIcon = class {
704
1045
  };
705
1046
  MgIcon.style = mgIconCss;
706
1047
 
707
- const mgIllustratedMessageCss = ".mg-illustrated-message{margin:auto;padding:0 1.5rem;max-width:47.5rem;box-sizing:border-box;text-align:center}.mg-illustrated-message__illustration{max-height:33.5rem}.mg-illustrated-message__illustration ::slotted([slot=illustration]){width:auto;height:auto;max-width:100%;max-height:33.5rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small{max-height:6rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:6rem}.mg-illustrated-message__title{margin:3rem 0 0}.mg-illustrated-message__title ::slotted([slot=title]){margin:0;font-size:2rem !important;font-family:var(--font-family) !important;font-weight:400}.mg-illustrated-message__details ::slotted([slot=details]){margin:2rem 0 0}";
1048
+ const mgIllustratedMessageCss = ".mg-illustrated-message{display:flex;flex-direction:column;justify-content:center;gap:3em 7rem;margin:auto;padding:var(--mg-illustrated-message-padding-vertical) 1.5rem;max-width:47.5rem;box-sizing:border-box;text-align:center}.mg-illustrated-message.mg-illustrated-message--horizontal{flex-direction:row;flex-wrap:wrap;align-items:center;max-width:unset}.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__slots,.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__illustration{max-width:47.5rem}.mg-illustrated-message__illustration{max-height:33.5rem}.mg-illustrated-message__illustration ::slotted([slot=illustration]){width:auto;height:auto;max-width:100%;max-height:33.5rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small{max-height:6rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:6rem}.mg-illustrated-message__title ::slotted([slot=title]){margin:0;font-size:2rem !important;font-family:var(--font-family) !important;font-weight:400}.mg-illustrated-message__details ::slotted([slot=details]){margin:2rem 0 0}";
708
1049
 
709
1050
  const MgIllustratedMessage = class {
710
1051
  constructor(hostRef) {
@@ -713,6 +1054,10 @@ const MgIllustratedMessage = class {
713
1054
  * Define illustration size
714
1055
  */
715
1056
  this.size = 'regular';
1057
+ /**
1058
+ * Define component orientation
1059
+ */
1060
+ this.direction = 'vertical';
716
1061
  }
717
1062
  /*************
718
1063
  * Lifecycle *
@@ -725,10 +1070,10 @@ const MgIllustratedMessage = class {
725
1070
  componentDidLoad() {
726
1071
  const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
727
1072
  const imageTags = ['img', 'svg'];
728
- if (!index$1.isTagName(this.element.querySelector('[slot="title"]'), headingTags)) {
1073
+ if (!isTagName(this.element.querySelector('[slot="title"]'), headingTags)) {
729
1074
  throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
730
1075
  }
731
- else if (!index$1.isTagName(this.element.querySelector('[slot="illustration"]'), imageTags)) {
1076
+ else if (!isTagName(this.element.querySelector('[slot="illustration"]'), imageTags)) {
732
1077
  throw new Error(`<mg-illustrated-message> Slotted illustration must be an image: ${imageTags.join(', ')}`);
733
1078
  }
734
1079
  }
@@ -738,10 +1083,13 @@ const MgIllustratedMessage = class {
738
1083
  * @returns {HTMLElement} HTML Element
739
1084
  */
740
1085
  render() {
741
- return (index.h("div", { class: "mg-illustrated-message" }, index.h("div", { class: {
1086
+ return (index.h("div", { class: {
1087
+ 'mg-illustrated-message': true,
1088
+ 'mg-illustrated-message--horizontal': this.direction === 'horizontal',
1089
+ } }, index.h("div", { class: {
742
1090
  'mg-illustrated-message__illustration': true,
743
1091
  'mg-illustrated-message__illustration--small': this.size === 'small',
744
- } }, index.h("slot", { name: "illustration" })), index.h("div", { class: "mg-illustrated-message__title" }, index.h("slot", { name: "title" })), index.h("div", { class: "mg-illustrated-message__details" }, index.h("slot", { name: "details" }))));
1092
+ } }, index.h("slot", { name: "illustration" })), index.h("div", { class: "mg-illustrated-message__slots" }, index.h("div", { class: "mg-illustrated-message__title" }, index.h("slot", { name: "title" })), index.h("div", { class: "mg-illustrated-message__details" }, index.h("slot", { name: "details" })))));
745
1093
  }
746
1094
  get element() { return index.getElement(this); }
747
1095
  };
@@ -798,9 +1146,7 @@ const MgInput = (props, children, utils) => {
798
1146
  * Check required properties
799
1147
  */
800
1148
  if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
801
- // TODO: throw new Error on next major (5.0.0)
802
- // throw new Error('<mg-input> prop "identifier" is required.');
803
- console.error('<mg-input> prop "identifier" is required.');
1149
+ throw new Error('<mg-input> prop "identifier" is required.');
804
1150
  }
805
1151
  if (typeof props.label !== 'string' || props.label.trim() === '') {
806
1152
  throw new Error('<mg-input> prop "label" is required.');
@@ -925,7 +1271,7 @@ const MgInputCheckbox = class {
925
1271
  /**
926
1272
  * Component classes
927
1273
  */
928
- this.classList = new index$1.ClassList(['mg-input--checkbox']);
1274
+ this.classList = new ClassList(['mg-input--checkbox']);
929
1275
  /**
930
1276
  * Formated value for display
931
1277
  */
@@ -1017,7 +1363,7 @@ const MgInputCheckbox = class {
1017
1363
  */
1018
1364
  componentWillLoad() {
1019
1365
  // Get locales
1020
- this.messages = index$1.initLocales(this.element).messages;
1366
+ this.messages = initLocales(this.element).messages;
1021
1367
  // Validate
1022
1368
  this.validateValue(this.value);
1023
1369
  // Check validity when component is ready
@@ -1126,7 +1472,7 @@ const MgInputDate = class {
1126
1472
  /**
1127
1473
  * Component classes
1128
1474
  */
1129
- this.classList = new index$1.ClassList(['mg-input--date']);
1475
+ this.classList = new ClassList(['mg-input--date']);
1130
1476
  /**
1131
1477
  * Handle input event
1132
1478
  */
@@ -1250,7 +1596,7 @@ const MgInputDate = class {
1250
1596
  */
1251
1597
  componentWillLoad() {
1252
1598
  // Get locales
1253
- const locales = index$1.initLocales(this.element);
1599
+ const locales = initLocales(this.element);
1254
1600
  this.locale = locales.locale;
1255
1601
  this.messages = locales.messages;
1256
1602
  // Validate
@@ -1344,7 +1690,7 @@ const MgInputNumeric = class {
1344
1690
  /**
1345
1691
  * Component classes
1346
1692
  */
1347
- this.classList = new index$1.ClassList(['mg-input--numeric']);
1693
+ this.classList = new ClassList(['mg-input--numeric']);
1348
1694
  /**
1349
1695
  * Define if input has focus
1350
1696
  */
@@ -1540,7 +1886,7 @@ const MgInputNumeric = class {
1540
1886
  */
1541
1887
  componentWillLoad() {
1542
1888
  // Get locales
1543
- const locales = index$1.initLocales(this.element);
1889
+ const locales = initLocales(this.element);
1544
1890
  this.locale = locales.locale;
1545
1891
  this.messages = locales.messages;
1546
1892
  // Validate
@@ -1611,7 +1957,7 @@ const MgInputPassword = class {
1611
1957
  /**
1612
1958
  * Component classes
1613
1959
  */
1614
- this.classList = new index$1.ClassList(['mg-input--password']);
1960
+ this.classList = new ClassList(['mg-input--password']);
1615
1961
  /**
1616
1962
  * Handle input event
1617
1963
  */
@@ -1676,7 +2022,7 @@ const MgInputPassword = class {
1676
2022
  */
1677
2023
  componentWillLoad() {
1678
2024
  // Get locales
1679
- this.messages = index$1.initLocales(this.element).messages;
2025
+ this.messages = initLocales(this.element).messages;
1680
2026
  // Check validity when component is ready
1681
2027
  // return a promise to process action only in the FIRST render().
1682
2028
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
@@ -1750,7 +2096,7 @@ const MgInputRadio = class {
1750
2096
  /**
1751
2097
  * Component classes
1752
2098
  */
1753
- this.classList = new index$1.ClassList(['mg-input--radio']);
2099
+ this.classList = new ClassList(['mg-input--radio']);
1754
2100
  /**
1755
2101
  * Handle input event
1756
2102
  *
@@ -1814,7 +2160,7 @@ const MgInputRadio = class {
1814
2160
  throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
1815
2161
  }
1816
2162
  // String array
1817
- else if (index$1.allItemsAreString(newValue)) {
2163
+ else if (allItemsAreString(newValue)) {
1818
2164
  this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
1819
2165
  }
1820
2166
  // Object array
@@ -1844,7 +2190,7 @@ const MgInputRadio = class {
1844
2190
  */
1845
2191
  componentWillLoad() {
1846
2192
  // Get locales
1847
- this.messages = index$1.initLocales(this.element).messages;
2193
+ this.messages = initLocales(this.element).messages;
1848
2194
  // Validate
1849
2195
  this.validateItems(this.items);
1850
2196
  // Check validity when component is ready
@@ -1947,7 +2293,7 @@ const MgInputSelect = class {
1947
2293
  /**
1948
2294
  * Component classes
1949
2295
  */
1950
- this.classList = new index$1.ClassList(['mg-input--select']);
2296
+ this.classList = new ClassList(['mg-input--select']);
1951
2297
  /**
1952
2298
  * Handle input event
1953
2299
  */
@@ -1957,7 +2303,7 @@ const MgInputSelect = class {
1957
2303
  this.checkError();
1958
2304
  }
1959
2305
  if (this.input.value !== '') {
1960
- 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;
1961
2307
  }
1962
2308
  else {
1963
2309
  this.value = null;
@@ -1995,7 +2341,7 @@ const MgInputSelect = class {
1995
2341
  }
1996
2342
  handleValue(newValue) {
1997
2343
  if (newValue !== null) {
1998
- 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;
1999
2345
  }
2000
2346
  else {
2001
2347
  this.readonlyValue = null;
@@ -2004,7 +2350,7 @@ const MgInputSelect = class {
2004
2350
  }
2005
2351
  validateItems(newValue) {
2006
2352
  // String array
2007
- if (index$1.allItemsAreString(newValue)) {
2353
+ if (allItemsAreString(newValue)) {
2008
2354
  this.valueExist = newValue.includes(this.value);
2009
2355
  this.options = newValue.map((item) => ({ title: item, value: item }));
2010
2356
  }
@@ -2044,7 +2390,7 @@ const MgInputSelect = class {
2044
2390
  */
2045
2391
  componentWillLoad() {
2046
2392
  // Get locales
2047
- this.messages = index$1.initLocales(this.element).messages;
2393
+ this.messages = initLocales(this.element).messages;
2048
2394
  // Validate
2049
2395
  this.validateItems(this.items);
2050
2396
  // Set default placeholder
@@ -2131,7 +2477,7 @@ const MgInputText = class {
2131
2477
  /**
2132
2478
  * Component classes
2133
2479
  */
2134
- this.classList = new index$1.ClassList(['mg-input--text']);
2480
+ this.classList = new ClassList(['mg-input--text']);
2135
2481
  /**
2136
2482
  * Handle input event
2137
2483
  *
@@ -2151,7 +2497,7 @@ const MgInputText = class {
2151
2497
  */
2152
2498
  this.handleFocus = () => {
2153
2499
  this.classList.add(this.classFocus);
2154
- this.classList = new index$1.ClassList(this.classList.classes);
2500
+ this.classList = new ClassList(this.classList.classes);
2155
2501
  };
2156
2502
  /**
2157
2503
  * Handle blur event
@@ -2161,7 +2507,7 @@ const MgInputText = class {
2161
2507
  this.handleBlur = () => {
2162
2508
  // Manage focus
2163
2509
  this.classList.delete(this.classFocus);
2164
- this.classList = new index$1.ClassList(this.classList.classes);
2510
+ this.classList = new ClassList(this.classList.classes);
2165
2511
  // Display Error
2166
2512
  this.displayError();
2167
2513
  };
@@ -2265,7 +2611,7 @@ const MgInputText = class {
2265
2611
  */
2266
2612
  componentWillLoad() {
2267
2613
  // Get locales
2268
- this.messages = index$1.initLocales(this.element).messages;
2614
+ this.messages = initLocales(this.element).messages;
2269
2615
  this.characterLeftId = `${this.identifier}-character-left`;
2270
2616
  // Validate
2271
2617
  this.validateIcon(this.icon);
@@ -2357,7 +2703,7 @@ const MgInputTextarea = class {
2357
2703
  /**
2358
2704
  * Component classes
2359
2705
  */
2360
- this.classList = new index$1.ClassList(['mg-input--textarea']);
2706
+ this.classList = new ClassList(['mg-input--textarea']);
2361
2707
  /**
2362
2708
  * Handle input event
2363
2709
  */
@@ -2373,7 +2719,7 @@ const MgInputTextarea = class {
2373
2719
  */
2374
2720
  this.handleFocus = () => {
2375
2721
  this.classList.add(this.classFocus);
2376
- this.classList = new index$1.ClassList(this.classList.classes);
2722
+ this.classList = new ClassList(this.classList.classes);
2377
2723
  };
2378
2724
  /**
2379
2725
  * Handle blur event
@@ -2381,7 +2727,7 @@ const MgInputTextarea = class {
2381
2727
  this.handleBlur = () => {
2382
2728
  // Manage focus
2383
2729
  this.classList.delete(this.classFocus);
2384
- this.classList = new index$1.ClassList(this.classList.classes);
2730
+ this.classList = new ClassList(this.classList.classes);
2385
2731
  // Display Error
2386
2732
  this.displayError();
2387
2733
  };
@@ -2464,7 +2810,7 @@ const MgInputTextarea = class {
2464
2810
  */
2465
2811
  componentWillLoad() {
2466
2812
  // Get locales
2467
- this.messages = index$1.initLocales(this.element).messages;
2813
+ this.messages = initLocales(this.element).messages;
2468
2814
  this.characterLeftId = `${this.identifier}-character-left`;
2469
2815
  // Validate
2470
2816
  this.validateDisplayCharacterLeft(this.displayCharacterLeft);
@@ -2516,9 +2862,7 @@ const MgInputTitle = class {
2516
2862
  }
2517
2863
  validateIdentifier(newValue) {
2518
2864
  if (typeof newValue !== 'string' || newValue.trim() === '') {
2519
- // TODO: throw new Error on next major (5.0.0)
2520
- // throw new Error('<mg-input-title> prop "identifier" is required.');
2521
- console.error('<mg-input-title> prop "identifier" is required.');
2865
+ throw new Error('<mg-input-title> prop "identifier" is required.');
2522
2866
  }
2523
2867
  }
2524
2868
  /*************
@@ -2600,7 +2944,7 @@ const MgInputToggle = class {
2600
2944
  /**
2601
2945
  * Component classes
2602
2946
  */
2603
- this.classList = new index$1.ClassList(['mg-input--toggle']);
2947
+ this.classList = new ClassList(['mg-input--toggle']);
2604
2948
  /**
2605
2949
  * Checked internal value
2606
2950
  */
@@ -2641,7 +2985,7 @@ const MgInputToggle = class {
2641
2985
  throw new Error('<mg-input-toggle> prop "items" require 2 items.');
2642
2986
  }
2643
2987
  // String array
2644
- else if (index$1.allItemsAreString(newValue)) {
2988
+ else if (allItemsAreString(newValue)) {
2645
2989
  this.options = newValue.map(item => ({ title: item, value: item }));
2646
2990
  }
2647
2991
  // Object array
@@ -2774,7 +3118,7 @@ const MgMessage = class {
2774
3118
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
2775
3119
  * If not set, it will be created.
2776
3120
  */
2777
- this.identifier = index$1.createID('mg-message');
3121
+ this.identifier = createID('mg-message');
2778
3122
  /**
2779
3123
  * Message variant
2780
3124
  */
@@ -2791,7 +3135,7 @@ const MgMessage = class {
2791
3135
  /**
2792
3136
  * Component classes
2793
3137
  */
2794
- this.classList = new index$1.ClassList(['mg-message']);
3138
+ this.classList = new ClassList(['mg-message']);
2795
3139
  /**
2796
3140
  * Define if component is using actions slot
2797
3141
  */
@@ -2872,7 +3216,7 @@ const MgMessage = class {
2872
3216
  */
2873
3217
  componentWillLoad() {
2874
3218
  // Get locales
2875
- this.messages = index$1.initLocales(this.element).messages;
3219
+ this.messages = initLocales(this.element).messages;
2876
3220
  // Validate
2877
3221
  this.validateVariant(this.variant);
2878
3222
  // Check if close button is an can be activated
@@ -2903,6 +3247,174 @@ const MgMessage = class {
2903
3247
  };
2904
3248
  MgMessage.style = mgMessageCss;
2905
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
+
2906
3418
  var NavigationAction;
2907
3419
  (function (NavigationAction) {
2908
3420
  NavigationAction["NEXT"] = "next";
@@ -2940,7 +3452,7 @@ const MgPagination = class {
2940
3452
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
2941
3453
  * If not set, it will be created.
2942
3454
  */
2943
- this.identifier = index$1.createID('mg-pagination');
3455
+ this.identifier = createID('mg-pagination');
2944
3456
  /**
2945
3457
  * Component total pages
2946
3458
  */
@@ -2975,10 +3487,11 @@ const MgPagination = class {
2975
3487
  * Go to 'previous/next' page button handler
2976
3488
  *
2977
3489
  * @param {string} action navigation action
3490
+ * @param {boolean} disabled button disable state
2978
3491
  * @returns {void}
2979
3492
  */
2980
- this.handleGoToPage = (action) => {
2981
- this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
3493
+ this.handleGoToPage = (action, disabled) => {
3494
+ !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
2982
3495
  };
2983
3496
  }
2984
3497
  validateTotalPages(newValue) {
@@ -3005,7 +3518,7 @@ const MgPagination = class {
3005
3518
  */
3006
3519
  componentWillLoad() {
3007
3520
  // Get locales
3008
- this.messages = index$1.initLocales(this.element).messages;
3521
+ this.messages = initLocales(this.element).messages;
3009
3522
  // Validate
3010
3523
  this.validateTotalPages(this.totalPages);
3011
3524
  this.validateCurrentPage(this.currentPage);
@@ -3022,7 +3535,7 @@ const MgPagination = class {
3022
3535
  render() {
3023
3536
  const navigationActionButton = (disabled, action) => (index.h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
3024
3537
  // eslint-disable-next-line react/jsx-no-bind
3025
- onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && index.h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && index.h("mg-icon", { icon: "chevron-right" })));
3538
+ onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && index.h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && index.h("mg-icon", { icon: "chevron-right" })));
3026
3539
  return (index.h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), index.h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), index.h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), index.h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
3027
3540
  }
3028
3541
  get element() { return index.getElement(this); }
@@ -3033,7 +3546,7 @@ const MgPagination = class {
3033
3546
  };
3034
3547
  MgPagination.style = mgPaginationCss;
3035
3548
 
3036
- 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{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__header-left mg-button:not([slot=append-input]){margin:0 0.3rem 0 0}.mg-panel__header-left mg-button:not([slot=append-input])>*:first-of-type{font-family:var(--font-family-heading);font-size:1.4rem;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}";
3037
3550
 
3038
3551
  const MgPanel = class {
3039
3552
  constructor(hostRef) {
@@ -3044,7 +3557,7 @@ const MgPanel = class {
3044
3557
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
3045
3558
  * If not set, it will be created.
3046
3559
  */
3047
- this.identifier = index$1.createID('mg-panel');
3560
+ this.identifier = createID('mg-panel');
3048
3561
  /**
3049
3562
  * Panel is opened
3050
3563
  */
@@ -3056,7 +3569,7 @@ const MgPanel = class {
3056
3569
  /**
3057
3570
  * Component classes
3058
3571
  */
3059
- this.classList = new index$1.ClassList(['mg-panel']);
3572
+ this.classList = new ClassList(['mg-panel']);
3060
3573
  /**
3061
3574
  * Title is in edition mode
3062
3575
  */
@@ -3130,7 +3643,7 @@ const MgPanel = class {
3130
3643
  * @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
3131
3644
  */
3132
3645
  this.headerLeft = () => {
3133
- const collapseButton = () => (index.h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled }, index.h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle));
3646
+ const collapseButton = () => (index.h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled }, index.h("span", { class: "mg-panel__collapse-button-content" }, index.h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle)));
3134
3647
  if (this.titleEditable && !this.isEditing) {
3135
3648
  return [
3136
3649
  collapseButton(),
@@ -3148,9 +3661,7 @@ const MgPanel = class {
3148
3661
  }
3149
3662
  validatePanelTitle(newValue) {
3150
3663
  if (typeof newValue !== 'string' || newValue.trim() === '') {
3151
- // TODO: throw new Error on next major (5.0.0)
3152
- // throw new Error('<mg-panel> prop "panelTitle" is required.');
3153
- console.error('<mg-panel> prop "panelTitle" is required.');
3664
+ throw new Error('<mg-panel> prop "panelTitle" is required.');
3154
3665
  }
3155
3666
  this.titleChange.emit(newValue);
3156
3667
  }
@@ -3175,7 +3686,7 @@ const MgPanel = class {
3175
3686
  */
3176
3687
  componentWillLoad() {
3177
3688
  // Get locales
3178
- this.messages = index$1.initLocales(this.element).messages;
3689
+ this.messages = initLocales(this.element).messages;
3179
3690
  // Validate
3180
3691
  this.validatetitlePattern(this.titlePattern);
3181
3692
  this.validatePanelTitle(this.panelTitle);
@@ -3208,32 +3719,1992 @@ const MgPanel = class {
3208
3719
  };
3209
3720
  MgPanel.style = mgPanelCss;
3210
3721
 
3211
- var Status;
3212
- (function (Status) {
3213
- Status["VISIBLE"] = "visible";
3214
- Status["HIDDEN"] = "hidden";
3215
- Status["DISABLED"] = "disabled";
3216
- Status["ACTIVE"] = "active";
3217
- })(Status || (Status = {}));
3218
- /**
3219
- * List of all possibles sizes
3220
- */
3221
- const sizes = ['regular', 'large'];
3722
+ var top = 'top';
3723
+ var bottom = 'bottom';
3724
+ var right = 'right';
3725
+ var left = 'left';
3726
+ var auto = 'auto';
3727
+ var basePlacements = [top, bottom, right, left];
3728
+ var start = 'start';
3729
+ var end = 'end';
3730
+ var clippingParents = 'clippingParents';
3731
+ var viewport = 'viewport';
3732
+ var popper = 'popper';
3733
+ var reference = 'reference';
3734
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
3735
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
3736
+ }, []);
3737
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
3738
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
3739
+ }, []); // modifiers that need to read the DOM
3222
3740
 
3223
- const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;font-family:var(--font-family);color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
3741
+ var beforeRead = 'beforeRead';
3742
+ var read = 'read';
3743
+ var afterRead = 'afterRead'; // pure-logic modifiers
3224
3744
 
3225
- /**
3226
- * type TabItem validation function
3227
- *
3228
- * @param {TabItem} tab tab item
3229
- * @returns {boolean} tab item type is valid
3230
- */
3231
- const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
3232
- const MgTabs = class {
3233
- constructor(hostRef) {
3234
- index.registerInstance(this, hostRef);
3235
- this.activeTabChange = index.createEvent(this, "active-tab-change", 7);
3236
- /************
3745
+ var beforeMain = 'beforeMain';
3746
+ var main = 'main';
3747
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
3748
+
3749
+ var beforeWrite = 'beforeWrite';
3750
+ var write = 'write';
3751
+ var afterWrite = 'afterWrite';
3752
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
3753
+
3754
+ function getNodeName(element) {
3755
+ return element ? (element.nodeName || '').toLowerCase() : null;
3756
+ }
3757
+
3758
+ function getWindow(node) {
3759
+ if (node == null) {
3760
+ return window;
3761
+ }
3762
+
3763
+ if (node.toString() !== '[object Window]') {
3764
+ var ownerDocument = node.ownerDocument;
3765
+ return ownerDocument ? ownerDocument.defaultView || window : window;
3766
+ }
3767
+
3768
+ return node;
3769
+ }
3770
+
3771
+ function isElement(node) {
3772
+ var OwnElement = getWindow(node).Element;
3773
+ return node instanceof OwnElement || node instanceof Element;
3774
+ }
3775
+
3776
+ function isHTMLElement(node) {
3777
+ var OwnElement = getWindow(node).HTMLElement;
3778
+ return node instanceof OwnElement || node instanceof HTMLElement;
3779
+ }
3780
+
3781
+ function isShadowRoot(node) {
3782
+ // IE 11 has no ShadowRoot
3783
+ if (typeof ShadowRoot === 'undefined') {
3784
+ return false;
3785
+ }
3786
+
3787
+ var OwnElement = getWindow(node).ShadowRoot;
3788
+ return node instanceof OwnElement || node instanceof ShadowRoot;
3789
+ }
3790
+
3791
+ // and applies them to the HTMLElements such as popper and arrow
3792
+
3793
+ function applyStyles(_ref) {
3794
+ var state = _ref.state;
3795
+ Object.keys(state.elements).forEach(function (name) {
3796
+ var style = state.styles[name] || {};
3797
+ var attributes = state.attributes[name] || {};
3798
+ var element = state.elements[name]; // arrow is optional + virtual elements
3799
+
3800
+ if (!isHTMLElement(element) || !getNodeName(element)) {
3801
+ return;
3802
+ } // Flow doesn't support to extend this property, but it's the most
3803
+ // effective way to apply styles to an HTMLElement
3804
+ // $FlowFixMe[cannot-write]
3805
+
3806
+
3807
+ Object.assign(element.style, style);
3808
+ Object.keys(attributes).forEach(function (name) {
3809
+ var value = attributes[name];
3810
+
3811
+ if (value === false) {
3812
+ element.removeAttribute(name);
3813
+ } else {
3814
+ element.setAttribute(name, value === true ? '' : value);
3815
+ }
3816
+ });
3817
+ });
3818
+ }
3819
+
3820
+ function effect$2(_ref2) {
3821
+ var state = _ref2.state;
3822
+ var initialStyles = {
3823
+ popper: {
3824
+ position: state.options.strategy,
3825
+ left: '0',
3826
+ top: '0',
3827
+ margin: '0'
3828
+ },
3829
+ arrow: {
3830
+ position: 'absolute'
3831
+ },
3832
+ reference: {}
3833
+ };
3834
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3835
+ state.styles = initialStyles;
3836
+
3837
+ if (state.elements.arrow) {
3838
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3839
+ }
3840
+
3841
+ return function () {
3842
+ Object.keys(state.elements).forEach(function (name) {
3843
+ var element = state.elements[name];
3844
+ var attributes = state.attributes[name] || {};
3845
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
3846
+
3847
+ var style = styleProperties.reduce(function (style, property) {
3848
+ style[property] = '';
3849
+ return style;
3850
+ }, {}); // arrow is optional + virtual elements
3851
+
3852
+ if (!isHTMLElement(element) || !getNodeName(element)) {
3853
+ return;
3854
+ }
3855
+
3856
+ Object.assign(element.style, style);
3857
+ Object.keys(attributes).forEach(function (attribute) {
3858
+ element.removeAttribute(attribute);
3859
+ });
3860
+ });
3861
+ };
3862
+ } // eslint-disable-next-line import/no-unused-modules
3863
+
3864
+
3865
+ const applyStyles$1 = {
3866
+ name: 'applyStyles',
3867
+ enabled: true,
3868
+ phase: 'write',
3869
+ fn: applyStyles,
3870
+ effect: effect$2,
3871
+ requires: ['computeStyles']
3872
+ };
3873
+
3874
+ function getBasePlacement(placement) {
3875
+ return placement.split('-')[0];
3876
+ }
3877
+
3878
+ var max = Math.max;
3879
+ var min = Math.min;
3880
+ var round = Math.round;
3881
+
3882
+ function getUAString() {
3883
+ var uaData = navigator.userAgentData;
3884
+
3885
+ if (uaData != null && uaData.brands) {
3886
+ return uaData.brands.map(function (item) {
3887
+ return item.brand + "/" + item.version;
3888
+ }).join(' ');
3889
+ }
3890
+
3891
+ return navigator.userAgent;
3892
+ }
3893
+
3894
+ function isLayoutViewport() {
3895
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
3896
+ }
3897
+
3898
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
3899
+ if (includeScale === void 0) {
3900
+ includeScale = false;
3901
+ }
3902
+
3903
+ if (isFixedStrategy === void 0) {
3904
+ isFixedStrategy = false;
3905
+ }
3906
+
3907
+ var clientRect = element.getBoundingClientRect();
3908
+ var scaleX = 1;
3909
+ var scaleY = 1;
3910
+
3911
+ if (includeScale && isHTMLElement(element)) {
3912
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
3913
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
3914
+ }
3915
+
3916
+ var _ref = isElement(element) ? getWindow(element) : window,
3917
+ visualViewport = _ref.visualViewport;
3918
+
3919
+ var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
3920
+ var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
3921
+ var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
3922
+ var width = clientRect.width / scaleX;
3923
+ var height = clientRect.height / scaleY;
3924
+ return {
3925
+ width: width,
3926
+ height: height,
3927
+ top: y,
3928
+ right: x + width,
3929
+ bottom: y + height,
3930
+ left: x,
3931
+ x: x,
3932
+ y: y
3933
+ };
3934
+ }
3935
+
3936
+ // means it doesn't take into account transforms.
3937
+
3938
+ function getLayoutRect(element) {
3939
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
3940
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
3941
+
3942
+ var width = element.offsetWidth;
3943
+ var height = element.offsetHeight;
3944
+
3945
+ if (Math.abs(clientRect.width - width) <= 1) {
3946
+ width = clientRect.width;
3947
+ }
3948
+
3949
+ if (Math.abs(clientRect.height - height) <= 1) {
3950
+ height = clientRect.height;
3951
+ }
3952
+
3953
+ return {
3954
+ x: element.offsetLeft,
3955
+ y: element.offsetTop,
3956
+ width: width,
3957
+ height: height
3958
+ };
3959
+ }
3960
+
3961
+ function contains(parent, child) {
3962
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3963
+
3964
+ if (parent.contains(child)) {
3965
+ return true;
3966
+ } // then fallback to custom implementation with Shadow DOM support
3967
+ else if (rootNode && isShadowRoot(rootNode)) {
3968
+ var next = child;
3969
+
3970
+ do {
3971
+ if (next && parent.isSameNode(next)) {
3972
+ return true;
3973
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
3974
+
3975
+
3976
+ next = next.parentNode || next.host;
3977
+ } while (next);
3978
+ } // Give up, the result is false
3979
+
3980
+
3981
+ return false;
3982
+ }
3983
+
3984
+ function getComputedStyle(element) {
3985
+ return getWindow(element).getComputedStyle(element);
3986
+ }
3987
+
3988
+ function isTableElement(element) {
3989
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
3990
+ }
3991
+
3992
+ function getDocumentElement(element) {
3993
+ // $FlowFixMe[incompatible-return]: assume body is always available
3994
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
3995
+ element.document) || window.document).documentElement;
3996
+ }
3997
+
3998
+ function getParentNode(element) {
3999
+ if (getNodeName(element) === 'html') {
4000
+ return element;
4001
+ }
4002
+
4003
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
4004
+ // $FlowFixMe[incompatible-return]
4005
+ // $FlowFixMe[prop-missing]
4006
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
4007
+ element.parentNode || ( // DOM Element detected
4008
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
4009
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
4010
+ getDocumentElement(element) // fallback
4011
+
4012
+ );
4013
+ }
4014
+
4015
+ function getTrueOffsetParent(element) {
4016
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
4017
+ getComputedStyle(element).position === 'fixed') {
4018
+ return null;
4019
+ }
4020
+
4021
+ return element.offsetParent;
4022
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
4023
+ // return the containing block
4024
+
4025
+
4026
+ function getContainingBlock(element) {
4027
+ var isFirefox = /firefox/i.test(getUAString());
4028
+ var isIE = /Trident/i.test(getUAString());
4029
+
4030
+ if (isIE && isHTMLElement(element)) {
4031
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
4032
+ var elementCss = getComputedStyle(element);
4033
+
4034
+ if (elementCss.position === 'fixed') {
4035
+ return null;
4036
+ }
4037
+ }
4038
+
4039
+ var currentNode = getParentNode(element);
4040
+
4041
+ if (isShadowRoot(currentNode)) {
4042
+ currentNode = currentNode.host;
4043
+ }
4044
+
4045
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
4046
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
4047
+ // create a containing block.
4048
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
4049
+
4050
+ if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
4051
+ return currentNode;
4052
+ } else {
4053
+ currentNode = currentNode.parentNode;
4054
+ }
4055
+ }
4056
+
4057
+ return null;
4058
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
4059
+ // such as table ancestors and cross browser bugs.
4060
+
4061
+
4062
+ function getOffsetParent(element) {
4063
+ var window = getWindow(element);
4064
+ var offsetParent = getTrueOffsetParent(element);
4065
+
4066
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
4067
+ offsetParent = getTrueOffsetParent(offsetParent);
4068
+ }
4069
+
4070
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
4071
+ return window;
4072
+ }
4073
+
4074
+ return offsetParent || getContainingBlock(element) || window;
4075
+ }
4076
+
4077
+ function getMainAxisFromPlacement(placement) {
4078
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
4079
+ }
4080
+
4081
+ function within(min$1, value, max$1) {
4082
+ return max(min$1, min(value, max$1));
4083
+ }
4084
+ function withinMaxClamp(min, value, max) {
4085
+ var v = within(min, value, max);
4086
+ return v > max ? max : v;
4087
+ }
4088
+
4089
+ function getFreshSideObject() {
4090
+ return {
4091
+ top: 0,
4092
+ right: 0,
4093
+ bottom: 0,
4094
+ left: 0
4095
+ };
4096
+ }
4097
+
4098
+ function mergePaddingObject(paddingObject) {
4099
+ return Object.assign({}, getFreshSideObject(), paddingObject);
4100
+ }
4101
+
4102
+ function expandToHashMap(value, keys) {
4103
+ return keys.reduce(function (hashMap, key) {
4104
+ hashMap[key] = value;
4105
+ return hashMap;
4106
+ }, {});
4107
+ }
4108
+
4109
+ var toPaddingObject = function toPaddingObject(padding, state) {
4110
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
4111
+ placement: state.placement
4112
+ })) : padding;
4113
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
4114
+ };
4115
+
4116
+ function arrow(_ref) {
4117
+ var _state$modifiersData$;
4118
+
4119
+ var state = _ref.state,
4120
+ name = _ref.name,
4121
+ options = _ref.options;
4122
+ var arrowElement = state.elements.arrow;
4123
+ var popperOffsets = state.modifiersData.popperOffsets;
4124
+ var basePlacement = getBasePlacement(state.placement);
4125
+ var axis = getMainAxisFromPlacement(basePlacement);
4126
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
4127
+ var len = isVertical ? 'height' : 'width';
4128
+
4129
+ if (!arrowElement || !popperOffsets) {
4130
+ return;
4131
+ }
4132
+
4133
+ var paddingObject = toPaddingObject(options.padding, state);
4134
+ var arrowRect = getLayoutRect(arrowElement);
4135
+ var minProp = axis === 'y' ? top : left;
4136
+ var maxProp = axis === 'y' ? bottom : right;
4137
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
4138
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
4139
+ var arrowOffsetParent = getOffsetParent(arrowElement);
4140
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
4141
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
4142
+ // outside of the popper bounds
4143
+
4144
+ var min = paddingObject[minProp];
4145
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
4146
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
4147
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
4148
+
4149
+ var axisProp = axis;
4150
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
4151
+ }
4152
+
4153
+ function effect$1(_ref2) {
4154
+ var state = _ref2.state,
4155
+ options = _ref2.options;
4156
+ var _options$element = options.element,
4157
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
4158
+
4159
+ if (arrowElement == null) {
4160
+ return;
4161
+ } // CSS selector
4162
+
4163
+
4164
+ if (typeof arrowElement === 'string') {
4165
+ arrowElement = state.elements.popper.querySelector(arrowElement);
4166
+
4167
+ if (!arrowElement) {
4168
+ return;
4169
+ }
4170
+ }
4171
+
4172
+ if (!contains(state.elements.popper, arrowElement)) {
4173
+
4174
+ return;
4175
+ }
4176
+
4177
+ state.elements.arrow = arrowElement;
4178
+ } // eslint-disable-next-line import/no-unused-modules
4179
+
4180
+
4181
+ const arrow$1 = {
4182
+ name: 'arrow',
4183
+ enabled: true,
4184
+ phase: 'main',
4185
+ fn: arrow,
4186
+ effect: effect$1,
4187
+ requires: ['popperOffsets'],
4188
+ requiresIfExists: ['preventOverflow']
4189
+ };
4190
+
4191
+ function getVariation(placement) {
4192
+ return placement.split('-')[1];
4193
+ }
4194
+
4195
+ var unsetSides = {
4196
+ top: 'auto',
4197
+ right: 'auto',
4198
+ bottom: 'auto',
4199
+ left: 'auto'
4200
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
4201
+ // Zooming can change the DPR, but it seems to report a value that will
4202
+ // cleanly divide the values into the appropriate subpixels.
4203
+
4204
+ function roundOffsetsByDPR(_ref) {
4205
+ var x = _ref.x,
4206
+ y = _ref.y;
4207
+ var win = window;
4208
+ var dpr = win.devicePixelRatio || 1;
4209
+ return {
4210
+ x: round(x * dpr) / dpr || 0,
4211
+ y: round(y * dpr) / dpr || 0
4212
+ };
4213
+ }
4214
+
4215
+ function mapToStyles(_ref2) {
4216
+ var _Object$assign2;
4217
+
4218
+ var popper = _ref2.popper,
4219
+ popperRect = _ref2.popperRect,
4220
+ placement = _ref2.placement,
4221
+ variation = _ref2.variation,
4222
+ offsets = _ref2.offsets,
4223
+ position = _ref2.position,
4224
+ gpuAcceleration = _ref2.gpuAcceleration,
4225
+ adaptive = _ref2.adaptive,
4226
+ roundOffsets = _ref2.roundOffsets,
4227
+ isFixed = _ref2.isFixed;
4228
+ var _offsets$x = offsets.x,
4229
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
4230
+ _offsets$y = offsets.y,
4231
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
4232
+
4233
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
4234
+ x: x,
4235
+ y: y
4236
+ }) : {
4237
+ x: x,
4238
+ y: y
4239
+ };
4240
+
4241
+ x = _ref3.x;
4242
+ y = _ref3.y;
4243
+ var hasX = offsets.hasOwnProperty('x');
4244
+ var hasY = offsets.hasOwnProperty('y');
4245
+ var sideX = left;
4246
+ var sideY = top;
4247
+ var win = window;
4248
+
4249
+ if (adaptive) {
4250
+ var offsetParent = getOffsetParent(popper);
4251
+ var heightProp = 'clientHeight';
4252
+ var widthProp = 'clientWidth';
4253
+
4254
+ if (offsetParent === getWindow(popper)) {
4255
+ offsetParent = getDocumentElement(popper);
4256
+
4257
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
4258
+ heightProp = 'scrollHeight';
4259
+ widthProp = 'scrollWidth';
4260
+ }
4261
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
4262
+
4263
+
4264
+ offsetParent = offsetParent;
4265
+
4266
+ if (placement === top || (placement === left || placement === right) && variation === end) {
4267
+ sideY = bottom;
4268
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
4269
+ offsetParent[heightProp];
4270
+ y -= offsetY - popperRect.height;
4271
+ y *= gpuAcceleration ? 1 : -1;
4272
+ }
4273
+
4274
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
4275
+ sideX = right;
4276
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
4277
+ offsetParent[widthProp];
4278
+ x -= offsetX - popperRect.width;
4279
+ x *= gpuAcceleration ? 1 : -1;
4280
+ }
4281
+ }
4282
+
4283
+ var commonStyles = Object.assign({
4284
+ position: position
4285
+ }, adaptive && unsetSides);
4286
+
4287
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
4288
+ x: x,
4289
+ y: y
4290
+ }) : {
4291
+ x: x,
4292
+ y: y
4293
+ };
4294
+
4295
+ x = _ref4.x;
4296
+ y = _ref4.y;
4297
+
4298
+ if (gpuAcceleration) {
4299
+ var _Object$assign;
4300
+
4301
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
4302
+ }
4303
+
4304
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
4305
+ }
4306
+
4307
+ function computeStyles(_ref5) {
4308
+ var state = _ref5.state,
4309
+ options = _ref5.options;
4310
+ var _options$gpuAccelerat = options.gpuAcceleration,
4311
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
4312
+ _options$adaptive = options.adaptive,
4313
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
4314
+ _options$roundOffsets = options.roundOffsets,
4315
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
4316
+
4317
+ var commonStyles = {
4318
+ placement: getBasePlacement(state.placement),
4319
+ variation: getVariation(state.placement),
4320
+ popper: state.elements.popper,
4321
+ popperRect: state.rects.popper,
4322
+ gpuAcceleration: gpuAcceleration,
4323
+ isFixed: state.options.strategy === 'fixed'
4324
+ };
4325
+
4326
+ if (state.modifiersData.popperOffsets != null) {
4327
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
4328
+ offsets: state.modifiersData.popperOffsets,
4329
+ position: state.options.strategy,
4330
+ adaptive: adaptive,
4331
+ roundOffsets: roundOffsets
4332
+ })));
4333
+ }
4334
+
4335
+ if (state.modifiersData.arrow != null) {
4336
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
4337
+ offsets: state.modifiersData.arrow,
4338
+ position: 'absolute',
4339
+ adaptive: false,
4340
+ roundOffsets: roundOffsets
4341
+ })));
4342
+ }
4343
+
4344
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
4345
+ 'data-popper-placement': state.placement
4346
+ });
4347
+ } // eslint-disable-next-line import/no-unused-modules
4348
+
4349
+
4350
+ const computeStyles$1 = {
4351
+ name: 'computeStyles',
4352
+ enabled: true,
4353
+ phase: 'beforeWrite',
4354
+ fn: computeStyles,
4355
+ data: {}
4356
+ };
4357
+
4358
+ var passive = {
4359
+ passive: true
4360
+ };
4361
+
4362
+ function effect(_ref) {
4363
+ var state = _ref.state,
4364
+ instance = _ref.instance,
4365
+ options = _ref.options;
4366
+ var _options$scroll = options.scroll,
4367
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
4368
+ _options$resize = options.resize,
4369
+ resize = _options$resize === void 0 ? true : _options$resize;
4370
+ var window = getWindow(state.elements.popper);
4371
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
4372
+
4373
+ if (scroll) {
4374
+ scrollParents.forEach(function (scrollParent) {
4375
+ scrollParent.addEventListener('scroll', instance.update, passive);
4376
+ });
4377
+ }
4378
+
4379
+ if (resize) {
4380
+ window.addEventListener('resize', instance.update, passive);
4381
+ }
4382
+
4383
+ return function () {
4384
+ if (scroll) {
4385
+ scrollParents.forEach(function (scrollParent) {
4386
+ scrollParent.removeEventListener('scroll', instance.update, passive);
4387
+ });
4388
+ }
4389
+
4390
+ if (resize) {
4391
+ window.removeEventListener('resize', instance.update, passive);
4392
+ }
4393
+ };
4394
+ } // eslint-disable-next-line import/no-unused-modules
4395
+
4396
+
4397
+ const eventListeners = {
4398
+ name: 'eventListeners',
4399
+ enabled: true,
4400
+ phase: 'write',
4401
+ fn: function fn() {},
4402
+ effect: effect,
4403
+ data: {}
4404
+ };
4405
+
4406
+ var hash$1 = {
4407
+ left: 'right',
4408
+ right: 'left',
4409
+ bottom: 'top',
4410
+ top: 'bottom'
4411
+ };
4412
+ function getOppositePlacement(placement) {
4413
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
4414
+ return hash$1[matched];
4415
+ });
4416
+ }
4417
+
4418
+ var hash = {
4419
+ start: 'end',
4420
+ end: 'start'
4421
+ };
4422
+ function getOppositeVariationPlacement(placement) {
4423
+ return placement.replace(/start|end/g, function (matched) {
4424
+ return hash[matched];
4425
+ });
4426
+ }
4427
+
4428
+ function getWindowScroll(node) {
4429
+ var win = getWindow(node);
4430
+ var scrollLeft = win.pageXOffset;
4431
+ var scrollTop = win.pageYOffset;
4432
+ return {
4433
+ scrollLeft: scrollLeft,
4434
+ scrollTop: scrollTop
4435
+ };
4436
+ }
4437
+
4438
+ function getWindowScrollBarX(element) {
4439
+ // If <html> has a CSS width greater than the viewport, then this will be
4440
+ // incorrect for RTL.
4441
+ // Popper 1 is broken in this case and never had a bug report so let's assume
4442
+ // it's not an issue. I don't think anyone ever specifies width on <html>
4443
+ // anyway.
4444
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
4445
+ // this (e.g. Edge 2019, IE11, Safari)
4446
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
4447
+ }
4448
+
4449
+ function getViewportRect(element, strategy) {
4450
+ var win = getWindow(element);
4451
+ var html = getDocumentElement(element);
4452
+ var visualViewport = win.visualViewport;
4453
+ var width = html.clientWidth;
4454
+ var height = html.clientHeight;
4455
+ var x = 0;
4456
+ var y = 0;
4457
+
4458
+ if (visualViewport) {
4459
+ width = visualViewport.width;
4460
+ height = visualViewport.height;
4461
+ var layoutViewport = isLayoutViewport();
4462
+
4463
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
4464
+ x = visualViewport.offsetLeft;
4465
+ y = visualViewport.offsetTop;
4466
+ }
4467
+ }
4468
+
4469
+ return {
4470
+ width: width,
4471
+ height: height,
4472
+ x: x + getWindowScrollBarX(element),
4473
+ y: y
4474
+ };
4475
+ }
4476
+
4477
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
4478
+
4479
+ function getDocumentRect(element) {
4480
+ var _element$ownerDocumen;
4481
+
4482
+ var html = getDocumentElement(element);
4483
+ var winScroll = getWindowScroll(element);
4484
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
4485
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
4486
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
4487
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
4488
+ var y = -winScroll.scrollTop;
4489
+
4490
+ if (getComputedStyle(body || html).direction === 'rtl') {
4491
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
4492
+ }
4493
+
4494
+ return {
4495
+ width: width,
4496
+ height: height,
4497
+ x: x,
4498
+ y: y
4499
+ };
4500
+ }
4501
+
4502
+ function isScrollParent(element) {
4503
+ // Firefox wants us to check `-x` and `-y` variations as well
4504
+ var _getComputedStyle = getComputedStyle(element),
4505
+ overflow = _getComputedStyle.overflow,
4506
+ overflowX = _getComputedStyle.overflowX,
4507
+ overflowY = _getComputedStyle.overflowY;
4508
+
4509
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
4510
+ }
4511
+
4512
+ function getScrollParent(node) {
4513
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
4514
+ // $FlowFixMe[incompatible-return]: assume body is always available
4515
+ return node.ownerDocument.body;
4516
+ }
4517
+
4518
+ if (isHTMLElement(node) && isScrollParent(node)) {
4519
+ return node;
4520
+ }
4521
+
4522
+ return getScrollParent(getParentNode(node));
4523
+ }
4524
+
4525
+ /*
4526
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
4527
+ until we get to the top window object. This list is what we attach scroll listeners
4528
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
4529
+ reference element's position.
4530
+ */
4531
+
4532
+ function listScrollParents(element, list) {
4533
+ var _element$ownerDocumen;
4534
+
4535
+ if (list === void 0) {
4536
+ list = [];
4537
+ }
4538
+
4539
+ var scrollParent = getScrollParent(element);
4540
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
4541
+ var win = getWindow(scrollParent);
4542
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
4543
+ var updatedList = list.concat(target);
4544
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
4545
+ updatedList.concat(listScrollParents(getParentNode(target)));
4546
+ }
4547
+
4548
+ function rectToClientRect(rect) {
4549
+ return Object.assign({}, rect, {
4550
+ left: rect.x,
4551
+ top: rect.y,
4552
+ right: rect.x + rect.width,
4553
+ bottom: rect.y + rect.height
4554
+ });
4555
+ }
4556
+
4557
+ function getInnerBoundingClientRect(element, strategy) {
4558
+ var rect = getBoundingClientRect(element, false, strategy === 'fixed');
4559
+ rect.top = rect.top + element.clientTop;
4560
+ rect.left = rect.left + element.clientLeft;
4561
+ rect.bottom = rect.top + element.clientHeight;
4562
+ rect.right = rect.left + element.clientWidth;
4563
+ rect.width = element.clientWidth;
4564
+ rect.height = element.clientHeight;
4565
+ rect.x = rect.left;
4566
+ rect.y = rect.top;
4567
+ return rect;
4568
+ }
4569
+
4570
+ function getClientRectFromMixedType(element, clippingParent, strategy) {
4571
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
4572
+ } // A "clipping parent" is an overflowable container with the characteristic of
4573
+ // clipping (or hiding) overflowing elements with a position different from
4574
+ // `initial`
4575
+
4576
+
4577
+ function getClippingParents(element) {
4578
+ var clippingParents = listScrollParents(getParentNode(element));
4579
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
4580
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
4581
+
4582
+ if (!isElement(clipperElement)) {
4583
+ return [];
4584
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
4585
+
4586
+
4587
+ return clippingParents.filter(function (clippingParent) {
4588
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
4589
+ });
4590
+ } // Gets the maximum area that the element is visible in due to any number of
4591
+ // clipping parents
4592
+
4593
+
4594
+ function getClippingRect(element, boundary, rootBoundary, strategy) {
4595
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
4596
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
4597
+ var firstClippingParent = clippingParents[0];
4598
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
4599
+ var rect = getClientRectFromMixedType(element, clippingParent, strategy);
4600
+ accRect.top = max(rect.top, accRect.top);
4601
+ accRect.right = min(rect.right, accRect.right);
4602
+ accRect.bottom = min(rect.bottom, accRect.bottom);
4603
+ accRect.left = max(rect.left, accRect.left);
4604
+ return accRect;
4605
+ }, getClientRectFromMixedType(element, firstClippingParent, strategy));
4606
+ clippingRect.width = clippingRect.right - clippingRect.left;
4607
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
4608
+ clippingRect.x = clippingRect.left;
4609
+ clippingRect.y = clippingRect.top;
4610
+ return clippingRect;
4611
+ }
4612
+
4613
+ function computeOffsets(_ref) {
4614
+ var reference = _ref.reference,
4615
+ element = _ref.element,
4616
+ placement = _ref.placement;
4617
+ var basePlacement = placement ? getBasePlacement(placement) : null;
4618
+ var variation = placement ? getVariation(placement) : null;
4619
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
4620
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
4621
+ var offsets;
4622
+
4623
+ switch (basePlacement) {
4624
+ case top:
4625
+ offsets = {
4626
+ x: commonX,
4627
+ y: reference.y - element.height
4628
+ };
4629
+ break;
4630
+
4631
+ case bottom:
4632
+ offsets = {
4633
+ x: commonX,
4634
+ y: reference.y + reference.height
4635
+ };
4636
+ break;
4637
+
4638
+ case right:
4639
+ offsets = {
4640
+ x: reference.x + reference.width,
4641
+ y: commonY
4642
+ };
4643
+ break;
4644
+
4645
+ case left:
4646
+ offsets = {
4647
+ x: reference.x - element.width,
4648
+ y: commonY
4649
+ };
4650
+ break;
4651
+
4652
+ default:
4653
+ offsets = {
4654
+ x: reference.x,
4655
+ y: reference.y
4656
+ };
4657
+ }
4658
+
4659
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
4660
+
4661
+ if (mainAxis != null) {
4662
+ var len = mainAxis === 'y' ? 'height' : 'width';
4663
+
4664
+ switch (variation) {
4665
+ case start:
4666
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
4667
+ break;
4668
+
4669
+ case end:
4670
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
4671
+ break;
4672
+ }
4673
+ }
4674
+
4675
+ return offsets;
4676
+ }
4677
+
4678
+ function detectOverflow(state, options) {
4679
+ if (options === void 0) {
4680
+ options = {};
4681
+ }
4682
+
4683
+ var _options = options,
4684
+ _options$placement = _options.placement,
4685
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
4686
+ _options$strategy = _options.strategy,
4687
+ strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
4688
+ _options$boundary = _options.boundary,
4689
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
4690
+ _options$rootBoundary = _options.rootBoundary,
4691
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
4692
+ _options$elementConte = _options.elementContext,
4693
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
4694
+ _options$altBoundary = _options.altBoundary,
4695
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
4696
+ _options$padding = _options.padding,
4697
+ padding = _options$padding === void 0 ? 0 : _options$padding;
4698
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
4699
+ var altContext = elementContext === popper ? reference : popper;
4700
+ var popperRect = state.rects.popper;
4701
+ var element = state.elements[altBoundary ? altContext : elementContext];
4702
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
4703
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
4704
+ var popperOffsets = computeOffsets({
4705
+ reference: referenceClientRect,
4706
+ element: popperRect,
4707
+ strategy: 'absolute',
4708
+ placement: placement
4709
+ });
4710
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
4711
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
4712
+ // 0 or negative = within the clipping rect
4713
+
4714
+ var overflowOffsets = {
4715
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
4716
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
4717
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
4718
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
4719
+ };
4720
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
4721
+
4722
+ if (elementContext === popper && offsetData) {
4723
+ var offset = offsetData[placement];
4724
+ Object.keys(overflowOffsets).forEach(function (key) {
4725
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
4726
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
4727
+ overflowOffsets[key] += offset[axis] * multiply;
4728
+ });
4729
+ }
4730
+
4731
+ return overflowOffsets;
4732
+ }
4733
+
4734
+ function computeAutoPlacement(state, options) {
4735
+ if (options === void 0) {
4736
+ options = {};
4737
+ }
4738
+
4739
+ var _options = options,
4740
+ placement = _options.placement,
4741
+ boundary = _options.boundary,
4742
+ rootBoundary = _options.rootBoundary,
4743
+ padding = _options.padding,
4744
+ flipVariations = _options.flipVariations,
4745
+ _options$allowedAutoP = _options.allowedAutoPlacements,
4746
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
4747
+ var variation = getVariation(placement);
4748
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
4749
+ return getVariation(placement) === variation;
4750
+ }) : basePlacements;
4751
+ var allowedPlacements = placements$1.filter(function (placement) {
4752
+ return allowedAutoPlacements.indexOf(placement) >= 0;
4753
+ });
4754
+
4755
+ if (allowedPlacements.length === 0) {
4756
+ allowedPlacements = placements$1;
4757
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
4758
+
4759
+
4760
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
4761
+ acc[placement] = detectOverflow(state, {
4762
+ placement: placement,
4763
+ boundary: boundary,
4764
+ rootBoundary: rootBoundary,
4765
+ padding: padding
4766
+ })[getBasePlacement(placement)];
4767
+ return acc;
4768
+ }, {});
4769
+ return Object.keys(overflows).sort(function (a, b) {
4770
+ return overflows[a] - overflows[b];
4771
+ });
4772
+ }
4773
+
4774
+ function getExpandedFallbackPlacements(placement) {
4775
+ if (getBasePlacement(placement) === auto) {
4776
+ return [];
4777
+ }
4778
+
4779
+ var oppositePlacement = getOppositePlacement(placement);
4780
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
4781
+ }
4782
+
4783
+ function flip(_ref) {
4784
+ var state = _ref.state,
4785
+ options = _ref.options,
4786
+ name = _ref.name;
4787
+
4788
+ if (state.modifiersData[name]._skip) {
4789
+ return;
4790
+ }
4791
+
4792
+ var _options$mainAxis = options.mainAxis,
4793
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
4794
+ _options$altAxis = options.altAxis,
4795
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
4796
+ specifiedFallbackPlacements = options.fallbackPlacements,
4797
+ padding = options.padding,
4798
+ boundary = options.boundary,
4799
+ rootBoundary = options.rootBoundary,
4800
+ altBoundary = options.altBoundary,
4801
+ _options$flipVariatio = options.flipVariations,
4802
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
4803
+ allowedAutoPlacements = options.allowedAutoPlacements;
4804
+ var preferredPlacement = state.options.placement;
4805
+ var basePlacement = getBasePlacement(preferredPlacement);
4806
+ var isBasePlacement = basePlacement === preferredPlacement;
4807
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
4808
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
4809
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
4810
+ placement: placement,
4811
+ boundary: boundary,
4812
+ rootBoundary: rootBoundary,
4813
+ padding: padding,
4814
+ flipVariations: flipVariations,
4815
+ allowedAutoPlacements: allowedAutoPlacements
4816
+ }) : placement);
4817
+ }, []);
4818
+ var referenceRect = state.rects.reference;
4819
+ var popperRect = state.rects.popper;
4820
+ var checksMap = new Map();
4821
+ var makeFallbackChecks = true;
4822
+ var firstFittingPlacement = placements[0];
4823
+
4824
+ for (var i = 0; i < placements.length; i++) {
4825
+ var placement = placements[i];
4826
+
4827
+ var _basePlacement = getBasePlacement(placement);
4828
+
4829
+ var isStartVariation = getVariation(placement) === start;
4830
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
4831
+ var len = isVertical ? 'width' : 'height';
4832
+ var overflow = detectOverflow(state, {
4833
+ placement: placement,
4834
+ boundary: boundary,
4835
+ rootBoundary: rootBoundary,
4836
+ altBoundary: altBoundary,
4837
+ padding: padding
4838
+ });
4839
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
4840
+
4841
+ if (referenceRect[len] > popperRect[len]) {
4842
+ mainVariationSide = getOppositePlacement(mainVariationSide);
4843
+ }
4844
+
4845
+ var altVariationSide = getOppositePlacement(mainVariationSide);
4846
+ var checks = [];
4847
+
4848
+ if (checkMainAxis) {
4849
+ checks.push(overflow[_basePlacement] <= 0);
4850
+ }
4851
+
4852
+ if (checkAltAxis) {
4853
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
4854
+ }
4855
+
4856
+ if (checks.every(function (check) {
4857
+ return check;
4858
+ })) {
4859
+ firstFittingPlacement = placement;
4860
+ makeFallbackChecks = false;
4861
+ break;
4862
+ }
4863
+
4864
+ checksMap.set(placement, checks);
4865
+ }
4866
+
4867
+ if (makeFallbackChecks) {
4868
+ // `2` may be desired in some cases – research later
4869
+ var numberOfChecks = flipVariations ? 3 : 1;
4870
+
4871
+ var _loop = function _loop(_i) {
4872
+ var fittingPlacement = placements.find(function (placement) {
4873
+ var checks = checksMap.get(placement);
4874
+
4875
+ if (checks) {
4876
+ return checks.slice(0, _i).every(function (check) {
4877
+ return check;
4878
+ });
4879
+ }
4880
+ });
4881
+
4882
+ if (fittingPlacement) {
4883
+ firstFittingPlacement = fittingPlacement;
4884
+ return "break";
4885
+ }
4886
+ };
4887
+
4888
+ for (var _i = numberOfChecks; _i > 0; _i--) {
4889
+ var _ret = _loop(_i);
4890
+
4891
+ if (_ret === "break") break;
4892
+ }
4893
+ }
4894
+
4895
+ if (state.placement !== firstFittingPlacement) {
4896
+ state.modifiersData[name]._skip = true;
4897
+ state.placement = firstFittingPlacement;
4898
+ state.reset = true;
4899
+ }
4900
+ } // eslint-disable-next-line import/no-unused-modules
4901
+
4902
+
4903
+ const flip$1 = {
4904
+ name: 'flip',
4905
+ enabled: true,
4906
+ phase: 'main',
4907
+ fn: flip,
4908
+ requiresIfExists: ['offset'],
4909
+ data: {
4910
+ _skip: false
4911
+ }
4912
+ };
4913
+
4914
+ function getSideOffsets(overflow, rect, preventedOffsets) {
4915
+ if (preventedOffsets === void 0) {
4916
+ preventedOffsets = {
4917
+ x: 0,
4918
+ y: 0
4919
+ };
4920
+ }
4921
+
4922
+ return {
4923
+ top: overflow.top - rect.height - preventedOffsets.y,
4924
+ right: overflow.right - rect.width + preventedOffsets.x,
4925
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
4926
+ left: overflow.left - rect.width - preventedOffsets.x
4927
+ };
4928
+ }
4929
+
4930
+ function isAnySideFullyClipped(overflow) {
4931
+ return [top, right, bottom, left].some(function (side) {
4932
+ return overflow[side] >= 0;
4933
+ });
4934
+ }
4935
+
4936
+ function hide(_ref) {
4937
+ var state = _ref.state,
4938
+ name = _ref.name;
4939
+ var referenceRect = state.rects.reference;
4940
+ var popperRect = state.rects.popper;
4941
+ var preventedOffsets = state.modifiersData.preventOverflow;
4942
+ var referenceOverflow = detectOverflow(state, {
4943
+ elementContext: 'reference'
4944
+ });
4945
+ var popperAltOverflow = detectOverflow(state, {
4946
+ altBoundary: true
4947
+ });
4948
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
4949
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
4950
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
4951
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
4952
+ state.modifiersData[name] = {
4953
+ referenceClippingOffsets: referenceClippingOffsets,
4954
+ popperEscapeOffsets: popperEscapeOffsets,
4955
+ isReferenceHidden: isReferenceHidden,
4956
+ hasPopperEscaped: hasPopperEscaped
4957
+ };
4958
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
4959
+ 'data-popper-reference-hidden': isReferenceHidden,
4960
+ 'data-popper-escaped': hasPopperEscaped
4961
+ });
4962
+ } // eslint-disable-next-line import/no-unused-modules
4963
+
4964
+
4965
+ const hide$1 = {
4966
+ name: 'hide',
4967
+ enabled: true,
4968
+ phase: 'main',
4969
+ requiresIfExists: ['preventOverflow'],
4970
+ fn: hide
4971
+ };
4972
+
4973
+ function distanceAndSkiddingToXY(placement, rects, offset) {
4974
+ var basePlacement = getBasePlacement(placement);
4975
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
4976
+
4977
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
4978
+ placement: placement
4979
+ })) : offset,
4980
+ skidding = _ref[0],
4981
+ distance = _ref[1];
4982
+
4983
+ skidding = skidding || 0;
4984
+ distance = (distance || 0) * invertDistance;
4985
+ return [left, right].indexOf(basePlacement) >= 0 ? {
4986
+ x: distance,
4987
+ y: skidding
4988
+ } : {
4989
+ x: skidding,
4990
+ y: distance
4991
+ };
4992
+ }
4993
+
4994
+ function offset(_ref2) {
4995
+ var state = _ref2.state,
4996
+ options = _ref2.options,
4997
+ name = _ref2.name;
4998
+ var _options$offset = options.offset,
4999
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
5000
+ var data = placements.reduce(function (acc, placement) {
5001
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
5002
+ return acc;
5003
+ }, {});
5004
+ var _data$state$placement = data[state.placement],
5005
+ x = _data$state$placement.x,
5006
+ y = _data$state$placement.y;
5007
+
5008
+ if (state.modifiersData.popperOffsets != null) {
5009
+ state.modifiersData.popperOffsets.x += x;
5010
+ state.modifiersData.popperOffsets.y += y;
5011
+ }
5012
+
5013
+ state.modifiersData[name] = data;
5014
+ } // eslint-disable-next-line import/no-unused-modules
5015
+
5016
+
5017
+ const offset$1 = {
5018
+ name: 'offset',
5019
+ enabled: true,
5020
+ phase: 'main',
5021
+ requires: ['popperOffsets'],
5022
+ fn: offset
5023
+ };
5024
+
5025
+ function popperOffsets(_ref) {
5026
+ var state = _ref.state,
5027
+ name = _ref.name;
5028
+ // Offsets are the actual position the popper needs to have to be
5029
+ // properly positioned near its reference element
5030
+ // This is the most basic placement, and will be adjusted by
5031
+ // the modifiers in the next step
5032
+ state.modifiersData[name] = computeOffsets({
5033
+ reference: state.rects.reference,
5034
+ element: state.rects.popper,
5035
+ strategy: 'absolute',
5036
+ placement: state.placement
5037
+ });
5038
+ } // eslint-disable-next-line import/no-unused-modules
5039
+
5040
+
5041
+ const popperOffsets$1 = {
5042
+ name: 'popperOffsets',
5043
+ enabled: true,
5044
+ phase: 'read',
5045
+ fn: popperOffsets,
5046
+ data: {}
5047
+ };
5048
+
5049
+ function getAltAxis(axis) {
5050
+ return axis === 'x' ? 'y' : 'x';
5051
+ }
5052
+
5053
+ function preventOverflow(_ref) {
5054
+ var state = _ref.state,
5055
+ options = _ref.options,
5056
+ name = _ref.name;
5057
+ var _options$mainAxis = options.mainAxis,
5058
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
5059
+ _options$altAxis = options.altAxis,
5060
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
5061
+ boundary = options.boundary,
5062
+ rootBoundary = options.rootBoundary,
5063
+ altBoundary = options.altBoundary,
5064
+ padding = options.padding,
5065
+ _options$tether = options.tether,
5066
+ tether = _options$tether === void 0 ? true : _options$tether,
5067
+ _options$tetherOffset = options.tetherOffset,
5068
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
5069
+ var overflow = detectOverflow(state, {
5070
+ boundary: boundary,
5071
+ rootBoundary: rootBoundary,
5072
+ padding: padding,
5073
+ altBoundary: altBoundary
5074
+ });
5075
+ var basePlacement = getBasePlacement(state.placement);
5076
+ var variation = getVariation(state.placement);
5077
+ var isBasePlacement = !variation;
5078
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
5079
+ var altAxis = getAltAxis(mainAxis);
5080
+ var popperOffsets = state.modifiersData.popperOffsets;
5081
+ var referenceRect = state.rects.reference;
5082
+ var popperRect = state.rects.popper;
5083
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
5084
+ placement: state.placement
5085
+ })) : tetherOffset;
5086
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
5087
+ mainAxis: tetherOffsetValue,
5088
+ altAxis: tetherOffsetValue
5089
+ } : Object.assign({
5090
+ mainAxis: 0,
5091
+ altAxis: 0
5092
+ }, tetherOffsetValue);
5093
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
5094
+ var data = {
5095
+ x: 0,
5096
+ y: 0
5097
+ };
5098
+
5099
+ if (!popperOffsets) {
5100
+ return;
5101
+ }
5102
+
5103
+ if (checkMainAxis) {
5104
+ var _offsetModifierState$;
5105
+
5106
+ var mainSide = mainAxis === 'y' ? top : left;
5107
+ var altSide = mainAxis === 'y' ? bottom : right;
5108
+ var len = mainAxis === 'y' ? 'height' : 'width';
5109
+ var offset = popperOffsets[mainAxis];
5110
+ var min$1 = offset + overflow[mainSide];
5111
+ var max$1 = offset - overflow[altSide];
5112
+ var additive = tether ? -popperRect[len] / 2 : 0;
5113
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
5114
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
5115
+ // outside the reference bounds
5116
+
5117
+ var arrowElement = state.elements.arrow;
5118
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
5119
+ width: 0,
5120
+ height: 0
5121
+ };
5122
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
5123
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
5124
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
5125
+ // to include its full size in the calculation. If the reference is small
5126
+ // and near the edge of a boundary, the popper can overflow even if the
5127
+ // reference is not overflowing as well (e.g. virtual elements with no
5128
+ // width or height)
5129
+
5130
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
5131
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
5132
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
5133
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
5134
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
5135
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
5136
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
5137
+ var tetherMax = offset + maxOffset - offsetModifierValue;
5138
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
5139
+ popperOffsets[mainAxis] = preventedOffset;
5140
+ data[mainAxis] = preventedOffset - offset;
5141
+ }
5142
+
5143
+ if (checkAltAxis) {
5144
+ var _offsetModifierState$2;
5145
+
5146
+ var _mainSide = mainAxis === 'x' ? top : left;
5147
+
5148
+ var _altSide = mainAxis === 'x' ? bottom : right;
5149
+
5150
+ var _offset = popperOffsets[altAxis];
5151
+
5152
+ var _len = altAxis === 'y' ? 'height' : 'width';
5153
+
5154
+ var _min = _offset + overflow[_mainSide];
5155
+
5156
+ var _max = _offset - overflow[_altSide];
5157
+
5158
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
5159
+
5160
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
5161
+
5162
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
5163
+
5164
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
5165
+
5166
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
5167
+
5168
+ popperOffsets[altAxis] = _preventedOffset;
5169
+ data[altAxis] = _preventedOffset - _offset;
5170
+ }
5171
+
5172
+ state.modifiersData[name] = data;
5173
+ } // eslint-disable-next-line import/no-unused-modules
5174
+
5175
+
5176
+ const preventOverflow$1 = {
5177
+ name: 'preventOverflow',
5178
+ enabled: true,
5179
+ phase: 'main',
5180
+ fn: preventOverflow,
5181
+ requiresIfExists: ['offset']
5182
+ };
5183
+
5184
+ function getHTMLElementScroll(element) {
5185
+ return {
5186
+ scrollLeft: element.scrollLeft,
5187
+ scrollTop: element.scrollTop
5188
+ };
5189
+ }
5190
+
5191
+ function getNodeScroll(node) {
5192
+ if (node === getWindow(node) || !isHTMLElement(node)) {
5193
+ return getWindowScroll(node);
5194
+ } else {
5195
+ return getHTMLElementScroll(node);
5196
+ }
5197
+ }
5198
+
5199
+ function isElementScaled(element) {
5200
+ var rect = element.getBoundingClientRect();
5201
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
5202
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
5203
+ return scaleX !== 1 || scaleY !== 1;
5204
+ } // Returns the composite rect of an element relative to its offsetParent.
5205
+ // Composite means it takes into account transforms as well as layout.
5206
+
5207
+
5208
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
5209
+ if (isFixed === void 0) {
5210
+ isFixed = false;
5211
+ }
5212
+
5213
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
5214
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
5215
+ var documentElement = getDocumentElement(offsetParent);
5216
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
5217
+ var scroll = {
5218
+ scrollLeft: 0,
5219
+ scrollTop: 0
5220
+ };
5221
+ var offsets = {
5222
+ x: 0,
5223
+ y: 0
5224
+ };
5225
+
5226
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
5227
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
5228
+ isScrollParent(documentElement)) {
5229
+ scroll = getNodeScroll(offsetParent);
5230
+ }
5231
+
5232
+ if (isHTMLElement(offsetParent)) {
5233
+ offsets = getBoundingClientRect(offsetParent, true);
5234
+ offsets.x += offsetParent.clientLeft;
5235
+ offsets.y += offsetParent.clientTop;
5236
+ } else if (documentElement) {
5237
+ offsets.x = getWindowScrollBarX(documentElement);
5238
+ }
5239
+ }
5240
+
5241
+ return {
5242
+ x: rect.left + scroll.scrollLeft - offsets.x,
5243
+ y: rect.top + scroll.scrollTop - offsets.y,
5244
+ width: rect.width,
5245
+ height: rect.height
5246
+ };
5247
+ }
5248
+
5249
+ function order(modifiers) {
5250
+ var map = new Map();
5251
+ var visited = new Set();
5252
+ var result = [];
5253
+ modifiers.forEach(function (modifier) {
5254
+ map.set(modifier.name, modifier);
5255
+ }); // On visiting object, check for its dependencies and visit them recursively
5256
+
5257
+ function sort(modifier) {
5258
+ visited.add(modifier.name);
5259
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
5260
+ requires.forEach(function (dep) {
5261
+ if (!visited.has(dep)) {
5262
+ var depModifier = map.get(dep);
5263
+
5264
+ if (depModifier) {
5265
+ sort(depModifier);
5266
+ }
5267
+ }
5268
+ });
5269
+ result.push(modifier);
5270
+ }
5271
+
5272
+ modifiers.forEach(function (modifier) {
5273
+ if (!visited.has(modifier.name)) {
5274
+ // check for visited object
5275
+ sort(modifier);
5276
+ }
5277
+ });
5278
+ return result;
5279
+ }
5280
+
5281
+ function orderModifiers(modifiers) {
5282
+ // order based on dependencies
5283
+ var orderedModifiers = order(modifiers); // order based on phase
5284
+
5285
+ return modifierPhases.reduce(function (acc, phase) {
5286
+ return acc.concat(orderedModifiers.filter(function (modifier) {
5287
+ return modifier.phase === phase;
5288
+ }));
5289
+ }, []);
5290
+ }
5291
+
5292
+ function debounce(fn) {
5293
+ var pending;
5294
+ return function () {
5295
+ if (!pending) {
5296
+ pending = new Promise(function (resolve) {
5297
+ Promise.resolve().then(function () {
5298
+ pending = undefined;
5299
+ resolve(fn());
5300
+ });
5301
+ });
5302
+ }
5303
+
5304
+ return pending;
5305
+ };
5306
+ }
5307
+
5308
+ function mergeByName(modifiers) {
5309
+ var merged = modifiers.reduce(function (merged, current) {
5310
+ var existing = merged[current.name];
5311
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
5312
+ options: Object.assign({}, existing.options, current.options),
5313
+ data: Object.assign({}, existing.data, current.data)
5314
+ }) : current;
5315
+ return merged;
5316
+ }, {}); // IE11 does not support Object.values
5317
+
5318
+ return Object.keys(merged).map(function (key) {
5319
+ return merged[key];
5320
+ });
5321
+ }
5322
+
5323
+ var DEFAULT_OPTIONS = {
5324
+ placement: 'bottom',
5325
+ modifiers: [],
5326
+ strategy: 'absolute'
5327
+ };
5328
+
5329
+ function areValidElements() {
5330
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
5331
+ args[_key] = arguments[_key];
5332
+ }
5333
+
5334
+ return !args.some(function (element) {
5335
+ return !(element && typeof element.getBoundingClientRect === 'function');
5336
+ });
5337
+ }
5338
+
5339
+ function popperGenerator(generatorOptions) {
5340
+ if (generatorOptions === void 0) {
5341
+ generatorOptions = {};
5342
+ }
5343
+
5344
+ var _generatorOptions = generatorOptions,
5345
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
5346
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
5347
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
5348
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
5349
+ return function createPopper(reference, popper, options) {
5350
+ if (options === void 0) {
5351
+ options = defaultOptions;
5352
+ }
5353
+
5354
+ var state = {
5355
+ placement: 'bottom',
5356
+ orderedModifiers: [],
5357
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
5358
+ modifiersData: {},
5359
+ elements: {
5360
+ reference: reference,
5361
+ popper: popper
5362
+ },
5363
+ attributes: {},
5364
+ styles: {}
5365
+ };
5366
+ var effectCleanupFns = [];
5367
+ var isDestroyed = false;
5368
+ var instance = {
5369
+ state: state,
5370
+ setOptions: function setOptions(setOptionsAction) {
5371
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
5372
+ cleanupModifierEffects();
5373
+ state.options = Object.assign({}, defaultOptions, state.options, options);
5374
+ state.scrollParents = {
5375
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
5376
+ popper: listScrollParents(popper)
5377
+ }; // Orders the modifiers based on their dependencies and `phase`
5378
+ // properties
5379
+
5380
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
5381
+
5382
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
5383
+ return m.enabled;
5384
+ }); // Validate the provided modifiers so that the consumer will get warned
5385
+
5386
+ runModifierEffects();
5387
+ return instance.update();
5388
+ },
5389
+ // Sync update – it will always be executed, even if not necessary. This
5390
+ // is useful for low frequency updates where sync behavior simplifies the
5391
+ // logic.
5392
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
5393
+ // prefer the async Popper#update method
5394
+ forceUpdate: function forceUpdate() {
5395
+ if (isDestroyed) {
5396
+ return;
5397
+ }
5398
+
5399
+ var _state$elements = state.elements,
5400
+ reference = _state$elements.reference,
5401
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
5402
+ // anymore
5403
+
5404
+ if (!areValidElements(reference, popper)) {
5405
+
5406
+ return;
5407
+ } // Store the reference and popper rects to be read by modifiers
5408
+
5409
+
5410
+ state.rects = {
5411
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
5412
+ popper: getLayoutRect(popper)
5413
+ }; // Modifiers have the ability to reset the current update cycle. The
5414
+ // most common use case for this is the `flip` modifier changing the
5415
+ // placement, which then needs to re-run all the modifiers, because the
5416
+ // logic was previously ran for the previous placement and is therefore
5417
+ // stale/incorrect
5418
+
5419
+ state.reset = false;
5420
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
5421
+ // is filled with the initial data specified by the modifier. This means
5422
+ // it doesn't persist and is fresh on each update.
5423
+ // To ensure persistent data, use `${name}#persistent`
5424
+
5425
+ state.orderedModifiers.forEach(function (modifier) {
5426
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
5427
+ });
5428
+
5429
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
5430
+
5431
+ if (state.reset === true) {
5432
+ state.reset = false;
5433
+ index = -1;
5434
+ continue;
5435
+ }
5436
+
5437
+ var _state$orderedModifie = state.orderedModifiers[index],
5438
+ fn = _state$orderedModifie.fn,
5439
+ _state$orderedModifie2 = _state$orderedModifie.options,
5440
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
5441
+ name = _state$orderedModifie.name;
5442
+
5443
+ if (typeof fn === 'function') {
5444
+ state = fn({
5445
+ state: state,
5446
+ options: _options,
5447
+ name: name,
5448
+ instance: instance
5449
+ }) || state;
5450
+ }
5451
+ }
5452
+ },
5453
+ // Async and optimistically optimized update – it will not be executed if
5454
+ // not necessary (debounced to run at most once-per-tick)
5455
+ update: debounce(function () {
5456
+ return new Promise(function (resolve) {
5457
+ instance.forceUpdate();
5458
+ resolve(state);
5459
+ });
5460
+ }),
5461
+ destroy: function destroy() {
5462
+ cleanupModifierEffects();
5463
+ isDestroyed = true;
5464
+ }
5465
+ };
5466
+
5467
+ if (!areValidElements(reference, popper)) {
5468
+
5469
+ return instance;
5470
+ }
5471
+
5472
+ instance.setOptions(options).then(function (state) {
5473
+ if (!isDestroyed && options.onFirstUpdate) {
5474
+ options.onFirstUpdate(state);
5475
+ }
5476
+ }); // Modifiers have the ability to execute arbitrary code before the first
5477
+ // update cycle runs. They will be executed in the same order as the update
5478
+ // cycle. This is useful when a modifier adds some persistent data that
5479
+ // other modifiers need to use, but the modifier is run after the dependent
5480
+ // one.
5481
+
5482
+ function runModifierEffects() {
5483
+ state.orderedModifiers.forEach(function (_ref3) {
5484
+ var name = _ref3.name,
5485
+ _ref3$options = _ref3.options,
5486
+ options = _ref3$options === void 0 ? {} : _ref3$options,
5487
+ effect = _ref3.effect;
5488
+
5489
+ if (typeof effect === 'function') {
5490
+ var cleanupFn = effect({
5491
+ state: state,
5492
+ name: name,
5493
+ instance: instance,
5494
+ options: options
5495
+ });
5496
+
5497
+ var noopFn = function noopFn() {};
5498
+
5499
+ effectCleanupFns.push(cleanupFn || noopFn);
5500
+ }
5501
+ });
5502
+ }
5503
+
5504
+ function cleanupModifierEffects() {
5505
+ effectCleanupFns.forEach(function (fn) {
5506
+ return fn();
5507
+ });
5508
+ effectCleanupFns = [];
5509
+ }
5510
+
5511
+ return instance;
5512
+ };
5513
+ }
5514
+
5515
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
5516
+ var createPopper = /*#__PURE__*/popperGenerator({
5517
+ defaultModifiers: defaultModifiers
5518
+ }); // eslint-disable-next-line import/no-unused-modules
5519
+
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}";
5521
+
5522
+ const MgPopover = class {
5523
+ constructor(hostRef) {
5524
+ index.registerInstance(this, hostRef);
5525
+ this.displayChange = index.createEvent(this, "display-change", 7);
5526
+ this.closeButtonId = '';
5527
+ /**
5528
+ * Sets an `id` attribute.
5529
+ * Needed by the input for accessibility `aria-decribedby`.
5530
+ */
5531
+ this.identifier = createID('mg-popover');
5532
+ /**
5533
+ * Popover placement
5534
+ */
5535
+ this.placement = 'bottom';
5536
+ /**
5537
+ * Define if popover has a cross button
5538
+ */
5539
+ this.closeButton = false;
5540
+ /**
5541
+ * Display popover
5542
+ */
5543
+ this.display = false;
5544
+ /**
5545
+ * Disable popover
5546
+ */
5547
+ this.disabled = false;
5548
+ /**
5549
+ * Check if clicked outside of component
5550
+ *
5551
+ * @param {MouseEvent} event mouse event
5552
+ * @returns {void}
5553
+ */
5554
+ this.clickOutside = (event) => {
5555
+ if (!this.disabled && event.target.closest(`mg-popover`) !== this.element) {
5556
+ this.display = false;
5557
+ }
5558
+ };
5559
+ /**
5560
+ * Show popover
5561
+ *
5562
+ * @returns {void}
5563
+ */
5564
+ this.show = () => {
5565
+ // Make the popover visible
5566
+ this.popover.setAttribute('data-show', '');
5567
+ // Enable the event listeners
5568
+ this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
5569
+ // Update its position
5570
+ this.popper.update();
5571
+ // hide when click outside
5572
+ // setTimeout is used to prevent event to trigger after creation
5573
+ setTimeout(() => {
5574
+ document.addEventListener('click', this.clickOutside, false);
5575
+ }, 0);
5576
+ };
5577
+ /**
5578
+ * Hide popover
5579
+ *
5580
+ * @returns {void}
5581
+ */
5582
+ this.hide = () => {
5583
+ // Hide the popover
5584
+ this.popover.removeAttribute('data-show');
5585
+ // Disable the event listeners
5586
+ this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
5587
+ // Remove event listener
5588
+ document.removeEventListener('click', this.clickOutside, false);
5589
+ };
5590
+ /**
5591
+ * Handle action for close button
5592
+ *
5593
+ * @returns {void}
5594
+ */
5595
+ this.handleCloseButton = () => {
5596
+ this.display = false;
5597
+ };
5598
+ }
5599
+ handleDisplay(newValue) {
5600
+ if (newValue) {
5601
+ this.show();
5602
+ }
5603
+ else {
5604
+ this.hide();
5605
+ }
5606
+ this.displayChange.emit(newValue);
5607
+ }
5608
+ /*************
5609
+ * Lifecycle *
5610
+ *************/
5611
+ /**
5612
+ * Check if component props are well configured on init
5613
+ *
5614
+ * @returns {void} timeout
5615
+ */
5616
+ componentWillLoad() {
5617
+ // Get locales
5618
+ this.messages = initLocales(this.element).messages;
5619
+ }
5620
+ /**
5621
+ * Check if component props are well configured on init
5622
+ *
5623
+ * @returns {void}
5624
+ */
5625
+ componentDidLoad() {
5626
+ const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
5627
+ const slottedTitleElement = this.element.querySelector('[slot="title"]');
5628
+ if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {
5629
+ throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
5630
+ }
5631
+ // Set close button id
5632
+ if (this.closeButton) {
5633
+ this.closeButtonId = `${this.identifier}-close-button`;
5634
+ }
5635
+ // Get popover content
5636
+ this.popover = this.element.shadowRoot.querySelector(`#${this.identifier}`);
5637
+ //Get interactive element (first element without slot attribute)
5638
+ const interactiveElement = this.element.querySelector(':not([slot])');
5639
+ // Add aria attributes
5640
+ interactiveElement.setAttribute('aria-controls', this.identifier);
5641
+ interactiveElement.setAttribute('aria-expanded', `${this.display}`);
5642
+ // Create popperjs popover
5643
+ this.popper = createPopper(interactiveElement, this.popover, {
5644
+ placement: this.placement,
5645
+ strategy: 'fixed',
5646
+ modifiers: [
5647
+ {
5648
+ name: 'offset',
5649
+ options: {
5650
+ offset: [0, 10],
5651
+ },
5652
+ },
5653
+ ],
5654
+ });
5655
+ // Add events to toggle display
5656
+ interactiveElement.addEventListener('click', () => {
5657
+ if (!this.disabled)
5658
+ this.display = !this.display;
5659
+ });
5660
+ // Add events to hide popover
5661
+ this.element.addEventListener('keydown', e => {
5662
+ if (!this.disabled && e.code === 'Escape')
5663
+ this.display = false;
5664
+ });
5665
+ this.handleDisplay(this.display);
5666
+ }
5667
+ /**
5668
+ * Render
5669
+ *
5670
+ * @returns {HTMLElement} HTML Element
5671
+ */
5672
+ render() {
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 }))));
5674
+ }
5675
+ get element() { return index.getElement(this); }
5676
+ static get watchers() { return {
5677
+ "display": ["handleDisplay"]
5678
+ }; }
5679
+ };
5680
+ MgPopover.style = mgPopoverCss;
5681
+
5682
+ var Status;
5683
+ (function (Status) {
5684
+ Status["VISIBLE"] = "visible";
5685
+ Status["HIDDEN"] = "hidden";
5686
+ Status["DISABLED"] = "disabled";
5687
+ Status["ACTIVE"] = "active";
5688
+ })(Status || (Status = {}));
5689
+ /**
5690
+ * List of all possibles sizes
5691
+ */
5692
+ const sizes = ['regular', 'large'];
5693
+
5694
+ const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;font-family:var(--font-family);color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
5695
+
5696
+ /**
5697
+ * type TabItem validation function
5698
+ *
5699
+ * @param {TabItem} tab tab item
5700
+ * @returns {boolean} tab item type is valid
5701
+ */
5702
+ const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
5703
+ const MgTabs = class {
5704
+ constructor(hostRef) {
5705
+ index.registerInstance(this, hostRef);
5706
+ this.activeTabChange = index.createEvent(this, "active-tab-change", 7);
5707
+ /************
3237
5708
  * Internal *
3238
5709
  ************/
3239
5710
  this.tabPanel = 'panel';
@@ -3243,7 +5714,7 @@ const MgTabs = class {
3243
5714
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
3244
5715
  * If not set, it will be created.
3245
5716
  */
3246
- this.identifier = index$1.createID('mg-tabs');
5717
+ this.identifier = createID('mg-tabs');
3247
5718
  /**
3248
5719
  * Define tabs size
3249
5720
  */
@@ -3260,7 +5731,7 @@ const MgTabs = class {
3260
5731
  /**
3261
5732
  * Component classes
3262
5733
  */
3263
- this.classList = new index$1.ClassList(['mg-tabs']);
5734
+ this.classList = new ClassList(['mg-tabs']);
3264
5735
  /**
3265
5736
  * Method to set active tab
3266
5737
  *
@@ -3354,9 +5825,7 @@ const MgTabs = class {
3354
5825
  }
3355
5826
  validateLabel(newValue) {
3356
5827
  if (typeof newValue !== 'string' || newValue.trim() === '') {
3357
- // TODO: throw new Error on next major (5.0.0)
3358
- // throw new Error('<mg-tabs> prop "label" is required.');
3359
- console.error('<mg-tabs> prop "label" is required.');
5828
+ throw new Error('<mg-tabs> prop "label" is required.');
3360
5829
  }
3361
5830
  }
3362
5831
  validateSize(newValue) {
@@ -3367,7 +5836,7 @@ const MgTabs = class {
3367
5836
  }
3368
5837
  validateItems(newValue) {
3369
5838
  // String array
3370
- if (index$1.allItemsAreString(newValue)) {
5839
+ if (allItemsAreString(newValue)) {
3371
5840
  this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
3372
5841
  }
3373
5842
  // Object array
@@ -3450,7 +5919,7 @@ const MgTag = class {
3450
5919
  /**
3451
5920
  * Component classes
3452
5921
  */
3453
- this.classList = new index$1.ClassList(['mg-tag']);
5922
+ this.classList = new ClassList(['mg-tag']);
3454
5923
  }
3455
5924
  validateVariant(newValue, oldValue) {
3456
5925
  if (!variants.includes(newValue)) {
@@ -3496,9 +5965,6 @@ const MgTag = class {
3496
5965
  };
3497
5966
  MgTag.style = mgTagCss;
3498
5967
 
3499
- /**
3500
- * List of all possibles placements
3501
- */
3502
5968
  var Guard;
3503
5969
  (function (Guard) {
3504
5970
  Guard["FOCUS"] = "focus";
@@ -3506,7 +5972,7 @@ var Guard;
3506
5972
  Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
3507
5973
  })(Guard || (Guard = {}));
3508
5974
 
3509
- const mgTooltipCss = ".sc-mg-tooltip-h{display:inline-block}.mg-tooltip.sc-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].sc-mg-tooltip{display:block}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip,.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip{visibility:hidden}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{top:-4px}.mg-tooltip[data-popper-placement^=left].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{right:-4px}.mg-tooltip[data-popper-placement^=right].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{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}";
3510
5976
 
3511
5977
  const MgTooltip = class {
3512
5978
  constructor(hostRef) {
@@ -3515,7 +5981,7 @@ const MgTooltip = class {
3515
5981
  * Sets an `id` attribute.
3516
5982
  * Needed by the input for accessibility `aria-decribedby`.
3517
5983
  */
3518
- this.identifier = index$1.createID('mg-tooltip');
5984
+ this.identifier = createID('mg-tooltip');
3519
5985
  /**
3520
5986
  * Tooltip placement
3521
5987
  */
@@ -3597,9 +6063,7 @@ const MgTooltip = class {
3597
6063
  }
3598
6064
  validateMessage(newValue) {
3599
6065
  if (typeof newValue !== 'string' || newValue.trim() === '') {
3600
- // TODO: throw new Error on next major (5.0.0)
3601
- // throw new Error('<mg-tooltip> prop "message" is required.');
3602
- console.error('<mg-tooltip> prop "message" is required.');
6066
+ throw new Error('<mg-tooltip> prop "message" is required.');
3603
6067
  }
3604
6068
  }
3605
6069
  handleDisplay(newValue) {
@@ -3623,12 +6087,12 @@ const MgTooltip = class {
3623
6087
  componentDidLoad() {
3624
6088
  var _a;
3625
6089
  // Get tooltip element
3626
- this.tooltip = this.element.querySelector(`#${this.identifier}`);
6090
+ this.tooltip = this.element.shadowRoot.querySelector(`#${this.identifier}`);
3627
6091
  // get slotted element
3628
6092
  const slotElement = this.element.firstElementChild;
3629
6093
  // Get interactive element
3630
6094
  const interactiveElements = ['a', 'button', 'input', 'textarea', 'select']; //! Might needs updates
3631
- const interactiveElement = this.element.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
6095
+ const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
3632
6096
  // define selected element to become tooltip selector
3633
6097
  const tooltipedElement = interactiveElement || slotElement;
3634
6098
  // Add tabindex to slotted element if we can't find any interactive element
@@ -3643,8 +6107,9 @@ const MgTooltip = class {
3643
6107
  slotElement.setAttribute('aria-describedby', `${ariaDescribedby} ${this.identifier}`);
3644
6108
  }
3645
6109
  // Create popperjs tooltip
3646
- this.popper = popper.createPopper(tooltipedElement, this.tooltip, {
6110
+ this.popper = createPopper(tooltipedElement, this.tooltip, {
3647
6111
  placement: this.placement,
6112
+ strategy: 'fixed',
3648
6113
  modifiers: [
3649
6114
  {
3650
6115
  name: 'offset',
@@ -3702,8 +6167,10 @@ MgTooltip.style = mgTooltipCss;
3702
6167
 
3703
6168
  exports.mg_badge = MgBadge;
3704
6169
  exports.mg_button = MgButton;
6170
+ exports.mg_card = MgCard;
3705
6171
  exports.mg_character_left = MgCharacterLeft;
3706
6172
  exports.mg_details = MgDetails;
6173
+ exports.mg_divider = MgDivider;
3707
6174
  exports.mg_form = MgForm;
3708
6175
  exports.mg_icon = MgIcon;
3709
6176
  exports.mg_illustrated_message = MgIllustratedMessage;
@@ -3718,8 +6185,10 @@ exports.mg_input_textarea = MgInputTextarea;
3718
6185
  exports.mg_input_title = MgInputTitle;
3719
6186
  exports.mg_input_toggle = MgInputToggle;
3720
6187
  exports.mg_message = MgMessage;
6188
+ exports.mg_modal = MgModal;
3721
6189
  exports.mg_pagination = MgPagination;
3722
6190
  exports.mg_panel = MgPanel;
6191
+ exports.mg_popover = MgPopover;
3723
6192
  exports.mg_tabs = MgTabs;
3724
6193
  exports.mg_tag = MgTag;
3725
6194
  exports.mg_tooltip = MgTooltip;