@mgdis/mg-components 4.1.1 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-dd2c7f7b.js → index-94497267.js} +455 -317
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{mg-badge_24.cjs.entry.js → mg-badge_23.cjs.entry.js} +219 -2181
- package/dist/cjs/mg-components.cjs.js +3 -26
- package/dist/cjs/mg-modal.cjs.entry.js +15 -2
- package/dist/cjs/mg-popover.cjs.entry.js +171 -0
- package/dist/cjs/popper-11d5f714.js +1801 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +118 -99
- package/dist/collection/components/atoms/mg-button/mg-button.js +221 -220
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +72 -69
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +1 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +102 -92
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +85 -67
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +64 -55
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +3 -6
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +122 -106
- package/dist/collection/components/molecules/inputs/MgInput.js +10 -17
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +323 -318
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +3 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +356 -361
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +1 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +463 -457
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +347 -340
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +348 -343
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +406 -401
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +12 -15
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +476 -473
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +461 -456
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +2 -8
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +299 -298
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +1 -3
- package/dist/collection/components/molecules/mg-details/mg-details.js +95 -93
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +13 -27
- package/dist/collection/components/molecules/mg-form/mg-form.js +175 -166
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +2 -6
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +37 -37
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +1 -3
- package/dist/collection/components/molecules/mg-message/mg-message.js +154 -153
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +11 -15
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +153 -134
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +5 -6
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +112 -117
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +1 -8
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +194 -189
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +1 -4
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +3 -5
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +129 -127
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +1 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +152 -135
- package/dist/collection/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/collection/locales/en/messages.json +50 -0
- package/dist/collection/locales/fr/messages.json +50 -0
- package/dist/collection/stories/grids.stories.js +1 -44
- package/dist/collection/stories/helpers.stories.js +1 -19
- package/dist/collection/stories/icons.stories.js +1 -4
- package/dist/collection/stories/typography.stories.js +1 -12
- package/dist/collection/variables.css +3 -2
- package/dist/collection/variables.scss +3 -2
- package/dist/components/MgInput.js +8 -3
- package/dist/components/mg-badge2.js +9 -0
- package/dist/components/mg-button2.js +2 -7
- package/dist/components/mg-input-checkbox.js +1 -6
- package/dist/components/mg-input-date.js +10 -27
- package/dist/components/mg-input-numeric.js +2 -7
- package/dist/components/mg-input-password.js +1 -6
- package/dist/components/mg-input-radio.js +1 -6
- package/dist/components/mg-input-select2.js +1 -6
- package/dist/components/mg-input-text2.js +3 -8
- package/dist/components/mg-input-textarea.js +2 -7
- package/dist/components/mg-input-title2.js +11 -0
- package/dist/components/mg-input-toggle.js +2 -7
- package/dist/components/mg-modal.js +14 -1
- package/dist/components/mg-pagination.js +3 -3
- package/dist/components/mg-panel.js +10 -4
- package/dist/components/mg-popover.js +1 -1
- package/dist/components/mg-tabs.js +10 -1
- package/dist/components/mg-tooltip2.js +9 -0
- package/dist/components/popper.js +60 -49
- package/dist/esm/{index-f58b769f.js → index-aad0184c.js} +456 -317
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-badge_24.entry.js → mg-badge_23.entry.js} +220 -2181
- package/dist/esm/mg-components.js +3 -26
- package/dist/esm/mg-modal.entry.js +15 -2
- package/dist/esm/mg-popover.entry.js +167 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/popper-f860750c.js +1799 -0
- package/dist/mg-components/fonts/OpenSans-Bold.ttf +0 -0
- package/dist/mg-components/locales/en/messages.json +50 -0
- package/dist/mg-components/locales/fr/messages.json +50 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-25452f60.entry.js +1 -0
- package/dist/mg-components/p-3899d5d2.js +2 -0
- package/dist/mg-components/p-a20fc541.entry.js +1 -0
- package/dist/mg-components/p-e08bc19a.entry.js +1 -0
- package/dist/mg-components/p-ec26fc38.js +1 -0
- package/dist/mg-components/variables.css +3 -2
- package/dist/mg-components/variables.scss +3 -2
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -1
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +1 -10
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +0 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +2 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +29 -29
- package/dist/types/stencil-public-runtime.d.ts +15 -4
- package/loader/package.json +1 -0
- package/package.json +9 -9
- package/dist/collection/fonts/Poppins-Bold.ttf +0 -0
- package/dist/mg-components/fonts/Poppins-Bold.ttf +0 -0
- package/dist/mg-components/p-2a3d8f60.entry.js +0 -1
- package/dist/mg-components/p-b6df1cac.js +0 -2
- package/dist/mg-components/p-c8779533.entry.js +0 -1
|
@@ -18,6 +18,13 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
18
18
|
this.tagName = this.isLegend ? 'legend' : 'label';
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
+
validateIdentifier(newValue) {
|
|
22
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
23
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
24
|
+
// throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
25
|
+
console.error('<mg-input-title> prop "identifier" is required.');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
21
28
|
/*************
|
|
22
29
|
* Lifecycle *
|
|
23
30
|
*************/
|
|
@@ -27,6 +34,7 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
27
34
|
* @returns {void}
|
|
28
35
|
*/
|
|
29
36
|
componentWillLoad() {
|
|
37
|
+
this.validateIdentifier(this.identifier);
|
|
30
38
|
this.getTagName();
|
|
31
39
|
}
|
|
32
40
|
/**
|
|
@@ -39,6 +47,9 @@ const MgInputTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
39
47
|
// \u00A0 represent a
|
|
40
48
|
return (h(TagName, { class: "mg-input-title", htmlFor: this.isLegend ? undefined : this.identifier }, h("slot", null), this.required && (h("span", { class: "mg-input-title__required" }, "\u00A0", h("span", { class: "is-asterisk" }, "*")))));
|
|
41
49
|
}
|
|
50
|
+
static get watchers() { return {
|
|
51
|
+
"identifier": ["validateIdentifier"]
|
|
52
|
+
}; }
|
|
42
53
|
static get style() { return mgInputTitleCss; }
|
|
43
54
|
}, [6, "mg-input-title", {
|
|
44
55
|
"identifier": [1],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { M as MgInput } from './MgInput.js';
|
|
3
|
-
import {
|
|
3
|
+
import { C as ClassList, a as allItemsAreString } from './components.utils.js';
|
|
4
4
|
import { d as defineCustomElement$4 } from './mg-icon2.js';
|
|
5
5
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
7
7
|
|
|
8
|
-
const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3}";
|
|
8
|
+
const mgInputToggleCss = ":host{display:block}.mg-input{display:flex;align-items:flex-start;min-height:var(--default-size);max-width:100%;margin-bottom:var(--mg-inputs-margin-bottom, 0);}.mg-input mg-input-title{flex-shrink:var(--mg-inputs-shrink, 1);width:var(--mg-inputs-title-width, auto);margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-input.mg-input--label-on-top{flex-direction:column}.mg-input.mg-input--label-on-top .mg-input__input-container{width:100%}.mg-input__title{display:flex;align-items:baseline;margin-bottom:0.3rem}.mg-input__title mg-input-title{flex-shrink:1;width:auto;margin-top:0;margin-right:var(--mg-inputs-spacer);text-align:left}.mg-input__title mg-tooltip{margin-top:0}.mg-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-input__input-container{min-height:var(--default-size);}.mg-input__input-container>strong{display:inline-block;margin-top:calc((var(--default-size) - var(--font-size) * var(--line-height)) / 2);min-height:var(--font-size)}.mg-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-input__input-container .mg-input__help-text,.mg-input__input-container .mg-input__error{text-align:start;font-size:1.2rem}.mg-input__input{display:flex;}.mg-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2)}.mg-input__input.mg-input__input--has-error .mg-input__box{border-color:hsl(var(--color-danger))}.mg-input__input+.mg-input__help-text,.mg-input__input+.mg-input__error{margin-top:0.5rem}.mg-input__error{display:inline-block;margin-top:0.2rem;padding:0.3rem 0.8rem;border-radius:0.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-input__input mg-icon,.mg-input__error mg-icon{display:flex}.sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-input.mg-input.mg-input--toggle .mg-input__input-container{flex:auto;min-width:0}.mg-input__button-toggle{display:flex;padding:0.2rem;min-width:0;background-color:hsl(var(--color-light));border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size) * var(--line-height) + 2 * (0.7rem + var(--mg-inputs-border-width))) / var(--mg-input-toggle-border-radius-ratio));font-family:var(--font-family);font-size:inherit;line-height:inherit;cursor:pointer}.mg-input__button-toggle:disabled{cursor:default}.mg-input__toggle-item-container{padding:0.5rem 0.9rem;border:0;box-sizing:border-box;border-radius:calc((var(--font-size) * var(--line-height) + 1rem) / var(--mg-input-toggle-border-radius-ratio));background-color:unset;font-weight:unset;color:hsl(var(--color-dark));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{font-weight:600;color:hsl(var(--color-info));background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%))}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container{display:flex;justify-content:center;align-items:center;width:calc(var(--font-size) * var(--line-height) + 1rem);height:calc(var(--font-size) * var(--line-height) + 1rem);padding:0;visibility:hidden}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container:first-of-type{visibility:visible}.mg-input.mg-input--toggle-icon .mg-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{visibility:hidden}.mg-input.mg-input--toggle-icon.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{visibility:visible}.mg-input.mg-input--toggle-on-off .mg-input__toggle-item-container:first-of-type{font-weight:600;color:hsl(var(--color-dark));background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%))}.mg-input.mg-input--toggle-on-off.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{background-color:unset;font-weight:unset;color:hsl(var(--color-dark))}.mg-input.mg-input--toggle-readonly .mg-input__button-toggle{border-color:transparent;background-color:transparent;cursor:initial}.mg-input.mg-input--toggle-readonly .mg-input__toggle-item-container:last-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:first-of-type{display:none}.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type{display:flex}.mg-input.mg-input--toggle-disabled .mg-input__button-toggle{opacity:0.3}";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* type Option validation function
|
|
@@ -30,11 +30,6 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
30
30
|
this.classIsActive = 'mg-input--toggle-is-active';
|
|
31
31
|
this.classOnOff = 'mg-input--toggle-on-off';
|
|
32
32
|
this.classIcon = 'mg-input--toggle-icon';
|
|
33
|
-
/**
|
|
34
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
35
|
-
* If not set, it will be created.
|
|
36
|
-
*/
|
|
37
|
-
this.identifier = createID('mg-input-toggle');
|
|
38
33
|
/**
|
|
39
34
|
* Input name
|
|
40
35
|
* If not set the value equals the identifier
|
|
@@ -4,7 +4,7 @@ import { i as initLocales } from './index2.js';
|
|
|
4
4
|
import { d as defineCustomElement$3 } from './mg-button2.js';
|
|
5
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
6
|
|
|
7
|
-
const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-
|
|
7
|
+
const mgModalCss = ".mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;padding:2rem 0;background-color:hsla(var(--color-light), 85%)}.mg-modal__dialog{display:flex;flex-direction:column;align-self:center;row-gap:3rem;padding:1.5rem 2.5rem;width:60rem;height:fit-content;max-width:100%;max-height:100%;box-sizing:border-box;background-color:hsl(var(--color-light));box-shadow:var(--box-shadow);border-radius:var(--mg-modal-border-radius)}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}";
|
|
8
8
|
|
|
9
9
|
const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
10
|
constructor() {
|
|
@@ -58,14 +58,23 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
58
58
|
this.hide = true;
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
validateModalTitle(newValue) {
|
|
62
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
63
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
64
|
+
// throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
65
|
+
console.error('<mg-modal> prop "modalTitle" is required.');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
61
68
|
validateHide(newValue) {
|
|
62
69
|
if (newValue) {
|
|
63
70
|
this.componentHide.emit();
|
|
64
71
|
this.classList.add(this.classHide);
|
|
72
|
+
document.body.style.overflow = this.bodyOverflow;
|
|
65
73
|
}
|
|
66
74
|
else {
|
|
67
75
|
this.componentShow.emit();
|
|
68
76
|
this.classList.delete(this.classHide);
|
|
77
|
+
document.body.style.overflow = 'hidden';
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
/**
|
|
@@ -89,6 +98,8 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
89
98
|
* @returns {void}
|
|
90
99
|
*/
|
|
91
100
|
componentWillLoad() {
|
|
101
|
+
// Store body overflow
|
|
102
|
+
this.bodyOverflow = document.body.style.overflow;
|
|
92
103
|
// Get locales
|
|
93
104
|
this.messages = initLocales(this.element).messages;
|
|
94
105
|
// Validate
|
|
@@ -98,6 +109,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
98
109
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
99
110
|
}
|
|
100
111
|
this.titleId = `${this.identifier}-title`;
|
|
112
|
+
this.validateModalTitle(this.modalTitle);
|
|
101
113
|
this.validateHide(this.hide);
|
|
102
114
|
}
|
|
103
115
|
/**
|
|
@@ -110,6 +122,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
110
122
|
}
|
|
111
123
|
get element() { return this; }
|
|
112
124
|
static get watchers() { return {
|
|
125
|
+
"modalTitle": ["validateModalTitle"],
|
|
113
126
|
"hide": ["validateHide"]
|
|
114
127
|
}; }
|
|
115
128
|
static get style() { return mgModalCss; }
|
|
@@ -13,7 +13,7 @@ var NavigationAction;
|
|
|
13
13
|
NavigationAction["PREVIOUS"] = "previous";
|
|
14
14
|
})(NavigationAction || (NavigationAction = {}));
|
|
15
15
|
|
|
16
|
-
const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-
|
|
16
|
+
const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}.mg-pagination{display:flex;align-items:center;flex-direction:row}.mg-pagination mg-input-select{margin-right:0.5rem}.mg-pagination mg-button{display:flex}.mg-pagination mg-button:first-of-type{margin-right:1rem}.mg-pagination mg-button:last-of-type{margin-left:1rem}";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Range generator
|
|
@@ -126,10 +126,10 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
126
126
|
* @returns {HTMLElement} HTML Element
|
|
127
127
|
*/
|
|
128
128
|
render() {
|
|
129
|
-
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`,
|
|
129
|
+
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
130
130
|
// eslint-disable-next-line react/jsx-no-bind
|
|
131
131
|
onClick: () => this.handleGoToPage(action), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
132
|
-
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-
|
|
132
|
+
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
133
133
|
}
|
|
134
134
|
get element() { return this; }
|
|
135
135
|
static get watchers() { return {
|
|
@@ -8,7 +8,7 @@ import { d as defineCustomElement$4 } from './mg-input-text2.js';
|
|
|
8
8
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
9
9
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
10
10
|
|
|
11
|
-
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__header-left mg-button:not([slot=append-input]){margin:0 0.3rem 0 0}.mg-panel__header-left mg-button:not([slot=append-input])>*:first-of-type{font-family:var(--font-family-heading);font-size:1.4rem;font-weight:
|
|
11
|
+
const mgPanelCss = ".mg-panel{background-color:hsl(var(--mg-panel-background));border-radius:var(--mg-panel-border-radius);box-shadow:var(--box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__header-right{flex:1 auto}.mg-panel__header-left mg-input-text{flex-grow:1}.mg-panel__header-left mg-button:not([slot=append-input]){margin:0 0.3rem 0 0}.mg-panel__header-left mg-button:not([slot=append-input])>*:first-of-type{font-family:var(--font-family-heading);font-size:1.4rem;font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
|
|
12
12
|
|
|
13
13
|
const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
@@ -123,14 +123,19 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
123
123
|
return collapseButton();
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
validatePanelTitle(newValue) {
|
|
127
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
128
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
129
|
+
// throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
130
|
+
console.error('<mg-panel> prop "panelTitle" is required.');
|
|
131
|
+
}
|
|
127
132
|
this.titleChange.emit(newValue);
|
|
128
133
|
}
|
|
129
134
|
validatetitlePattern(newValue) {
|
|
130
135
|
if (newValue && !this.titleEditable) {
|
|
131
136
|
throw new Error('<mg-panel> prop "titleEditable" must be set to `true`.');
|
|
132
137
|
}
|
|
133
|
-
if (newValue && this.titlePatternErrorMessage === undefined) {
|
|
138
|
+
if (newValue && (this.titlePatternErrorMessage === undefined || this.titlePatternErrorMessage.trim() === '')) {
|
|
134
139
|
throw new Error('<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".');
|
|
135
140
|
}
|
|
136
141
|
}
|
|
@@ -150,6 +155,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
150
155
|
this.messages = initLocales(this.element).messages;
|
|
151
156
|
// Validate
|
|
152
157
|
this.validatetitlePattern(this.titlePattern);
|
|
158
|
+
this.validatePanelTitle(this.panelTitle);
|
|
153
159
|
}
|
|
154
160
|
/**
|
|
155
161
|
* Edit DOM after render
|
|
@@ -172,7 +178,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
172
178
|
}
|
|
173
179
|
get element() { return this; }
|
|
174
180
|
static get watchers() { return {
|
|
175
|
-
"panelTitle": ["
|
|
181
|
+
"panelTitle": ["validatePanelTitle"],
|
|
176
182
|
"titlePattern": ["validatetitlePattern"],
|
|
177
183
|
"expanded": ["handleExpanded"]
|
|
178
184
|
}; }
|
|
@@ -5,7 +5,7 @@ import { d as defineCustomElement$3 } from './mg-button2.js';
|
|
|
5
5
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
6
6
|
import { c as createPopper } from './popper.js';
|
|
7
7
|
|
|
8
|
-
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-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].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{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-
|
|
8
|
+
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-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].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{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.sc-mg-popover,.mg-popover__arrow.sc-mg-popover::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover__arrow.sc-mg-popover{visibility:hidden}.mg-popover__arrow.sc-mg-popover::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{bottom:-6px}.mg-popover[data-popper-placement^=bottom].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{top:-6px}.mg-popover[data-popper-placement^=left].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{right:-6px}.mg-popover[data-popper-placement^=right].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{left:-6px}.mg-popover__title.sc-mg-popover-s>[slot=title],.mg-popover__title .sc-mg-popover-s>[slot=title]{margin:0 0 1rem;font-size:var(--mg-popover-title-font-size);font-weight:600}";
|
|
9
9
|
|
|
10
10
|
const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
@@ -15,7 +15,7 @@ var Status;
|
|
|
15
15
|
*/
|
|
16
16
|
const sizes = ['regular', 'large'];
|
|
17
17
|
|
|
18
|
-
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
|
|
18
|
+
const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button{padding:calc(1rem + 0.3rem) calc(1rem * 1.3) 1rem}.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button{padding:calc(1.8rem + 0.3rem) calc(1.8rem * 1.3) 1.8rem}.mg-tabs__header{display:flex;flex-direction:row;flex-wrap:wrap}.mg-tabs__navigation-button{display:flex;align-items:center;column-gap:0.5rem;background:none;border:none;border-bottom:0.3rem solid transparent;font-family:var(--font-family);color:hsl(var(--color-dark));line-height:var(--line-height);cursor:pointer}.mg-tabs__navigation-button:disabled,.mg-tabs__navigation-button--disabled{cursor:default;opacity:30%}.mg-tabs__navigation-button:hover:not(:disabled),.mg-tabs__navigation-button:focus:not(:disabled){background-color:hsla(var(--color-info-h), var(--color-info-s), var(--color-info-l), 10%)}.mg-tabs__navigation-button.mg-tabs__navigation-button--active{color:hsl(var(--color-info));border-bottom-color:hsl(var(--color-info));font-weight:700}.mg-tabs__navigation-button.mg-tabs__navigation-button--hidden{display:none}.mg-tabs__content-container:focus-visible{outline:none}";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* type TabItem validation function
|
|
@@ -149,6 +149,13 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
+
validateLabel(newValue) {
|
|
153
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
154
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
155
|
+
// throw new Error('<mg-tabs> prop "label" is required.');
|
|
156
|
+
console.error('<mg-tabs> prop "label" is required.');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
152
159
|
validateSize(newValue) {
|
|
153
160
|
if (!sizes.includes(newValue)) {
|
|
154
161
|
throw new Error(`<mg-tabs> prop "size" must be one of : ${sizes.join(', ')}`);
|
|
@@ -186,6 +193,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
186
193
|
*/
|
|
187
194
|
componentWillLoad() {
|
|
188
195
|
// Check tabs format
|
|
196
|
+
this.validateLabel(this.label);
|
|
189
197
|
this.validateItems(this.items);
|
|
190
198
|
this.validateActiveTab(this.activeTab);
|
|
191
199
|
this.validateSize(this.size);
|
|
@@ -206,6 +214,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
206
214
|
}
|
|
207
215
|
get element() { return this; }
|
|
208
216
|
static get watchers() { return {
|
|
217
|
+
"label": ["validateLabel"],
|
|
209
218
|
"size": ["validateSize"],
|
|
210
219
|
"items": ["validateItems"],
|
|
211
220
|
"activeTab": ["validateActiveTab"]
|
|
@@ -102,6 +102,13 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
102
102
|
this.guard = undefined;
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
|
+
validateMessage(newValue) {
|
|
106
|
+
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
107
|
+
// TODO: throw new Error on next major (5.0.0)
|
|
108
|
+
// throw new Error('<mg-tooltip> prop "message" is required.');
|
|
109
|
+
console.error('<mg-tooltip> prop "message" is required.');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
105
112
|
handleDisplay(newValue) {
|
|
106
113
|
if (newValue) {
|
|
107
114
|
this.show();
|
|
@@ -182,6 +189,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
182
189
|
});
|
|
183
190
|
});
|
|
184
191
|
this.handleDisplay(this.display);
|
|
192
|
+
this.validateMessage(this.message);
|
|
185
193
|
}
|
|
186
194
|
/**
|
|
187
195
|
* Render
|
|
@@ -193,6 +201,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
193
201
|
}
|
|
194
202
|
get element() { return this; }
|
|
195
203
|
static get watchers() { return {
|
|
204
|
+
"message": ["validateMessage"],
|
|
196
205
|
"display": ["handleDisplay"]
|
|
197
206
|
}; }
|
|
198
207
|
static get style() { return mgTooltipCss; }
|
|
@@ -158,38 +158,57 @@ var max = Math.max;
|
|
|
158
158
|
var min = Math.min;
|
|
159
159
|
var round = Math.round;
|
|
160
160
|
|
|
161
|
-
function
|
|
161
|
+
function getUAString() {
|
|
162
|
+
var uaData = navigator.userAgentData;
|
|
163
|
+
|
|
164
|
+
if (uaData != null && uaData.brands) {
|
|
165
|
+
return uaData.brands.map(function (item) {
|
|
166
|
+
return item.brand + "/" + item.version;
|
|
167
|
+
}).join(' ');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return navigator.userAgent;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function isLayoutViewport() {
|
|
174
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
162
178
|
if (includeScale === void 0) {
|
|
163
179
|
includeScale = false;
|
|
164
180
|
}
|
|
165
181
|
|
|
166
|
-
|
|
182
|
+
if (isFixedStrategy === void 0) {
|
|
183
|
+
isFixedStrategy = false;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
var clientRect = element.getBoundingClientRect();
|
|
167
187
|
var scaleX = 1;
|
|
168
188
|
var scaleY = 1;
|
|
169
189
|
|
|
170
|
-
if (isHTMLElement(element)
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
// Fallback to 1 in case both values are `0`
|
|
174
|
-
|
|
175
|
-
if (offsetWidth > 0) {
|
|
176
|
-
scaleX = round(rect.width) / offsetWidth || 1;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (offsetHeight > 0) {
|
|
180
|
-
scaleY = round(rect.height) / offsetHeight || 1;
|
|
181
|
-
}
|
|
190
|
+
if (includeScale && isHTMLElement(element)) {
|
|
191
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
192
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
182
193
|
}
|
|
183
194
|
|
|
195
|
+
var _ref = isElement(element) ? getWindow(element) : window,
|
|
196
|
+
visualViewport = _ref.visualViewport;
|
|
197
|
+
|
|
198
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
199
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
200
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
201
|
+
var width = clientRect.width / scaleX;
|
|
202
|
+
var height = clientRect.height / scaleY;
|
|
184
203
|
return {
|
|
185
|
-
width:
|
|
186
|
-
height:
|
|
187
|
-
top:
|
|
188
|
-
right:
|
|
189
|
-
bottom:
|
|
190
|
-
left:
|
|
191
|
-
x:
|
|
192
|
-
y:
|
|
204
|
+
width: width,
|
|
205
|
+
height: height,
|
|
206
|
+
top: y,
|
|
207
|
+
right: x + width,
|
|
208
|
+
bottom: y + height,
|
|
209
|
+
left: x,
|
|
210
|
+
x: x,
|
|
211
|
+
y: y
|
|
193
212
|
};
|
|
194
213
|
}
|
|
195
214
|
|
|
@@ -284,8 +303,8 @@ function getTrueOffsetParent(element) {
|
|
|
284
303
|
|
|
285
304
|
|
|
286
305
|
function getContainingBlock(element) {
|
|
287
|
-
var isFirefox =
|
|
288
|
-
var isIE =
|
|
306
|
+
var isFirefox = /firefox/i.test(getUAString());
|
|
307
|
+
var isIE = /Trident/i.test(getUAString());
|
|
289
308
|
|
|
290
309
|
if (isIE && isHTMLElement(element)) {
|
|
291
310
|
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
|
@@ -706,31 +725,21 @@ function getWindowScrollBarX(element) {
|
|
|
706
725
|
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
707
726
|
}
|
|
708
727
|
|
|
709
|
-
function getViewportRect(element) {
|
|
728
|
+
function getViewportRect(element, strategy) {
|
|
710
729
|
var win = getWindow(element);
|
|
711
730
|
var html = getDocumentElement(element);
|
|
712
731
|
var visualViewport = win.visualViewport;
|
|
713
732
|
var width = html.clientWidth;
|
|
714
733
|
var height = html.clientHeight;
|
|
715
734
|
var x = 0;
|
|
716
|
-
var y = 0;
|
|
717
|
-
// can be obscured underneath it.
|
|
718
|
-
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
|
|
719
|
-
// if it isn't open, so if this isn't available, the popper will be detected
|
|
720
|
-
// to overflow the bottom of the screen too early.
|
|
735
|
+
var y = 0;
|
|
721
736
|
|
|
722
737
|
if (visualViewport) {
|
|
723
738
|
width = visualViewport.width;
|
|
724
|
-
height = visualViewport.height;
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
// Feature detection fails in mobile emulation mode in Chrome.
|
|
729
|
-
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
|
|
730
|
-
// 0.001
|
|
731
|
-
// Fallback here: "Not Safari" userAgent
|
|
732
|
-
|
|
733
|
-
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
739
|
+
height = visualViewport.height;
|
|
740
|
+
var layoutViewport = isLayoutViewport();
|
|
741
|
+
|
|
742
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
734
743
|
x = visualViewport.offsetLeft;
|
|
735
744
|
y = visualViewport.offsetTop;
|
|
736
745
|
}
|
|
@@ -824,8 +833,8 @@ function rectToClientRect(rect) {
|
|
|
824
833
|
});
|
|
825
834
|
}
|
|
826
835
|
|
|
827
|
-
function getInnerBoundingClientRect(element) {
|
|
828
|
-
var rect = getBoundingClientRect(element);
|
|
836
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
837
|
+
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
|
829
838
|
rect.top = rect.top + element.clientTop;
|
|
830
839
|
rect.left = rect.left + element.clientLeft;
|
|
831
840
|
rect.bottom = rect.top + element.clientHeight;
|
|
@@ -837,8 +846,8 @@ function getInnerBoundingClientRect(element) {
|
|
|
837
846
|
return rect;
|
|
838
847
|
}
|
|
839
848
|
|
|
840
|
-
function getClientRectFromMixedType(element, clippingParent) {
|
|
841
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
849
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
850
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
842
851
|
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
843
852
|
// clipping (or hiding) overflowing elements with a position different from
|
|
844
853
|
// `initial`
|
|
@@ -861,18 +870,18 @@ function getClippingParents(element) {
|
|
|
861
870
|
// clipping parents
|
|
862
871
|
|
|
863
872
|
|
|
864
|
-
function getClippingRect(element, boundary, rootBoundary) {
|
|
873
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
865
874
|
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
866
875
|
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
867
876
|
var firstClippingParent = clippingParents[0];
|
|
868
877
|
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
869
|
-
var rect = getClientRectFromMixedType(element, clippingParent);
|
|
878
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
870
879
|
accRect.top = max(rect.top, accRect.top);
|
|
871
880
|
accRect.right = min(rect.right, accRect.right);
|
|
872
881
|
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
873
882
|
accRect.left = max(rect.left, accRect.left);
|
|
874
883
|
return accRect;
|
|
875
|
-
}, getClientRectFromMixedType(element, firstClippingParent));
|
|
884
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
876
885
|
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
877
886
|
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
878
887
|
clippingRect.x = clippingRect.left;
|
|
@@ -953,6 +962,8 @@ function detectOverflow(state, options) {
|
|
|
953
962
|
var _options = options,
|
|
954
963
|
_options$placement = _options.placement,
|
|
955
964
|
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
|
965
|
+
_options$strategy = _options.strategy,
|
|
966
|
+
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
|
956
967
|
_options$boundary = _options.boundary,
|
|
957
968
|
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
|
958
969
|
_options$rootBoundary = _options.rootBoundary,
|
|
@@ -967,7 +978,7 @@ function detectOverflow(state, options) {
|
|
|
967
978
|
var altContext = elementContext === popper ? reference : popper;
|
|
968
979
|
var popperRect = state.rects.popper;
|
|
969
980
|
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
970
|
-
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
|
981
|
+
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
|
971
982
|
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
972
983
|
var popperOffsets = computeOffsets({
|
|
973
984
|
reference: referenceClientRect,
|
|
@@ -1481,7 +1492,7 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
1481
1492
|
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1482
1493
|
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
1483
1494
|
var documentElement = getDocumentElement(offsetParent);
|
|
1484
|
-
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
|
1495
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
1485
1496
|
var scroll = {
|
|
1486
1497
|
scrollLeft: 0,
|
|
1487
1498
|
scrollTop: 0
|