@mgdis/mg-components 6.10.0 → 6.10.1

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 (114) hide show
  1. package/dist/cjs/{index-CfIlskRh.js → index-CL_COdxv.js} +4 -4
  2. package/dist/cjs/{index-CfIlskRh.js.map → index-CL_COdxv.js.map} +1 -1
  3. package/dist/cjs/{index.es-BCLy9yYb.js → index.es-DaPqByCe.js} +82 -82
  4. package/dist/cjs/index.es-DaPqByCe.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/mg-action-more_37.cjs.entry.js +1881 -1874
  7. package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
  8. package/dist/cjs/mg-alert.cjs.entry.js +6 -6
  9. package/dist/cjs/mg-components.cjs.js +1 -1
  10. package/dist/cjs/mg-input-combobox.cjs.entry.js +33 -33
  11. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +12 -12
  12. package/dist/cjs/mg-loader.cjs.entry.js +4 -4
  13. package/dist/cjs/mg-progress.cjs.entry.js +10 -10
  14. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -1
  15. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  16. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +43 -63
  17. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  18. package/dist/collection/components/molecules/mg-popover/mg-popover.js +47 -97
  19. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  20. package/dist/components/index.es.js +71 -71
  21. package/dist/components/index.es.js.map +1 -1
  22. package/dist/components/index2.js +2 -2
  23. package/dist/components/mg-action-more.js +6 -6
  24. package/dist/components/mg-alert.js +5 -5
  25. package/dist/components/mg-badge2.js +6 -6
  26. package/dist/components/mg-button2.js +6 -6
  27. package/dist/components/mg-character-left2.js +4 -4
  28. package/dist/components/mg-details.js +2 -2
  29. package/dist/components/mg-form.js +7 -7
  30. package/dist/components/mg-icon2.js +6 -6
  31. package/dist/components/mg-illustrated-message.js +5 -5
  32. package/dist/components/mg-input-checkbox.js +9 -9
  33. package/dist/components/mg-input-combobox.js +32 -32
  34. package/dist/components/mg-input-date.js +17 -17
  35. package/dist/components/mg-input-numeric.js +13 -13
  36. package/dist/components/mg-input-password.js +3 -3
  37. package/dist/components/mg-input-radio.js +7 -7
  38. package/dist/components/mg-input-rich-text-editor.js +11 -11
  39. package/dist/components/mg-input-select2.js +7 -7
  40. package/dist/components/mg-input-text2.js +9 -9
  41. package/dist/components/mg-input-textarea.js +7 -7
  42. package/dist/components/mg-input-title2.js +4 -4
  43. package/dist/components/mg-input-toggle.js +6 -6
  44. package/dist/components/mg-input2.js +8 -8
  45. package/dist/components/mg-item-more2.js +7 -7
  46. package/dist/components/mg-loader2.js +3 -3
  47. package/dist/components/mg-menu-item2.js +11 -11
  48. package/dist/components/mg-message2.js +4 -4
  49. package/dist/components/mg-modal.js +8 -8
  50. package/dist/components/mg-pagination2.js +6 -6
  51. package/dist/components/mg-panel.js +9 -9
  52. package/dist/components/mg-popover-content2.js +4 -4
  53. package/dist/components/mg-popover-content2.js.map +1 -1
  54. package/dist/components/mg-popover2.js +48 -96
  55. package/dist/components/mg-popover2.js.map +1 -1
  56. package/dist/components/mg-progress.js +10 -10
  57. package/dist/components/mg-skip-links.js +2 -2
  58. package/dist/components/mg-table.js +6 -6
  59. package/dist/components/mg-tabs.js +12 -12
  60. package/dist/components/mg-tag.js +4 -4
  61. package/dist/components/mg-tooltip-content2.js +1 -1
  62. package/dist/components/mg-tooltip-content2.js.map +1 -1
  63. package/dist/components/mg-tooltip2.js +47 -66
  64. package/dist/components/mg-tooltip2.js.map +1 -1
  65. package/dist/components/popper.js +1793 -0
  66. package/dist/components/popper.js.map +1 -0
  67. package/dist/esm/{index-DmsGewMC.js → index-DALWFL9i.js} +4 -4
  68. package/dist/esm/{index-DmsGewMC.js.map → index-DALWFL9i.js.map} +1 -1
  69. package/dist/esm/{index.es-rLV3KFPd.js → index.es-hNwGkhG6.js} +73 -73
  70. package/dist/esm/index.es-hNwGkhG6.js.map +1 -0
  71. package/dist/esm/loader.js +1 -1
  72. package/dist/esm/mg-action-more_37.entry.js +1881 -1874
  73. package/dist/esm/mg-action-more_37.entry.js.map +1 -1
  74. package/dist/esm/mg-alert.entry.js +6 -6
  75. package/dist/esm/mg-components.js +1 -1
  76. package/dist/esm/mg-input-combobox.entry.js +33 -33
  77. package/dist/esm/mg-input-rich-text-editor.entry.js +12 -12
  78. package/dist/esm/mg-loader.entry.js +4 -4
  79. package/dist/esm/mg-progress.entry.js +10 -10
  80. package/dist/mg-components/mg-components.esm.js +1 -1
  81. package/dist/mg-components/{p-88f77de2.entry.js → p-352cfc01.entry.js} +2 -2
  82. package/dist/mg-components/{p-0f761c6c.entry.js → p-68f7de47.entry.js} +2 -2
  83. package/dist/mg-components/{p-DK9teKTo.js → p-Cg3R_y_o.js} +2 -2
  84. package/dist/mg-components/{p-DK9teKTo.js.map → p-Cg3R_y_o.js.map} +1 -1
  85. package/dist/mg-components/{p-cdbe689e.entry.js → p-a52a168c.entry.js} +2 -2
  86. package/dist/mg-components/{p-ad66e7b3.entry.js → p-bf5de898.entry.js} +2 -2
  87. package/dist/mg-components/{p-d3a868f0.entry.js → p-dcefa0b0.entry.js} +2 -2
  88. package/dist/mg-components/p-dcefa0b0.entry.js.map +1 -0
  89. package/dist/mg-components/{p-73099ed7.entry.js → p-e33557f9.entry.js} +2 -2
  90. package/dist/mg-components/{p-rLV3KFPd.js → p-hNwGkhG6.js} +2 -2
  91. package/dist/mg-components/p-hNwGkhG6.js.map +1 -0
  92. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -6
  93. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -8
  94. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +8 -22
  95. package/dist/types/components.d.ts +6 -8
  96. package/ide/intellij/web-types.json +1 -1
  97. package/package.json +9 -9
  98. package/dist/cjs/index.es-BCLy9yYb.js.map +0 -1
  99. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -2
  100. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +0 -1
  101. package/dist/collection/utils/floating-ui.utils.js +0 -74
  102. package/dist/collection/utils/floating-ui.utils.js.map +0 -1
  103. package/dist/components/floating-ui.utils.js +0 -1721
  104. package/dist/components/floating-ui.utils.js.map +0 -1
  105. package/dist/esm/index.es-rLV3KFPd.js.map +0 -1
  106. package/dist/mg-components/p-d3a868f0.entry.js.map +0 -1
  107. package/dist/mg-components/p-rLV3KFPd.js.map +0 -1
  108. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -6
  109. package/dist/types/utils/floating-ui.utils.d.ts +0 -28
  110. /package/dist/mg-components/{p-88f77de2.entry.js.map → p-352cfc01.entry.js.map} +0 -0
  111. /package/dist/mg-components/{p-0f761c6c.entry.js.map → p-68f7de47.entry.js.map} +0 -0
  112. /package/dist/mg-components/{p-cdbe689e.entry.js.map → p-a52a168c.entry.js.map} +0 -0
  113. /package/dist/mg-components/{p-ad66e7b3.entry.js.map → p-bf5de898.entry.js.map} +0 -0
  114. /package/dist/mg-components/{p-73099ed7.entry.js.map → p-e33557f9.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { D as De, G as Gt, W as Wt } from './index.es.js';
2
+ import { q as qe, X as Xt, K as Kt } from './index.es.js';
3
3
 
4
4
  /**
5
5
  * List of all possibles roles
@@ -35,26 +35,26 @@ const MgProgress$1 = /*@__PURE__*/ proxyCustomElement(class MgProgress extends H
35
35
  this.max = 100;
36
36
  }
37
37
  watchLabel(newValue) {
38
- if (!De(newValue)) {
39
- throw new Error(`<mg-progress> prop "label" must be a valid string. Passed value: ${Gt(newValue)}.`);
38
+ if (!qe(newValue)) {
39
+ throw new Error(`<mg-progress> prop "label" must be a valid string. Passed value: ${Xt(newValue)}.`);
40
40
  }
41
41
  }
42
42
  watchAriaRole(newValue) {
43
43
  if (newValue && !roles.includes(newValue)) {
44
- throw new Error(`<mg-progress> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${Gt(newValue)}.`);
44
+ throw new Error(`<mg-progress> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${Xt(newValue)}.`);
45
45
  }
46
46
  }
47
47
  watchValue(newValue) {
48
- if (newValue !== undefined && (!Wt(newValue) || !(newValue >= this.min && newValue <= this.max)))
49
- throw new Error(`<mg-progress> prop “value” must be a number within the range ${this.min} to ${this.max}. Passed value: ${Gt(newValue)}.`);
48
+ if (newValue !== undefined && (!Kt(newValue) || !(newValue >= this.min && newValue <= this.max)))
49
+ throw new Error(`<mg-progress> prop “value” must be a number within the range ${this.min} to ${this.max}. Passed value: ${Xt(newValue)}.`);
50
50
  }
51
51
  watchMin(newValue) {
52
- if (newValue !== 0 && newValue !== undefined && (!Wt(newValue) || newValue >= this.max))
53
- throw new Error(`<mg-progress> prop “min” must be a number lower than: ${this.max}. Passed value: ${Gt(newValue)}.`);
52
+ if (newValue !== 0 && newValue !== undefined && (!Kt(newValue) || newValue >= this.max))
53
+ throw new Error(`<mg-progress> prop “min” must be a number lower than: ${this.max}. Passed value: ${Xt(newValue)}.`);
54
54
  }
55
55
  watchMax(newValue) {
56
- if (newValue !== 100 && newValue !== undefined && (!Wt(newValue) || newValue <= this.min))
57
- throw new Error(`<mg-progress> prop “max” must be a number greater than: ${this.min}. Passed value: ${Gt(newValue)}.`);
56
+ if (newValue !== 100 && newValue !== undefined && (!Kt(newValue) || newValue <= this.min))
57
+ throw new Error(`<mg-progress> prop “max” must be a number greater than: ${this.min}. Passed value: ${Xt(newValue)}.`);
58
58
  }
59
59
  /*************
60
60
  * Lifecycle *
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
2
  import { i as initLocales } from './index2.js';
3
- import { D as De } from './index.es.js';
3
+ import { q as qe } from './index.es.js';
4
4
 
5
5
  const mgSkipLinksCss = ".mg-c-skip-links{position:absolute;display:flex;min-height:var(--mg-b-size-56);align-items:center;background:var(--mg-b-color-light);opacity:0;transform:translateY(-100%)}.mg-c-skip-links:focus-within{position:relative;opacity:1;transform:translateY(0)}.mg-c-skip-links__list{display:flex;flex-wrap:wrap;align-items:center;padding:0 var(--mg-b-size-16);margin:0;gap:var(--mg-b-spacing-actions);list-style:none}.mg-c-skip-links__link{display:inline-block;padding:var(--mg-b-size-8) var(--mg-b-size-16);color:var(--mg-b-color-dark)}.mg-c-skip-links__link:hover{background:hsl(var(--mg-b-color-dark-h), var(--mg-b-color-dark-s), var(--mg-b-color-dark-l), 10%)}";
6
6
 
@@ -23,7 +23,7 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class MgSkipLinks extends
23
23
  };
24
24
  }
25
25
  validateLinks(links) {
26
- if (links === undefined || links.length === 0 || links.some(link => !De(link.href) || !link.href.startsWith('#') || !De(link.label))) {
26
+ if (links === undefined || links.length === 0 || links.some(link => !qe(link.href) || !link.href.startsWith('#') || !qe(link.label))) {
27
27
  throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
28
28
  }
29
29
  }
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement } from '@stencil/core/internal/client';
2
- import { Z as Zt, G as Gt, D as De, P as Pt } from './index.es.js';
2
+ import { H as Ht, X as Xt, q as qe, Z as Zt } from './index.es.js';
3
3
  import { i as initLocales } from './index2.js';
4
4
  import { d as defineCustomElement$2 } from './mg-icon2.js';
5
5
 
@@ -83,11 +83,11 @@ const MgTable$1 = /*@__PURE__*/ proxyCustomElement(class MgTable extends HTMLEle
83
83
  /**
84
84
  * Class collection
85
85
  */
86
- this.classCollection = new Zt([this.componentClass]);
86
+ this.classCollection = new Ht([this.componentClass]);
87
87
  }
88
88
  watchSize(newValue, oldValue) {
89
89
  if (!sizes.includes(newValue)) {
90
- throw new Error(`<mg-table> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Gt(newValue)}.`);
90
+ throw new Error(`<mg-table> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Xt(newValue)}.`);
91
91
  }
92
92
  else {
93
93
  if (oldValue !== undefined) {
@@ -106,7 +106,7 @@ const MgTable$1 = /*@__PURE__*/ proxyCustomElement(class MgTable extends HTMLEle
106
106
  }
107
107
  watchColumns(newValue) {
108
108
  if (newValue !== undefined && !isValidColumnsObject(newValue)) {
109
- throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${Gt(newValue)}.`);
109
+ throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${Xt(newValue)}.`);
110
110
  }
111
111
  }
112
112
  /**
@@ -235,8 +235,8 @@ const MgTable$1 = /*@__PURE__*/ proxyCustomElement(class MgTable extends HTMLEle
235
235
  // Ensure caption is not visible (otherwhise the table does not have rounded corners)
236
236
  captionTable.className = 'mg-u-visually-hidden';
237
237
  // Link caption to div
238
- if (!De(captionTable.id)) {
239
- captionTable.setAttribute('id', Pt(`${this.componentClass}-caption`));
238
+ if (!qe(captionTable.id)) {
239
+ captionTable.setAttribute('id', Zt(`${this.componentClass}-caption`));
240
240
  }
241
241
  divWrapper.setAttribute('aria-labelledby', captionTable.id);
242
242
  // Add sortable caption if neeeded
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { P as Pt, Z as Zt, X as Xt, U as Ut, G as Gt, D as De, a as Dt } from './index.es.js';
2
+ import { Z as Zt, H as Ht, Q as Qt, D as Dt, X as Xt, q as qe, a as qt } from './index.es.js';
3
3
  import { K as Keys } from './events.utils.js';
4
4
  import { d as defineCustomElement$3 } from './mg-badge2.js';
5
5
  import { d as defineCustomElement$2 } from './mg-icon2.js';
@@ -43,7 +43,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
43
43
  * Identifier is used for the element ID (id is a reserved prop in Stencil.js)
44
44
  * If not set, it will be created.
45
45
  */
46
- this.identifier = Pt('mg-tabs');
46
+ this.identifier = Zt('mg-tabs');
47
47
  /**
48
48
  * Define tabs size
49
49
  */
@@ -55,7 +55,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
55
55
  /**
56
56
  * Component classes
57
57
  */
58
- this.classCollection = new Zt(['mg-c-tabs']);
58
+ this.classCollection = new Ht(['mg-c-tabs']);
59
59
  /**
60
60
  * Validate that new tab status can be `Status.ACTIVE`
61
61
  * @param tab - tab item
@@ -153,7 +153,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
153
153
  */
154
154
  this.resetFocus = () => {
155
155
  // update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
156
- Xt(() => {
156
+ Qt(() => {
157
157
  this.tabFocus = undefined;
158
158
  Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
159
159
  tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
@@ -170,30 +170,30 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
170
170
  };
171
171
  }
172
172
  watchIdentifier(newValue) {
173
- if (!Ut(newValue)) {
174
- console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
173
+ if (!Dt(newValue)) {
174
+ console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${Xt(newValue)}.`);
175
175
  }
176
176
  }
177
177
  validateLabel(newValue) {
178
- if (!De(newValue)) {
179
- throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${Gt(newValue)}.`);
178
+ if (!qe(newValue)) {
179
+ throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${Xt(newValue)}.`);
180
180
  }
181
181
  }
182
182
  validateSize(newValue) {
183
183
  if (!sizes.includes(newValue)) {
184
- throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Gt(newValue)}.`);
184
+ throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Xt(newValue)}.`);
185
185
  }
186
186
  this.classCollection.add(`mg-c-tabs--size-${this.size}`);
187
187
  }
188
188
  validateItems(newValue) {
189
189
  // String array
190
- if (Dt(newValue))
190
+ if (qt(newValue))
191
191
  this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
192
192
  // Object array
193
193
  else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
194
194
  this.tabs = newValue;
195
195
  else
196
- throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${Gt(newValue)}.`);
196
+ throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${Xt(newValue)}.`);
197
197
  }
198
198
  validateActiveTab(newValue) {
199
199
  // when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
@@ -218,7 +218,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class MgTabs extends HTMLEleme
218
218
  this.activeTabChange.emit(newValue);
219
219
  }
220
220
  else {
221
- throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${Gt(newValue)}.`);
221
+ throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${Xt(newValue)}.`);
222
222
  }
223
223
  }
224
224
  /*************
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { Z as Zt, G as Gt, D as De } from './index.es.js';
2
+ import { H as Ht, X as Xt, q as qe } from './index.es.js';
3
3
 
4
4
  /**
5
5
  * List of all possibles variants
@@ -34,11 +34,11 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement
34
34
  /**
35
35
  * Component classes
36
36
  */
37
- this.classCollection = new Zt(['mg-c-tag']);
37
+ this.classCollection = new Ht(['mg-c-tag']);
38
38
  }
39
39
  validateVariant(newValue, oldValue) {
40
40
  if (!variants.includes(newValue)) {
41
- throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${Gt(newValue)}.`);
41
+ throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${Xt(newValue)}.`);
42
42
  }
43
43
  else {
44
44
  if (oldValue !== undefined) {
@@ -71,7 +71,7 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class MgTag extends HTMLElement
71
71
  * @param textContent - html element textContent property
72
72
  */
73
73
  validateTextContent(textContent) {
74
- if (!De(textContent))
74
+ if (!qe(textContent))
75
75
  throw new Error('<mg-tag> slot must contain a text content.');
76
76
  }
77
77
  /*************
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
 
3
- const mgTooltipContentCss = ":host{z-index:1000;top:0;left:0;display:none;width:max-content;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){position:absolute;visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}";
3
+ const mgTooltipContentCss = ":host{z-index:1000;display:none;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}";
4
4
 
5
5
  const MgTooltipContent = /*@__PURE__*/ proxyCustomElement(class MgTooltipContent extends HTMLElement {
6
6
  constructor() {
@@ -1 +1 @@
1
- {"file":"mg-tooltip-content2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,goCAAgoC;;MCU/oC,gBAAgB,iBAAAA,kBAAA,CAAA,MAAA,gBAAA,SAAA,WAAA,CAAA;;;;;;AAM3B;;AAEe;AAEf;;;AAGG;IACH,MAAM,GAAA;QACJ,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,SAAS,EAAA,EAClB,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAC,6BAA6B,EAAQ,CAAA,EAC1E,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,OAAO,EAAQ,CAAA,CACrB;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["../styles/dist/components/mg-tooltip-content.css?tag=mg-tooltip-content&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.tsx"],"sourcesContent":[":host{z-index:1000;top:0;left:0;display:none;width:max-content;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){position:absolute;visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}/*# sourceMappingURL=mg-tooltip-content.css.map */\n","import { Component, h, Host, Prop } from '@stencil/core';\n\n/**\n * @internal\n */\n@Component({\n tag: 'mg-tooltip-content',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-tooltip-content.css',\n shadow: true,\n})\nexport class MgTooltipContent {\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"tooltip\">\n <span innerHTML={this.message} class=\"mg-tooltip-content__message\"></span>\n <slot name=\"arrow\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"mg-tooltip-content2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,2mCAA2mC;;MCU1nC,gBAAgB,iBAAAA,kBAAA,CAAA,MAAA,gBAAA,SAAA,WAAA,CAAA;;;;;;AAM3B;;AAEe;AAEf;;;AAGG;IACH,MAAM,GAAA;QACJ,QACE,CAAC,CAAA,IAAI,EAAC,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,SAAS,EAAA,EAClB,CAAM,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,EAAC,6BAA6B,EAAQ,CAAA,EAC1E,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,OAAO,EAAQ,CAAA,CACrB;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement"],"sources":["../styles/dist/components/mg-tooltip-content.css?tag=mg-tooltip-content&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.tsx"],"sourcesContent":[":host{z-index:1000;display:none;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-popper-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-popper-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}/*# sourceMappingURL=mg-tooltip-content.css.map */\n","import { Component, h, Host, Prop } from '@stencil/core';\n\n/**\n * @internal\n */\n@Component({\n tag: 'mg-tooltip-content',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-tooltip-content.css',\n shadow: true,\n})\nexport class MgTooltipContent {\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"tooltip\">\n <span innerHTML={this.message} class=\"mg-tooltip-content__message\"></span>\n <slot name=\"arrow\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { P as Pt, X as Xt, U as Ut, G as Gt, D as De, B as Bt, c as Ht } from './index.es.js';
3
- import { b as autoUpdate, c as computePosition, g as getTransformation, n as numberToPx, i as isFloatingUIPlacement, o as offset, f as flip, d as shift, e as arrow, l as limitShift } from './floating-ui.utils.js';
2
+ import { Z as Zt, Q as Qt, D as Dt, X as Xt, q as qe, J as Jt, c as Gt } from './index.es.js';
4
3
  import { d as defineCustomElement$1 } from './mg-tooltip-content2.js';
4
+ import { c as createPopper } from './popper.js';
5
5
 
6
6
  const Guard = {
7
7
  FOCUS: 'focus',
@@ -27,7 +27,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
27
27
  * Sets an `id` attribute.
28
28
  * Needed by the input for accessibility `aria-decribedby`.
29
29
  */
30
- this.identifier = Pt('mg-tooltip');
30
+ this.identifier = Zt('mg-tooltip');
31
31
  /**
32
32
  * Tooltip placement
33
33
  */
@@ -46,14 +46,15 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
46
46
  this.show = () => {
47
47
  // Make the tooltip visible
48
48
  this.mgTooltipContent.dataset.show = '';
49
+ // Enable the event listeners
50
+ this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
49
51
  // hide when click outside on nextTick to prevent event to trigger after creation
50
- Xt(() => {
52
+ Qt(() => {
51
53
  this.windows.forEach((localWindow) => {
52
54
  localWindow.addEventListener('click', this.handleClickOutside, false);
53
55
  localWindow.addEventListener('keydown', this.handlePressEscape, false);
54
56
  });
55
57
  });
56
- this.updateTooltip();
57
58
  };
58
59
  /**
59
60
  * Hide tooltip
@@ -61,6 +62,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
61
62
  this.hide = () => {
62
63
  // Hide the tooltip
63
64
  this.mgTooltipContent.removeAttribute('data-show');
65
+ // Disable the event listeners
66
+ this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
64
67
  // Remove event listener
65
68
  this.windows.forEach((localWindow) => {
66
69
  localWindow.removeEventListener('click', this.handleClickOutside, false);
@@ -91,9 +94,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
91
94
  * @param condition - additionnal condition to apply display prop newValue
92
95
  */
93
96
  this.setDisplay = (newValue, condition = true) => {
94
- if (!this.disabled && condition && this.display !== newValue) {
97
+ if (!this.disabled && condition)
95
98
  this.display = newValue;
96
- }
97
99
  };
98
100
  /**
99
101
  * Action for tooltip element and tooltiped element mouse listener
@@ -151,43 +153,30 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
151
153
  }
152
154
  };
153
155
  /**
154
- * Update tooltip position
155
- * @returns autoUpdate function
156
+ * Set popper instance
157
+ * @param strategy - popper strategy to apply on instance
156
158
  */
157
- this.updateTooltip = () => autoUpdate(this.tooltipedElement, this.mgTooltipContent, async () => {
158
- // Placement
159
- const { x, y, placement, middlewareData } = await computePosition(this.tooltipedElement, this.mgTooltipContent, {
159
+ this.setPopper = (strategy) => {
160
+ // Create popperjs tooltip
161
+ this.popper = createPopper(this.tooltipedElement, this.mgTooltipContent, {
160
162
  placement: this.placement,
161
- strategy: this.tooltipStrategy,
162
- middleware: [
163
- offset(8),
164
- flip(),
165
- shift({
166
- limiter: limitShift(),
167
- }),
168
- arrow({ element: this.arrowElement }),
163
+ strategy,
164
+ modifiers: [
165
+ {
166
+ name: 'offset',
167
+ options: {
168
+ offset: [0, 8],
169
+ },
170
+ },
171
+ {
172
+ name: 'flip',
173
+ options: {
174
+ fallbackPlacements: ['auto'],
175
+ },
176
+ },
169
177
  ],
170
178
  });
171
- // Positioning
172
- Object.assign(this.mgTooltipContent.style, {
173
- position: this.tooltipStrategy,
174
- transform: getTransformation(x, y),
175
- });
176
- // Arrow positioning
177
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
178
- const staticSide = {
179
- top: 'bottom',
180
- right: 'left',
181
- bottom: 'top',
182
- left: 'right',
183
- }[placement.split('-')[0]];
184
- Object.assign(this.arrowElement.style, {
185
- left: numberToPx(arrowX),
186
- top: numberToPx(arrowY),
187
- [staticSide]: '-4px',
188
- });
189
- this.mgTooltipContent.setAttribute('data-placement', placement);
190
- });
179
+ };
191
180
  /**
192
181
  * Define selected element to become tooltip selector and init listeners
193
182
  * @param element - tooltiped element
@@ -229,15 +218,17 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
229
218
  // set guard when one of mutations is for a disabled with disabled-on-click
230
219
  if (mutationList.some((mutation) => mutation.target.disabled && mutation.target.disableOnClick)) {
231
220
  this.guard = Guard.DISABLE_ON_CLICK;
232
- return;
233
221
  }
222
+ // when the disabled-on-click guard is running we stop process
223
+ if (this.guard === Guard.DISABLE_ON_CLICK)
224
+ return;
234
225
  // update button wrapper
235
226
  this.setMgButtonWrapper(mgButton);
236
227
  // Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
237
228
  // we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
238
229
  this.resetGuard();
239
- // update Floating UI instance
240
- this.updateTooltip();
230
+ // update popper instance
231
+ this.popper.update();
241
232
  }).observe(mgButton, { attributes: true });
242
233
  };
243
234
  /**
@@ -256,23 +247,19 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
256
247
  };
257
248
  }
258
249
  watchIdentifier(newValue) {
259
- if (!Ut(newValue)) {
260
- throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
250
+ if (!Dt(newValue)) {
251
+ throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${Xt(newValue)}.`);
261
252
  }
262
253
  // use renderTooltipContent to update tooltip-content id
263
254
  this.renderTooltipContent();
264
255
  }
265
256
  watchMessage(newValue) {
266
- if (!De(newValue)) {
267
- throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${Gt(newValue)}.`);
257
+ if (!qe(newValue)) {
258
+ throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${Xt(newValue)}.`);
268
259
  }
269
260
  if (this.mgTooltipContent !== undefined)
270
261
  this.mgTooltipContent.message = newValue;
271
262
  }
272
- watchPlacement(newValue) {
273
- if (!isFloatingUIPlacement(newValue))
274
- this.placement = 'bottom';
275
- }
276
263
  watchDisplay(newValue) {
277
264
  if (newValue) {
278
265
  this.show();
@@ -302,7 +289,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
302
289
  this.mgTooltipContent.setAttribute('id', this.identifier);
303
290
  const arrow = document.createElement('div');
304
291
  arrow.setAttribute('slot', 'arrow');
305
- arrow.dataset.floatingArrow = '';
292
+ arrow.dataset.popperArrow = '';
306
293
  this.mgTooltipContent.appendChild(arrow);
307
294
  // manage tooltipElement & tooltipedElement mouseenter/mouseleave events
308
295
  this.mgTooltipContent.addEventListener('mouseenter', () => {
@@ -323,16 +310,13 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
323
310
  */
324
311
  componentWillLoad() {
325
312
  // Get windows to attach events
326
- this.windows = Bt(window);
313
+ this.windows = Jt(window);
327
314
  // Get tooltip element
328
315
  this.renderTooltipContent();
329
316
  //validate properties
330
- this.watchPlacement(this.placement);
331
317
  this.watchDisabled(this.disabled);
332
318
  this.watchMessage(this.message);
333
319
  this.watchIdentifier(this.identifier);
334
- // define if the tooltip is inside a popover
335
- this.tooltipStrategy = this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed';
336
320
  }
337
321
  /**
338
322
  * Get slotted element
@@ -344,10 +328,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
344
328
  // get slotted element wich is not the tooltip
345
329
  const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
346
330
  // Get interactive element
347
- const interactiveElement = slotElement.matches(Ht) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(Ht);
331
+ const interactiveElement = slotElement.matches(Gt) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(Gt);
348
332
  this.setTooltipedElement(interactiveElement || slotElement);
349
- // Set arrow element
350
- this.arrowElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');
351
333
  // Check if slotted element is a disabled mg-button
352
334
  // In this case we wrap the mg-button into a div to enable the tooltip
353
335
  if (isButton(slotElement)) {
@@ -363,6 +345,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
363
345
  }
364
346
  // apply a11y aria
365
347
  this.setAriaDescribedby(slotElement);
348
+ // set Tooltip
349
+ this.setPopper(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
366
350
  // add document keyboard handler
367
351
  document.addEventListener('keydown', this.handlePressEscape);
368
352
  // check props
@@ -372,32 +356,30 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
372
356
  * update popper position after props change on component did update hook to benefit from render ended
373
357
  */
374
358
  componentDidUpdate() {
375
- this.updateTooltip();
359
+ this.popper.update();
376
360
  }
377
361
  /**
378
362
  * remove listeners
379
363
  */
380
364
  disconnectedCallback() {
381
- var _a, _b;
365
+ var _a;
382
366
  document.removeEventListener('keydown', this.handlePressEscape);
383
367
  (_a = this.windows) === null || _a === void 0 ? void 0 : _a.forEach((localWindow) => {
384
368
  localWindow.removeEventListener('click', this.handleClickOutside, false);
385
369
  localWindow.removeEventListener('keydown', this.handlePressEscape, false);
386
370
  });
387
- (_b = this.updateTooltip) === null || _b === void 0 ? void 0 : _b.call(this);
388
371
  }
389
372
  /**
390
373
  * Render
391
374
  * @returns HTML Element
392
375
  */
393
376
  render() {
394
- return (h(Host, { key: 'dab470c730b1541ab5be487222da8ba3643501ae' }, h("slot", { key: 'a6f5d444e3521d93cf9f39ccffcd68cfde4f8101' }), h("slot", { key: 'ba4d98f953453a710379cb4ce28f1c468a34ffc4', name: "content" })));
377
+ return (h(Host, { key: '9aae13f15c5c93d3a2e887a75e1ad54fd823f79e' }, h("slot", { key: 'd7a42dac1c0e43c1fddc08f80ba36ce5db65af0a' }), h("slot", { key: 'a89fc2e61a82de8d41d1231f5ba0136cd801f1f3', name: "content" })));
395
378
  }
396
379
  get element() { return this; }
397
380
  static get watchers() { return {
398
381
  "identifier": ["watchIdentifier"],
399
382
  "message": ["watchMessage"],
400
- "placement": ["watchPlacement"],
401
383
  "display": ["watchDisplay"],
402
384
  "disabled": ["watchDisabled"]
403
385
  }; }
@@ -405,13 +387,12 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
405
387
  }, [1, "mg-tooltip", {
406
388
  "identifier": [1],
407
389
  "message": [1],
408
- "placement": [1025],
390
+ "placement": [1],
409
391
  "display": [1028],
410
392
  "disabled": [4]
411
393
  }, undefined, {
412
394
  "identifier": ["watchIdentifier"],
413
395
  "message": ["watchMessage"],
414
- "placement": ["watchPlacement"],
415
396
  "display": ["watchDisplay"],
416
397
  "disabled": ["watchDisabled"]
417
398
  }]);