@mgdis/mg-components 6.10.0 → 6.11.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 (142) hide show
  1. package/dist/cjs/{index-CfIlskRh.js → index-B_WwxtkQ.js} +4 -4
  2. package/dist/cjs/{index-CfIlskRh.js.map → index-B_WwxtkQ.js.map} +1 -1
  3. package/dist/cjs/{index.es-BCLy9yYb.js → index.es-C-3Gv8Eu.js} +85 -81
  4. package/dist/cjs/index.es-C-3Gv8Eu.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/mg-action-more_37.cjs.entry.js +1915 -1909
  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 +75 -72
  11. package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -1
  12. package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -1
  13. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +12 -12
  14. package/dist/cjs/mg-loader.cjs.entry.js +4 -4
  15. package/dist/cjs/mg-progress.cjs.entry.js +10 -10
  16. package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
  17. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  18. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -1
  19. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  20. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +43 -63
  21. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  22. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js.map +1 -1
  23. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +67 -45
  24. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -1
  25. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +25 -30
  26. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
  27. package/dist/collection/components/molecules/mg-details/mg-details.js +5 -1
  28. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  29. package/dist/collection/components/molecules/mg-popover/mg-popover.js +47 -97
  30. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  31. package/dist/components/index.es.js +71 -68
  32. package/dist/components/index.es.js.map +1 -1
  33. package/dist/components/index2.js +2 -2
  34. package/dist/components/mg-action-more.js +6 -6
  35. package/dist/components/mg-alert.js +5 -5
  36. package/dist/components/mg-badge2.js +6 -6
  37. package/dist/components/mg-button2.js +7 -7
  38. package/dist/components/mg-button2.js.map +1 -1
  39. package/dist/components/mg-character-left2.js +4 -4
  40. package/dist/components/mg-details.js +8 -4
  41. package/dist/components/mg-details.js.map +1 -1
  42. package/dist/components/mg-form.js +7 -7
  43. package/dist/components/mg-icon2.js +6 -6
  44. package/dist/components/mg-illustrated-message.js +5 -5
  45. package/dist/components/mg-input-checkbox.js +9 -9
  46. package/dist/components/mg-input-combobox.js +74 -71
  47. package/dist/components/mg-input-combobox.js.map +1 -1
  48. package/dist/components/mg-input-date.js +17 -17
  49. package/dist/components/mg-input-numeric.js +13 -13
  50. package/dist/components/mg-input-password.js +3 -3
  51. package/dist/components/mg-input-radio.js +7 -7
  52. package/dist/components/mg-input-rich-text-editor.js +11 -11
  53. package/dist/components/mg-input-select2.js +32 -37
  54. package/dist/components/mg-input-select2.js.map +1 -1
  55. package/dist/components/mg-input-text2.js +9 -9
  56. package/dist/components/mg-input-textarea.js +7 -7
  57. package/dist/components/mg-input-title2.js +4 -4
  58. package/dist/components/mg-input-toggle.js +6 -6
  59. package/dist/components/mg-input2.js +8 -8
  60. package/dist/components/mg-item-more2.js +7 -7
  61. package/dist/components/mg-loader2.js +3 -3
  62. package/dist/components/mg-menu-item2.js +11 -11
  63. package/dist/components/mg-message2.js +4 -4
  64. package/dist/components/mg-modal.js +8 -8
  65. package/dist/components/mg-pagination2.js +6 -6
  66. package/dist/components/mg-panel.js +9 -9
  67. package/dist/components/mg-popover-content2.js +4 -4
  68. package/dist/components/mg-popover-content2.js.map +1 -1
  69. package/dist/components/mg-popover2.js +48 -96
  70. package/dist/components/mg-popover2.js.map +1 -1
  71. package/dist/components/mg-progress.js +10 -10
  72. package/dist/components/mg-skip-links.js +2 -2
  73. package/dist/components/mg-table.js +6 -6
  74. package/dist/components/mg-tabs.js +12 -12
  75. package/dist/components/mg-tag.js +4 -4
  76. package/dist/components/mg-tooltip-content2.js +1 -1
  77. package/dist/components/mg-tooltip-content2.js.map +1 -1
  78. package/dist/components/mg-tooltip2.js +47 -66
  79. package/dist/components/mg-tooltip2.js.map +1 -1
  80. package/dist/components/popper.js +1793 -0
  81. package/dist/components/popper.js.map +1 -0
  82. package/dist/esm/{index-DmsGewMC.js → index-DHpyFawS.js} +4 -4
  83. package/dist/esm/{index-DmsGewMC.js.map → index-DHpyFawS.js.map} +1 -1
  84. package/dist/esm/{index.es-rLV3KFPd.js → index.es-lyrZ9KRh.js} +73 -70
  85. package/dist/esm/index.es-lyrZ9KRh.js.map +1 -0
  86. package/dist/esm/loader.js +1 -1
  87. package/dist/esm/mg-action-more_37.entry.js +1915 -1909
  88. package/dist/esm/mg-action-more_37.entry.js.map +1 -1
  89. package/dist/esm/mg-alert.entry.js +6 -6
  90. package/dist/esm/mg-components.js +1 -1
  91. package/dist/esm/mg-input-combobox.entry.js +75 -72
  92. package/dist/esm/mg-input-combobox.entry.js.map +1 -1
  93. package/dist/esm/mg-input-rich-text-editor.entry.js +12 -12
  94. package/dist/esm/mg-loader.entry.js +4 -4
  95. package/dist/esm/mg-progress.entry.js +10 -10
  96. package/dist/mg-components/mg-components.esm.js +1 -1
  97. package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -1
  98. package/dist/mg-components/{p-ad66e7b3.entry.js → p-596c0e08.entry.js} +2 -2
  99. package/dist/mg-components/p-8a3bd8ad.entry.js +2 -0
  100. package/dist/mg-components/p-8a3bd8ad.entry.js.map +1 -0
  101. package/dist/mg-components/p-98a74b62.entry.js +2 -0
  102. package/dist/mg-components/{p-cdbe689e.entry.js.map → p-98a74b62.entry.js.map} +1 -1
  103. package/dist/mg-components/{p-DK9teKTo.js → p-C-vIqOyI.js} +2 -2
  104. package/dist/mg-components/{p-DK9teKTo.js.map → p-C-vIqOyI.js.map} +1 -1
  105. package/dist/mg-components/{p-73099ed7.entry.js → p-d4ed3aad.entry.js} +2 -2
  106. package/dist/mg-components/p-e822bd96.entry.js +2 -0
  107. package/dist/mg-components/{p-88f77de2.entry.js.map → p-e822bd96.entry.js.map} +1 -1
  108. package/dist/mg-components/p-fc7b96e6.entry.js +2 -0
  109. package/dist/mg-components/p-fc7b96e6.entry.js.map +1 -0
  110. package/dist/mg-components/p-lyrZ9KRh.js +2 -0
  111. package/dist/mg-components/p-lyrZ9KRh.js.map +1 -0
  112. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -6
  113. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -8
  114. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +1 -1
  115. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +5 -0
  116. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -9
  117. package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -0
  118. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +8 -22
  119. package/dist/types/components.d.ts +11 -8
  120. package/ide/intellij/web-types.json +6 -2
  121. package/ide/vscode/html-custom-data.json +1 -1
  122. package/package.json +12 -12
  123. package/dist/cjs/index.es-BCLy9yYb.js.map +0 -1
  124. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -2
  125. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +0 -1
  126. package/dist/collection/utils/floating-ui.utils.js +0 -74
  127. package/dist/collection/utils/floating-ui.utils.js.map +0 -1
  128. package/dist/components/floating-ui.utils.js +0 -1721
  129. package/dist/components/floating-ui.utils.js.map +0 -1
  130. package/dist/esm/index.es-rLV3KFPd.js.map +0 -1
  131. package/dist/mg-components/p-0f761c6c.entry.js +0 -2
  132. package/dist/mg-components/p-0f761c6c.entry.js.map +0 -1
  133. package/dist/mg-components/p-88f77de2.entry.js +0 -2
  134. package/dist/mg-components/p-cdbe689e.entry.js +0 -2
  135. package/dist/mg-components/p-d3a868f0.entry.js +0 -2
  136. package/dist/mg-components/p-d3a868f0.entry.js.map +0 -1
  137. package/dist/mg-components/p-rLV3KFPd.js +0 -2
  138. package/dist/mg-components/p-rLV3KFPd.js.map +0 -1
  139. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -6
  140. package/dist/types/utils/floating-ui.utils.d.ts +0 -28
  141. /package/dist/mg-components/{p-ad66e7b3.entry.js.map → p-596c0e08.entry.js.map} +0 -0
  142. /package/dist/mg-components/{p-73099ed7.entry.js.map → p-d4ed3aad.entry.js.map} +0 -0
