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