@mgdis/mg-components 5.7.0 → 5.8.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 (53) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mg-action-more_31.cjs.entry.js +216 -565
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-item-more.cjs.entry.js +273 -0
  5. package/dist/cjs/mg-menu.conf-9afe6571.js +242 -0
  6. package/dist/collection/collection-manifest.json +2 -1
  7. package/dist/collection/components/atoms/mg-button/mg-button.js +24 -0
  8. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +8 -0
  9. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -2
  10. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +0 -13
  11. package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +39 -67
  12. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +3 -3
  13. package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +156 -77
  14. package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
  15. package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +30 -0
  16. package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +200 -0
  17. package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -2
  18. package/dist/collection/styles/navigation-button.scss +1 -1
  19. package/dist/collection/utils/behaviors.utils.js +33 -29
  20. package/dist/components/index.d.ts +1 -0
  21. package/dist/components/index.js +1 -0
  22. package/dist/components/mg-action-more.js +2 -1
  23. package/dist/components/mg-button2.js +4 -1
  24. package/dist/components/mg-icon2.js +8 -0
  25. package/dist/components/mg-item-more.d.ts +11 -0
  26. package/dist/components/mg-item-more.js +336 -0
  27. package/dist/components/mg-menu-item2.js +134 -250
  28. package/dist/components/mg-menu.conf.js +14 -0
  29. package/dist/components/mg-menu2.js +35 -102
  30. package/dist/components/mg-tabs.js +1 -1
  31. package/dist/components/mg-tooltip2.js +6 -2
  32. package/dist/esm/loader.js +1 -1
  33. package/dist/esm/mg-action-more_31.entry.js +185 -534
  34. package/dist/esm/mg-components.js +1 -1
  35. package/dist/esm/mg-item-more.entry.js +269 -0
  36. package/dist/esm/mg-menu.conf-881fbd82.js +235 -0
  37. package/dist/mg-components/mg-components.css +1 -1
  38. package/dist/mg-components/mg-components.esm.js +1 -1
  39. package/dist/mg-components/p-1221773c.entry.js +1 -0
  40. package/dist/mg-components/p-367f92d2.js +1 -0
  41. package/dist/mg-components/p-6aeded97.entry.js +1 -0
  42. package/dist/mg-components/styles/navigation-button.scss +1 -1
  43. package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -0
  44. package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +3 -27
  45. package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +9 -27
  46. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -0
  47. package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +65 -16
  48. package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +26 -0
  49. package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +74 -0
  50. package/dist/types/components.d.ts +66 -12
  51. package/dist/types/utils/behaviors.utils.d.ts +12 -5
  52. package/package.json +1 -1
  53. package/dist/mg-components/p-4cfd5423.entry.js +0 -1
