@mgdis/mg-components 5.27.0 → 5.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-1d560837.js → index-4b43c17b.js} +23 -23
- package/dist/cjs/index-4b43c17b.js.map +1 -0
- package/dist/cjs/{index-7072369e.js → index-83102ab3.js} +9 -8
- package/dist/cjs/index-83102ab3.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{mg-action-more_35.cjs.entry.js → mg-action-more_36.cjs.entry.js} +414 -80
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -0
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js +4 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +4 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js.map +1 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +4 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js.map +1 -1
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +4 -1
- package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +4 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +1 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +13 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +7 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +42 -11
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +6 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +12 -3
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +5 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +24 -22
- 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 +34 -3
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +5 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +5 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +8 -3
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +9 -3
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +5 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js.map +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +6 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +5 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +4 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +5 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +4 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
- package/dist/components/index.es.js +22 -22
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/mg-action-more.js +15 -11
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-button2.js +1 -1
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-card2.js.map +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-illustrated-message.js +3 -3
- package/dist/components/mg-illustrated-message.js.map +1 -1
- package/dist/components/mg-input-date.js +42 -11
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +3 -3
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-text2.js +9 -3
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-title2.js +1 -1
- package/dist/components/mg-input-title2.js.map +1 -1
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-input2.js +1 -1
- package/dist/components/mg-input2.js.map +1 -1
- package/dist/components/mg-item-more.js +1 -339
- package/dist/components/mg-item-more.js.map +1 -1
- package/dist/components/mg-item-more2.js +592 -0
- package/dist/components/mg-item-more2.js.map +1 -0
- package/dist/components/mg-menu-item2.js +27 -5
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-menu.js +1 -1
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-message.js.map +1 -1
- package/dist/components/mg-modal.js +2 -2
- package/dist/components/mg-modal.js.map +1 -1
- package/dist/components/mg-panel.js +1 -1
- package/dist/components/mg-panel.js.map +1 -1
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover2.js +1 -1
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-tabs.js +1 -1
- package/dist/components/mg-tabs.js.map +1 -1
- package/dist/components/mg-tag.js +1 -1
- package/dist/components/mg-tag.js.map +1 -1
- package/dist/components/mg-tooltip-content2.js +1 -1
- package/dist/components/mg-tooltip-content2.js.map +1 -1
- package/dist/components/mg-tooltip2.js +10 -3
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/{index-445fc2a0.js → index-c4ed16b2.js} +23 -23
- package/dist/esm/index-c4ed16b2.js.map +1 -0
- package/dist/esm/{index-629a42c7.js → index-d43d1c5d.js} +9 -8
- package/dist/esm/index-d43d1c5d.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-action-more_35.entry.js → mg-action-more_36.entry.js} +401 -68
- package/dist/esm/mg-action-more_36.entry.js.map +1 -0
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +2 -2
- 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-350454b9.js +2 -0
- package/dist/mg-components/p-350454b9.js.map +1 -0
- package/dist/mg-components/p-9cdd1bc9.entry.js +2 -0
- package/dist/mg-components/p-9cdd1bc9.entry.js.map +1 -0
- package/dist/mg-components/p-cf0b0988.js +3 -0
- package/dist/mg-components/p-cf0b0988.js.map +1 -0
- package/dist/mg-components/{p-fe347f48.entry.js → p-d4084a15.entry.js} +2 -2
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +3 -0
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +3 -0
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +3 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.d.ts +3 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +2 -1
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +6 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +11 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +3 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +3 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +15 -0
- package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +3 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +4 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +3 -0
- package/dist/types/components.d.ts +5 -0
- package/ide/intellij/web-types.json +20 -81
- package/ide/vscode/html-custom-data.json +14 -74
- package/package.json +23 -23
- package/dist/cjs/index-1d560837.js.map +0 -1
- package/dist/cjs/index-7072369e.js.map +0 -1
- package/dist/cjs/mg-action-more_35.cjs.entry.js.map +0 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +0 -273
- package/dist/cjs/mg-item-more.cjs.entry.js.map +0 -1
- package/dist/cjs/mg-menu.conf-c291eee6.js +0 -18
- package/dist/cjs/mg-menu.conf-c291eee6.js.map +0 -1
- package/dist/components/mg-menu.conf.js +0 -16
- package/dist/components/mg-menu.conf.js.map +0 -1
- package/dist/components/mg-menu2.js +0 -202
- package/dist/components/mg-menu2.js.map +0 -1
- package/dist/esm/index-445fc2a0.js.map +0 -1
- package/dist/esm/index-629a42c7.js.map +0 -1
- package/dist/esm/mg-action-more_35.entry.js.map +0 -1
- package/dist/esm/mg-item-more.entry.js +0 -269
- package/dist/esm/mg-item-more.entry.js.map +0 -1
- package/dist/esm/mg-menu.conf-9609bcb2.js +0 -16
- package/dist/esm/mg-menu.conf-9609bcb2.js.map +0 -1
- package/dist/mg-components/p-3ebe6845.js +0 -2
- package/dist/mg-components/p-3ebe6845.js.map +0 -1
- package/dist/mg-components/p-6735e4b2.entry.js +0 -2
- package/dist/mg-components/p-6735e4b2.entry.js.map +0 -1
- package/dist/mg-components/p-9dfaa41f.js +0 -3
- package/dist/mg-components/p-9dfaa41f.js.map +0 -1
- package/dist/mg-components/p-b3e0f7b3.entry.js +0 -2
- package/dist/mg-components/p-b3e0f7b3.entry.js.map +0 -1
- package/dist/mg-components/p-fe935e54.js +0 -2
- package/dist/mg-components/p-fe935e54.js.map +0 -1
- /package/dist/mg-components/{p-fe347f48.entry.js.map → p-d4084a15.entry.js.map} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-
|
|
2
|
-
import { R as Re, i as initLocales, M as Me, B as Be, U as Ue, F as Fe, N as Ne, g as ge, W as We, P as Pe,
|
|
3
|
-
import { D as Direction, s as sizes$2 } from './mg-menu.conf-9609bcb2.js';
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-d43d1c5d.js';
|
|
2
|
+
import { R as Re, i as initLocales, M as Me, B as Be, U as Ue, F as Fe, N as Ne, d as de, g as ge, W as We, P as Pe, z as ze, q as qe, O as Oe, D as De, _ as _e } from './index-c4ed16b2.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Available menu-item positions
|
|
@@ -25,6 +24,19 @@ var Status$1;
|
|
|
25
24
|
*/
|
|
26
25
|
const targets = ['_blank', '_self', '_parent', '_top'];
|
|
27
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Menu direction type
|
|
29
|
+
*/
|
|
30
|
+
var Direction;
|
|
31
|
+
(function (Direction) {
|
|
32
|
+
Direction["VERTICAL"] = "vertical";
|
|
33
|
+
Direction["HORIZONTAL"] = "horizontal";
|
|
34
|
+
})(Direction || (Direction = {}));
|
|
35
|
+
/**
|
|
36
|
+
* List of all possibles sizes
|
|
37
|
+
*/
|
|
38
|
+
const sizes$2 = ['regular', 'medium', 'large'];
|
|
39
|
+
|
|
28
40
|
const mgActionMoreCss = ".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}}:host{--mg-popover-padding-vertical:1rem;--mg-popover-padding-horizontal:0;--mg-popover-max-width:unset}.mg-c-action-more__chevron{transition:200ms}.mg-c-action-more__chevron--rotate.mg-c-action-more__chevron{transform:rotate(180deg)}";
|
|
29
41
|
const MgActionMoreStyle0 = mgActionMoreCss;
|
|
30
42
|
|
|
@@ -394,7 +406,7 @@ const MgButton = class {
|
|
|
394
406
|
*/
|
|
395
407
|
render() {
|
|
396
408
|
var _a;
|
|
397
|
-
return (h(Host, { key: '
|
|
409
|
+
return (h(Host, { key: '8aa45a51510eccbb021e452d540c77844f3f4792', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: '9743ead1b9fd1f70ef0690087806a1767c5825b0', class: this.classCollection.join(), id: this.identifier }, this.loading && h("mg-icon", { icon: "loader", spin: true }), h("div", { key: '7070995c17ecedb4223475cce662e115e8d72510', class: "mg-c-button__content" }, h("slot", { key: 'cb0ad8aa02d634f0a3dfa9b584ec8fb26da88271' })))));
|
|
398
410
|
}
|
|
399
411
|
get element() { return getElement(this); }
|
|
400
412
|
static get watchers() { return {
|
|
@@ -474,7 +486,7 @@ const MgCard = class {
|
|
|
474
486
|
*/
|
|
475
487
|
render() {
|
|
476
488
|
var _a;
|
|
477
|
-
return (h("div", { key: '
|
|
489
|
+
return (h("div", { key: '9e604fe7b06f19797c6841b1902b56684a4bdc69', class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-c-card__bar" }), h("slot", { key: '44d9092aaa6bbdf0b20a1fffe0edad15150cd8cb' })));
|
|
478
490
|
}
|
|
479
491
|
static get watchers() { return {
|
|
480
492
|
"variant": ["validateVariant"],
|
|
@@ -563,7 +575,7 @@ const MgDetails = class {
|
|
|
563
575
|
* @returns HTML Element
|
|
564
576
|
*/
|
|
565
577
|
render() {
|
|
566
|
-
return (h("details", { key: '
|
|
578
|
+
return (h("details", { key: '28d18aa44daec76231b80e2f8c48b475bb318d10', class: "mg-c-details", onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: 'a998fadad2ee592b632ab19c0fe69f142211156a' }, h("slot", { key: '7e5b636e9ed6f05904ed13c06cff14a5353de74b', name: "summary" }), h("span", { key: '770f0cfd6f70127a61f6ffab1c30e4d8d83c70bb', class: "mg-c-details__toggle" }, h("mg-icon", { key: '2f996b8793388b6606706459352a9b540e45f120', icon: "chevron-up", size: "small", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: '1d0dc92242080d172d226bf013ae56ffe6e4a717', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: 'd6b973893a807d2ef94a7c3d131e3ca0c9a675e3', class: "mg-c-details__details" }, h("slot", { key: 'ae1928a7aad8d986f44cb36e02648680dea074a4', name: "details" }))));
|
|
567
579
|
}
|
|
568
580
|
static get watchers() { return {
|
|
569
581
|
"toggleClosed": ["validateTitles"],
|
|
@@ -790,7 +802,7 @@ const MgForm = class {
|
|
|
790
802
|
* @returns HTML Element
|
|
791
803
|
*/
|
|
792
804
|
render() {
|
|
793
|
-
return (h("form", { key: '
|
|
805
|
+
return (h("form", { key: 'cfcf6da7026b3e3703903090773ecf69e57034cc', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { innerHTML: this.requiredMessageText }), h("slot", { key: '2f0c489e6ce31580cbb66f144749f5c3e2ad18eb' }), !this.readonly && !this.disabled && h("slot", { name: "actions" })));
|
|
794
806
|
}
|
|
795
807
|
get element() { return getElement(this); }
|
|
796
808
|
static get watchers() { return {
|
|
@@ -961,13 +973,13 @@ const MgIllustratedMessage = class {
|
|
|
961
973
|
* @returns HTML Element
|
|
962
974
|
*/
|
|
963
975
|
render() {
|
|
964
|
-
return (h("div", { key: '
|
|
976
|
+
return (h("div", { key: '566da859acf529d2389b892db469a2293f85c67e', class: {
|
|
965
977
|
'mg-c-illustrated-message': true,
|
|
966
978
|
'mg-c-illustrated-message--horizontal': this.direction === 'horizontal',
|
|
967
|
-
} }, h("div", { key: '
|
|
979
|
+
} }, h("div", { key: '7d2d44156ae0c8c0ac2364e6f1fc7c41242f7d6c', class: {
|
|
968
980
|
'mg-c-illustrated-message__illustration': true,
|
|
969
981
|
'mg-c-illustrated-message__illustration--small': this.size === 'small',
|
|
970
|
-
} }, h("slot", { key: '
|
|
982
|
+
} }, h("slot", { key: '3a477be62f6866dece99be8882f89dcd2a620c5e', name: "illustration" })), h("div", { key: 'd6d8950d4bb5b8c6cafe1c148978bed1291f5768', class: "mg-c-illustrated-message__slots" }, h("div", { key: '47d0406a0d5eb2ea2388472defdc44411ba2977d', class: "mg-c-illustrated-message__title" }, h("slot", { key: '8126236dfce191b268f84f45183cc8304019c129', name: "title" })), h("div", { key: '64641dadca2ed82f3ad4b24d677ee01cc002dabf', class: "mg-c-illustrated-message__details" }, h("slot", { key: '65b61b0c16c9dde9cd2eab062b97fe189f53e5a2', name: "details" })))));
|
|
971
983
|
}
|
|
972
984
|
get element() { return getElement(this); }
|
|
973
985
|
};
|
|
@@ -1227,7 +1239,7 @@ const MgInput = class {
|
|
|
1227
1239
|
render() {
|
|
1228
1240
|
const readonlyValue = this.getReadonlyValues();
|
|
1229
1241
|
const isGroup = this.isFieldset && !this.isReadonly;
|
|
1230
|
-
return (h(Host, { key: '
|
|
1242
|
+
return (h(Host, { key: '5eedfac460913f23f71a3fbba43af958afc63e0d', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: '9335584ba10e2bc199accb9b4200b45252c848a9', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: '7c5de08476008bfe6cbcfa07706cee30f16bc059', name: this.slotLabel }), this.tooltip && !this.isReadonly && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: '5cf88a0ea68aaf2d8f1c96c4593ef6ea0133beb6', class: "mg-c-input__input-container" }, this.isReadonly
|
|
1231
1243
|
? [
|
|
1232
1244
|
Array.isArray(readonlyValue) ? (h("ul", { key: "readonly-value-list" }, readonlyValue.map(value => (h("li", { key: value }, h("strong", null, value)))))) : (h("strong", { key: "readonly-value" }, readonlyValue)),
|
|
1233
1245
|
h("slot", { key: "default-slot" }),
|
|
@@ -1856,6 +1868,7 @@ var InputError$1;
|
|
|
1856
1868
|
InputError["MAX"] = "max";
|
|
1857
1869
|
InputError["MINMAX"] = "minMax";
|
|
1858
1870
|
InputError["REQUIRED"] = "required";
|
|
1871
|
+
InputError["PATTERN"] = "badInput";
|
|
1859
1872
|
})(InputError$1 || (InputError$1 = {}));
|
|
1860
1873
|
|
|
1861
1874
|
const mgInputDateCss = ".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-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.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}}";
|
|
@@ -1868,6 +1881,12 @@ const MgInputDate = class {
|
|
|
1868
1881
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
1869
1882
|
// hasDisplayedError (triggered by blur event)
|
|
1870
1883
|
this.hasDisplayedError = false;
|
|
1884
|
+
/**
|
|
1885
|
+
* Method to validate date pattern string
|
|
1886
|
+
* @param value - value to test
|
|
1887
|
+
* @returns truthy when value match the pattern
|
|
1888
|
+
*/
|
|
1889
|
+
this.isValidPattern = (value) => Be(value) && de.test(value);
|
|
1871
1890
|
/**
|
|
1872
1891
|
* Format help text to display
|
|
1873
1892
|
* @param helpText - help text format
|
|
@@ -1900,32 +1919,52 @@ const MgInputDate = class {
|
|
|
1900
1919
|
this.handlerInProgress = undefined;
|
|
1901
1920
|
});
|
|
1902
1921
|
};
|
|
1922
|
+
/**
|
|
1923
|
+
* Handle keydown event
|
|
1924
|
+
* @param event - input keydown event
|
|
1925
|
+
*/
|
|
1926
|
+
this.handleKeyDown = (event) => {
|
|
1927
|
+
// bypass the native "Delete" action wich trigger an "input" event with "checkValidty() => false" with a falsy badInput = true,
|
|
1928
|
+
// when we reset the field we need to test a blank value.
|
|
1929
|
+
if (['Delete', 'Backspace'].includes(event.key)) {
|
|
1930
|
+
event.preventDefault();
|
|
1931
|
+
this.value = '';
|
|
1932
|
+
this.checkValidity();
|
|
1933
|
+
if (this.hasDisplayedError) {
|
|
1934
|
+
this.setErrorMessage();
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1903
1938
|
/**
|
|
1904
1939
|
* Check if input is valid
|
|
1905
1940
|
*/
|
|
1906
1941
|
this.checkValidity = () => {
|
|
1907
|
-
this.setValidity(this.readonly || this.disabled || this.input.checkValidity());
|
|
1942
|
+
this.setValidity(this.readonly || this.disabled || (this.input.checkValidity() && (!this.value || this.isValidPattern(this.value))));
|
|
1908
1943
|
};
|
|
1909
1944
|
/**
|
|
1910
1945
|
* get input error code
|
|
1911
1946
|
* @returns error code
|
|
1912
1947
|
*/
|
|
1913
1948
|
this.getInputError = () => {
|
|
1914
|
-
var _a
|
|
1949
|
+
var _a;
|
|
1915
1950
|
let inputError = null;
|
|
1916
1951
|
// required
|
|
1917
1952
|
if (this.input.validity.valueMissing) {
|
|
1918
1953
|
inputError = InputError$1.REQUIRED;
|
|
1919
1954
|
}
|
|
1955
|
+
// pattern
|
|
1956
|
+
else if (this.value && !this.isValidPattern(this.value)) {
|
|
1957
|
+
inputError = InputError$1.PATTERN;
|
|
1958
|
+
}
|
|
1920
1959
|
// min & max
|
|
1921
|
-
else if ((this.input.validity.rangeUnderflow || this.input.validity.rangeOverflow) && ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
1960
|
+
else if ((this.input.validity.rangeUnderflow || this.input.validity.rangeOverflow) && ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.max !== '9999-12-31') {
|
|
1922
1961
|
inputError = InputError$1.MINMAX;
|
|
1923
1962
|
}
|
|
1924
1963
|
// min
|
|
1925
1964
|
else if (this.input.validity.rangeUnderflow) {
|
|
1926
1965
|
inputError = InputError$1.MIN;
|
|
1927
1966
|
}
|
|
1928
|
-
//max
|
|
1967
|
+
// max
|
|
1929
1968
|
else if (this.input.validity.rangeOverflow) {
|
|
1930
1969
|
inputError = InputError$1.MAX;
|
|
1931
1970
|
}
|
|
@@ -1980,7 +2019,7 @@ const MgInputDate = class {
|
|
|
1980
2019
|
this.required = false;
|
|
1981
2020
|
this.readonly = false;
|
|
1982
2021
|
this.min = undefined;
|
|
1983
|
-
this.max =
|
|
2022
|
+
this.max = '9999-12-31';
|
|
1984
2023
|
this.disabled = false;
|
|
1985
2024
|
this.tooltip = undefined;
|
|
1986
2025
|
this.tooltipPosition = 'input';
|
|
@@ -1994,12 +2033,16 @@ const MgInputDate = class {
|
|
|
1994
2033
|
// When the input is not fully completed or has been cleared, the value becomes an empty string.
|
|
1995
2034
|
if (newValue === '')
|
|
1996
2035
|
newValue = null;
|
|
1997
|
-
|
|
1998
|
-
|
|
2036
|
+
// check value validity
|
|
2037
|
+
if (newValue && !Be(newValue)) {
|
|
2038
|
+
throw new Error("<mg-input-date> props 'value' must be a valid string");
|
|
1999
2039
|
}
|
|
2000
|
-
else {
|
|
2040
|
+
else if (!newValue || (newValue && this.isValidPattern(newValue))) {
|
|
2001
2041
|
this.valueChange.emit(newValue);
|
|
2002
2042
|
}
|
|
2043
|
+
else {
|
|
2044
|
+
console.error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
2045
|
+
}
|
|
2003
2046
|
}
|
|
2004
2047
|
watchReadonly(newValue) {
|
|
2005
2048
|
if (newValue)
|
|
@@ -2008,7 +2051,7 @@ const MgInputDate = class {
|
|
|
2008
2051
|
this.classCollection.delete(classReadonly);
|
|
2009
2052
|
}
|
|
2010
2053
|
validateMinMax(newValue) {
|
|
2011
|
-
if (
|
|
2054
|
+
if (newValue && !this.isValidPattern(newValue)) {
|
|
2012
2055
|
throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
|
|
2013
2056
|
}
|
|
2014
2057
|
}
|
|
@@ -2102,7 +2145,7 @@ const MgInputDate = class {
|
|
|
2102
2145
|
* @returns HTML Element
|
|
2103
2146
|
*/
|
|
2104
2147
|
render() {
|
|
2105
|
-
return (h("mg-input", { key: '
|
|
2148
|
+
return (h("mg-input", { key: 'ff06e342e04a96ecc30ff064ace7c179b1db8425', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: ge(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, h("input", { key: 'bcecf05a95c3e812af6fc6d0b137afba726b2cb8', 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) => {
|
|
2106
2149
|
if (el !== null)
|
|
2107
2150
|
this.input = el;
|
|
2108
2151
|
} })));
|
|
@@ -2233,7 +2276,7 @@ const MgInputNumeric = class {
|
|
|
2233
2276
|
this.formatValue = (value) => {
|
|
2234
2277
|
switch (this.format) {
|
|
2235
2278
|
case 'number':
|
|
2236
|
-
return qe(value, this.locale);
|
|
2279
|
+
return qe(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2237
2280
|
case 'currency':
|
|
2238
2281
|
return ze(value, this.locale, this.currency);
|
|
2239
2282
|
case 'none':
|
|
@@ -2463,10 +2506,10 @@ const MgInputNumeric = class {
|
|
|
2463
2506
|
* @returns HTML Element
|
|
2464
2507
|
*/
|
|
2465
2508
|
render() {
|
|
2466
|
-
return (h("mg-input", { key: '
|
|
2509
|
+
return (h("mg-input", { key: 'c1b1a0cd22f0ed6597852ecd38bb97d9942565a1', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: this.readonlyValue, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("input", { key: '9e64e0096e3ab8212c6626fba772a7756cd4f144', type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
2467
2510
|
if (el !== null)
|
|
2468
2511
|
this.input = el;
|
|
2469
|
-
} }), h("slot", { key: '
|
|
2512
|
+
} }), h("slot", { key: 'd2484bde61ff7962bb8b060f448a656160edd3f9', name: "append-input" })));
|
|
2470
2513
|
}
|
|
2471
2514
|
get element() { return getElement(this); }
|
|
2472
2515
|
static get watchers() { return {
|
|
@@ -2667,7 +2710,7 @@ const MgInputPassword = class {
|
|
|
2667
2710
|
return (h("mg-input", { key: '0743de03e00b3eeeca1e155fefa6fa3fa8dd20e4', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: this.value !== undefined ? '•'.repeat(this.value.length) : undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("span", { key: '35c61d84248fe5b65c91afcb932d8e71aa0db71f', class: "mg-c-input__input-group" }, h("input", { key: 'b546544ac71d8d29ea7ac18146faccfdb1d738de', type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
2668
2711
|
if (el !== null)
|
|
2669
2712
|
this.input = el;
|
|
2670
|
-
} }), h("mg-button", { key: '
|
|
2713
|
+
} }), h("mg-button", { key: 'fbe3f10fd8b9626d13d1e8ca9f3355e8af0d573e', label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { key: '48f1d7921294675f036439364bc73d1c730573c9', icon: this.displayPassword ? 'eye-slash' : 'eye' })))));
|
|
2671
2714
|
}
|
|
2672
2715
|
get element() { return getElement(this); }
|
|
2673
2716
|
static get watchers() { return {
|
|
@@ -3229,6 +3272,12 @@ MgInputSelect.style = MgInputSelectStyle0;
|
|
|
3229
3272
|
const mgInputTextCss = ".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-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input.mg-c-input--has-display-character-left mg-character-left{font-size:1.1rem;opacity:.6}.mg-c-input.mg-c-input--has-display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--has-display-character-left .mg-c-input__input+.mg-c-input__error ::slotted(*){margin-top:0}.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__with-character-left{position:relative;width:100%}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left .mg-c-input__box{padding-right:calc(var(--mg-character-left-message-length)*1ch + .8rem)}.mg-c-input__with-character-left mg-character-left{position:absolute;top:50%;right:1rem;display:none;font-size:1.1rem;opacity:.6;transform:translateY(-50%)}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{display:block}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-inputs-spacer);color:var(--mg-inputs-color);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box{padding-left:calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer)*2)}";
|
|
3230
3273
|
const MgInputTextStyle0 = mgInputTextCss;
|
|
3231
3274
|
|
|
3275
|
+
/**
|
|
3276
|
+
* Check if datalist options are well structured.
|
|
3277
|
+
*
|
|
3278
|
+
* @param options - Datalist options to check.
|
|
3279
|
+
* @returns True if datalist is well structured.
|
|
3280
|
+
*/
|
|
3232
3281
|
const isDatalistOption = (options) => Array.isArray(options) && options.every(option => typeof option === 'string');
|
|
3233
3282
|
const MgInputText = class {
|
|
3234
3283
|
constructor(hostRef) {
|
|
@@ -3479,14 +3528,14 @@ const MgInputText = class {
|
|
|
3479
3528
|
* @returns HTML Element
|
|
3480
3529
|
*/
|
|
3481
3530
|
render() {
|
|
3482
|
-
return (h("mg-input", { key: '
|
|
3531
|
+
return (h("mg-input", { key: '0bcc765df96b4183f70e03f0579bc64f0d2455d2', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: this.value, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("div", { key: 'fdbfcdc5be2946e3c25b4ea1bc3e1824a205e4fe', class: "mg-c-input__with-character-left", style: {
|
|
3483
3532
|
'--mg-character-left-message-length': (this.displayCharacterLeft
|
|
3484
3533
|
? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
|
|
3485
3534
|
: 0).toString(),
|
|
3486
|
-
} }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { key: '
|
|
3535
|
+
} }, this.icon !== undefined && h("mg-icon", { icon: this.icon }), h("input", { key: '1fa97359a69a9ab7093dbcbe4349638f121931c7', type: this.type, class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, list: this.hasDatalist() ? this.datalistId : undefined, autocomplete: this.hasDatalist() ? 'off' : undefined, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
3487
3536
|
if (el !== null)
|
|
3488
3537
|
this.input = el;
|
|
3489
|
-
} }), this.hasDatalist() && (h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { key: '
|
|
3538
|
+
} }), this.hasDatalist() && (h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), h("slot", { key: 'e6e209266d3525fb2dcd3eecf1dc054d2d7750b4', name: "append-input" })));
|
|
3490
3539
|
}
|
|
3491
3540
|
get element() { return getElement(this); }
|
|
3492
3541
|
static get watchers() { return {
|
|
@@ -3789,7 +3838,7 @@ const MgInputTitle = class {
|
|
|
3789
3838
|
render() {
|
|
3790
3839
|
const TagName = this.readonly ? 'span' : this.tagName;
|
|
3791
3840
|
// \u00A0 represent a
|
|
3792
|
-
return (h(TagName, { key: '
|
|
3841
|
+
return (h(TagName, { key: '3042d844802f32bc180f7fa2a94b6d6b72e3fc85', class: "mg-c-input-title", htmlFor: !this.isLegend && this.identifier, id: this.isLegend ? `${this.identifier}-title` : undefined }, h("slot", { key: 'b95a542c64ab1deddcae5d2cf5185a5748303926' }), this.required && !this.readonly && (h("span", { class: "mg-c-input-title__required" }, "\u00A0", h("span", { class: "mg-u-is-asterisk" }, "*")))));
|
|
3793
3842
|
}
|
|
3794
3843
|
static get watchers() { return {
|
|
3795
3844
|
"identifier": ["validateIdentifier"],
|
|
@@ -4008,7 +4057,7 @@ const MgInputToggle = class {
|
|
|
4008
4057
|
*/
|
|
4009
4058
|
render() {
|
|
4010
4059
|
var _a;
|
|
4011
|
-
return (h("mg-input", { key: '
|
|
4060
|
+
return (h("mg-input", { key: '560cd6ef008109c6dd8cee23d51c019b10feb7ff', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonlyValue: (_a = this.getCheckedItem(this.checked)) === null || _a === void 0 ? void 0 : _a.title, tooltip: !this.readonly && this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, h("button", { key: '05bdaac2362591a6f9e250fc8703701fc5c91d2d', type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { key: '395086e1a986767072db4e10b3afc5b4cc650bd8', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { key: 'c39a37141d822e8ddfad1505039379b0b14d6490', name: "item-1" })), h("span", { key: 'fcc28290602815ace1d755e7ea1eede7d6fbcc10', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { key: '7788fc760df5c002ca621c439902ff44fb7226db', name: "item-2" })))));
|
|
4012
4061
|
}
|
|
4013
4062
|
get element() { return getElement(this); }
|
|
4014
4063
|
static get watchers() { return {
|
|
@@ -4023,6 +4072,274 @@ const MgInputToggle = class {
|
|
|
4023
4072
|
};
|
|
4024
4073
|
MgInputToggle.style = MgInputToggleStyle0;
|
|
4025
4074
|
|
|
4075
|
+
/**
|
|
4076
|
+
* MgItemMore type guard
|
|
4077
|
+
* @param element - element to control type
|
|
4078
|
+
* @returns truthy if element is mg-item-more
|
|
4079
|
+
*/
|
|
4080
|
+
const isMgItemMore = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
4081
|
+
var OverflowBehaviorElements;
|
|
4082
|
+
(function (OverflowBehaviorElements) {
|
|
4083
|
+
OverflowBehaviorElements["BASE_INDEX"] = "data-overflow-base-index";
|
|
4084
|
+
OverflowBehaviorElements["PROXY_INDEX"] = "data-overflow-proxy-index";
|
|
4085
|
+
})(OverflowBehaviorElements || (OverflowBehaviorElements = {}));
|
|
4086
|
+
class OverflowBehavior {
|
|
4087
|
+
constructor(element, render) {
|
|
4088
|
+
this.element = element;
|
|
4089
|
+
this.render = render;
|
|
4090
|
+
/**********
|
|
4091
|
+
* Public *
|
|
4092
|
+
**********/
|
|
4093
|
+
/**
|
|
4094
|
+
* Disconnect ResizeObserver
|
|
4095
|
+
*/
|
|
4096
|
+
this.disconnect = () => {
|
|
4097
|
+
this._resizeObserver.disconnect();
|
|
4098
|
+
};
|
|
4099
|
+
/************
|
|
4100
|
+
* Internal *
|
|
4101
|
+
************/
|
|
4102
|
+
/**
|
|
4103
|
+
* run overflow behavior
|
|
4104
|
+
* @param width - width of the container. Optional.
|
|
4105
|
+
*/
|
|
4106
|
+
this.run = (width) => {
|
|
4107
|
+
if (this._moreElement === undefined) {
|
|
4108
|
+
// set moreElement
|
|
4109
|
+
this._moreElement = this.render();
|
|
4110
|
+
// set children
|
|
4111
|
+
this._baseChildren = this.getInteractiveItems(this.element);
|
|
4112
|
+
if (isMgItemMore(this._moreElement)) {
|
|
4113
|
+
this._proxyChildren = this.getInteractiveItems(this._moreElement.shadowRoot.querySelector('mg-menu'));
|
|
4114
|
+
}
|
|
4115
|
+
// update children
|
|
4116
|
+
this._baseChildren.forEach((child, index) => {
|
|
4117
|
+
child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
|
|
4118
|
+
// set moreElement children
|
|
4119
|
+
this._proxyChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
|
|
4120
|
+
});
|
|
4121
|
+
}
|
|
4122
|
+
if (width !== undefined)
|
|
4123
|
+
this.updateDisplayedItems(width);
|
|
4124
|
+
};
|
|
4125
|
+
/**
|
|
4126
|
+
* Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
|
|
4127
|
+
* @param element - element to parse
|
|
4128
|
+
* @returns children
|
|
4129
|
+
*/
|
|
4130
|
+
this.getInteractiveItems = (element) => { var _a; return (((_a = element.children) === null || _a === void 0 ? void 0 : _a.length) > 0 ? Array.from(element.children) : []).filter(element => ['MG-MENU-ITEM', 'MG-BUTTON'].includes(element.nodeName)); };
|
|
4131
|
+
/**
|
|
4132
|
+
* Update displayed items in container from a given available space
|
|
4133
|
+
* @param availableWidth - available width in container to display child items
|
|
4134
|
+
*/
|
|
4135
|
+
this.updateDisplayedItems = (availableWidth) => {
|
|
4136
|
+
this.restoreItems();
|
|
4137
|
+
const acc = { accWidth: 0, previousItem: null };
|
|
4138
|
+
[...this._baseChildren, this._moreElement].forEach((child) => {
|
|
4139
|
+
acc.accWidth += child.offsetWidth;
|
|
4140
|
+
const hasPreviuosItem = acc.previousItem !== null;
|
|
4141
|
+
const isPreviousItemHidden = hasPreviuosItem && acc.previousItem.getAttribute('hidden') !== null;
|
|
4142
|
+
// if previous item is hidden AND is NOT more element we hidde current
|
|
4143
|
+
// OR if item has an overflow we hidde current
|
|
4144
|
+
// OR if current item is more element AND have NOT previous hidden items, current more element item is an hidden item
|
|
4145
|
+
// ELSE current is a display item
|
|
4146
|
+
this.toggleItem(child, (isPreviousItemHidden && !this.isMoreElement(child)) || this.isOverflowElement(acc.accWidth, child, availableWidth) || (this.isMoreElement(child) && !isPreviousItemHidden));
|
|
4147
|
+
// update previous item with current item
|
|
4148
|
+
acc.previousItem = child;
|
|
4149
|
+
});
|
|
4150
|
+
};
|
|
4151
|
+
/**
|
|
4152
|
+
* Utility method to know if item overflow partialy or totaly in the container
|
|
4153
|
+
* @param cumulateWidth - previous sibling elements cumulate width + item width
|
|
4154
|
+
* @param item - item HTML element
|
|
4155
|
+
* @param availableWidth - container available width
|
|
4156
|
+
* @returns truthy if element is overflow
|
|
4157
|
+
*/
|
|
4158
|
+
this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
|
|
4159
|
+
if (item.previousElementSibling === null || this.isMoreElement(item))
|
|
4160
|
+
return false;
|
|
4161
|
+
else if (!this.isMoreElement(item.nextElementSibling))
|
|
4162
|
+
return cumulateWidth + this._moreElement.offsetWidth > availableWidth;
|
|
4163
|
+
else
|
|
4164
|
+
return cumulateWidth > availableWidth;
|
|
4165
|
+
};
|
|
4166
|
+
/**
|
|
4167
|
+
* Utility method to know if a given element is the 'MORE' element
|
|
4168
|
+
* @param element - element to match with 'MORE' element
|
|
4169
|
+
* @returns truthy if element is the 'MORE' element
|
|
4170
|
+
*/
|
|
4171
|
+
this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
4172
|
+
/**
|
|
4173
|
+
* Toggle display item element
|
|
4174
|
+
* @param item - item to control
|
|
4175
|
+
* @param isHidden - is item hidden
|
|
4176
|
+
*/
|
|
4177
|
+
this.toggleItem = (item, isHidden) => {
|
|
4178
|
+
const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
|
|
4179
|
+
if (this.isMoreElement(item))
|
|
4180
|
+
this.toggleElement(this._moreElement, isHidden);
|
|
4181
|
+
else if (mgActionMenuindex >= 0) {
|
|
4182
|
+
this.toggleElement(item, isHidden);
|
|
4183
|
+
this.toggleElement(this._proxyChildren[mgActionMenuindex], !isHidden);
|
|
4184
|
+
}
|
|
4185
|
+
};
|
|
4186
|
+
/**
|
|
4187
|
+
* Toggle element's hidde attribute
|
|
4188
|
+
* @param element - element to toggle
|
|
4189
|
+
* @param isHidden - element is hidden
|
|
4190
|
+
*/
|
|
4191
|
+
this.toggleElement = (element, isHidden) => {
|
|
4192
|
+
if (isHidden)
|
|
4193
|
+
element.setAttribute('hidden', '');
|
|
4194
|
+
else
|
|
4195
|
+
element.removeAttribute('hidden');
|
|
4196
|
+
};
|
|
4197
|
+
/**
|
|
4198
|
+
* Remove hidden attributes on all items
|
|
4199
|
+
*/
|
|
4200
|
+
this.restoreItems = () => {
|
|
4201
|
+
[...this._baseChildren, this._moreElement].forEach(item => item.removeAttribute('hidden'));
|
|
4202
|
+
};
|
|
4203
|
+
if (this._resizeObserver === undefined) {
|
|
4204
|
+
// add resize observer
|
|
4205
|
+
this._resizeObserver = new ResizeObserver(entries => {
|
|
4206
|
+
entries.forEach(entry => {
|
|
4207
|
+
this.run(entry.contentRect.width);
|
|
4208
|
+
});
|
|
4209
|
+
});
|
|
4210
|
+
this._resizeObserver.observe(this.element);
|
|
4211
|
+
}
|
|
4212
|
+
this.run();
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
|
|
4216
|
+
const mgItemMoreCss = ".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}}:host:not([hidden]){display:flex}";
|
|
4217
|
+
const MgItemMoreStyle0 = mgItemMoreCss;
|
|
4218
|
+
|
|
4219
|
+
const MgItemMore = class {
|
|
4220
|
+
constructor(hostRef) {
|
|
4221
|
+
registerInstance(this, hostRef);
|
|
4222
|
+
/************
|
|
4223
|
+
* Internal *
|
|
4224
|
+
************/
|
|
4225
|
+
this.name = 'mg-item-more';
|
|
4226
|
+
this.canRenderMgMenuItemOverflowElement = true;
|
|
4227
|
+
/***********
|
|
4228
|
+
* Methods *
|
|
4229
|
+
***********/
|
|
4230
|
+
/**
|
|
4231
|
+
* render mg-item-more overflow element
|
|
4232
|
+
* @returns mg-item-more element
|
|
4233
|
+
*/
|
|
4234
|
+
this.renderMgMenuItemOverflowElement = () => {
|
|
4235
|
+
// create menu items proxy element from item clones
|
|
4236
|
+
this.parentMenuItems.forEach((child) => {
|
|
4237
|
+
this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
|
|
4238
|
+
});
|
|
4239
|
+
const allMenuItem = Array.from(this.parentMenu.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
|
|
4240
|
+
Array.from(this.moreElementMenuItem.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
|
|
4241
|
+
const proxified = allMenuItem[index];
|
|
4242
|
+
// manage click on proxy to mirror it on initial element
|
|
4243
|
+
proxy.addEventListener('click', () => {
|
|
4244
|
+
// be carefull to use element.click() method instead of dispatchEvent to ensure bubbles outside shadowDom
|
|
4245
|
+
const navElement = allMenuItem[index].shadowRoot.querySelector('a, button');
|
|
4246
|
+
if (navElement instanceof HTMLButtonElement || navElement instanceof HTMLAnchorElement)
|
|
4247
|
+
navElement.click();
|
|
4248
|
+
});
|
|
4249
|
+
// add id suffix to prevent duplicate key. default html id is: '';
|
|
4250
|
+
if (Be(proxy.id))
|
|
4251
|
+
proxy.id = `${proxy.id}-proxy`;
|
|
4252
|
+
// update properties and DOM when proxyfied item is updated
|
|
4253
|
+
proxified.addEventListener('item-updated', (event) => {
|
|
4254
|
+
Object.assign(proxy, event.target);
|
|
4255
|
+
proxy.innerHTML = event.target.innerHTML;
|
|
4256
|
+
});
|
|
4257
|
+
// manage status change miror in proxyfied element
|
|
4258
|
+
proxified.addEventListener('status-change', (event) => {
|
|
4259
|
+
proxy.setAttribute('status', event.detail);
|
|
4260
|
+
});
|
|
4261
|
+
});
|
|
4262
|
+
return this.element;
|
|
4263
|
+
};
|
|
4264
|
+
this.icon = { icon: 'ellipsis-vertical' };
|
|
4265
|
+
this.slotlabel = { display: false };
|
|
4266
|
+
this.size = undefined;
|
|
4267
|
+
this.parentMenu = undefined;
|
|
4268
|
+
}
|
|
4269
|
+
validateIcon(newValue) {
|
|
4270
|
+
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
|
|
4271
|
+
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type.`);
|
|
4272
|
+
}
|
|
4273
|
+
validateSlotLabel(newValue) {
|
|
4274
|
+
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
|
|
4275
|
+
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type.`);
|
|
4276
|
+
else if (typeof newValue.label !== 'string')
|
|
4277
|
+
this.slotlabel.label = this.messages.menuLabel;
|
|
4278
|
+
}
|
|
4279
|
+
validateSize(newValue) {
|
|
4280
|
+
if (newValue && typeof newValue !== 'string')
|
|
4281
|
+
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type.`);
|
|
4282
|
+
}
|
|
4283
|
+
/*************
|
|
4284
|
+
* Lifecycle *
|
|
4285
|
+
*************/
|
|
4286
|
+
/**
|
|
4287
|
+
* Set variables and validate props
|
|
4288
|
+
*/
|
|
4289
|
+
componentWillLoad() {
|
|
4290
|
+
// init variables
|
|
4291
|
+
this.messages = initLocales(this.element).messages.itemMore;
|
|
4292
|
+
// validate props
|
|
4293
|
+
this.validateIcon(this.icon);
|
|
4294
|
+
this.validateSlotLabel(this.slotlabel);
|
|
4295
|
+
this.validateSize(this.size);
|
|
4296
|
+
}
|
|
4297
|
+
/**
|
|
4298
|
+
* Ensure parent DOM is fully rendered with timeout method before parse elements
|
|
4299
|
+
* @returns timeout
|
|
4300
|
+
*/
|
|
4301
|
+
componentDidLoad() {
|
|
4302
|
+
// ensure parent menu is fully rendered
|
|
4303
|
+
return setTimeout(() => {
|
|
4304
|
+
this.parentMenu = this.element.closest('mg-menu');
|
|
4305
|
+
});
|
|
4306
|
+
}
|
|
4307
|
+
/**
|
|
4308
|
+
* Set OverflowBehavior when parentMenu state is upate AND defined
|
|
4309
|
+
*/
|
|
4310
|
+
componentDidUpdate() {
|
|
4311
|
+
if (this.parentMenu && this.canRenderMgMenuItemOverflowElement) {
|
|
4312
|
+
this.parentMenuItems = Array.from(this.parentMenu.children).filter(item => item.nodeName === 'MG-MENU-ITEM');
|
|
4313
|
+
this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
|
|
4314
|
+
this.canRenderMgMenuItemOverflowElement = false;
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
/**
|
|
4318
|
+
* Disconnect overflow ResizeObserver
|
|
4319
|
+
*/
|
|
4320
|
+
disconnectedCallback() {
|
|
4321
|
+
var _a;
|
|
4322
|
+
(_a = this.overflowBehavior) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
4323
|
+
}
|
|
4324
|
+
/**
|
|
4325
|
+
* Render
|
|
4326
|
+
* @returns HTML Element
|
|
4327
|
+
*/
|
|
4328
|
+
render() {
|
|
4329
|
+
return (h(Host, { key: 'c64a37d994cb6c3c388939b151588f2acf23e372', role: "listitem" }, this.parentMenu && (h("mg-menu-item", { "data-overflow-more": true, "data-size": this.parentMenu.size, ref: el => {
|
|
4330
|
+
if (el)
|
|
4331
|
+
this.moreElementMenuItem = el;
|
|
4332
|
+
} }, h("mg-icon", { icon: this.icon.icon, slot: "image" }), h("span", { class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size })))));
|
|
4333
|
+
}
|
|
4334
|
+
get element() { return getElement(this); }
|
|
4335
|
+
static get watchers() { return {
|
|
4336
|
+
"icon": ["validateIcon"],
|
|
4337
|
+
"slotlabel": ["validateSlotLabel"],
|
|
4338
|
+
"size": ["validateSize"]
|
|
4339
|
+
}; }
|
|
4340
|
+
};
|
|
4341
|
+
MgItemMore.style = MgItemMoreStyle0;
|
|
4342
|
+
|
|
4026
4343
|
const mgMenuCss = ".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}}:host{display:flex;background-color:hsl(var(--mg-menu-background-color-hsl, var(--color-light)))}:host([direction=vertical]){height:100%;flex-direction:column;overflow-y:auto}";
|
|
4027
4344
|
const MgMenuStyle0 = mgMenuCss;
|
|
4028
4345
|
|
|
@@ -4065,7 +4382,7 @@ const MgMenu = class {
|
|
|
4065
4382
|
*/
|
|
4066
4383
|
this.setItemListener = (item, index) => {
|
|
4067
4384
|
['click', 'focus'].forEach(trigger => {
|
|
4068
|
-
|
|
4385
|
+
item.shadowRoot.querySelector('button,a').addEventListener(trigger, () => {
|
|
4069
4386
|
this.focusedMenuItem = index;
|
|
4070
4387
|
// reset expanded on previous active menu item
|
|
4071
4388
|
(this.getItemMoreMenuItem() ? [...this.menuItems, this.getItemMoreMenuItem()] : this.menuItems).forEach((item, index) => {
|
|
@@ -4093,13 +4410,21 @@ const MgMenu = class {
|
|
|
4093
4410
|
* render mg-item-more
|
|
4094
4411
|
*/
|
|
4095
4412
|
this.renderMgItemMore = () => {
|
|
4413
|
+
if (this.direction !== Direction.HORIZONTAL || this.isChildMenu) {
|
|
4414
|
+
return;
|
|
4415
|
+
}
|
|
4096
4416
|
// /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
|
|
4097
4417
|
// by doing this we prevent stencil to generate a circular dependencies graph at build time with mg-item-more component.
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4418
|
+
let mgItemMore = this.getItemMore();
|
|
4419
|
+
if (!mgItemMore) {
|
|
4420
|
+
mgItemMore = document.createElement('mg-item-more');
|
|
4421
|
+
mgItemMore.addEventListener('item-loaded', this.handleItemLoaded);
|
|
4422
|
+
Object.assign(mgItemMore, this.itemmore || {});
|
|
4423
|
+
this.element.appendChild(mgItemMore);
|
|
4424
|
+
}
|
|
4425
|
+
else {
|
|
4426
|
+
Object.defineProperties(mgItemMore, this.itemmore || {});
|
|
4427
|
+
}
|
|
4103
4428
|
};
|
|
4104
4429
|
this.label = undefined;
|
|
4105
4430
|
this.direction = Direction.HORIZONTAL;
|
|
@@ -4152,22 +4477,13 @@ const MgMenu = class {
|
|
|
4152
4477
|
this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
4153
4478
|
this.isChildMenu = this.element.closest('mg-menu-item') !== null;
|
|
4154
4479
|
// add mg-item-more to manage OverflowBehavior
|
|
4155
|
-
|
|
4480
|
+
// when all props, states and DOM are already rendered we can render the mg-item-more
|
|
4481
|
+
this.renderMgItemMore();
|
|
4482
|
+
// then use mutation observer on children to improve reactivity
|
|
4483
|
+
new MutationObserver(() => {
|
|
4156
4484
|
this.renderMgItemMore();
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
const mgItemMore = this.getItemMore();
|
|
4160
|
-
// prevent infinit loop by exclude mg-item-more deletion entry
|
|
4161
|
-
if (entries.some(entry => entry.type === 'childList' && Array.from(entry.removedNodes).some(node => node.nodeName === 'MG-ITEM-MORE')))
|
|
4162
|
-
return;
|
|
4163
|
-
else if (mgItemMore !== null) {
|
|
4164
|
-
// render a new mg-item-more
|
|
4165
|
-
mgItemMore.remove();
|
|
4166
|
-
mgItemMore.removeEventListener('item-loaded', this.handleItemLoaded);
|
|
4167
|
-
this.renderMgItemMore();
|
|
4168
|
-
}
|
|
4169
|
-
}).observe(this.element, { childList: true, characterData: true, subtree: true });
|
|
4170
|
-
}, 0);
|
|
4485
|
+
}).observe(this.element, { childList: true });
|
|
4486
|
+
});
|
|
4171
4487
|
}
|
|
4172
4488
|
/**
|
|
4173
4489
|
* Add listeners to items
|
|
@@ -4180,7 +4496,7 @@ const MgMenu = class {
|
|
|
4180
4496
|
* @returns HTML Element
|
|
4181
4497
|
*/
|
|
4182
4498
|
render() {
|
|
4183
|
-
return (h(Host, { key: '
|
|
4499
|
+
return (h(Host, { key: 'cf7e1a8ea713af4019295c4147d3023223fc8a79', role: "list", "aria-label": this.label }, h("slot", { key: 'dcb316d5c13b3b01bfd0c7b891cbd3728a37fa11' })));
|
|
4184
4500
|
}
|
|
4185
4501
|
get element() { return getElement(this); }
|
|
4186
4502
|
static get watchers() { return {
|
|
@@ -4200,6 +4516,7 @@ const MgMenuItem = class {
|
|
|
4200
4516
|
registerInstance(this, hostRef);
|
|
4201
4517
|
this.statusChange = createEvent(this, "status-change", 7);
|
|
4202
4518
|
this.itemLoaded = createEvent(this, "item-loaded", 7);
|
|
4519
|
+
this.itemUpdated = createEvent(this, "item-updated", 7);
|
|
4203
4520
|
/************
|
|
4204
4521
|
* Internal *
|
|
4205
4522
|
************/
|
|
@@ -4453,10 +4770,11 @@ const MgMenuItem = class {
|
|
|
4453
4770
|
this.itemLoaded.emit();
|
|
4454
4771
|
new MutationObserver(mutationsList => {
|
|
4455
4772
|
if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
|
|
4456
|
-
this.updateStatus();
|
|
4773
|
+
this.updateStatus([Status$1.ACTIVE]);
|
|
4457
4774
|
if (mutationsList.some(mutation => mutation.type === 'characterData'))
|
|
4458
4775
|
this.validateSlot();
|
|
4459
4776
|
this.updateDisplayNotificationBadge();
|
|
4777
|
+
this.itemUpdated.emit();
|
|
4460
4778
|
}).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });
|
|
4461
4779
|
}, 0);
|
|
4462
4780
|
}
|
|
@@ -4474,6 +4792,14 @@ const MgMenuItem = class {
|
|
|
4474
4792
|
[`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
|
|
4475
4793
|
} }, h("mg-icon", { icon: "chevron-down", size: "small" })))));
|
|
4476
4794
|
}
|
|
4795
|
+
/**
|
|
4796
|
+
* Emit event when component is updated
|
|
4797
|
+
*/
|
|
4798
|
+
componentShouldUpdate() {
|
|
4799
|
+
return Ue(() => {
|
|
4800
|
+
this.itemUpdated.emit();
|
|
4801
|
+
});
|
|
4802
|
+
}
|
|
4477
4803
|
/**
|
|
4478
4804
|
* Render
|
|
4479
4805
|
* @returns HTML Element
|
|
@@ -4483,7 +4809,7 @@ const MgMenuItem = class {
|
|
|
4483
4809
|
['mg-c-menu-item__collapse-container']: true,
|
|
4484
4810
|
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
|
|
4485
4811
|
});
|
|
4486
|
-
return (h(Host, { key: '
|
|
4812
|
+
return (h(Host, { key: 'a340655f5b46ed3019e1be29cfade7dfbc480ec2', 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() }, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
4487
4813
|
this.renderInteractiveElement(),
|
|
4488
4814
|
h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
4489
4815
|
])));
|
|
@@ -4661,7 +4987,7 @@ const MgMessage = class {
|
|
|
4661
4987
|
let role;
|
|
4662
4988
|
if (!this.noAriaRole)
|
|
4663
4989
|
role = this.variant === 'info' ? 'status' : 'alert';
|
|
4664
|
-
return (h("div", { key: '
|
|
4990
|
+
return (h("div", { key: '2a2a66325834f5072ee6e89de0bcc40c3e0e6753', id: this.identifier, class: this.classCollection.join(), role: role }, h("mg-card", { key: '573448d09a88125eecf6b0c482cc589602238fea', variant: this.variant, "variant-style": "bar-left" }, h("span", { key: '81295346d39fdfeda74b9cdab5c468cce52cbc43', class: "mg-c-message__icon" }, h("mg-icon", { key: 'b8d655f6cffd963d601b8001f6b066e9e6ca379f', icon: this.getIcon() })), h("div", { key: '831938b7c2be97edb8dd37d2f28af6798bb32896', class: "mg-c-message__content" }, h("span", { key: '2c2d085285ec3feca97fa046ae038c725d0f05db', class: "mg-c-message__content-slot" }, h("slot", { key: '1907d1d60816a5e2d53e6ae87e60f66df253208b' })), this.hasActions && h("span", { class: "mg-c-message__content-separator" }), this.hasActions && (h("span", { class: "mg-c-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-c-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))))));
|
|
4665
4991
|
}
|
|
4666
4992
|
get element() { return getElement(this); }
|
|
4667
4993
|
static get watchers() { return {
|
|
@@ -4834,14 +5160,14 @@ const MgModal = class {
|
|
|
4834
5160
|
* @returns HTML Element
|
|
4835
5161
|
*/
|
|
4836
5162
|
render() {
|
|
4837
|
-
return (h("div", { key: '
|
|
5163
|
+
return (h("div", { key: 'a6d02e454214fe334e4fb9b7278b97b6713db306', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", { key: 'd192af0bfa6105f8ddb43ec73cfffb1d0469aca8' }, h("div", { key: '4f4f5b08ce39f20ca4f65686da294487d955ebd4', class: "mg-c-modal__dialog" }, h("header", { key: 'fd87c3a17a5b2783f4ffb79d23c6005cbf82af53', class: "mg-c-modal__header" }, this.closeButton && (h("span", { class: "mg-c-modal__close-button" }, h("mg-button", { identifier: `${this.identifier}-close-button`, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose, ref: (el) => {
|
|
4838
5164
|
if (el !== null) {
|
|
4839
5165
|
// store closeButton Element
|
|
4840
5166
|
this.closeButtonElement = el;
|
|
4841
5167
|
// add close button element to modalFocusableElements when it is render
|
|
4842
5168
|
this.modalFocusableElements.unshift(this.closeButtonElement);
|
|
4843
5169
|
}
|
|
4844
|
-
} }, h("mg-icon", { icon: "cross" })))), h("h1", { key: '
|
|
5170
|
+
} }, h("mg-icon", { icon: "cross" })))), h("h1", { key: '363962112d7d1db2f13cf91a7964588c4c2be71f', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-c-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-c-modal__footer" }, h("slot", { name: "actions" })))))));
|
|
4845
5171
|
}
|
|
4846
5172
|
get element() { return getElement(this); }
|
|
4847
5173
|
static get watchers() { return {
|
|
@@ -5143,7 +5469,7 @@ const MgPanel = class {
|
|
|
5143
5469
|
*/
|
|
5144
5470
|
render() {
|
|
5145
5471
|
const headerId = `${this.identifier}-header`;
|
|
5146
|
-
return (h("section", { key: '
|
|
5472
|
+
return (h("section", { key: '75509a6a7fdba04cea71380d46f5d0b66bbc9602', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '8ec07f87babeae31db85b5181d5884119010e8ce' }, h("header", { key: '045e43ab54c95691e1c4b758504bffc995f63340', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: '096d93e147c30c6ece4a6a3f5ee3acff05dc5143', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '37f2d61903662b519e583eca0ca90c044386e539' })))));
|
|
5147
5473
|
}
|
|
5148
5474
|
get element() { return getElement(this); }
|
|
5149
5475
|
static get watchers() { return {
|
|
@@ -7148,7 +7474,7 @@ const MgPopover = class {
|
|
|
7148
7474
|
* @returns HTML Element
|
|
7149
7475
|
*/
|
|
7150
7476
|
render() {
|
|
7151
|
-
return (h(Host, { key: '
|
|
7477
|
+
return (h(Host, { key: '2faad932884b3c0a13e42f960470096ad7c2a4e9' }, h("slot", { key: '270b328576a6772d54d4cff826f2b7c63a9a6cda' }), h("slot", { key: '9fc11feb085c19562bdef1966135edee44799e21', name: "content" })));
|
|
7152
7478
|
}
|
|
7153
7479
|
get element() { return getElement(this); }
|
|
7154
7480
|
static get watchers() { return {
|
|
@@ -7201,7 +7527,7 @@ const MgPopoverContent = class {
|
|
|
7201
7527
|
* @returns HTML Element
|
|
7202
7528
|
*/
|
|
7203
7529
|
render() {
|
|
7204
|
-
return (h(Host, { key: '
|
|
7530
|
+
return (h(Host, { key: 'e2ec01fc83727038047673eb89fa7a1fc6b90abe' }, h("mg-card", { key: '2ba199e78605edc19a6a0ddefb5a6749d80f6119', class: this.classCollection.join() }, this.closeButton && (h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { key: '1b6275e0da818d3f5606a9a49974f85b2aedda8a', class: "mg-c-popover-content__title" }, h("slot", { key: '6205bd6ccfba59e5526388b2f24251f5ff6cb6dc', name: "title" })), h("slot", { key: 'f1bc97234ef01af903e1c507bc79805ad252f02e', name: "content" })), h("slot", { key: '5f1a1a4fd2b0e86384b2b3d46da2d408fcec2e4e', name: "arrow" })));
|
|
7205
7531
|
}
|
|
7206
7532
|
get element() { return getElement(this); }
|
|
7207
7533
|
};
|
|
@@ -7478,7 +7804,7 @@ const MgTabs = class {
|
|
|
7478
7804
|
* @returns HTML Element
|
|
7479
7805
|
*/
|
|
7480
7806
|
render() {
|
|
7481
|
-
return (h("div", { key: '
|
|
7807
|
+
return (h("div", { key: '6aa138347fc29ccb2ebadc034a50ad6daa61fcee', class: this.classCollection.join() }, h("header", { key: 'c5a350bd2e66f3fad27eec61d51dcd7aebd8e5c2', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
7482
7808
|
[`${this.buttonTabBaseClass}`]: true,
|
|
7483
7809
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
7484
7810
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -7573,7 +7899,7 @@ const MgTag = class {
|
|
|
7573
7899
|
* @returns HTML Element
|
|
7574
7900
|
*/
|
|
7575
7901
|
render() {
|
|
7576
|
-
return (h("span", { key: '
|
|
7902
|
+
return (h("span", { key: 'f107390f5fb47c34faac9de08a08739499d0e409', class: this.classCollection.join() }, h("slot", { key: '04b346f71dff32aa32f52b96553154434ba231eb' })));
|
|
7577
7903
|
}
|
|
7578
7904
|
get element() { return getElement(this); }
|
|
7579
7905
|
static get watchers() { return {
|
|
@@ -7589,6 +7915,7 @@ var Guard;
|
|
|
7589
7915
|
Guard["FOCUS"] = "focus";
|
|
7590
7916
|
Guard["HOVER_TOOLTIP_ELEMENT"] = "hoverTooltipGuard";
|
|
7591
7917
|
Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
|
|
7918
|
+
Guard["DISABLE_ON_CLICK"] = "disableOnClick";
|
|
7592
7919
|
})(Guard || (Guard = {}));
|
|
7593
7920
|
|
|
7594
7921
|
const mgTooltipCss = ":host{display:inline-block}mg-tooltip-content{font-family:var(--font-family);font-size:var(--font-size);font-weight:200}";
|
|
@@ -7668,7 +7995,7 @@ const MgTooltip = class {
|
|
|
7668
7995
|
*/
|
|
7669
7996
|
this.tooltipMouseListenerAction = (elementGuard, isMouseenter, conditionalGuard) => {
|
|
7670
7997
|
// we mutate elementGuard
|
|
7671
|
-
if (
|
|
7998
|
+
if (![Guard.FOCUS, Guard.DISABLE_ON_CLICK].includes(this.guard)) {
|
|
7672
7999
|
this.guard = elementGuard;
|
|
7673
8000
|
if (!isMouseenter) {
|
|
7674
8001
|
// process action in the next event loop macro task
|
|
@@ -7749,6 +8076,12 @@ const MgTooltip = class {
|
|
|
7749
8076
|
],
|
|
7750
8077
|
});
|
|
7751
8078
|
// Manage tooltipedElement focus/blur events
|
|
8079
|
+
this.tooltipedElement.addEventListener('disabled-change', (event) => {
|
|
8080
|
+
if (event.target.disableOnClick) {
|
|
8081
|
+
this.guard = event.detail ? Guard.DISABLE_ON_CLICK : null;
|
|
8082
|
+
}
|
|
8083
|
+
});
|
|
8084
|
+
// Manage tooltipedElement focus/blur events
|
|
7752
8085
|
this.tooltipedElement.addEventListener('focus', () => {
|
|
7753
8086
|
this.guard = Guard.FOCUS;
|
|
7754
8087
|
this.setDisplay(true);
|
|
@@ -7863,7 +8196,7 @@ const MgTooltip = class {
|
|
|
7863
8196
|
// In this case we wrap the mg-button into a div to enable the tooltip
|
|
7864
8197
|
if (isButton(slotElement)) {
|
|
7865
8198
|
new MutationObserver(mutationList => {
|
|
7866
|
-
if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {
|
|
8199
|
+
if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName)) && this.guard !== Guard.DISABLE_ON_CLICK) {
|
|
7867
8200
|
this.setMgButtonWrapper(slotElement);
|
|
7868
8201
|
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
7869
8202
|
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
@@ -7888,7 +8221,7 @@ const MgTooltip = class {
|
|
|
7888
8221
|
* @returns HTML Element
|
|
7889
8222
|
*/
|
|
7890
8223
|
render() {
|
|
7891
|
-
return (h(Host, { key: '
|
|
8224
|
+
return (h(Host, { key: '1e78ccb946f44e44298b967286535bd5cb74f00d' }, h("slot", { key: 'cbc51e25225889f1b151499e98ab903a7daed059' }), h("slot", { key: '3e45bf6b40fc00b245f36d1cead2cb2659786ef9', name: "content" })));
|
|
7892
8225
|
}
|
|
7893
8226
|
get element() { return getElement(this); }
|
|
7894
8227
|
static get watchers() { return {
|
|
@@ -7916,11 +8249,11 @@ const MgTooltipContent = class {
|
|
|
7916
8249
|
* @returns HTML Element
|
|
7917
8250
|
*/
|
|
7918
8251
|
render() {
|
|
7919
|
-
return (h(Host, { key: '
|
|
8252
|
+
return (h(Host, { key: '81cff61f9230149078ace113a6661ae15ab6482e', role: "tooltip" }, h("span", { key: '11c2076354834ff3e51055197422726933154540', innerHTML: this.message, class: "mg-tooltip-content__message" }), h("slot", { key: 'ce2da739d5ac72a4ae3927a0b528a760f3f6422e', name: "arrow" })));
|
|
7920
8253
|
}
|
|
7921
8254
|
};
|
|
7922
8255
|
MgTooltipContent.style = MgTooltipContentStyle0;
|
|
7923
8256
|
|
|
7924
|
-
export { MgActionMore as mg_action_more, MgBadge as mg_badge, MgButton as mg_button, MgCard as mg_card, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgDivider as mg_divider, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInput as mg_input, MgInputCheckbox as mg_input_checkbox, MgInputCheckboxPaginated as mg_input_checkbox_paginated, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgMenu as mg_menu, MgMenuItem as mg_menu_item, MgMessage as mg_message, MgModal as mg_modal, MgPagination as mg_pagination, MgPanel as mg_panel, MgPopover as mg_popover, MgPopoverContent as mg_popover_content, MgSkipLinks as mg_skip_links, MgTabs as mg_tabs, MgTag as mg_tag, MgTooltip as mg_tooltip, MgTooltipContent as mg_tooltip_content };
|
|
8257
|
+
export { MgActionMore as mg_action_more, MgBadge as mg_badge, MgButton as mg_button, MgCard as mg_card, MgCharacterLeft as mg_character_left, MgDetails as mg_details, MgDivider as mg_divider, MgForm as mg_form, MgIcon as mg_icon, MgIllustratedMessage as mg_illustrated_message, MgInput as mg_input, MgInputCheckbox as mg_input_checkbox, MgInputCheckboxPaginated as mg_input_checkbox_paginated, MgInputDate as mg_input_date, MgInputNumeric as mg_input_numeric, MgInputPassword as mg_input_password, MgInputRadio as mg_input_radio, MgInputSelect as mg_input_select, MgInputText as mg_input_text, MgInputTextarea as mg_input_textarea, MgInputTitle as mg_input_title, MgInputToggle as mg_input_toggle, MgItemMore as mg_item_more, MgMenu as mg_menu, MgMenuItem as mg_menu_item, MgMessage as mg_message, MgModal as mg_modal, MgPagination as mg_pagination, MgPanel as mg_panel, MgPopover as mg_popover, MgPopoverContent as mg_popover_content, MgSkipLinks as mg_skip_links, MgTabs as mg_tabs, MgTag as mg_tag, MgTooltip as mg_tooltip, MgTooltipContent as mg_tooltip_content };
|
|
7925
8258
|
|
|
7926
|
-
//# sourceMappingURL=mg-action-
|
|
8259
|
+
//# sourceMappingURL=mg-action-more_36.entry.js.map
|