@mgdis/mg-components 6.4.0 → 6.5.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 (132) hide show
  1. package/dist/cjs/{index-911898e4.js → index-1a5a1081.js} +266 -241
  2. package/dist/cjs/index-1a5a1081.js.map +1 -0
  3. package/dist/cjs/{index-a3269bfc.js → index-ede3b3dc.js} +3 -3
  4. package/dist/cjs/{index-a3269bfc.js.map → index-ede3b3dc.js.map} +1 -1
  5. package/dist/cjs/{index.es-325100d7.js → index.es-a112f649.js} +36 -36
  6. package/dist/cjs/index.es-a112f649.js.map +1 -0
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/mg-action-more_36.cjs.entry.js +2260 -1872
  9. package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
  10. package/dist/cjs/mg-alert.cjs.entry.js +7 -7
  11. package/dist/cjs/mg-components.cjs.js +3 -3
  12. package/dist/cjs/mg-components.cjs.js.map +1 -1
  13. package/dist/cjs/mg-loader.cjs.entry.js +5 -5
  14. package/dist/cjs/mg-progress.cjs.entry.js +11 -11
  15. package/dist/collection/collection-manifest.json +1 -1
  16. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +1 -0
  17. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
  18. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +68 -38
  19. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
  20. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +14 -6
  21. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
  22. package/dist/collection/components/molecules/mg-details/mg-details.js +6 -1
  23. package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
  24. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +2 -0
  25. package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +1 -0
  26. package/dist/collection/components/molecules/mg-popover/mg-popover.js +90 -46
  27. package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
  28. package/dist/collection/utils/floating-ui.utils.js +33 -0
  29. package/dist/collection/utils/floating-ui.utils.js.map +1 -0
  30. package/dist/components/floating-ui.utils.js +2099 -0
  31. package/dist/components/floating-ui.utils.js.map +1 -0
  32. package/dist/components/index.es.js +29 -29
  33. package/dist/components/index.es.js.map +1 -1
  34. package/dist/components/index2.js +2 -2
  35. package/dist/components/mg-action-more.js +6 -6
  36. package/dist/components/mg-alert.js +5 -5
  37. package/dist/components/mg-badge2.js +6 -6
  38. package/dist/components/mg-button2.js +6 -6
  39. package/dist/components/mg-card2.js +1 -1
  40. package/dist/components/mg-card2.js.map +1 -1
  41. package/dist/components/mg-character-left2.js +4 -4
  42. package/dist/components/mg-details.js +8 -3
  43. package/dist/components/mg-details.js.map +1 -1
  44. package/dist/components/mg-form.js +7 -7
  45. package/dist/components/mg-icon2.js +6 -6
  46. package/dist/components/mg-illustrated-message.js +2 -2
  47. package/dist/components/mg-input-checkbox.js +9 -9
  48. package/dist/components/mg-input-date.js +13 -13
  49. package/dist/components/mg-input-numeric.js +12 -12
  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-select2.js +7 -7
  53. package/dist/components/mg-input-text2.js +9 -9
  54. package/dist/components/mg-input-textarea.js +7 -7
  55. package/dist/components/mg-input-title2.js +4 -4
  56. package/dist/components/mg-input-toggle.js +6 -6
  57. package/dist/components/mg-input2.js +8 -8
  58. package/dist/components/mg-item-more2.js +8 -8
  59. package/dist/components/mg-item-more2.js.map +1 -1
  60. package/dist/components/mg-loader.js +3 -3
  61. package/dist/components/mg-menu-item2.js +24 -16
  62. package/dist/components/mg-menu-item2.js.map +1 -1
  63. package/dist/components/mg-message2.js +5 -5
  64. package/dist/components/mg-message2.js.map +1 -1
  65. package/dist/components/mg-modal.js +9 -9
  66. package/dist/components/mg-modal.js.map +1 -1
  67. package/dist/components/mg-pagination2.js +6 -6
  68. package/dist/components/mg-panel.js +10 -10
  69. package/dist/components/mg-panel.js.map +1 -1
  70. package/dist/components/mg-popover-content2.js +4 -4
  71. package/dist/components/mg-popover-content2.js.map +1 -1
  72. package/dist/components/mg-popover2.js +89 -47
  73. package/dist/components/mg-popover2.js.map +1 -1
  74. package/dist/components/mg-progress.js +10 -10
  75. package/dist/components/mg-skip-links.js +2 -2
  76. package/dist/components/mg-tabs.js +12 -12
  77. package/dist/components/mg-tag.js +4 -4
  78. package/dist/components/mg-tooltip-content2.js +1 -1
  79. package/dist/components/mg-tooltip-content2.js.map +1 -1
  80. package/dist/components/mg-tooltip2.js +71 -42
  81. package/dist/components/mg-tooltip2.js.map +1 -1
  82. package/dist/esm/{index-1f32332a.js → index-5059254f.js} +266 -241
  83. package/dist/esm/index-5059254f.js.map +1 -0
  84. package/dist/esm/{index-9bd10f5d.js → index-a7c3b5c5.js} +3 -3
  85. package/dist/esm/{index-9bd10f5d.js.map → index-a7c3b5c5.js.map} +1 -1
  86. package/dist/esm/{index.es-a2587b72.js → index.es-5e0101ac.js} +30 -30
  87. package/dist/esm/index.es-5e0101ac.js.map +1 -0
  88. package/dist/esm/loader.js +3 -3
  89. package/dist/esm/mg-action-more_36.entry.js +2260 -1872
  90. package/dist/esm/mg-action-more_36.entry.js.map +1 -1
  91. package/dist/esm/mg-alert.entry.js +7 -7
  92. package/dist/esm/mg-components.js +4 -4
  93. package/dist/esm/mg-components.js.map +1 -1
  94. package/dist/esm/mg-loader.entry.js +5 -5
  95. package/dist/esm/mg-progress.entry.js +11 -11
  96. package/dist/mg-components/mg-components.esm.js +1 -1
  97. package/dist/mg-components/mg-components.esm.js.map +1 -1
  98. package/dist/mg-components/{p-0ead5317.entry.js → p-1a162791.entry.js} +2 -2
  99. package/dist/mg-components/{p-f48d964f.entry.js → p-2403e01d.entry.js} +2 -2
  100. package/dist/mg-components/p-6c831a83.entry.js +2 -0
  101. package/dist/mg-components/p-6c831a83.entry.js.map +1 -0
  102. package/dist/mg-components/{p-3b052ac0.entry.js → p-ad64ab4a.entry.js} +2 -2
  103. package/dist/mg-components/{p-b986c107.js → p-b6c1a6ce.js} +2 -2
  104. package/dist/mg-components/p-b6c1a6ce.js.map +1 -0
  105. package/dist/mg-components/{p-dc436f3c.js → p-d9731ebc.js} +2 -2
  106. package/dist/mg-components/p-e39791fa.js +3 -0
  107. package/dist/mg-components/p-e39791fa.js.map +1 -0
  108. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +6 -0
  109. package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +7 -6
  110. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +10 -4
  111. package/dist/types/components/molecules/mg-details/mg-details.d.ts +4 -0
  112. package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +6 -0
  113. package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +13 -8
  114. package/dist/types/components.d.ts +8 -6
  115. package/dist/types/utils/floating-ui.utils.d.ts +19 -0
  116. package/ide/intellij/web-types.json +1 -1
  117. package/package.json +21 -21
  118. package/dist/cjs/index-911898e4.js.map +0 -1
  119. package/dist/cjs/index.es-325100d7.js.map +0 -1
  120. package/dist/components/popper.js +0 -1794
  121. package/dist/components/popper.js.map +0 -1
  122. package/dist/esm/index-1f32332a.js.map +0 -1
  123. package/dist/esm/index.es-a2587b72.js.map +0 -1
  124. package/dist/mg-components/p-35898742.js +0 -3
  125. package/dist/mg-components/p-35898742.js.map +0 -1
  126. package/dist/mg-components/p-6810a565.entry.js +0 -2
  127. package/dist/mg-components/p-6810a565.entry.js.map +0 -1
  128. package/dist/mg-components/p-b986c107.js.map +0 -1
  129. /package/dist/mg-components/{p-0ead5317.entry.js.map → p-1a162791.entry.js.map} +0 -0
  130. /package/dist/mg-components/{p-f48d964f.entry.js.map → p-2403e01d.entry.js.map} +0 -0
  131. /package/dist/mg-components/{p-3b052ac0.entry.js.map → p-ad64ab4a.entry.js.map} +0 -0
  132. /package/dist/mg-components/{p-dc436f3c.js.map → p-d9731ebc.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
2
- import { G as Ge, J as Je, X as Xe, y as ye } from './index.es.js';
2
+ import { K as Ke, V as Ve, Q as Qe, m as me } from './index.es.js';
3
3
  import { d as defineCustomElement$5, b as classReadonly, e as classDisabled } from './mg-input2.js';
4
4
  import { d as defineCustomElement$6 } from './mg-icon2.js';
5
5
  import { d as defineCustomElement$4 } from './mg-input-title2.js';
@@ -61,7 +61,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
61
61
  /**
62
62
  * Component classes
63
63
  */
64
- this.classCollection = new Ge(['mg-c-input--toggle']);
64
+ this.classCollection = new Ke(['mg-c-input--toggle']);
65
65
  /**
66
66
  * Checked internal value
67
67
  */
@@ -122,10 +122,10 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
122
122
  }