@@ -31,6 +31,7 @@ export const icons = {
31
31
  'bell': () => (h("path", { fill: "currentColor", d: "M8 15.33a1.7 1.7 0 0 0 1.52-1.83h-3A1.7 1.7 0 0 0 8 15.33ZM13.13 11c-.46-.59-1.32-1.48-1.32-4.42a4.4 4.4 0 0 0-3.05-4.4v-.6A.85.85 0 0 0 8 .67a.85.85 0 0 0-.76.91v.6a4.4 4.4 0 0 0-3 4.44c0 2.94-.86 3.83-1.32 4.42a1 1 0 0 0-.2.63.85.85 0 0 0 .76.91h9.14a.85.85 0 0 0 .76-.91 1.05 1.05 0 0 0-.25-.67Z" })),
32
32
  'briefcase': () => (h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Z" })),
33
33
  'briefcase-outline': () => (h("path", { fill: "currentColor", d: "M14 4.5h-3v-1c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H2c-.55 0-1 .45-1 1v7c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-7c0-.55-.45-1-1-1Zm-8-1h4v1H6v-1Zm8 9H2v-7h12v7Z" })),
34
+ 'building-outline': () => (h("path", { fill: "currentColor", d: "M4 2h8v12H9v-1a1 1 0 1 0-2 0v1H4V2Zm4 13h4a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h4ZM7 4H5v2h2V4Zm2 0h2v2H9V4Zm2 4H9v2h2V8ZM5 8h2v2H5V8Z" })),
34
35
  'calculator': () => (h("path", { fill: "currentColor", d: "M12.83.67H3.17a.5.5 0 0 0-.5.5v13.66a.5.5 0 0 0 .5.5h9.66a.5.5 0 0 0 .5-.5V1.17a.5.5 0 0 0-.5-.5ZM5.58 13.39a.29.29 0 0 1-.28.3H4.1a.29.29 0 0 1-.3-.28v-1.2a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm0-3.28a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V8.93a.29.29 0 0 1 .28-.3h1.2a.29.29 0 0 1 .3.28v1.2Zm3.29 3.28a.29.29 0 0 1-.3.3H7.38a.29.29 0 0 1-.3-.3v-1.18a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm0-3.28a.32.32 0 0 1-.3.3H7.38a.32.32 0 0 1-.3-.3V8.93a.29.29 0 0 1 .3-.3h1.19a.29.29 0 0 1 .3.3Zm3.33 3.28a.29.29 0 0 1-.28.3h-1.25a.29.29 0 0 1-.3-.28V8.93a.29.29 0 0 1 .28-.3h1.25a.29.29 0 0 1 .3.28v4.48Zm0-7.15a.29.29 0 0 1-.3.3H4.1a.29.29 0 0 1-.3-.3V2.61a.29.29 0 0 1 .28-.3h7.82a.29.29 0 0 1 .3.28v3.65Z" })),
35
36
  'calendar': () => (h("path", { fill: "currentColor", d: "M14 3.5c0-.55-.45-1-1-1h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v.98s0 .02.02.02H2v9c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-9h-.02s.02 0 .02-.02V3.5Zm-11 10v-8h10v8H3Z" })),
36
37
  'calendar-outline': () => (h("path", { fill: "currentColor", d: "M13 2.5h-1v-1h-1v1H5v-1H4v1H3c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h10c.55 0 1-.45 1-1v-10c0-.55-.45-1-1-1Zm-10 11v-8h10v8H3Zm0-9v-1h10v1H3Z" })),
@@ -146,6 +147,7 @@ export const icons = {
146
147
  'pen': () => (h("path", { fill: "currentColor", d: "M1.67,11.69v2.64h2.64l7.78-7.78-2.64-2.64L1.67,11.69ZM14.13,4.51c.27-.28,.27-.72,0-1h0l-1.65-1.64c-.28-.27-.72-.27-1,0h0l-1.28,1.29,2.64,2.64,1.29-1.29Z" })),
147
148
  'pen-circle': () => (h("path", { fill: "currentColor", d: "M8 .44C3.82.44.44 3.82.44 8S3.83 15.56 8 15.56s7.56-3.39 7.56-7.56C15.56 3.82 12.18.44 8 .44M5.47 12.19H3.62v-1.85l5.46-5.45 1.85 1.86-5.45 5.45Zm6.88-6.89-.9.9-1.86-1.85.9-.9c.19-.19.51-.19.7 0l1.16 1.15c.19.19.19.51 0 .7" })),
148
149
  'pen-fancy': () => (h("path", { fill: "currentColor", d: "M3.63,8.65c-.24,.07-.43,.26-.5,.5l-1.46,4.37,.11,.12,2.3-2.3c0-.06,0-.13,0-.19,0-.44,.35-.8,.79-.81,.44,0,.8,.35,.81,.79,0,.44-.35,.8-.79,.81,0,0-.01,0-.02,0h-.19l-2.3,2.3,.12,.11,4.37-1.46c.24-.07,.43-.26,.5-.5l.82-2.08-2.49-2.48-2.07,.82ZM10.8,2.35L6.27,7.28l2.42,2.42,4.94-4.52c2.1-1.86-.99-4.92-2.83-2.83Z" })),
150
+ 'pen-fancy-files-outline': () => (h("path", { fill: "currentColor", d: "M12 2H6v10h6V8.946l.023-.058.085-.078.892-.813V12a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v.112a2.298 2.298 0 0 0-.974.66L12 2.8V2Zm1 4.643-1 .913-.566.515-1.528-1.524L12 4.275l.767-.832c.075-.085.153-.156.233-.215 1.167-.857 2.796.9 1.555 1.997L13 6.643ZM4 3H3v11.5a.5.5 0 0 0 .5.5H11v-1H4V3Zm4.238 4.41a.466.466 0 0 0-.316.315L7 10.477l.07.076 1.452-1.449v-.12a.51.51 0 0 1 .5-.51.51.51 0 0 1 .511.498.51.51 0 0 1-.499.51h-.133L7.45 10.931l.075.069 2.76-.92a.466.466 0 0 0 .317-.314l.518-1.31-1.573-1.562-1.308.516Z" })),
149
151
  'pen-fancy-outline': () => (h("path", { fill: "currentColor", d: "M12.24 1.67c-.49 0-1 .21-1.44.7L6.27 7.3l2.42 2.42 4.94-4.52c1.6-1.42.19-3.53-1.39-3.53ZM8.72 8.34 7.66 7.28l3.9-4.24c.22-.24.44-.36.69-.36.41 0 .87.34 1.03.78.14.37.04.7-.32 1.02L8.73 8.36ZM5.7 7.86l-2.08.82c-.24.08-.42.26-.5.5l-1.46 4.37.12.12.56.56.12.12 4.37-1.46c.24-.08.42-.26.5-.5l.81-2.08L5.7 7.87Zm-2.57 4.46L4 9.72c.03-.08.09-.15.17-.18l1.29-.51 1.52 1.52-.5 1.29c-.03.08-.1.15-.19.18l-2.6.87.95-.95c.06.02.12.04.19.04.44 0 .79-.35.79-.79s-.35-.79-.79-.79-.79.35-.79.79c0 .07.02.13.04.19l-.95.95Z" })),
150
152
  'phone': () => (h("path", { fill: "currentColor", d: "M13.97 10.62 11.2 9.43a.6.6 0 0 0-.69.17l-1.23 1.5A9.137 9.137 0 0 1 4.9 6.72l1.5-1.23c.21-.17.28-.45.17-.69L5.38 2.03a.589.589 0 0 0-.68-.34l-2.57.59a.59.59 0 0 0-.46.58c0 6.34 5.14 11.48 11.48 11.48.28 0 .52-.19.58-.46l.59-2.57a.595.595 0 0 0-.35-.68Z" })),
151
153
  'picture': () => (h("path", { fill: "currentColor", d: "M14.33 12.93V3.07a1.4 1.4 0 0 0-1.4-1.4H3.07a1.4 1.4 0 0 0-1.4 1.4v9.86a1.4 1.4 0 0 0 1.4 1.4h9.86a1.4 1.4 0 0 0 1.4-1.4ZM5.54 9.06l1.76 2.11L9.76 8l3.17 4.22H3.07Z" })),
@@ -164,6 +166,8 @@ export const icons = {
164
166
  h("path", { key: "tags-2", fill: "currentColor", d: "M15 7.37 10.15 3a1.12 1.12 0 0 0-.77-.29H8.26l4.5 4.09a1.76 1.76 0 0 1 0 2.65L8.77 13a1.17 1.17 0 0 0 1.55 0L15 8.79a.94.94 0 0 0 0-1.42Z" }),
165
167
  ],
166
168
  'thumb-up': () => (h("path", { fill: "currentColor", d: "M2.11 14.36h1a.45.45 0 0 0 .45-.44V7.17a.45.45 0 0 0-.45-.44h-1a.44.44 0 0 0-.44.44v6.75a.44.44 0 0 0 .44.44Zm12.22-7a1.27 1.27 0 0 0-1.27-1.27H9.71l.61-2.91v-.2a1.07 1.07 0 0 0-.28-.68l-.68-.66-4.17 4.19a1.26 1.26 0 0 0-.37.9v6.36a1.27 1.27 0 0 0 1.27 1.27h5.06a1.24 1.24 0 0 0 1.17-.77l1.92-4.49a1.22 1.22 0 0 0 .09-.46V7.42Z" })),
169
+ 'thumbtack': () => (h("path", { fill: "currentColor", d: "M8.91 2 7.71 5.594 2.364 7.09 5.274 10l-.707.706-1.687 1.687-.264.264-.09.09-.209.498L2 14l.755-.317.498-.21.09-.089.264-.264 1.687-1.687.706-.706 2.91 2.908 1.496-5.347L14 7.09 8.91 2Z" })),
170
+ 'thumbtack-outline': () => (h("path", { fill: "currentColor", "fill-rule": "evenodd", d: "m5.273 10-2.91 2.91L2 14l1.09-.364L6 10.727l2.91 2.91 1.496-5.348L14 7.09 8.91 2 7.71 5.594 2.364 7.09 5.273 10Zm3.241-3.563-4.18 1.17 4.059 4.059 1.17-4.18 2.533-.845-2.737-2.737-.845 2.533Z" })),
167
171
  'trash': () => [
168
172
  h("path", { key: "trash-1", fill: "currentColor", d: "M3.27 14.17c0 .66.54 1.19 1.2 1.2h7l-.05-.02h.08c.64-.02 1.14-.56 1.12-1.2V4.32H3.27v9.85Zm5.97-7.12c0-.33.27-.6.6-.6s.6.27.6.6v5.3c0 .33-.27.6-.6.6s-.6-.27-.6-.6v-5.3Zm-3.5 0c0-.33.27-.59.6-.6.32.02.58.28.6.6v5.3c-.02.32-.28.58-.6.6a.645.645 0 0 1-.6-.6v-5.3Zm7.28-5.39h-2.6V.95a.28.28 0 0 0-.28-.28H5.87a.28.28 0 0 0-.28.28v.72H2.91a.28.28 0 0 0-.28.28V3.1c0 .15.12.28.28.28h10.11c.15 0 .28-.12.28-.28V1.94a.28.28 0 0 0-.28-.28Z" }),
169
173
  h("path", { key: "trash-2", fill: "currentColor", d: "M13,2h-2.9L9.9,1.6 C9.8,1.4,9.6,1.2,9.4,1.2H6.6c-0.2,0-0.4,0.1-0.5,0.3L5.8,2H2.9C2.7,2,2.5,2.2,2.5,2.4c0,0,0,0,0,0v0.8c0,0.2,0.2,0.4,0.4,0.4H13 c0.2,0,0.4-0.2,0.4-0.4V2.4C13.4,2.2,13.2,2,13,2z" }),
@@ -174,6 +178,10 @@ export const icons = {
174
178
  'upload': () => (h("path", { fill: "currentColor", d: "M9.58 10.74V6.59a.31.31 0 0 1 .31-.3H12a.3.3 0 0 0 .21-.52l-4-4a.29.29 0 0 0-.42 0l-4 4a.3.3 0 0 0 .21.52h2.11a.31.31 0 0 1 .31.3v4.15a.3.3 0 0 0 .3.3h2.56a.3.3 0 0 0 .3-.3ZM14.33 14v-1a.29.29 0 0 0-.29-.3H2a.29.29 0 0 0-.29.3v1a.29.29 0 0 0 .29.29h12a.29.29 0 0 0 .33-.29Z" })),
175
179
  'user': () => (h("path", { fill: "currentColor", d: "M8 8.79a3.56 3.56 0 1 0-3.56-3.56A3.56 3.56 0 0 0 8 8.79Zm3.17.79H9.8a4.27 4.27 0 0 1-3.6 0H4.83a3.16 3.16 0 0 0-3.16 3.17v.4a1.18 1.18 0 0 0 1.18 1.18h10.3a1.18 1.18 0 0 0 1.18-1.18v-.4a3.16 3.16 0 0 0-3.16-3.17Z" })),
176
180
  'user-circle': () => (h("path", { fill: "currentColor", d: "M8 .62C3.95.61.66 3.9.65 7.95c0 4.05 3.28 7.34 7.33 7.35 4.04 0 7.33-3.26 7.35-7.3.02-4.05-3.25-7.36-7.3-7.38H8Zm0 .75c3.64 0 6.59 2.96 6.58 6.6V8c0 1.35-.41 2.66-1.19 3.76a2.713 2.713 0 0 0-2.66-2.37H9.54c-.98.46-2.1.46-3.08 0H5.28c-1.36 0-2.5 1.02-2.67 2.37A6.483 6.483 0 0 1 1.42 8a6.59 6.59 0 0 1 6.55-6.63H8ZM5 5.63c0-1.68 1.37-3.05 3.05-3.05 1.68 0 3.05 1.37 3.05 3.05 0 1.68-1.37 3.05-3.05 3.05H8c-1.66-.03-3-1.39-3-3.05Z" })),
181
+ 'user-pen-fancy-outline': () => [
182
+ h("path", { fill: "currentColor", d: "M7.5 7a2.5 2.5 0 0 1 0-5 2.5 2.5 0 0 1 0 5Zm0-4C6.67 3 6 3.67 6 4.5S6.67 6 7.5 6 9 5.33 9 4.5 8.33 3 7.5 3ZM11.12 11.46l-.22.54-.3.77s-.04.09-.06.13c-.03.04-.06.07-.1.1-.05.04-.1.07-.16.08L7.52 14l-.07-.07 1.45-1.45h.13c.15 0 .27-.06.36-.16a.56.56 0 0 0 .1-.15c.01-.02.02-.04.03-.07v-.02s.01-.05.01-.08v-.03c0-.28-.23-.5-.51-.5-.28.01-.5.24-.5.51v.14l-.76.75-.14.13-.55.55-.07-.07.16-.48.1-.29.24-.71.42-1.27c.05-.16.17-.28.32-.32l1.31-.52 1.57 1.57ZM14.56 8.22l-2.05 1.87-.7.64-.06.05-.32.29-1.52-1.52.28-.31.06-.06.64-.7 1.88-2.04c1.16-1.31 3.11.61 1.79 1.78Z" }),
183
+ h("path", { fill: "currentColor", d: "M9 8H6c-2.21 0-4 1.79-4 4 0 .55.45 1 1 1h3.11l.33-1H3c0-1.66 1.34-3 3-3h3.05l.12-.13.71-.77C9.6 8.03 9.3 8 9 8Z" }),
184
+ ],
177
185
  'user-group': () => (h("path", { fill: "currentColor", d: "M13.15 4.12c-.81-.01-1.47.65-1.48 1.46 0 .82.65 1.47 1.46 1.48s1.47-.65 1.48-1.46-.65-1.47-1.46-1.48Zm-10.04.01a1.47 1.47 0 0 0-1.58 1.59c.06.71.62 1.28 1.34 1.34.81.07 1.52-.53 1.59-1.34.06-.81-.54-1.52-1.35-1.59Zm7.36.39c-.22-.84-.87-1.51-1.71-1.75-1.36-.41-2.8.36-3.22 1.72-.18.61-.13 1.27.14 1.85.41.9 1.33 1.48 2.32 1.45 1.41.01 2.56-1.14 2.57-2.55 0-.24-.03-.49-.1-.72Zm-.71 4h-.19c-.99.49-2.14.49-3.13 0h-.19c-1.46 0-2.64 1.18-2.64 2.64v2.69c1.23.93 2.74 1.47 4.39 1.47s3.17-.55 4.4-1.48v-2.68c0-1.46-1.18-2.64-2.64-2.64Zm5.52.25a7.282 7.282 0 0 1-1.65 3.91c-.08.1-.16.19-.25.28-.08.09-.17.18-.25.27v-.55h.03v-.72s.01-.07 0-.1v-.66c.01-1.25-.66-2.4-1.76-3 .27-.26.63-.41 1-.41h1.51c.63.01 1.17.41 1.37.98ZM2.86 11.16v1.52h.01v.55l-.28-.31c-.08-.08-.15-.16-.22-.24A7.238 7.238 0 0 1 .74 8.86c.16-.62.72-1.07 1.4-1.07h1.47c.37-.01.73.12 1.01.37-1.1.6-1.77 1.75-1.76 3Z" })),
178
186
  'user-plus': () => (h("path", { fill: "currentColor", d: "M14,3.33H12.65V2a.36.36,0,0,0-.35-.33h-.65A.36.36,0,0,0,11.3,2V3.33H10a.34.34,0,0,0-.33.34v.66a.34.34,0,0,0,.33.34H11.3V6a.37.37,0,0,0,.35.33h.65A.37.37,0,0,0,12.65,6V4.67H14a.34.34,0,0,0,.32-.34V3.67A.34.34,0,0,0,14,3.33ZM9.28,9.77h-.2a5.19,5.19,0,0,1-3.91,0H5A3,3,0,0,0,1.7,12.46h0v.72A1.27,1.27,0,0,0,3,14.33h8.25a1.26,1.26,0,0,0,1.36-1.14v-.68A3,3,0,0,0,9.37,9.76H9.28ZM7.13,3.7A2.64,2.64,0,1,1,4.5,6.34h0A2.64,2.64,0,0,1,7.13,3.7Z" })),
179
187
  'user-question-outline': () => (h("path", { fill: "currentColor", d: "M5.23 11.14c.86-.66 1.01-1.9.35-2.75s-1.9-1.01-2.75-.35a1.96 1.96 0 0 0 0 3.1c-.72.42-1.16 1.2-1.16 2.03v.8c0 .2.17.37.37.37h3.98c.2 0 .37-.17.37-.37v-.8c0-.83-.44-1.61-1.16-2.03ZM2.81 9.59c0-.67.55-1.22 1.22-1.22s1.22.55 1.22 1.22-.55 1.22-1.22 1.22-1.22-.55-1.22-1.22Zm2.83 4H2.41v-.42c0-.89.72-1.62 1.62-1.62s1.62.72 1.62 1.62v.42h-.01Zm7.13-11.93H8c-.86 0-1.56.7-1.56 1.56v7.16c0 .21.17.37.37.37.08 0 .16-.03.22-.07l1.49-1.12h4.25c.86 0 1.56-.7 1.56-1.56V3.22c0-.86-.7-1.56-1.56-1.56Zm.82 6.33c0 .45-.37.82-.82.82H8.4a.41.41 0 0 0-.22.07l-1 .75V3.22c0-.45.37-.82.82-.82h4.77c.45 0 .82.37.82.82v4.77Zm-2.8-.42c0 .23-.18.41-.41.41s-.41-.18-.41-.41.18-.41.41-.41c.23 0 .41.18.41.41Zm-.41-4.34c-.83 0-1.5.67-1.5 1.5 0 .23.18.41.41.41s.41-.18.41-.41c0-.38.31-.68.69-.68.38 0 .68.31.68.69 0 .38-.31.68-.68.68-.23 0-.41.18-.41.41v.44c0 .23.18.41.41.41s.41-.18.41-.41v-.09c.8-.23 1.26-1.06 1.04-1.85-.18-.65-.77-1.09-1.44-1.09Z" })),
@@ -157,6 +157,7 @@ export class MgTooltip {
157
157
  if (typeof newValue !== 'string' || newValue.trim() === '') {
158
158
  throw new Error('<mg-tooltip> prop "message" is required.');
159
159
  }
160
+ this.popper.update();
160
161
  }
161
162
  handleDisplay(newValue) {
162
163
  if (newValue) {
@@ -188,10 +189,13 @@ export class MgTooltip {
188
189
  this.tooltipedElement = interactiveElement || slotElement;
189
190
  // Check if slotted element is a disabled mg-button
190
191
  // In this case we wrap the mg-button into a div to enable the tooltip
191
- if (slotElement.tagName === 'MG-BUTTON') {
192
+ if (['MG-BUTTON', 'BUTTON'].includes(slotElement.tagName)) {
192
193
  new MutationObserver(mutationList => {
193
- if (mutationList.some(mutation => mutation.attributeName === 'aria-disabled')) {
194
+ if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {
194
195
  this.setMgButtonWrapper(slotElement);
196
+ // Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
197
+ // we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
198
+ this.resetGuard();
195
199
  this.initTooltip(slotElement, interactiveElement);
196
200
  }
197
201
  }).observe(slotElement, { attributes: true });
@@ -6,19 +6,6 @@ export var Direction;
6
6
  Direction["VERTICAL"] = "vertical";
7
7
  Direction["HORIZONTAL"] = "horizontal";
8
8
  })(Direction || (Direction = {}));
9
- /**
10
- * More item type guard
11
- *
12
- * @param {unknown} element element to control
13
- * @returns {boolean} truthy if element is more-item
14
- */
15
- export const isMoreItem = (element) => {
16
- var _a, _b, _c;
17
- const item = element;
18
- return (item === undefined ||
19
- (typeof item === 'object' &&
20
- (typeof item.size === 'string' || typeof ((_a = item.mgIcon) === null || _a === void 0 ? void 0 : _a.icon) === 'string' || typeof ((_b = item.slotLabel) === null || _b === void 0 ? void 0 : _b.label) === 'string' || typeof ((_c = item.slotLabel) === null || _c === void 0 ? void 0 : _c.display) === 'boolean')));
21
- };
22
9
  /**
23
10
  * List of all possibles sizes
24
11
  */
@@ -1,7 +1,5 @@
1
1
  import { h, Host } from '@stencil/core';
2
- import { OverflowBehavior, OverflowBehaviorElements } from '../../../../utils/behaviors.utils';
3
- import { Direction, isMoreItem, sizes } from './mg-menu.conf';
4
- import { initLocales } from '../../../../locales';
2
+ import { Direction, sizes } from './mg-menu.conf';
5
3
  export class MgMenu {
6
4
  constructor() {
7
5
  /************
@@ -45,45 +43,23 @@ export class MgMenu {
45
43
  });
46
44
  };
47
45
  /**
48
- * render mg-menu-more
46
+ * render mg-item-more
49
47
  *
50
- * @returns {HTMLElement} formated mg-menu-item element
51
- */
52
- this.renderMgMenuMore = () => {
53
- const moreElement = this.element.shadowRoot.querySelector(`[${OverflowBehaviorElements.MORE}]`);
54
- this.menuItems.forEach((child) => {
55
- const proxy = child.cloneNode(true);
56
- moreElement.querySelector('mg-menu').appendChild(proxy);
57
- });
58
- const allMenuItem = Array.from(this.element.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
59
- Array.from(moreElement.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
60
- // manage click on proxy to mirror it on initial element
61
- proxy.addEventListener('click', () => {
62
- (allMenuItem[index].shadowRoot.querySelector('a') || allMenuItem[index].shadowRoot.querySelector('button')).dispatchEvent(new MouseEvent('click', { bubbles: true }));
63
- });
64
- // manage status change miror in proxy
65
- allMenuItem[index].addEventListener('status-change', (event) => {
66
- proxy.setAttribute('status', event.detail);
67
- });
68
- });
69
- this.element.appendChild(moreElement);
70
- return this.element.querySelector(`[${OverflowBehaviorElements.MORE}]`);
71
- };
72
- /**
73
- * Render mg-menu-item more element for overflow behavior
74
- *
75
- * @returns {HTMLElement} rendered mg-menu-item more element
48
+ * @returns {void}
76
49
  */
77
- this.renderMgMenuItemMore = () => {
78
- var _a, _b, _c, _d, _e, _f, _g;
79
- return (h("mg-menu-item", { "data-overflow-more": true }, h("mg-icon", { icon: ((_b = (_a = this.moreitem) === null || _a === void 0 ? void 0 : _a.mgIcon) === null || _b === void 0 ? void 0 : _b.icon) || 'ellipsis-vertical', slot: "image" }), h("span", { class: { 'sr-only': !((_d = (_c = this.moreitem) === null || _c === void 0 ? void 0 : _c.slotLabel) === null || _d === void 0 ? void 0 : _d.display) }, slot: "label" }, ((_f = (_e = this.moreitem) === null || _e === void 0 ? void 0 : _e.slotLabel) === null || _f === void 0 ? void 0 : _f.label) || this.messages.moreLabel), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: (_g = this.moreitem) === null || _g === void 0 ? void 0 : _g.size })));
50
+ this.renderMgItemMore = () => {
51
+ // /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
52
+ // by doing this we prevent stencil to generate a circular dependencies graph at build time with mg-item-more component.
53
+ const item = 'mg-item-more';
54
+ const mgItemMore = document.createElement(item);
55
+ Object.assign(mgItemMore, this.itemMore);
56
+ this.element.appendChild(mgItemMore);
80
57
  };
81
58
  this.label = undefined;
82
59
  this.direction = Direction.HORIZONTAL;
83
- this.moreitem = undefined;
60
+ this.itemMore = undefined;
84
61
  this.size = 'regular';
85
62
  this.isChildMenu = undefined;
86
- this.hasOverflow = false;
87
63
  }
88
64
  validateLabel(newValue) {
89
65
  if (newValue === undefined) {
@@ -95,12 +71,9 @@ export class MgMenu {
95
71
  throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
96
72
  }
97
73
  }
98
- validateMoreItem(newValue) {
74
+ validateItemMore(newValue) {
99
75
  if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
100
- throw new Error(`<${this.name}> prop "moreitem" must be paired with direction ${Direction.HORIZONTAL}.`);
101
- }
102
- else if (newValue !== undefined && !isMoreItem(newValue)) {
103
- throw new Error(`<${this.name}> prop "moreitem" must match MoreItemType.`);
76
+ throw new Error(`<${this.name}> prop "itemMore" must be paired with direction ${Direction.HORIZONTAL}.`);
104
77
  }
105
78
  }
106
79
  validateSize(newValue) {
@@ -117,11 +90,9 @@ export class MgMenu {
117
90
  * @returns {void}
118
91
  */
119
92
  componentWillLoad() {
120
- this.messages = initLocales(this.element).messages.plusMenu;
121
- // validation
122
93
  this.validateDirection(this.direction);
123
94
  this.validateLabel(this.label);
124
- this.validateMoreItem(this.moreitem);
95
+ this.validateItemMore(this.itemMore);
125
96
  this.validateSize(this.size);
126
97
  }
127
98
  /**
@@ -137,36 +108,38 @@ export class MgMenu {
137
108
  // store all menu-items
138
109
  this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
139
110
  this.isChildMenu = this.element.closest('mg-menu-item') !== null;
140
- this.hasOverflow = this.direction === Direction.HORIZONTAL && !this.isChildMenu;
141
- if (this.hasOverflow && isMoreItem(this.moreitem))
142
- this.overflowBehavior = new OverflowBehavior(this.element, this.renderMgMenuMore);
111
+ // add mg-item-more to manage OverflowBehavior
112
+ if (this.direction === Direction.HORIZONTAL && !this.isChildMenu)
113
+ this.renderMgItemMore();
114
+ // use mutation observer to improve reactivity
115
+ new MutationObserver(entries => {
116
+ const mgItemMore = this.element.querySelector('mg-item-more');
117
+ // prevent infinit loop by exclude mg-item-more deletion entry
118
+ if (entries.some(entry => entry.type === 'childList' && Array.from(entry.removedNodes).some(node => node.nodeName === 'MG-ITEM-MORE')))
119
+ return;
120
+ else if (mgItemMore !== null) {
121
+ // render a new mg-item-more
122
+ mgItemMore.remove();
123
+ this.renderMgItemMore();
124
+ }
125
+ }).observe(this.element, { childList: true, characterData: true, subtree: true });
143
126
  }, 0);
144
127
  }
145
128
  /**
146
- * Check add listeners to childs
129
+ * Add listeners to items
147
130
  *
148
131
  * @returns {void}
149
132
  */
150
133
  componentDidRender() {
151
- // add menu items listeners
152
134
  this.initMenuItemsListeners();
153
135
  }
154
- /**
155
- * Disconnect overflow ResizeObserver
156
- *
157
- * @returns {void} run overflow resize obeserver disconnexion
158
- */
159
- disconnectedCallback() {
160
- if (this.hasOverflow)
161
- this.overflowBehavior.disconnect();
162
- }
163
136
  /**
164
137
  * Render
165
138
  *
166
139
  * @returns {HTMLElement} HTML Element
167
140
  */
168
141
  render() {
169
- return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null), this.hasOverflow && isMoreItem(this.moreitem) && this.renderMgMenuItemMore()));
142
+ return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
170
143
  }
171
144
  static get is() { return "mg-menu"; }
172
145
  static get encapsulation() { return "shadow"; }
@@ -222,14 +195,14 @@ export class MgMenu {
222
195
  "reflect": true,
223
196
  "defaultValue": "Direction.HORIZONTAL"
224
197
  },
225
- "moreitem": {
198
+ "itemMore": {
226
199
  "type": "unknown",
227
200
  "mutable": false,
228
201
  "complexType": {
229
- "original": "MoreItemType",
230
- "resolved": "{ mgIcon?: { icon: string; }; slotLabel?: { label?: string; display?: boolean; }; size?: \"regular\" | \"large\" | \"medium\"; }",
202
+ "original": "ItemMoreType",
203
+ "resolved": "{ size: \"regular\" | \"large\" | \"medium\"; icon: IconType; slotlabel: SlotLabelType; }",
231
204
  "references": {
232
- "MoreItemType": {
205
+ "ItemMoreType": {
233
206
  "location": "import",
234
207
  "path": "./mg-menu.conf"
235
208
  }
@@ -239,7 +212,7 @@ export class MgMenu {
239
212
  "optional": false,
240
213
  "docs": {
241
214
  "tags": [],
242
- "text": "Customize mg-menu \"more element\"\nUsed with direction: 'vertical' to manage overflow"
215
+ "text": "Customize \"mg-item-more\" element\nUsed with direction: 'vertical' to manage overflow"
243
216
  }
244
217
  },
245
218
  "size": {
@@ -269,8 +242,7 @@ export class MgMenu {
269
242
  }
270
243
  static get states() {
271
244
  return {
272
- "isChildMenu": {},
273
- "hasOverflow": {}
245
+ "isChildMenu": {}
274
246
  };
275
247
  }
276
248
  static get elementRef() { return "element"; }
@@ -282,8 +254,8 @@ export class MgMenu {
282
254
  "propName": "direction",
283
255
  "methodName": "validateDirection"
284
256
  }, {
285
- "propName": "moreitem",
286
- "methodName": "validateMoreItem"
257
+ "propName": "itemMore",
258
+ "methodName": "validateItemMore"
287
259
  }, {
288
260
  "propName": "size",
289
261
  "methodName": "validateSize"
@@ -28,7 +28,7 @@
28
28
  .mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,
29
29
  .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-regular {
30
30
  padding: 1rem 2rem;
31
- height: calc(3.8rem);
31
+ height: 3.8rem;
32
32
  }
33
33
  .mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button,
34
34
  .mg-menu-item.mg-menu-item--size-regular .mg-menu-item__navigation-button ::slotted([slot=label]),
@@ -50,7 +50,7 @@
50
50
  .mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,
51
51
  .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-medium {
52
52
  padding: 1rem 3rem;
53
- height: calc(5.1rem);
53
+ height: 5.1rem;
54
54
  }
55
55
  .mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button,
56
56
  .mg-menu-item.mg-menu-item--size-medium .mg-menu-item__navigation-button ::slotted([slot=label]),
@@ -72,7 +72,7 @@
72
72
  .mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,
73
73
  .mg-menu-item__navigation-button.mg-menu-item__navigation-button--size-large {
74
74
  padding: 1rem 4rem;
75
- height: calc(7.1rem);
75
+ height: 7.1rem;
76
76
  }
77
77
  .mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button,
78
78
  .mg-menu-item.mg-menu-item--size-large .mg-menu-item__navigation-button ::slotted([slot=label]),
@@ -1,6 +1,5 @@
1
1
  import { h, Host } from '@stencil/core';
2
- import { OverflowBehaviorElements } from '../../../../utils/behaviors.utils';
3
- import { ClassList } from '../../../../utils/components.utils';
2
+ import { ClassList, createID } from '../../../../utils/components.utils';
4
3
  import { initLocales } from '../../../../locales';
5
4
  import { Direction } from '../mg-menu/mg-menu.conf';
6
5
  import { Status } from './mg-menu-item.conf';
@@ -34,9 +33,91 @@ export class MgMenuItem {
34
33
  * Is component contextual direction match the given direction
35
34
  *
36
35
  * @param {MgMenuItem['direction']} direction in parent menu
36
+ * @param {MgMenuItem['direction']} compareWith direction to compare with. Default: `this.direction`
37
37
  * @returns {boolean} true is direction match the direction propertie
38
38
  */
39
- this.isDirection = (direction) => this.direction === direction;
39
+ this.isDirection = (direction, compareWith = this.direction) => direction === compareWith;
40
+ /**
41
+ * Update displayNotificationBadge
42
+ * current component notification badge have priority over the slot badge when submenu contain badge
43
+ *
44
+ * @returns {void} update displayNotificationBadge value
45
+ */
46
+ this.updateDisplayNotificationBadge = () => {
47
+ const childMenu = this.element.querySelector('mg-menu');
48
+ this.displayNotificationBadge =
49
+ childMenu !== null &&
50
+ Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);
51
+ };
52
+ /**
53
+ * Method to control if one of component children have active status
54
+ *
55
+ * @returns {boolean} truthy if component has active child
56
+ */
57
+ this.hasActiveChild = () => {
58
+ var _a;
59
+ return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).some((element) => element.nodeName === 'MG-MENU-ITEM' && this.hasStatus(element, Status.ACTIVE) && element.getAttribute('hidden') === null);
60
+ };
61
+ /**
62
+ * Validate slots
63
+ *
64
+ * @param {boolean} guard prevent action whith guard. Default: false.
65
+ * @returns {void}
66
+ */
67
+ this.validateSlot = (guard = false) => {
68
+ // slot title AND metadata validation
69
+ // add title on label AND metada slots due to text-overflow on these element
70
+ if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined)
71
+ throw new Error(`<${this.name}> slot "label" is required.`);
72
+ ['label', 'metadata'].forEach(slot => {
73
+ Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
74
+ if (element.textContent.trim().length < 1)
75
+ throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
76
+ if ((guard && element.getAttribute('title') === null) || !guard)
77
+ element.setAttribute('title', element.textContent);
78
+ });
79
+ });
80
+ };
81
+ /**
82
+ * Update status
83
+ *
84
+ * @param {Status[]} guard status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
85
+ * @returns {void}
86
+ */
87
+ this.updateStatus = (guard = []) => {
88
+ if (![Status.HIDDEN, Status.DISABLED, ...guard].includes(this.status)) {
89
+ this.status = this.hasActiveChild() ? Status.ACTIVE : Status.VISIBLE;
90
+ }
91
+ };
92
+ /**
93
+ * Init event-listeners
94
+ *
95
+ * @returns {void}
96
+ */
97
+ this.initListeners = () => {
98
+ var _a;
99
+ // manage first sub-level menu-items
100
+ Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).forEach(item => {
101
+ if (item.nodeName === 'MG-MENU-ITEM') {
102
+ // manage child menu listener
103
+ item.addEventListener('status-change', () => {
104
+ this.updateStatus();
105
+ });
106
+ }
107
+ });
108
+ };
109
+ /**
110
+ * Get mg-popover identifier
111
+ *
112
+ * @returns {MgPopover['identifier']} generated mg-popover identifier
113
+ */
114
+ this.getPopoverIdentifier = () => `${this.identifier}-popover`;
115
+ /**
116
+ * Condition to know if component should display a mg-popover
117
+ *
118
+ * @returns {boolean} truthy if component display popover
119
+ */
120
+ this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
40
121
  /************
41
122
  * Handlers *
42
123
  ************/
@@ -64,35 +145,13 @@ export class MgMenuItem {
64
145
  this.handlePopoverDisplay = (event) => {
65
146
  this.expanded = event.detail;
66
147
  };
67
- /**
68
- * Update displayNotificationBadge
69
- * current component notification badge have priority over the slot badge when submenu contain badge
70
- *
71
- * @returns {void} update displayNotificationBadge value
72
- */
73
- this.updateDisplayNotificationBadge = () => {
74
- const childMenu = this.element.querySelector('mg-menu');
75
- this.displayNotificationBadge =
76
- childMenu !== null &&
77
- Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && subItem.getAttribute('hidden') === null);
78
- };
79
- /**
80
- * Method to control if one of component children have active status
81
- *
82
- * @returns {boolean} truthy if component has active child
83
- */
84
- this.hasActiveChild = () => {
85
- var _a;
86
- return Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || [])
87
- .filter(element => element.nodeName === 'MG-MENU-ITEM')
88
- .some((element) => this.hasStatus(element, Status.ACTIVE) && element.getAttribute('hidden') === null);
89
- };
90
148
  /**
91
149
  * Render slot
92
150
  *
93
151
  * @returns {HTMLElement} HTML Element
94
152
  */
95
153
  this.renderSlot = () => h("slot", null);
154
+ this.identifier = createID('mg-menu-item');
96
155
  this.href = undefined;
97
156
  this.status = Status.VISIBLE;
98
157
  this.expanded = false;
@@ -100,6 +159,7 @@ export class MgMenuItem {
100
159
  this.navigationButtonClassList = new ClassList([this.navigationButton]);
101
160
  this.direction = undefined;
102
161
  this.isInMainMenu = undefined;
162
+ this.isItemMore = undefined;
103
163
  this.hasChildren = false;
104
164
  this.displayNotificationBadge = undefined;
105
165
  }
@@ -136,11 +196,33 @@ export class MgMenuItem {
136
196
  this.navigationButtonClassList.delete(`${this.navigationButton}--size-${oldValue}`);
137
197
  this.navigationButtonClassList.add(`${this.navigationButton}--size-${newValue}`);
138
198
  }
199
+ validateDirection(newValue) {
200
+ // manage menu items style depending to parent menu horientation
201
+ this.element.setAttribute(`data-style-direction-${newValue}`, '');
202
+ this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
203
+ // manage all sub levels child menu-items level with data-level attribut
204
+ if (this.isDirection(Direction.VERTICAL, newValue)) {
205
+ Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
206
+ item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
207
+ });
208
+ }
209
+ }
139
210
  validateHasChildren(newValue) {
140
211
  if (newValue && this.element.href !== undefined) {
141
212
  throw new Error(`<${this.name}> prop "href" is unauthorizied when element is a parent.`);
142
213
  }
143
214
  }
215
+ /**
216
+ * Render popover clickoutside guard for content slot
217
+ *
218
+ * @returns {void}
219
+ */
220
+ updatePopoverGuard() {
221
+ if (this.displayPopover())
222
+ Array.from(this.element.children)
223
+ .filter((child) => child.getAttribute('slot') === null && child.nodeName !== 'MG-MENU' && Boolean(child.dataset))
224
+ .forEach((slot) => (slot.dataset.mgPopoverGuard = this.getPopoverIdentifier()));
225
+ }
144
226
  /*************
145
227
  * Lifecycle *
146
228
  *************/
@@ -153,11 +235,13 @@ export class MgMenuItem {
153
235
  // has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
154
236
  // we store only matching elements
155
237
  this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
238
+ this.badgeLabel = initLocales(this.element).messages.plusMenu.badgeLabel;
239
+ this.isItemMore = this.element.dataset.overflowMore !== undefined;
156
240
  // Validate props
157
- this.validateSize(this.size);
158
241
  this.validateStatus(this.status);
159
242
  this.validateExpanded(this.expanded);
160
- this.badgeLabel = initLocales(this.element).messages.plusMenu.badgeLabel;
243
+ // Validate states
244
+ this.validateSize(this.size);
161
245
  }
162
246
  /**
163
247
  * Check if component slots configuration
@@ -165,63 +249,36 @@ export class MgMenuItem {
165
249
  * @returns {ReturnType<typeof setTimeout>} timeout
166
250
  */
167
251
  componentDidLoad() {
168
- // slot title AND metadata validation
169
- // add title on label AND metada slots due to text-overflow on these element
170
- if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined)
171
- throw new Error(`<${this.name}> slot "label" is required.`);
172
- ['label', 'metadata'].forEach(slot => {
173
- Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
174
- if (element.textContent.trim().length < 1)
175
- throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
176
- if (element.getAttribute('title') === null)
177
- element.setAttribute('title', element.textContent);
178
- });
179
- });
252
+ // validation
253
+ this.validateSlot(true);
180
254
  // update props and states after componentDidLoad hook
181
255
  // return a promise to process action only in the FIRST render().
182
256
  // https://stenciljs.com/docs/component-lifecycle#componentwillload
183
257
  return setTimeout(() => {
184
- var _a;
185
258
  // define menu-item context states
186
259
  const menu = this.element.closest('mg-menu');
187
- this.direction = this.element.getAttribute(OverflowBehaviorElements.MORE) !== null || menu === null ? Direction.HORIZONTAL : menu.direction;
188
- this.size = menu === null || menu === void 0 ? void 0 : menu.size;
189
- this.isInMainMenu = this.element.parentElement.closest('mg-menu-item') === null;
260
+ this.direction = this.isItemMore || menu === null ? Direction.HORIZONTAL : menu.direction;
261
+ this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;
262
+ if ((menu === null || menu === void 0 ? void 0 : menu.size) !== undefined)
263
+ this.size = menu.size;
264
+ if (this.isItemMore)
265
+ this.size = this.element.dataset.size;
190
266
  // when main menu item contain an active item it will get the active style
191
267
  // AND if item is in vertical menu it will be expanded
192
- if (this.hasActiveChild()) {
193
- this.status = Status.ACTIVE;
194
- if (this.isInMainMenu)
195
- this.expanded = this.isDirection(Direction.VERTICAL);
196
- }
197
- // manage menu items style depending to parent menu horientation
198
- this.element.setAttribute(`data-style-direction-${this.direction}`, '');
199
- this.navigationButtonClassList.add(`${this.navigationButton}--${this.direction}`);
268
+ if (this.hasActiveChild() && this.isInMainMenu)
269
+ this.expanded = this.isDirection(Direction.VERTICAL);
270
+ this.updateStatus([Status.ACTIVE]);
200
271
  this.updateDisplayNotificationBadge();
201
- // manage all sub levels child menu-items level with data-level attribut
202
- if (this.isDirection(Direction.VERTICAL)) {
203
- Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
204
- item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
205
- });
206
- }
207
- // manage first sub-level menu-items
208
- const childItems = Array.from(((_a = this.element.querySelector('mg-menu')) === null || _a === void 0 ? void 0 : _a.children) || []).filter(item => item.nodeName === 'MG-MENU-ITEM');
209
- childItems.forEach(item => {
210
- const updateStatus = () => {
211
- if (![Status.HIDDEN, Status.DISABLED].includes(this.status)) {
212
- this.status = this.hasActiveChild() ? Status.ACTIVE : Status.VISIBLE;
213
- }
214
- };
215
- // manage child menu listener
216
- item.addEventListener('status-change', () => {
217
- updateStatus();
218
- });
219
- new MutationObserver(mutationsList => {
220
- if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
221
- updateStatus();
222
- this.updateDisplayNotificationBadge();
223
- }).observe(item, { attributes: true });
224
- });
272
+ this.updatePopoverGuard();
273
+ // manage child dom changes with mutationObserver and listzners
274
+ this.initListeners();
275
+ new MutationObserver(mutationsList => {
276
+ if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
277
+ this.updateStatus();
278
+ if (mutationsList.some(mutation => mutation.type === 'characterData'))
279
+ this.validateSlot();
280
+ this.updateDisplayNotificationBadge();
281
+ }).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });
225
282
  }, 0);
226
283
  }
227
284
  /**
@@ -247,7 +304,7 @@ export class MgMenuItem {
247
304
  [`${this.name}__collapse-container`]: true,
248
305
  [`${this.name}__collapse-container--first-level`]: this.isInMainMenu && this.isDirection(Direction.HORIZONTAL),
249
306
  });
250
- return (h(Host, { role: "menuitem", "aria-haspopup": this.hasChildren.toString() }, this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
307
+ return (h(Host, { role: !this.isItemMore && 'menuitem', "aria-haspopup": !this.isItemMore && this.hasChildren.toString() }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier() }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
251
308
  this.renderInteractiveElement(),
252
309
  h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
253
310
  ])));
@@ -266,6 +323,24 @@ export class MgMenuItem {
266
323
  }
267
324
  static get properties() {
268
325
  return {
326
+ "identifier": {
327
+ "type": "string",
328
+ "mutable": false,
329
+ "complexType": {
330
+ "original": "string",
331
+ "resolved": "string",
332
+ "references": {}
333
+ },
334
+ "required": false,
335
+ "optional": false,
336
+ "docs": {
337
+ "tags": [],
338
+ "text": "Identifier is used to control mg-popover\nDefault: createID('mg-menu-item');"
339
+ },
340
+ "attribute": "identifier",
341
+ "reflect": false,
342
+ "defaultValue": "createID('mg-menu-item')"
343
+ },
269
344
  "href": {
270
345
  "type": "string",
271
346
  "mutable": false,
@@ -332,6 +407,7 @@ export class MgMenuItem {
332
407
  "navigationButtonClassList": {},
333
408
  "direction": {},
334
409
  "isInMainMenu": {},
410
+ "isItemMore": {},
335
411
  "hasChildren": {},
336
412
  "displayNotificationBadge": {}
337
413
  };
@@ -369,6 +445,9 @@ export class MgMenuItem {
369
445
  }, {
370
446
  "propName": "size",
371
447
  "methodName": "validateSize"
448
+ }, {
449
+ "propName": "direction",
450
+ "methodName": "validateDirection"
372
451
  }, {
373
452
  "propName": "hasChildren",
374
453
  "methodName": "validateHasChildren"