@@ -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 { D as Dt, e as er, B as Bt, Y as Yt, q as qe, K as Kt, X as Xt } 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 = Dt('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
+ er(() => {
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 (!Bt(newValue)) {
251
+ throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${Yt(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: ${Yt(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 = Kt(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(Xt) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(Xt);
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
  }]);
@@ -1 +1 @@
1
- {"file":"mg-tooltip2.js","mappings":";;;;;AAKO,MAAM,KAAK,GAA8B;AAC9C,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,qBAAqB,EAAE,cAAc;AACrC,IAAA,uBAAuB,EAAE,gBAAgB;AACzC,IAAA,gBAAgB,EAAE,gBAAgB;CACnC;;ACVD,MAAM,YAAY,GAAG,yYAAyY;;ACK9Z;;;;AAIG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAgB,KAAqC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAE,OAAmB,CAAC,OAAO,CAAC;MAUvJ,SAAS,iBAAAA,kBAAA,CAAA,MAAA,SAAA,SAAA,WAAA,CAAA;AALtB,IAAA,WAAA,GAAA;;;;AA6BE;;;AAGG;AACK,QAAA,IAAA,CAAA,UAAU,GAAWC,EAAQ,CAAC,YAAY,CAAC;AAsBnD;;AAEG;AACsB,QAAA,IAAS,CAAA,SAAA,GAAyB,QAAQ;AAMnE;;AAEG;AACsB,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK;AAUxC;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAG,KAAK;AASxB;;AAEG;AACK,QAAA,IAAI,CAAA,IAAA,GAAG,MAAW;;YAExB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE;;YAEvCC,EAAQ,CAAC,MAAK;gBACZ,IAAI,CAA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CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,SAAS,EAAQ,CAAA,CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","createID","nextTick","isValideID","toString","isValidString","getWindows","focusableElements"],"sources":["src/components/atoms/mg-tooltip/mg-tooltip.conf.tsx","../styles/dist/components/mg-tooltip.css?tag=mg-tooltip&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip.tsx"],"sourcesContent":["import { type ExtendedPlacement, placements } from '../../../utils/floating-ui.utils';\nexport * from '../../../utils/floating-ui.utils';\n\nexport type GuardType = 'focus' | 'hoverTooltip' | 'hoverTooltiped' | 'disableOnClick';\n\nexport const Guard: Record<string, GuardType> = {\n FOCUS: 'focus',\n HOVER_TOOLTIP_ELEMENT: 'hoverTooltip',\n HOVER_TOOLTIPED_ELEMENT: 'hoverTooltiped',\n DISABLE_ON_CLICK: 'disableOnClick',\n};\n\n/**\n * Placement type from placements\n */\nexport type TooltipPlacementType = ExtendedPlacement & (typeof placements)[number];\n","/*!\n * @prop --mg-c-tooltip-border-radius: Defines the border radius of the tooltip. Default value: `--mg-b-size-radius`.\n * @prop --mg-c-tooltip-color-background: Defines the background color of the tooltip. Default value: `--mg-b-color-dark`.\n * @prop --mg-c-tooltip-color-text: Defines the font color of the tooltip. Default value: `--mg-b-color-light`.\n */:host{display:inline-block}/*# sourceMappingURL=mg-tooltip.css.map */\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { createID, focusableElements, getWindows, isValideID, isValidString, nextTick, toString } from '@mgdis/stencil-helpers';\nimport { computePosition, autoUpdate, flip, shift, limitShift, offset, arrow, type Strategy, type Placement } from '@floating-ui/dom';\nimport { type GuardType, Guard, type TooltipPlacementType, isFloatingUIPlacement, getTransformation, numberToPx } from './mg-tooltip.conf';\n\n/**\n * HTMLMgButtonElement type guard\n * @param element - element to check\n * @returns return true if type is HTMLMgButtonElement\n */\nconst isButton = (element: unknown): element is HTMLMgButtonElement => typeof element === 'object' && ['MG-BUTTON', 'BUTTON'].includes((element as Element).tagName);\n\n/**\n * @slot - Element that will display the tooltip\n */\n@Component({\n tag: 'mg-tooltip',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-tooltip.css',\n shadow: true,\n})\nexport class MgTooltip {\n /************\n * Internal *\n ************/\n\n private mgTooltipContent: HTMLMgTooltipContentElement;\n private tooltipedElement: HTMLElement;\n private arrowElement: HTMLElement;\n private windows: Window[];\n private hasCustomTabIndex: boolean;\n private tooltipStrategy: Strategy;\n\n // tooltip actions guards\n private guard: GuardType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTooltipElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-tooltip');\n @Watch('identifier')\n watchIdentifier(newValue: MgTooltip['identifier']): void {\n if (!isValideID(newValue)) {\n throw new Error(`<mg-tooltip> prop \"identifier\" value is invalid. Passed value: ${toString(newValue)}.`);\n }\n // use renderTooltipContent to update tooltip-content id\n this.renderTooltipContent();\n }\n\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n @Watch('message')\n watchMessage(newValue: MgTooltip['message']): void {\n if (!isValidString(newValue)) {\n throw new Error(`<mg-tooltip> prop \"message\" is required and must be a string. Passed value: ${toString(newValue)}.`);\n }\n if (this.mgTooltipContent !== undefined) this.mgTooltipContent.message = newValue;\n }\n\n /**\n * Tooltip placement\n */\n @Prop({ mutable: true }) placement: TooltipPlacementType = 'bottom';\n @Watch('placement')\n watchPlacement(newValue: TooltipPlacementType): void {\n if (!isFloatingUIPlacement(newValue)) this.placement = 'bottom';\n }\n\n /**\n * Display tooltip\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n watchDisplay(newValue: MgTooltip['display']): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Disable tooltip\n */\n @Prop() disabled = false;\n @Watch('disabled')\n watchDisabled(newValue: MgTooltip['disabled']): void {\n if (this.hasCustomTabIndex) {\n if (newValue) this.tooltipedElement.removeAttribute('tabindex');\n else if (!this.tooltipedElement.hasAttribute('tabindex')) this.tooltipedElement.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Show tooltip\n */\n private show = (): void => {\n // Make the tooltip visible\n this.mgTooltipContent.dataset.show = '';\n // hide when click outside on nextTick to prevent event to trigger after creation\n nextTick(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.handleClickOutside, false);\n localWindow.addEventListener('keydown', this.handlePressEscape, false);\n });\n });\n this.updateTooltip();\n };\n\n /**\n * Hide tooltip\n */\n private hide = (): void => {\n // Hide the tooltip\n this.mgTooltipContent.removeAttribute('data-show');\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.handleClickOutside, false);\n localWindow.removeEventListener('keyboard', this.handlePressEscape, false);\n });\n };\n\n /**\n * Check if clicked outside of component and hide tooltip\n * @param event - mouse event\n */\n private handleClickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (event.target.closest('mg-tooltip') !== this.element) this.setDisplay(false);\n };\n\n /**\n * Check if 'Escape' key is pressed of component and hide tooltip\n * @param event - keyboard event\n */\n private handlePressEscape = (event: KeyboardEvent): void => {\n if (event.code === 'Escape') {\n this.setDisplay(false);\n this.resetGuard();\n }\n };\n\n /**\n * Method to set display prop\n * @param newValue - display prop new value\n * @param condition - additionnal condition to apply display prop newValue\n */\n private setDisplay = (newValue: MgTooltip['display'], condition = true): void => {\n if (!this.disabled && condition && this.display !== newValue) {\n this.display = newValue;\n }\n };\n\n /**\n * Action for tooltip element and tooltiped element mouse listener\n * @param elementGuard - tooltip element guard\n * @param eventName - event name\n * @param conditionalGuard - guard condition\n */\n private tooltipMouseListenerAction = (elementGuard: GuardType, eventName: 'mouseenter' | 'mouseleave', conditionalGuard: GuardType): void => {\n // active FOCUS guard cancel process\n if ([Guard.FOCUS, Guard.DISABLE_ON_CLICK].includes(this.guard)) {\n return;\n }\n\n // Update guard by element guard\n this.guard = elementGuard;\n\n if (eventName !== 'mouseenter') {\n // process action in the next event loop macro task\n setTimeout(() => {\n this.setDisplay(false, this.guard !== conditionalGuard);\n this.resetGuard();\n }, 100);\n } else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {\n this.setDisplay(true);\n }\n };\n\n /**\n * Method to reset guard value\n */\n private resetGuard = (): void => {\n this.guard = undefined;\n };\n\n /**\n * Update slot content when it is a mg-button\n * @param mgButton - slotted mg-button\n */\n private setMgButtonWrapper = (mgButton: HTMLMgButtonElement): void => {\n const buttonWrapperClass = 'mg-c-tooltip__mg-button-wrapper';\n const hasButtonWrapper = mgButton.parentElement.classList.contains(buttonWrapperClass);\n // For disabled mg-button, we need to wrap it in a new element\n // We bind handlers to this new element to keep listener features as workaround to disabled mg-button `pointer-events: none`\n // AND to prevent multiple nested wrappers from rendering when a new render is called with a disabled mg-button\n if (mgButton.disabled && !hasButtonWrapper) {\n // wrap mg-button in a div\n const div = document.createElement('div');\n div.classList.add(buttonWrapperClass);\n mgButton.parentNode.insertBefore(div, mgButton);\n div.appendChild(mgButton);\n\n // update tooltipElement\n this.setTooltipedElement(div);\n } else if (!mgButton.disabled && hasButtonWrapper) {\n this.element.firstElementChild.replaceWith(mgButton);\n\n // update tooltipElement\n this.setTooltipedElement(mgButton);\n }\n };\n\n /**\n * Update tooltip position\n * @returns autoUpdate function\n */\n private updateTooltip = () =>\n autoUpdate(this.tooltipedElement, this.mgTooltipContent, async () => {\n // Placement\n const { x, y, placement, middlewareData } = await computePosition(this.tooltipedElement, this.mgTooltipContent, {\n placement: this.placement as Placement,\n strategy: this.tooltipStrategy,\n middleware: [\n offset(8),\n flip(),\n shift({\n limiter: limitShift(),\n }),\n arrow({ element: this.arrowElement }),\n ],\n });\n\n // Positioning\n Object.assign(this.mgTooltipContent.style, {\n position: this.tooltipStrategy,\n transform: getTransformation(x, y),\n });\n\n // Arrow positioning\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]];\n\n Object.assign(this.arrowElement.style, {\n left: numberToPx(arrowX),\n top: numberToPx(arrowY),\n [staticSide]: '-4px',\n });\n\n this.mgTooltipContent.setAttribute('data-placement', placement);\n });\n\n /**\n * Define selected element to become tooltip selector and init listeners\n * @param element - tooltiped element\n */\n private setTooltipedElement = (element: HTMLElement): void => {\n this.tooltipedElement = element;\n\n // Manage tooltipedElement focus events\n this.tooltipedElement.addEventListener('focus', () => {\n this.guard = Guard.FOCUS;\n this.setDisplay(true);\n });\n\n // as `click` event is the composition of `mousedown` and `mouseup` event,\n // and `click` event trigger `focus` event after a success `mousedown` wich set the `guard` to `Guard.FOCUS`\n // we reset the guard on `mouseup` event to unlock tooltip\n this.tooltipedElement.addEventListener('mouseup', () => {\n this.resetGuard();\n });\n\n this.tooltipedElement.addEventListener('blur', () => {\n this.resetGuard();\n this.setDisplay(false);\n });\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n this.tooltipedElement.addEventListener('mouseenter', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIP_ELEMENT);\n });\n\n this.tooltipedElement.addEventListener('mouseleave', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIP_ELEMENT);\n });\n };\n\n /**\n * Set button mutation observer\n * @param mgButton - mg-button to observe\n */\n private setMgButtonMutationObserver = (mgButton: HTMLMgButtonElement): void => {\n new MutationObserver(mutationList => {\n // stop process when none of mutations attributed is disabled\n if (!mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) return;\n\n // set guard when one of mutations is for a disabled with disabled-on-click\n if (mutationList.some((mutation: MutationRecord & { target: HTMLMgButtonElement }) => mutation.target.disabled && mutation.target.disableOnClick)) {\n this.guard = Guard.DISABLE_ON_CLICK;\n return;\n }\n\n // update button wrapper\n this.setMgButtonWrapper(mgButton);\n\n // Since Firefox doesn't trigger a \"blur\" event when the \"disabled\" attribute is added or removed from a button\n // we have to manually unlock the guard because the \"blur\" handler of the tooltipedElement won't do it.\n this.resetGuard();\n\n // update Floating UI instance\n this.updateTooltip();\n }).observe(mgButton, { attributes: true });\n };\n\n /**\n * Set tooltiped element aria-describedby\n * @param element - element to update\n */\n private setAriaDescribedby = (element: HTMLElement): void => {\n // Set aria-describedby\n if (!element.hasAttribute('aria-describedby')) {\n this.tooltipedElement.setAttribute('aria-describedby', this.identifier);\n } else {\n // We ensure to have uniq ids\n element.setAttribute('aria-describedby', `${[...new Set([...element.getAttribute('aria-describedby').split(' '), this.identifier])].join(' ')}`);\n }\n };\n\n /**\n * Render tooltip content element and init listeners\n */\n private renderTooltipContent(): void {\n if (this.mgTooltipContent !== undefined) {\n this.mgTooltipContent.setAttribute('id', this.identifier);\n } else {\n this.mgTooltipContent = document.createElement('mg-tooltip-content');\n this.mgTooltipContent.setAttribute('slot', 'content');\n this.mgTooltipContent.setAttribute('id', this.identifier);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.floatingArrow = '';\n this.mgTooltipContent.appendChild(arrow);\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n this.mgTooltipContent.addEventListener('mouseenter', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIPED_ELEMENT);\n });\n this.mgTooltipContent.addEventListener('mouseleave', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIPED_ELEMENT);\n });\n\n // append tooltip element to component\n this.element.appendChild(this.mgTooltipContent);\n }\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * set variables\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n\n // Get tooltip element\n this.renderTooltipContent();\n\n //validate properties\n this.watchPlacement(this.placement);\n this.watchDisabled(this.disabled);\n this.watchMessage(this.message);\n this.watchIdentifier(this.identifier);\n\n // define if the tooltip is inside a popover\n this.tooltipStrategy = this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed';\n }\n\n /**\n * Get slotted element\n * Check if it already contain an interactive element, if not we need to add a tabIndex attribute\n * We need to attach the focused element to the tooltip (aria-describedby)\n */\n componentDidLoad(): void {\n // get slotted element wich is not the tooltip\n const slotElement: HTMLElement = this.element.querySelector(`*:not(#${this.identifier})`);\n\n // Get interactive element\n const interactiveElement: HTMLElement = slotElement.matches(focusableElements) ? slotElement : slotElement.shadowRoot?.querySelector(focusableElements);\n\n this.setTooltipedElement(interactiveElement || slotElement);\n\n // Set arrow element\n this.arrowElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');\n\n // Check if slotted element is a disabled mg-button\n // In this case we wrap the mg-button into a div to enable the tooltip\n if (isButton(slotElement)) {\n this.setMgButtonMutationObserver(slotElement);\n this.setMgButtonWrapper(slotElement);\n }\n\n // Add tabindex to slotted element if we can't find any interactive element\n if (!this.disabled && [undefined, null].includes(interactiveElement)) {\n this.hasCustomTabIndex = true;\n slotElement.tabIndex = 0;\n // Add role on non-interactive element to work with \"aria-describedby\" for screen readers\n slotElement.setAttribute('role', 'button');\n }\n\n // apply a11y aria\n this.setAriaDescribedby(slotElement);\n\n // add document keyboard handler\n document.addEventListener('keydown', this.handlePressEscape);\n\n // check props\n this.watchDisplay(this.display);\n }\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.updateTooltip();\n }\n\n /**\n * remove listeners\n */\n disconnectedCallback(): void {\n document.removeEventListener('keydown', this.handlePressEscape);\n this.windows?.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.handleClickOutside, false);\n localWindow.removeEventListener('keydown', this.handlePressEscape, false);\n });\n this.updateTooltip?.();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"mg-tooltip2.js","mappings":";;;;;AAEO,MAAM,KAAK,GAA8B;AAC9C,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,qBAAqB,EAAE,cAAc;AACrC,IAAA,uBAAuB,EAAE,gBAAgB;AACzC,IAAA,gBAAgB,EAAE,gBAAgB;CACnC;;ACPD,MAAM,YAAY,GAAG,yYAAyY;;ACK9Z;;;;AAIG;AACH,MAAM,QAAQ,GAAG,CAAC,OAAgB,KAAqC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAE,OAAmB,CAAC,OAAO,CAAC;MAUvJ,SAAS,iBAAAA,kBAAA,CAAA,MAAA,SAAA,SAAA,WAAA,CAAA;AALtB,IAAA,WAAA,GAAA;;;;AA4BE;;;AAGG;AACK,QAAA,IAAA,CAAA,UAAU,GAAWC,EAAQ,CAAC,YAAY,CAAC;AAsBnD;;AAEG;AACK,QAAA,IAAS,CAAA,SAAA,GAAc,QAAQ;AAEvC;;AAEG;AACsB,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK;AAUxC;;AAEG;AACK,QAAA,IAAQ,CAAA,QAAA,GAAG,KAAK;AASxB;;AAEG;AACK,QAAA,IAAI,CAAA,IAAA,GAAG,MAAW;;YAExB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,GAAG,EAAE;;YAEvC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,KACzB,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,SAAS,EAAE,CAAC,GAAG,OAAO,CAAC,SAAS,EAAE,EAAE,IAAI,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A,CAAE,OAAO,CAAC,CAAC,WAAmB,KAAI;YAC5C,WAAW,CAAC,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC;YACxE,WAAW,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC;AAC3E,SAAC,CAAC;;AAGJ;;;AAGG;IACH,MAAM,GAAA;AACJ,QAAA,QACE,EAAC,IAAI,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACH,CAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,EACb,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,SAAS,EAAQ,CAAA,CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","createID","nextTick","isValideID","toString","isValidString","getWindows","focusableElements"],"sources":["src/components/atoms/mg-tooltip/mg-tooltip.conf.tsx","../styles/dist/components/mg-tooltip.css?tag=mg-tooltip&encapsulation=shadow","src/components/atoms/mg-tooltip/mg-tooltip.tsx"],"sourcesContent":["export type GuardType = 'focus' | 'hoverTooltip' | 'hoverTooltiped' | 'disableOnClick';\n\nexport const Guard: Record<string, GuardType> = {\n FOCUS: 'focus',\n HOVER_TOOLTIP_ELEMENT: 'hoverTooltip',\n HOVER_TOOLTIPED_ELEMENT: 'hoverTooltiped',\n DISABLE_ON_CLICK: 'disableOnClick',\n};\n","/*!\n * @prop --mg-c-tooltip-border-radius: Defines the border radius of the tooltip. Default value: `--mg-b-size-radius`.\n * @prop --mg-c-tooltip-color-background: Defines the background color of the tooltip. Default value: `--mg-b-color-dark`.\n * @prop --mg-c-tooltip-color-text: Defines the font color of the tooltip. Default value: `--mg-b-color-light`.\n */:host{display:inline-block}/*# sourceMappingURL=mg-tooltip.css.map */\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core';\nimport { createID, focusableElements, getWindows, isValideID, isValidString, nextTick, toString } from '@mgdis/stencil-helpers';\nimport { Instance as PopperInstance, createPopper, Placement, PositioningStrategy } from '@popperjs/core';\nimport { type GuardType, Guard } from './mg-tooltip.conf';\n\n/**\n * HTMLMgButtonElement type guard\n * @param element - element to check\n * @returns return true if type is HTMLMgButtonElement\n */\nconst isButton = (element: unknown): element is HTMLMgButtonElement => typeof element === 'object' && ['MG-BUTTON', 'BUTTON'].includes((element as Element).tagName);\n\n/**\n * @slot - Element that will display the tooltip\n */\n@Component({\n tag: 'mg-tooltip',\n styleUrl: '../../../../node_modules/@mgdis/styles/dist/components/mg-tooltip.css',\n shadow: true,\n})\nexport class MgTooltip {\n /************\n * Internal *\n ************/\n\n private popper: PopperInstance;\n private mgTooltipContent: HTMLMgTooltipContentElement;\n private tooltipedElement: HTMLElement;\n private windows: Window[];\n private hasCustomTabIndex: boolean;\n\n // tooltip actions guards\n private guard: GuardType;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgTooltipElement;\n\n /**\n * Sets an `id` attribute.\n * Needed by the input for accessibility `aria-decribedby`.\n */\n @Prop() identifier: string = createID('mg-tooltip');\n @Watch('identifier')\n watchIdentifier(newValue: MgTooltip['identifier']): void {\n if (!isValideID(newValue)) {\n throw new Error(`<mg-tooltip> prop \"identifier\" value is invalid. Passed value: ${toString(newValue)}.`);\n }\n // use renderTooltipContent to update tooltip-content id\n this.renderTooltipContent();\n }\n\n /**\n * Displayed message in the tooltip\n */\n @Prop() message!: string;\n @Watch('message')\n watchMessage(newValue: MgTooltip['message']): void {\n if (!isValidString(newValue)) {\n throw new Error(`<mg-tooltip> prop \"message\" is required and must be a string. Passed value: ${toString(newValue)}.`);\n }\n if (this.mgTooltipContent !== undefined) this.mgTooltipContent.message = newValue;\n }\n\n /**\n * Tooltip placement\n */\n @Prop() placement: Placement = 'bottom';\n\n /**\n * Display tooltip\n */\n @Prop({ mutable: true }) display = false;\n @Watch('display')\n watchDisplay(newValue: MgTooltip['display']): void {\n if (newValue) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Disable tooltip\n */\n @Prop() disabled = false;\n @Watch('disabled')\n watchDisabled(newValue: MgTooltip['disabled']): void {\n if (this.hasCustomTabIndex) {\n if (newValue) this.tooltipedElement.removeAttribute('tabindex');\n else if (!this.tooltipedElement.hasAttribute('tabindex')) this.tooltipedElement.setAttribute('tabindex', '0');\n }\n }\n\n /**\n * Show tooltip\n */\n private show = (): void => {\n // Make the tooltip visible\n this.mgTooltipContent.dataset.show = '';\n // Enable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }],\n }));\n // hide when click outside on nextTick to prevent event to trigger after creation\n nextTick(() => {\n this.windows.forEach((localWindow: Window) => {\n localWindow.addEventListener('click', this.handleClickOutside, false);\n localWindow.addEventListener('keydown', this.handlePressEscape, false);\n });\n });\n };\n\n /**\n * Hide tooltip\n */\n private hide = (): void => {\n // Hide the tooltip\n this.mgTooltipContent.removeAttribute('data-show');\n // Disable the event listeners\n this.popper.setOptions(options => ({\n ...options,\n modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }],\n }));\n // Remove event listener\n this.windows.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.handleClickOutside, false);\n localWindow.removeEventListener('keyboard', this.handlePressEscape, false);\n });\n };\n\n /**\n * Check if clicked outside of component and hide tooltip\n * @param event - mouse event\n */\n private handleClickOutside = (event: MouseEvent & { target: HTMLElement }): void => {\n if (event.target.closest('mg-tooltip') !== this.element) this.setDisplay(false);\n };\n\n /**\n * Check if 'Escape' key is pressed of component and hide tooltip\n * @param event - keyboard event\n */\n private handlePressEscape = (event: KeyboardEvent): void => {\n if (event.code === 'Escape') {\n this.setDisplay(false);\n this.resetGuard();\n }\n };\n\n /**\n * Method to set display prop\n * @param newValue - display prop new value\n * @param condition - additionnal condition to apply display prop newValue\n */\n private setDisplay = (newValue: MgTooltip['display'], condition = true): void => {\n if (!this.disabled && condition) this.display = newValue;\n };\n\n /**\n * Action for tooltip element and tooltiped element mouse listener\n * @param elementGuard - tooltip element guard\n * @param eventName - event name\n * @param conditionalGuard - guard condition\n */\n private tooltipMouseListenerAction = (elementGuard: GuardType, eventName: 'mouseenter' | 'mouseleave', conditionalGuard: GuardType): void => {\n // active FOCUS guard cancel process\n if ([Guard.FOCUS, Guard.DISABLE_ON_CLICK].includes(this.guard)) {\n return;\n }\n\n // Update guard by element guard\n this.guard = elementGuard;\n\n if (eventName !== 'mouseenter') {\n // process action in the next event loop macro task\n setTimeout(() => {\n this.setDisplay(false, this.guard !== conditionalGuard);\n this.resetGuard();\n }, 100);\n } else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {\n this.setDisplay(true);\n }\n };\n\n /**\n * Method to reset guard value\n */\n private resetGuard = (): void => {\n this.guard = undefined;\n };\n\n /**\n * Update slot content when it is a mg-button\n * @param mgButton - slotted mg-button\n */\n private setMgButtonWrapper = (mgButton: HTMLMgButtonElement): void => {\n const buttonWrapperClass = 'mg-c-tooltip__mg-button-wrapper';\n const hasButtonWrapper = mgButton.parentElement.classList.contains(buttonWrapperClass);\n // For disabled mg-button, we need to wrap it in a new element\n // We bind handlers to this new element to keep listener features as workaround to disabled mg-button `pointer-events: none`\n // AND to prevent multiple nested wrappers from rendering when a new render is called with a disabled mg-button\n if (mgButton.disabled && !hasButtonWrapper) {\n // wrap mg-button in a div\n const div = document.createElement('div');\n div.classList.add(buttonWrapperClass);\n mgButton.parentNode.insertBefore(div, mgButton);\n div.appendChild(mgButton);\n\n // update tooltipElement\n this.setTooltipedElement(div);\n } else if (!mgButton.disabled && hasButtonWrapper) {\n this.element.firstElementChild.replaceWith(mgButton);\n\n // update tooltipElement\n this.setTooltipedElement(mgButton);\n }\n };\n\n /**\n * Set popper instance\n * @param strategy - popper strategy to apply on instance\n */\n private setPopper = (strategy: PositioningStrategy): void => {\n // Create popperjs tooltip\n this.popper = createPopper(this.tooltipedElement, this.mgTooltipContent, {\n placement: this.placement,\n strategy,\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 8],\n },\n },\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['auto'],\n },\n },\n ],\n });\n };\n\n /**\n * Define selected element to become tooltip selector and init listeners\n * @param element - tooltiped element\n */\n private setTooltipedElement = (element: HTMLElement): void => {\n this.tooltipedElement = element;\n\n // Manage tooltipedElement focus events\n this.tooltipedElement.addEventListener('focus', () => {\n this.guard = Guard.FOCUS;\n this.setDisplay(true);\n });\n\n // as `click` event is the composition of `mousedown` and `mouseup` event,\n // and `click` event trigger `focus` event after a success `mousedown` wich set the `guard` to `Guard.FOCUS`\n // we reset the guard on `mouseup` event to unlock tooltip\n this.tooltipedElement.addEventListener('mouseup', () => {\n this.resetGuard();\n });\n\n this.tooltipedElement.addEventListener('blur', () => {\n this.resetGuard();\n this.setDisplay(false);\n });\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n this.tooltipedElement.addEventListener('mouseenter', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIP_ELEMENT);\n });\n\n this.tooltipedElement.addEventListener('mouseleave', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIP_ELEMENT);\n });\n };\n\n /**\n * Set button mutation observer\n * @param mgButton - mg-button to observe\n */\n private setMgButtonMutationObserver = (mgButton: HTMLMgButtonElement): void => {\n new MutationObserver(mutationList => {\n // stop process when none of mutations attributed is disabled\n if (!mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) return;\n\n // set guard when one of mutations is for a disabled with disabled-on-click\n if (mutationList.some((mutation: MutationRecord & { target: HTMLMgButtonElement }) => mutation.target.disabled && mutation.target.disableOnClick)) {\n this.guard = Guard.DISABLE_ON_CLICK;\n }\n\n // when the disabled-on-click guard is running we stop process\n if (this.guard === Guard.DISABLE_ON_CLICK) return;\n\n // update button wrapper\n this.setMgButtonWrapper(mgButton);\n\n // Since Firefox doesn't trigger a \"blur\" event when the \"disabled\" attribute is added or removed from a button\n // we have to manually unlock the guard because the \"blur\" handler of the tooltipedElement won't do it.\n this.resetGuard();\n\n // update popper instance\n this.popper.update();\n }).observe(mgButton, { attributes: true });\n };\n\n /**\n * Set tooltiped element aria-describedby\n * @param element - element to update\n */\n private setAriaDescribedby = (element: HTMLElement): void => {\n // Set aria-describedby\n if (!element.hasAttribute('aria-describedby')) {\n this.tooltipedElement.setAttribute('aria-describedby', this.identifier);\n } else {\n // We ensure to have uniq ids\n element.setAttribute('aria-describedby', `${[...new Set([...element.getAttribute('aria-describedby').split(' '), this.identifier])].join(' ')}`);\n }\n };\n\n /**\n * Render tooltip content element and init listeners\n */\n private renderTooltipContent(): void {\n if (this.mgTooltipContent !== undefined) {\n this.mgTooltipContent.setAttribute('id', this.identifier);\n } else {\n this.mgTooltipContent = document.createElement('mg-tooltip-content');\n this.mgTooltipContent.setAttribute('slot', 'content');\n this.mgTooltipContent.setAttribute('id', this.identifier);\n\n const arrow = document.createElement('div');\n arrow.setAttribute('slot', 'arrow');\n arrow.dataset.popperArrow = '';\n this.mgTooltipContent.appendChild(arrow);\n\n // manage tooltipElement & tooltipedElement mouseenter/mouseleave events\n this.mgTooltipContent.addEventListener('mouseenter', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIPED_ELEMENT);\n });\n this.mgTooltipContent.addEventListener('mouseleave', () => {\n this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIPED_ELEMENT);\n });\n\n // append tooltip element to component\n this.element.appendChild(this.mgTooltipContent);\n }\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * set variables\n */\n componentWillLoad(): void {\n // Get windows to attach events\n this.windows = getWindows(window);\n\n // Get tooltip element\n this.renderTooltipContent();\n\n //validate properties\n this.watchDisabled(this.disabled);\n this.watchMessage(this.message);\n this.watchIdentifier(this.identifier);\n }\n\n /**\n * Get slotted element\n * Check if it already contain an interactive element, if not we need to add a tabIndex attribute\n * We need to attach the focused element to the tooltip (aria-describedby)\n */\n componentDidLoad(): void {\n // get slotted element wich is not the tooltip\n const slotElement: HTMLElement = this.element.querySelector(`*:not(#${this.identifier})`);\n\n // Get interactive element\n const interactiveElement: HTMLElement = slotElement.matches(focusableElements) ? slotElement : slotElement.shadowRoot?.querySelector(focusableElements);\n\n this.setTooltipedElement(interactiveElement || slotElement);\n\n // Check if slotted element is a disabled mg-button\n // In this case we wrap the mg-button into a div to enable the tooltip\n if (isButton(slotElement)) {\n this.setMgButtonMutationObserver(slotElement);\n this.setMgButtonWrapper(slotElement);\n }\n\n // Add tabindex to slotted element if we can't find any interactive element\n if (!this.disabled && [undefined, null].includes(interactiveElement)) {\n this.hasCustomTabIndex = true;\n slotElement.tabIndex = 0;\n // Add role on non-interactive element to work with \"aria-describedby\" for screen readers\n slotElement.setAttribute('role', 'button');\n }\n\n // apply a11y aria\n this.setAriaDescribedby(slotElement);\n\n // set Tooltip\n this.setPopper(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');\n\n // add document keyboard handler\n document.addEventListener('keydown', this.handlePressEscape);\n\n // check props\n this.watchDisplay(this.display);\n }\n\n /**\n * update popper position after props change on component did update hook to benefit from render ended\n */\n componentDidUpdate(): void {\n this.popper.update();\n }\n\n /**\n * remove listeners\n */\n disconnectedCallback(): void {\n document.removeEventListener('keydown', this.handlePressEscape);\n this.windows?.forEach((localWindow: Window) => {\n localWindow.removeEventListener('click', this.handleClickOutside, false);\n localWindow.removeEventListener('keydown', this.handlePressEscape, false);\n });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host>\n <slot></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"],"version":3}