123
123
  validateItems(newValue) {
124
124
  if (typeof newValue === 'object' && this.items.length !== 2) {
125
- throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${Je(newValue)}.`);
125
+ throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${Ve(newValue)}.`);
126
126
  }
127
127
  // String array
128
- else if (Xe(newValue)) {
128
+ else if (Qe(newValue)) {
129
129
  this.options = newValue.map(item => ({ title: item, value: item }));
130
130
  }
131
131
  // Object array
@@ -133,7 +133,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
133
133
  this.options = newValue;
134
134
  }
135
135
  else {
136
- throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${Je(newValue)}.`);
136
+ throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${Ve(newValue)}.`);
137
137
  }
138
138
  }
139
139
  watchIsOnOff(newValue) {
@@ -181,7 +181,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
181
181
  if (typeof valid !== 'boolean') {
182
182
  throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
183
183
  }
184
- else if (!ye(errorMessage)) {
184
+ else if (!me(errorMessage)) {
185
185
  throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
186
186
  }
187
187
  else {
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { y as ye, J as Je, I as Ie } from './index.es.js';
2
+ import { m as me, V as Ve, X as Xe } from './index.es.js';
3
3
  import { d as defineCustomElement$4 } from './mg-icon2.js';
4
4
  import { d as defineCustomElement$3 } from './mg-input-title2.js';
5
5
  import { d as defineCustomElement$2 } from './mg-tooltip2.js';
@@ -68,11 +68,11 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
68
68
  this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
69
69
  }
70
70
  watchIdentifier(newValue) {
71
- if (!ye(newValue)) {
72
- throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${Je(newValue)}.`);
71
+ if (!me(newValue)) {
72
+ throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${Ve(newValue)}.`);
73
73
  }
74
- else if (!Ie(newValue)) {
75
- console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
74
+ else if (!Xe(newValue)) {
75
+ console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${Ve(newValue)}.`);
76
76
  }
77
77
  else {
78
78
  this.helpTextId = `${this.identifier}-help-text`;
@@ -94,7 +94,7 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
94
94
  }
95
95
  watchTooltipPosition(newValue) {
96
96
  if (!tooltipPositions.includes(newValue)) {
97
- throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${Je(newValue)}.`);
97
+ throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${Ve(newValue)}.`);
98
98
  }
99
99
  }
100
100
  watchErrorMessage(newValue) {
@@ -161,8 +161,8 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
161
161
  */
162
162
  // eslint-disable-next-line @stencil-community/no-unused-watch
163
163
  watchLabel() {
164
- if (!ye(this.label)) {
165
- throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${Je(this.label)}.`);
164
+ if (!me(this.label)) {
165
+ throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${Ve(this.label)}.`);
166
166
  }
167
167
  else {
168
168
  this.watchAriaDescribedbyIDs();
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
- import { J as Je } from './index.es.js';
2
+ import { V as Ve } from './index.es.js';
3
3
  import { d as defineCustomElement$4, D as Direction, s as sizes } from './mg-menu-item2.js';
4
4
  import { i as initLocales } from './index2.js';
5
5
  import { d as defineCustomElement$8 } from './mg-badge2.js';
@@ -86,7 +86,7 @@ class OverflowBehavior {
86
86
  }
87
87
  }
88
88
 
89
- const mgMenuCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}";
89
+ const mgMenuCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;min-width:0;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}";
90
90
  const MgMenuStyle0 = mgMenuCss;
91
91
 
92
92
  const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement {
@@ -161,12 +161,12 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
161
161
  }
162
162
  validateLabel(newValue) {
163
163
  if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
164
- throw new Error(`<${this.name}> prop "label" is required. Passed value: ${Je(newValue)}.`);
164
+ throw new Error(`<${this.name}> prop "label" is required. Passed value: ${Ve(newValue)}.`);
165
165
  }
166
166
  }
167
167
  validateDirection(newValue) {
168
168
  if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
169
- throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${Je(newValue)}.`);
169
+ throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${Ve(newValue)}.`);
170
170
  }
171
171
  else {
172
172
  this.updateMenuItems();
@@ -182,7 +182,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
182
182
  }
183
183
  validateSize(newValue) {
184
184
  if (!sizes.includes(newValue)) {
185
- throw new Error(`<${this.name}> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Je(newValue)}.`);
185
+ throw new Error(`<${this.name}> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Ve(newValue)}.`);
186
186
  }
187
187
  }
188
188
  /**
@@ -355,17 +355,17 @@ const MgItemMore = /*@__PURE__*/ proxyCustomElement(class MgItemMore extends HTM
355
355
  }
356
356
  validateIcon(newValue) {
357
357
  if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
358
- throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${Je(newValue)}.`);
358
+ throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${Ve(newValue)}.`);
359
359
  }
360
360
  validateSlotLabel(newValue) {
361
361
  if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
362
- throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${Je(newValue)}.`);
362
+ throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${Ve(newValue)}.`);
363
363
  else if (typeof newValue.label !== 'string')
364
364
  this.slotlabel.label = this.messages.menuLabel;
365
365
  }
366
366
  validateSize(newValue) {
367
367
  if (newValue && !sizes.includes(newValue))
368
- throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${Je(newValue)}.`);
368
+ throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${Ve(newValue)}.`);
369
369
  }
370
370
  /*************
371
371
  * Lifecycle *
@@ -1 +1 @@
1
- {"file":"mg-item-more2.js","mappings":";;;;;;;;;;;AAAA;;;MAGa,gBAAgB;IAK3B,YACU,aAA0B,EAC1B,eAA6B,EAC7B,wBAAqC;QAFrC,kBAAa,GAAb,aAAa,CAAa;QAC1B,oBAAe,GAAf,eAAe,CAAc;QAC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gBAAM,IAAI,GAAG,KAAK,IAAI;oBAAE,IAAI,CAAC,iBAAiB,GAAG,GAAG,CAAA;aAAC,GAAY,CACtJ,CAChB,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["toString"],"sources":["src/utils/behaviors.utils.ts","../styles/dist/components/mg-menu.css?tag=mg-menu&encapsulation=shadow","src/components/molecules/menu/mg-menu/mg-menu.tsx","../styles/dist/components/mg-item-more.css?tag=mg-item-more&encapsulation=shadow","src/components/molecules/internals/mg-item-more/mg-item-more.tsx"],"sourcesContent":["/**\n * \n */\nexport class OverflowBehavior {\n // variables\n private _resizeObserver: ResizeObserver;\n private _availableWidth: number;\n\n constructor(\n private parentElement: HTMLElement,\n private itemMoreElement: HTMLElement,\n private itemMoreContainerElement: HTMLElement\n ) {\n if(!this.parentElement || !this.itemMoreElement || !this.itemMoreContainerElement) {\n throw new Error('OverflowBehavior - all construtor params are required')\n }\n\n const items = Array.from(this.parentElement.children) as HTMLElement[]\n\n this._resizeObserver = new ResizeObserver(entries => {\n this._availableWidth = entries.map(entry => entry.contentRect.width).sort((a, b) => a - b).shift();\n // reset items\n items.forEach(item => this.toggleItem(item, false));\n \n let accWidth = 0;\n\n items.forEach((item, index) => {\n accWidth += item.offsetWidth;\n if(index) this.toggleItem(item, this.isOverflowElement(accWidth, item))\n });\n });\n this._resizeObserver.observe(this.parentElement);\n }\n\n /**********\n * Public *\n **********/\n\n /**\n * Disconnect ResizeObserver\n */\n public disconnect = (): void => {\n this._resizeObserver.disconnect();\n };\n\n /************\n * Internal *\n ************/\n\n /**\n * Utility method to know if element is HTMLMgItemMoreElement\n * @param element - element to match with 'MORE' element\n * @returns truthy if element is the 'MORE' element\n */\n private isMoreElement = (element: HTMLElement): element is HTMLMgItemMoreElement => element === this.itemMoreElement;\n\n /**\n * Utility method to know if item overflow partialy or totaly in the container\n * @param cumulateWidth - previous sibling elements cumulate width + item width\n * @param item - item HTML element\n * @returns truthy if element is overflow\n */\n private isOverflowElement = (cumulateWidth: number, item: HTMLElement): boolean => {\n const displayMgItemMore = this.itemMoreContainerElement.children.length > 0\n if (!this.isMoreElement(item)) {\n if (item.nextElementSibling.nodeName !== 'MG-ITEM-MORE' && !displayMgItemMore) return cumulateWidth + this.itemMoreElement.offsetWidth > this._availableWidth;\n else return cumulateWidth > this._availableWidth;\n }\n else return !displayMgItemMore;\n };\n\n /**\n * Toogle item from isHidden condition\n * @param item - item to update\n * @param isHidden - item is hidden\n */\n private toggleItem = (item: HTMLElement, isHidden: boolean):void => {\n if (this.isMoreElement(item) && isHidden) item.setAttribute('hidden', '');\n else if(this.isMoreElement(item) && !isHidden) item.removeAttribute('hidden');\n else if (!this.isMoreElement(item) && isHidden) this.itemMoreContainerElement.appendChild(item)\n else if(!this.isMoreElement(item) && item.parentElement !== this.parentElement) this.parentElement.insertBefore(item, this.itemMoreElement)\n }\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}/*# sourceMappingURL=mg-menu.css.map */\n","import { Component, h, Prop, Element, Watch, Host, Listen } from '@stencil/core';\nimport { Direction, sizes } from './mg-menu.conf';\nimport type { MenuSizeType, ItemMoreType, DirectionType } from './mg-menu.conf';\nimport { toString } from '@mgdis/stencil-helpers';\n\n/**\n * @slot - Menu content\n */\n@Component({\n tag: 'mg-menu',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu.css',\n shadow: true,\n})\nexport class MgMenu {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuElement;\n\n /**\n * Menu label. Include short menu description.\n * Required to define accessibility required attribute `aria-label`\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgMenu['label']): void {\n if (newValue === undefined && !this.element.hasAttribute('aria-label')) {\n throw new Error(`<${this.name}> prop \"label\" is required. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Component display direction.\n */\n @Prop({ reflect: true }) direction: DirectionType = Direction.HORIZONTAL;\n @Watch('direction')\n validateDirection(newValue: MgMenu['direction']): void {\n if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {\n throw new Error(`<${this.name}> prop \"direction\" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${toString(newValue)}.`);\n } else {\n this.updateMenuItems();\n }\n }\n\n /**\n * Customize \"mg-item-more\" element\n * Used with direction: 'vertical' to manage overflow\n */\n @Prop() itemmore?: ItemMoreType;\n @Watch('itemmore')\n validateItemMore(newValue: MgMenu['itemmore']): void {\n if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {\n throw new Error(`<${this.name}> prop \"itemmore\" must be paired with direction ${Direction.HORIZONTAL}.`);\n } else if (newValue !== undefined) {\n this.renderMgItemMore();\n }\n }\n\n /**\n * Define mg-menu size\n */\n @Prop() size: MenuSizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgMenu['size']): void {\n if (!sizes.includes(newValue)) {\n throw new Error(`<${this.name}> prop \"size\" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define mg-menu-item listener when they are loaded\n * @param event - mg-item-loaded \"item-loaded\" custom event\n */\n @Listen('item-loaded')\n updateItemListener(event: CustomEvent & { target: HTMLMgMenuItemElement}): void {\n const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;\n\n ['click', 'focus'].forEach(trigger => {\n itemToWatch.addEventListener(trigger, ():void => {\n const focusedItem: HTMLMgMenuItemElement = event.target.closest('mg-menu').querySelector('[data-has-focus]')\n // exit process if new focused item in the current menu children\n if(focusedItem === itemToWatch) return;\n\n // reset expanded on previous active menu item\n if(focusedItem) focusedItem.removeAttribute(\"data-has-focus\");\n\n // update focusedMenuItem with new value\n itemToWatch.setAttribute('data-has-focus','true');\n });\n })\n };\n\n /*************\n * Methods *\n *************/\n\n /**\n * Test if menu is a child menu\n * @returns truthy if menu is a child menu\n */\n private isChildMenu = (): boolean => this.element.closest('mg-menu-item') !== null;\n\n /**\n * Get menu children items\n * @returns menu children mg-menu-item\n */\n private getMenuItems = (menu = this.element): HTMLMgMenuItemElement[] => {\n const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM') as HTMLMgMenuItemElement[];\n const itemMoreMenuItem = menu.querySelector('mg-item-more')?.shadowRoot?.querySelector('mg-menu-item');\n if(itemMoreMenuItem) {\n menuItems.push(itemMoreMenuItem)\n }\n return menuItems;\n }\n\n /**\n * Update menu items\n */\n private updateMenuItems = (): void => {\n this.getMenuItems().forEach((item) => {\n item.dataset.styleDirection = this.direction\n })\n\n // render mg-item-more to manage OverflowBehavior\n this.renderMgItemMore();\n }\n\n /**\n * render mg-item-more\n */\n private renderMgItemMore = (): void => {\n if (this.direction === Direction.VERTICAL || this.direction === Direction.HORIZONTAL && this.isChildMenu() || this.element.children.length <= 1) {\n return;\n }\n\n // Insert mg-item-more outside the mg-menu shadowdom\n let itemMoreElement = this.element.querySelector('mg-item-more')\n if (itemMoreElement === null) {\n itemMoreElement = document.createElement('mg-item-more');\n this.element.appendChild(itemMoreElement);\n }\n\n // update mg-item-more props\n for (const propertie in this.itemmore) {\n itemMoreElement[propertie] = this.itemmore[propertie];\n }\n if (this.itemmore?.size === undefined) itemMoreElement.size = this.size;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.validateDirection(this.direction);\n this.validateLabel(this.label);\n this.validateItemMore(this.itemmore);\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n */\n componentDidLoad(): void {\n // set menu-items\n this.updateMenuItems();\n\n // add listener to close main menu when focus leave it\n if(!this.isChildMenu() && this.direction === Direction.HORIZONTAL) {\n document.addEventListener('focusin', (event: FocusEvent & { target: HTMLElement}):void => {\n const isElementChild = (element: HTMLElement):boolean => {\n if (element === this.element) return true;\n else if(!element.parentElement) return false;\n else return isElementChild(element.parentElement);\n };\n \n if(!event.target.closest('mg-menu') || !isElementChild(event.target)) {\n const focusedItem = this.element.querySelector('[data-has-focus]')\n // reset expanded on previous active menu item\n if(focusedItem) focusedItem.removeAttribute('data-has-focus');\n }\n })\n }\n // add mutation observer to improve global reactivity\n new MutationObserver(this.updateMenuItems).observe(this.element, { childList: true });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"list\" aria-label={this.label}>\n <slot></slot>\n </Host>\n );\n }\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host:not([hidden]){display:flex}/*# sourceMappingURL=mg-item-more.css.map */\n","import { Component, h, Prop, Element, Host, Watch, State } from '@stencil/core';\nimport { toString } from '@mgdis/stencil-helpers';\nimport type { IconType, SizeType, SlotLabelType } from './mg-item-more.conf';\nimport type { MessageType } from '../../../../locales/index.conf';\nimport { OverflowBehavior } from '../../../../utils/behaviors.utils';\nimport { Direction, sizes } from '../../menu/mg-menu/mg-menu.conf';\nimport { initLocales } from '../../../../locales';\n\n/**\n * @internal\n */\n@Component({\n tag: 'mg-item-more',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-item-more.css',\n shadow: true,\n})\nexport class MgItemMore {\n /************\n * Internal *\n ************/\n private readonly name = 'mg-item-more';\n private messages: MessageType;\n private overflowBehavior: OverflowBehavior;\n private itemMoreContainer: HTMLMgMenuElement\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgItemMoreElement;\n\n /**\n * Define icon\n */\n @Prop() icon?: IconType = { icon: 'ellipsis-vertical' };\n @Watch('icon')\n validateIcon(newValue: MgItemMore['icon']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))\n throw new Error(`<${this.name}> prop \"icon\" must match MgItemMore['icon'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define slot label element\n */\n @Prop() slotlabel?: SlotLabelType = { display: false };\n @Watch('slotlabel')\n validateSlotLabel(newValue: MgItemMore['slotlabel']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))\n throw new Error(`<${this.name}> prop \"slotlabel\" must match MgItemMore['slotlabel'] type. Passed value: ${toString(newValue)}.`);\n else if (typeof newValue.label !== 'string') this.slotlabel.label = this.messages.menuLabel;\n }\n\n /**\n * Define component child menu size.\n */\n @Prop() size?: SizeType;\n @Watch('size')\n validateSize(newValue: MgItemMore['size']): void {\n if (newValue && !sizes.includes(newValue)) throw new Error(`<${this.name}> prop \"size\" must match MgItemMore['size'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define component parent menu.\n */\n @State() parentMenu: HTMLMgMenuElement;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Set variables and validate props\n */\n componentWillLoad(): void {\n // init variables\n this.messages = initLocales(this.element).messages.itemMore as MessageType;\n\n // validate props\n this.validateIcon(this.icon);\n this.validateSlotLabel(this.slotlabel);\n this.validateSize(this.size);\n }\n\n /**\n * Ensure parent DOM is fully rendered with timeout method before parse elements\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // ensure parent menu is fully rendered\n return setTimeout(() => {\n this.parentMenu = this.element.closest('mg-menu');\n });\n }\n\n /**\n * Set OverflowBehavior when parentMenu state is upate AND defined\n */\n componentDidUpdate(): void {\n if (this.parentMenu && this.overflowBehavior === undefined) {\n this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.element, this.itemMoreContainer);\n }\n }\n\n /**\n * Disconnect overflow ResizeObserver\n */\n disconnectedCallback(): void {\n this.overflowBehavior?.disconnect();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const menuItemIdentifier = \"mg-item-more\"\n return (\n <Host role=\"listitem\" data-mg-popover-guard={`${menuItemIdentifier}-popover`}>\n {this.parentMenu && (\n <mg-menu-item\n data-overflow-more\n data-size={this.parentMenu.size}\n data-style-direction={Direction.HORIZONTAL}\n identifier={menuItemIdentifier}\n >\n <mg-icon icon={this.icon.icon} size={this.size} slot=\"image\"></mg-icon>\n <span class={{ 'mg-u-visually-hidden': !this.slotlabel.display }} slot=\"label\">\n {this.slotlabel.label}\n </span>\n <mg-menu direction={Direction.VERTICAL} label={this.messages.menuLabel} size={this.size} ref={(ref) => {if (ref !== null) this.itemMoreContainer = ref}}></mg-menu>\n </mg-menu-item>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"mg-item-more2.js","mappings":";;;;;;;;;;;AAAA;;;MAGa,gBAAgB;IAK3B,YACU,aAA0B,EAC1B,eAA6B,EAC7B,wBAAqC;QAFrC,kBAAa,GAAb,aAAa,CAAa;QAC1B,oBAAe,GAAf,eAAe,CAAc;QAC7B,6BAAwB,GAAxB,wBAAwB,CAAa;;;;;;;QA8BxC,eAAU,GAAG;YAClB,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;SACnC,CAAC;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["toString"],"sources":["src/utils/behaviors.utils.ts","../styles/dist/components/mg-menu.css?tag=mg-menu&encapsulation=shadow","src/components/molecules/menu/mg-menu/mg-menu.tsx","../styles/dist/components/mg-item-more.css?tag=mg-item-more&encapsulation=shadow","src/components/molecules/internals/mg-item-more/mg-item-more.tsx"],"sourcesContent":["/**\n * \n */\nexport class OverflowBehavior {\n // variables\n private _resizeObserver: ResizeObserver;\n private _availableWidth: number;\n\n constructor(\n private parentElement: HTMLElement,\n private itemMoreElement: HTMLElement,\n private itemMoreContainerElement: HTMLElement\n ) {\n if(!this.parentElement || !this.itemMoreElement || !this.itemMoreContainerElement) {\n throw new Error('OverflowBehavior - all construtor params are required')\n }\n\n const items = Array.from(this.parentElement.children) as HTMLElement[]\n\n this._resizeObserver = new ResizeObserver(entries => {\n this._availableWidth = entries.map(entry => entry.contentRect.width).sort((a, b) => a - b).shift();\n // reset items\n items.forEach(item => this.toggleItem(item, false));\n \n let accWidth = 0;\n\n items.forEach((item, index) => {\n accWidth += item.offsetWidth;\n if(index) this.toggleItem(item, this.isOverflowElement(accWidth, item))\n });\n });\n this._resizeObserver.observe(this.parentElement);\n }\n\n /**********\n * Public *\n **********/\n\n /**\n * Disconnect ResizeObserver\n */\n public disconnect = (): void => {\n this._resizeObserver.disconnect();\n };\n\n /************\n * Internal *\n ************/\n\n /**\n * Utility method to know if element is HTMLMgItemMoreElement\n * @param element - element to match with 'MORE' element\n * @returns truthy if element is the 'MORE' element\n */\n private isMoreElement = (element: HTMLElement): element is HTMLMgItemMoreElement => element === this.itemMoreElement;\n\n /**\n * Utility method to know if item overflow partialy or totaly in the container\n * @param cumulateWidth - previous sibling elements cumulate width + item width\n * @param item - item HTML element\n * @returns truthy if element is overflow\n */\n private isOverflowElement = (cumulateWidth: number, item: HTMLElement): boolean => {\n const displayMgItemMore = this.itemMoreContainerElement.children.length > 0\n if (!this.isMoreElement(item)) {\n if (item.nextElementSibling.nodeName !== 'MG-ITEM-MORE' && !displayMgItemMore) return cumulateWidth + this.itemMoreElement.offsetWidth > this._availableWidth;\n else return cumulateWidth > this._availableWidth;\n }\n else return !displayMgItemMore;\n };\n\n /**\n * Toogle item from isHidden condition\n * @param item - item to update\n * @param isHidden - item is hidden\n */\n private toggleItem = (item: HTMLElement, isHidden: boolean):void => {\n if (this.isMoreElement(item) && isHidden) item.setAttribute('hidden', '');\n else if(this.isMoreElement(item) && !isHidden) item.removeAttribute('hidden');\n else if (!this.isMoreElement(item) && isHidden) this.itemMoreContainerElement.appendChild(item)\n else if(!this.isMoreElement(item) && item.parentElement !== this.parentElement) this.parentElement.insertBefore(item, this.itemMoreElement)\n }\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;min-width:0;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}/*# sourceMappingURL=mg-menu.css.map */\n","import { Component, h, Prop, Element, Watch, Host, Listen } from '@stencil/core';\nimport { Direction, sizes } from './mg-menu.conf';\nimport type { MenuSizeType, ItemMoreType, DirectionType } from './mg-menu.conf';\nimport { toString } from '@mgdis/stencil-helpers';\n\n/**\n * @slot - Menu content\n */\n@Component({\n tag: 'mg-menu',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu.css',\n shadow: true,\n})\nexport class MgMenu {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuElement;\n\n /**\n * Menu label. Include short menu description.\n * Required to define accessibility required attribute `aria-label`\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgMenu['label']): void {\n if (newValue === undefined && !this.element.hasAttribute('aria-label')) {\n throw new Error(`<${this.name}> prop \"label\" is required. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Component display direction.\n */\n @Prop({ reflect: true }) direction: DirectionType = Direction.HORIZONTAL;\n @Watch('direction')\n validateDirection(newValue: MgMenu['direction']): void {\n if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {\n throw new Error(`<${this.name}> prop \"direction\" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${toString(newValue)}.`);\n } else {\n this.updateMenuItems();\n }\n }\n\n /**\n * Customize \"mg-item-more\" element\n * Used with direction: 'vertical' to manage overflow\n */\n @Prop() itemmore?: ItemMoreType;\n @Watch('itemmore')\n validateItemMore(newValue: MgMenu['itemmore']): void {\n if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {\n throw new Error(`<${this.name}> prop \"itemmore\" must be paired with direction ${Direction.HORIZONTAL}.`);\n } else if (newValue !== undefined) {\n this.renderMgItemMore();\n }\n }\n\n /**\n * Define mg-menu size\n */\n @Prop() size: MenuSizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgMenu['size']): void {\n if (!sizes.includes(newValue)) {\n throw new Error(`<${this.name}> prop \"size\" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define mg-menu-item listener when they are loaded\n * @param event - mg-item-loaded \"item-loaded\" custom event\n */\n @Listen('item-loaded')\n updateItemListener(event: CustomEvent & { target: HTMLMgMenuItemElement}): void {\n const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;\n\n ['click', 'focus'].forEach(trigger => {\n itemToWatch.addEventListener(trigger, ():void => {\n const focusedItem: HTMLMgMenuItemElement = event.target.closest('mg-menu').querySelector('[data-has-focus]')\n // exit process if new focused item in the current menu children\n if(focusedItem === itemToWatch) return;\n\n // reset expanded on previous active menu item\n if(focusedItem) focusedItem.removeAttribute(\"data-has-focus\");\n\n // update focusedMenuItem with new value\n itemToWatch.setAttribute('data-has-focus','true');\n });\n })\n };\n\n /*************\n * Methods *\n *************/\n\n /**\n * Test if menu is a child menu\n * @returns truthy if menu is a child menu\n */\n private isChildMenu = (): boolean => this.element.closest('mg-menu-item') !== null;\n\n /**\n * Get menu children items\n * @returns menu children mg-menu-item\n */\n private getMenuItems = (menu = this.element): HTMLMgMenuItemElement[] => {\n const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM') as HTMLMgMenuItemElement[];\n const itemMoreMenuItem = menu.querySelector('mg-item-more')?.shadowRoot?.querySelector('mg-menu-item');\n if(itemMoreMenuItem) {\n menuItems.push(itemMoreMenuItem)\n }\n return menuItems;\n }\n\n /**\n * Update menu items\n */\n private updateMenuItems = (): void => {\n this.getMenuItems().forEach((item) => {\n item.dataset.styleDirection = this.direction\n })\n\n // render mg-item-more to manage OverflowBehavior\n this.renderMgItemMore();\n }\n\n /**\n * render mg-item-more\n */\n private renderMgItemMore = (): void => {\n if (this.direction === Direction.VERTICAL || this.direction === Direction.HORIZONTAL && this.isChildMenu() || this.element.children.length <= 1) {\n return;\n }\n\n // Insert mg-item-more outside the mg-menu shadowdom\n let itemMoreElement = this.element.querySelector('mg-item-more')\n if (itemMoreElement === null) {\n itemMoreElement = document.createElement('mg-item-more');\n this.element.appendChild(itemMoreElement);\n }\n\n // update mg-item-more props\n for (const propertie in this.itemmore) {\n itemMoreElement[propertie] = this.itemmore[propertie];\n }\n if (this.itemmore?.size === undefined) itemMoreElement.size = this.size;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.validateDirection(this.direction);\n this.validateLabel(this.label);\n this.validateItemMore(this.itemmore);\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n */\n componentDidLoad(): void {\n // set menu-items\n this.updateMenuItems();\n\n // add listener to close main menu when focus leave it\n if(!this.isChildMenu() && this.direction === Direction.HORIZONTAL) {\n document.addEventListener('focusin', (event: FocusEvent & { target: HTMLElement}):void => {\n const isElementChild = (element: HTMLElement):boolean => {\n if (element === this.element) return true;\n else if(!element.parentElement) return false;\n else return isElementChild(element.parentElement);\n };\n \n if(!event.target.closest('mg-menu') || !isElementChild(event.target)) {\n const focusedItem = this.element.querySelector('[data-has-focus]')\n // reset expanded on previous active menu item\n if(focusedItem) focusedItem.removeAttribute('data-has-focus');\n }\n })\n }\n // add mutation observer to improve global reactivity\n new MutationObserver(this.updateMenuItems).observe(this.element, { childList: true });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"list\" aria-label={this.label}>\n <slot></slot>\n </Host>\n );\n }\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host:not([hidden]){display:flex}/*# sourceMappingURL=mg-item-more.css.map */\n","import { Component, h, Prop, Element, Host, Watch, State } from '@stencil/core';\nimport { toString } from '@mgdis/stencil-helpers';\nimport type { IconType, SizeType, SlotLabelType } from './mg-item-more.conf';\nimport type { MessageType } from '../../../../locales/index.conf';\nimport { OverflowBehavior } from '../../../../utils/behaviors.utils';\nimport { Direction, sizes } from '../../menu/mg-menu/mg-menu.conf';\nimport { initLocales } from '../../../../locales';\n\n/**\n * @internal\n */\n@Component({\n tag: 'mg-item-more',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-item-more.css',\n shadow: true,\n})\nexport class MgItemMore {\n /************\n * Internal *\n ************/\n private readonly name = 'mg-item-more';\n private messages: MessageType;\n private overflowBehavior: OverflowBehavior;\n private itemMoreContainer: HTMLMgMenuElement\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgItemMoreElement;\n\n /**\n * Define icon\n */\n @Prop() icon?: IconType = { icon: 'ellipsis-vertical' };\n @Watch('icon')\n validateIcon(newValue: MgItemMore['icon']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))\n throw new Error(`<${this.name}> prop \"icon\" must match MgItemMore['icon'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define slot label element\n */\n @Prop() slotlabel?: SlotLabelType = { display: false };\n @Watch('slotlabel')\n validateSlotLabel(newValue: MgItemMore['slotlabel']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))\n throw new Error(`<${this.name}> prop \"slotlabel\" must match MgItemMore['slotlabel'] type. Passed value: ${toString(newValue)}.`);\n else if (typeof newValue.label !== 'string') this.slotlabel.label = this.messages.menuLabel;\n }\n\n /**\n * Define component child menu size.\n */\n @Prop() size?: SizeType;\n @Watch('size')\n validateSize(newValue: MgItemMore['size']): void {\n if (newValue && !sizes.includes(newValue)) throw new Error(`<${this.name}> prop \"size\" must match MgItemMore['size'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define component parent menu.\n */\n @State() parentMenu: HTMLMgMenuElement;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Set variables and validate props\n */\n componentWillLoad(): void {\n // init variables\n this.messages = initLocales(this.element).messages.itemMore as MessageType;\n\n // validate props\n this.validateIcon(this.icon);\n this.validateSlotLabel(this.slotlabel);\n this.validateSize(this.size);\n }\n\n /**\n * Ensure parent DOM is fully rendered with timeout method before parse elements\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // ensure parent menu is fully rendered\n return setTimeout(() => {\n this.parentMenu = this.element.closest('mg-menu');\n });\n }\n\n /**\n * Set OverflowBehavior when parentMenu state is upate AND defined\n */\n componentDidUpdate(): void {\n if (this.parentMenu && this.overflowBehavior === undefined) {\n this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.element, this.itemMoreContainer);\n }\n }\n\n /**\n * Disconnect overflow ResizeObserver\n */\n disconnectedCallback(): void {\n this.overflowBehavior?.disconnect();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const menuItemIdentifier = \"mg-item-more\"\n return (\n <Host role=\"listitem\" data-mg-popover-guard={`${menuItemIdentifier}-popover`}>\n {this.parentMenu && (\n <mg-menu-item\n data-overflow-more\n data-size={this.parentMenu.size}\n data-style-direction={Direction.HORIZONTAL}\n identifier={menuItemIdentifier}\n >\n <mg-icon icon={this.icon.icon} size={this.size} slot=\"image\"></mg-icon>\n <span class={{ 'mg-u-visually-hidden': !this.slotlabel.display }} slot=\"label\">\n {this.slotlabel.label}\n </span>\n <mg-menu direction={Direction.VERTICAL} label={this.messages.menuLabel} size={this.size} ref={(ref) => {if (ref !== null) this.itemMoreContainer = ref}}></mg-menu>\n </mg-menu-item>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
  import { i as initLocales } from './index2.js';
3
- import { y as ye, J as Je } from './index.es.js';
3
+ import { m as me, V as Ve } from './index.es.js';
4
4
  import { d as defineCustomElement$2 } from './mg-icon2.js';
5
5
 
6
6
  const mgLoaderCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host{display:block}.mg-c-loader{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:var(--mg-b-size-4);text-align:center}";
@@ -13,8 +13,8 @@ const MgLoader$1 = /*@__PURE__*/ proxyCustomElement(class MgLoader extends HTMLE
13
13
  this.__attachShadow();
14
14
  }
15
15
  watchMessage(newValue) {
16
- if (newValue && !ye(newValue))
17
- throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${Je(newValue)}.`);
16
+ if (newValue && !me(newValue))
17
+ throw new Error(`<mg-loader> prop "message" must be a valid string. Passed value: ${Ve(newValue)}.`);
18
18
  }
19
19
  /*************
20
20
  * Lifecycle *
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
- import { z as ze, G as Ge, y as ye, I as Ie, J as Je, e as et } from './index.es.js';
2
+ import { G as Ge, K as Ke, m as me, X as Xe, V as Ve, s as st } from './index.es.js';
3
3
  import { i as initLocales } from './index2.js';
4
4
  import { d as defineCustomElement$6 } from './mg-badge2.js';
5
5
  import { d as defineCustomElement$5 } from './mg-button2.js';
@@ -55,7 +55,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
55
55
  /**
56
56
  * Identifier is used to control mg-popover
57
57
  */
58
- this.identifier = ze('mg-menu-item');
58
+ this.identifier = Ge('mg-menu-item');
59
59
  /**
60
60
  * Define menu-item status.
61
61
  */
@@ -74,7 +74,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
74
74
  /**
75
75
  * Component button classes
76
76
  */
77
- this.navigationButtonClassList = new Ge([this.navigationButton]);
77
+ this.navigationButtonClassList = new Ke([this.navigationButton]);
78
78
  /**
79
79
  * Does component have children.
80
80
  */
@@ -82,6 +82,11 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
82
82
  /***********
83
83
  * Methods *
84
84
  **********/
85
+ /**
86
+ * Get parent menu
87
+ * @returns parent menu
88
+ */
89
+ this.getParentMenu = () => this.element.closest('mg-menu');
85
90
  /**
86
91
  * Does an Element have given Status
87
92
  * @param mgMenuItemElement - to parse
@@ -93,7 +98,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
93
98
  * Condition to know if component should display a mg-popover
94
99
  * @returns truthy if component display popover
95
100
  */
96
- this.hasPopover = () => this.isDirection(Direction.HORIZONTAL) && (this.isInMainMenu && Array.from(this.element.children).some(element => !element.querySelector('[slot]')) || this.isItemMore) && this.href === undefined;
101
+ this.hasPopover = () => this.isDirection(Direction.HORIZONTAL) && (this.isInMainMenu() && Array.from(this.element.children).some(element => !element.querySelector('[slot]')) || this.isItemMore) && this.href === undefined;
97
102
  /**
98
103
  * Method to control if one of component children have active status
99
104
  * @returns truthy if component has active child
@@ -106,7 +111,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
106
111
  * Is component an interactive item
107
112
  * @returns truthy if element is clickable
108
113
  */
109
- this.isInteractiveItem = () => this.hasChildren || !ye(this.href);
114
+ this.isInteractiveItem = () => this.hasChildren || !me(this.href);
110
115
  /**
111
116
  * Is component contextual direction match the given direction
112
117
  * @param direction - in parent menu
@@ -114,6 +119,11 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
114
119
  * @returns true is direction match the direction propertie
115
120
  */
116
121
  this.isDirection = (direction, compareWith = this.direction) => direction === compareWith;
122
+ /**
123
+ * Does component is in main menu
124
+ * @returns true if component is in main menu
125
+ */
126
+ this.isInMainMenu = () => this.getParentMenu() !== null && this.element.parentElement.closest('mg-menu-item') === null;
117
127
  /**
118
128
  * Update displayNotificationBadge
119
129
  * current component notification badge have priority over the slot badge when submenu contain badge
@@ -154,7 +164,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
154
164
  }
155
165
  ['label', 'metadata'].forEach(slot => {
156
166
  Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
157
- if (!ye(element.textContent))
167
+ if (!me(element.textContent))
158
168
  throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
159
169
  if ((guard && !element.hasAttribute('title')) || !guard)
160
170
  element.setAttribute('title', element.textContent);
@@ -166,8 +176,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
166
176
  * @param guard - prevent action with guard
167
177
  */
168
178
  this.updateItem = (guard) => {
169
- const menu = this.element.closest('mg-menu');
170
- this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;
179
+ const menu = this.getParentMenu();
171
180
  // define element size
172
181
  if ((menu === null || menu === void 0 ? void 0 : menu.size) !== undefined && !this.isItemMore)
173
182
  this.size = menu.size;
@@ -222,8 +231,8 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
222
231
  this.renderSlot = () => h("slot", null);
223
232
  }
224
233
  watchIdentifier(newValue) {
225
- if (!Ie(newValue)) {
226
- console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${Je(newValue)}.`);
234
+ if (!Xe(newValue)) {
235
+ console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${Ve(newValue)}.`);
227
236
  }
228
237
  else {
229
238
  this.popoverIdentifier = `${this.identifier}-popover`;
@@ -231,7 +240,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
231
240
  }
232
241
  watchTarget(newValue) {
233
242
  if (newValue && !targets.includes(newValue)) {
234
- throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${Je(newValue)}.`);
243
+ throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${Ve(newValue)}.`);
235
244
  }
236
245
  }
237
246
  watchStatus(newValue, oldValue) {
@@ -241,7 +250,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
241
250
  }
242
251
  watchExpanded(newValue) {
243
252
  if (typeof newValue !== 'boolean') {
244
- throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${Je(newValue)}.`);
253
+ throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${Ve(newValue)}.`);
245
254
  }
246
255
  else {
247
256
  this.updateExpanded(newValue);
@@ -356,7 +365,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
356
365
  * @returns promise process wich emit the 'item-updated' event
357
366
  */
358
367
  componentShouldUpdate() {
359
- return et(() => {
368
+ return st(() => {
360
369
  this.itemUpdated.emit();
361
370
  });
362
371
  }
@@ -381,9 +390,9 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
381
390
  render() {
382
391
  const getContainerClasses = () => ({
383
392
  ['mg-c-menu-item__collapse-container']: true,
384
- ['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
393
+ ['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu() || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
385
394
  });
386
- return (h(Host, { key: '1bfbcc26638508e5fff8d0a9b0bd1956e06cb9ae', role: this.isItemMore ? 'presentation' : 'listitem' }, this.hasPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.popoverIdentifier, "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
395
+ return (h(Host, { key: '010958810569e4b777b08d6aebc39be61bb03291', role: this.isItemMore ? 'presentation' : 'listitem' }, this.hasPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.popoverIdentifier, "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
387
396
  }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
388
397
  this.renderInteractiveElement(),
389
398
  h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
@@ -411,7 +420,6 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
411
420
  "size": [32],
412
421
  "navigationButtonClassList": [32],
413
422
  "direction": [32],
414
- "isInMainMenu": [32],
415
423
  "isItemMore": [32],
416
424
  "hasChildren": [32],
417
425
  "displayNotificationBadge": [32]