@mgdis/mg-components 6.9.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 (215) hide show
  1. package/dist/cjs/events.utils-D5SAtkpQ.js +28 -0
  2. package/dist/cjs/events.utils-D5SAtkpQ.js.map +1 -0
  3. package/dist/cjs/index-CATFkm3O.js +4 -0
  4. package/dist/cjs/{index-CTU2m-sy.js → index-CL_COdxv.js} +20 -6
  5. package/dist/cjs/{index-CTU2m-sy.js.map → index-CL_COdxv.js.map} +1 -1
  6. package/dist/cjs/index.es-DaPqByCe.js +250 -0
  7. package/dist/cjs/index.es-DaPqByCe.js.map +1 -0
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/mg-action-more_37.cjs.entry.js +1929 -1913
  10. package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
  11. package/dist/cjs/mg-alert.cjs.entry.js +7 -7
  12. package/dist/cjs/mg-components.cjs.js +1 -1
  13. package/dist/cjs/mg-input-combobox.cjs.entry.js +774 -0
  14. package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -0
  15. package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -0
  16. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +16 -14
  17. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js.map +1 -1
  18. package/dist/cjs/mg-input-rich-text-editor.entry.cjs.js.map +1 -1
  19. package/dist/cjs/mg-loader.cjs.entry.js +5 -5
  20. package/dist/cjs/mg-progress.cjs.entry.js +11 -11
  21. package/dist/collection/collection-manifest.json +1 -0
  22. package/dist/collection/components/atoms/mg-button/mg-button.js +3 -2
  23. package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
  24. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -1
  25. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  26. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +38 -68
  27. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  28. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js +2 -0
  29. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js.map +1 -0
  30. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1443 -0
  31. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -0
  32. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
  33. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +2 -2
  34. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
  35. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
  36. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
  37. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +1 -0
  38. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +3 -3
  39. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js.map +1 -1
  40. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
  41. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -1
  42. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
  43. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
  44. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +2 -2
  45. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js.map +1 -1
  46. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +3 -3
  47. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js.map +1 -1
  48. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
  49. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
  50. package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
  51. package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
  52. package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
  53. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
  54. package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
  55. package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
  56. package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
  57. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
  58. package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
  59. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
  60. package/dist/collection/components/molecules/mg-popover/mg-popover.js +53 -129
  61. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  62. package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
  63. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
  64. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +6 -5
  65. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
  66. package/dist/collection/locales/en/messages.json +8 -1
  67. package/dist/collection/locales/fr/messages.json +8 -1
  68. package/dist/collection/utils/behaviors.utils.js +3 -3
  69. package/dist/collection/utils/behaviors.utils.js.map +1 -1
  70. package/dist/collection/utils/events.utils.js +22 -0
  71. package/dist/collection/utils/events.utils.js.map +1 -0
  72. package/dist/components/events.utils.js +26 -0
  73. package/dist/components/events.utils.js.map +1 -0
  74. package/dist/components/index.es.js +129 -36
  75. package/dist/components/index.es.js.map +1 -1
  76. package/dist/components/index2.js +18 -4
  77. package/dist/components/index2.js.map +1 -1
  78. package/dist/components/mg-action-more.js +8 -8
  79. package/dist/components/mg-action-more.js.map +1 -1
  80. package/dist/components/mg-alert.js +6 -6
  81. package/dist/components/mg-badge2.js +6 -6
  82. package/dist/components/mg-button2.js +9 -8
  83. package/dist/components/mg-button2.js.map +1 -1
  84. package/dist/components/mg-character-left2.js +4 -4
  85. package/dist/components/mg-details.js +4 -4
  86. package/dist/components/mg-details.js.map +1 -1
  87. package/dist/components/mg-form.js +8 -8
  88. package/dist/components/mg-icon2.js +6 -6
  89. package/dist/components/mg-illustrated-message.js +6 -6
  90. package/dist/components/mg-input-checkbox.js +9 -9
  91. package/dist/components/mg-input-combobox.d.ts +11 -0
  92. package/dist/components/mg-input-combobox.js +897 -0
  93. package/dist/components/mg-input-combobox.js.map +1 -0
  94. package/dist/components/mg-input-date.js +18 -18
  95. package/dist/components/mg-input-date.js.map +1 -1
  96. package/dist/components/mg-input-numeric.js +16 -16
  97. package/dist/components/mg-input-numeric.js.map +1 -1
  98. package/dist/components/mg-input-password.js +5 -5
  99. package/dist/components/mg-input-password.js.map +1 -1
  100. package/dist/components/mg-input-radio.js +8 -8
  101. package/dist/components/mg-input-rich-text-editor.js +15 -13
  102. package/dist/components/mg-input-rich-text-editor.js.map +1 -1
  103. package/dist/components/mg-input-select2.js +9 -9
  104. package/dist/components/mg-input-select2.js.map +1 -1
  105. package/dist/components/mg-input-text2.js +11 -11
  106. package/dist/components/mg-input-text2.js.map +1 -1
  107. package/dist/components/mg-input-textarea.js +9 -9
  108. package/dist/components/mg-input-textarea.js.map +1 -1
  109. package/dist/components/mg-input-title2.js +4 -4
  110. package/dist/components/mg-input-toggle.js +7 -7
  111. package/dist/components/mg-input2.js +8 -8
  112. package/dist/components/mg-item-more2.js +12 -12
  113. package/dist/components/mg-item-more2.js.map +1 -1
  114. package/dist/components/mg-loader.js +1 -70
  115. package/dist/components/mg-loader.js.map +1 -1
  116. package/dist/components/mg-loader2.js +75 -0
  117. package/dist/components/mg-loader2.js.map +1 -0
  118. package/dist/components/mg-menu-item2.js +13 -13
  119. package/dist/components/mg-menu-item2.js.map +1 -1
  120. package/dist/components/mg-message2.js +6 -6
  121. package/dist/components/mg-modal.js +10 -10
  122. package/dist/components/mg-pagination2.js +9 -9
  123. package/dist/components/mg-panel.js +10 -10
  124. package/dist/components/mg-popover-content2.js +5 -5
  125. package/dist/components/mg-popover-content2.js.map +1 -1
  126. package/dist/components/mg-popover2.js +54 -128
  127. package/dist/components/mg-popover2.js.map +1 -1
  128. package/dist/components/mg-progress.js +11 -11
  129. package/dist/components/mg-skip-links.js +3 -3
  130. package/dist/components/mg-table.js +6 -6
  131. package/dist/components/mg-tabs.js +18 -17
  132. package/dist/components/mg-tabs.js.map +1 -1
  133. package/dist/components/mg-tag.js +4 -4
  134. package/dist/components/mg-tooltip-content2.js +1 -1
  135. package/dist/components/mg-tooltip-content2.js.map +1 -1
  136. package/dist/components/mg-tooltip2.js +42 -71
  137. package/dist/components/mg-tooltip2.js.map +1 -1
  138. package/dist/components/popper.js +1793 -0
  139. package/dist/components/popper.js.map +1 -0
  140. package/dist/esm/events.utils-yMGqY8YG.js +26 -0
  141. package/dist/esm/events.utils-yMGqY8YG.js.map +1 -0
  142. package/dist/esm/index-CAuxALt5.js +4 -0
  143. package/dist/esm/{index-SQlkEaXW.js → index-DALWFL9i.js} +20 -6
  144. package/dist/esm/{index-SQlkEaXW.js.map → index-DALWFL9i.js.map} +1 -1
  145. package/dist/esm/index.es-hNwGkhG6.js +223 -0
  146. package/dist/esm/index.es-hNwGkhG6.js.map +1 -0
  147. package/dist/esm/loader.js +1 -1
  148. package/dist/esm/mg-action-more_37.entry.js +1930 -1914
  149. package/dist/esm/mg-action-more_37.entry.js.map +1 -1
  150. package/dist/esm/mg-alert.entry.js +7 -7
  151. package/dist/esm/mg-components.js +1 -1
  152. package/dist/esm/mg-input-combobox.entry.js +772 -0
  153. package/dist/esm/mg-input-combobox.entry.js.map +1 -0
  154. package/dist/esm/mg-input-rich-text-editor.entry.js +17 -15
  155. package/dist/esm/mg-input-rich-text-editor.entry.js.map +1 -1
  156. package/dist/esm/{mg-input.conf-BtkqaBXm.js → mg-input.conf-CNgv8hc5.js} +3 -3
  157. package/dist/esm/{mg-input.conf-BtkqaBXm.js.map → mg-input.conf-CNgv8hc5.js.map} +1 -1
  158. package/dist/esm/mg-loader.entry.js +5 -5
  159. package/dist/esm/mg-progress.entry.js +11 -11
  160. package/dist/mg-components/locales/en/messages.json +8 -1
  161. package/dist/mg-components/locales/fr/messages.json +8 -1
  162. package/dist/mg-components/mg-components.esm.js +1 -1
  163. package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -0
  164. package/dist/mg-components/mg-input-rich-text-editor.entry.esm.js.map +1 -1
  165. package/dist/mg-components/p-352cfc01.entry.js +2 -0
  166. package/dist/mg-components/{p-680948e3.entry.js.map → p-352cfc01.entry.js.map} +1 -1
  167. package/dist/mg-components/p-68f7de47.entry.js +2 -0
  168. package/dist/mg-components/p-68f7de47.entry.js.map +1 -0
  169. package/dist/mg-components/p-CNgv8hc5.js +2 -0
  170. package/dist/mg-components/{p-BtkqaBXm.js.map → p-CNgv8hc5.js.map} +1 -1
  171. package/dist/mg-components/p-Cg3R_y_o.js +2 -0
  172. package/dist/mg-components/{p-CqGbLOnN.js.map → p-Cg3R_y_o.js.map} +1 -1
  173. package/dist/mg-components/p-a52a168c.entry.js +2 -0
  174. package/dist/mg-components/{p-9acc6504.entry.js.map → p-a52a168c.entry.js.map} +1 -1
  175. package/dist/mg-components/{p-583b3769.entry.js → p-bf5de898.entry.js} +2 -2
  176. package/dist/mg-components/p-dcefa0b0.entry.js +2 -0
  177. package/dist/mg-components/p-dcefa0b0.entry.js.map +1 -0
  178. package/dist/mg-components/{p-650d6986.entry.js → p-e33557f9.entry.js} +3 -3
  179. package/dist/mg-components/p-e33557f9.entry.js.map +1 -0
  180. package/dist/mg-components/p-hNwGkhG6.js +2 -0
  181. package/dist/mg-components/p-hNwGkhG6.js.map +1 -0
  182. package/dist/mg-components/p-yMGqY8YG.js +2 -0
  183. package/dist/mg-components/p-yMGqY8YG.js.map +1 -0
  184. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -6
  185. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -7
  186. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +24 -0
  187. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +340 -0
  188. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +9 -27
  189. package/dist/types/components.d.ts +253 -10
  190. package/dist/types/utils/events.utils.d.ts +4 -0
  191. package/ide/intellij/web-types.json +400 -1
  192. package/ide/vscode/html-custom-data.json +332 -0
  193. package/package.json +15 -15
  194. package/dist/cjs/index.es-jXqiN1uw.js +0 -152
  195. package/dist/cjs/index.es-jXqiN1uw.js.map +0 -1
  196. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -2
  197. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +0 -1
  198. package/dist/collection/utils/floating-ui.utils.js +0 -30
  199. package/dist/collection/utils/floating-ui.utils.js.map +0 -1
  200. package/dist/components/floating-ui.utils.js +0 -1677
  201. package/dist/components/floating-ui.utils.js.map +0 -1
  202. package/dist/esm/index.es-DDBtzymI.js +0 -130
  203. package/dist/esm/index.es-DDBtzymI.js.map +0 -1
  204. package/dist/mg-components/p-650d6986.entry.js.map +0 -1
  205. package/dist/mg-components/p-680948e3.entry.js +0 -2
  206. package/dist/mg-components/p-9acc6504.entry.js +0 -2
  207. package/dist/mg-components/p-BtkqaBXm.js +0 -2
  208. package/dist/mg-components/p-CqGbLOnN.js +0 -2
  209. package/dist/mg-components/p-DDBtzymI.js +0 -2
  210. package/dist/mg-components/p-DDBtzymI.js.map +0 -1
  211. package/dist/mg-components/p-c0fb6f62.entry.js +0 -2
  212. package/dist/mg-components/p-c0fb6f62.entry.js.map +0 -1
  213. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -6
  214. package/dist/types/utils/floating-ui.utils.d.ts +0 -20
  215. /package/dist/mg-components/{p-583b3769.entry.js.map → p-bf5de898.entry.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { x as xt, M as Mt, O as Ot, z as zt, L as Le, R as Rt, j as jt } from './index.es.js';
3
- import { b as autoUpdate, c as computePosition, o as offset, f as flip, d as shift, e as arrow, i as isFloatingUIPlacement, 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 = xt('mg-tooltip');
30
+ this.identifier = Zt('mg-tooltip');
31
31
  /**
32
32
  * Tooltip placement
33
33
  */
@@ -46,8 +46,10 @@ 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
- Mt(() => {
52
+ Qt(() => {
51
53
  this.windows.forEach((localWindow) => {
52
54
  localWindow.addEventListener('click', this.handleClickOutside, false);
53
55
  localWindow.addEventListener('keydown', this.handlePressEscape, false);
@@ -60,6 +62,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
60
62
  this.hide = () => {
61
63
  // Hide the tooltip
62
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 }] })));
63
67
  // Remove event listener
64
68
  this.windows.forEach((localWindow) => {
65
69
  localWindow.removeEventListener('click', this.handleClickOutside, false);
@@ -149,50 +153,28 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
149
153
  }
150
154
  };
151
155
  /**
152
- * Set Floating UI instance
153
- * @param strategy - Floating UI strategy to apply on instance
156
+ * Set popper instance
157
+ * @param strategy - popper strategy to apply on instance
154
158
  */
155
- this.setFloatingUI = (strategy) => {
156
- // Initial styles configuration
157
- Object.assign(this.mgTooltipContent.style, {
158
- position: strategy,
159
- top: '0',
160
- left: '0',
161
- transform: 'translate(0, 0)',
162
- });
163
- // Create Floating UI instance with autoUpdate
164
- this.floatingUICleanup = autoUpdate(this.tooltipedElement, this.mgTooltipContent, () => {
165
- computePosition(this.tooltipedElement, this.mgTooltipContent, {
166
- placement: this.placement,
167
- strategy,
168
- middleware: [offset(8), flip(), shift({ limiter: limitShift() }), arrow({ element: this.mgTooltipContent.querySelector('[data-floating-arrow]') })],
169
- }).then(({ x, y, placement, middlewareData }) => {
170
- Object.assign(this.mgTooltipContent.style, {
171
- transform: !isNaN(x) && !isNaN(y) ? `translate(${x}px, ${y}px)` : undefined,
172
- });
173
- // Update arrow style
174
- const { x: arrowX, y: arrowY } = middlewareData.arrow;
175
- const staticSide = {
176
- top: 'bottom',
177
- right: 'left',
178
- bottom: 'top',
179
- left: 'right',
180
- }[placement.split('-')[0]];
181
- const arrowElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');
182
- // https://floating-ui.com/docs/arrow
183
- // Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.
184
- // Due to this, either x or y will be undefined, depending on the side of placement.
185
- // The above code uses `isNaN` to check for null and undefined simultaneously.
186
- // Don’t remove `isNaN`, because either value can be falsy (0), causing a bug!
187
- const numberToPx = (number) => (!isNaN(number) ? `${number}px` : '');
188
- Object.assign(arrowElement.style, {
189
- left: numberToPx(arrowX),
190
- top: numberToPx(arrowY),
191
- [staticSide]: '-4px',
192
- position: 'absolute',
193
- });
194
- this.mgTooltipContent.setAttribute('data-placement', placement);
195
- });
159
+ this.setPopper = (strategy) => {
160
+ // Create popperjs tooltip
161
+ this.popper = createPopper(this.tooltipedElement, this.mgTooltipContent, {
162
+ placement: this.placement,
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
+ },
177
+ ],
196
178
  });
197
179
  };
198
180
  /**
@@ -245,9 +227,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
245
227
  // Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
246
228
  // we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
247
229
  this.resetGuard();
248
- // update Floating UI instance
249
- this.floatingUICleanup();
250
- this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
230
+ // update popper instance
231
+ this.popper.update();
251
232
  }).observe(mgButton, { attributes: true });
252
233
  };
253
234
  /**
@@ -266,23 +247,19 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
266
247
  };
267
248
  }
268
249
  watchIdentifier(newValue) {
269
- if (!Ot(newValue)) {
270
- throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${zt(newValue)}.`);
250
+ if (!Dt(newValue)) {
251
+ throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${Xt(newValue)}.`);
271
252
  }
272
253
  // use renderTooltipContent to update tooltip-content id
273
254
  this.renderTooltipContent();
274
255
  }
275
256
  watchMessage(newValue) {
276
- if (!Le(newValue)) {
277
- throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${zt(newValue)}.`);
257
+ if (!qe(newValue)) {
258
+ throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${Xt(newValue)}.`);
278
259
  }
279
260
  if (this.mgTooltipContent !== undefined)
280
261
  this.mgTooltipContent.message = newValue;
281
262
  }
282
- watchPlacement(newValue) {
283
- if (!isFloatingUIPlacement(newValue))
284
- this.placement = 'bottom';
285
- }
286
263
  watchDisplay(newValue) {
287
264
  if (newValue) {
288
265
  this.show();
@@ -312,7 +289,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
312
289
  this.mgTooltipContent.setAttribute('id', this.identifier);
313
290
  const arrow = document.createElement('div');
314
291
  arrow.setAttribute('slot', 'arrow');
315
- arrow.dataset.floatingArrow = '';
292
+ arrow.dataset.popperArrow = '';
316
293
  this.mgTooltipContent.appendChild(arrow);
317
294
  // manage tooltipElement & tooltipedElement mouseenter/mouseleave events
318
295
  this.mgTooltipContent.addEventListener('mouseenter', () => {
@@ -333,11 +310,10 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
333
310
  */
334
311
  componentWillLoad() {
335
312
  // Get windows to attach events
336
- this.windows = Rt(window);
313
+ this.windows = Jt(window);
337
314
  // Get tooltip element
338
315
  this.renderTooltipContent();
339
316
  //validate properties
340
- this.watchPlacement(this.placement);
341
317
  this.watchDisabled(this.disabled);
342
318
  this.watchMessage(this.message);
343
319
  this.watchIdentifier(this.identifier);
@@ -352,7 +328,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
352
328
  // get slotted element wich is not the tooltip
353
329
  const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
354
330
  // Get interactive element
355
- const interactiveElement = slotElement.matches(jt) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(jt);
331
+ const interactiveElement = slotElement.matches(Gt) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(Gt);
356
332
  this.setTooltipedElement(interactiveElement || slotElement);
357
333
  // Check if slotted element is a disabled mg-button
358
334
  // In this case we wrap the mg-button into a div to enable the tooltip
@@ -370,7 +346,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
370
346
  // apply a11y aria
371
347
  this.setAriaDescribedby(slotElement);
372
348
  // set Tooltip
373
- this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
349
+ this.setPopper(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
374
350
  // add document keyboard handler
375
351
  document.addEventListener('keydown', this.handlePressEscape);
376
352
  // check props
@@ -380,8 +356,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
380
356
  * update popper position after props change on component did update hook to benefit from render ended
381
357
  */
382
358
  componentDidUpdate() {
383
- this.floatingUICleanup();
384
- this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
359
+ this.popper.update();
385
360
  }
386
361
  /**
387
362
  * remove listeners
@@ -393,21 +368,18 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
393
368
  localWindow.removeEventListener('click', this.handleClickOutside, false);
394
369
  localWindow.removeEventListener('keydown', this.handlePressEscape, false);
395
370
  });
396
- // cleanup Floating UI
397
- this.floatingUICleanup();
398
371
  }
399
372
  /**
400
373
  * Render
401
374
  * @returns HTML Element
402
375
  */
403
376
  render() {
404
- return (h(Host, { key: '31d97272cfd3448abf9ed9cda62fdec0a356d422' }, h("slot", { key: '8fbf8343471f53591caacc3ff4c4b8aaf4577c4f' }), h("slot", { key: '6f4eab4c33e9ec07e0fe7ffa63de4921f4b27e0c', name: "content" })));
377
+ return (h(Host, { key: '9aae13f15c5c93d3a2e887a75e1ad54fd823f79e' }, h("slot", { key: 'd7a42dac1c0e43c1fddc08f80ba36ce5db65af0a' }), h("slot", { key: 'a89fc2e61a82de8d41d1231f5ba0136cd801f1f3', name: "content" })));
405
378
  }
406
379
  get element() { return this; }
407
380
  static get watchers() { return {
408
381
  "identifier": ["watchIdentifier"],
409
382
  "message": ["watchMessage"],
410
- "placement": ["watchPlacement"],
411
383
  "display": ["watchDisplay"],
412
384
  "disabled": ["watchDisabled"]
413
385
  }; }
@@ -415,13 +387,12 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class MgTooltip extends HTMLE
415
387
  }, [1, "mg-tooltip", {
416
388
  "identifier": [1],
417
389
  "message": [1],
418
- "placement": [1025],
390
+ "placement": [1],
419
391
  "display": [1028],
420
392
  "disabled": [4]
421
393
  }, undefined, {
422
394
  "identifier": ["watchIdentifier"],
423
395
  "message": ["watchMessage"],
424
- "placement": ["watchPlacement"],
425
396
  "display": ["watchDisplay"],
426
397
  "disabled": ["watchDisabled"]
427
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;;;;AA4BE;;;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,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,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;;AAGjC;;AAEG;IACH,kBAAkB,GAAA;QAChB,IAAI,CAAC,iBAAiB,EAAE;QACxB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,IAAI,GAAG,UAAU,GAAG,OAAO,CAAC;;AAGxF;;AAEG;IACH,oBAAoB,GAAA;;QAClB,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC;AAC/D,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,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;;QAEF,IAAI,CAAC,iBAAiB,EAAE;;AAG1B;;;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":["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 } 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 floatingUICleanup: ReturnType<typeof autoUpdate>;\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({ mutable: true }) placement: TooltipPlacementType = 'bottom';\n @Watch('placement')\n watchPlacement(newValue): 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 };\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 };\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 Floating UI instance\n * @param strategy - Floating UI strategy to apply on instance\n */\n private setFloatingUI = (strategy: Strategy): void => {\n // Initial styles configuration\n Object.assign(this.mgTooltipContent.style, {\n position: strategy,\n top: '0',\n left: '0',\n transform: 'translate(0, 0)',\n });\n\n // Create Floating UI instance with autoUpdate\n this.floatingUICleanup = autoUpdate(this.tooltipedElement, this.mgTooltipContent, () => {\n computePosition(this.tooltipedElement, this.mgTooltipContent, {\n placement: this.placement as Placement,\n strategy,\n middleware: [offset(8), flip(), shift({ limiter: limitShift() }), arrow({ element: this.mgTooltipContent.querySelector('[data-floating-arrow]') })],\n }).then(({ x, y, placement, middlewareData }) => {\n Object.assign(this.mgTooltipContent.style, {\n transform: !isNaN(x) && !isNaN(y) ? `translate(${x}px, ${y}px)` : undefined,\n });\n\n // Update arrow style\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n const staticSide = {\n top: 'bottom',\n right: 'left',\n bottom: 'top',\n left: 'right',\n }[placement.split('-')[0]];\n\n const arrowElement: HTMLElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');\n // https://floating-ui.com/docs/arrow\n // Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.\n // Due to this, either x or y will be undefined, depending on the side of placement.\n // The above code uses `isNaN` to check for null and undefined simultaneously.\n // Don’t remove `isNaN`, because either value can be falsy (0), causing a bug!\n const numberToPx = (number: number): string => (!isNaN(number) ? `${number}px` : '');\n\n Object.assign(arrowElement.style, {\n left: numberToPx(arrowX),\n top: numberToPx(arrowY),\n [staticSide]: '-4px',\n position: 'absolute',\n });\n\n this.mgTooltipContent.setAttribute('data-placement', placement);\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 Floating UI instance\n this.floatingUICleanup();\n this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');\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\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.setFloatingUI(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.floatingUICleanup();\n this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');\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 // cleanup Floating UI\n this.floatingUICleanup();\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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AAC,iBAAiB,CAAC;AAC/D,QAAA,CAAA,EAAA,GAAA,IAAI,CAAC,OAAO,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,MAAA,GAAA,EAAA,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}