@mgdis/mg-components 4.2.1 → 5.0.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 (65) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/{mg-badge_23.cjs.entry.js → mg-badge_24.cjs.entry.js} +2032 -42
  3. package/dist/cjs/mg-components.cjs.js +1 -1
  4. package/dist/cjs/mg-modal.cjs.entry.js +1 -3
  5. package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -3
  6. package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -2
  7. package/dist/collection/components/atoms/mg-button/mg-button.css +106 -68
  8. package/dist/collection/components/atoms/mg-button/mg-button.js +51 -64
  9. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +3 -0
  10. package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -3
  11. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +4 -6
  12. package/dist/collection/components/molecules/inputs/MgInput.js +1 -3
  13. package/dist/collection/components/molecules/mg-form/mg-form.js +2 -3
  14. package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -1
  15. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +15 -7
  16. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +27 -2
  17. package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +1 -1
  18. package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -3
  19. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -3
  20. package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -1
  21. package/dist/collection/components/molecules/mg-panel/mg-panel.css +8 -7
  22. package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -4
  23. package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -2
  24. package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -8
  25. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -3
  26. package/dist/collection/variables.css +6 -0
  27. package/dist/components/MgInput.js +1 -3
  28. package/dist/components/mg-badge2.js +1 -3
  29. package/dist/components/mg-button2.js +44 -13
  30. package/dist/components/mg-form.js +2 -3
  31. package/dist/components/mg-icon2.js +3 -0
  32. package/dist/components/mg-illustrated-message.js +12 -4
  33. package/dist/components/mg-input-title2.js +1 -3
  34. package/dist/components/mg-modal.js +1 -3
  35. package/dist/components/mg-pagination.js +4 -3
  36. package/dist/components/mg-panel.js +3 -5
  37. package/dist/components/mg-popover.js +9 -9
  38. package/dist/components/mg-tabs.js +1 -3
  39. package/dist/components/mg-tooltip2.js +6 -7
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/{mg-badge_23.entry.js → mg-badge_24.entry.js} +2032 -43
  42. package/dist/esm/mg-components.js +1 -1
  43. package/dist/esm/mg-modal.entry.js +1 -3
  44. package/dist/mg-components/mg-components.css +1 -1
  45. package/dist/mg-components/mg-components.esm.js +1 -1
  46. package/dist/mg-components/p-b60a4c53.entry.js +1 -0
  47. package/dist/mg-components/p-df947fa5.entry.js +1 -0
  48. package/dist/mg-components/variables.css +6 -0
  49. package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +2 -2
  50. package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +5 -1
  51. package/dist/types/components/atoms/mg-button/mg-button.d.ts +19 -17
  52. package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +4 -0
  53. package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +1 -0
  54. package/dist/types/components.d.ts +13 -29
  55. package/package.json +1 -1
  56. package/dist/cjs/mg-popover.cjs.entry.js +0 -171
  57. package/dist/cjs/popper-11d5f714.js +0 -1801
  58. package/dist/collection/variables.scss +0 -212
  59. package/dist/esm/mg-popover.entry.js +0 -167
  60. package/dist/esm/popper-f860750c.js +0 -1799
  61. package/dist/mg-components/p-25452f60.entry.js +0 -1
  62. package/dist/mg-components/p-a20fc541.entry.js +0 -1
  63. package/dist/mg-components/p-e08bc19a.entry.js +0 -1
  64. package/dist/mg-components/p-ec26fc38.js +0 -1
  65. package/dist/mg-components/variables.scss +0 -212
@@ -1,6 +1,5 @@
1
- import { r as registerInstance, h, g as getElement, c as createEvent, H as Host } from './index-aad0184c.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-aad0184c.js';
2
2
  import { C as ClassList, i as initLocales, c as createID, a as isTagName, b as allItemsAreString } from './index-7efedd97.js';
3
- import { c as createPopper } from './popper-f860750c.js';
4
3
 
5
4
  /**
6
5
  * List of all possibles variants
@@ -33,9 +32,7 @@ const MgBadge = class {
33
32
  }
34
33
  validateLabel(newValue) {
35
34
  if (typeof newValue !== 'string' || newValue.trim() === '') {
36
- // TODO: throw new Error on next major (5.0.0)
37
- // throw new Error('<mg-badge> prop "label" is required.');
38
- console.error('<mg-badge> prop "label" is required.');
35
+ throw new Error('<mg-badge> prop "label" is required.');
39
36
  }
40
37
  }
41
38
  validateVariant(newValue, oldValue) {
@@ -88,7 +85,7 @@ MgBadge.style = mgBadgeCss;
88
85
  */
89
86
  const variants$3 = ['primary', 'secondary', 'danger', 'danger-alt', 'info', 'flat', 'success'];
90
87
 
91
- const mgButtonCss = ".mg-button.sc-mg-button{position:relative;display:inline-flex;align-items:center;column-gap:0.6rem;padding:calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;min-height:var(--default-size);box-sizing:border-box;border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));cursor:pointer;background-image:none;border-top-width:var(--mg-button-border-top-width, 0.1rem);border-right-width:var(--mg-button-border-right-width, 0.1rem);border-bottom-width:var(--mg-button-border-bottom-width, 0.1rem);border-left-width:var(--mg-button-border-left-width, 0.1rem);border-style:solid;font-family:inherit;text-decoration:none;font-weight:normal;text-align:left;touch-action:manipulation}.mg-button[disabled].sc-mg-button,.mg-button[aria-disabled=true].sc-mg-button,.mg-button.disabled.sc-mg-button{opacity:var(--mg-button-disabled-opacity);cursor:default}.mg-button.mg-button--icon.sc-mg-button{padding:0;justify-content:center;width:var(--default-size);height:var(--default-size);border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-button.mg-button--primary.sc-mg-button{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-primary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)))}.mg-button.mg-button--primary.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--primary.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--primary.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-button.mg-button--secondary.sc-mg-button{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-secondary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)))}.mg-button.mg-button--secondary.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--secondary.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--secondary.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-button.mg-button--danger.sc-mg-button{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)))}.mg-button.mg-button--danger.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt.sc-mg-button{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-danger));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)))}.mg-button.mg-button--danger-alt.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger-alt.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--danger-alt.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info.sc-mg-button{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)))}.mg-button.mg-button--info.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--info.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--info.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--success.sc-mg-button{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-dark));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)))}.mg-button.mg-button--success.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--success.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--success.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-button.mg-button--flat.sc-mg-button{background:none;border:none}.mg-button.mg-button--flat.sc-mg-button:hover:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--flat.sc-mg-button:focus:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button,.mg-button.mg-button--flat.sc-mg-button:active:not([disabled],[aria-disabled=true].sc-mg-button,.disabled).sc-mg-button{background:hsla(var(--color-dark), 0.1)}.mg-button.sc-mg-button mg-icon.sc-mg-button:only-child,.mg-button .sc-mg-button-s>mg-icon{display:inline-flex;flex-shrink:0;line-height:1;margin:auto 0}.mg-button.mg-button--loading.sc-mg-button>mg-icon.sc-mg-button{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.mg-button.mg-button--loading.sc-mg-button .mg-button__content.sc-mg-button{opacity:0}.mg-button__content.sc-mg-button{display:flex;align-items:center;column-gap:0.6rem}mg-button.sc-mg-button{display:inline-block}.mg-button.sc-mg-button,mg-button.sc-mg-button{vertical-align:middle;max-width:100%}";
88
+ const mgButtonCss = ":host{display:inline-block;vertical-align:middle;max-width:100%}:host(:focus-visible){outline:0}:host(:focus-visible) .mg-button:not(.mg-button--disabled){outline-color:-webkit-focus-ring-color;outline-style:auto;outline-width:0.2rem}:host(:hover) .mg-button--flat:not(.mg-button--disabled),:host(:focus) .mg-button--flat:not(.mg-button--disabled),:host(:active) .mg-button--flat:not(.mg-button--disabled){background:hsla(var(--color-dark), 0.1)}.mg-button.mg-button--primary{border-color:hsl(var(--mg-button-primary-border-color, var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-primary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l)), hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), calc(var(--mg-button-primary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--primary:not(.mg-button--disabled),:host(:focus) .mg-button--primary:not(.mg-button--disabled),:host(:active) .mg-button--primary:not(.mg-button--disabled){background:hsl(var(--mg-button-primary-color-h), var(--mg-button-primary-color-s), var(--mg-button-primary-color-l))}.mg-button.mg-button--secondary{border-color:hsl(var(--mg-button-secondary-border-color, var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--mg-button-secondary-font-color));background:linear-gradient(to bottom, hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l)), hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), calc(var(--mg-button-secondary-color-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--secondary:not(.mg-button--disabled),:host(:focus) .mg-button--secondary:not(.mg-button--disabled),:host(:active) .mg-button--secondary:not(.mg-button--disabled){background:hsl(var(--mg-button-secondary-color-h), var(--mg-button-secondary-color-s), var(--mg-button-secondary-color-l))}.mg-button.mg-button--danger{border-color:hsl(var(--mg-button-danger-border-color, var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l)), hsl(var(--color-danger-h), var(--color-danger-s), calc(var(--color-danger-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger:not(.mg-button--disabled),:host(:focus) .mg-button--danger:not(.mg-button--disabled),:host(:active) .mg-button--danger:not(.mg-button--disabled){background:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-button.mg-button--danger-alt{border-color:hsl(var(--mg-button-danger-alt-border-color, var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-danger));background:linear-gradient(to bottom, hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l)), hsl(var(--color-neutral-h), var(--color-neutral-s), calc(var(--color-neutral-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--danger-alt:not(.mg-button--disabled),:host(:focus) .mg-button--danger-alt:not(.mg-button--disabled),:host(:active) .mg-button--danger-alt:not(.mg-button--disabled){background:hsl(var(--color-neutral-h), var(--color-neutral-s), var(--color-neutral-l))}.mg-button.mg-button--info{border-color:hsl(var(--mg-button-info-border-color, var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-neutral));background:linear-gradient(to bottom, hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l)), hsl(var(--color-info-h), var(--color-info-s), calc(var(--color-info-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--info:not(.mg-button--disabled),:host(:focus) .mg-button--info:not(.mg-button--disabled),:host(:active) .mg-button--info:not(.mg-button--disabled){background:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-button.mg-button--success{border-color:hsl(var(--mg-button-success-border-color, var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-border-variation) * 10%)));color:hsl(var(--color-dark));background:linear-gradient(to bottom, hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l)), hsl(var(--color-success-h), var(--color-success-s), calc(var(--color-success-l) - var(--mg-button-gradient) * 10%)))}:host(:hover) .mg-button--success:not(.mg-button--disabled),:host(:focus) .mg-button--success:not(.mg-button--disabled),:host(:active) .mg-button--success:not(.mg-button--disabled){background:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-button{position:relative;display:inline-flex;align-items:center;column-gap:0.6rem;padding:calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;min-height:var(--default-size);box-sizing:border-box;border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-border-radius));cursor:pointer;background-image:none;border-top-width:var(--mg-button-border-top-width, 0.1rem);border-right-width:var(--mg-button-border-right-width, 0.1rem);border-bottom-width:var(--mg-button-border-bottom-width, 0.1rem);border-left-width:var(--mg-button-border-left-width, 0.1rem);border-style:solid;text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);touch-action:manipulation}.mg-button.mg-button--disabled{opacity:var(--mg-button-disabled-opacity);cursor:default}.mg-button.mg-button--icon{padding:0;justify-content:center;width:var(--default-size);height:var(--default-size);border-top-right-radius:var(--mg-button-border-radius-top-right, var(--mg-button-icon-border-radius));border-top-left-radius:var(--mg-button-border-radius-top-left, var(--mg-button-icon-border-radius));border-bottom-right-radius:var(--mg-button-border-radius-bottom-right, var(--mg-button-icon-border-radius));border-bottom-left-radius:var(--mg-button-border-radius-bottom-left, var(--mg-button-icon-border-radius));font-size:var(--font-size);line-height:var(--font-size)}.mg-button.mg-button--flat{background:none;border:none}.mg-button.mg-button--loading>mg-icon:first-of-type{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%)}.mg-button.mg-button--loading .mg-button__content{opacity:0}.mg-button mg-icon:only-child,.mg-button ::slotted(mg-icon){display:inline-flex;flex-shrink:0;line-height:1;margin:auto 0}.mg-button slot,.mg-button ::slotted(*:not(mg-icon)){text-decoration:none;font-family:inherit;font-weight:var(--mg-button-font-weight, normal);text-align:left;font-size:var(--font-size);display:flex;align-items:center;column-gap:0.6rem}";
92
89
 
