@mgdis/mg-components 5.27.2 → 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-00072168.js → index-11b35234.js} +76 -36
- package/dist/cjs/index-11b35234.js.map +1 -0
- package/dist/cjs/index-3198e64e.js +1688 -0
- 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 +270 -216
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +10 -10
- 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/collection/components/molecules/menu/mg-menu/mg-menu.js +21 -18
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +2 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -4
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +6 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/components/index.es.js +65 -25
- 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 +26 -23
- package/dist/components/mg-item-more2.js.map +1 -1
- package/dist/components/mg-loader.js +2 -2
- package/dist/components/mg-menu-item2.js +8 -7
- package/dist/components/mg-menu-item2.js.map +1 -1
- 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 +9 -5
- package/dist/components/mg-popover2.js.map +1 -1
- 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-8d5d1bfd.js → index-00abd8c1.js} +67 -27
- package/dist/esm/index-00abd8c1.js.map +1 -0
- package/dist/esm/index-99317ec3.js +1659 -0
- 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 +270 -216
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-components.js +11 -11
- 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-99e2f42a.entry.js → p-d3e15dd7.entry.js} +2 -2
- package/dist/mg-components/{p-99e2f42a.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/components/molecules/menu/mg-menu/mg-menu.d.ts +1 -5
- 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 +25 -25
- package/dist/cjs/index-00072168.js.map +0 -1
- package/dist/cjs/index-7e27c7ae.js +0 -2561
- package/dist/cjs/index-7e27c7ae.js.map +0 -1
- package/dist/esm/index-8d5d1bfd.js.map +0 -1
- package/dist/esm/index-e479d5ae.js +0 -2532
- package/dist/esm/index-e479d5ae.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-7315d4a6.js +0 -3
- package/dist/mg-components/p-7315d4a6.js.map +0 -1
- package/dist/mg-components/p-8800813b.js +0 -2
- package/dist/mg-components/p-8800813b.js.map +0 -1
- package/dist/mg-components/p-f9ac8927.entry.js +0 -2
- package/dist/mg-components/p-f9ac8927.entry.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-99317ec3.js';
|
|
2
|
+
import { C as Ce, i as initLocales, H as He, I as Ie, G as Ge, B as Be, q as qe, h as he, y as ye, Z as Ze, Q as Qe, J as Je, Y as Ye, P as Pe, W as We, z as ze } from './index-00abd8c1.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Available menu-item positions
|
|
@@ -75,7 +75,7 @@ const MgActionMore = class {
|
|
|
75
75
|
************/
|
|
76
76
|
this.name = 'mg-action-more';
|
|
77
77
|
this.classBase = 'mg-c-action-more';
|
|
78
|
-
this.mgPopoverIdentifier =
|
|
78
|
+
this.mgPopoverIdentifier = Ce(this.name);
|
|
79
79
|
/************
|
|
80
80
|
* Methods *
|
|
81
81
|
***********/
|
|
@@ -199,7 +199,7 @@ const MgBadge = class {
|
|
|
199
199
|
this.label = undefined;
|
|
200
200
|
this.variant = variants$5[0];
|
|
201
201
|
this.outline = undefined;
|
|
202
|
-
this.classCollection = new
|
|
202
|
+
this.classCollection = new He(['mg-c-badge']);
|
|
203
203
|
}
|
|
204
204
|
validateValue(newValue) {
|
|
205
205
|
if (/^(\d+\+*|[?*!a-z])$/i.exec(`${newValue}`) === null) {
|
|
@@ -207,7 +207,7 @@ const MgBadge = class {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
validateLabel(newValue) {
|
|
210
|
-
if (!
|
|
210
|
+
if (!Ie(newValue)) {
|
|
211
211
|
throw new Error('<mg-badge> prop "label" is required.');
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -318,7 +318,7 @@ const MgButton = class {
|
|
|
318
318
|
this.isIcon = false;
|
|
319
319
|
this.disableOnClick = false;
|
|
320
320
|
this.loading = false;
|
|
321
|
-
this.classCollection = new
|
|
321
|
+
this.classCollection = new He(['mg-c-button']);
|
|
322
322
|
}
|
|
323
323
|
validateVariant(newValue, oldValue) {
|
|
324
324
|
if (!variants$4.includes(newValue)) {
|
|
@@ -377,7 +377,7 @@ const MgButton = class {
|
|
|
377
377
|
this.validateFullWidth(this.fullWidth);
|
|
378
378
|
if (this.isIcon) {
|
|
379
379
|
this.classCollection.add(`mg-c-button--icon`);
|
|
380
|
-
if (!
|
|
380
|
+
if (!Ie(this.label)) {
|
|
381
381
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
382
382
|
}
|
|
383
383
|
}
|
|
@@ -389,7 +389,7 @@ const MgButton = class {
|
|
|
389
389
|
* Add listners
|
|
390
390
|
*/
|
|
391
391
|
componentDidLoad() {
|
|
392
|
-
|
|
392
|
+
Ge(() => {
|
|
393
393
|
var _a;
|
|
394
394
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
395
395
|
// submit buttons should trigger form submition;
|
|
@@ -448,7 +448,7 @@ const MgCard = class {
|
|
|
448
448
|
};
|
|
449
449
|
this.variant = undefined;
|
|
450
450
|
this.variantStyle = undefined;
|
|
451
|
-
this.classCollection = new
|
|
451
|
+
this.classCollection = new He([this.classBase]);
|
|
452
452
|
}
|
|
453
453
|
validateVariant(newValue, oldValue) {
|
|
454
454
|
if (newValue && !variants$3.includes(newValue))
|
|
@@ -553,7 +553,7 @@ const MgDetails = class {
|
|
|
553
553
|
this.expanded = false;
|
|
554
554
|
}
|
|
555
555
|
validateTitles(newValue) {
|
|
556
|
-
if (!
|
|
556
|
+
if (!Ie(newValue)) {
|
|
557
557
|
throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
|
|
558
558
|
}
|
|
559
559
|
}
|
|
@@ -711,7 +711,7 @@ const MgForm = class {
|
|
|
711
711
|
}
|
|
712
712
|
});
|
|
713
713
|
};
|
|
714
|
-
this.identifier =
|
|
714
|
+
this.identifier = Ce('mg-form');
|
|
715
715
|
this.name = this.identifier;
|
|
716
716
|
this.readonly = false;
|
|
717
717
|
this.requiredMessage = undefined;
|
|
@@ -720,7 +720,7 @@ const MgForm = class {
|
|
|
720
720
|
this.disabled = false;
|
|
721
721
|
this.valid = undefined;
|
|
722
722
|
this.invalid = undefined;
|
|
723
|
-
this.classCollection = new
|
|
723
|
+
this.classCollection = new He(['mg-c-form']);
|
|
724
724
|
this.requiredMessageText = undefined;
|
|
725
725
|
}
|
|
726
726
|
validateRequiredMessage(newValue) {
|
|
@@ -861,7 +861,7 @@ const MgIcon = class {
|
|
|
861
861
|
this.variant = undefined;
|
|
862
862
|
this.variantStyle = undefined;
|
|
863
863
|
this.spin = false;
|
|
864
|
-
this.classCollection = new
|
|
864
|
+
this.classCollection = new He(['mg-c-icon']);
|
|
865
865
|
}
|
|
866
866
|
validateIcon(newValue, oldValue) {
|
|
867
867
|
if (!Object.keys(icons).includes(newValue))
|
|
@@ -960,7 +960,7 @@ const MgIllustratedMessage = class {
|
|
|
960
960
|
componentDidLoad() {
|
|
961
961
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
962
962
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
963
|
-
if (!
|
|
963
|
+
if (!Be(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
964
964
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
965
965
|
}
|
|
966
966
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -1000,6 +1000,7 @@ var Handler;
|
|
|
1000
1000
|
(function (Handler) {
|
|
1001
1001
|
Handler["BLUR"] = "blur";
|
|
1002
1002
|
Handler["FOCUS"] = "focus";
|
|
1003
|
+
Handler["MOUSEENTER"] = "mouseenter";
|
|
1003
1004
|
})(Handler || (Handler = {}));
|
|
1004
1005
|
const classFieldset = 'mg-c-input--fieldset';
|
|
1005
1006
|
const classDisabled = 'mg-c-input--disabled';
|
|
@@ -1060,7 +1061,7 @@ const MgInput = class {
|
|
|
1060
1061
|
this.isVerticalList = false;
|
|
1061
1062
|
}
|
|
1062
1063
|
watchIdentifier(newValue) {
|
|
1063
|
-
if (!
|
|
1064
|
+
if (!Ie(newValue)) {
|
|
1064
1065
|
throw new Error('<mg-input> prop "identifier" is required.');
|
|
1065
1066
|
}
|
|
1066
1067
|
else {
|
|
@@ -1145,7 +1146,7 @@ const MgInput = class {
|
|
|
1145
1146
|
*/
|
|
1146
1147
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1147
1148
|
watchLabel() {
|
|
1148
|
-
if (!
|
|
1149
|
+
if (!Ie(this.label)) {
|
|
1149
1150
|
throw new Error('<mg-input> prop "label" is required.');
|
|
1150
1151
|
}
|
|
1151
1152
|
else {
|
|
@@ -1306,7 +1307,7 @@ h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-descri
|
|
|
1306
1307
|
var _a, _b;
|
|
1307
1308
|
return (h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
|
|
1308
1309
|
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 }),
|
|
1309
|
-
h("label", { htmlFor: input._id }, input.title)));
|
|
1310
|
+
h("label", { htmlFor: input._id, onMouseEnter: input._handleMouseEnter, onMouseLeave: input._handleMouseLeave }, input.title)));
|
|
1310
1311
|
})));
|
|
1311
1312
|
|
|
1312
1313
|
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}";
|
|
@@ -1371,7 +1372,11 @@ const MgInputCheckbox = class {
|
|
|
1371
1372
|
/**
|
|
1372
1373
|
* Handle blur event
|
|
1373
1374
|
*/
|
|
1374
|
-
this.handleBlur = () => {
|
|
1375
|
+
this.handleBlur = (event) => {
|
|
1376
|
+
if (this.handlerInProgress === Handler.MOUSEENTER) {
|
|
1377
|
+
event.preventDefault();
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1375
1380
|
// set guard
|
|
1376
1381
|
this.handlerInProgress = Handler.BLUR;
|
|
1377
1382
|
// Check validity
|
|
@@ -1420,6 +1425,18 @@ const MgInputCheckbox = class {
|
|
|
1420
1425
|
});
|
|
1421
1426
|
this.updateValues();
|
|
1422
1427
|
};
|
|
1428
|
+
/**
|
|
1429
|
+
* Handle input label mouseenter event
|
|
1430
|
+
*/
|
|
1431
|
+
this.handleMouseEnter = () => {
|
|
1432
|
+
this.handlerInProgress = Handler.MOUSEENTER;
|
|
1433
|
+
};
|
|
1434
|
+
/**
|
|
1435
|
+
* Handle input label leave event
|
|
1436
|
+
*/
|
|
1437
|
+
this.handleMouseLeave = () => {
|
|
1438
|
+
this.handlerInProgress = undefined;
|
|
1439
|
+
};
|
|
1423
1440
|
/**
|
|
1424
1441
|
* Update values
|
|
1425
1442
|
*/
|
|
@@ -1428,6 +1445,8 @@ const MgInputCheckbox = class {
|
|
|
1428
1445
|
delete o._handleBlur;
|
|
1429
1446
|
delete o._handleInput;
|
|
1430
1447
|
delete o._handleKeydown;
|
|
1448
|
+
delete o._handleMouseEnter;
|
|
1449
|
+
delete o._handleMouseLeave;
|
|
1431
1450
|
delete o._id;
|
|
1432
1451
|
return o;
|
|
1433
1452
|
});
|
|
@@ -1441,7 +1460,7 @@ const MgInputCheckbox = class {
|
|
|
1441
1460
|
* Method to update searchResults
|
|
1442
1461
|
*/
|
|
1443
1462
|
this.updateSearchResults = () => {
|
|
1444
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
1463
|
+
this.searchResults = this.checkboxItems.filter(item => qe(item.title).includes(qe(this.searchValue)));
|
|
1445
1464
|
};
|
|
1446
1465
|
/**
|
|
1447
1466
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1515,7 +1534,7 @@ const MgInputCheckbox = class {
|
|
|
1515
1534
|
this.helpText = undefined;
|
|
1516
1535
|
this.valid = undefined;
|
|
1517
1536
|
this.invalid = undefined;
|
|
1518
|
-
this.classCollection = new
|
|
1537
|
+
this.classCollection = new He([this.baseClassName, classFieldset]);
|
|
1519
1538
|
this.errorMessage = undefined;
|
|
1520
1539
|
this.checkboxItems = [];
|
|
1521
1540
|
this.displaySearchInput = undefined;
|
|
@@ -1525,7 +1544,7 @@ const MgInputCheckbox = class {
|
|
|
1525
1544
|
}
|
|
1526
1545
|
validateValue(newValue) {
|
|
1527
1546
|
if (isCheckboxItems(newValue)) {
|
|
1528
|
-
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) })));
|
|
1547
|
+
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) })));
|
|
1529
1548
|
this.valueChange.emit(newValue);
|
|
1530
1549
|
}
|
|
1531
1550
|
else {
|
|
@@ -1623,7 +1642,7 @@ const MgInputCheckbox = class {
|
|
|
1623
1642
|
if (typeof valid !== 'boolean') {
|
|
1624
1643
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean');
|
|
1625
1644
|
}
|
|
1626
|
-
else if (!
|
|
1645
|
+
else if (!Ie(errorMessage)) {
|
|
1627
1646
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string');
|
|
1628
1647
|
}
|
|
1629
1648
|
else {
|
|
@@ -1736,7 +1755,7 @@ const MgInputCheckbox = class {
|
|
|
1736
1755
|
* @returns HTML Element
|
|
1737
1756
|
*/
|
|
1738
1757
|
render() {
|
|
1739
|
-
return (h("mg-input", { key: '
|
|
1758
|
+
return (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 ? (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())));
|
|
1740
1759
|
}
|
|
1741
1760
|
get element() { return getElement(this); }
|
|
1742
1761
|
static get watchers() { return {
|
|
@@ -1886,7 +1905,7 @@ const MgInputDate = class {
|
|
|
1886
1905
|
* @param value - value to test
|
|
1887
1906
|
* @returns truthy when value match the pattern
|
|
1888
1907
|
*/
|
|
1889
|
-
this.isValidPattern = (value) =>
|
|
1908
|
+
this.isValidPattern = (value) => Ie(value) && he.test(value);
|
|
1890
1909
|
/**
|
|
1891
1910
|
* Format help text to display
|
|
1892
1911
|
* @param helpText - help text format
|
|
@@ -1894,10 +1913,10 @@ const MgInputDate = class {
|
|
|
1894
1913
|
*/
|
|
1895
1914
|
this.formatHelpText = (helpText) => {
|
|
1896
1915
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
1897
|
-
let text =
|
|
1916
|
+
let text = Ie(helpText) ? helpText : this.messages.input.date.helpText;
|
|
1898
1917
|
if (text.includes(defaultHelpTextVariable))
|
|
1899
1918
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
1900
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}',
|
|
1919
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', ye(Ze(new Date('2023-12-24')), this.systemLocale));
|
|
1901
1920
|
};
|
|
1902
1921
|
/**
|
|
1903
1922
|
* Handle input event
|
|
@@ -1989,8 +2008,8 @@ const MgInputDate = class {
|
|
|
1989
2008
|
// min, max & minMax
|
|
1990
2009
|
else if ([InputError$1.MIN, InputError$1.MAX, InputError$1.MINMAX].includes(inputError)) {
|
|
1991
2010
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
1992
|
-
.replace('{min}',
|
|
1993
|
-
.replace('{max}',
|
|
2011
|
+
.replace('{min}', ye(this.min, this.systemLocale))
|
|
2012
|
+
.replace('{max}', ye(this.max, this.systemLocale));
|
|
1994
2013
|
}
|
|
1995
2014
|
// wrong date format
|
|
1996
2015
|
// element.validity.badInput is default error message
|
|
@@ -2004,7 +2023,7 @@ const MgInputDate = class {
|
|
|
2004
2023
|
* @returns translated html pattern
|
|
2005
2024
|
*/
|
|
2006
2025
|
this.renderPattern = () => {
|
|
2007
|
-
let patternLocal =
|
|
2026
|
+
let patternLocal = Qe(this.systemLocale);
|
|
2008
2027
|
for (const key in this.messages.input.date.pattern) {
|
|
2009
2028
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
2010
2029
|
}
|
|
@@ -2026,7 +2045,7 @@ const MgInputDate = class {
|
|
|
2026
2045
|
this.helpText = undefined;
|
|
2027
2046
|
this.valid = undefined;
|
|
2028
2047
|
this.invalid = undefined;
|
|
2029
|
-
this.classCollection = new
|
|
2048
|
+
this.classCollection = new He(['mg-c-input--date']);
|
|
2030
2049
|
this.errorMessage = undefined;
|
|
2031
2050
|
}
|
|
2032
2051
|
validateValue(newValue) {
|
|
@@ -2034,7 +2053,7 @@ const MgInputDate = class {
|
|
|
2034
2053
|
if (newValue === '')
|
|
2035
2054
|
newValue = null;
|
|
2036
2055
|
// check value validity
|
|
2037
|
-
if (newValue && !
|
|
2056
|
+
if (newValue && !Ie(newValue)) {
|
|
2038
2057
|
throw new Error("<mg-input-date> props 'value' must be a valid string");
|
|
2039
2058
|
}
|
|
2040
2059
|
else if (!newValue || (newValue && this.isValidPattern(newValue))) {
|
|
@@ -2091,7 +2110,7 @@ const MgInputDate = class {
|
|
|
2091
2110
|
if (typeof valid !== 'boolean') {
|
|
2092
2111
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean');
|
|
2093
2112
|
}
|
|
2094
|
-
else if (!
|
|
2113
|
+
else if (!Ie(errorMessage)) {
|
|
2095
2114
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string');
|
|
2096
2115
|
}
|
|
2097
2116
|
else {
|
|
@@ -2145,7 +2164,7 @@ const MgInputDate = class {
|
|
|
2145
2164
|
* @returns HTML Element
|
|
2146
2165
|
*/
|
|
2147
2166
|
render() {
|
|
2148
|
-
return (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:
|
|
2167
|
+
return (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: ye(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, 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) => {
|
|
2149
2168
|
if (el !== null)
|
|
2150
2169
|
this.input = el;
|
|
2151
2170
|
} })));
|
|
@@ -2276,9 +2295,9 @@ const MgInputNumeric = class {
|
|
|
2276
2295
|
this.formatValue = (value) => {
|
|
2277
2296
|
switch (this.format) {
|
|
2278
2297
|
case 'number':
|
|
2279
|
-
return
|
|
2298
|
+
return Ye(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2280
2299
|
case 'currency':
|
|
2281
|
-
return
|
|
2300
|
+
return Je(value, this.locale, this.currency);
|
|
2282
2301
|
case 'none':
|
|
2283
2302
|
return value.toString();
|
|
2284
2303
|
}
|
|
@@ -2315,7 +2334,7 @@ const MgInputNumeric = class {
|
|
|
2315
2334
|
this.decimalLength = 2;
|
|
2316
2335
|
this.valid = undefined;
|
|
2317
2336
|
this.invalid = undefined;
|
|
2318
|
-
this.classCollection = new
|
|
2337
|
+
this.classCollection = new He(['mg-c-input--numeric']);
|
|
2319
2338
|
this.errorMessage = undefined;
|
|
2320
2339
|
this.hasFocus = undefined;
|
|
2321
2340
|
}
|
|
@@ -2411,7 +2430,7 @@ const MgInputNumeric = class {
|
|
|
2411
2430
|
if (typeof valid !== 'boolean') {
|
|
2412
2431
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean');
|
|
2413
2432
|
}
|
|
2414
|
-
else if (!
|
|
2433
|
+
else if (!Ie(errorMessage)) {
|
|
2415
2434
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string');
|
|
2416
2435
|
}
|
|
2417
2436
|
else {
|
|
@@ -2603,7 +2622,7 @@ const MgInputPassword = class {
|
|
|
2603
2622
|
this.helpText = undefined;
|
|
2604
2623
|
this.valid = undefined;
|
|
2605
2624
|
this.invalid = undefined;
|
|
2606
|
-
this.classCollection = new
|
|
2625
|
+
this.classCollection = new He(['mg-c-input--password']);
|
|
2607
2626
|
this.errorMessage = undefined;
|
|
2608
2627
|
this.displayPassword = false;
|
|
2609
2628
|
}
|
|
@@ -2661,7 +2680,7 @@ const MgInputPassword = class {
|
|
|
2661
2680
|
if (typeof valid !== 'boolean') {
|
|
2662
2681
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean');
|
|
2663
2682
|
}
|
|
2664
|
-
else if (!
|
|
2683
|
+
else if (!Ie(errorMessage)) {
|
|
2665
2684
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string');
|
|
2666
2685
|
}
|
|
2667
2686
|
else {
|
|
@@ -2808,7 +2827,7 @@ const MgInputRadio = class {
|
|
|
2808
2827
|
this.helpText = undefined;
|
|
2809
2828
|
this.valid = undefined;
|
|
2810
2829
|
this.invalid = undefined;
|
|
2811
|
-
this.classCollection = new
|
|
2830
|
+
this.classCollection = new He(['mg-c-input--radio', classFieldset]);
|
|
2812
2831
|
this.errorMessage = undefined;
|
|
2813
2832
|
this.options = undefined;
|
|
2814
2833
|
}
|
|
@@ -2821,7 +2840,7 @@ const MgInputRadio = class {
|
|
|
2821
2840
|
throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
|
|
2822
2841
|
}
|
|
2823
2842
|
// String array
|
|
2824
|
-
else if (
|
|
2843
|
+
else if (Pe(newValue)) {
|
|
2825
2844
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
2826
2845
|
}
|
|
2827
2846
|
// Object array
|
|
@@ -2880,7 +2899,7 @@ const MgInputRadio = class {
|
|
|
2880
2899
|
if (typeof valid !== 'boolean') {
|
|
2881
2900
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean');
|
|
2882
2901
|
}
|
|
2883
|
-
else if (!
|
|
2902
|
+
else if (!Ie(errorMessage)) {
|
|
2884
2903
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string');
|
|
2885
2904
|
}
|
|
2886
2905
|
else {
|
|
@@ -3027,7 +3046,7 @@ const MgInputSelect = class {
|
|
|
3027
3046
|
if (this.input.value === '') {
|
|
3028
3047
|
this.setValue(null);
|
|
3029
3048
|
}
|
|
3030
|
-
else if (
|
|
3049
|
+
else if (Pe(this.items) && this.items.includes(this.input.value)) {
|
|
3031
3050
|
this.setValue(this.input.value);
|
|
3032
3051
|
}
|
|
3033
3052
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3101,7 +3120,7 @@ const MgInputSelect = class {
|
|
|
3101
3120
|
this.helpText = undefined;
|
|
3102
3121
|
this.valid = undefined;
|
|
3103
3122
|
this.invalid = undefined;
|
|
3104
|
-
this.classCollection = new
|
|
3123
|
+
this.classCollection = new He(['mg-c-input--select']);
|
|
3105
3124
|
this.errorMessage = undefined;
|
|
3106
3125
|
this.options = undefined;
|
|
3107
3126
|
this.valueExist = undefined;
|
|
@@ -3109,7 +3128,7 @@ const MgInputSelect = class {
|
|
|
3109
3128
|
}
|
|
3110
3129
|
validateValue(newValue) {
|
|
3111
3130
|
var _a, _b;
|
|
3112
|
-
if (
|
|
3131
|
+
if (Pe(this.items) && typeof newValue === 'string') {
|
|
3113
3132
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
|
|
3114
3133
|
}
|
|
3115
3134
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3126,7 +3145,7 @@ const MgInputSelect = class {
|
|
|
3126
3145
|
this.options = [];
|
|
3127
3146
|
}
|
|
3128
3147
|
// String array
|
|
3129
|
-
else if (
|
|
3148
|
+
else if (Pe(newValue)) {
|
|
3130
3149
|
if (typeof this.value === 'string')
|
|
3131
3150
|
this.valueExist = newValue.includes(this.value);
|
|
3132
3151
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3198,7 +3217,7 @@ const MgInputSelect = class {
|
|
|
3198
3217
|
if (typeof valid !== 'boolean') {
|
|
3199
3218
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean');
|
|
3200
3219
|
}
|
|
3201
|
-
else if (!
|
|
3220
|
+
else if (!Ie(errorMessage)) {
|
|
3202
3221
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string');
|
|
3203
3222
|
}
|
|
3204
3223
|
else {
|
|
@@ -3310,7 +3329,7 @@ const MgInputText = class {
|
|
|
3310
3329
|
*/
|
|
3311
3330
|
this.handleFocus = () => {
|
|
3312
3331
|
this.classCollection.add(this.classFocus);
|
|
3313
|
-
this.classCollection = new
|
|
3332
|
+
this.classCollection = new He(this.classCollection.classes);
|
|
3314
3333
|
};
|
|
3315
3334
|
/**
|
|
3316
3335
|
* Handle blur event
|
|
@@ -3318,7 +3337,7 @@ const MgInputText = class {
|
|
|
3318
3337
|
this.handleBlur = () => {
|
|
3319
3338
|
// Manage focus
|
|
3320
3339
|
this.classCollection.delete(this.classFocus);
|
|
3321
|
-
this.classCollection = new
|
|
3340
|
+
this.classCollection = new He(this.classCollection.classes);
|
|
3322
3341
|
// Display Error
|
|
3323
3342
|
this.handlerInProgress = Handler.BLUR;
|
|
3324
3343
|
this.displayError().finally(() => {
|
|
@@ -3393,7 +3412,7 @@ const MgInputText = class {
|
|
|
3393
3412
|
this.helpText = undefined;
|
|
3394
3413
|
this.valid = undefined;
|
|
3395
3414
|
this.invalid = undefined;
|
|
3396
|
-
this.classCollection = new
|
|
3415
|
+
this.classCollection = new He(['mg-c-input--text']);
|
|
3397
3416
|
this.errorMessage = undefined;
|
|
3398
3417
|
}
|
|
3399
3418
|
handleValue(newValue) {
|
|
@@ -3444,7 +3463,7 @@ const MgInputText = class {
|
|
|
3444
3463
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3445
3464
|
}
|
|
3446
3465
|
validatePattern(newValue) {
|
|
3447
|
-
if (newValue !== undefined && !(
|
|
3466
|
+
if (newValue !== undefined && !(Ie(this.pattern) && Ie(this.patternErrorMessage))) {
|
|
3448
3467
|
throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3449
3468
|
}
|
|
3450
3469
|
}
|
|
@@ -3474,7 +3493,7 @@ const MgInputText = class {
|
|
|
3474
3493
|
if (typeof valid !== 'boolean') {
|
|
3475
3494
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
|
|
3476
3495
|
}
|
|
3477
|
-
else if (!
|
|
3496
|
+
else if (!Ie(errorMessage)) {
|
|
3478
3497
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
|
|
3479
3498
|
}
|
|
3480
3499
|
else {
|
|
@@ -3583,7 +3602,7 @@ const MgInputTextarea = class {
|
|
|
3583
3602
|
*/
|
|
3584
3603
|
this.handleFocus = () => {
|
|
3585
3604
|
this.classCollection.add(this.classFocus);
|
|
3586
|
-
this.classCollection = new
|
|
3605
|
+
this.classCollection = new He(this.classCollection.classes);
|
|
3587
3606
|
};
|
|
3588
3607
|
/**
|
|
3589
3608
|
* Handle blur event
|
|
@@ -3591,7 +3610,7 @@ const MgInputTextarea = class {
|
|
|
3591
3610
|
this.handleBlur = () => {
|
|
3592
3611
|
// Manage focus
|
|
3593
3612
|
this.classCollection.delete(this.classFocus);
|
|
3594
|
-
this.classCollection = new
|
|
3613
|
+
this.classCollection = new He(this.classCollection.classes);
|
|
3595
3614
|
// Display Error
|
|
3596
3615
|
this.handlerInProgress = Handler.BLUR;
|
|
3597
3616
|
this.displayError().finally(() => {
|
|
@@ -3654,7 +3673,7 @@ const MgInputTextarea = class {
|
|
|
3654
3673
|
this.valid = undefined;
|
|
3655
3674
|
this.invalid = undefined;
|
|
3656
3675
|
this.resizable = 'none';
|
|
3657
|
-
this.classCollection = new
|
|
3676
|
+
this.classCollection = new He(['mg-c-input--textarea']);
|
|
3658
3677
|
this.errorMessage = undefined;
|
|
3659
3678
|
}
|
|
3660
3679
|
handleValue(newValue) {
|
|
@@ -3693,7 +3712,7 @@ const MgInputTextarea = class {
|
|
|
3693
3712
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3694
3713
|
}
|
|
3695
3714
|
validatePattern(newValue) {
|
|
3696
|
-
if (newValue !== undefined && !(
|
|
3715
|
+
if (newValue !== undefined && !(Ie(this.pattern) && Ie(this.patternErrorMessage))) {
|
|
3697
3716
|
throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3698
3717
|
}
|
|
3699
3718
|
}
|
|
@@ -3725,7 +3744,7 @@ const MgInputTextarea = class {
|
|
|
3725
3744
|
if (typeof valid !== 'boolean') {
|
|
3726
3745
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
|
|
3727
3746
|
}
|
|
3728
|
-
else if (!
|
|
3747
|
+
else if (!Ie(errorMessage)) {
|
|
3729
3748
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
|
|
3730
3749
|
}
|
|
3731
3750
|
else {
|
|
@@ -3814,7 +3833,7 @@ const MgInputTitle = class {
|
|
|
3814
3833
|
this.tagName = 'label';
|
|
3815
3834
|
}
|
|
3816
3835
|
validateIdentifier(newValue) {
|
|
3817
|
-
if (!
|
|
3836
|
+
if (!Ie(newValue)) {
|
|
3818
3837
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
3819
3838
|
}
|
|
3820
3839
|
}
|
|
@@ -3928,7 +3947,7 @@ const MgInputToggle = class {
|
|
|
3928
3947
|
this.tooltip = undefined;
|
|
3929
3948
|
this.tooltipPosition = 'input';
|
|
3930
3949
|
this.helpText = undefined;
|
|
3931
|
-
this.classCollection = new
|
|
3950
|
+
this.classCollection = new He(['mg-c-input--toggle']);
|
|
3932
3951
|
this.options = undefined;
|
|
3933
3952
|
this.errorMessage = undefined;
|
|
3934
3953
|
this.valid = undefined;
|
|
@@ -3945,7 +3964,7 @@ const MgInputToggle = class {
|
|
|
3945
3964
|
throw new Error('<mg-input-toggle> prop "items" require 2 items.');
|
|
3946
3965
|
}
|
|
3947
3966
|
// String array
|
|
3948
|
-
else if (
|
|
3967
|
+
else if (Pe(newValue)) {
|
|
3949
3968
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
3950
3969
|
}
|
|
3951
3970
|
// Object array
|
|
@@ -4001,7 +4020,7 @@ const MgInputToggle = class {
|
|
|
4001
4020
|
if (typeof valid !== 'boolean') {
|
|
4002
4021
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean');
|
|
4003
4022
|
}
|
|
4004
|
-
else if (!
|
|
4023
|
+
else if (!Ie(errorMessage)) {
|
|
4005
4024
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string');
|
|
4006
4025
|
}
|
|
4007
4026
|
else {
|
|
@@ -4247,7 +4266,7 @@ const MgItemMore = class {
|
|
|
4247
4266
|
navElement.click();
|
|
4248
4267
|
});
|
|
4249
4268
|
// add id suffix to prevent duplicate key. default html id is: '';
|
|
4250
|
-
if (
|
|
4269
|
+
if (Ie(proxy.id))
|
|
4251
4270
|
proxy.id = `${proxy.id}-proxy`;
|
|
4252
4271
|
// update properties and DOM when proxyfied item is updated
|
|
4253
4272
|
proxified.addEventListener('item-updated', (event) => {
|
|
@@ -4277,7 +4296,7 @@ const MgItemMore = class {
|
|
|
4277
4296
|
this.slotlabel.label = this.messages.menuLabel;
|
|
4278
4297
|
}
|
|
4279
4298
|
validateSize(newValue) {
|
|
4280
|
-
if (newValue &&
|
|
4299
|
+
if (newValue && !sizes$2.includes(newValue))
|
|
4281
4300
|
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type.`);
|
|
4282
4301
|
}
|
|
4283
4302
|
/*************
|
|
@@ -4326,10 +4345,10 @@ const MgItemMore = class {
|
|
|
4326
4345
|
* @returns HTML Element
|
|
4327
4346
|
*/
|
|
4328
4347
|
render() {
|
|
4329
|
-
return (h(Host, { key: '
|
|
4348
|
+
return (h(Host, { key: 'b490696ded183a1db05673b3e9ba9744ee134382', role: "listitem" }, this.parentMenu && (h("mg-menu-item", { key: '6f8b1967da50e77d87355cedde8aeb2327ddd0ab', "data-overflow-more": true, "data-size": this.parentMenu.size, ref: el => {
|
|
4330
4349
|
if (el)
|
|
4331
4350
|
this.moreElementMenuItem = el;
|
|
4332
|
-
} }, h("mg-icon", { key: '
|
|
4351
|
+
} }, h("mg-icon", { key: 'ddcf120831d42bc6cb9b8e147abac9ba7cbeedb6', icon: this.icon.icon, size: this.size, slot: "image" }), h("span", { key: 'fae667ee2f6ac8f4d4f85c5a8db91dede3f470e6', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { key: '912d544f80b84b4cffa28517ffbc91d60792a460', direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size })))));
|
|
4333
4352
|
}
|
|
4334
4353
|
get element() { return getElement(this); }
|
|
4335
4354
|
static get watchers() { return {
|
|
@@ -4365,16 +4384,11 @@ const MgMenu = class {
|
|
|
4365
4384
|
item.expanded = false;
|
|
4366
4385
|
}
|
|
4367
4386
|
};
|
|
4368
|
-
/**
|
|
4369
|
-
* get mg-item-more element
|
|
4370
|
-
* @returns mg-item-more element
|
|
4371
|
-
*/
|
|
4372
|
-
this.getItemMore = () => this.element.querySelector('mg-item-more');
|
|
4373
4387
|
/**
|
|
4374
4388
|
* get mg-item-more child mg-menu-item element
|
|
4375
4389
|
* @returns mg-menu-item element
|
|
4376
4390
|
*/
|
|
4377
|
-
this.getItemMoreMenuItem = () => { var _a, _b; return (_b = (_a = this.
|
|
4391
|
+
this.getItemMoreMenuItem = () => { var _a, _b; return (_b = (_a = this.itemMoreElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item'); };
|
|
4378
4392
|
/**
|
|
4379
4393
|
* Set item listend
|
|
4380
4394
|
* @param item - mg-menu-item element
|
|
@@ -4410,20 +4424,25 @@ const MgMenu = class {
|
|
|
4410
4424
|
* render mg-item-more
|
|
4411
4425
|
*/
|
|
4412
4426
|
this.renderMgItemMore = () => {
|
|
4413
|
-
if (this.direction !== Direction.HORIZONTAL || this.isChildMenu) {
|
|
4427
|
+
if (this.direction !== Direction.HORIZONTAL || this.isChildMenu || this.element.children.length <= 1) {
|
|
4414
4428
|
return;
|
|
4415
4429
|
}
|
|
4416
|
-
//
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
mgItemMore.addEventListener('item-loaded', this.handleItemLoaded);
|
|
4422
|
-
Object.assign(mgItemMore, this.itemmore || {});
|
|
4423
|
-
this.element.appendChild(mgItemMore);
|
|
4430
|
+
// Insert mg-item-more outside the mg-menu shadowdom
|
|
4431
|
+
if (!this.itemMoreElement) {
|
|
4432
|
+
this.itemMoreElement = document.createElement('mg-item-more');
|
|
4433
|
+
this.itemMoreElement.addEventListener('item-loaded', this.handleItemLoaded);
|
|
4434
|
+
this.element.appendChild(this.itemMoreElement);
|
|
4424
4435
|
}
|
|
4425
|
-
|
|
4426
|
-
|
|
4436
|
+
// update mg-item-more props
|
|
4437
|
+
for (const attribute in this.itemmore) {
|
|
4438
|
+
const newValue = this.itemmore[attribute];
|
|
4439
|
+
// to improve rendering we use HTML attributes as much as possible
|
|
4440
|
+
if (['string', 'number'].includes(typeof newValue)) {
|
|
4441
|
+
this.itemMoreElement.setAttribute(attribute, newValue);
|
|
4442
|
+
}
|
|
4443
|
+
else {
|
|
4444
|
+
this.itemMoreElement[attribute] = newValue;
|
|
4445
|
+
}
|
|
4427
4446
|
}
|
|
4428
4447
|
};
|
|
4429
4448
|
this.label = undefined;
|
|
@@ -4446,6 +4465,9 @@ const MgMenu = class {
|
|
|
4446
4465
|
if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
|
|
4447
4466
|
throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${Direction.HORIZONTAL}.`);
|
|
4448
4467
|
}
|
|
4468
|
+
else if (newValue) {
|
|
4469
|
+
this.renderMgItemMore();
|
|
4470
|
+
}
|
|
4449
4471
|
}
|
|
4450
4472
|
validateSize(newValue) {
|
|
4451
4473
|
if (!sizes$2.includes(newValue)) {
|
|
@@ -4496,7 +4518,7 @@ const MgMenu = class {
|
|
|
4496
4518
|
* @returns HTML Element
|
|
4497
4519
|
*/
|
|
4498
4520
|
render() {
|
|
4499
|
-
return (h(Host, { key: '
|
|
4521
|
+
return (h(Host, { key: 'a29897d754b7cbb34cc8d63b5ecb025c0d252e12', role: "list", "aria-label": this.label }, h("slot", { key: '7fc9dbd765f529e17f0c7ca2012d1b6bf86a05d9' })));
|
|
4500
4522
|
}
|
|
4501
4523
|
get element() { return getElement(this); }
|
|
4502
4524
|
static get watchers() { return {
|
|
@@ -4508,7 +4530,7 @@ const MgMenu = class {
|
|
|
4508
4530
|
};
|
|
4509
4531
|
MgMenu.style = MgMenuStyle0;
|
|
4510
4532
|
|
|
4511
|
-
const mgMenuItemCss = ".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-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{height:3.8rem;padding:1rem 2rem}.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button,.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button ::slotted([slot=label]),.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button ::slotted([slot=metadata]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular ::slotted([slot=label]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular ::slotted([slot=metadata]){font-size:var(--font-size)}.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular.mg-c-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular.mg-c-menu-item__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{height:5.1rem;padding:1rem 3rem}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button,.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button ::slotted([slot=label]),.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button ::slotted([slot=metadata]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium ::slotted([slot=label]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium ::slotted([slot=metadata]){font-size:calc(var(--font-size) + .2rem)}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium.mg-c-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium.mg-c-menu-item__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{height:7.1rem;padding:1rem 4rem}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button,.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button ::slotted([slot=label]),.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button ::slotted([slot=metadata]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large ::slotted([slot=label]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large ::slotted([slot=metadata]){font-size:calc(var(--font-size) + .2rem)}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large.mg-c-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large.mg-c-menu-item__navigation-button--vertical{padding-left:calc(4rem - 0.3rem)}.mg-c-menu-item__navigation-button{display:flex;box-sizing:border-box;align-items:center;border:none;background-color:unset;color:hsl(var(--mg-menu-item-color-hsl, var(--color-dark)));column-gap:var(--mg-menu-item-navigation-button-column-gap, 1rem);cursor:pointer;font-family:var(--font-family);font-weight:400;line-height:var(--line-height);text-decoration:none;white-space:nowrap}.mg-c-menu-item__navigation-button:disabled,.mg-c-menu-item__navigation-button--disabled{cursor:default;opacity:var(--mg-disabled-opacity)}.mg-c-menu-item__navigation-button:focus-visible{z-index:10}.mg-c-menu-item__navigation-button:hover:not(.mg-c-menu-item__navigation-button--disabled),.mg-c-menu-item__navigation-button:focus-visible:not(.mg-c-menu-item__navigation-button--disabled){background-color:hsl(var(--mg-menu-item-focused-background-color-hsl)/10%)}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--active{color:hsl(var(--mg-menu-item-color-active-hsl));font-weight:600}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--active.mg-c-menu-item__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--active.mg-c-menu-item__navigation-button--vertical{border-left-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--hidden{display:none}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal{border-bottom:.3rem solid rgba(0,0,0,0)}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical{border-left:.3rem solid rgba(0,0,0,0)}:host([data-style-direction=vertical][data-level=\"1\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(1*2rem - .3rem)}:host([data-level=\"1\"]) .mg-c-menu-item__collapse-container{z-index:calc(1*10)}:host([data-style-direction=vertical][data-level=\"2\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(2*2rem - .3rem)}:host([data-level=\"2\"]) .mg-c-menu-item__collapse-container{z-index:calc(2*10)}:host([data-style-direction=vertical][data-level=\"3\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(3*2rem - .3rem)}:host([data-level=\"3\"]) .mg-c-menu-item__collapse-container{z-index:calc(3*10)}:host([data-style-direction=vertical][data-level=\"4\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(4*2rem - .3rem)}:host([data-level=\"4\"]) .mg-c-menu-item__collapse-container{z-index:calc(4*10)}:host([data-style-direction=vertical][data-level=\"5\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(5*2rem - .3rem)}:host([data-level=\"5\"]) .mg-c-menu-item__collapse-container{z-index:calc(5*10)}:host([data-style-direction=vertical][data-level=\"6\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(6*2rem - .3rem)}:host([data-level=\"6\"]) .mg-c-menu-item__collapse-container{z-index:calc(6*10)}:host([data-style-direction=vertical][data-level=\"1\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(1*3rem - .3rem)}:host([data-level=\"1\"]) .mg-c-menu-item__collapse-container{z-index:calc(1*10)}:host([data-style-direction=vertical][data-level=\"2\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(2*3rem - .3rem)}:host([data-level=\"2\"]) .mg-c-menu-item__collapse-container{z-index:calc(2*10)}:host([data-style-direction=vertical][data-level=\"3\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(3*3rem - .3rem)}:host([data-level=\"3\"]) .mg-c-menu-item__collapse-container{z-index:calc(3*10)}:host([data-style-direction=vertical][data-level=\"4\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(4*3rem - .3rem)}:host([data-level=\"4\"]) .mg-c-menu-item__collapse-container{z-index:calc(4*10)}:host([data-style-direction=vertical][data-level=\"5\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(5*3rem - .3rem)}:host([data-level=\"5\"]) .mg-c-menu-item__collapse-container{z-index:calc(5*10)}:host([data-style-direction=vertical][data-level=\"6\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(6*3rem - .3rem)}:host([data-level=\"6\"]) .mg-c-menu-item__collapse-container{z-index:calc(6*10)}:host([data-style-direction=vertical][data-level=\"1\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(1*4rem - .3rem)}:host([data-level=\"1\"]) .mg-c-menu-item__collapse-container{z-index:calc(1*10)}:host([data-style-direction=vertical][data-level=\"2\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(2*4rem - .3rem)}:host([data-level=\"2\"]) .mg-c-menu-item__collapse-container{z-index:calc(2*10)}:host([data-style-direction=vertical][data-level=\"3\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(3*4rem - .3rem)}:host([data-level=\"3\"]) .mg-c-menu-item__collapse-container{z-index:calc(3*10)}:host([data-style-direction=vertical][data-level=\"4\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(4*4rem - .3rem)}:host([data-level=\"4\"]) .mg-c-menu-item__collapse-container{z-index:calc(4*10)}:host([data-style-direction=vertical][data-level=\"5\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(5*4rem - .3rem)}:host([data-level=\"5\"]) .mg-c-menu-item__collapse-container{z-index:calc(5*10)}:host([data-style-direction=vertical][data-level=\"6\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(6*4rem - .3rem)}:host([data-level=\"6\"]) .mg-c-menu-item__collapse-container{z-index:calc(6*10)}.mg-c-menu-item{max-width:var(--mg-menu-item-navigation-button-max-width)}.mg-c-menu-item__collapse-container{z-index:10;width:max-content}.mg-c-menu-item__navigation-button-center{min-width:0}.mg-c-menu-item__navigation-button-text-content{display:flex;width:100%;align-items:center}.mg-c-menu-item__navigation-button-text-content-notification,.mg-c-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:1rem;font-size:var(--font-size)}.mg-c-menu-item__navigation-button-new-tab{margin-left:.6rem}.mg-c-menu-item__navigation-button-chevron{margin-left:auto;transition:200ms}.mg-c-menu-item__navigation-button-chevron--rotate.mg-c-menu-item__navigation-button-chevron{transform:rotate(180deg)}:host{position:relative;display:flex;--mg-popover-padding-vertical:0;--mg-popover-padding-horizontal:0;--mg-popover-max-width:unset}:host([data-style-direction=vertical]){flex-direction:column}:host([data-style-direction=vertical]) .mg-c-menu-item__navigation-button{width:100%}:host([data-style-direction=vertical]) .mg-c-menu-item__collapse-container{position:unset;top:unset;left:unset;width:unset}:host([data-style-direction=vertical]) .mg-c-menu-item-chevron{margin-left:auto}:host([data-overflow-more]){--mg-menu-item-navigation-button-column-gap:0}:host([data-overflow-more]) .mg-c-menu-item__navigation-button-chevron{display:none}:host([data-overflow-more]) .mg-c-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:0}:host([data-overflow-more]) ::slotted(mg-menu){--mg-menu-item-navigation-button-column-gap:1rem}:host([data-style-direction=horizontal]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level,:host([data-overflow-more]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level{background-color:hsl(var(--color-light))}:host([data-style-direction=horizontal]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level ::slotted(mg-menu),:host([data-overflow-more]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level ::slotted(mg-menu){padding:1rem 0}::slotted([slot=label]),::slotted([slot=metadata]){display:block;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}::slotted(*){display:flex;flex-direction:column}:host([status=disabled]){pointer-events:none}:host([hidden]){display:none}";
|
|
4533
|
+
const mgMenuItemCss = ".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-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{height:3.8rem;padding:1rem 2rem}.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button,.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button ::slotted([slot=label]),.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button ::slotted([slot=metadata]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular ::slotted([slot=label]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular ::slotted([slot=metadata]){font-size:var(--font-size)}.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular.mg-c-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-regular .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular.mg-c-menu-item__navigation-button--vertical{padding-left:calc(2rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{height:5.1rem;padding:1rem 3rem}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button,.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button ::slotted([slot=label]),.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button ::slotted([slot=metadata]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium ::slotted([slot=label]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium ::slotted([slot=metadata]){font-size:calc(var(--font-size) + .2rem)}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium.mg-c-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-medium .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium.mg-c-menu-item__navigation-button--vertical{padding-left:calc(3rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{height:7.1rem;padding:1rem 4rem}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button,.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button ::slotted([slot=label]),.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button ::slotted([slot=metadata]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large ::slotted([slot=label]),.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large ::slotted([slot=metadata]){font-size:calc(var(--font-size) + .2rem)}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large.mg-c-menu-item__navigation-button--horizontal{padding-bottom:calc(1rem - 0.3rem)}.mg-c-menu-item.mg-c-menu-item--size-large .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical,.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large.mg-c-menu-item__navigation-button--vertical{padding-left:calc(4rem - 0.3rem)}.mg-c-menu-item__navigation-button{display:flex;box-sizing:border-box;align-items:center;border:none;background-color:unset;color:hsl(var(--mg-menu-item-color-hsl, var(--color-dark)));column-gap:var(--mg-menu-item-navigation-button-column-gap, 1rem);cursor:pointer;font-family:var(--font-family);font-weight:400;line-height:var(--line-height);text-decoration:none;white-space:nowrap}.mg-c-menu-item__navigation-button:disabled,.mg-c-menu-item__navigation-button--disabled{cursor:default;opacity:var(--mg-disabled-opacity)}.mg-c-menu-item__navigation-button:focus-visible{z-index:10}.mg-c-menu-item__navigation-button:hover:not(.mg-c-menu-item__navigation-button--disabled),.mg-c-menu-item__navigation-button:focus-visible:not(.mg-c-menu-item__navigation-button--disabled){background-color:hsl(var(--mg-menu-item-focused-background-color-hsl)/10%)}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--active{color:hsl(var(--mg-menu-item-color-active-hsl));font-weight:600}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--active.mg-c-menu-item__navigation-button--horizontal{border-bottom-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--active.mg-c-menu-item__navigation-button--vertical{border-left-color:hsl(var(--mg-menu-item-border-color-active-hsl))}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--hidden{display:none}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--horizontal{border-bottom:.3rem solid rgba(0,0,0,0)}.mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--vertical{border-left:.3rem solid rgba(0,0,0,0)}:host([data-style-direction=vertical][data-level=\"1\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(1*2rem - .3rem)}:host([data-level=\"1\"]) .mg-c-menu-item__collapse-container{z-index:calc(1*10)}:host([data-style-direction=vertical][data-level=\"2\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(2*2rem - .3rem)}:host([data-level=\"2\"]) .mg-c-menu-item__collapse-container{z-index:calc(2*10)}:host([data-style-direction=vertical][data-level=\"3\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(3*2rem - .3rem)}:host([data-level=\"3\"]) .mg-c-menu-item__collapse-container{z-index:calc(3*10)}:host([data-style-direction=vertical][data-level=\"4\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(4*2rem - .3rem)}:host([data-level=\"4\"]) .mg-c-menu-item__collapse-container{z-index:calc(4*10)}:host([data-style-direction=vertical][data-level=\"5\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(5*2rem - .3rem)}:host([data-level=\"5\"]) .mg-c-menu-item__collapse-container{z-index:calc(5*10)}:host([data-style-direction=vertical][data-level=\"6\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-regular{padding-left:calc(6*2rem - .3rem)}:host([data-level=\"6\"]) .mg-c-menu-item__collapse-container{z-index:calc(6*10)}:host([data-style-direction=vertical][data-level=\"1\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(1*3rem - .3rem)}:host([data-level=\"1\"]) .mg-c-menu-item__collapse-container{z-index:calc(1*10)}:host([data-style-direction=vertical][data-level=\"2\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(2*3rem - .3rem)}:host([data-level=\"2\"]) .mg-c-menu-item__collapse-container{z-index:calc(2*10)}:host([data-style-direction=vertical][data-level=\"3\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(3*3rem - .3rem)}:host([data-level=\"3\"]) .mg-c-menu-item__collapse-container{z-index:calc(3*10)}:host([data-style-direction=vertical][data-level=\"4\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(4*3rem - .3rem)}:host([data-level=\"4\"]) .mg-c-menu-item__collapse-container{z-index:calc(4*10)}:host([data-style-direction=vertical][data-level=\"5\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(5*3rem - .3rem)}:host([data-level=\"5\"]) .mg-c-menu-item__collapse-container{z-index:calc(5*10)}:host([data-style-direction=vertical][data-level=\"6\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-medium{padding-left:calc(6*3rem - .3rem)}:host([data-level=\"6\"]) .mg-c-menu-item__collapse-container{z-index:calc(6*10)}:host([data-style-direction=vertical][data-level=\"1\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(1*4rem - .3rem)}:host([data-level=\"1\"]) .mg-c-menu-item__collapse-container{z-index:calc(1*10)}:host([data-style-direction=vertical][data-level=\"2\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(2*4rem - .3rem)}:host([data-level=\"2\"]) .mg-c-menu-item__collapse-container{z-index:calc(2*10)}:host([data-style-direction=vertical][data-level=\"3\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(3*4rem - .3rem)}:host([data-level=\"3\"]) .mg-c-menu-item__collapse-container{z-index:calc(3*10)}:host([data-style-direction=vertical][data-level=\"4\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(4*4rem - .3rem)}:host([data-level=\"4\"]) .mg-c-menu-item__collapse-container{z-index:calc(4*10)}:host([data-style-direction=vertical][data-level=\"5\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(5*4rem - .3rem)}:host([data-level=\"5\"]) .mg-c-menu-item__collapse-container{z-index:calc(5*10)}:host([data-style-direction=vertical][data-level=\"6\"]) .mg-c-menu-item__navigation-button.mg-c-menu-item__navigation-button--size-large{padding-left:calc(6*4rem - .3rem)}:host([data-level=\"6\"]) .mg-c-menu-item__collapse-container{z-index:calc(6*10)}.mg-c-menu-item{max-width:var(--mg-menu-item-navigation-button-max-width)}.mg-c-menu-item__collapse-container{z-index:10;width:max-content}.mg-c-menu-item__navigation-button-center{min-width:0}.mg-c-menu-item__navigation-button-text-content{display:flex;width:100%;align-items:center}.mg-c-menu-item__navigation-button-text-content-notification,.mg-c-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:1rem;font-size:var(--font-size)}.mg-c-menu-item__navigation-button-new-tab{margin-left:.6rem}.mg-c-menu-item__navigation-button-chevron{display:var(--mg-c-menu-item-chevron-display);margin-left:auto;transition:200ms}.mg-c-menu-item__navigation-button-chevron--rotate.mg-c-menu-item__navigation-button-chevron{transform:rotate(180deg)}:host{position:relative;display:flex;--mg-popover-padding-vertical:0;--mg-popover-padding-horizontal:0;--mg-popover-max-width:unset}:host([data-style-direction=vertical]){flex-direction:column}:host([data-style-direction=vertical]) .mg-c-menu-item__navigation-button{width:100%}:host([data-style-direction=vertical]) .mg-c-menu-item__collapse-container{position:unset;top:unset;left:unset;width:unset}:host([data-style-direction=vertical]) .mg-c-menu-item-chevron{margin-left:auto}:host([data-overflow-more]){--mg-menu-item-navigation-button-column-gap:0}:host([data-overflow-more]) .mg-c-menu-item__navigation-button-chevron{--mg-c-menu-item-chevron-display:none}:host([data-overflow-more]) .mg-c-menu-item__navigation-button-text-content ::slotted([slot=information]){margin-left:0}:host([data-overflow-more]) ::slotted(mg-menu){--mg-menu-item-navigation-button-column-gap:1rem}:host([data-style-direction=horizontal]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level,:host([data-overflow-more]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level{background-color:hsl(var(--color-light))}:host([data-style-direction=horizontal]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level ::slotted(mg-menu),:host([data-overflow-more]) .mg-c-menu-item__collapse-container.mg-c-menu-item__collapse-container--first-level ::slotted(mg-menu){padding:1rem 0}::slotted([slot=label]),::slotted([slot=metadata]){display:block;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}::slotted(*){display:flex;flex-direction:column}:host([status=disabled]){pointer-events:none}:host([hidden]){display:none}";
|
|
4512
4534
|
const MgMenuItemStyle0 = mgMenuItemCss;
|
|
4513
4535
|
|
|
4514
4536
|
const MgMenuItem = class {
|
|
@@ -4574,7 +4596,7 @@ const MgMenuItem = class {
|
|
|
4574
4596
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
4575
4597
|
['label', 'metadata'].forEach(slot => {
|
|
4576
4598
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
4577
|
-
if (!
|
|
4599
|
+
if (!Ie(element.textContent))
|
|
4578
4600
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
4579
4601
|
if ((guard && element.getAttribute('title') === null) || !guard)
|
|
4580
4602
|
element.setAttribute('title', element.textContent);
|
|
@@ -4643,13 +4665,13 @@ const MgMenuItem = class {
|
|
|
4643
4665
|
* @returns HTML Element
|
|
4644
4666
|
*/
|
|
4645
4667
|
this.renderSlot = () => h("slot", null);
|
|
4646
|
-
this.identifier =
|
|
4668
|
+
this.identifier = Ce('mg-menu-item');
|
|
4647
4669
|
this.href = undefined;
|
|
4648
4670
|
this.target = undefined;
|
|
4649
4671
|
this.status = Status$1.VISIBLE;
|
|
4650
4672
|
this.expanded = false;
|
|
4651
4673
|
this.size = 'regular';
|
|
4652
|
-
this.navigationButtonClassList = new
|
|
4674
|
+
this.navigationButtonClassList = new He([this.navigationButton]);
|
|
4653
4675
|
this.direction = undefined;
|
|
4654
4676
|
this.isInMainMenu = undefined;
|
|
4655
4677
|
this.isItemMore = undefined;
|
|
@@ -4796,7 +4818,7 @@ const MgMenuItem = class {
|
|
|
4796
4818
|
* Emit event when component is updated
|
|
4797
4819
|
*/
|
|
4798
4820
|
componentShouldUpdate() {
|
|
4799
|
-
return
|
|
4821
|
+
return Ge(() => {
|
|
4800
4822
|
this.itemUpdated.emit();
|
|
4801
4823
|
});
|
|
4802
4824
|
}
|
|
@@ -4809,7 +4831,8 @@ const MgMenuItem = class {
|
|
|
4809
4831
|
['mg-c-menu-item__collapse-container']: true,
|
|
4810
4832
|
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
|
|
4811
4833
|
});
|
|
4812
|
-
return (h(Host, { key: '10b41e1b90d01a0f0df082cd9fc50884e87c2e59', role: this.isItemMore ? 'presentation' : 'listitem' }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier()
|
|
4834
|
+
return (h(Host, { key: '10b41e1b90d01a0f0df082cd9fc50884e87c2e59', role: this.isItemMore ? 'presentation' : 'listitem' }, this.displayPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier(), "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
|
|
4835
|
+
}, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
4813
4836
|
this.renderInteractiveElement(),
|
|
4814
4837
|
h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
4815
4838
|
])));
|
|
@@ -4902,13 +4925,13 @@ const MgMessage = class {
|
|
|
4902
4925
|
return 'exclamation-circle';
|
|
4903
4926
|
}
|
|
4904
4927
|
};
|
|
4905
|
-
this.identifier =
|
|
4928
|
+
this.identifier = Ce('mg-message');
|
|
4906
4929
|
this.delay = undefined;
|
|
4907
4930
|
this.variant = variants$1[0];
|
|
4908
4931
|
this.closeButton = false;
|
|
4909
4932
|
this.hide = false;
|
|
4910
4933
|
this.noAriaRole = undefined;
|
|
4911
|
-
this.classCollection = new
|
|
4934
|
+
this.classCollection = new He(['mg-c-message']);
|
|
4912
4935
|
this.hasActions = false;
|
|
4913
4936
|
}
|
|
4914
4937
|
validateDelay(newValue) {
|
|
@@ -5051,12 +5074,12 @@ const MgModal = class {
|
|
|
5051
5074
|
*/
|
|
5052
5075
|
this.setFocus = () => {
|
|
5053
5076
|
// Get all focusable elements
|
|
5054
|
-
const slottedFocusableElements = Array.from(this.element.querySelectorAll(
|
|
5077
|
+
const slottedFocusableElements = Array.from(this.element.querySelectorAll(We));
|
|
5055
5078
|
// If close button is enabled or at least one of the slotted element is focusable
|
|
5056
5079
|
if (this.closeButton || slottedFocusableElements.length > 0) {
|
|
5057
5080
|
// Check if slotted focusable elements have shadowDom with focusable elements
|
|
5058
5081
|
this.modalFocusableElements = slottedFocusableElements.reduce((acc, focusableElement) => {
|
|
5059
|
-
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(
|
|
5082
|
+
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(We) || focusableElement : focusableElement);
|
|
5060
5083
|
return acc;
|
|
5061
5084
|
}, []);
|
|
5062
5085
|
// When close button is enabled it's the first focusable element.
|
|
@@ -5078,21 +5101,21 @@ const MgModal = class {
|
|
|
5078
5101
|
this.handleClose = () => {
|
|
5079
5102
|
this.hide = true;
|
|
5080
5103
|
};
|
|
5081
|
-
this.identifier =
|
|
5104
|
+
this.identifier = Ce('mg-modal');
|
|
5082
5105
|
this.dialogRole = dialogRoles[0];
|
|
5083
5106
|
this.modalTitle = undefined;
|
|
5084
5107
|
this.closeButton = false;
|
|
5085
5108
|
this.hide = undefined;
|
|
5086
5109
|
this.hasActions = false;
|
|
5087
5110
|
this.hasContent = false;
|
|
5088
|
-
this.classCollection = new
|
|
5111
|
+
this.classCollection = new He(['mg-c-modal']);
|
|
5089
5112
|
}
|
|
5090
5113
|
validateDialogRole(newValue) {
|
|
5091
5114
|
if (!dialogRoles.includes(newValue))
|
|
5092
5115
|
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}.`);
|
|
5093
5116
|
}
|
|
5094
5117
|
validateModalTitle(newValue) {
|
|
5095
|
-
if (!
|
|
5118
|
+
if (!Ie(newValue)) {
|
|
5096
5119
|
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
5097
5120
|
}
|
|
5098
5121
|
}
|
|
@@ -5239,7 +5262,7 @@ const MgPagination = class {
|
|
|
5239
5262
|
this.handleGoToPage = (action, disabled) => {
|
|
5240
5263
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
5241
5264
|
};
|
|
5242
|
-
this.identifier =
|
|
5265
|
+
this.identifier = Ce('mg-pagination');
|
|
5243
5266
|
this.label = undefined;
|
|
5244
5267
|
this.hideNavigationLabels = undefined;
|
|
5245
5268
|
this.hidePageCount = undefined;
|
|
@@ -5404,7 +5427,7 @@ const MgPanel = class {
|
|
|
5404
5427
|
];
|
|
5405
5428
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5406
5429
|
};
|
|
5407
|
-
this.identifier =
|
|
5430
|
+
this.identifier = Ce('mg-panel');
|
|
5408
5431
|
this.panelTitle = undefined;
|
|
5409
5432
|
this.titlePattern = undefined;
|
|
5410
5433
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -5413,12 +5436,12 @@ const MgPanel = class {
|
|
|
5413
5436
|
this.expanded = false;
|
|
5414
5437
|
this.expandToggleDisplay = expandToggleDisplays[0];
|
|
5415
5438
|
this.expandToggleDisabled = undefined;
|
|
5416
|
-
this.classCollection = new
|
|
5439
|
+
this.classCollection = new He(['mg-c-panel']);
|
|
5417
5440
|
this.isEditing = false;
|
|
5418
5441
|
this.updatedPanelTitle = undefined;
|
|
5419
5442
|
}
|
|
5420
5443
|
validatePanelTitle(newValue) {
|
|
5421
|
-
if (!
|
|
5444
|
+
if (!Ie(newValue))
|
|
5422
5445
|
throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
5423
5446
|
this.titleChange.emit(newValue);
|
|
5424
5447
|
}
|
|
@@ -7369,7 +7392,7 @@ const MgPopover = class {
|
|
|
7369
7392
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7370
7393
|
}
|
|
7371
7394
|
};
|
|
7372
|
-
this.identifier =
|
|
7395
|
+
this.identifier = Ce('mg-popover');
|
|
7373
7396
|
this.placement = 'bottom';
|
|
7374
7397
|
this.arrowHide = false;
|
|
7375
7398
|
this.closeButton = false;
|
|
@@ -7412,7 +7435,7 @@ const MgPopover = class {
|
|
|
7412
7435
|
*/
|
|
7413
7436
|
componentWillLoad() {
|
|
7414
7437
|
// Get windows to attach events
|
|
7415
|
-
this.windows =
|
|
7438
|
+
this.windows = ze(window);
|
|
7416
7439
|
// render mg-popover-content slot
|
|
7417
7440
|
this.renderPopoverContent();
|
|
7418
7441
|
this.validateCloseButton(this.closeButton);
|
|
@@ -7430,6 +7453,10 @@ const MgPopover = class {
|
|
|
7430
7453
|
// Add aria attributes
|
|
7431
7454
|
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
7432
7455
|
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
7456
|
+
const fallbackPlacements = [];
|
|
7457
|
+
if (this.element.dataset.fallbackPlacement) {
|
|
7458
|
+
fallbackPlacements.push(this.element.dataset.fallbackPlacement);
|
|
7459
|
+
}
|
|
7433
7460
|
// Create popperjs popover
|
|
7434
7461
|
this.popper = createPopper(interactiveElement, this.mgPopover, {
|
|
7435
7462
|
placement: this.placement,
|
|
@@ -7444,7 +7471,7 @@ const MgPopover = class {
|
|
|
7444
7471
|
{
|
|
7445
7472
|
name: 'flip',
|
|
7446
7473
|
options: {
|
|
7447
|
-
fallbackPlacements: ['auto'],
|
|
7474
|
+
fallbackPlacements: [...fallbackPlacements, 'auto'],
|
|
7448
7475
|
},
|
|
7449
7476
|
},
|
|
7450
7477
|
],
|
|
@@ -7474,7 +7501,7 @@ const MgPopover = class {
|
|
|
7474
7501
|
* @returns HTML Element
|
|
7475
7502
|
*/
|
|
7476
7503
|
render() {
|
|
7477
|
-
return (h(Host, { key: '
|
|
7504
|
+
return (h(Host, { key: 'a01aff00a17da32a72491629ba80ec51a34cdb0e' }, h("slot", { key: 'bb314190042b65bf899e34efac1781ce9230930f' }), h("slot", { key: 'daba0b8cb0b1b3b4637bb972da309a9afb73f99e', name: "content" })));
|
|
7478
7505
|
}
|
|
7479
7506
|
get element() { return getElement(this); }
|
|
7480
7507
|
static get watchers() { return {
|
|
@@ -7500,7 +7527,7 @@ const MgPopoverContent = class {
|
|
|
7500
7527
|
this.hideContent.emit();
|
|
7501
7528
|
};
|
|
7502
7529
|
this.closeButton = false;
|
|
7503
|
-
this.classCollection = new
|
|
7530
|
+
this.classCollection = new He(['mg-c-popover-content']);
|
|
7504
7531
|
}
|
|
7505
7532
|
/*************
|
|
7506
7533
|
* Lifecycle *
|
|
@@ -7518,7 +7545,7 @@ const MgPopoverContent = class {
|
|
|
7518
7545
|
componentDidLoad() {
|
|
7519
7546
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7520
7547
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
7521
|
-
if (slottedTitleElement && !
|
|
7548
|
+
if (slottedTitleElement && !Be(slottedTitleElement, headingTags)) {
|
|
7522
7549
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
7523
7550
|
}
|
|
7524
7551
|
}
|
|
@@ -7554,7 +7581,7 @@ const MgSkipLinks = class {
|
|
|
7554
7581
|
this.links = undefined;
|
|
7555
7582
|
}
|
|
7556
7583
|
validateLinks(links) {
|
|
7557
|
-
if (links === undefined || links.length === 0 || links.some(link => !
|
|
7584
|
+
if (links === undefined || links.length === 0 || links.some(link => !Ie(link.href) || !link.href.startsWith('#') || !Ie(link.label))) {
|
|
7558
7585
|
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.`);
|
|
7559
7586
|
}
|
|
7560
7587
|
}
|
|
@@ -7706,7 +7733,7 @@ const MgTabs = class {
|
|
|
7706
7733
|
*/
|
|
7707
7734
|
this.resetFocus = () => {
|
|
7708
7735
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7709
|
-
|
|
7736
|
+
Ge(() => {
|
|
7710
7737
|
this.tabFocus = undefined;
|
|
7711
7738
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7712
7739
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7721,16 +7748,16 @@ const MgTabs = class {
|
|
|
7721
7748
|
if (slots.length !== this.tabs.length)
|
|
7722
7749
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7723
7750
|
};
|
|
7724
|
-
this.identifier =
|
|
7751
|
+
this.identifier = Ce('mg-tabs');
|
|
7725
7752
|
this.label = undefined;
|
|
7726
7753
|
this.size = 'regular';
|
|
7727
7754
|
this.items = undefined;
|
|
7728
7755
|
this.activeTab = undefined;
|
|
7729
7756
|
this.tabs = [];
|
|
7730
|
-
this.classCollection = new
|
|
7757
|
+
this.classCollection = new He(['mg-c-tabs']);
|
|
7731
7758
|
}
|
|
7732
7759
|
validateLabel(newValue) {
|
|
7733
|
-
if (!
|
|
7760
|
+
if (!Ie(newValue)) {
|
|
7734
7761
|
throw new Error('<mg-tabs> prop "label" is required.');
|
|
7735
7762
|
}
|
|
7736
7763
|
}
|
|
@@ -7742,7 +7769,7 @@ const MgTabs = class {
|
|
|
7742
7769
|
}
|
|
7743
7770
|
validateItems(newValue) {
|
|
7744
7771
|
// String array
|
|
7745
|
-
if (
|
|
7772
|
+
if (Pe(newValue))
|
|
7746
7773
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
7747
7774
|
// Object array
|
|
7748
7775
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
@@ -7842,7 +7869,7 @@ const MgTag = class {
|
|
|
7842
7869
|
this.variant = variants[0];
|
|
7843
7870
|
this.outline = undefined;
|
|
7844
7871
|
this.soft = undefined;
|
|
7845
|
-
this.classCollection = new
|
|
7872
|
+
this.classCollection = new He(['mg-c-tag']);
|
|
7846
7873
|
}
|
|
7847
7874
|
validateVariant(newValue, oldValue) {
|
|
7848
7875
|
if (!variants.includes(newValue)) {
|
|
@@ -7879,7 +7906,7 @@ const MgTag = class {
|
|
|
7879
7906
|
* @param textContent - html element textContent property
|
|
7880
7907
|
*/
|
|
7881
7908
|
validateTextContent(textContent) {
|
|
7882
|
-
if (!
|
|
7909
|
+
if (!Ie(textContent))
|
|
7883
7910
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
7884
7911
|
}
|
|
7885
7912
|
/*************
|
|
@@ -7939,10 +7966,10 @@ const MgTooltip = class {
|
|
|
7939
7966
|
// Enable the event listeners
|
|
7940
7967
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7941
7968
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7942
|
-
|
|
7969
|
+
Ge(() => {
|
|
7943
7970
|
this.windows.forEach((localWindow) => {
|
|
7944
|
-
localWindow.addEventListener('click', this.
|
|
7945
|
-
localWindow.addEventListener('keydown', this.
|
|
7971
|
+
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
7972
|
+
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
7946
7973
|
});
|
|
7947
7974
|
});
|
|
7948
7975
|
};
|
|
@@ -7956,15 +7983,15 @@ const MgTooltip = class {
|
|
|
7956
7983
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
7957
7984
|
// Remove event listener
|
|
7958
7985
|
this.windows.forEach((localWindow) => {
|
|
7959
|
-
localWindow.removeEventListener('click', this.
|
|
7960
|
-
localWindow.removeEventListener('keyboard', this.
|
|
7986
|
+
localWindow.removeEventListener('click', this.handleClickOutside, false);
|
|
7987
|
+
localWindow.removeEventListener('keyboard', this.handlePressEscape, false);
|
|
7961
7988
|
});
|
|
7962
7989
|
};
|
|
7963
7990
|
/**
|
|
7964
7991
|
* Check if clicked outside of component and hidde tooltip
|
|
7965
7992
|
* @param event - mouse event
|
|
7966
7993
|
*/
|
|
7967
|
-
this.
|
|
7994
|
+
this.handleClickOutside = (event) => {
|
|
7968
7995
|
if (event.target.closest('mg-tooltip') !== this.element)
|
|
7969
7996
|
this.setDisplay(false);
|
|
7970
7997
|
};
|
|
@@ -7972,7 +7999,7 @@ const MgTooltip = class {
|
|
|
7972
7999
|
* Check if 'Escape' key is pressed of component and hidde tooltip
|
|
7973
8000
|
* @param event - keyboard event
|
|
7974
8001
|
*/
|
|
7975
|
-
this.
|
|
8002
|
+
this.handlePressEscape = (event) => {
|
|
7976
8003
|
if (event.code === 'Escape') {
|
|
7977
8004
|
this.setDisplay(false);
|
|
7978
8005
|
this.resetGuard();
|
|
@@ -7990,23 +8017,25 @@ const MgTooltip = class {
|
|
|
7990
8017
|
/**
|
|
7991
8018
|
* Action for tooltip element and tooltiped element mouse listener
|
|
7992
8019
|
* @param elementGuard - tooltip element guard
|
|
7993
|
-
* @param
|
|
8020
|
+
* @param eventName - event name
|
|
7994
8021
|
* @param conditionalGuard - guard condition
|
|
7995
8022
|
*/
|
|
7996
|
-
this.tooltipMouseListenerAction = (elementGuard,
|
|
7997
|
-
//
|
|
7998
|
-
if (
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8023
|
+
this.tooltipMouseListenerAction = (elementGuard, eventName, conditionalGuard) => {
|
|
8024
|
+
// active FOCUS guard cancel process
|
|
8025
|
+
if ([Guard.FOCUS, Guard.DISABLE_ON_CLICK].includes(this.guard)) {
|
|
8026
|
+
return;
|
|
8027
|
+
}
|
|
8028
|
+
// Update guard by element guard
|
|
8029
|
+
this.guard = elementGuard;
|
|
8030
|
+
if (eventName !== 'mouseenter') {
|
|
8031
|
+
// process action in the next event loop macro task
|
|
8032
|
+
setTimeout(() => {
|
|
8033
|
+
this.setDisplay(false, this.guard !== conditionalGuard);
|
|
8034
|
+
this.resetGuard();
|
|
8035
|
+
}, 100);
|
|
8036
|
+
}
|
|
8037
|
+
else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {
|
|
8038
|
+
this.setDisplay(true);
|
|
8010
8039
|
}
|
|
8011
8040
|
};
|
|
8012
8041
|
/**
|
|
@@ -8033,27 +8062,9 @@ const MgTooltip = class {
|
|
|
8033
8062
|
}
|
|
8034
8063
|
};
|
|
8035
8064
|
/**
|
|
8036
|
-
*
|
|
8037
|
-
* @param slotElement - slotted element
|
|
8038
|
-
* @param interactiveElement - interactive element
|
|
8065
|
+
* Set popper instance
|
|
8039
8066
|
*/
|
|
8040
|
-
this.
|
|
8041
|
-
// Add tabindex to slotted element if we can't find any interactive element
|
|
8042
|
-
if (!this.disabled && !interactiveElement) {
|
|
8043
|
-
this.hasCustomTabIndex = true;
|
|
8044
|
-
slotElement.tabIndex = 0;
|
|
8045
|
-
// Add role on non-interactive element to work with "aria-describedby" for screen readers
|
|
8046
|
-
slotElement.setAttribute('role', 'button');
|
|
8047
|
-
}
|
|
8048
|
-
// Set aria-describedby
|
|
8049
|
-
const ariaDescribedby = slotElement.getAttribute('aria-describedby');
|
|
8050
|
-
if (ariaDescribedby === null) {
|
|
8051
|
-
this.tooltipedElement.setAttribute('aria-describedby', this.identifier);
|
|
8052
|
-
}
|
|
8053
|
-
else {
|
|
8054
|
-
// We ensure to have uniq ids
|
|
8055
|
-
slotElement.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);
|
|
8056
|
-
}
|
|
8067
|
+
this.setPopper = () => {
|
|
8057
8068
|
// use element data attribute: `data-popper-strategy`, in order to get popper strategy configuration
|
|
8058
8069
|
const strategy = (this.element.dataset.popperStrategy || 'fixed');
|
|
8059
8070
|
// Create popperjs tooltip
|
|
@@ -8075,13 +8086,14 @@ const MgTooltip = class {
|
|
|
8075
8086
|
},
|
|
8076
8087
|
],
|
|
8077
8088
|
});
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8089
|
+
};
|
|
8090
|
+
/**
|
|
8091
|
+
* Define selected element to become tooltip selector and init listeners
|
|
8092
|
+
* @param element - tooltiped element
|
|
8093
|
+
*/
|
|
8094
|
+
this.setTooltipedElement = (element) => {
|
|
8095
|
+
this.tooltipedElement = element;
|
|
8096
|
+
// Manage tooltipedElement focus events
|
|
8085
8097
|
this.tooltipedElement.addEventListener('focus', () => {
|
|
8086
8098
|
this.guard = Guard.FOCUS;
|
|
8087
8099
|
this.setDisplay(true);
|
|
@@ -8096,37 +8108,71 @@ const MgTooltip = class {
|
|
|
8096
8108
|
this.resetGuard();
|
|
8097
8109
|
this.setDisplay(false);
|
|
8098
8110
|
});
|
|
8099
|
-
document.addEventListener('keydown', this.pressEscape);
|
|
8100
8111
|
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
].forEach(({ element, action }) => {
|
|
8107
|
-
element.addEventListener(eventType, () => {
|
|
8108
|
-
action();
|
|
8109
|
-
});
|
|
8110
|
-
});
|
|
8112
|
+
this.tooltipedElement.addEventListener('mouseenter', () => {
|
|
8113
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIP_ELEMENT);
|
|
8114
|
+
});
|
|
8115
|
+
this.tooltipedElement.addEventListener('mouseleave', () => {
|
|
8116
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIP_ELEMENT);
|
|
8111
8117
|
});
|
|
8112
8118
|
};
|
|
8113
|
-
|
|
8119
|
+
/**
|
|
8120
|
+
* Set button mutation observer
|
|
8121
|
+
* @param mgButton - mg-button to observe
|
|
8122
|
+
*/
|
|
8123
|
+
this.setMgButtonMutationObserver = (mgButton) => {
|
|
8124
|
+
new MutationObserver(mutationList => {
|
|
8125
|
+
// stop process when none of mutations attributed is disabled
|
|
8126
|
+
if (!mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName)))
|
|
8127
|
+
return;
|
|
8128
|
+
// set guard when one of mutations is for a disabled with disabled-on-click
|
|
8129
|
+
if (mutationList.some((mutation) => mutation.target.disabled && mutation.target.disableOnClick)) {
|
|
8130
|
+
this.guard = Guard.DISABLE_ON_CLICK;
|
|
8131
|
+
}
|
|
8132
|
+
// when the disabled-on-click guard is running we stop process
|
|
8133
|
+
if (this.guard === Guard.DISABLE_ON_CLICK)
|
|
8134
|
+
return;
|
|
8135
|
+
// update button wrapper
|
|
8136
|
+
this.setMgButtonWrapper(mgButton);
|
|
8137
|
+
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
8138
|
+
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
8139
|
+
this.resetGuard();
|
|
8140
|
+
// update popper instance
|
|
8141
|
+
this.popper.update();
|
|
8142
|
+
}).observe(mgButton, { attributes: true });
|
|
8143
|
+
};
|
|
8144
|
+
/**
|
|
8145
|
+
* Set tooltiped element aria-describedby
|
|
8146
|
+
* @param element - element to update
|
|
8147
|
+
*/
|
|
8148
|
+
this.setAriaDescribedby = (element) => {
|
|
8149
|
+
// Set aria-describedby
|
|
8150
|
+
const ariaDescribedby = element.getAttribute('aria-describedby');
|
|
8151
|
+
if (ariaDescribedby === null) {
|
|
8152
|
+
this.tooltipedElement.setAttribute('aria-describedby', this.identifier);
|
|
8153
|
+
}
|
|
8154
|
+
else {
|
|
8155
|
+
// We ensure to have uniq ids
|
|
8156
|
+
element.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);
|
|
8157
|
+
}
|
|
8158
|
+
};
|
|
8159
|
+
this.identifier = Ce('mg-tooltip');
|
|
8114
8160
|
this.message = undefined;
|
|
8115
8161
|
this.placement = 'bottom';
|
|
8116
8162
|
this.display = false;
|
|
8117
8163
|
this.disabled = false;
|
|
8118
8164
|
}
|
|
8119
|
-
|
|
8165
|
+
watchIdentifier() {
|
|
8120
8166
|
// use renderTooltipContent to update tooltip-content id
|
|
8121
8167
|
this.renderTooltipContent();
|
|
8122
8168
|
}
|
|
8123
|
-
|
|
8124
|
-
if (!
|
|
8169
|
+
watchMessage(newValue) {
|
|
8170
|
+
if (!Ie(newValue)) {
|
|
8125
8171
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
8126
8172
|
}
|
|
8127
8173
|
this.mgTooltipContent.message = newValue;
|
|
8128
8174
|
}
|
|
8129
|
-
|
|
8175
|
+
watchDisplay(newValue) {
|
|
8130
8176
|
if (newValue) {
|
|
8131
8177
|
this.show();
|
|
8132
8178
|
}
|
|
@@ -8134,7 +8180,7 @@ const MgTooltip = class {
|
|
|
8134
8180
|
this.hide();
|
|
8135
8181
|
}
|
|
8136
8182
|
}
|
|
8137
|
-
|
|
8183
|
+
watchDisabled(newValue) {
|
|
8138
8184
|
if (this.hasCustomTabIndex) {
|
|
8139
8185
|
if (newValue)
|
|
8140
8186
|
this.tooltipedElement.removeAttribute('tabindex');
|
|
@@ -8143,23 +8189,29 @@ const MgTooltip = class {
|
|
|
8143
8189
|
}
|
|
8144
8190
|
}
|
|
8145
8191
|
/**
|
|
8146
|
-
* Render tooltip content element
|
|
8192
|
+
* Render tooltip content element and init listeners
|
|
8147
8193
|
*/
|
|
8148
8194
|
renderTooltipContent() {
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
mgTooltipContent.
|
|
8195
|
+
if (this.mgTooltipContent) {
|
|
8196
|
+
this.mgTooltipContent.setAttribute('id', this.identifier);
|
|
8197
|
+
}
|
|
8198
|
+
else {
|
|
8199
|
+
this.mgTooltipContent = document.createElement('mg-tooltip-content');
|
|
8200
|
+
this.mgTooltipContent.setAttribute('slot', 'content');
|
|
8201
|
+
this.mgTooltipContent.setAttribute('id', this.identifier);
|
|
8154
8202
|
const arrow = document.createElement('div');
|
|
8155
8203
|
arrow.setAttribute('slot', 'arrow');
|
|
8156
8204
|
arrow.dataset.popperArrow = '';
|
|
8157
|
-
mgTooltipContent.appendChild(arrow);
|
|
8205
|
+
this.mgTooltipContent.appendChild(arrow);
|
|
8206
|
+
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
8207
|
+
this.mgTooltipContent.addEventListener('mouseenter', () => {
|
|
8208
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseenter', Guard.HOVER_TOOLTIPED_ELEMENT);
|
|
8209
|
+
});
|
|
8210
|
+
this.mgTooltipContent.addEventListener('mouseleave', () => {
|
|
8211
|
+
this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, 'mouseleave', Guard.HOVER_TOOLTIPED_ELEMENT);
|
|
8212
|
+
});
|
|
8158
8213
|
// append tooltip element to component
|
|
8159
|
-
this.element.appendChild(mgTooltipContent);
|
|
8160
|
-
}
|
|
8161
|
-
else {
|
|
8162
|
-
mgTooltipContent.setAttribute('id', this.identifier);
|
|
8214
|
+
this.element.appendChild(this.mgTooltipContent);
|
|
8163
8215
|
}
|
|
8164
8216
|
}
|
|
8165
8217
|
/*************
|
|
@@ -8170,14 +8222,13 @@ const MgTooltip = class {
|
|
|
8170
8222
|
*/
|
|
8171
8223
|
componentWillLoad() {
|
|
8172
8224
|
// Get windows to attach events
|
|
8173
|
-
this.windows =
|
|
8225
|
+
this.windows = ze(window);
|
|
8174
8226
|
// Get tooltip element
|
|
8175
8227
|
this.renderTooltipContent();
|
|
8176
|
-
this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);
|
|
8177
8228
|
//validate properties
|
|
8178
|
-
this.
|
|
8179
|
-
this.
|
|
8180
|
-
this.
|
|
8229
|
+
this.watchDisabled(this.disabled);
|
|
8230
|
+
this.watchMessage(this.message);
|
|
8231
|
+
this.watchIdentifier();
|
|
8181
8232
|
}
|
|
8182
8233
|
/**
|
|
8183
8234
|
* Get slotted element
|
|
@@ -8189,26 +8240,29 @@ const MgTooltip = class {
|
|
|
8189
8240
|
// get slotted element wich is not the tooltip
|
|
8190
8241
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
8191
8242
|
// Get interactive element
|
|
8192
|
-
const interactiveElement = slotElement.matches(
|
|
8193
|
-
|
|
8194
|
-
this.tooltipedElement = interactiveElement || slotElement;
|
|
8243
|
+
const interactiveElement = slotElement.matches(We) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(We);
|
|
8244
|
+
this.setTooltipedElement(interactiveElement || slotElement);
|
|
8195
8245
|
// Check if slotted element is a disabled mg-button
|
|
8196
8246
|
// In this case we wrap the mg-button into a div to enable the tooltip
|
|
8197
8247
|
if (isButton(slotElement)) {
|
|
8198
|
-
|
|
8199
|
-
if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName)) && this.guard !== Guard.DISABLE_ON_CLICK) {
|
|
8200
|
-
this.setMgButtonWrapper(slotElement);
|
|
8201
|
-
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
8202
|
-
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
8203
|
-
this.resetGuard();
|
|
8204
|
-
this.initTooltip(slotElement, interactiveElement);
|
|
8205
|
-
}
|
|
8206
|
-
}).observe(slotElement, { attributes: true });
|
|
8248
|
+
this.setMgButtonMutationObserver(slotElement);
|
|
8207
8249
|
this.setMgButtonWrapper(slotElement);
|
|
8208
8250
|
}
|
|
8209
|
-
//
|
|
8210
|
-
this.
|
|
8211
|
-
|
|
8251
|
+
// Add tabindex to slotted element if we can't find any interactive element
|
|
8252
|
+
if (!this.disabled && !interactiveElement) {
|
|
8253
|
+
this.hasCustomTabIndex = true;
|
|
8254
|
+
slotElement.tabIndex = 0;
|
|
8255
|
+
// Add role on non-interactive element to work with "aria-describedby" for screen readers
|
|
8256
|
+
slotElement.setAttribute('role', 'button');
|
|
8257
|
+
}
|
|
8258
|
+
// apply a11y aria
|
|
8259
|
+
this.setAriaDescribedby(slotElement);
|
|
8260
|
+
// set Tooltip
|
|
8261
|
+
this.setPopper();
|
|
8262
|
+
// add document keyboard handler
|
|
8263
|
+
document.addEventListener('keydown', this.handlePressEscape);
|
|
8264
|
+
// check props
|
|
8265
|
+
this.watchDisplay(this.display);
|
|
8212
8266
|
}
|
|
8213
8267
|
/**
|
|
8214
8268
|
* update popper position after props change on component did update hook to benefit from render ended
|
|
@@ -8221,14 +8275,14 @@ const MgTooltip = class {
|
|
|
8221
8275
|
* @returns HTML Element
|
|
8222
8276
|
*/
|
|
8223
8277
|
render() {
|
|
8224
|
-
return (h(Host, { key: '
|
|
8278
|
+
return (h(Host, { key: '9d7c428ba22f6b8e41ad1b62837d7b369e38314d' }, h("slot", { key: 'f5bdcac81a64674dd57e88e1c00b540dd49310f6' }), h("slot", { key: '8d40b6f4f1d3f385dcdf582509f89b3ec0dbd676', name: "content" })));
|
|
8225
8279
|
}
|
|
8226
8280
|
get element() { return getElement(this); }
|
|
8227
8281
|
static get watchers() { return {
|
|
8228
|
-
"identifier": ["
|
|
8229
|
-
"message": ["
|
|
8230
|
-
"display": ["
|
|
8231
|
-
"disabled": ["
|
|
8282
|
+
"identifier": ["watchIdentifier"],
|
|
8283
|
+
"message": ["watchMessage"],
|
|
8284
|
+
"display": ["watchDisplay"],
|
|
8285
|
+
"disabled": ["watchDisabled"]
|
|
8232
8286
|
}; }
|
|
8233
8287
|
};
|
|
8234
8288
|
MgTooltip.style = MgTooltipStyle0;
|