@mgdis/mg-components 5.27.3 → 5.27.4
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-8e9b0d9b.js → index-11b35234.js} +47 -47
- package/dist/cjs/index-11b35234.js.map +1 -0
- package/dist/cjs/{index-7bb96ccc.js → index-3198e64e.js} +79 -27
- package/dist/cjs/index-3198e64e.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +237 -191
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +124 -97
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +21 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/components/index.es.js +39 -39
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +2 -2
- package/dist/components/mg-badge2.js +3 -3
- package/dist/components/mg-button2.js +4 -4
- package/dist/components/mg-card2.js +2 -2
- package/dist/components/mg-details.js +2 -2
- package/dist/components/mg-form.js +3 -3
- package/dist/components/mg-icon2.js +2 -2
- package/dist/components/mg-illustrated-message.js +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +25 -7
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +11 -11
- package/dist/components/mg-input-numeric.js +5 -5
- package/dist/components/mg-input-password.js +3 -3
- package/dist/components/mg-input-radio.js +4 -4
- package/dist/components/mg-input-select2.js +6 -6
- package/dist/components/mg-input-text2.js +6 -6
- package/dist/components/mg-input-textarea.js +6 -6
- package/dist/components/mg-input-title2.js +2 -2
- package/dist/components/mg-input-toggle.js +4 -4
- package/dist/components/mg-input2.js +4 -3
- package/dist/components/mg-input2.js.map +1 -1
- package/dist/components/mg-item-more2.js +2 -2
- package/dist/components/mg-loader.js +2 -2
- package/dist/components/mg-menu-item2.js +5 -5
- package/dist/components/mg-message.js +3 -3
- package/dist/components/mg-modal.js +6 -6
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +4 -4
- package/dist/components/mg-popover-content2.js +3 -3
- package/dist/components/mg-popover2.js +3 -3
- package/dist/components/mg-skip-links.js +2 -2
- package/dist/components/mg-tabs.js +6 -6
- package/dist/components/mg-tag.js +3 -3
- package/dist/components/mg-tooltip2.js +134 -107
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/{index-138ea119.js → index-00abd8c1.js} +41 -41
- package/dist/esm/index-00abd8c1.js.map +1 -0
- package/dist/esm/{index-c4faef56.js → index-99317ec3.js} +79 -27
- package/dist/esm/index-99317ec3.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +237 -191
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +3 -3
- package/dist/mg-components/index.esm.js.map +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-48c0a0bf.entry.js +2 -0
- package/dist/mg-components/p-48c0a0bf.entry.js.map +1 -0
- package/dist/mg-components/p-4cfcbdc2.js +2 -0
- package/dist/mg-components/p-4cfcbdc2.js.map +1 -0
- package/dist/mg-components/p-815362e4.js +3 -0
- package/dist/mg-components/p-815362e4.js.map +1 -0
- package/dist/mg-components/{p-bac6ca1f.entry.js → p-d3e15dd7.entry.js} +2 -2
- package/dist/mg-components/{p-bac6ca1f.entry.js.map → p-d3e15dd7.entry.js.map} +1 -1
- package/dist/mg-components/p-e1255160.js.map +1 -1
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +25 -12
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +2 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +8 -0
- package/dist/types/stencil-public-runtime.d.ts +3 -8
- package/ide/intellij/web-types.json +1 -1
- package/ide/vscode/html-custom-data.json +1 -1
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/package.json +24 -24
- package/dist/cjs/index-7bb96ccc.js.map +0 -1
- package/dist/cjs/index-8e9b0d9b.js.map +0 -1
- package/dist/esm/index-138ea119.js.map +0 -1
- package/dist/esm/index-c4faef56.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/mg-components/p-284c8327.entry.js +0 -2
- package/dist/mg-components/p-284c8327.entry.js.map +0 -1
- package/dist/mg-components/p-4c68f6ea.js +0 -3
- package/dist/mg-components/p-4c68f6ea.js.map +0 -1
- package/dist/mg-components/p-e9433a87.js +0 -2
- package/dist/mg-components/p-e9433a87.js.map +0 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const index$1 = require('./index-
|
|
5
|
+
const index = require('./index-3198e64e.js');
|
|
6
|
+
const index$1 = require('./index-11b35234.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Available menu-item positions
|
|
@@ -79,7 +79,7 @@ const MgActionMore = class {
|
|
|
79
79
|
************/
|
|
80
80
|
this.name = 'mg-action-more';
|
|
81
81
|
this.classBase = 'mg-c-action-more';
|
|
82
|
-
this.mgPopoverIdentifier = index$1.
|
|
82
|
+
this.mgPopoverIdentifier = index$1.Ce(this.name);
|
|
83
83
|
/************
|
|
84
84
|
* Methods *
|
|
85
85
|
***********/
|
|
@@ -203,7 +203,7 @@ const MgBadge = class {
|
|
|
203
203
|
this.label = undefined;
|
|
204
204
|
this.variant = variants$5[0];
|
|
205
205
|
this.outline = undefined;
|
|
206
|
-
this.classCollection = new index$1.
|
|
206
|
+
this.classCollection = new index$1.He(['mg-c-badge']);
|
|
207
207
|
}
|
|
208
208
|
validateValue(newValue) {
|
|
209
209
|
if (/^(\d+\+*|[?*!a-z])$/i.exec(`${newValue}`) === null) {
|
|
@@ -211,7 +211,7 @@ const MgBadge = class {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
validateLabel(newValue) {
|
|
214
|
-
if (!index$1.
|
|
214
|
+
if (!index$1.Ie(newValue)) {
|
|
215
215
|
throw new Error('<mg-badge> prop "label" is required.');
|
|
216
216
|
}
|
|
217
217
|
}
|
|
@@ -322,7 +322,7 @@ const MgButton = class {
|
|
|
322
322
|
this.isIcon = false;
|
|
323
323
|
this.disableOnClick = false;
|
|
324
324
|
this.loading = false;
|
|
325
|
-
this.classCollection = new index$1.
|
|
325
|
+
this.classCollection = new index$1.He(['mg-c-button']);
|
|
326
326
|
}
|
|
327
327
|
validateVariant(newValue, oldValue) {
|
|
328
328
|
if (!variants$4.includes(newValue)) {
|
|
@@ -381,7 +381,7 @@ const MgButton = class {
|
|
|
381
381
|
this.validateFullWidth(this.fullWidth);
|
|
382
382
|
if (this.isIcon) {
|
|
383
383
|
this.classCollection.add(`mg-c-button--icon`);
|
|
384
|
-
if (!index$1.
|
|
384
|
+
if (!index$1.Ie(this.label)) {
|
|
385
385
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
386
386
|
}
|
|
387
387
|
}
|
|
@@ -393,7 +393,7 @@ const MgButton = class {
|
|
|
393
393
|
* Add listners
|
|
394
394
|
*/
|
|
395
395
|
componentDidLoad() {
|
|
396
|
-
index$1.
|
|
396
|
+
index$1.Ge(() => {
|
|
397
397
|
var _a;
|
|
398
398
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
399
399
|
// submit buttons should trigger form submition;
|
|
@@ -452,7 +452,7 @@ const MgCard = class {
|
|
|
452
452
|
};
|
|
453
453
|
this.variant = undefined;
|
|
454
454
|
this.variantStyle = undefined;
|
|
455
|
-
this.classCollection = new index$1.
|
|
455
|
+
this.classCollection = new index$1.He([this.classBase]);
|
|
456
456
|
}
|
|
457
457
|
validateVariant(newValue, oldValue) {
|
|
458
458
|
if (newValue && !variants$3.includes(newValue))
|
|
@@ -557,7 +557,7 @@ const MgDetails = class {
|
|
|
557
557
|
this.expanded = false;
|
|
558
558
|
}
|
|
559
559
|
validateTitles(newValue) {
|
|
560
|
-
if (!index$1.
|
|
560
|
+
if (!index$1.Ie(newValue)) {
|
|
561
561
|
throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
|
|
562
562
|
}
|
|
563
563
|
}
|
|
@@ -715,7 +715,7 @@ const MgForm = class {
|
|
|
715
715
|
}
|
|
716
716
|
});
|
|
717
717
|
};
|
|
718
|
-
this.identifier = index$1.
|
|
718
|
+
this.identifier = index$1.Ce('mg-form');
|
|
719
719
|
this.name = this.identifier;
|
|
720
720
|
this.readonly = false;
|
|
721
721
|
this.requiredMessage = undefined;
|
|
@@ -724,7 +724,7 @@ const MgForm = class {
|
|
|
724
724
|
this.disabled = false;
|
|
725
725
|
this.valid = undefined;
|
|
726
726
|
this.invalid = undefined;
|
|
727
|
-
this.classCollection = new index$1.
|
|
727
|
+
this.classCollection = new index$1.He(['mg-c-form']);
|
|
728
728
|
this.requiredMessageText = undefined;
|
|
729
729
|
}
|
|
730
730
|
validateRequiredMessage(newValue) {
|
|
@@ -865,7 +865,7 @@ const MgIcon = class {
|
|
|
865
865
|
this.variant = undefined;
|
|
866
866
|
this.variantStyle = undefined;
|
|
867
867
|
this.spin = false;
|
|
868
|
-
this.classCollection = new index$1.
|
|
868
|
+
this.classCollection = new index$1.He(['mg-c-icon']);
|
|
869
869
|
}
|
|
870
870
|
validateIcon(newValue, oldValue) {
|
|
871
871
|
if (!Object.keys(icons).includes(newValue))
|
|
@@ -964,7 +964,7 @@ const MgIllustratedMessage = class {
|
|
|
964
964
|
componentDidLoad() {
|
|
965
965
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
966
966
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
967
|
-
if (!index$1.
|
|
967
|
+
if (!index$1.Be(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
968
968
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
969
969
|
}
|
|
970
970
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -1004,6 +1004,7 @@ var Handler;
|
|
|
1004
1004
|
(function (Handler) {
|
|
1005
1005
|
Handler["BLUR"] = "blur";
|
|
1006
1006
|
Handler["FOCUS"] = "focus";
|
|
1007
|
+
Handler["MOUSEENTER"] = "mouseenter";
|
|
1007
1008
|
})(Handler || (Handler = {}));
|
|
1008
1009
|
const classFieldset = 'mg-c-input--fieldset';
|
|
1009
1010
|
const classDisabled = 'mg-c-input--disabled';
|
|
@@ -1064,7 +1065,7 @@ const MgInput = class {
|
|
|
1064
1065
|
this.isVerticalList = false;
|
|
1065
1066
|
}
|
|
1066
1067
|
watchIdentifier(newValue) {
|
|
1067
|
-
if (!index$1.
|
|
1068
|
+
if (!index$1.Ie(newValue)) {
|
|
1068
1069
|
throw new Error('<mg-input> prop "identifier" is required.');
|
|
1069
1070
|
}
|
|
1070
1071
|
else {
|
|
@@ -1149,7 +1150,7 @@ const MgInput = class {
|
|
|
1149
1150
|
*/
|
|
1150
1151
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1151
1152
|
watchLabel() {
|
|
1152
|
-
if (!index$1.
|
|
1153
|
+
if (!index$1.Ie(this.label)) {
|
|
1153
1154
|
throw new Error('<mg-input> prop "label" is required.');
|
|
1154
1155
|
}
|
|
1155
1156
|
else {
|
|
@@ -1310,7 +1311,7 @@ index.h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-
|
|
|
1310
1311
|
var _a, _b;
|
|
1311
1312
|
return (index.h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
|
|
1312
1313
|
index.h("input", { type: "checkbox", id: input._id, name: props.name, value: (_a = input.value) === null || _a === void 0 ? void 0 : _a.toString(), checked: Boolean(input.value), required: input.required, "aria-invalid": ((_b = props.invalid) === null || _b === void 0 ? void 0 : _b.toString()) || 'false', disabled: props.disabled || input.disabled, indeterminate: input.value === null, onInput: input._handleInput, onBlur: input._handleBlur, onKeyDown: input._handleKeydown }),
|
|
1313
|
-
index.h("label", { htmlFor: input._id }, input.title)));
|
|
1314
|
+
index.h("label", { htmlFor: input._id, onMouseEnter: input._handleMouseEnter, onMouseLeave: input._handleMouseLeave }, input.title)));
|
|
1314
1315
|
})));
|
|
1315
1316
|
|
|
1316
1317
|
const mgInputCheckboxCss = ".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input__box.mg-c-input__box--width{width:100%;min-width:5rem;max-width:calc(17.7rem + var(--mg-inputs-spacer)*2)}.mg-c-input.mg-c-input--width-2 .mg-c-input__box,.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left{max-width:5rem}.mg-c-input.mg-c-input--width-4 .mg-c-input__box,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left{max-width:7rem}.mg-c-input.mg-c-input--width-16 .mg-c-input__box,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{max-width:21rem}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%;max-width:100%}.mg-c-input.mg-c-input--label-on-top.mg-c-input--width-2 .mg-c-input__box,.mg-c-input.mg-c-input--label-on-top.mg-c-input--width-2 .mg-c-input__with-character-left{max-width:5rem}.mg-c-input.mg-c-input--label-on-top.mg-c-input--width-4 .mg-c-input__box,.mg-c-input.mg-c-input--label-on-top.mg-c-input--width-4 .mg-c-input__with-character-left{max-width:7rem}.mg-c-input.mg-c-input--label-on-top.mg-c-input--width-16 .mg-c-input__box,.mg-c-input.mg-c-input--label-on-top.mg-c-input--width-16 .mg-c-input__with-character-left{max-width:21rem}.mg-c-input.mg-c-input--label-on-top.mg-c-input--width-full .mg-c-input__box{width:100%;max-width:100%}.mg-c-input.mg-c-input--label-on-top .mg-c-input__box{width:auto}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-input-check-size);height:var(--mg-input-check-size);flex-shrink:0;margin:calc((var(--font-size)*var(--line-height) - var(--mg-input-check-size))/2) .6rem 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);gap:1rem 2.3rem;list-style:none}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:.7rem}:host(.mg-c-input.mg-c-input--fieldset:not(.mg-c-input--checkbox-multi)) .mg-c-input__input-container mg-tooltip{margin-left:3rem}:host(.mg-c-input.mg-c-input--checkbox) .mg-c-input__input,:host(.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset;align-items:flex-start}:host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-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-c-input__input{display:flex;min-height:var(--default-size);align-items:center;justify-content:start}.mg-c-input__input mg-tooltip{align-self:baseline;margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input ::slotted(.mg-c-input__button-toggle:disabled),.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--disabled .mg-c-input__input-container strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;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-c-input__title slot[name=label]+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__error ::slotted(*),.mg-c-input__help-text ::slotted(*){font-size:1.2rem;text-align:start}.mg-c-input__help-text+.mg-c-input__error{margin-top:.2rem}:host(:not(.mg-c-input--textarea)) .mg-c-input__input+.mg-c-input__error,:host(:not(.mg-c-input--textarea)) .mg-c-input__input+.mg-c-input__help-text{margin-top:.5rem}.mg-c-input.mg-c-input--readonly>*:not([slot=label],[name=append-input]),.mg-c-input.mg-c-input--readonly ::slotted(mg-button[slot=append-input]){display:none}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}:host(.mg-c-input){display:flex}:host(.mg-c-input.mg-c-input--textarea.mg-c-input--readonly) .mg-c-input__input-container{white-space:pre-line}:host(.mg-c-input.mg-c-input--checkbox,.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset}:host(.mg-c-input.mg-c-input--label-on-top){flex-direction:column}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}@media screen and (max-width: 767px){:host(.mg-c-input){flex-direction:column}:host(.mg-c-input) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}:host(.mg-c-input) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-group-container{padding:.4rem calc(0.4rem*2) .4rem calc(0.4rem/2);margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container{display:flex;width:unset;flex:unset;flex-wrap:wrap;column-gap:calc(var(--mg-inputs-spacer)*1.2)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container-list{display:flex;flex-flow:row wrap;gap:calc(0.4rem*1);padding:0;margin:0;list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__sections{display:flex;flex-flow:column nowrap;gap:calc(0.4rem*0);max-height:80vh;padding-right:1rem;overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header{display:flex;flex-flow:row wrap;gap:calc(0.4rem*2);min-height:var(--default-size);flex-wrap:nowrap;align-items:center;text-wrap:nowrap}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-tootlip{display:inline-block;width:auto;height:auto;margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title{display:inline;margin:0;color:hsl(var(--mg-color-dark-40-hsl))}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title-label{font-size:var(--font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title--static.mg-c-input__section-header-title{margin:0 1.1rem}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-value{display:inline-flex;min-width:var(--default-size);min-height:var(--default-size);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--default-size) - .2rem - var(--font-size)*var(--line-height))/2) 1.1rem;border-radius:.3rem;background-color:hsl(var(--mg-color-dark-5-hsl));font-size:var(--font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__content{display:flex;flex-flow:column nowrap;gap:calc(0.4rem*2)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-group{margin-left:calc(0.4rem*2)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-no-result{text-align:center}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--with-values .mg-c-input__input-container{gap:.4rem}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content{width:37rem;height:40rem}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__section-header-tootlip){margin-left:var(--mg-inputs-spacer)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-popover-min-width:7rem;--mg-card-padding:calc(0.4rem * 2)}.mg-c-input.mg-c-input--checkbox-multi mg-input-text{--mg-inputs-margin-bottom:0}";
|
|
@@ -1375,7 +1376,11 @@ const MgInputCheckbox = class {
|
|
|
1375
1376
|
/**
|
|
1376
1377
|
* Handle blur event
|
|
1377
1378
|
*/
|
|
1378
|
-
this.handleBlur = () => {
|
|
1379
|
+
this.handleBlur = (event) => {
|
|
1380
|
+
if (this.handlerInProgress === Handler.MOUSEENTER) {
|
|
1381
|
+
event.preventDefault();
|
|
1382
|
+
return;
|
|
1383
|
+
}
|
|
1379
1384
|
// set guard
|
|
1380
1385
|
this.handlerInProgress = Handler.BLUR;
|
|
1381
1386
|
// Check validity
|
|
@@ -1424,6 +1429,18 @@ const MgInputCheckbox = class {
|
|
|
1424
1429
|
});
|
|
1425
1430
|
this.updateValues();
|
|
1426
1431
|
};
|
|
1432
|
+
/**
|
|
1433
|
+
* Handle input label mouseenter event
|
|
1434
|
+
*/
|
|
1435
|
+
this.handleMouseEnter = () => {
|
|
1436
|
+
this.handlerInProgress = Handler.MOUSEENTER;
|
|
1437
|
+
};
|
|
1438
|
+
/**
|
|
1439
|
+
* Handle input label leave event
|
|
1440
|
+
*/
|
|
1441
|
+
this.handleMouseLeave = () => {
|
|
1442
|
+
this.handlerInProgress = undefined;
|
|
1443
|
+
};
|
|
1427
1444
|
/**
|
|
1428
1445
|
* Update values
|
|
1429
1446
|
*/
|
|
@@ -1432,6 +1449,8 @@ const MgInputCheckbox = class {
|
|
|
1432
1449
|
delete o._handleBlur;
|
|
1433
1450
|
delete o._handleInput;
|
|
1434
1451
|
delete o._handleKeydown;
|
|
1452
|
+
delete o._handleMouseEnter;
|
|
1453
|
+
delete o._handleMouseLeave;
|
|
1435
1454
|
delete o._id;
|
|
1436
1455
|
return o;
|
|
1437
1456
|
});
|
|
@@ -1445,7 +1464,7 @@ const MgInputCheckbox = class {
|
|
|
1445
1464
|
* Method to update searchResults
|
|
1446
1465
|
*/
|
|
1447
1466
|
this.updateSearchResults = () => {
|
|
1448
|
-
this.searchResults = this.checkboxItems.filter(item => index$1.
|
|
1467
|
+
this.searchResults = this.checkboxItems.filter(item => index$1.qe(item.title).includes(index$1.qe(this.searchValue)));
|
|
1449
1468
|
};
|
|
1450
1469
|
/**
|
|
1451
1470
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1519,7 +1538,7 @@ const MgInputCheckbox = class {
|
|
|
1519
1538
|
this.helpText = undefined;
|
|
1520
1539
|
this.valid = undefined;
|
|
1521
1540
|
this.invalid = undefined;
|
|
1522
|
-
this.classCollection = new index$1.
|
|
1541
|
+
this.classCollection = new index$1.He([this.baseClassName, classFieldset]);
|
|
1523
1542
|
this.errorMessage = undefined;
|
|
1524
1543
|
this.checkboxItems = [];
|
|
1525
1544
|
this.displaySearchInput = undefined;
|
|
@@ -1529,7 +1548,7 @@ const MgInputCheckbox = class {
|
|
|
1529
1548
|
}
|
|
1530
1549
|
validateValue(newValue) {
|
|
1531
1550
|
if (isCheckboxItems(newValue)) {
|
|
1532
|
-
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this) })));
|
|
1551
|
+
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this), _handleMouseEnter: this.handleMouseEnter.bind(this), _handleMouseLeave: this.handleMouseLeave.bind(this) })));
|
|
1533
1552
|
this.valueChange.emit(newValue);
|
|
1534
1553
|
}
|
|
1535
1554
|
else {
|
|
@@ -1627,7 +1646,7 @@ const MgInputCheckbox = class {
|
|
|
1627
1646
|
if (typeof valid !== 'boolean') {
|
|
1628
1647
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean');
|
|
1629
1648
|
}
|
|
1630
|
-
else if (!index$1.
|
|
1649
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
1631
1650
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string');
|
|
1632
1651
|
}
|
|
1633
1652
|
else {
|
|
@@ -1740,7 +1759,7 @@ const MgInputCheckbox = class {
|
|
|
1740
1759
|
* @returns HTML Element
|
|
1741
1760
|
*/
|
|
1742
1761
|
render() {
|
|
1743
|
-
return (index.h("mg-input", { key: '
|
|
1762
|
+
return (index.h("mg-input", { key: '619a108d13b49c7b74dded7afa759202aa909abb', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonlyValue: this.value.filter(({ value }) => value).map(({ title }) => title), tooltip: !this.readonly ? this.tooltip : undefined, tooltipPosition: this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, this.type === 'checkbox' || this.readonly ? (index.h(MgInputCheckboxList, { checkboxes: this.checkboxItems, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name, invalid: this.invalid })) : (this.renderCheckboxMulti())));
|
|
1744
1763
|
}
|
|
1745
1764
|
get element() { return index.getElement(this); }
|
|
1746
1765
|
static get watchers() { return {
|
|
@@ -1890,7 +1909,7 @@ const MgInputDate = class {
|
|
|
1890
1909
|
* @param value - value to test
|
|
1891
1910
|
* @returns truthy when value match the pattern
|
|
1892
1911
|
*/
|
|
1893
|
-
this.isValidPattern = (value) => index$1.
|
|
1912
|
+
this.isValidPattern = (value) => index$1.Ie(value) && index$1.he.test(value);
|
|
1894
1913
|
/**
|
|
1895
1914
|
* Format help text to display
|
|
1896
1915
|
* @param helpText - help text format
|
|
@@ -1898,10 +1917,10 @@ const MgInputDate = class {
|
|
|
1898
1917
|
*/
|
|
1899
1918
|
this.formatHelpText = (helpText) => {
|
|
1900
1919
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
1901
|
-
let text = index$1.
|
|
1920
|
+
let text = index$1.Ie(helpText) ? helpText : this.messages.input.date.helpText;
|
|
1902
1921
|
if (text.includes(defaultHelpTextVariable))
|
|
1903
1922
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
1904
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}', index$1.
|
|
1923
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', index$1.ye(index$1.Ze(new Date('2023-12-24')), this.systemLocale));
|
|
1905
1924
|
};
|
|
1906
1925
|
/**
|
|
1907
1926
|
* Handle input event
|
|
@@ -1993,8 +2012,8 @@ const MgInputDate = class {
|
|
|
1993
2012
|
// min, max & minMax
|
|
1994
2013
|
else if ([InputError$1.MIN, InputError$1.MAX, InputError$1.MINMAX].includes(inputError)) {
|
|
1995
2014
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
1996
|
-
.replace('{min}', index$1.
|
|
1997
|
-
.replace('{max}', index$1.
|
|
2015
|
+
.replace('{min}', index$1.ye(this.min, this.systemLocale))
|
|
2016
|
+
.replace('{max}', index$1.ye(this.max, this.systemLocale));
|
|
1998
2017
|
}
|
|
1999
2018
|
// wrong date format
|
|
2000
2019
|
// element.validity.badInput is default error message
|
|
@@ -2008,7 +2027,7 @@ const MgInputDate = class {
|
|
|
2008
2027
|
* @returns translated html pattern
|
|
2009
2028
|
*/
|
|
2010
2029
|
this.renderPattern = () => {
|
|
2011
|
-
let patternLocal = index$1.
|
|
2030
|
+
let patternLocal = index$1.Qe(this.systemLocale);
|
|
2012
2031
|
for (const key in this.messages.input.date.pattern) {
|
|
2013
2032
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
2014
2033
|
}
|
|
@@ -2030,7 +2049,7 @@ const MgInputDate = class {
|
|
|
2030
2049
|
this.helpText = undefined;
|
|
2031
2050
|
this.valid = undefined;
|
|
2032
2051
|
this.invalid = undefined;
|
|
2033
|
-
this.classCollection = new index$1.
|
|
2052
|
+
this.classCollection = new index$1.He(['mg-c-input--date']);
|
|
2034
2053
|
this.errorMessage = undefined;
|
|
2035
2054
|
}
|
|
2036
2055
|
validateValue(newValue) {
|
|
@@ -2038,7 +2057,7 @@ const MgInputDate = class {
|
|
|
2038
2057
|
if (newValue === '')
|
|
2039
2058
|
newValue = null;
|
|
2040
2059
|
// check value validity
|
|
2041
|
-
if (newValue && !index$1.
|
|
2060
|
+
if (newValue && !index$1.Ie(newValue)) {
|
|
2042
2061
|
throw new Error("<mg-input-date> props 'value' must be a valid string");
|
|
2043
2062
|
}
|
|
2044
2063
|
else if (!newValue || (newValue && this.isValidPattern(newValue))) {
|
|
@@ -2095,7 +2114,7 @@ const MgInputDate = class {
|
|
|
2095
2114
|
if (typeof valid !== 'boolean') {
|
|
2096
2115
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean');
|
|
2097
2116
|
}
|
|
2098
|
-
else if (!index$1.
|
|
2117
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
2099
2118
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string');
|
|
2100
2119
|
}
|
|
2101
2120
|
else {
|
|
@@ -2149,7 +2168,7 @@ const MgInputDate = class {
|
|
|
2149
2168
|
* @returns HTML Element
|
|
2150
2169
|
*/
|
|
2151
2170
|
render() {
|
|
2152
|
-
return (index.h("mg-input", { key: 'f38d79cb71311149b4d15885b65cd8f025dde15d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: index$1.
|
|
2171
|
+
return (index.h("mg-input", { key: 'f38d79cb71311149b4d15885b65cd8f025dde15d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: index$1.ye(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, index.h("input", { key: '67bf6f0ad58ee1a506ffd0d3d41d5954db68465c', type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
2153
2172
|
if (el !== null)
|
|
2154
2173
|
this.input = el;
|
|
2155
2174
|
} })));
|
|
@@ -2280,9 +2299,9 @@ const MgInputNumeric = class {
|
|
|
2280
2299
|
this.formatValue = (value) => {
|
|
2281
2300
|
switch (this.format) {
|
|
2282
2301
|
case 'number':
|
|
2283
|
-
return index$1.
|
|
2302
|
+
return index$1.Ye(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2284
2303
|
case 'currency':
|
|
2285
|
-
return index$1.
|
|
2304
|
+
return index$1.Je(value, this.locale, this.currency);
|
|
2286
2305
|
case 'none':
|
|
2287
2306
|
return value.toString();
|
|
2288
2307
|
}
|
|
@@ -2319,7 +2338,7 @@ const MgInputNumeric = class {
|
|
|
2319
2338
|
this.decimalLength = 2;
|
|
2320
2339
|
this.valid = undefined;
|
|
2321
2340
|
this.invalid = undefined;
|
|
2322
|
-
this.classCollection = new index$1.
|
|
2341
|
+
this.classCollection = new index$1.He(['mg-c-input--numeric']);
|
|
2323
2342
|
this.errorMessage = undefined;
|
|
2324
2343
|
this.hasFocus = undefined;
|
|
2325
2344
|
}
|
|
@@ -2415,7 +2434,7 @@ const MgInputNumeric = class {
|
|
|
2415
2434
|
if (typeof valid !== 'boolean') {
|
|
2416
2435
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean');
|
|
2417
2436
|
}
|
|
2418
|
-
else if (!index$1.
|
|
2437
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
2419
2438
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string');
|
|
2420
2439
|
}
|
|
2421
2440
|
else {
|
|
@@ -2607,7 +2626,7 @@ const MgInputPassword = class {
|
|
|
2607
2626
|
this.helpText = undefined;
|
|
2608
2627
|
this.valid = undefined;
|
|
2609
2628
|
this.invalid = undefined;
|
|
2610
|
-
this.classCollection = new index$1.
|
|
2629
|
+
this.classCollection = new index$1.He(['mg-c-input--password']);
|
|
2611
2630
|
this.errorMessage = undefined;
|
|
2612
2631
|
this.displayPassword = false;
|
|
2613
2632
|
}
|
|
@@ -2665,7 +2684,7 @@ const MgInputPassword = class {
|
|
|
2665
2684
|
if (typeof valid !== 'boolean') {
|
|
2666
2685
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean');
|
|
2667
2686
|
}
|
|
2668
|
-
else if (!index$1.
|
|
2687
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
2669
2688
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string');
|
|
2670
2689
|
}
|
|
2671
2690
|
else {
|
|
@@ -2812,7 +2831,7 @@ const MgInputRadio = class {
|
|
|
2812
2831
|
this.helpText = undefined;
|
|
2813
2832
|
this.valid = undefined;
|
|
2814
2833
|
this.invalid = undefined;
|
|
2815
|
-
this.classCollection = new index$1.
|
|
2834
|
+
this.classCollection = new index$1.He(['mg-c-input--radio', classFieldset]);
|
|
2816
2835
|
this.errorMessage = undefined;
|
|
2817
2836
|
this.options = undefined;
|
|
2818
2837
|
}
|
|
@@ -2825,7 +2844,7 @@ const MgInputRadio = class {
|
|
|
2825
2844
|
throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
|
|
2826
2845
|
}
|
|
2827
2846
|
// String array
|
|
2828
|
-
else if (index$1.
|
|
2847
|
+
else if (index$1.Pe(newValue)) {
|
|
2829
2848
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
2830
2849
|
}
|
|
2831
2850
|
// Object array
|
|
@@ -2884,7 +2903,7 @@ const MgInputRadio = class {
|
|
|
2884
2903
|
if (typeof valid !== 'boolean') {
|
|
2885
2904
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean');
|
|
2886
2905
|
}
|
|
2887
|
-
else if (!index$1.
|
|
2906
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
2888
2907
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string');
|
|
2889
2908
|
}
|
|
2890
2909
|
else {
|
|
@@ -3031,7 +3050,7 @@ const MgInputSelect = class {
|
|
|
3031
3050
|
if (this.input.value === '') {
|
|
3032
3051
|
this.setValue(null);
|
|
3033
3052
|
}
|
|
3034
|
-
else if (index$1.
|
|
3053
|
+
else if (index$1.Pe(this.items) && this.items.includes(this.input.value)) {
|
|
3035
3054
|
this.setValue(this.input.value);
|
|
3036
3055
|
}
|
|
3037
3056
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3105,7 +3124,7 @@ const MgInputSelect = class {
|
|
|
3105
3124
|
this.helpText = undefined;
|
|
3106
3125
|
this.valid = undefined;
|
|
3107
3126
|
this.invalid = undefined;
|
|
3108
|
-
this.classCollection = new index$1.
|
|
3127
|
+
this.classCollection = new index$1.He(['mg-c-input--select']);
|
|
3109
3128
|
this.errorMessage = undefined;
|
|
3110
3129
|
this.options = undefined;
|
|
3111
3130
|
this.valueExist = undefined;
|
|
@@ -3113,7 +3132,7 @@ const MgInputSelect = class {
|
|
|
3113
3132
|
}
|
|
3114
3133
|
validateValue(newValue) {
|
|
3115
3134
|
var _a, _b;
|
|
3116
|
-
if (index$1.
|
|
3135
|
+
if (index$1.Pe(this.items) && typeof newValue === 'string') {
|
|
3117
3136
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
|
|
3118
3137
|
}
|
|
3119
3138
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3130,7 +3149,7 @@ const MgInputSelect = class {
|
|
|
3130
3149
|
this.options = [];
|
|
3131
3150
|
}
|
|
3132
3151
|
// String array
|
|
3133
|
-
else if (index$1.
|
|
3152
|
+
else if (index$1.Pe(newValue)) {
|
|
3134
3153
|
if (typeof this.value === 'string')
|
|
3135
3154
|
this.valueExist = newValue.includes(this.value);
|
|
3136
3155
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3202,7 +3221,7 @@ const MgInputSelect = class {
|
|
|
3202
3221
|
if (typeof valid !== 'boolean') {
|
|
3203
3222
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean');
|
|
3204
3223
|
}
|
|
3205
|
-
else if (!index$1.
|
|
3224
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
3206
3225
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string');
|
|
3207
3226
|
}
|
|
3208
3227
|
else {
|
|
@@ -3314,7 +3333,7 @@ const MgInputText = class {
|
|
|
3314
3333
|
*/
|
|
3315
3334
|
this.handleFocus = () => {
|
|
3316
3335
|
this.classCollection.add(this.classFocus);
|
|
3317
|
-
this.classCollection = new index$1.
|
|
3336
|
+
this.classCollection = new index$1.He(this.classCollection.classes);
|
|
3318
3337
|
};
|
|
3319
3338
|
/**
|
|
3320
3339
|
* Handle blur event
|
|
@@ -3322,7 +3341,7 @@ const MgInputText = class {
|
|
|
3322
3341
|
this.handleBlur = () => {
|
|
3323
3342
|
// Manage focus
|
|
3324
3343
|
this.classCollection.delete(this.classFocus);
|
|
3325
|
-
this.classCollection = new index$1.
|
|
3344
|
+
this.classCollection = new index$1.He(this.classCollection.classes);
|
|
3326
3345
|
// Display Error
|
|
3327
3346
|
this.handlerInProgress = Handler.BLUR;
|
|
3328
3347
|
this.displayError().finally(() => {
|
|
@@ -3397,7 +3416,7 @@ const MgInputText = class {
|
|
|
3397
3416
|
this.helpText = undefined;
|
|
3398
3417
|
this.valid = undefined;
|
|
3399
3418
|
this.invalid = undefined;
|
|
3400
|
-
this.classCollection = new index$1.
|
|
3419
|
+
this.classCollection = new index$1.He(['mg-c-input--text']);
|
|
3401
3420
|
this.errorMessage = undefined;
|
|
3402
3421
|
}
|
|
3403
3422
|
handleValue(newValue) {
|
|
@@ -3448,7 +3467,7 @@ const MgInputText = class {
|
|
|
3448
3467
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3449
3468
|
}
|
|
3450
3469
|
validatePattern(newValue) {
|
|
3451
|
-
if (newValue !== undefined && !(index$1.
|
|
3470
|
+
if (newValue !== undefined && !(index$1.Ie(this.pattern) && index$1.Ie(this.patternErrorMessage))) {
|
|
3452
3471
|
throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3453
3472
|
}
|
|
3454
3473
|
}
|
|
@@ -3478,7 +3497,7 @@ const MgInputText = class {
|
|
|
3478
3497
|
if (typeof valid !== 'boolean') {
|
|
3479
3498
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
|
|
3480
3499
|
}
|
|
3481
|
-
else if (!index$1.
|
|
3500
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
3482
3501
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
|
|
3483
3502
|
}
|
|
3484
3503
|
else {
|
|
@@ -3587,7 +3606,7 @@ const MgInputTextarea = class {
|
|
|
3587
3606
|
*/
|
|
3588
3607
|
this.handleFocus = () => {
|
|
3589
3608
|
this.classCollection.add(this.classFocus);
|
|
3590
|
-
this.classCollection = new index$1.
|
|
3609
|
+
this.classCollection = new index$1.He(this.classCollection.classes);
|
|
3591
3610
|
};
|
|
3592
3611
|
/**
|
|
3593
3612
|
* Handle blur event
|
|
@@ -3595,7 +3614,7 @@ const MgInputTextarea = class {
|
|
|
3595
3614
|
this.handleBlur = () => {
|
|
3596
3615
|
// Manage focus
|
|
3597
3616
|
this.classCollection.delete(this.classFocus);
|
|
3598
|
-
this.classCollection = new index$1.
|
|
3617
|
+
this.classCollection = new index$1.He(this.classCollection.classes);
|
|
3599
3618
|
// Display Error
|
|
3600
3619
|
this.handlerInProgress = Handler.BLUR;
|
|
3601
3620
|
this.displayError().finally(() => {
|
|
@@ -3658,7 +3677,7 @@ const MgInputTextarea = class {
|
|
|
3658
3677
|
this.valid = undefined;
|
|
3659
3678
|
this.invalid = undefined;
|
|
3660
3679
|
this.resizable = 'none';
|
|
3661
|
-
this.classCollection = new index$1.
|
|
3680
|
+
this.classCollection = new index$1.He(['mg-c-input--textarea']);
|
|
3662
3681
|
this.errorMessage = undefined;
|
|
3663
3682
|
}
|
|
3664
3683
|
handleValue(newValue) {
|
|
@@ -3697,7 +3716,7 @@ const MgInputTextarea = class {
|
|
|
3697
3716
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3698
3717
|
}
|
|
3699
3718
|
validatePattern(newValue) {
|
|
3700
|
-
if (newValue !== undefined && !(index$1.
|
|
3719
|
+
if (newValue !== undefined && !(index$1.Ie(this.pattern) && index$1.Ie(this.patternErrorMessage))) {
|
|
3701
3720
|
throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3702
3721
|
}
|
|
3703
3722
|
}
|
|
@@ -3729,7 +3748,7 @@ const MgInputTextarea = class {
|
|
|
3729
3748
|
if (typeof valid !== 'boolean') {
|
|
3730
3749
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
|
|
3731
3750
|
}
|
|
3732
|
-
else if (!index$1.
|
|
3751
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
3733
3752
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
|
|
3734
3753
|
}
|
|
3735
3754
|
else {
|
|
@@ -3818,7 +3837,7 @@ const MgInputTitle = class {
|
|
|
3818
3837
|
this.tagName = 'label';
|
|
3819
3838
|
}
|
|
3820
3839
|
validateIdentifier(newValue) {
|
|
3821
|
-
if (!index$1.
|
|
3840
|
+
if (!index$1.Ie(newValue)) {
|
|
3822
3841
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
3823
3842
|
}
|
|
3824
3843
|
}
|
|
@@ -3932,7 +3951,7 @@ const MgInputToggle = class {
|
|
|
3932
3951
|
this.tooltip = undefined;
|
|
3933
3952
|
this.tooltipPosition = 'input';
|
|
3934
3953
|
this.helpText = undefined;
|
|
3935
|
-
this.classCollection = new index$1.
|
|
3954
|
+
this.classCollection = new index$1.He(['mg-c-input--toggle']);
|
|
3936
3955
|
this.options = undefined;
|
|
3937
3956
|
this.errorMessage = undefined;
|
|
3938
3957
|
this.valid = undefined;
|
|
@@ -3949,7 +3968,7 @@ const MgInputToggle = class {
|
|
|
3949
3968
|
throw new Error('<mg-input-toggle> prop "items" require 2 items.');
|
|
3950
3969
|
}
|
|
3951
3970
|
// String array
|
|
3952
|
-
else if (index$1.
|
|
3971
|
+
else if (index$1.Pe(newValue)) {
|
|
3953
3972
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
3954
3973
|
}
|
|
3955
3974
|
// Object array
|
|
@@ -4005,7 +4024,7 @@ const MgInputToggle = class {
|
|
|
4005
4024
|
if (typeof valid !== 'boolean') {
|
|
4006
4025
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean');
|
|
4007
4026
|
}
|
|
4008
|
-
else if (!index$1.
|
|
4027
|
+
else if (!index$1.Ie(errorMessage)) {
|
|
4009
4028
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string');
|
|
4010
4029
|
}
|
|
4011
4030
|
else {
|
|
@@ -4251,7 +4270,7 @@ const MgItemMore = class {
|
|
|
4251
4270
|
navElement.click();
|
|
4252
4271
|
});
|
|
4253
4272
|
// add id suffix to prevent duplicate key. default html id is: '';
|
|
4254
|
-
if (index$1.
|
|
4273
|
+
if (index$1.Ie(proxy.id))
|
|
4255
4274
|
proxy.id = `${proxy.id}-proxy`;
|
|
4256
4275
|
// update properties and DOM when proxyfied item is updated
|
|
4257
4276
|
proxified.addEventListener('item-updated', (event) => {
|
|
@@ -4581,7 +4600,7 @@ const MgMenuItem = class {
|
|
|
4581
4600
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
4582
4601
|
['label', 'metadata'].forEach(slot => {
|
|
4583
4602
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
4584
|
-
if (!index$1.
|
|
4603
|
+
if (!index$1.Ie(element.textContent))
|
|
4585
4604
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
4586
4605
|
if ((guard && element.getAttribute('title') === null) || !guard)
|
|
4587
4606
|
element.setAttribute('title', element.textContent);
|
|
@@ -4650,13 +4669,13 @@ const MgMenuItem = class {
|
|
|
4650
4669
|
* @returns HTML Element
|
|
4651
4670
|
*/
|
|
4652
4671
|
this.renderSlot = () => index.h("slot", null);
|
|
4653
|
-
this.identifier = index$1.
|
|
4672
|
+
this.identifier = index$1.Ce('mg-menu-item');
|
|
4654
4673
|
this.href = undefined;
|
|
4655
4674
|
this.target = undefined;
|
|
4656
4675
|
this.status = Status$1.VISIBLE;
|
|
4657
4676
|
this.expanded = false;
|
|
4658
4677
|
this.size = 'regular';
|
|
4659
|
-
this.navigationButtonClassList = new index$1.
|
|
4678
|
+
this.navigationButtonClassList = new index$1.He([this.navigationButton]);
|
|
4660
4679
|
this.direction = undefined;
|
|
4661
4680
|
this.isInMainMenu = undefined;
|
|
4662
4681
|
this.isItemMore = undefined;
|
|
@@ -4803,7 +4822,7 @@ const MgMenuItem = class {
|
|
|
4803
4822
|
* Emit event when component is updated
|
|
4804
4823
|
*/
|
|
4805
4824
|
componentShouldUpdate() {
|
|
4806
|
-
return index$1.
|
|
4825
|
+
return index$1.Ge(() => {
|
|
4807
4826
|
this.itemUpdated.emit();
|
|
4808
4827
|
});
|
|
4809
4828
|
}
|
|
@@ -4910,13 +4929,13 @@ const MgMessage = class {
|
|
|
4910
4929
|
return 'exclamation-circle';
|
|
4911
4930
|
}
|
|
4912
4931
|
};
|
|
4913
|
-
this.identifier = index$1.
|
|
4932
|
+
this.identifier = index$1.Ce('mg-message');
|
|
4914
4933
|
this.delay = undefined;
|
|
4915
4934
|
this.variant = variants$1[0];
|
|
4916
4935
|
this.closeButton = false;
|
|
4917
4936
|
this.hide = false;
|
|
4918
4937
|
this.noAriaRole = undefined;
|
|
4919
|
-
this.classCollection = new index$1.
|
|
4938
|
+
this.classCollection = new index$1.He(['mg-c-message']);
|
|
4920
4939
|
this.hasActions = false;
|
|
4921
4940
|
}
|
|
4922
4941
|
validateDelay(newValue) {
|
|
@@ -5059,12 +5078,12 @@ const MgModal = class {
|
|
|
5059
5078
|
*/
|
|
5060
5079
|
this.setFocus = () => {
|
|
5061
5080
|
// Get all focusable elements
|
|
5062
|
-
const slottedFocusableElements = Array.from(this.element.querySelectorAll(index$1.
|
|
5081
|
+
const slottedFocusableElements = Array.from(this.element.querySelectorAll(index$1.We));
|
|
5063
5082
|
// If close button is enabled or at least one of the slotted element is focusable
|
|
5064
5083
|
if (this.closeButton || slottedFocusableElements.length > 0) {
|
|
5065
5084
|
// Check if slotted focusable elements have shadowDom with focusable elements
|
|
5066
5085
|
this.modalFocusableElements = slottedFocusableElements.reduce((acc, focusableElement) => {
|
|
5067
|
-
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(index$1.
|
|
5086
|
+
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(index$1.We) || focusableElement : focusableElement);
|
|
5068
5087
|
return acc;
|
|
5069
5088
|
}, []);
|
|
5070
5089
|
// When close button is enabled it's the first focusable element.
|
|
@@ -5086,21 +5105,21 @@ const MgModal = class {
|
|
|
5086
5105
|
this.handleClose = () => {
|
|
5087
5106
|
this.hide = true;
|
|
5088
5107
|
};
|
|
5089
|
-
this.identifier = index$1.
|
|
5108
|
+
this.identifier = index$1.Ce('mg-modal');
|
|
5090
5109
|
this.dialogRole = dialogRoles[0];
|
|
5091
5110
|
this.modalTitle = undefined;
|
|
5092
5111
|
this.closeButton = false;
|
|
5093
5112
|
this.hide = undefined;
|
|
5094
5113
|
this.hasActions = false;
|
|
5095
5114
|
this.hasContent = false;
|
|
5096
|
-
this.classCollection = new index$1.
|
|
5115
|
+
this.classCollection = new index$1.He(['mg-c-modal']);
|
|
5097
5116
|
}
|
|
5098
5117
|
validateDialogRole(newValue) {
|
|
5099
5118
|
if (!dialogRoles.includes(newValue))
|
|
5100
5119
|
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}.`);
|
|
5101
5120
|
}
|
|
5102
5121
|
validateModalTitle(newValue) {
|
|
5103
|
-
if (!index$1.
|
|
5122
|
+
if (!index$1.Ie(newValue)) {
|
|
5104
5123
|
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
5105
5124
|
}
|
|
5106
5125
|
}
|
|
@@ -5247,7 +5266,7 @@ const MgPagination = class {
|
|
|
5247
5266
|
this.handleGoToPage = (action, disabled) => {
|
|
5248
5267
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
5249
5268
|
};
|
|
5250
|
-
this.identifier = index$1.
|
|
5269
|
+
this.identifier = index$1.Ce('mg-pagination');
|
|
5251
5270
|
this.label = undefined;
|
|
5252
5271
|
this.hideNavigationLabels = undefined;
|
|
5253
5272
|
this.hidePageCount = undefined;
|
|
@@ -5412,7 +5431,7 @@ const MgPanel = class {
|
|
|
5412
5431
|
];
|
|
5413
5432
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5414
5433
|
};
|
|
5415
|
-
this.identifier = index$1.
|
|
5434
|
+
this.identifier = index$1.Ce('mg-panel');
|
|
5416
5435
|
this.panelTitle = undefined;
|
|
5417
5436
|
this.titlePattern = undefined;
|
|
5418
5437
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -5421,12 +5440,12 @@ const MgPanel = class {
|
|
|
5421
5440
|
this.expanded = false;
|
|
5422
5441
|
this.expandToggleDisplay = expandToggleDisplays[0];
|
|
5423
5442
|
this.expandToggleDisabled = undefined;
|
|
5424
|
-
this.classCollection = new index$1.
|
|
5443
|
+
this.classCollection = new index$1.He(['mg-c-panel']);
|
|
5425
5444
|
this.isEditing = false;
|
|
5426
5445
|
this.updatedPanelTitle = undefined;
|
|
5427
5446
|
}
|
|
5428
5447
|
validatePanelTitle(newValue) {
|
|
5429
|
-
if (!index$1.
|
|
5448
|
+
if (!index$1.Ie(newValue))
|
|
5430
5449
|
throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
5431
5450
|
this.titleChange.emit(newValue);
|
|
5432
5451
|
}
|
|
@@ -7377,7 +7396,7 @@ const MgPopover = class {
|
|
|
7377
7396
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7378
7397
|
}
|
|
7379
7398
|
};
|
|
7380
|
-
this.identifier = index$1.
|
|
7399
|
+
this.identifier = index$1.Ce('mg-popover');
|
|
7381
7400
|
this.placement = 'bottom';
|
|
7382
7401
|
this.arrowHide = false;
|
|
7383
7402
|
this.closeButton = false;
|
|
@@ -7420,7 +7439,7 @@ const MgPopover = class {
|
|
|
7420
7439
|
*/
|
|
7421
7440
|
componentWillLoad() {
|
|
7422
7441
|
// Get windows to attach events
|
|
7423
|
-
this.windows = index$1.
|
|
7442
|
+
this.windows = index$1.ze(window);
|
|
7424
7443
|
// render mg-popover-content slot
|
|
7425
7444
|
this.renderPopoverContent();
|
|
7426
7445
|
this.validateCloseButton(this.closeButton);
|
|
@@ -7512,7 +7531,7 @@ const MgPopoverContent = class {
|
|
|
7512
7531
|
this.hideContent.emit();
|
|
7513
7532
|
};
|
|
7514
7533
|
this.closeButton = false;
|
|
7515
|
-
this.classCollection = new index$1.
|
|
7534
|
+
this.classCollection = new index$1.He(['mg-c-popover-content']);
|
|
7516
7535
|
}
|
|
7517
7536
|
/*************
|
|
7518
7537
|
* Lifecycle *
|
|
@@ -7530,7 +7549,7 @@ const MgPopoverContent = class {
|
|
|
7530
7549
|
componentDidLoad() {
|
|
7531
7550
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7532
7551
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
7533
|
-
if (slottedTitleElement && !index$1.
|
|
7552
|
+
if (slottedTitleElement && !index$1.Be(slottedTitleElement, headingTags)) {
|
|
7534
7553
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
7535
7554
|
}
|
|
7536
7555
|
}
|
|
@@ -7566,7 +7585,7 @@ const MgSkipLinks = class {
|
|
|
7566
7585
|
this.links = undefined;
|
|
7567
7586
|
}
|
|
7568
7587
|
validateLinks(links) {
|
|
7569
|
-
if (links === undefined || links.length === 0 || links.some(link => !index$1.
|
|
7588
|
+
if (links === undefined || links.length === 0 || links.some(link => !index$1.Ie(link.href) || !link.href.startsWith('#') || !index$1.Ie(link.label))) {
|
|
7570
7589
|
throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
|
|
7571
7590
|
}
|
|
7572
7591
|
}
|
|
@@ -7718,7 +7737,7 @@ const MgTabs = class {
|
|
|
7718
7737
|
*/
|
|
7719
7738
|
this.resetFocus = () => {
|
|
7720
7739
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7721
|
-
index$1.
|
|
7740
|
+
index$1.Ge(() => {
|
|
7722
7741
|
this.tabFocus = undefined;
|
|
7723
7742
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7724
7743
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7733,16 +7752,16 @@ const MgTabs = class {
|
|
|
7733
7752
|
if (slots.length !== this.tabs.length)
|
|
7734
7753
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7735
7754
|
};
|
|
7736
|
-
this.identifier = index$1.
|
|
7755
|
+
this.identifier = index$1.Ce('mg-tabs');
|
|
7737
7756
|
this.label = undefined;
|
|
7738
7757
|
this.size = 'regular';
|
|
7739
7758
|
this.items = undefined;
|
|
7740
7759
|
this.activeTab = undefined;
|
|
7741
7760
|
this.tabs = [];
|
|
7742
|
-
this.classCollection = new index$1.
|
|
7761
|
+
this.classCollection = new index$1.He(['mg-c-tabs']);
|
|
7743
7762
|
}
|
|
7744
7763
|
validateLabel(newValue) {
|
|
7745
|
-
if (!index$1.
|
|
7764
|
+
if (!index$1.Ie(newValue)) {
|
|
7746
7765
|
throw new Error('<mg-tabs> prop "label" is required.');
|
|
7747
7766
|
}
|
|
7748
7767
|
}
|
|
@@ -7754,7 +7773,7 @@ const MgTabs = class {
|
|
|
7754
7773
|
}
|
|
7755
7774
|
validateItems(newValue) {
|
|
7756
7775
|
// String array
|
|
7757
|
-
if (index$1.
|
|
7776
|
+
if (index$1.Pe(newValue))
|
|
7758
7777
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
7759
7778
|
// Object array
|
|
7760
7779
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
@@ -7854,7 +7873,7 @@ const MgTag = class {
|
|
|
7854
7873
|
this.variant = variants[0];
|
|
7855
7874
|
this.outline = undefined;
|
|
7856
7875
|
this.soft = undefined;
|
|
7857
|
-
this.classCollection = new index$1.
|
|
7876
|
+
this.classCollection = new index$1.He(['mg-c-tag']);
|
|
7858
7877
|
}
|
|
7859
7878
|
validateVariant(newValue, oldValue) {
|
|
7860
7879
|
if (!variants.includes(newValue)) {
|
|
@@ -7891,7 +7910,7 @@ const MgTag = class {
|
|
|
7891
7910
|
* @param textContent - html element textContent property
|
|
7892
7911
|
*/
|
|
7893
7912
|
validateTextContent(textContent) {
|
|
7894
|
-
if (!index$1.
|
|
7913
|
+
if (!index$1.Ie(textContent))
|
|
7895
7914
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
7896
7915
|
}
|
|
7897
7916
|
/*************
|
|
@@ -7951,10 +7970,10 @@ const MgTooltip = class {
|
|
|
7951
7970
|
// Enable the event listeners
|
|
7952
7971
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7953
7972
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7954
|
-
index$1.
|
|
7973
|
+
index$1.Ge(() => {
|
|
7955
7974
|
this.windows.forEach((localWindow) => {
|
|
7956
|
-
localWindow.addEventListener('click', this.
|
|
7957
|
-
localWindow.addEventListener('keydown', this.
|
|
7975
|
+
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
7976
|
+
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
7958
7977
|
});
|
|
7959
7978
|
});
|
|
7960
7979
|
};
|
|
@@ -7968,15 +7987,15 @@ const MgTooltip = class {
|
|
|
7968
7987
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
7969
7988
|
// Remove event listener
|
|
7970
7989
|
this.windows.forEach((localWindow) => {
|
|
7971
|
-
localWindow.removeEventListener('click', this.
|
|
7972
|
-
localWindow.removeEventListener('keyboard', this.
|
|
7990
|
+
localWindow.removeEventListener('click', this.handleClickOutside, false);
|
|
7991
|
+
localWindow.removeEventListener('keyboard', this.handlePressEscape, false);
|
|
7973
7992
|
});
|
|
7974
7993
|
};
|
|
7975
7994
|
/**
|
|
7976
7995
|
* Check if clicked outside of component and hidde tooltip
|
|
7977
7996
|
* @param event - mouse event
|
|
7978
7997
|
*/
|
|
7979
|
-
this.
|
|
7998
|
+
this.handleClickOutside = (event) => {
|
|
7980
7999
|
if (event.target.closest('mg-tooltip') !== this.element)
|
|
7981
8000
|
this.setDisplay(false);
|
|
7982
8001
|
};
|
|
@@ -7984,7 +8003,7 @@ const MgTooltip = class {
|
|
|
7984
8003
|
* Check if 'Escape' key is pressed of component and hidde tooltip
|
|
7985
8004
|
* @param event - keyboard event
|
|
7986
8005
|
*/
|
|
7987
|
-
this.
|
|
8006
|
+
this.handlePressEscape = (event) => {
|
|
7988
8007
|
if (event.code === 'Escape') {
|
|
7989
8008
|
this.setDisplay(false);
|
|
7990
8009
|
this.resetGuard();
|
|
@@ -8002,23 +8021,25 @@ const MgTooltip = class {
|
|
|
8002
8021
|
/**
|
|
8003
8022
|
* Action for tooltip element and tooltiped element mouse listener
|
|
8004
8023
|
* @param elementGuard - tooltip element guard
|
|
8005
|
-
* @param
|
|
8024
|
+
* @param eventName - event name
|
|
8006
8025
|
* @param conditionalGuard - guard condition
|
|
8007
8026
|
*/
|
|
8008
|
-
this.tooltipMouseListenerAction = (elementGuard,
|
|
8009
|
-
//
|
|
8010
|
-
if (
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8027
|
+
this.tooltipMouseListenerAction = (elementGuard, eventName, conditionalGuard) => {
|
|
8028
|
+
// active FOCUS guard cancel process
|
|
8029
|
+
if ([Guard.FOCUS, Guard.DISABLE_ON_CLICK].includes(this.guard)) {
|
|
8030
|
+
return;
|
|
8031
|
+
}
|
|
8032
|
+
// Update guard by element guard
|
|
8033
|
+
this.guard = elementGuard;
|
|
8034
|
+
if (eventName !== 'mouseenter') {
|
|
8035
|
+
// process action in the next event loop macro task
|
|
8036
|
+
setTimeout(() => {
|
|
8037
|
+
this.setDisplay(false, this.guard !== conditionalGuard);
|
|
8038
|
+
this.resetGuard();
|
|
8039
|
+
}, 100);
|
|
8040
|
+
}
|
|
8041
|
+
else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {
|
|
8042
|
+
this.setDisplay(true);
|
|
8022
8043
|
}
|
|
8023
8044
|
};
|
|
8024
8045
|
/**
|
|
@@ -8045,27 +8066,9 @@ const MgTooltip = class {
|
|
|
8045
8066
|
}
|
|
8046
8067
|
};
|
|
8047
8068
|
/**
|
|
8048
|
-
*
|
|
8049
|
-
* @param slotElement - slotted element
|
|
8050
|
-
* @param interactiveElement - interactive element
|
|
8069
|
+
* Set popper instance
|
|
8051
8070
|
*/
|
|
8052
|
-
this.
|
|
8053
|
-
// Add tabindex to slotted element if we can't find any interactive element
|
|
8054
|
-
if (!this.disabled && !interactiveElement) {
|
|
8055
|
-
this.hasCustomTabIndex = true;
|
|
8056
|
-
slotElement.tabIndex = 0;
|
|
8057
|
-
// Add role on non-interactive element to work with "aria-describedby" for screen readers
|
|
8058
|
-
slotElement.setAttribute('role', 'button');
|
|
8059
|
-
}
|
|
8060
|
-
// Set aria-describedby
|
|
8061
|
-
const ariaDescribedby = slotElement.getAttribute('aria-describedby');
|
|
8062
|
-
if (ariaDescribedby === null) {
|
|
8063
|
-
this.tooltipedElement.setAttribute('aria-describedby', this.identifier);
|
|
8064
|
-
}
|
|
8065
|
-
else {
|
|
8066
|
-
// We ensure to have uniq ids
|
|
8067
|
-
slotElement.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);
|
|
8068
|
-
}
|
|
8071
|
+
this.setPopper = () => {
|
|
8069
8072
|
// use element data attribute: `data-popper-strategy`, in order to get popper strategy configuration
|
|
8070
8073
|
const strategy = (this.element.dataset.popperStrategy || 'fixed');
|
|
8071
8074
|
// Create popperjs tooltip
|
|
@@ -8087,13 +8090,14 @@ const MgTooltip = class {
|
|
|
8087
8090
|
},
|
|
8088
8091
|
],
|
|
8089
8092
|
});
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8093
|
+
};
|
|
8094
|
+
/**
|
|
8095
|
+
* Define selected element to become tooltip selector and init listeners
|
|
8096
|
+
* @param element - tooltiped element
|
|
8097
|
+
*/
|
|
8098
|
+
this.setTooltipedElement = (element) => {
|
|
8099
|
+
this.tooltipedElement = element;
|
|
8100
|
+
// Manage tooltipedElement focus events
|
|
8097
8101
|
this.tooltipedElement.addEventListener('focus', () => {
|
|
8098
8102
|
this.guard = Guard.FOCUS;
|
|
8099
8103
|
this.setDisplay(true);
|
|
@@ -8108,37 +8112,71 @@ const MgTooltip = class {
|
|
|
8108
8112
|
this.resetGuard();
|
|
8109
8113
|
this.setDisplay(false);
|
|
8110
8114
|
});
|
|
8111
|
-
document.addEventListener('keydown', this.pressEscape);
|
|
8112
8115
|
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
].forEach(({ element, action }) => {
|
|
8119
|
-
element.addEventListener(eventType, () => {
|
|
8120
|
-
action();
|
|
8121
|
-
});
|
|
8122
|
-
});
|
|
8116
|
+
this.tooltipedElement.addEventListener('mouseenter', () => {
|
|
8117
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIP_ELEMENT);
|
|
8118
|
+
});
|
|
8119
|
+
this.tooltipedElement.addEventListener('mouseleave', () => {
|
|
8120
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIP_ELEMENT);
|
|
8123
8121
|
});
|
|
8124
8122
|
};
|
|
8125
|
-
|
|
8123
|
+
/**
|
|
8124
|
+
* Set button mutation observer
|
|
8125
|
+
* @param mgButton - mg-button to observe
|
|
8126
|
+
*/
|
|
8127
|
+
this.setMgButtonMutationObserver = (mgButton) => {
|
|
8128
|
+
new MutationObserver(mutationList => {
|
|
8129
|
+
// stop process when none of mutations attributed is disabled
|
|
8130
|
+
if (!mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName)))
|
|
8131
|
+
return;
|
|
8132
|
+
// set guard when one of mutations is for a disabled with disabled-on-click
|
|
8133
|
+
if (mutationList.some((mutation) => mutation.target.disabled && mutation.target.disableOnClick)) {
|
|
8134
|
+
this.guard = Guard.DISABLE_ON_CLICK;
|
|
8135
|
+
}
|
|
8136
|
+
// when the disabled-on-click guard is running we stop process
|
|
8137
|
+
if (this.guard === Guard.DISABLE_ON_CLICK)
|
|
8138
|
+
return;
|
|
8139
|
+
// update button wrapper
|
|
8140
|
+
this.setMgButtonWrapper(mgButton);
|
|
8141
|
+
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
8142
|
+
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
8143
|
+
this.resetGuard();
|
|
8144
|
+
// update popper instance
|
|
8145
|
+
this.popper.update();
|
|
8146
|
+
}).observe(mgButton, { attributes: true });
|
|
8147
|
+
};
|
|
8148
|
+
/**
|
|
8149
|
+
* Set tooltiped element aria-describedby
|
|
8150
|
+
* @param element - element to update
|
|
8151
|
+
*/
|
|
8152
|
+
this.setAriaDescribedby = (element) => {
|
|
8153
|
+
// Set aria-describedby
|
|
8154
|
+
const ariaDescribedby = element.getAttribute('aria-describedby');
|
|
8155
|
+
if (ariaDescribedby === null) {
|
|
8156
|
+
this.tooltipedElement.setAttribute('aria-describedby', this.identifier);
|
|
8157
|
+
}
|
|
8158
|
+
else {
|
|
8159
|
+
// We ensure to have uniq ids
|
|
8160
|
+
element.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);
|
|
8161
|
+
}
|
|
8162
|
+
};
|
|
8163
|
+
this.identifier = index$1.Ce('mg-tooltip');
|
|
8126
8164
|
this.message = undefined;
|
|
8127
8165
|
this.placement = 'bottom';
|
|
8128
8166
|
this.display = false;
|
|
8129
8167
|
this.disabled = false;
|
|
8130
8168
|
}
|
|
8131
|
-
|
|
8169
|
+
watchIdentifier() {
|
|
8132
8170
|
// use renderTooltipContent to update tooltip-content id
|
|
8133
8171
|
this.renderTooltipContent();
|
|
8134
8172
|
}
|
|
8135
|
-
|
|
8136
|
-
if (!index$1.
|
|
8173
|
+
watchMessage(newValue) {
|
|
8174
|
+
if (!index$1.Ie(newValue)) {
|
|
8137
8175
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
8138
8176
|
}
|
|
8139
8177
|
this.mgTooltipContent.message = newValue;
|
|
8140
8178
|
}
|
|
8141
|
-
|
|
8179
|
+
watchDisplay(newValue) {
|
|
8142
8180
|
if (newValue) {
|
|
8143
8181
|
this.show();
|
|
8144
8182
|
}
|
|
@@ -8146,7 +8184,7 @@ const MgTooltip = class {
|
|
|
8146
8184
|
this.hide();
|
|
8147
8185
|
}
|
|
8148
8186
|
}
|
|
8149
|
-
|
|
8187
|
+
watchDisabled(newValue) {
|
|
8150
8188
|
if (this.hasCustomTabIndex) {
|
|
8151
8189
|
if (newValue)
|
|
8152
8190
|
this.tooltipedElement.removeAttribute('tabindex');
|
|
@@ -8155,23 +8193,29 @@ const MgTooltip = class {
|
|
|
8155
8193
|
}
|
|
8156
8194
|
}
|
|
8157
8195
|
/**
|
|
8158
|
-
* Render tooltip content element
|
|
8196
|
+
* Render tooltip content element and init listeners
|
|
8159
8197
|
*/
|
|
8160
8198
|
renderTooltipContent() {
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
mgTooltipContent.
|
|
8199
|
+
if (this.mgTooltipContent) {
|
|
8200
|
+
this.mgTooltipContent.setAttribute('id', this.identifier);
|
|
8201
|
+
}
|
|
8202
|
+
else {
|
|
8203
|
+
this.mgTooltipContent = document.createElement('mg-tooltip-content');
|
|
8204
|
+
this.mgTooltipContent.setAttribute('slot', 'content');
|
|
8205
|
+
this.mgTooltipContent.setAttribute('id', this.identifier);
|
|
8166
8206
|
const arrow = document.createElement('div');
|
|
8167
8207
|
arrow.setAttribute('slot', 'arrow');
|
|
8168
8208
|
arrow.dataset.popperArrow = '';
|
|
8169
|
-
mgTooltipContent.appendChild(arrow);
|
|
8209
|
+
this.mgTooltipContent.appendChild(arrow);
|
|
8210
|
+
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
8211
|
+
this.mgTooltipContent.addEventListener('mouseenter', () => {
|
|
8212
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIPED_ELEMENT);
|
|
8213
|
+
});
|
|
8214
|
+
this.mgTooltipContent.addEventListener('mouseleave', () => {
|
|
8215
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIPED_ELEMENT);
|
|
8216
|
+
});
|
|
8170
8217
|
// append tooltip element to component
|
|
8171
|
-
this.element.appendChild(mgTooltipContent);
|
|
8172
|
-
}
|
|
8173
|
-
else {
|
|
8174
|
-
mgTooltipContent.setAttribute('id', this.identifier);
|
|
8218
|
+
this.element.appendChild(this.mgTooltipContent);
|
|
8175
8219
|
}
|
|
8176
8220
|
}
|
|
8177
8221
|
/*************
|
|
@@ -8182,14 +8226,13 @@ const MgTooltip = class {
|
|
|
8182
8226
|
*/
|
|
8183
8227
|
componentWillLoad() {
|
|
8184
8228
|
// Get windows to attach events
|
|
8185
|
-
this.windows = index$1.
|
|
8229
|
+
this.windows = index$1.ze(window);
|
|
8186
8230
|
// Get tooltip element
|
|
8187
8231
|
this.renderTooltipContent();
|
|
8188
|
-
this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);
|
|
8189
8232
|
//validate properties
|
|
8190
|
-
this.
|
|
8191
|
-
this.
|
|
8192
|
-
this.
|
|
8233
|
+
this.watchDisabled(this.disabled);
|
|
8234
|
+
this.watchMessage(this.message);
|
|
8235
|
+
this.watchIdentifier();
|
|
8193
8236
|
}
|
|
8194
8237
|
/**
|
|
8195
8238
|
* Get slotted element
|
|
@@ -8201,26 +8244,29 @@ const MgTooltip = class {
|
|
|
8201
8244
|
// get slotted element wich is not the tooltip
|
|
8202
8245
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
8203
8246
|
// Get interactive element
|
|
8204
|
-
const interactiveElement = slotElement.matches(index$1.
|
|
8205
|
-
|
|
8206
|
-
this.tooltipedElement = interactiveElement || slotElement;
|
|
8247
|
+
const interactiveElement = slotElement.matches(index$1.We) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(index$1.We);
|
|
8248
|
+
this.setTooltipedElement(interactiveElement || slotElement);
|
|
8207
8249
|
// Check if slotted element is a disabled mg-button
|
|
8208
8250
|
// In this case we wrap the mg-button into a div to enable the tooltip
|
|
8209
8251
|
if (isButton(slotElement)) {
|
|
8210
|
-
|
|
8211
|
-
if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName)) && this.guard !== Guard.DISABLE_ON_CLICK) {
|
|
8212
|
-
this.setMgButtonWrapper(slotElement);
|
|
8213
|
-
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
8214
|
-
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
8215
|
-
this.resetGuard();
|
|
8216
|
-
this.initTooltip(slotElement, interactiveElement);
|
|
8217
|
-
}
|
|
8218
|
-
}).observe(slotElement, { attributes: true });
|
|
8252
|
+
this.setMgButtonMutationObserver(slotElement);
|
|
8219
8253
|
this.setMgButtonWrapper(slotElement);
|
|
8220
8254
|
}
|
|
8221
|
-
//
|
|
8222
|
-
this.
|
|
8223
|
-
|
|
8255
|
+
// Add tabindex to slotted element if we can't find any interactive element
|
|
8256
|
+
if (!this.disabled && !interactiveElement) {
|
|
8257
|
+
this.hasCustomTabIndex = true;
|
|
8258
|
+
slotElement.tabIndex = 0;
|
|
8259
|
+
// Add role on non-interactive element to work with "aria-describedby" for screen readers
|
|
8260
|
+
slotElement.setAttribute('role', 'button');
|
|
8261
|
+
}
|
|
8262
|
+
// apply a11y aria
|
|
8263
|
+
this.setAriaDescribedby(slotElement);
|
|
8264
|
+
// set Tooltip
|
|
8265
|
+
this.setPopper();
|
|
8266
|
+
// add document keyboard handler
|
|
8267
|
+
document.addEventListener('keydown', this.handlePressEscape);
|
|
8268
|
+
// check props
|
|
8269
|
+
this.watchDisplay(this.display);
|
|
8224
8270
|
}
|
|
8225
8271
|
/**
|
|
8226
8272
|
* update popper position after props change on component did update hook to benefit from render ended
|
|
@@ -8233,14 +8279,14 @@ const MgTooltip = class {
|
|
|
8233
8279
|
* @returns HTML Element
|
|
8234
8280
|
*/
|
|
8235
8281
|
render() {
|
|
8236
|
-
return (index.h(index.Host, { key: '
|
|
8282
|
+
return (index.h(index.Host, { key: '9d7c428ba22f6b8e41ad1b62837d7b369e38314d' }, index.h("slot", { key: 'f5bdcac81a64674dd57e88e1c00b540dd49310f6' }), index.h("slot", { key: '8d40b6f4f1d3f385dcdf582509f89b3ec0dbd676', name: "content" })));
|
|
8237
8283
|
}
|
|
8238
8284
|
get element() { return index.getElement(this); }
|
|
8239
8285
|
static get watchers() { return {
|
|
8240
|
-
"identifier": ["
|
|
8241
|
-
"message": ["
|
|
8242
|
-
"display": ["
|
|
8243
|
-
"disabled": ["
|
|
8286
|
+
"identifier": ["watchIdentifier"],
|
|
8287
|
+
"message": ["watchMessage"],
|
|
8288
|
+
"display": ["watchDisplay"],
|
|
8289
|
+
"disabled": ["watchDisabled"]
|
|
8244
8290
|
}; }
|
|
8245
8291
|
};
|
|
8246
8292
|
MgTooltip.style = MgTooltipStyle0;
|