93
90
  const MgButton = class {
94
91
  constructor(hostRef) {
@@ -97,6 +94,8 @@ const MgButton = class {
97
94
  * Internal *
98
95
  ************/
99
96
  this.onClickElementFn = null;
97
+ this.classDisabled = 'mg-button--disabled';
98
+ this.classLoading = 'mg-button--loading';
100
99
  /**
101
100
  * Define button variant
102
101
  */
@@ -131,11 +130,38 @@ const MgButton = class {
131
130
  if (this.disabled)
132
131
  event.stopPropagation();
133
132
  // Used to prevent multi-click.
134
- if (this.disableOnClick && !this.disabled) {
133
+ else if (this.disableOnClick) {
135
134
  this.loading = true;
136
135
  this.disabled = true;
137
136
  }
138
137
  };
138
+ /**
139
+ * Handle onKeyDown event
140
+ *
141
+ * @param {KeyboardEvent} event keyboard event
142
+ * @returns {void}
143
+ */
144
+ this.handleKeydown = (event) => {
145
+ if (!this.disabled && event.key === ' ') {
146
+ event.preventDefault();
147
+ }
148
+ else if (!this.disabled && ['Enter', 'NumpadEnter', 'Space'].includes(event.key)) {
149
+ event.preventDefault();
150
+ this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
151
+ }
152
+ };
153
+ /**
154
+ * Handle onKeyUp event
155
+ *
156
+ * @param {KeyboardEvent} event keyboard event
157
+ * @returns {void}
158
+ */
159
+ this.handleKeyup = (event) => {
160
+ if (!this.disabled && event.key === ' ') {
161
+ event.preventDefault();
162
+ this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
163
+ }
164
+ };
139
165
  }
140
166
  validateVariant(newValue, oldValue) {
141
167
  if (!variants$3.includes(newValue)) {
@@ -156,14 +182,21 @@ const MgButton = class {
156
182
  }
157
183
  // Manage if onclick
158
184
  this.element.onclick = isDisabled ? undefined : this.onClickElementFn;
185
+ // apply style
186
+ if (isDisabled) {
187
+ this.classList.add(this.classDisabled);
188
+ }
189
+ else {
190
+ this.classList.delete(this.classDisabled);
191
+ }
159
192
  }
160
193
  loadingHandler(newValue) {
161
194
  // we add loading style if it newvalue is true else we remove it
162
195
  if (newValue) {
163
- this.classList.add('mg-button--loading');
196
+ this.classList.add(this.classLoading);
164
197
  }
165
198
  else {
166
- this.classList.delete('mg-button--loading');
199
+ this.classList.delete(this.classLoading);
167
200
  }
168
201
  }
169
202
  /**
@@ -189,10 +222,7 @@ const MgButton = class {
189
222
  * @returns {HTMLElement} html element
190
223
  */
191
224
  render() {
192
- return (h("button", { id: this.identifier, class: this.classList.join(), type: this.type, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": this.controls, "aria-haspopup": this.haspopup !== undefined && this.haspopup.toString(), onClick: this.handleClick,
193
- // has stencil does not support form attribute on button, we set the attribute from the ref
194
- // https://github.com/ionic-team/stencil/issues/2703#issuecomment-1050943715
195
- ref: btn => this.form && btn.setAttribute('form', this.form) }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null))));
225
+ return (h(Host, { role: "button", tabIndex: this.disabled ? -1 : 0, type: this.type, form: this.form, "aria-label": this.label, "aria-disabled": this.disabled !== undefined && this.disabled.toString(), onClick: this.handleClick, onKeyUp: this.handleKeyup, onKeyDown: this.handleKeydown }, h("div", { class: this.classList.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { class: "mg-button__content" }, h("slot", null)))));
196
226
  }
197
227
  get element() { return getElement(this); }
198
228
  static get watchers() { return {
@@ -424,9 +454,8 @@ const MgForm = class {
424
454
  */
425
455
  componentDidLoad() {
426
456
  this.mgButtons.forEach(mgButton => {
427
- // submit buttons should trigger form submition
428
- const button = mgButton.querySelector('button');
429
- if (['submit', null].includes(button.getAttribute('type'))) {
457
+ // submit buttons should trigger form submition;
458
+ if (['submit', null].includes(mgButton.getAttribute('type'))) {
430
459
  mgButton.addEventListener('click', () => {
431
460
  this.form.dispatchEvent(new CustomEvent('submit', { bubbles: true }));
432
461
  });
@@ -496,6 +525,8 @@ const icons = {
496
525
  'dashboard': () => h("path", { fill: "currentColor", d: "M1.67 8.7H7.3V1.67H1.67v7.04Zm0 5.63H7.3v-4.22H1.67v4.22Zm7.04 0h5.63V7.3H8.71v7.04Zm0-12.67v4.23h5.63V1.67H8.71Z" }),
497
526
  'dashboard-outline': () => (h("path", { fill: "currentColor", d: "M13.33 2.67v2.22H9.7V2.67h3.63m-7.04 0V7.7H2.67V2.67H6.3m7.04 5.63v5.04H9.71V8.3h3.63M6.3 11.11v2.22H2.67v-2.22H6.3m8.03-9.44H8.7v4.22h5.63V1.67Zm-7.04 0H1.67v7.04H7.3V1.67Zm7.04 5.63H8.7v7.04h5.63V7.3Zm-7.04 2.81H1.67v4.22H7.3v-4.22Z" })),
498
527
  'download': () => (h("path", { fill: "currentColor", d: "M6.4 2v4.1c0 .2-.1.3-.3.3H4c-.2 0-.3.1-.3.3 0 .1 0 .2.1.2l4 4c.1.1.3.1.4 0l4-4c.1-.1.1-.3 0-.4-.1-.1-.1-.1-.2-.1H9.9c-.2 0-.3-.1-.3-.3V2c0-.2-.1-.3-.3-.3H6.7c-.1 0-.3.1-.3.3zm7.9 11v1c0 .2-.1.3-.3.3H2c-.2 0-.3-.1-.3-.3v-1c0-.2.1-.3.3-.3h12c.2 0 .3.1.3.3z" })),
528
+ 'ellipsis': () => (h("path", { fill: "currentColor", d: "M2.5 6.17A1.83 1.83 0 1 0 4.33 8c0-1.01-.82-1.83-1.83-1.83Zm11 0A1.83 1.83 0 1 0 15.33 8c0-1.01-.82-1.83-1.83-1.83Zm-5.5 0A1.83 1.83 0 1 0 9.83 8c0-1.01-.82-1.83-1.83-1.83Z" })),
529
+ 'ellipsis-vertical': () => (h("path", { fill: "currentColor", d: "M6.17 13.5A1.83 1.83 0 1 0 8 11.67c-1.01 0-1.83.82-1.83 1.83Zm0-11A1.83 1.83 0 1 0 8 .67c-1.01 0-1.83.82-1.83 1.83Zm0 5.5A1.83 1.83 0 1 0 8 6.17c-1.01 0-1.83.82-1.83 1.83Z" })),
499
530
  'euro': () => (h("path", { fill: "currentColor", d: "M13 13.14a.4.4 0 0 0-.47-.31A7.79 7.79 0 0 1 11 13a4.31 4.31 0 0 1-4-2.79h3.8a.41.41 0 0 0 .39-.31l.19-.9a.39.39 0 0 0-.3-.47H6.51a7.07 7.07 0 0 1 0-1.38h4.89a.4.4 0 0 0 .39-.31l.22-1a.4.4 0 0 0-.3-.47H7a4.2 4.2 0 0 1 3.92-2.45 6.57 6.57 0 0 1 1.26.14.41.41 0 0 0 .47-.29l.4-1.45a.4.4 0 0 0-.28-.48A9.43 9.43 0 0 0 11 .67a7.12 7.12 0 0 0-6.83 4.7h-1.1a.4.4 0 0 0-.4.39v1a.4.4 0 0 0 .4.39h.72a9.08 9.08 0 0 0 0 1.38h-.72a.39.39 0 0 0-.4.39v.93a.4.4 0 0 0 .4.39h1A7 7 0 0 0 11 15.3a8.7 8.7 0 0 0 2-.25.39.39 0 0 0 .3-.46l-.3-1.45Z" })),
500
531
  'euro-circle': () => (h("path", { fill: "currentColor", d: "M8 .67C3.95.67.67 3.95.67 8S3.95 15.33 8 15.33s7.33-3.28 7.33-7.33S12.05.67 8 .67Zm2.27 11.4c-.38.09-.76.14-1.15.14a4.038 4.038 0 0 1-3.99-2.92h-.58c-.13 0-.23-.1-.23-.22v-.54c0-.12.11-.22.23-.22h.41a5.34 5.34 0 0 1 0-.8h-.41c-.13 0-.23-.1-.23-.22v-.58c0-.13.11-.22.23-.22h.63c.6-1.65 2.18-2.74 3.94-2.71.34 0 .68.03 1.02.1.12.03.19.16.16.28l-.23.84c-.03.12-.15.19-.27.17-.24-.05-.48-.08-.73-.08A2.42 2.42 0 0 0 6.81 6.5h2.71c.12.03.2.15.17.27l-.13.58c-.02.1-.12.18-.22.18H6.52c-.03.26-.03.53 0 .8h2.63c.12.03.2.15.17.27l-.11.52c-.03.1-.12.18-.22.18H6.8c.36.96 1.28 1.6 2.31 1.61.3 0 .59-.04.88-.1.12-.02.24.05.27.18l.17.84c.02.12-.05.24-.17.27v-.03Z" })),
501
532
  'exclamation-circle': () => (h("path", { fill: "currentColor", d: "M8 15.33c4.05 0 7.33-3.28 7.33-7.33S12.05.67 8 .67.67 3.95.67 8 3.95 15.33 8 15.33Zm.95-3.3c0 .15-.12.27-.28.27h-1.4c-.15 0-.28-.12-.28-.27v-1.31c0-.15.12-.28.28-.28h1.4c.15 0 .28.12.28.28v1.31ZM7 3.96c0-.14.11-.25.25-.25H8.7c.14 0 .25.11.25.25v4.8c0 .14-.11.25-.25.25H7.25c-.14 0-.25-.11-.25-.25V3.95Z" })),
@@ -595,6 +626,7 @@ const icons = {
595
626
  '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" })),
596
627
  '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" })),
597
628
  '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" })),
629
+ 'user-shield-outline': () => (h("path", { fill: "currentColor", d: "M8 8.92c-1.5 0-2.72-1.22-2.72-2.72S6.5 3.48 8 3.48s2.72 1.22 2.72 2.72S9.5 8.92 8 8.92Zm0-4.64a1.92 1.92 0 1 0 .001 3.841A1.92 1.92 0 0 0 8 4.28Zm4.97-1.84L8.56.78C8.2.65 7.81.65 7.45.78L3.03 2.43C2.41 2.66 2 3.26 2 3.92V8c0 3.82 4.23 6.47 5.52 7.2.15.08.31.13.48.13s.33-.04.48-.13C9.78 14.48 14 11.82 14 8V3.92c0-.66-.41-1.25-1.03-1.48ZM8.08 14.5c-.05.03-.12.03-.17 0-.49-.28-2.12-1.24-3.4-2.68.62-.82 1.94-1.39 3.47-1.39s2.84.61 3.49 1.4c-1.29 1.43-2.9 2.39-3.39 2.67ZM13.19 8c0 1.2-.51 2.28-1.22 3.22-.83-.91-2.34-1.59-4-1.59s-3.16.64-3.98 1.58c-.7-.93-1.2-2.01-1.2-3.2V3.93c0-.33.21-.62.51-.74l4.43-1.66c.09-.03.18-.05.27-.05s.19.02.27.05l4.42 1.66c.3.11.51.41.51.73V8Z" })),
598
630
  'users': () => (h("path", { fill: "currentColor", d: "M12,8.76h-.2a5.24,5.24,0,0,1-3.93,0H7.61a3.05,3.05,0,0,0-3.3,2.75v.69a1.28,1.28,0,0,0,1.38,1.14H14a1.27,1.27,0,0,0,1.37-1.14v-.69A3.07,3.07,0,0,0,12,8.75Zm-6.4-.32A2,2,0,0,0,4.31,8H2.48A1.69,1.69,0,0,0,.65,9.53v.76a.85.85,0,0,0,.91.76H3.45A3.58,3.58,0,0,1,5.61,8.44ZM9.81,2.66A2.65,2.65,0,1,1,7.16,5.31h0A2.65,2.65,0,0,1,9.81,2.66ZM3.31,4.18A1.51,1.51,0,1,1,1.8,5.69,1.51,1.51,0,0,1,3.31,4.18Z" })),
599
631
  'wallet': () => (h("path", { fill: "currentColor", d: "M13.88 5H3a.43.43 0 0 1-.46-.38.43.43 0 0 1 .46-.43h11a.43.43 0 0 0 .46-.38A1.28 1.28 0 0 0 13 2.67H2.5A1.7 1.7 0 0 0 .67 4.19v7.62a1.7 1.7 0 0 0 1.83 1.52h11.38a1.32 1.32 0 0 0 1.45-1.14V6.1A1.33 1.33 0 0 0 13.88 5Zm-1.21 5.29a1.1 1.1 0 1 1 1.1-1.1 1.1 1.1 0 0 1-1.1 1.05Z" })),
600
632
  };
@@ -700,7 +732,7 @@ const MgIcon = class {
700
732
  };
701
733
  MgIcon.style = mgIconCss;
702
734
 
703
- const mgIllustratedMessageCss = ".mg-illustrated-message{margin:auto;padding:0 1.5rem;max-width:47.5rem;box-sizing:border-box;text-align:center}.mg-illustrated-message__illustration{max-height:33.5rem}.mg-illustrated-message__illustration ::slotted([slot=illustration]){width:auto;height:auto;max-width:100%;max-height:33.5rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small{max-height:6rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:6rem}.mg-illustrated-message__title{margin:3rem 0 0}.mg-illustrated-message__title ::slotted([slot=title]){margin:0;font-size:2rem !important;font-family:var(--font-family) !important;font-weight:400}.mg-illustrated-message__details ::slotted([slot=details]){margin:2rem 0 0}";
735
+ const mgIllustratedMessageCss = ".mg-illustrated-message{display:flex;flex-direction:column;justify-content:center;gap:3em 7rem;margin:auto;padding:var(--mg-illustrated-message-padding-vertical) 1.5rem;max-width:47.5rem;box-sizing:border-box;text-align:center}.mg-illustrated-message.mg-illustrated-message--horizontal{flex-direction:row;flex-wrap:wrap;align-items:center;max-width:unset}.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__slots,.mg-illustrated-message.mg-illustrated-message--horizontal .mg-illustrated-message__illustration{max-width:47.5rem}.mg-illustrated-message__illustration{max-height:33.5rem}.mg-illustrated-message__illustration ::slotted([slot=illustration]){width:auto;height:auto;max-width:100%;max-height:33.5rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small{max-height:6rem}.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small ::slotted([slot=illustration]){max-height:6rem}.mg-illustrated-message__title ::slotted([slot=title]){margin:0;font-size:2rem !important;font-family:var(--font-family) !important;font-weight:400}.mg-illustrated-message__details ::slotted([slot=details]){margin:2rem 0 0}";
704
736
 
705
737
  const MgIllustratedMessage = class {
706
738
  constructor(hostRef) {
@@ -709,6 +741,10 @@ const MgIllustratedMessage = class {
709
741
  * Define illustration size
710
742
  */
711
743
  this.size = 'regular';
744
+ /**
745
+ * Define component orientation
746
+ */
747
+ this.direction = 'vertical';
712
748
  }
713
749
  /*************
714
750
  * Lifecycle *
@@ -734,10 +770,13 @@ const MgIllustratedMessage = class {
734
770
  * @returns {HTMLElement} HTML Element
735
771
  */
736
772
  render() {
737
- return (h("div", { class: "mg-illustrated-message" }, h("div", { class: {
773
+ return (h("div", { class: {
774
+ 'mg-illustrated-message': true,
775
+ 'mg-illustrated-message--horizontal': this.direction === 'horizontal',
776
+ } }, h("div", { class: {
738
777
  'mg-illustrated-message__illustration': true,
739
778
  'mg-illustrated-message__illustration--small': this.size === 'small',
740
- } }, h("slot", { name: "illustration" })), h("div", { class: "mg-illustrated-message__title" }, h("slot", { name: "title" })), h("div", { class: "mg-illustrated-message__details" }, h("slot", { name: "details" }))));
779
+ } }, h("slot", { name: "illustration" })), h("div", { class: "mg-illustrated-message__slots" }, h("div", { class: "mg-illustrated-message__title" }, h("slot", { name: "title" })), h("div", { class: "mg-illustrated-message__details" }, h("slot", { name: "details" })))));
741
780
  }
742
781
  get element() { return getElement(this); }
743
782
  };
@@ -794,9 +833,7 @@ const MgInput = (props, children, utils) => {
794
833
  * Check required properties
795
834
  */
796
835
  if (typeof props.identifier !== 'string' || props.identifier.trim() === '') {
797
- // TODO: throw new Error on next major (5.0.0)
798
- // throw new Error('<mg-input> prop "identifier" is required.');
799
- console.error('<mg-input> prop "identifier" is required.');
836
+ throw new Error('<mg-input> prop "identifier" is required.');
800
837
  }
801
838
  if (typeof props.label !== 'string' || props.label.trim() === '') {
802
839
  throw new Error('<mg-input> prop "label" is required.');
@@ -2512,9 +2549,7 @@ const MgInputTitle = class {
2512
2549
  }
2513
2550
  validateIdentifier(newValue) {
2514
2551
  if (typeof newValue !== 'string' || newValue.trim() === '') {
2515
- // TODO: throw new Error on next major (5.0.0)
2516
- // throw new Error('<mg-input-title> prop "identifier" is required.');
2517
- console.error('<mg-input-title> prop "identifier" is required.');
2552
+ throw new Error('<mg-input-title> prop "identifier" is required.');
2518
2553
  }
2519
2554
  }
2520
2555
  /*************
@@ -2971,10 +3006,11 @@ const MgPagination = class {
2971
3006
  * Go to 'previous/next' page button handler
2972
3007
  *
2973
3008
  * @param {string} action navigation action
3009
+ * @param {boolean} disabled button disable state
2974
3010
  * @returns {void}
2975
3011
  */
2976
- this.handleGoToPage = (action) => {
2977
- this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
3012
+ this.handleGoToPage = (action, disabled) => {
3013
+ !disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
2978
3014
  };
2979
3015
  }
2980
3016
  validateTotalPages(newValue) {
@@ -3018,7 +3054,7 @@ const MgPagination = class {
3018
3054
  render() {
3019
3055
  const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
3020
3056
  // eslint-disable-next-line react/jsx-no-bind
3021
- onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
3057
+ onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
3022
3058
  return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
3023
3059
  }
3024
3060
  get element() { return getElement(this); }
@@ -3029,7 +3065,7 @@ const MgPagination = class {
3029
3065
  };
3030
3066
  MgPagination.style = mgPaginationCss;
3031
3067
 
3032
- const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__header-left mg-button:not([slot=append-input]){margin:0 0.3rem 0 0}.mg-panel__header-left mg-button:not([slot=append-input])>*:first-of-type{font-family:var(--font-family-heading);font-size:1.4rem;font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
3068
+ const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
3033
3069
 
3034
3070
  const MgPanel = class {
3035
3071
  constructor(hostRef) {
@@ -3126,7 +3162,7 @@ const MgPanel = class {
3126
3162
  * @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
3127
3163
  */
3128
3164
  this.headerLeft = () => {
3129
- const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, expanded: this.expanded, controls: `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle));
3165
+ const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("span", { class: "mg-panel__collapse-button-content" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle)));
3130
3166
  if (this.titleEditable && !this.isEditing) {
3131
3167
  return [
3132
3168
  collapseButton(),
@@ -3144,9 +3180,7 @@ const MgPanel = class {
3144
3180
  }
3145
3181
  validatePanelTitle(newValue) {
3146
3182
  if (typeof newValue !== 'string' || newValue.trim() === '') {
3147
- // TODO: throw new Error on next major (5.0.0)
3148
- // throw new Error('<mg-panel> prop "panelTitle" is required.');
3149
- console.error('<mg-panel> prop "panelTitle" is required.');
3183
+ throw new Error('<mg-panel> prop "panelTitle" is required.');
3150
3184
  }
3151
3185
  this.titleChange.emit(newValue);
3152
3186
  }
@@ -3204,6 +3238,1965 @@ const MgPanel = class {
3204
3238
  };
3205
3239
  MgPanel.style = mgPanelCss;
3206
3240
 
3241
+ var top = 'top';
3242
+ var bottom = 'bottom';
3243
+ var right = 'right';
3244
+ var left = 'left';
3245
+ var auto = 'auto';
3246
+ var basePlacements = [top, bottom, right, left];
3247
+ var start = 'start';
3248
+ var end = 'end';
3249
+ var clippingParents = 'clippingParents';
3250
+ var viewport = 'viewport';
3251
+ var popper = 'popper';
3252
+ var reference = 'reference';
3253
+ var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
3254
+ return acc.concat([placement + "-" + start, placement + "-" + end]);
3255
+ }, []);
3256
+ var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
3257
+ return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
3258
+ }, []); // modifiers that need to read the DOM
3259
+
3260
+ var beforeRead = 'beforeRead';
3261
+ var read = 'read';
3262
+ var afterRead = 'afterRead'; // pure-logic modifiers
3263
+
3264
+ var beforeMain = 'beforeMain';
3265
+ var main = 'main';
3266
+ var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
3267
+
3268
+ var beforeWrite = 'beforeWrite';
3269
+ var write = 'write';
3270
+ var afterWrite = 'afterWrite';
3271
+ var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
3272
+
3273
+ function getNodeName(element) {
3274
+ return element ? (element.nodeName || '').toLowerCase() : null;
3275
+ }
3276
+
3277
+ function getWindow(node) {
3278
+ if (node == null) {
3279
+ return window;
3280
+ }
3281
+
3282
+ if (node.toString() !== '[object Window]') {
3283
+ var ownerDocument = node.ownerDocument;
3284
+ return ownerDocument ? ownerDocument.defaultView || window : window;
3285
+ }
3286
+
3287
+ return node;
3288
+ }
3289
+
3290
+ function isElement(node) {
3291
+ var OwnElement = getWindow(node).Element;
3292
+ return node instanceof OwnElement || node instanceof Element;
3293
+ }
3294
+
3295
+ function isHTMLElement(node) {
3296
+ var OwnElement = getWindow(node).HTMLElement;
3297
+ return node instanceof OwnElement || node instanceof HTMLElement;
3298
+ }
3299
+
3300
+ function isShadowRoot(node) {
3301
+ // IE 11 has no ShadowRoot
3302
+ if (typeof ShadowRoot === 'undefined') {
3303
+ return false;
3304
+ }
3305
+
3306
+ var OwnElement = getWindow(node).ShadowRoot;
3307
+ return node instanceof OwnElement || node instanceof ShadowRoot;
3308
+ }
3309
+
3310
+ // and applies them to the HTMLElements such as popper and arrow
3311
+
3312
+ function applyStyles(_ref) {
3313
+ var state = _ref.state;
3314
+ Object.keys(state.elements).forEach(function (name) {
3315
+ var style = state.styles[name] || {};
3316
+ var attributes = state.attributes[name] || {};
3317
+ var element = state.elements[name]; // arrow is optional + virtual elements
3318
+
3319
+ if (!isHTMLElement(element) || !getNodeName(element)) {
3320
+ return;
3321
+ } // Flow doesn't support to extend this property, but it's the most
3322
+ // effective way to apply styles to an HTMLElement
3323
+ // $FlowFixMe[cannot-write]
3324
+
3325
+
3326
+ Object.assign(element.style, style);
3327
+ Object.keys(attributes).forEach(function (name) {
3328
+ var value = attributes[name];
3329
+
3330
+ if (value === false) {
3331
+ element.removeAttribute(name);
3332
+ } else {
3333
+ element.setAttribute(name, value === true ? '' : value);
3334
+ }
3335
+ });
3336
+ });
3337
+ }
3338
+
3339
+ function effect$2(_ref2) {
3340
+ var state = _ref2.state;
3341
+ var initialStyles = {
3342
+ popper: {
3343
+ position: state.options.strategy,
3344
+ left: '0',
3345
+ top: '0',
3346
+ margin: '0'
3347
+ },
3348
+ arrow: {
3349
+ position: 'absolute'
3350
+ },
3351
+ reference: {}
3352
+ };
3353
+ Object.assign(state.elements.popper.style, initialStyles.popper);
3354
+ state.styles = initialStyles;
3355
+
3356
+ if (state.elements.arrow) {
3357
+ Object.assign(state.elements.arrow.style, initialStyles.arrow);
3358
+ }
3359
+
3360
+ return function () {
3361
+ Object.keys(state.elements).forEach(function (name) {
3362
+ var element = state.elements[name];
3363
+ var attributes = state.attributes[name] || {};
3364
+ var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
3365
+
3366
+ var style = styleProperties.reduce(function (style, property) {
3367
+ style[property] = '';
3368
+ return style;
3369
+ }, {}); // arrow is optional + virtual elements
3370
+
3371
+ if (!isHTMLElement(element) || !getNodeName(element)) {
3372
+ return;
3373
+ }
3374
+
3375
+ Object.assign(element.style, style);
3376
+ Object.keys(attributes).forEach(function (attribute) {
3377
+ element.removeAttribute(attribute);
3378
+ });
3379
+ });
3380
+ };
3381
+ } // eslint-disable-next-line import/no-unused-modules
3382
+
3383
+
3384
+ const applyStyles$1 = {
3385
+ name: 'applyStyles',
3386
+ enabled: true,
3387
+ phase: 'write',
3388
+ fn: applyStyles,
3389
+ effect: effect$2,
3390
+ requires: ['computeStyles']
3391
+ };
3392
+
3393
+ function getBasePlacement(placement) {
3394
+ return placement.split('-')[0];
3395
+ }
3396
+
3397
+ var max = Math.max;
3398
+ var min = Math.min;
3399
+ var round = Math.round;
3400
+
3401
+ function getUAString() {
3402
+ var uaData = navigator.userAgentData;
3403
+
3404
+ if (uaData != null && uaData.brands) {
3405
+ return uaData.brands.map(function (item) {
3406
+ return item.brand + "/" + item.version;
3407
+ }).join(' ');
3408
+ }
3409
+
3410
+ return navigator.userAgent;
3411
+ }
3412
+
3413
+ function isLayoutViewport() {
3414
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
3415
+ }
3416
+
3417
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
3418
+ if (includeScale === void 0) {
3419
+ includeScale = false;
3420
+ }
3421
+
3422
+ if (isFixedStrategy === void 0) {
3423
+ isFixedStrategy = false;
3424
+ }
3425
+
3426
+ var clientRect = element.getBoundingClientRect();
3427
+ var scaleX = 1;
3428
+ var scaleY = 1;
3429
+
3430
+ if (includeScale && isHTMLElement(element)) {
3431
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
3432
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
3433
+ }
3434
+
3435
+ var _ref = isElement(element) ? getWindow(element) : window,
3436
+ visualViewport = _ref.visualViewport;
3437
+
3438
+ var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
3439
+ var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
3440
+ var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
3441
+ var width = clientRect.width / scaleX;
3442
+ var height = clientRect.height / scaleY;
3443
+ return {
3444
+ width: width,
3445
+ height: height,
3446
+ top: y,
3447
+ right: x + width,
3448
+ bottom: y + height,
3449
+ left: x,
3450
+ x: x,
3451
+ y: y
3452
+ };
3453
+ }
3454
+
3455
+ // means it doesn't take into account transforms.
3456
+
3457
+ function getLayoutRect(element) {
3458
+ var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
3459
+ // Fixes https://github.com/popperjs/popper-core/issues/1223
3460
+
3461
+ var width = element.offsetWidth;
3462
+ var height = element.offsetHeight;
3463
+
3464
+ if (Math.abs(clientRect.width - width) <= 1) {
3465
+ width = clientRect.width;
3466
+ }
3467
+
3468
+ if (Math.abs(clientRect.height - height) <= 1) {
3469
+ height = clientRect.height;
3470
+ }
3471
+
3472
+ return {
3473
+ x: element.offsetLeft,
3474
+ y: element.offsetTop,
3475
+ width: width,
3476
+ height: height
3477
+ };
3478
+ }
3479
+
3480
+ function contains(parent, child) {
3481
+ var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
3482
+
3483
+ if (parent.contains(child)) {
3484
+ return true;
3485
+ } // then fallback to custom implementation with Shadow DOM support
3486
+ else if (rootNode && isShadowRoot(rootNode)) {
3487
+ var next = child;
3488
+
3489
+ do {
3490
+ if (next && parent.isSameNode(next)) {
3491
+ return true;
3492
+ } // $FlowFixMe[prop-missing]: need a better way to handle this...
3493
+
3494
+
3495
+ next = next.parentNode || next.host;
3496
+ } while (next);
3497
+ } // Give up, the result is false
3498
+
3499
+
3500
+ return false;
3501
+ }
3502
+
3503
+ function getComputedStyle(element) {
3504
+ return getWindow(element).getComputedStyle(element);
3505
+ }
3506
+
3507
+ function isTableElement(element) {
3508
+ return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
3509
+ }
3510
+
3511
+ function getDocumentElement(element) {
3512
+ // $FlowFixMe[incompatible-return]: assume body is always available
3513
+ return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
3514
+ element.document) || window.document).documentElement;
3515
+ }
3516
+
3517
+ function getParentNode(element) {
3518
+ if (getNodeName(element) === 'html') {
3519
+ return element;
3520
+ }
3521
+
3522
+ return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
3523
+ // $FlowFixMe[incompatible-return]
3524
+ // $FlowFixMe[prop-missing]
3525
+ element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
3526
+ element.parentNode || ( // DOM Element detected
3527
+ isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
3528
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
3529
+ getDocumentElement(element) // fallback
3530
+
3531
+ );
3532
+ }
3533
+
3534
+ function getTrueOffsetParent(element) {
3535
+ if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
3536
+ getComputedStyle(element).position === 'fixed') {
3537
+ return null;
3538
+ }
3539
+
3540
+ return element.offsetParent;
3541
+ } // `.offsetParent` reports `null` for fixed elements, while absolute elements
3542
+ // return the containing block
3543
+
3544
+
3545
+ function getContainingBlock(element) {
3546
+ var isFirefox = /firefox/i.test(getUAString());
3547
+ var isIE = /Trident/i.test(getUAString());
3548
+
3549
+ if (isIE && isHTMLElement(element)) {
3550
+ // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
3551
+ var elementCss = getComputedStyle(element);
3552
+
3553
+ if (elementCss.position === 'fixed') {
3554
+ return null;
3555
+ }
3556
+ }
3557
+
3558
+ var currentNode = getParentNode(element);
3559
+
3560
+ if (isShadowRoot(currentNode)) {
3561
+ currentNode = currentNode.host;
3562
+ }
3563
+
3564
+ while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
3565
+ var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
3566
+ // create a containing block.
3567
+ // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
3568
+
3569
+ if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
3570
+ return currentNode;
3571
+ } else {
3572
+ currentNode = currentNode.parentNode;
3573
+ }
3574
+ }
3575
+
3576
+ return null;
3577
+ } // Gets the closest ancestor positioned element. Handles some edge cases,
3578
+ // such as table ancestors and cross browser bugs.
3579
+
3580
+
3581
+ function getOffsetParent(element) {
3582
+ var window = getWindow(element);
3583
+ var offsetParent = getTrueOffsetParent(element);
3584
+
3585
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
3586
+ offsetParent = getTrueOffsetParent(offsetParent);
3587
+ }
3588
+
3589
+ if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {
3590
+ return window;
3591
+ }
3592
+
3593
+ return offsetParent || getContainingBlock(element) || window;
3594
+ }
3595
+
3596
+ function getMainAxisFromPlacement(placement) {
3597
+ return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
3598
+ }
3599
+
3600
+ function within(min$1, value, max$1) {
3601
+ return max(min$1, min(value, max$1));
3602
+ }
3603
+ function withinMaxClamp(min, value, max) {
3604
+ var v = within(min, value, max);
3605
+ return v > max ? max : v;
3606
+ }
3607
+
3608
+ function getFreshSideObject() {
3609
+ return {
3610
+ top: 0,
3611
+ right: 0,
3612
+ bottom: 0,
3613
+ left: 0
3614
+ };
3615
+ }
3616
+
3617
+ function mergePaddingObject(paddingObject) {
3618
+ return Object.assign({}, getFreshSideObject(), paddingObject);
3619
+ }
3620
+
3621
+ function expandToHashMap(value, keys) {
3622
+ return keys.reduce(function (hashMap, key) {
3623
+ hashMap[key] = value;
3624
+ return hashMap;
3625
+ }, {});
3626
+ }
3627
+
3628
+ var toPaddingObject = function toPaddingObject(padding, state) {
3629
+ padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
3630
+ placement: state.placement
3631
+ })) : padding;
3632
+ return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
3633
+ };
3634
+
3635
+ function arrow(_ref) {
3636
+ var _state$modifiersData$;
3637
+
3638
+ var state = _ref.state,
3639
+ name = _ref.name,
3640
+ options = _ref.options;
3641
+ var arrowElement = state.elements.arrow;
3642
+ var popperOffsets = state.modifiersData.popperOffsets;
3643
+ var basePlacement = getBasePlacement(state.placement);
3644
+ var axis = getMainAxisFromPlacement(basePlacement);
3645
+ var isVertical = [left, right].indexOf(basePlacement) >= 0;
3646
+ var len = isVertical ? 'height' : 'width';
3647
+
3648
+ if (!arrowElement || !popperOffsets) {
3649
+ return;
3650
+ }
3651
+
3652
+ var paddingObject = toPaddingObject(options.padding, state);
3653
+ var arrowRect = getLayoutRect(arrowElement);
3654
+ var minProp = axis === 'y' ? top : left;
3655
+ var maxProp = axis === 'y' ? bottom : right;
3656
+ var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
3657
+ var startDiff = popperOffsets[axis] - state.rects.reference[axis];
3658
+ var arrowOffsetParent = getOffsetParent(arrowElement);
3659
+ var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
3660
+ var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
3661
+ // outside of the popper bounds
3662
+
3663
+ var min = paddingObject[minProp];
3664
+ var max = clientSize - arrowRect[len] - paddingObject[maxProp];
3665
+ var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
3666
+ var offset = within(min, center, max); // Prevents breaking syntax highlighting...
3667
+
3668
+ var axisProp = axis;
3669
+ state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
3670
+ }
3671
+
3672
+ function effect$1(_ref2) {
3673
+ var state = _ref2.state,
3674
+ options = _ref2.options;
3675
+ var _options$element = options.element,
3676
+ arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
3677
+
3678
+ if (arrowElement == null) {
3679
+ return;
3680
+ } // CSS selector
3681
+
3682
+
3683
+ if (typeof arrowElement === 'string') {
3684
+ arrowElement = state.elements.popper.querySelector(arrowElement);
3685
+
3686
+ if (!arrowElement) {
3687
+ return;
3688
+ }
3689
+ }
3690
+
3691
+ if (!contains(state.elements.popper, arrowElement)) {
3692
+
3693
+ return;
3694
+ }
3695
+
3696
+ state.elements.arrow = arrowElement;
3697
+ } // eslint-disable-next-line import/no-unused-modules
3698
+
3699
+
3700
+ const arrow$1 = {
3701
+ name: 'arrow',
3702
+ enabled: true,
3703
+ phase: 'main',
3704
+ fn: arrow,
3705
+ effect: effect$1,
3706
+ requires: ['popperOffsets'],
3707
+ requiresIfExists: ['preventOverflow']
3708
+ };
3709
+
3710
+ function getVariation(placement) {
3711
+ return placement.split('-')[1];
3712
+ }
3713
+
3714
+ var unsetSides = {
3715
+ top: 'auto',
3716
+ right: 'auto',
3717
+ bottom: 'auto',
3718
+ left: 'auto'
3719
+ }; // Round the offsets to the nearest suitable subpixel based on the DPR.
3720
+ // Zooming can change the DPR, but it seems to report a value that will
3721
+ // cleanly divide the values into the appropriate subpixels.
3722
+
3723
+ function roundOffsetsByDPR(_ref) {
3724
+ var x = _ref.x,
3725
+ y = _ref.y;
3726
+ var win = window;
3727
+ var dpr = win.devicePixelRatio || 1;
3728
+ return {
3729
+ x: round(x * dpr) / dpr || 0,
3730
+ y: round(y * dpr) / dpr || 0
3731
+ };
3732
+ }
3733
+
3734
+ function mapToStyles(_ref2) {
3735
+ var _Object$assign2;
3736
+
3737
+ var popper = _ref2.popper,
3738
+ popperRect = _ref2.popperRect,
3739
+ placement = _ref2.placement,
3740
+ variation = _ref2.variation,
3741
+ offsets = _ref2.offsets,
3742
+ position = _ref2.position,
3743
+ gpuAcceleration = _ref2.gpuAcceleration,
3744
+ adaptive = _ref2.adaptive,
3745
+ roundOffsets = _ref2.roundOffsets,
3746
+ isFixed = _ref2.isFixed;
3747
+ var _offsets$x = offsets.x,
3748
+ x = _offsets$x === void 0 ? 0 : _offsets$x,
3749
+ _offsets$y = offsets.y,
3750
+ y = _offsets$y === void 0 ? 0 : _offsets$y;
3751
+
3752
+ var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
3753
+ x: x,
3754
+ y: y
3755
+ }) : {
3756
+ x: x,
3757
+ y: y
3758
+ };
3759
+
3760
+ x = _ref3.x;
3761
+ y = _ref3.y;
3762
+ var hasX = offsets.hasOwnProperty('x');
3763
+ var hasY = offsets.hasOwnProperty('y');
3764
+ var sideX = left;
3765
+ var sideY = top;
3766
+ var win = window;
3767
+
3768
+ if (adaptive) {
3769
+ var offsetParent = getOffsetParent(popper);
3770
+ var heightProp = 'clientHeight';
3771
+ var widthProp = 'clientWidth';
3772
+
3773
+ if (offsetParent === getWindow(popper)) {
3774
+ offsetParent = getDocumentElement(popper);
3775
+
3776
+ if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
3777
+ heightProp = 'scrollHeight';
3778
+ widthProp = 'scrollWidth';
3779
+ }
3780
+ } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
3781
+
3782
+
3783
+ offsetParent = offsetParent;
3784
+
3785
+ if (placement === top || (placement === left || placement === right) && variation === end) {
3786
+ sideY = bottom;
3787
+ var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
3788
+ offsetParent[heightProp];
3789
+ y -= offsetY - popperRect.height;
3790
+ y *= gpuAcceleration ? 1 : -1;
3791
+ }
3792
+
3793
+ if (placement === left || (placement === top || placement === bottom) && variation === end) {
3794
+ sideX = right;
3795
+ var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
3796
+ offsetParent[widthProp];
3797
+ x -= offsetX - popperRect.width;
3798
+ x *= gpuAcceleration ? 1 : -1;
3799
+ }
3800
+ }
3801
+
3802
+ var commonStyles = Object.assign({
3803
+ position: position
3804
+ }, adaptive && unsetSides);
3805
+
3806
+ var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
3807
+ x: x,
3808
+ y: y
3809
+ }) : {
3810
+ x: x,
3811
+ y: y
3812
+ };
3813
+
3814
+ x = _ref4.x;
3815
+ y = _ref4.y;
3816
+
3817
+ if (gpuAcceleration) {
3818
+ var _Object$assign;
3819
+
3820
+ return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
3821
+ }
3822
+
3823
+ return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
3824
+ }
3825
+
3826
+ function computeStyles(_ref5) {
3827
+ var state = _ref5.state,
3828
+ options = _ref5.options;
3829
+ var _options$gpuAccelerat = options.gpuAcceleration,
3830
+ gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
3831
+ _options$adaptive = options.adaptive,
3832
+ adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
3833
+ _options$roundOffsets = options.roundOffsets,
3834
+ roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
3835
+
3836
+ var commonStyles = {
3837
+ placement: getBasePlacement(state.placement),
3838
+ variation: getVariation(state.placement),
3839
+ popper: state.elements.popper,
3840
+ popperRect: state.rects.popper,
3841
+ gpuAcceleration: gpuAcceleration,
3842
+ isFixed: state.options.strategy === 'fixed'
3843
+ };
3844
+
3845
+ if (state.modifiersData.popperOffsets != null) {
3846
+ state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
3847
+ offsets: state.modifiersData.popperOffsets,
3848
+ position: state.options.strategy,
3849
+ adaptive: adaptive,
3850
+ roundOffsets: roundOffsets
3851
+ })));
3852
+ }
3853
+
3854
+ if (state.modifiersData.arrow != null) {
3855
+ state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
3856
+ offsets: state.modifiersData.arrow,
3857
+ position: 'absolute',
3858
+ adaptive: false,
3859
+ roundOffsets: roundOffsets
3860
+ })));
3861
+ }
3862
+
3863
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
3864
+ 'data-popper-placement': state.placement
3865
+ });
3866
+ } // eslint-disable-next-line import/no-unused-modules
3867
+
3868
+
3869
+ const computeStyles$1 = {
3870
+ name: 'computeStyles',
3871
+ enabled: true,
3872
+ phase: 'beforeWrite',
3873
+ fn: computeStyles,
3874
+ data: {}
3875
+ };
3876
+
3877
+ var passive = {
3878
+ passive: true
3879
+ };
3880
+
3881
+ function effect(_ref) {
3882
+ var state = _ref.state,
3883
+ instance = _ref.instance,
3884
+ options = _ref.options;
3885
+ var _options$scroll = options.scroll,
3886
+ scroll = _options$scroll === void 0 ? true : _options$scroll,
3887
+ _options$resize = options.resize,
3888
+ resize = _options$resize === void 0 ? true : _options$resize;
3889
+ var window = getWindow(state.elements.popper);
3890
+ var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
3891
+
3892
+ if (scroll) {
3893
+ scrollParents.forEach(function (scrollParent) {
3894
+ scrollParent.addEventListener('scroll', instance.update, passive);
3895
+ });
3896
+ }
3897
+
3898
+ if (resize) {
3899
+ window.addEventListener('resize', instance.update, passive);
3900
+ }
3901
+
3902
+ return function () {
3903
+ if (scroll) {
3904
+ scrollParents.forEach(function (scrollParent) {
3905
+ scrollParent.removeEventListener('scroll', instance.update, passive);
3906
+ });
3907
+ }
3908
+
3909
+ if (resize) {
3910
+ window.removeEventListener('resize', instance.update, passive);
3911
+ }
3912
+ };
3913
+ } // eslint-disable-next-line import/no-unused-modules
3914
+
3915
+
3916
+ const eventListeners = {
3917
+ name: 'eventListeners',
3918
+ enabled: true,
3919
+ phase: 'write',
3920
+ fn: function fn() {},
3921
+ effect: effect,
3922
+ data: {}
3923
+ };
3924
+
3925
+ var hash$1 = {
3926
+ left: 'right',
3927
+ right: 'left',
3928
+ bottom: 'top',
3929
+ top: 'bottom'
3930
+ };
3931
+ function getOppositePlacement(placement) {
3932
+ return placement.replace(/left|right|bottom|top/g, function (matched) {
3933
+ return hash$1[matched];
3934
+ });
3935
+ }
3936
+
3937
+ var hash = {
3938
+ start: 'end',
3939
+ end: 'start'
3940
+ };
3941
+ function getOppositeVariationPlacement(placement) {
3942
+ return placement.replace(/start|end/g, function (matched) {
3943
+ return hash[matched];
3944
+ });
3945
+ }
3946
+
3947
+ function getWindowScroll(node) {
3948
+ var win = getWindow(node);
3949
+ var scrollLeft = win.pageXOffset;
3950
+ var scrollTop = win.pageYOffset;
3951
+ return {
3952
+ scrollLeft: scrollLeft,
3953
+ scrollTop: scrollTop
3954
+ };
3955
+ }
3956
+
3957
+ function getWindowScrollBarX(element) {
3958
+ // If <html> has a CSS width greater than the viewport, then this will be
3959
+ // incorrect for RTL.
3960
+ // Popper 1 is broken in this case and never had a bug report so let's assume
3961
+ // it's not an issue. I don't think anyone ever specifies width on <html>
3962
+ // anyway.
3963
+ // Browsers where the left scrollbar doesn't cause an issue report `0` for
3964
+ // this (e.g. Edge 2019, IE11, Safari)
3965
+ return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
3966
+ }
3967
+
3968
+ function getViewportRect(element, strategy) {
3969
+ var win = getWindow(element);
3970
+ var html = getDocumentElement(element);
3971
+ var visualViewport = win.visualViewport;
3972
+ var width = html.clientWidth;
3973
+ var height = html.clientHeight;
3974
+ var x = 0;
3975
+ var y = 0;
3976
+
3977
+ if (visualViewport) {
3978
+ width = visualViewport.width;
3979
+ height = visualViewport.height;
3980
+ var layoutViewport = isLayoutViewport();
3981
+
3982
+ if (layoutViewport || !layoutViewport && strategy === 'fixed') {
3983
+ x = visualViewport.offsetLeft;
3984
+ y = visualViewport.offsetTop;
3985
+ }
3986
+ }
3987
+
3988
+ return {
3989
+ width: width,
3990
+ height: height,
3991
+ x: x + getWindowScrollBarX(element),
3992
+ y: y
3993
+ };
3994
+ }
3995
+
3996
+ // of the `<html>` and `<body>` rect bounds if horizontally scrollable
3997
+
3998
+ function getDocumentRect(element) {
3999
+ var _element$ownerDocumen;
4000
+
4001
+ var html = getDocumentElement(element);
4002
+ var winScroll = getWindowScroll(element);
4003
+ var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
4004
+ var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
4005
+ var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
4006
+ var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
4007
+ var y = -winScroll.scrollTop;
4008
+
4009
+ if (getComputedStyle(body || html).direction === 'rtl') {
4010
+ x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
4011
+ }
4012
+
4013
+ return {
4014
+ width: width,
4015
+ height: height,
4016
+ x: x,
4017
+ y: y
4018
+ };
4019
+ }
4020
+
4021
+ function isScrollParent(element) {
4022
+ // Firefox wants us to check `-x` and `-y` variations as well
4023
+ var _getComputedStyle = getComputedStyle(element),
4024
+ overflow = _getComputedStyle.overflow,
4025
+ overflowX = _getComputedStyle.overflowX,
4026
+ overflowY = _getComputedStyle.overflowY;
4027
+
4028
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
4029
+ }
4030
+
4031
+ function getScrollParent(node) {
4032
+ if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
4033
+ // $FlowFixMe[incompatible-return]: assume body is always available
4034
+ return node.ownerDocument.body;
4035
+ }
4036
+
4037
+ if (isHTMLElement(node) && isScrollParent(node)) {
4038
+ return node;
4039
+ }
4040
+
4041
+ return getScrollParent(getParentNode(node));
4042
+ }
4043
+
4044
+ /*
4045
+ given a DOM element, return the list of all scroll parents, up the list of ancesors
4046
+ until we get to the top window object. This list is what we attach scroll listeners
4047
+ to, because if any of these parent elements scroll, we'll need to re-calculate the
4048
+ reference element's position.
4049
+ */
4050
+
4051
+ function listScrollParents(element, list) {
4052
+ var _element$ownerDocumen;
4053
+
4054
+ if (list === void 0) {
4055
+ list = [];
4056
+ }
4057
+
4058
+ var scrollParent = getScrollParent(element);
4059
+ var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
4060
+ var win = getWindow(scrollParent);
4061
+ var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
4062
+ var updatedList = list.concat(target);
4063
+ return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
4064
+ updatedList.concat(listScrollParents(getParentNode(target)));
4065
+ }
4066
+
4067
+ function rectToClientRect(rect) {
4068
+ return Object.assign({}, rect, {
4069
+ left: rect.x,
4070
+ top: rect.y,
4071
+ right: rect.x + rect.width,
4072
+ bottom: rect.y + rect.height
4073
+ });
4074
+ }
4075
+
4076
+ function getInnerBoundingClientRect(element, strategy) {
4077
+ var rect = getBoundingClientRect(element, false, strategy === 'fixed');
4078
+ rect.top = rect.top + element.clientTop;
4079
+ rect.left = rect.left + element.clientLeft;
4080
+ rect.bottom = rect.top + element.clientHeight;
4081
+ rect.right = rect.left + element.clientWidth;
4082
+ rect.width = element.clientWidth;
4083
+ rect.height = element.clientHeight;
4084
+ rect.x = rect.left;
4085
+ rect.y = rect.top;
4086
+ return rect;
4087
+ }
4088
+
4089
+ function getClientRectFromMixedType(element, clippingParent, strategy) {
4090
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
4091
+ } // A "clipping parent" is an overflowable container with the characteristic of
4092
+ // clipping (or hiding) overflowing elements with a position different from
4093
+ // `initial`
4094
+
4095
+
4096
+ function getClippingParents(element) {
4097
+ var clippingParents = listScrollParents(getParentNode(element));
4098
+ var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;
4099
+ var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
4100
+
4101
+ if (!isElement(clipperElement)) {
4102
+ return [];
4103
+ } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
4104
+
4105
+
4106
+ return clippingParents.filter(function (clippingParent) {
4107
+ return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
4108
+ });
4109
+ } // Gets the maximum area that the element is visible in due to any number of
4110
+ // clipping parents
4111
+
4112
+
4113
+ function getClippingRect(element, boundary, rootBoundary, strategy) {
4114
+ var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
4115
+ var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
4116
+ var firstClippingParent = clippingParents[0];
4117
+ var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
4118
+ var rect = getClientRectFromMixedType(element, clippingParent, strategy);
4119
+ accRect.top = max(rect.top, accRect.top);
4120
+ accRect.right = min(rect.right, accRect.right);
4121
+ accRect.bottom = min(rect.bottom, accRect.bottom);
4122
+ accRect.left = max(rect.left, accRect.left);
4123
+ return accRect;
4124
+ }, getClientRectFromMixedType(element, firstClippingParent, strategy));
4125
+ clippingRect.width = clippingRect.right - clippingRect.left;
4126
+ clippingRect.height = clippingRect.bottom - clippingRect.top;
4127
+ clippingRect.x = clippingRect.left;
4128
+ clippingRect.y = clippingRect.top;
4129
+ return clippingRect;
4130
+ }
4131
+
4132
+ function computeOffsets(_ref) {
4133
+ var reference = _ref.reference,
4134
+ element = _ref.element,
4135
+ placement = _ref.placement;
4136
+ var basePlacement = placement ? getBasePlacement(placement) : null;
4137
+ var variation = placement ? getVariation(placement) : null;
4138
+ var commonX = reference.x + reference.width / 2 - element.width / 2;
4139
+ var commonY = reference.y + reference.height / 2 - element.height / 2;
4140
+ var offsets;
4141
+
4142
+ switch (basePlacement) {
4143
+ case top:
4144
+ offsets = {
4145
+ x: commonX,
4146
+ y: reference.y - element.height
4147
+ };
4148
+ break;
4149
+
4150
+ case bottom:
4151
+ offsets = {
4152
+ x: commonX,
4153
+ y: reference.y + reference.height
4154
+ };
4155
+ break;
4156
+
4157
+ case right:
4158
+ offsets = {
4159
+ x: reference.x + reference.width,
4160
+ y: commonY
4161
+ };
4162
+ break;
4163
+
4164
+ case left:
4165
+ offsets = {
4166
+ x: reference.x - element.width,
4167
+ y: commonY
4168
+ };
4169
+ break;
4170
+
4171
+ default:
4172
+ offsets = {
4173
+ x: reference.x,
4174
+ y: reference.y
4175
+ };
4176
+ }
4177
+
4178
+ var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
4179
+
4180
+ if (mainAxis != null) {
4181
+ var len = mainAxis === 'y' ? 'height' : 'width';
4182
+
4183
+ switch (variation) {
4184
+ case start:
4185
+ offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
4186
+ break;
4187
+
4188
+ case end:
4189
+ offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
4190
+ break;
4191
+ }
4192
+ }
4193
+
4194
+ return offsets;
4195
+ }
4196
+
4197
+ function detectOverflow(state, options) {
4198
+ if (options === void 0) {
4199
+ options = {};
4200
+ }
4201
+
4202
+ var _options = options,
4203
+ _options$placement = _options.placement,
4204
+ placement = _options$placement === void 0 ? state.placement : _options$placement,
4205
+ _options$strategy = _options.strategy,
4206
+ strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
4207
+ _options$boundary = _options.boundary,
4208
+ boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
4209
+ _options$rootBoundary = _options.rootBoundary,
4210
+ rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
4211
+ _options$elementConte = _options.elementContext,
4212
+ elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
4213
+ _options$altBoundary = _options.altBoundary,
4214
+ altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
4215
+ _options$padding = _options.padding,
4216
+ padding = _options$padding === void 0 ? 0 : _options$padding;
4217
+ var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
4218
+ var altContext = elementContext === popper ? reference : popper;
4219
+ var popperRect = state.rects.popper;
4220
+ var element = state.elements[altBoundary ? altContext : elementContext];
4221
+ var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
4222
+ var referenceClientRect = getBoundingClientRect(state.elements.reference);
4223
+ var popperOffsets = computeOffsets({
4224
+ reference: referenceClientRect,
4225
+ element: popperRect,
4226
+ strategy: 'absolute',
4227
+ placement: placement
4228
+ });
4229
+ var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
4230
+ var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
4231
+ // 0 or negative = within the clipping rect
4232
+
4233
+ var overflowOffsets = {
4234
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
4235
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
4236
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
4237
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
4238
+ };
4239
+ var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
4240
+
4241
+ if (elementContext === popper && offsetData) {
4242
+ var offset = offsetData[placement];
4243
+ Object.keys(overflowOffsets).forEach(function (key) {
4244
+ var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
4245
+ var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
4246
+ overflowOffsets[key] += offset[axis] * multiply;
4247
+ });
4248
+ }
4249
+
4250
+ return overflowOffsets;
4251
+ }
4252
+
4253
+ function computeAutoPlacement(state, options) {
4254
+ if (options === void 0) {
4255
+ options = {};
4256
+ }
4257
+
4258
+ var _options = options,
4259
+ placement = _options.placement,
4260
+ boundary = _options.boundary,
4261
+ rootBoundary = _options.rootBoundary,
4262
+ padding = _options.padding,
4263
+ flipVariations = _options.flipVariations,
4264
+ _options$allowedAutoP = _options.allowedAutoPlacements,
4265
+ allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
4266
+ var variation = getVariation(placement);
4267
+ var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
4268
+ return getVariation(placement) === variation;
4269
+ }) : basePlacements;
4270
+ var allowedPlacements = placements$1.filter(function (placement) {
4271
+ return allowedAutoPlacements.indexOf(placement) >= 0;
4272
+ });
4273
+
4274
+ if (allowedPlacements.length === 0) {
4275
+ allowedPlacements = placements$1;
4276
+ } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
4277
+
4278
+
4279
+ var overflows = allowedPlacements.reduce(function (acc, placement) {
4280
+ acc[placement] = detectOverflow(state, {
4281
+ placement: placement,
4282
+ boundary: boundary,
4283
+ rootBoundary: rootBoundary,
4284
+ padding: padding
4285
+ })[getBasePlacement(placement)];
4286
+ return acc;
4287
+ }, {});
4288
+ return Object.keys(overflows).sort(function (a, b) {
4289
+ return overflows[a] - overflows[b];
4290
+ });
4291
+ }
4292
+
4293
+ function getExpandedFallbackPlacements(placement) {
4294
+ if (getBasePlacement(placement) === auto) {
4295
+ return [];
4296
+ }
4297
+
4298
+ var oppositePlacement = getOppositePlacement(placement);
4299
+ return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
4300
+ }
4301
+
4302
+ function flip(_ref) {
4303
+ var state = _ref.state,
4304
+ options = _ref.options,
4305
+ name = _ref.name;
4306
+
4307
+ if (state.modifiersData[name]._skip) {
4308
+ return;
4309
+ }
4310
+
4311
+ var _options$mainAxis = options.mainAxis,
4312
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
4313
+ _options$altAxis = options.altAxis,
4314
+ checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
4315
+ specifiedFallbackPlacements = options.fallbackPlacements,
4316
+ padding = options.padding,
4317
+ boundary = options.boundary,
4318
+ rootBoundary = options.rootBoundary,
4319
+ altBoundary = options.altBoundary,
4320
+ _options$flipVariatio = options.flipVariations,
4321
+ flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
4322
+ allowedAutoPlacements = options.allowedAutoPlacements;
4323
+ var preferredPlacement = state.options.placement;
4324
+ var basePlacement = getBasePlacement(preferredPlacement);
4325
+ var isBasePlacement = basePlacement === preferredPlacement;
4326
+ var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
4327
+ var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
4328
+ return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
4329
+ placement: placement,
4330
+ boundary: boundary,
4331
+ rootBoundary: rootBoundary,
4332
+ padding: padding,
4333
+ flipVariations: flipVariations,
4334
+ allowedAutoPlacements: allowedAutoPlacements
4335
+ }) : placement);
4336
+ }, []);
4337
+ var referenceRect = state.rects.reference;
4338
+ var popperRect = state.rects.popper;
4339
+ var checksMap = new Map();
4340
+ var makeFallbackChecks = true;
4341
+ var firstFittingPlacement = placements[0];
4342
+
4343
+ for (var i = 0; i < placements.length; i++) {
4344
+ var placement = placements[i];
4345
+
4346
+ var _basePlacement = getBasePlacement(placement);
4347
+
4348
+ var isStartVariation = getVariation(placement) === start;
4349
+ var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
4350
+ var len = isVertical ? 'width' : 'height';
4351
+ var overflow = detectOverflow(state, {
4352
+ placement: placement,
4353
+ boundary: boundary,
4354
+ rootBoundary: rootBoundary,
4355
+ altBoundary: altBoundary,
4356
+ padding: padding
4357
+ });
4358
+ var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
4359
+
4360
+ if (referenceRect[len] > popperRect[len]) {
4361
+ mainVariationSide = getOppositePlacement(mainVariationSide);
4362
+ }
4363
+
4364
+ var altVariationSide = getOppositePlacement(mainVariationSide);
4365
+ var checks = [];
4366
+
4367
+ if (checkMainAxis) {
4368
+ checks.push(overflow[_basePlacement] <= 0);
4369
+ }
4370
+
4371
+ if (checkAltAxis) {
4372
+ checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
4373
+ }
4374
+
4375
+ if (checks.every(function (check) {
4376
+ return check;
4377
+ })) {
4378
+ firstFittingPlacement = placement;
4379
+ makeFallbackChecks = false;
4380
+ break;
4381
+ }
4382
+
4383
+ checksMap.set(placement, checks);
4384
+ }
4385
+
4386
+ if (makeFallbackChecks) {
4387
+ // `2` may be desired in some cases – research later
4388
+ var numberOfChecks = flipVariations ? 3 : 1;
4389
+
4390
+ var _loop = function _loop(_i) {
4391
+ var fittingPlacement = placements.find(function (placement) {
4392
+ var checks = checksMap.get(placement);
4393
+
4394
+ if (checks) {
4395
+ return checks.slice(0, _i).every(function (check) {
4396
+ return check;
4397
+ });
4398
+ }
4399
+ });
4400
+
4401
+ if (fittingPlacement) {
4402
+ firstFittingPlacement = fittingPlacement;
4403
+ return "break";
4404
+ }
4405
+ };
4406
+
4407
+ for (var _i = numberOfChecks; _i > 0; _i--) {
4408
+ var _ret = _loop(_i);
4409
+
4410
+ if (_ret === "break") break;
4411
+ }
4412
+ }
4413
+
4414
+ if (state.placement !== firstFittingPlacement) {
4415
+ state.modifiersData[name]._skip = true;
4416
+ state.placement = firstFittingPlacement;
4417
+ state.reset = true;
4418
+ }
4419
+ } // eslint-disable-next-line import/no-unused-modules
4420
+
4421
+
4422
+ const flip$1 = {
4423
+ name: 'flip',
4424
+ enabled: true,
4425
+ phase: 'main',
4426
+ fn: flip,
4427
+ requiresIfExists: ['offset'],
4428
+ data: {
4429
+ _skip: false
4430
+ }
4431
+ };
4432
+
4433
+ function getSideOffsets(overflow, rect, preventedOffsets) {
4434
+ if (preventedOffsets === void 0) {
4435
+ preventedOffsets = {
4436
+ x: 0,
4437
+ y: 0
4438
+ };
4439
+ }
4440
+
4441
+ return {
4442
+ top: overflow.top - rect.height - preventedOffsets.y,
4443
+ right: overflow.right - rect.width + preventedOffsets.x,
4444
+ bottom: overflow.bottom - rect.height + preventedOffsets.y,
4445
+ left: overflow.left - rect.width - preventedOffsets.x
4446
+ };
4447
+ }
4448
+
4449
+ function isAnySideFullyClipped(overflow) {
4450
+ return [top, right, bottom, left].some(function (side) {
4451
+ return overflow[side] >= 0;
4452
+ });
4453
+ }
4454
+
4455
+ function hide(_ref) {
4456
+ var state = _ref.state,
4457
+ name = _ref.name;
4458
+ var referenceRect = state.rects.reference;
4459
+ var popperRect = state.rects.popper;
4460
+ var preventedOffsets = state.modifiersData.preventOverflow;
4461
+ var referenceOverflow = detectOverflow(state, {
4462
+ elementContext: 'reference'
4463
+ });
4464
+ var popperAltOverflow = detectOverflow(state, {
4465
+ altBoundary: true
4466
+ });
4467
+ var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
4468
+ var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
4469
+ var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
4470
+ var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
4471
+ state.modifiersData[name] = {
4472
+ referenceClippingOffsets: referenceClippingOffsets,
4473
+ popperEscapeOffsets: popperEscapeOffsets,
4474
+ isReferenceHidden: isReferenceHidden,
4475
+ hasPopperEscaped: hasPopperEscaped
4476
+ };
4477
+ state.attributes.popper = Object.assign({}, state.attributes.popper, {
4478
+ 'data-popper-reference-hidden': isReferenceHidden,
4479
+ 'data-popper-escaped': hasPopperEscaped
4480
+ });
4481
+ } // eslint-disable-next-line import/no-unused-modules
4482
+
4483
+
4484
+ const hide$1 = {
4485
+ name: 'hide',
4486
+ enabled: true,
4487
+ phase: 'main',
4488
+ requiresIfExists: ['preventOverflow'],
4489
+ fn: hide
4490
+ };
4491
+
4492
+ function distanceAndSkiddingToXY(placement, rects, offset) {
4493
+ var basePlacement = getBasePlacement(placement);
4494
+ var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
4495
+
4496
+ var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
4497
+ placement: placement
4498
+ })) : offset,
4499
+ skidding = _ref[0],
4500
+ distance = _ref[1];
4501
+
4502
+ skidding = skidding || 0;
4503
+ distance = (distance || 0) * invertDistance;
4504
+ return [left, right].indexOf(basePlacement) >= 0 ? {
4505
+ x: distance,
4506
+ y: skidding
4507
+ } : {
4508
+ x: skidding,
4509
+ y: distance
4510
+ };
4511
+ }
4512
+
4513
+ function offset(_ref2) {
4514
+ var state = _ref2.state,
4515
+ options = _ref2.options,
4516
+ name = _ref2.name;
4517
+ var _options$offset = options.offset,
4518
+ offset = _options$offset === void 0 ? [0, 0] : _options$offset;
4519
+ var data = placements.reduce(function (acc, placement) {
4520
+ acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
4521
+ return acc;
4522
+ }, {});
4523
+ var _data$state$placement = data[state.placement],
4524
+ x = _data$state$placement.x,
4525
+ y = _data$state$placement.y;
4526
+
4527
+ if (state.modifiersData.popperOffsets != null) {
4528
+ state.modifiersData.popperOffsets.x += x;
4529
+ state.modifiersData.popperOffsets.y += y;
4530
+ }
4531
+
4532
+ state.modifiersData[name] = data;
4533
+ } // eslint-disable-next-line import/no-unused-modules
4534
+
4535
+
4536
+ const offset$1 = {
4537
+ name: 'offset',
4538
+ enabled: true,
4539
+ phase: 'main',
4540
+ requires: ['popperOffsets'],
4541
+ fn: offset
4542
+ };
4543
+
4544
+ function popperOffsets(_ref) {
4545
+ var state = _ref.state,
4546
+ name = _ref.name;
4547
+ // Offsets are the actual position the popper needs to have to be
4548
+ // properly positioned near its reference element
4549
+ // This is the most basic placement, and will be adjusted by
4550
+ // the modifiers in the next step
4551
+ state.modifiersData[name] = computeOffsets({
4552
+ reference: state.rects.reference,
4553
+ element: state.rects.popper,
4554
+ strategy: 'absolute',
4555
+ placement: state.placement
4556
+ });
4557
+ } // eslint-disable-next-line import/no-unused-modules
4558
+
4559
+
4560
+ const popperOffsets$1 = {
4561
+ name: 'popperOffsets',
4562
+ enabled: true,
4563
+ phase: 'read',
4564
+ fn: popperOffsets,
4565
+ data: {}
4566
+ };
4567
+
4568
+ function getAltAxis(axis) {
4569
+ return axis === 'x' ? 'y' : 'x';
4570
+ }
4571
+
4572
+ function preventOverflow(_ref) {
4573
+ var state = _ref.state,
4574
+ options = _ref.options,
4575
+ name = _ref.name;
4576
+ var _options$mainAxis = options.mainAxis,
4577
+ checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
4578
+ _options$altAxis = options.altAxis,
4579
+ checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
4580
+ boundary = options.boundary,
4581
+ rootBoundary = options.rootBoundary,
4582
+ altBoundary = options.altBoundary,
4583
+ padding = options.padding,
4584
+ _options$tether = options.tether,
4585
+ tether = _options$tether === void 0 ? true : _options$tether,
4586
+ _options$tetherOffset = options.tetherOffset,
4587
+ tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
4588
+ var overflow = detectOverflow(state, {
4589
+ boundary: boundary,
4590
+ rootBoundary: rootBoundary,
4591
+ padding: padding,
4592
+ altBoundary: altBoundary
4593
+ });
4594
+ var basePlacement = getBasePlacement(state.placement);
4595
+ var variation = getVariation(state.placement);
4596
+ var isBasePlacement = !variation;
4597
+ var mainAxis = getMainAxisFromPlacement(basePlacement);
4598
+ var altAxis = getAltAxis(mainAxis);
4599
+ var popperOffsets = state.modifiersData.popperOffsets;
4600
+ var referenceRect = state.rects.reference;
4601
+ var popperRect = state.rects.popper;
4602
+ var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
4603
+ placement: state.placement
4604
+ })) : tetherOffset;
4605
+ var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
4606
+ mainAxis: tetherOffsetValue,
4607
+ altAxis: tetherOffsetValue
4608
+ } : Object.assign({
4609
+ mainAxis: 0,
4610
+ altAxis: 0
4611
+ }, tetherOffsetValue);
4612
+ var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
4613
+ var data = {
4614
+ x: 0,
4615
+ y: 0
4616
+ };
4617
+
4618
+ if (!popperOffsets) {
4619
+ return;
4620
+ }
4621
+
4622
+ if (checkMainAxis) {
4623
+ var _offsetModifierState$;
4624
+
4625
+ var mainSide = mainAxis === 'y' ? top : left;
4626
+ var altSide = mainAxis === 'y' ? bottom : right;
4627
+ var len = mainAxis === 'y' ? 'height' : 'width';
4628
+ var offset = popperOffsets[mainAxis];
4629
+ var min$1 = offset + overflow[mainSide];
4630
+ var max$1 = offset - overflow[altSide];
4631
+ var additive = tether ? -popperRect[len] / 2 : 0;
4632
+ var minLen = variation === start ? referenceRect[len] : popperRect[len];
4633
+ var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
4634
+ // outside the reference bounds
4635
+
4636
+ var arrowElement = state.elements.arrow;
4637
+ var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
4638
+ width: 0,
4639
+ height: 0
4640
+ };
4641
+ var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
4642
+ var arrowPaddingMin = arrowPaddingObject[mainSide];
4643
+ var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
4644
+ // to include its full size in the calculation. If the reference is small
4645
+ // and near the edge of a boundary, the popper can overflow even if the
4646
+ // reference is not overflowing as well (e.g. virtual elements with no
4647
+ // width or height)
4648
+
4649
+ var arrowLen = within(0, referenceRect[len], arrowRect[len]);
4650
+ var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
4651
+ var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
4652
+ var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
4653
+ var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
4654
+ var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
4655
+ var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
4656
+ var tetherMax = offset + maxOffset - offsetModifierValue;
4657
+ var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
4658
+ popperOffsets[mainAxis] = preventedOffset;
4659
+ data[mainAxis] = preventedOffset - offset;
4660
+ }
4661
+
4662
+ if (checkAltAxis) {
4663
+ var _offsetModifierState$2;
4664
+
4665
+ var _mainSide = mainAxis === 'x' ? top : left;
4666
+
4667
+ var _altSide = mainAxis === 'x' ? bottom : right;
4668
+
4669
+ var _offset = popperOffsets[altAxis];
4670
+
4671
+ var _len = altAxis === 'y' ? 'height' : 'width';
4672
+
4673
+ var _min = _offset + overflow[_mainSide];
4674
+
4675
+ var _max = _offset - overflow[_altSide];
4676
+
4677
+ var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
4678
+
4679
+ var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
4680
+
4681
+ var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
4682
+
4683
+ var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
4684
+
4685
+ var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
4686
+
4687
+ popperOffsets[altAxis] = _preventedOffset;
4688
+ data[altAxis] = _preventedOffset - _offset;
4689
+ }
4690
+
4691
+ state.modifiersData[name] = data;
4692
+ } // eslint-disable-next-line import/no-unused-modules
4693
+
4694
+
4695
+ const preventOverflow$1 = {
4696
+ name: 'preventOverflow',
4697
+ enabled: true,
4698
+ phase: 'main',
4699
+ fn: preventOverflow,
4700
+ requiresIfExists: ['offset']
4701
+ };
4702
+
4703
+ function getHTMLElementScroll(element) {
4704
+ return {
4705
+ scrollLeft: element.scrollLeft,
4706
+ scrollTop: element.scrollTop
4707
+ };
4708
+ }
4709
+
4710
+ function getNodeScroll(node) {
4711
+ if (node === getWindow(node) || !isHTMLElement(node)) {
4712
+ return getWindowScroll(node);
4713
+ } else {
4714
+ return getHTMLElementScroll(node);
4715
+ }
4716
+ }
4717
+
4718
+ function isElementScaled(element) {
4719
+ var rect = element.getBoundingClientRect();
4720
+ var scaleX = round(rect.width) / element.offsetWidth || 1;
4721
+ var scaleY = round(rect.height) / element.offsetHeight || 1;
4722
+ return scaleX !== 1 || scaleY !== 1;
4723
+ } // Returns the composite rect of an element relative to its offsetParent.
4724
+ // Composite means it takes into account transforms as well as layout.
4725
+
4726
+
4727
+ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
4728
+ if (isFixed === void 0) {
4729
+ isFixed = false;
4730
+ }
4731
+
4732
+ var isOffsetParentAnElement = isHTMLElement(offsetParent);
4733
+ var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
4734
+ var documentElement = getDocumentElement(offsetParent);
4735
+ var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
4736
+ var scroll = {
4737
+ scrollLeft: 0,
4738
+ scrollTop: 0
4739
+ };
4740
+ var offsets = {
4741
+ x: 0,
4742
+ y: 0
4743
+ };
4744
+
4745
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
4746
+ if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
4747
+ isScrollParent(documentElement)) {
4748
+ scroll = getNodeScroll(offsetParent);
4749
+ }
4750
+
4751
+ if (isHTMLElement(offsetParent)) {
4752
+ offsets = getBoundingClientRect(offsetParent, true);
4753
+ offsets.x += offsetParent.clientLeft;
4754
+ offsets.y += offsetParent.clientTop;
4755
+ } else if (documentElement) {
4756
+ offsets.x = getWindowScrollBarX(documentElement);
4757
+ }
4758
+ }
4759
+
4760
+ return {
4761
+ x: rect.left + scroll.scrollLeft - offsets.x,
4762
+ y: rect.top + scroll.scrollTop - offsets.y,
4763
+ width: rect.width,
4764
+ height: rect.height
4765
+ };
4766
+ }
4767
+
4768
+ function order(modifiers) {
4769
+ var map = new Map();
4770
+ var visited = new Set();
4771
+ var result = [];
4772
+ modifiers.forEach(function (modifier) {
4773
+ map.set(modifier.name, modifier);
4774
+ }); // On visiting object, check for its dependencies and visit them recursively
4775
+
4776
+ function sort(modifier) {
4777
+ visited.add(modifier.name);
4778
+ var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
4779
+ requires.forEach(function (dep) {
4780
+ if (!visited.has(dep)) {
4781
+ var depModifier = map.get(dep);
4782
+
4783
+ if (depModifier) {
4784
+ sort(depModifier);
4785
+ }
4786
+ }
4787
+ });
4788
+ result.push(modifier);
4789
+ }
4790
+
4791
+ modifiers.forEach(function (modifier) {
4792
+ if (!visited.has(modifier.name)) {
4793
+ // check for visited object
4794
+ sort(modifier);
4795
+ }
4796
+ });
4797
+ return result;
4798
+ }
4799
+
4800
+ function orderModifiers(modifiers) {
4801
+ // order based on dependencies
4802
+ var orderedModifiers = order(modifiers); // order based on phase
4803
+
4804
+ return modifierPhases.reduce(function (acc, phase) {
4805
+ return acc.concat(orderedModifiers.filter(function (modifier) {
4806
+ return modifier.phase === phase;
4807
+ }));
4808
+ }, []);
4809
+ }
4810
+
4811
+ function debounce(fn) {
4812
+ var pending;
4813
+ return function () {
4814
+ if (!pending) {
4815
+ pending = new Promise(function (resolve) {
4816
+ Promise.resolve().then(function () {
4817
+ pending = undefined;
4818
+ resolve(fn());
4819
+ });
4820
+ });
4821
+ }
4822
+
4823
+ return pending;
4824
+ };
4825
+ }
4826
+
4827
+ function mergeByName(modifiers) {
4828
+ var merged = modifiers.reduce(function (merged, current) {
4829
+ var existing = merged[current.name];
4830
+ merged[current.name] = existing ? Object.assign({}, existing, current, {
4831
+ options: Object.assign({}, existing.options, current.options),
4832
+ data: Object.assign({}, existing.data, current.data)
4833
+ }) : current;
4834
+ return merged;
4835
+ }, {}); // IE11 does not support Object.values
4836
+
4837
+ return Object.keys(merged).map(function (key) {
4838
+ return merged[key];
4839
+ });
4840
+ }
4841
+
4842
+ var DEFAULT_OPTIONS = {
4843
+ placement: 'bottom',
4844
+ modifiers: [],
4845
+ strategy: 'absolute'
4846
+ };
4847
+
4848
+ function areValidElements() {
4849
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
4850
+ args[_key] = arguments[_key];
4851
+ }
4852
+
4853
+ return !args.some(function (element) {
4854
+ return !(element && typeof element.getBoundingClientRect === 'function');
4855
+ });
4856
+ }
4857
+
4858
+ function popperGenerator(generatorOptions) {
4859
+ if (generatorOptions === void 0) {
4860
+ generatorOptions = {};
4861
+ }
4862
+
4863
+ var _generatorOptions = generatorOptions,
4864
+ _generatorOptions$def = _generatorOptions.defaultModifiers,
4865
+ defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
4866
+ _generatorOptions$def2 = _generatorOptions.defaultOptions,
4867
+ defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
4868
+ return function createPopper(reference, popper, options) {
4869
+ if (options === void 0) {
4870
+ options = defaultOptions;
4871
+ }
4872
+
4873
+ var state = {
4874
+ placement: 'bottom',
4875
+ orderedModifiers: [],
4876
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
4877
+ modifiersData: {},
4878
+ elements: {
4879
+ reference: reference,
4880
+ popper: popper
4881
+ },
4882
+ attributes: {},
4883
+ styles: {}
4884
+ };
4885
+ var effectCleanupFns = [];
4886
+ var isDestroyed = false;
4887
+ var instance = {
4888
+ state: state,
4889
+ setOptions: function setOptions(setOptionsAction) {
4890
+ var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
4891
+ cleanupModifierEffects();
4892
+ state.options = Object.assign({}, defaultOptions, state.options, options);
4893
+ state.scrollParents = {
4894
+ reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
4895
+ popper: listScrollParents(popper)
4896
+ }; // Orders the modifiers based on their dependencies and `phase`
4897
+ // properties
4898
+
4899
+ var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
4900
+
4901
+ state.orderedModifiers = orderedModifiers.filter(function (m) {
4902
+ return m.enabled;
4903
+ }); // Validate the provided modifiers so that the consumer will get warned
4904
+
4905
+ runModifierEffects();
4906
+ return instance.update();
4907
+ },
4908
+ // Sync update – it will always be executed, even if not necessary. This
4909
+ // is useful for low frequency updates where sync behavior simplifies the
4910
+ // logic.
4911
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
4912
+ // prefer the async Popper#update method
4913
+ forceUpdate: function forceUpdate() {
4914
+ if (isDestroyed) {
4915
+ return;
4916
+ }
4917
+
4918
+ var _state$elements = state.elements,
4919
+ reference = _state$elements.reference,
4920
+ popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
4921
+ // anymore
4922
+
4923
+ if (!areValidElements(reference, popper)) {
4924
+
4925
+ return;
4926
+ } // Store the reference and popper rects to be read by modifiers
4927
+
4928
+
4929
+ state.rects = {
4930
+ reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
4931
+ popper: getLayoutRect(popper)
4932
+ }; // Modifiers have the ability to reset the current update cycle. The
4933
+ // most common use case for this is the `flip` modifier changing the
4934
+ // placement, which then needs to re-run all the modifiers, because the
4935
+ // logic was previously ran for the previous placement and is therefore
4936
+ // stale/incorrect
4937
+
4938
+ state.reset = false;
4939
+ state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
4940
+ // is filled with the initial data specified by the modifier. This means
4941
+ // it doesn't persist and is fresh on each update.
4942
+ // To ensure persistent data, use `${name}#persistent`
4943
+
4944
+ state.orderedModifiers.forEach(function (modifier) {
4945
+ return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
4946
+ });
4947
+
4948
+ for (var index = 0; index < state.orderedModifiers.length; index++) {
4949
+
4950
+ if (state.reset === true) {
4951
+ state.reset = false;
4952
+ index = -1;
4953
+ continue;
4954
+ }
4955
+
4956
+ var _state$orderedModifie = state.orderedModifiers[index],
4957
+ fn = _state$orderedModifie.fn,
4958
+ _state$orderedModifie2 = _state$orderedModifie.options,
4959
+ _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
4960
+ name = _state$orderedModifie.name;
4961
+
4962
+ if (typeof fn === 'function') {
4963
+ state = fn({
4964
+ state: state,
4965
+ options: _options,
4966
+ name: name,
4967
+ instance: instance
4968
+ }) || state;
4969
+ }
4970
+ }
4971
+ },
4972
+ // Async and optimistically optimized update – it will not be executed if
4973
+ // not necessary (debounced to run at most once-per-tick)
4974
+ update: debounce(function () {
4975
+ return new Promise(function (resolve) {
4976
+ instance.forceUpdate();
4977
+ resolve(state);
4978
+ });
4979
+ }),
4980
+ destroy: function destroy() {
4981
+ cleanupModifierEffects();
4982
+ isDestroyed = true;
4983
+ }
4984
+ };
4985
+
4986
+ if (!areValidElements(reference, popper)) {
4987
+
4988
+ return instance;
4989
+ }
4990
+
4991
+ instance.setOptions(options).then(function (state) {
4992
+ if (!isDestroyed && options.onFirstUpdate) {
4993
+ options.onFirstUpdate(state);
4994
+ }
4995
+ }); // Modifiers have the ability to execute arbitrary code before the first
4996
+ // update cycle runs. They will be executed in the same order as the update
4997
+ // cycle. This is useful when a modifier adds some persistent data that
4998
+ // other modifiers need to use, but the modifier is run after the dependent
4999
+ // one.
5000
+
5001
+ function runModifierEffects() {
5002
+ state.orderedModifiers.forEach(function (_ref3) {
5003
+ var name = _ref3.name,
5004
+ _ref3$options = _ref3.options,
5005
+ options = _ref3$options === void 0 ? {} : _ref3$options,
5006
+ effect = _ref3.effect;
5007
+
5008
+ if (typeof effect === 'function') {
5009
+ var cleanupFn = effect({
5010
+ state: state,
5011
+ name: name,
5012
+ instance: instance,
5013
+ options: options
5014
+ });
5015
+
5016
+ var noopFn = function noopFn() {};
5017
+
5018
+ effectCleanupFns.push(cleanupFn || noopFn);
5019
+ }
5020
+ });
5021
+ }
5022
+
5023
+ function cleanupModifierEffects() {
5024
+ effectCleanupFns.forEach(function (fn) {
5025
+ return fn();
5026
+ });
5027
+ effectCleanupFns = [];
5028
+ }
5029
+
5030
+ return instance;
5031
+ };
5032
+ }
5033
+
5034
+ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
5035
+ var createPopper = /*#__PURE__*/popperGenerator({
5036
+ defaultModifiers: defaultModifiers
5037
+ }); // eslint-disable-next-line import/no-unused-modules
5038
+
5039
+ const mgPopoverCss = "mg-popover{display:contents}mg-popover::slotted(*){display:inline-block}.mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show]{display:block}.mg-popover mg-button{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow,.mg-popover__arrow::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover__arrow{visibility:hidden}.mg-popover__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow{bottom:-6px}.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow{top:-6px}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow{right:-6px}.mg-popover[data-popper-placement^=right]>.mg-popover__arrow{left:-6px}.mg-popover__title ::slotted([slot=title]){margin:0 0 1rem !important;font-size:var(--mg-popover-title-font-size) !important;font-weight:600}";
5040
+
5041
+ const MgPopover = class {
5042
+ constructor(hostRef) {
5043
+ registerInstance(this, hostRef);
5044
+ this.displayChange = createEvent(this, "display-change", 7);
5045
+ this.closeButtonId = '';
5046
+ /**
5047
+ * Sets an `id` attribute.
5048
+ * Needed by the input for accessibility `aria-decribedby`.
5049
+ */
5050
+ this.identifier = createID('mg-popover');
5051
+ /**
5052
+ * Popover placement
5053
+ */
5054
+ this.placement = 'bottom';
5055
+ /**
5056
+ * Define if popover has a cross button
5057
+ */
5058
+ this.closeButton = false;
5059
+ /**
5060
+ * Display popover
5061
+ */
5062
+ this.display = false;
5063
+ /**
5064
+ * Disable popover
5065
+ */
5066
+ this.disabled = false;
5067
+ /**
5068
+ * Check if clicked outside of component
5069
+ *
5070
+ * @param {MouseEvent} event mouse event
5071
+ * @returns {void}
5072
+ */
5073
+ this.clickOutside = (event) => {
5074
+ if (!this.disabled && event.target.closest(`mg-popover`) !== this.element) {
5075
+ this.display = false;
5076
+ }
5077
+ };
5078
+ /**
5079
+ * Show popover
5080
+ *
5081
+ * @returns {void}
5082
+ */
5083
+ this.show = () => {
5084
+ // Make the popover visible
5085
+ this.popover.setAttribute('data-show', '');
5086
+ // Enable the event listeners
5087
+ this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
5088
+ // Update its position
5089
+ this.popper.update();
5090
+ // hide when click outside
5091
+ // setTimeout is used to prevent event to trigger after creation
5092
+ setTimeout(() => {
5093
+ document.addEventListener('click', this.clickOutside, false);
5094
+ }, 0);
5095
+ };
5096
+ /**
5097
+ * Hide popover
5098
+ *
5099
+ * @returns {void}
5100
+ */
5101
+ this.hide = () => {
5102
+ // Hide the popover
5103
+ this.popover.removeAttribute('data-show');
5104
+ // Disable the event listeners
5105
+ this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
5106
+ // Remove event listener
5107
+ document.removeEventListener('click', this.clickOutside, false);
5108
+ };
5109
+ /**
5110
+ * Handle action for close button
5111
+ *
5112
+ * @returns {void}
5113
+ */
5114
+ this.handleCloseButton = () => {
5115
+ this.display = false;
5116
+ };
5117
+ }
5118
+ handleDisplay(newValue) {
5119
+ if (newValue) {
5120
+ this.show();
5121
+ }
5122
+ else {
5123
+ this.hide();
5124
+ }
5125
+ this.displayChange.emit(newValue);
5126
+ }
5127
+ /*************
5128
+ * Lifecycle *
5129
+ *************/
5130
+ /**
5131
+ * Check if component props are well configured on init
5132
+ *
5133
+ * @returns {void} timeout
5134
+ */
5135
+ componentWillLoad() {
5136
+ // Get locales
5137
+ this.messages = initLocales(this.element).messages;
5138
+ }
5139
+ /**
5140
+ * Check if component props are well configured on init
5141
+ *
5142
+ * @returns {void}
5143
+ */
5144
+ componentDidLoad() {
5145
+ const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
5146
+ const slottedTitleElement = this.element.querySelector('[slot="title"]');
5147
+ if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {
5148
+ throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
5149
+ }
5150
+ // Set close button id
5151
+ if (this.closeButton) {
5152
+ this.closeButtonId = `${this.identifier}-close-button`;
5153
+ }
5154
+ // Get popover content
5155
+ this.popover = this.element.shadowRoot.querySelector(`#${this.identifier}`);
5156
+ //Get interactive element (first element without slot attribute)
5157
+ const interactiveElement = this.element.querySelector(':not([slot])');
5158
+ // Add aria attributes
5159
+ interactiveElement.setAttribute('aria-controls', this.identifier);
5160
+ interactiveElement.setAttribute('aria-expanded', `${this.display}`);
5161
+ // Create popperjs popover
5162
+ this.popper = createPopper(interactiveElement, this.popover, {
5163
+ placement: this.placement,
5164
+ modifiers: [
5165
+ {
5166
+ name: 'offset',
5167
+ options: {
5168
+ offset: [0, 10],
5169
+ },
5170
+ },
5171
+ ],
5172
+ });
5173
+ // Add events to toggle display
5174
+ interactiveElement.addEventListener('click', () => {
5175
+ if (!this.disabled)
5176
+ this.display = !this.display;
5177
+ });
5178
+ // Add events to hide popover
5179
+ this.element.addEventListener('keydown', e => {
5180
+ if (!this.disabled && e.code === 'Escape')
5181
+ this.display = false;
5182
+ });
5183
+ this.handleDisplay(this.display);
5184
+ }
5185
+ /**
5186
+ * Render
5187
+ *
5188
+ * @returns {HTMLElement} HTML Element
5189
+ */
5190
+ render() {
5191
+ return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" }), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
5192
+ }
5193
+ get element() { return getElement(this); }
5194
+ static get watchers() { return {
5195
+ "display": ["handleDisplay"]
5196
+ }; }
5197
+ };
5198
+ MgPopover.style = mgPopoverCss;
5199
+
3207
5200
  var Status;
3208
5201
  (function (Status) {
3209
5202
  Status["VISIBLE"] = "visible";
@@ -3350,9 +5343,7 @@ const MgTabs = class {
3350
5343
  }
3351
5344
  validateLabel(newValue) {
3352
5345
  if (typeof newValue !== 'string' || newValue.trim() === '') {
3353
- // TODO: throw new Error on next major (5.0.0)
3354
- // throw new Error('<mg-tabs> prop "label" is required.');
3355
- console.error('<mg-tabs> prop "label" is required.');
5346
+ throw new Error('<mg-tabs> prop "label" is required.');
3356
5347
  }
3357
5348
  }
3358
5349
  validateSize(newValue) {
@@ -3502,7 +5493,7 @@ var Guard;
3502
5493
  Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
3503
5494
  })(Guard || (Guard = {}));
3504
5495
 
3505
- const mgTooltipCss = ".sc-mg-tooltip-h{display:inline-block}.mg-tooltip.sc-mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:9999;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}.mg-tooltip[data-show].sc-mg-tooltip{display:block}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip,.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip{visibility:hidden}.mg-tooltip.sc-mg-tooltip .mg-tooltip__arrow.sc-mg-tooltip::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{top:-4px}.mg-tooltip[data-popper-placement^=left].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{right:-4px}.mg-tooltip[data-popper-placement^=right].sc-mg-tooltip>.mg-tooltip__arrow.sc-mg-tooltip{left:-4px}";
5496
+ const mgTooltipCss = ":host{display:inline-block}.mg-tooltip{display:none;padding:0.5rem 0.8rem;z-index:9999;border-radius:var(--mg-tooltip-border-radius);background-color:hsl(var(--mg-tooltip-background-color));color:hsl(var(--mg-tooltip-font-color));text-align:start}.mg-tooltip[data-show]{display:block}.mg-tooltip .mg-tooltip__arrow,.mg-tooltip .mg-tooltip__arrow::before{position:absolute;width:0.8rem;height:0.8rem;z-index:9999;background:inherit}.mg-tooltip .mg-tooltip__arrow{visibility:hidden}.mg-tooltip .mg-tooltip__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-tooltip[data-popper-placement^=top]>.mg-tooltip__arrow{bottom:-4px}.mg-tooltip[data-popper-placement^=bottom]>.mg-tooltip__arrow{top:-4px}.mg-tooltip[data-popper-placement^=left]>.mg-tooltip__arrow{right:-4px}.mg-tooltip[data-popper-placement^=right]>.mg-tooltip__arrow{left:-4px}";
3506
5497
 
3507
5498
  const MgTooltip = class {
3508
5499
  constructor(hostRef) {
@@ -3593,9 +5584,7 @@ const MgTooltip = class {
3593
5584
  }
3594
5585
  validateMessage(newValue) {
3595
5586
  if (typeof newValue !== 'string' || newValue.trim() === '') {
3596
- // TODO: throw new Error on next major (5.0.0)
3597
- // throw new Error('<mg-tooltip> prop "message" is required.');
3598
- console.error('<mg-tooltip> prop "message" is required.');
5587
+ throw new Error('<mg-tooltip> prop "message" is required.');
3599
5588
  }
3600
5589
  }
3601
5590
  handleDisplay(newValue) {
@@ -3619,12 +5608,12 @@ const MgTooltip = class {
3619
5608
  componentDidLoad() {
3620
5609
  var _a;
3621
5610
  // Get tooltip element
3622
- this.tooltip = this.element.querySelector(`#${this.identifier}`);
5611
+ this.tooltip = this.element.shadowRoot.querySelector(`#${this.identifier}`);
3623
5612
  // get slotted element
3624
5613
  const slotElement = this.element.firstElementChild;
3625
5614
  // Get interactive element
3626
5615
  const interactiveElements = ['a', 'button', 'input', 'textarea', 'select']; //! Might needs updates
3627
- const interactiveElement = this.element.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
5616
+ const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
3628
5617
  // define selected element to become tooltip selector
3629
5618
  const tooltipedElement = interactiveElement || slotElement;
3630
5619
  // Add tabindex to slotted element if we can't find any interactive element
@@ -3696,4 +5685,4 @@ const MgTooltip = class {
3696
5685
  };
3697
5686
  MgTooltip.style = mgTooltipCss;
3698
5687
 
3699
- export { MgBadge as mg_badge, MgButton as mg_button, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInputCheckbox as mg_input_checkbox, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgMessage as mg_message, MgPagination as mg_pagination, MgPanel as mg_panel, MgTabs as mg_tabs, MgTag as mg_tag, MgTooltip as mg_tooltip };
5688
+ export { MgBadge as mg_badge, MgButton as mg_button, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInputCheckbox as mg_input_checkbox, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgMessage as mg_message, MgPagination as mg_pagination, MgPanel as mg_panel, MgPopover as mg_popover, MgTabs as mg_tabs, MgTag as mg_tag, MgTooltip as mg_tooltip };