@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
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const index$1 = require('./index-
|
|
7
|
-
const mgMenu_conf = require('./mg-menu.conf-c291eee6.js');
|
|
5
|
+
const index = require('./index-83102ab3.js');
|
|
6
|
+
const index$1 = require('./index-4b43c17b.js');
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Available menu-item positions
|
|
@@ -29,6 +28,19 @@ var Status$1;
|
|
|
29
28
|
*/
|
|
30
29
|
const targets = ['_blank', '_self', '_parent', '_top'];
|
|
31
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Menu direction type
|
|
33
|
+
*/
|
|
34
|
+
var Direction;
|
|
35
|
+
(function (Direction) {
|
|
36
|
+
Direction["VERTICAL"] = "vertical";
|
|
37
|
+
Direction["HORIZONTAL"] = "horizontal";
|
|
38
|
+
})(Direction || (Direction = {}));
|
|
39
|
+
/**
|
|
40
|
+
* List of all possibles sizes
|
|
41
|
+
*/
|
|
42
|
+
const sizes$2 = ['regular', 'medium', 'large'];
|
|
43
|
+
|
|
32
44
|
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)}";
|
|
33
45
|
const MgActionMoreStyle0 = mgActionMoreCss;
|
|
34
46
|
|
|
@@ -154,7 +166,7 @@ const MgActionMore = class {
|
|
|
154
166
|
[`${this.classBase}__chevron--rotate`]: this.expanded === true,
|
|
155
167
|
} }, index.h("mg-icon", { key: '40cd8ad011debcda6794b5a3f6ae6a42ea6c385d', icon: "chevron-down", size: "small" })));
|
|
156
168
|
}
|
|
157
|
-
return (index.h(index.Host, { key: '3a0959e16e76ab50c857e489ddb91a9ed9758fbd', "data-mg-popover-guard": this.mgPopoverIdentifier }, index.h("span", { key: '1e37a919b19563aab4333a94f1676cb6b9d60289', class: "mg-action-more" }, index.h("mg-popover", { key: 'd539fd10e3cf38774c05180e906b35840b37f11a', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, index.h("mg-button", { key: 'e2fb983a112fe074ca9e9fd8629181274aaddd17', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && index.h("mg-icon", Object.assign({}, this.icon)), !this.button.isIcon && buttonContent), index.h("div", { key: 'e09d81146a0d5188a90d4e1204852608ea74d433', slot: "content" }, index.h("mg-menu", { key: '00949f8628192c04d537ed9c4c4261b33fb06c71', direction:
|
|
169
|
+
return (index.h(index.Host, { key: '3a0959e16e76ab50c857e489ddb91a9ed9758fbd', "data-mg-popover-guard": this.mgPopoverIdentifier }, index.h("span", { key: '1e37a919b19563aab4333a94f1676cb6b9d60289', class: "mg-action-more" }, index.h("mg-popover", { key: 'd539fd10e3cf38774c05180e906b35840b37f11a', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, index.h("mg-button", { key: 'e2fb983a112fe074ca9e9fd8629181274aaddd17', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && index.h("mg-icon", Object.assign({}, this.icon)), !this.button.isIcon && buttonContent), index.h("div", { key: 'e09d81146a0d5188a90d4e1204852608ea74d433', slot: "content" }, index.h("mg-menu", { key: '00949f8628192c04d537ed9c4c4261b33fb06c71', direction: Direction.VERTICAL, label: this.messages.label }, this.items.map(item => {
|
|
158
170
|
var _a;
|
|
159
171
|
return (
|
|
160
172
|
// eslint-disable-next-line react/jsx-no-bind
|
|
@@ -398,7 +410,7 @@ const MgButton = class {
|
|
|
398
410
|
*/
|
|
399
411
|
render() {
|
|
400
412
|
var _a;
|
|
401
|
-
return (index.h(index.Host, { key: '
|
|
413
|
+
return (index.h(index.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 }, index.h("div", { key: '9743ead1b9fd1f70ef0690087806a1767c5825b0', class: this.classCollection.join(), id: this.identifier }, this.loading && index.h("mg-icon", { icon: "loader", spin: true }), index.h("div", { key: '7070995c17ecedb4223475cce662e115e8d72510', class: "mg-c-button__content" }, index.h("slot", { key: 'cb0ad8aa02d634f0a3dfa9b584ec8fb26da88271' })))));
|
|
402
414
|
}
|
|
403
415
|
get element() { return index.getElement(this); }
|
|
404
416
|
static get watchers() { return {
|
|
@@ -478,7 +490,7 @@ const MgCard = class {
|
|
|
478
490
|
*/
|
|
479
491
|
render() {
|
|
480
492
|
var _a;
|
|
481
|
-
return (index.h("div", { key: '
|
|
493
|
+
return (index.h("div", { key: '9e604fe7b06f19797c6841b1902b56684a4bdc69', class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && index.h("span", { class: "mg-c-card__bar" }), index.h("slot", { key: '44d9092aaa6bbdf0b20a1fffe0edad15150cd8cb' })));
|
|
482
494
|
}
|
|
483
495
|
static get watchers() { return {
|
|
484
496
|
"variant": ["validateVariant"],
|
|
@@ -567,7 +579,7 @@ const MgDetails = class {
|
|
|
567
579
|
* @returns HTML Element
|
|
568
580
|
*/
|
|
569
581
|
render() {
|
|
570
|
-
return (index.h("details", { key: '
|
|
582
|
+
return (index.h("details", { key: '28d18aa44daec76231b80e2f8c48b475bb318d10', class: "mg-c-details", onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, index.h("summary", { key: 'a998fadad2ee592b632ab19c0fe69f142211156a' }, index.h("slot", { key: '7e5b636e9ed6f05904ed13c06cff14a5353de74b', name: "summary" }), index.h("span", { key: '770f0cfd6f70127a61f6ffab1c30e4d8d83c70bb', class: "mg-c-details__toggle" }, index.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 } }), index.h("span", { key: '1d0dc92242080d172d226bf013ae56ffe6e4a717', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), index.h("div", { key: 'd6b973893a807d2ef94a7c3d131e3ca0c9a675e3', class: "mg-c-details__details" }, index.h("slot", { key: 'ae1928a7aad8d986f44cb36e02648680dea074a4', name: "details" }))));
|
|
571
583
|
}
|
|
572
584
|
static get watchers() { return {
|
|
573
585
|
"toggleClosed": ["validateTitles"],
|
|
@@ -794,7 +806,7 @@ const MgForm = class {
|
|
|
794
806
|
* @returns HTML Element
|
|
795
807
|
*/
|
|
796
808
|
render() {
|
|
797
|
-
return (index.h("form", { key: '
|
|
809
|
+
return (index.h("form", { key: 'cfcf6da7026b3e3703903090773ecf69e57034cc', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && index.h("p", { innerHTML: this.requiredMessageText }), index.h("slot", { key: '2f0c489e6ce31580cbb66f144749f5c3e2ad18eb' }), !this.readonly && !this.disabled && index.h("slot", { name: "actions" })));
|
|
798
810
|
}
|
|
799
811
|
get element() { return index.getElement(this); }
|
|
800
812
|
static get watchers() { return {
|
|
@@ -965,13 +977,13 @@ const MgIllustratedMessage = class {
|
|
|
965
977
|
* @returns HTML Element
|
|
966
978
|
*/
|
|
967
979
|
render() {
|
|
968
|
-
return (index.h("div", { key: '
|
|
980
|
+
return (index.h("div", { key: '566da859acf529d2389b892db469a2293f85c67e', class: {
|
|
969
981
|
'mg-c-illustrated-message': true,
|
|
970
982
|
'mg-c-illustrated-message--horizontal': this.direction === 'horizontal',
|
|
971
|
-
} }, index.h("div", { key: '
|
|
983
|
+
} }, index.h("div", { key: '7d2d44156ae0c8c0ac2364e6f1fc7c41242f7d6c', class: {
|
|
972
984
|
'mg-c-illustrated-message__illustration': true,
|
|
973
985
|
'mg-c-illustrated-message__illustration--small': this.size === 'small',
|
|
974
|
-
} }, index.h("slot", { key: '
|
|
986
|
+
} }, index.h("slot", { key: '3a477be62f6866dece99be8882f89dcd2a620c5e', name: "illustration" })), index.h("div", { key: 'd6d8950d4bb5b8c6cafe1c148978bed1291f5768', class: "mg-c-illustrated-message__slots" }, index.h("div", { key: '47d0406a0d5eb2ea2388472defdc44411ba2977d', class: "mg-c-illustrated-message__title" }, index.h("slot", { key: '8126236dfce191b268f84f45183cc8304019c129', name: "title" })), index.h("div", { key: '64641dadca2ed82f3ad4b24d677ee01cc002dabf', class: "mg-c-illustrated-message__details" }, index.h("slot", { key: '65b61b0c16c9dde9cd2eab062b97fe189f53e5a2', name: "details" })))));
|
|
975
987
|
}
|
|
976
988
|
get element() { return index.getElement(this); }
|
|
977
989
|
};
|
|
@@ -1231,7 +1243,7 @@ const MgInput = class {
|
|
|
1231
1243
|
render() {
|
|
1232
1244
|
const readonlyValue = this.getReadonlyValues();
|
|
1233
1245
|
const isGroup = this.isFieldset && !this.isReadonly;
|
|
1234
|
-
return (index.h(index.Host, { key: '
|
|
1246
|
+
return (index.h(index.Host, { key: '5eedfac460913f23f71a3fbba43af958afc63e0d', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, index.h("div", { key: '9335584ba10e2bc199accb9b4200b45252c848a9', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, index.h("slot", { key: '7c5de08476008bfe6cbcfa07706cee30f16bc059', name: this.slotLabel }), this.tooltip && !this.isReadonly && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), index.h("div", { key: '5cf88a0ea68aaf2d8f1c96c4593ef6ea0133beb6', class: "mg-c-input__input-container" }, this.isReadonly
|
|
1235
1247
|
? [
|
|
1236
1248
|
Array.isArray(readonlyValue) ? (index.h("ul", { key: "readonly-value-list" }, readonlyValue.map(value => (index.h("li", { key: value }, index.h("strong", null, value)))))) : (index.h("strong", { key: "readonly-value" }, readonlyValue)),
|
|
1237
1249
|
index.h("slot", { key: "default-slot" }),
|
|
@@ -1860,6 +1872,7 @@ var InputError$1;
|
|
|
1860
1872
|
InputError["MAX"] = "max";
|
|
1861
1873
|
InputError["MINMAX"] = "minMax";
|
|
1862
1874
|
InputError["REQUIRED"] = "required";
|
|
1875
|
+
InputError["PATTERN"] = "badInput";
|
|
1863
1876
|
})(InputError$1 || (InputError$1 = {}));
|
|
1864
1877
|
|
|
1865
1878
|
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}}";
|
|
@@ -1872,6 +1885,12 @@ const MgInputDate = class {
|
|
|
1872
1885
|
this.inputValid = index.createEvent(this, "input-valid", 7);
|
|
1873
1886
|
// hasDisplayedError (triggered by blur event)
|
|
1874
1887
|
this.hasDisplayedError = false;
|
|
1888
|
+
/**
|
|
1889
|
+
* Method to validate date pattern string
|
|
1890
|
+
* @param value - value to test
|
|
1891
|
+
* @returns truthy when value match the pattern
|
|
1892
|
+
*/
|
|
1893
|
+
this.isValidPattern = (value) => index$1.Be(value) && index$1.de.test(value);
|
|
1875
1894
|
/**
|
|
1876
1895
|
* Format help text to display
|
|
1877
1896
|
* @param helpText - help text format
|
|
@@ -1904,32 +1923,52 @@ const MgInputDate = class {
|
|
|
1904
1923
|
this.handlerInProgress = undefined;
|
|
1905
1924
|
});
|
|
1906
1925
|
};
|
|
1926
|
+
/**
|
|
1927
|
+
* Handle keydown event
|
|
1928
|
+
* @param event - input keydown event
|
|
1929
|
+
*/
|
|
1930
|
+
this.handleKeyDown = (event) => {
|
|
1931
|
+
// bypass the native "Delete" action wich trigger an "input" event with "checkValidty() => false" with a falsy badInput = true,
|
|
1932
|
+
// when we reset the field we need to test a blank value.
|
|
1933
|
+
if (['Delete', 'Backspace'].includes(event.key)) {
|
|
1934
|
+
event.preventDefault();
|
|
1935
|
+
this.value = '';
|
|
1936
|
+
this.checkValidity();
|
|
1937
|
+
if (this.hasDisplayedError) {
|
|
1938
|
+
this.setErrorMessage();
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
};
|
|
1907
1942
|
/**
|
|
1908
1943
|
* Check if input is valid
|
|
1909
1944
|
*/
|
|
1910
1945
|
this.checkValidity = () => {
|
|
1911
|
-
this.setValidity(this.readonly || this.disabled || this.input.checkValidity());
|
|
1946
|
+
this.setValidity(this.readonly || this.disabled || (this.input.checkValidity() && (!this.value || this.isValidPattern(this.value))));
|
|
1912
1947
|
};
|
|
1913
1948
|
/**
|
|
1914
1949
|
* get input error code
|
|
1915
1950
|
* @returns error code
|
|
1916
1951
|
*/
|
|
1917
1952
|
this.getInputError = () => {
|
|
1918
|
-
var _a
|
|
1953
|
+
var _a;
|
|
1919
1954
|
let inputError = null;
|
|
1920
1955
|
// required
|
|
1921
1956
|
if (this.input.validity.valueMissing) {
|
|
1922
1957
|
inputError = InputError$1.REQUIRED;
|
|
1923
1958
|
}
|
|
1959
|
+
// pattern
|
|
1960
|
+
else if (this.value && !this.isValidPattern(this.value)) {
|
|
1961
|
+
inputError = InputError$1.PATTERN;
|
|
1962
|
+
}
|
|
1924
1963
|
// min & max
|
|
1925
|
-
else if ((this.input.validity.rangeUnderflow || this.input.validity.rangeOverflow) && ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
1964
|
+
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') {
|
|
1926
1965
|
inputError = InputError$1.MINMAX;
|
|
1927
1966
|
}
|
|
1928
1967
|
// min
|
|
1929
1968
|
else if (this.input.validity.rangeUnderflow) {
|
|
1930
1969
|
inputError = InputError$1.MIN;
|
|
1931
1970
|
}
|
|
1932
|
-
//max
|
|
1971
|
+
// max
|
|
1933
1972
|
else if (this.input.validity.rangeOverflow) {
|
|
1934
1973
|
inputError = InputError$1.MAX;
|
|
1935
1974
|
}
|
|
@@ -1984,7 +2023,7 @@ const MgInputDate = class {
|
|
|
1984
2023
|
this.required = false;
|
|
1985
2024
|
this.readonly = false;
|
|
1986
2025
|
this.min = undefined;
|
|
1987
|
-
this.max =
|
|
2026
|
+
this.max = '9999-12-31';
|
|
1988
2027
|
this.disabled = false;
|
|
1989
2028
|
this.tooltip = undefined;
|
|
1990
2029
|
this.tooltipPosition = 'input';
|
|
@@ -1998,12 +2037,16 @@ const MgInputDate = class {
|
|
|
1998
2037
|
// When the input is not fully completed or has been cleared, the value becomes an empty string.
|
|
1999
2038
|
if (newValue === '')
|
|
2000
2039
|
newValue = null;
|
|
2001
|
-
|
|
2002
|
-
|
|
2040
|
+
// check value validity
|
|
2041
|
+
if (newValue && !index$1.Be(newValue)) {
|
|
2042
|
+
throw new Error("<mg-input-date> props 'value' must be a valid string");
|
|
2003
2043
|
}
|
|
2004
|
-
else {
|
|
2044
|
+
else if (!newValue || (newValue && this.isValidPattern(newValue))) {
|
|
2005
2045
|
this.valueChange.emit(newValue);
|
|
2006
2046
|
}
|
|
2047
|
+
else {
|
|
2048
|
+
console.error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
2049
|
+
}
|
|
2007
2050
|
}
|
|
2008
2051
|
watchReadonly(newValue) {
|
|
2009
2052
|
if (newValue)
|
|
@@ -2012,7 +2055,7 @@ const MgInputDate = class {
|
|
|
2012
2055
|
this.classCollection.delete(classReadonly);
|
|
2013
2056
|
}
|
|
2014
2057
|
validateMinMax(newValue) {
|
|
2015
|
-
if (
|
|
2058
|
+
if (newValue && !this.isValidPattern(newValue)) {
|
|
2016
2059
|
throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
|
|
2017
2060
|
}
|
|
2018
2061
|
}
|
|
@@ -2106,7 +2149,7 @@ const MgInputDate = class {
|
|
|
2106
2149
|
* @returns HTML Element
|
|
2107
2150
|
*/
|
|
2108
2151
|
render() {
|
|
2109
|
-
return (index.h("mg-input", { key: '
|
|
2152
|
+
return (index.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: index$1.ge(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, index.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) => {
|
|
2110
2153
|
if (el !== null)
|
|
2111
2154
|
this.input = el;
|
|
2112
2155
|
} })));
|
|
@@ -2237,7 +2280,7 @@ const MgInputNumeric = class {
|
|
|
2237
2280
|
this.formatValue = (value) => {
|
|
2238
2281
|
switch (this.format) {
|
|
2239
2282
|
case 'number':
|
|
2240
|
-
return index$1.qe(value, this.locale);
|
|
2283
|
+
return index$1.qe(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2241
2284
|
case 'currency':
|
|
2242
2285
|
return index$1.ze(value, this.locale, this.currency);
|
|
2243
2286
|
case 'none':
|
|
@@ -2467,10 +2510,10 @@ const MgInputNumeric = class {
|
|
|
2467
2510
|
* @returns HTML Element
|
|
2468
2511
|
*/
|
|
2469
2512
|
render() {
|
|
2470
|
-
return (index.h("mg-input", { key: '
|
|
2513
|
+
return (index.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 }, index.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) => {
|
|
2471
2514
|
if (el !== null)
|
|
2472
2515
|
this.input = el;
|
|
2473
|
-
} }), index.h("slot", { key: '
|
|
2516
|
+
} }), index.h("slot", { key: 'd2484bde61ff7962bb8b060f448a656160edd3f9', name: "append-input" })));
|
|
2474
2517
|
}
|
|
2475
2518
|
get element() { return index.getElement(this); }
|
|
2476
2519
|
static get watchers() { return {
|
|
@@ -2671,7 +2714,7 @@ const MgInputPassword = class {
|
|
|
2671
2714
|
return (index.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 }, index.h("span", { key: '35c61d84248fe5b65c91afcb932d8e71aa0db71f', class: "mg-c-input__input-group" }, index.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) => {
|
|
2672
2715
|
if (el !== null)
|
|
2673
2716
|
this.input = el;
|
|
2674
|
-
} }), index.h("mg-button", { key: '
|
|
2717
|
+
} }), index.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 }, index.h("mg-icon", { key: '48f1d7921294675f036439364bc73d1c730573c9', icon: this.displayPassword ? 'eye-slash' : 'eye' })))));
|
|
2675
2718
|
}
|
|
2676
2719
|
get element() { return index.getElement(this); }
|
|
2677
2720
|
static get watchers() { return {
|
|
@@ -3233,6 +3276,12 @@ MgInputSelect.style = MgInputSelectStyle0;
|
|
|
3233
3276
|
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)}";
|
|
3234
3277
|
const MgInputTextStyle0 = mgInputTextCss;
|
|
3235
3278
|
|
|
3279
|
+
/**
|
|
3280
|
+
* Check if datalist options are well structured.
|
|
3281
|
+
*
|
|
3282
|
+
* @param options - Datalist options to check.
|
|
3283
|
+
* @returns True if datalist is well structured.
|
|
3284
|
+
*/
|
|
3236
3285
|
const isDatalistOption = (options) => Array.isArray(options) && options.every(option => typeof option === 'string');
|
|
3237
3286
|
const MgInputText = class {
|
|
3238
3287
|
constructor(hostRef) {
|
|
@@ -3483,14 +3532,14 @@ const MgInputText = class {
|
|
|
3483
3532
|
* @returns HTML Element
|
|
3484
3533
|
*/
|
|
3485
3534
|
render() {
|
|
3486
|
-
return (index.h("mg-input", { key: '
|
|
3535
|
+
return (index.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 }, index.h("div", { key: 'fdbfcdc5be2946e3c25b4ea1bc3e1824a205e4fe', class: "mg-c-input__with-character-left", style: {
|
|
3487
3536
|
'--mg-character-left-message-length': (this.displayCharacterLeft
|
|
3488
3537
|
? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
|
|
3489
3538
|
: 0).toString(),
|
|
3490
|
-
} }, this.icon !== undefined && index.h("mg-icon", { icon: this.icon }), index.h("input", { key: '
|
|
3539
|
+
} }, this.icon !== undefined && index.h("mg-icon", { icon: this.icon }), index.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) => {
|
|
3491
3540
|
if (el !== null)
|
|
3492
3541
|
this.input = el;
|
|
3493
|
-
} }), this.hasDatalist() && (index.h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (index.h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (index.h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), index.h("slot", { key: '
|
|
3542
|
+
} }), this.hasDatalist() && (index.h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (index.h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (index.h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), index.h("slot", { key: 'e6e209266d3525fb2dcd3eecf1dc054d2d7750b4', name: "append-input" })));
|
|
3494
3543
|
}
|
|
3495
3544
|
get element() { return index.getElement(this); }
|
|
3496
3545
|
static get watchers() { return {
|
|
@@ -3793,7 +3842,7 @@ const MgInputTitle = class {
|
|
|
3793
3842
|
render() {
|
|
3794
3843
|
const TagName = this.readonly ? 'span' : this.tagName;
|
|
3795
3844
|
// \u00A0 represent a
|
|
3796
|
-
return (index.h(TagName, { key: '
|
|
3845
|
+
return (index.h(TagName, { key: '3042d844802f32bc180f7fa2a94b6d6b72e3fc85', class: "mg-c-input-title", htmlFor: !this.isLegend && this.identifier, id: this.isLegend ? `${this.identifier}-title` : undefined }, index.h("slot", { key: 'b95a542c64ab1deddcae5d2cf5185a5748303926' }), this.required && !this.readonly && (index.h("span", { class: "mg-c-input-title__required" }, "\u00A0", index.h("span", { class: "mg-u-is-asterisk" }, "*")))));
|
|
3797
3846
|
}
|
|
3798
3847
|
static get watchers() { return {
|
|
3799
3848
|
"identifier": ["validateIdentifier"],
|
|
@@ -4012,7 +4061,7 @@ const MgInputToggle = class {
|
|
|
4012
4061
|
*/
|
|
4013
4062
|
render() {
|
|
4014
4063
|
var _a;
|
|
4015
|
-
return (index.h("mg-input", { key: '
|
|
4064
|
+
return (index.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 }, index.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 }, index.h("span", { key: '395086e1a986767072db4e10b3afc5b4cc650bd8', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { key: 'c39a37141d822e8ddfad1505039379b0b14d6490', name: "item-1" })), index.h("span", { key: 'fcc28290602815ace1d755e7ea1eede7d6fbcc10', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { key: '7788fc760df5c002ca621c439902ff44fb7226db', name: "item-2" })))));
|
|
4016
4065
|
}
|
|
4017
4066
|
get element() { return index.getElement(this); }
|
|
4018
4067
|
static get watchers() { return {
|
|
@@ -4027,6 +4076,274 @@ const MgInputToggle = class {
|
|
|
4027
4076
|
};
|
|
4028
4077
|
MgInputToggle.style = MgInputToggleStyle0;
|
|
4029
4078
|
|
|
4079
|
+
/**
|
|
4080
|
+
* MgItemMore type guard
|
|
4081
|
+
* @param element - element to control type
|
|
4082
|
+
* @returns truthy if element is mg-item-more
|
|
4083
|
+
*/
|
|
4084
|
+
const isMgItemMore = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
4085
|
+
var OverflowBehaviorElements;
|
|
4086
|
+
(function (OverflowBehaviorElements) {
|
|
4087
|
+
OverflowBehaviorElements["BASE_INDEX"] = "data-overflow-base-index";
|
|
4088
|
+
OverflowBehaviorElements["PROXY_INDEX"] = "data-overflow-proxy-index";
|
|
4089
|
+
})(OverflowBehaviorElements || (OverflowBehaviorElements = {}));
|
|
4090
|
+
class OverflowBehavior {
|
|
4091
|
+
constructor(element, render) {
|
|
4092
|
+
this.element = element;
|
|
4093
|
+
this.render = render;
|
|
4094
|
+
/**********
|
|
4095
|
+
* Public *
|
|
4096
|
+
**********/
|
|
4097
|
+
/**
|
|
4098
|
+
* Disconnect ResizeObserver
|
|
4099
|
+
*/
|
|
4100
|
+
this.disconnect = () => {
|
|
4101
|
+
this._resizeObserver.disconnect();
|
|
4102
|
+
};
|
|
4103
|
+
/************
|
|
4104
|
+
* Internal *
|
|
4105
|
+
************/
|
|
4106
|
+
/**
|
|
4107
|
+
* run overflow behavior
|
|
4108
|
+
* @param width - width of the container. Optional.
|
|
4109
|
+
*/
|
|
4110
|
+
this.run = (width) => {
|
|
4111
|
+
if (this._moreElement === undefined) {
|
|
4112
|
+
// set moreElement
|
|
4113
|
+
this._moreElement = this.render();
|
|
4114
|
+
// set children
|
|
4115
|
+
this._baseChildren = this.getInteractiveItems(this.element);
|
|
4116
|
+
if (isMgItemMore(this._moreElement)) {
|
|
4117
|
+
this._proxyChildren = this.getInteractiveItems(this._moreElement.shadowRoot.querySelector('mg-menu'));
|
|
4118
|
+
}
|
|
4119
|
+
// update children
|
|
4120
|
+
this._baseChildren.forEach((child, index) => {
|
|
4121
|
+
child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
|
|
4122
|
+
// set moreElement children
|
|
4123
|
+
this._proxyChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
|
|
4124
|
+
});
|
|
4125
|
+
}
|
|
4126
|
+
if (width !== undefined)
|
|
4127
|
+
this.updateDisplayedItems(width);
|
|
4128
|
+
};
|
|
4129
|
+
/**
|
|
4130
|
+
* Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
|
|
4131
|
+
* @param element - element to parse
|
|
4132
|
+
* @returns children
|
|
4133
|
+
*/
|
|
4134
|
+
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)); };
|
|
4135
|
+
/**
|
|
4136
|
+
* Update displayed items in container from a given available space
|
|
4137
|
+
* @param availableWidth - available width in container to display child items
|
|
4138
|
+
*/
|
|
4139
|
+
this.updateDisplayedItems = (availableWidth) => {
|
|
4140
|
+
this.restoreItems();
|
|
4141
|
+
const acc = { accWidth: 0, previousItem: null };
|
|
4142
|
+
[...this._baseChildren, this._moreElement].forEach((child) => {
|
|
4143
|
+
acc.accWidth += child.offsetWidth;
|
|
4144
|
+
const hasPreviuosItem = acc.previousItem !== null;
|
|
4145
|
+
const isPreviousItemHidden = hasPreviuosItem && acc.previousItem.getAttribute('hidden') !== null;
|
|
4146
|
+
// if previous item is hidden AND is NOT more element we hidde current
|
|
4147
|
+
// OR if item has an overflow we hidde current
|
|
4148
|
+
// OR if current item is more element AND have NOT previous hidden items, current more element item is an hidden item
|
|
4149
|
+
// ELSE current is a display item
|
|
4150
|
+
this.toggleItem(child, (isPreviousItemHidden && !this.isMoreElement(child)) || this.isOverflowElement(acc.accWidth, child, availableWidth) || (this.isMoreElement(child) && !isPreviousItemHidden));
|
|
4151
|
+
// update previous item with current item
|
|
4152
|
+
acc.previousItem = child;
|
|
4153
|
+
});
|
|
4154
|
+
};
|
|
4155
|
+
/**
|
|
4156
|
+
* Utility method to know if item overflow partialy or totaly in the container
|
|
4157
|
+
* @param cumulateWidth - previous sibling elements cumulate width + item width
|
|
4158
|
+
* @param item - item HTML element
|
|
4159
|
+
* @param availableWidth - container available width
|
|
4160
|
+
* @returns truthy if element is overflow
|
|
4161
|
+
*/
|
|
4162
|
+
this.isOverflowElement = (cumulateWidth, item, availableWidth) => {
|
|
4163
|
+
if (item.previousElementSibling === null || this.isMoreElement(item))
|
|
4164
|
+
return false;
|
|
4165
|
+
else if (!this.isMoreElement(item.nextElementSibling))
|
|
4166
|
+
return cumulateWidth + this._moreElement.offsetWidth > availableWidth;
|
|
4167
|
+
else
|
|
4168
|
+
return cumulateWidth > availableWidth;
|
|
4169
|
+
};
|
|
4170
|
+
/**
|
|
4171
|
+
* Utility method to know if a given element is the 'MORE' element
|
|
4172
|
+
* @param element - element to match with 'MORE' element
|
|
4173
|
+
* @returns truthy if element is the 'MORE' element
|
|
4174
|
+
*/
|
|
4175
|
+
this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
4176
|
+
/**
|
|
4177
|
+
* Toggle display item element
|
|
4178
|
+
* @param item - item to control
|
|
4179
|
+
* @param isHidden - is item hidden
|
|
4180
|
+
*/
|
|
4181
|
+
this.toggleItem = (item, isHidden) => {
|
|
4182
|
+
const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
|
|
4183
|
+
if (this.isMoreElement(item))
|
|
4184
|
+
this.toggleElement(this._moreElement, isHidden);
|
|
4185
|
+
else if (mgActionMenuindex >= 0) {
|
|
4186
|
+
this.toggleElement(item, isHidden);
|
|
4187
|
+
this.toggleElement(this._proxyChildren[mgActionMenuindex], !isHidden);
|
|
4188
|
+
}
|
|
4189
|
+
};
|
|
4190
|
+
/**
|
|
4191
|
+
* Toggle element's hidde attribute
|
|
4192
|
+
* @param element - element to toggle
|
|
4193
|
+
* @param isHidden - element is hidden
|
|
4194
|
+
*/
|
|
4195
|
+
this.toggleElement = (element, isHidden) => {
|
|
4196
|
+
if (isHidden)
|
|
4197
|
+
element.setAttribute('hidden', '');
|
|
4198
|
+
else
|
|
4199
|
+
element.removeAttribute('hidden');
|
|
4200
|
+
};
|
|
4201
|
+
/**
|
|
4202
|
+
* Remove hidden attributes on all items
|
|
4203
|
+
*/
|
|
4204
|
+
this.restoreItems = () => {
|
|
4205
|
+
[...this._baseChildren, this._moreElement].forEach(item => item.removeAttribute('hidden'));
|
|
4206
|
+
};
|
|
4207
|
+
if (this._resizeObserver === undefined) {
|
|
4208
|
+
// add resize observer
|
|
4209
|
+
this._resizeObserver = new ResizeObserver(entries => {
|
|
4210
|
+
entries.forEach(entry => {
|
|
4211
|
+
this.run(entry.contentRect.width);
|
|
4212
|
+
});
|
|
4213
|
+
});
|
|
4214
|
+
this._resizeObserver.observe(this.element);
|
|
4215
|
+
}
|
|
4216
|
+
this.run();
|
|
4217
|
+
}
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4220
|
+
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}";
|
|
4221
|
+
const MgItemMoreStyle0 = mgItemMoreCss;
|
|
4222
|
+
|
|
4223
|
+
const MgItemMore = class {
|
|
4224
|
+
constructor(hostRef) {
|
|
4225
|
+
index.registerInstance(this, hostRef);
|
|
4226
|
+
/************
|
|
4227
|
+
* Internal *
|
|
4228
|
+
************/
|
|
4229
|
+
this.name = 'mg-item-more';
|
|
4230
|
+
this.canRenderMgMenuItemOverflowElement = true;
|
|
4231
|
+
/***********
|
|
4232
|
+
* Methods *
|
|
4233
|
+
***********/
|
|
4234
|
+
/**
|
|
4235
|
+
* render mg-item-more overflow element
|
|
4236
|
+
* @returns mg-item-more element
|
|
4237
|
+
*/
|
|
4238
|
+
this.renderMgMenuItemOverflowElement = () => {
|
|
4239
|
+
// create menu items proxy element from item clones
|
|
4240
|
+
this.parentMenuItems.forEach((child) => {
|
|
4241
|
+
this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
|
|
4242
|
+
});
|
|
4243
|
+
const allMenuItem = Array.from(this.parentMenu.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
|
|
4244
|
+
Array.from(this.moreElementMenuItem.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
|
|
4245
|
+
const proxified = allMenuItem[index];
|
|
4246
|
+
// manage click on proxy to mirror it on initial element
|
|
4247
|
+
proxy.addEventListener('click', () => {
|
|
4248
|
+
// be carefull to use element.click() method instead of dispatchEvent to ensure bubbles outside shadowDom
|
|
4249
|
+
const navElement = allMenuItem[index].shadowRoot.querySelector('a, button');
|
|
4250
|
+
if (navElement instanceof HTMLButtonElement || navElement instanceof HTMLAnchorElement)
|
|
4251
|
+
navElement.click();
|
|
4252
|
+
});
|
|
4253
|
+
// add id suffix to prevent duplicate key. default html id is: '';
|
|
4254
|
+
if (index$1.Be(proxy.id))
|
|
4255
|
+
proxy.id = `${proxy.id}-proxy`;
|
|
4256
|
+
// update properties and DOM when proxyfied item is updated
|
|
4257
|
+
proxified.addEventListener('item-updated', (event) => {
|
|
4258
|
+
Object.assign(proxy, event.target);
|
|
4259
|
+
proxy.innerHTML = event.target.innerHTML;
|
|
4260
|
+
});
|
|
4261
|
+
// manage status change miror in proxyfied element
|
|
4262
|
+
proxified.addEventListener('status-change', (event) => {
|
|
4263
|
+
proxy.setAttribute('status', event.detail);
|
|
4264
|
+
});
|
|
4265
|
+
});
|
|
4266
|
+
return this.element;
|
|
4267
|
+
};
|
|
4268
|
+
this.icon = { icon: 'ellipsis-vertical' };
|
|
4269
|
+
this.slotlabel = { display: false };
|
|
4270
|
+
this.size = undefined;
|
|
4271
|
+
this.parentMenu = undefined;
|
|
4272
|
+
}
|
|
4273
|
+
validateIcon(newValue) {
|
|
4274
|
+
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
|
|
4275
|
+
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type.`);
|
|
4276
|
+
}
|
|
4277
|
+
validateSlotLabel(newValue) {
|
|
4278
|
+
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
|
|
4279
|
+
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type.`);
|
|
4280
|
+
else if (typeof newValue.label !== 'string')
|
|
4281
|
+
this.slotlabel.label = this.messages.menuLabel;
|
|
4282
|
+
}
|
|
4283
|
+
validateSize(newValue) {
|
|
4284
|
+
if (newValue && typeof newValue !== 'string')
|
|
4285
|
+
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type.`);
|
|
4286
|
+
}
|
|
4287
|
+
/*************
|
|
4288
|
+
* Lifecycle *
|
|
4289
|
+
*************/
|
|
4290
|
+
/**
|
|
4291
|
+
* Set variables and validate props
|
|
4292
|
+
*/
|
|
4293
|
+
componentWillLoad() {
|
|
4294
|
+
// init variables
|
|
4295
|
+
this.messages = index$1.initLocales(this.element).messages.itemMore;
|
|
4296
|
+
// validate props
|
|
4297
|
+
this.validateIcon(this.icon);
|
|
4298
|
+
this.validateSlotLabel(this.slotlabel);
|
|
4299
|
+
this.validateSize(this.size);
|
|
4300
|
+
}
|
|
4301
|
+
/**
|
|
4302
|
+
* Ensure parent DOM is fully rendered with timeout method before parse elements
|
|
4303
|
+
* @returns timeout
|
|
4304
|
+
*/
|
|
4305
|
+
componentDidLoad() {
|
|
4306
|
+
// ensure parent menu is fully rendered
|
|
4307
|
+
return setTimeout(() => {
|
|
4308
|
+
this.parentMenu = this.element.closest('mg-menu');
|
|
4309
|
+
});
|
|
4310
|
+
}
|
|
4311
|
+
/**
|
|
4312
|
+
* Set OverflowBehavior when parentMenu state is upate AND defined
|
|
4313
|
+
*/
|
|
4314
|
+
componentDidUpdate() {
|
|
4315
|
+
if (this.parentMenu && this.canRenderMgMenuItemOverflowElement) {
|
|
4316
|
+
this.parentMenuItems = Array.from(this.parentMenu.children).filter(item => item.nodeName === 'MG-MENU-ITEM');
|
|
4317
|
+
this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
|
|
4318
|
+
this.canRenderMgMenuItemOverflowElement = false;
|
|
4319
|
+
}
|
|
4320
|
+
}
|
|
4321
|
+
/**
|
|
4322
|
+
* Disconnect overflow ResizeObserver
|
|
4323
|
+
*/
|
|
4324
|
+
disconnectedCallback() {
|
|
4325
|
+
var _a;
|
|
4326
|
+
(_a = this.overflowBehavior) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
4327
|
+
}
|
|
4328
|
+
/**
|
|
4329
|
+
* Render
|
|
4330
|
+
* @returns HTML Element
|
|
4331
|
+
*/
|
|
4332
|
+
render() {
|
|
4333
|
+
return (index.h(index.Host, { key: 'c64a37d994cb6c3c388939b151588f2acf23e372', role: "listitem" }, this.parentMenu && (index.h("mg-menu-item", { "data-overflow-more": true, "data-size": this.parentMenu.size, ref: el => {
|
|
4334
|
+
if (el)
|
|
4335
|
+
this.moreElementMenuItem = el;
|
|
4336
|
+
} }, index.h("mg-icon", { icon: this.icon.icon, slot: "image" }), index.h("span", { class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), index.h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size })))));
|
|
4337
|
+
}
|
|
4338
|
+
get element() { return index.getElement(this); }
|
|
4339
|
+
static get watchers() { return {
|
|
4340
|
+
"icon": ["validateIcon"],
|
|
4341
|
+
"slotlabel": ["validateSlotLabel"],
|
|
4342
|
+
"size": ["validateSize"]
|
|
4343
|
+
}; }
|
|
4344
|
+
};
|
|
4345
|
+
MgItemMore.style = MgItemMoreStyle0;
|
|
4346
|
+
|
|
4030
4347
|
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}";
|
|
4031
4348
|
const MgMenuStyle0 = mgMenuCss;
|
|
4032
4349
|
|
|
@@ -4069,7 +4386,7 @@ const MgMenu = class {
|
|
|
4069
4386
|
*/
|
|
4070
4387
|
this.setItemListener = (item, index) => {
|
|
4071
4388
|
['click', 'focus'].forEach(trigger => {
|
|
4072
|
-
|
|
4389
|
+
item.shadowRoot.querySelector('button,a').addEventListener(trigger, () => {
|
|
4073
4390
|
this.focusedMenuItem = index;
|
|
4074
4391
|
// reset expanded on previous active menu item
|
|
4075
4392
|
(this.getItemMoreMenuItem() ? [...this.menuItems, this.getItemMoreMenuItem()] : this.menuItems).forEach((item, index) => {
|
|
@@ -4097,16 +4414,24 @@ const MgMenu = class {
|
|
|
4097
4414
|
* render mg-item-more
|
|
4098
4415
|
*/
|
|
4099
4416
|
this.renderMgItemMore = () => {
|
|
4417
|
+
if (this.direction !== Direction.HORIZONTAL || this.isChildMenu) {
|
|
4418
|
+
return;
|
|
4419
|
+
}
|
|
4100
4420
|
// /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
|
|
4101
4421
|
// by doing this we prevent stencil to generate a circular dependencies graph at build time with mg-item-more component.
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4422
|
+
let mgItemMore = this.getItemMore();
|
|
4423
|
+
if (!mgItemMore) {
|
|
4424
|
+
mgItemMore = document.createElement('mg-item-more');
|
|
4425
|
+
mgItemMore.addEventListener('item-loaded', this.handleItemLoaded);
|
|
4426
|
+
Object.assign(mgItemMore, this.itemmore || {});
|
|
4427
|
+
this.element.appendChild(mgItemMore);
|
|
4428
|
+
}
|
|
4429
|
+
else {
|
|
4430
|
+
Object.defineProperties(mgItemMore, this.itemmore || {});
|
|
4431
|
+
}
|
|
4107
4432
|
};
|
|
4108
4433
|
this.label = undefined;
|
|
4109
|
-
this.direction =
|
|
4434
|
+
this.direction = Direction.HORIZONTAL;
|
|
4110
4435
|
this.itemmore = undefined;
|
|
4111
4436
|
this.size = 'regular';
|
|
4112
4437
|
this.isChildMenu = undefined;
|
|
@@ -4117,18 +4442,18 @@ const MgMenu = class {
|
|
|
4117
4442
|
}
|
|
4118
4443
|
}
|
|
4119
4444
|
validateDirection(newValue) {
|
|
4120
|
-
if (![
|
|
4121
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${
|
|
4445
|
+
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
4446
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
|
|
4122
4447
|
}
|
|
4123
4448
|
}
|
|
4124
4449
|
validateItemMore(newValue) {
|
|
4125
|
-
if (newValue !== undefined && this.direction !==
|
|
4126
|
-
throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${
|
|
4450
|
+
if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
|
|
4451
|
+
throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${Direction.HORIZONTAL}.`);
|
|
4127
4452
|
}
|
|
4128
4453
|
}
|
|
4129
4454
|
validateSize(newValue) {
|
|
4130
|
-
if (!
|
|
4131
|
-
throw new Error(`<${this.name}> prop "size" must be one of: ${
|
|
4455
|
+
if (!sizes$2.includes(newValue)) {
|
|
4456
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$2.join(', ')}.`);
|
|
4132
4457
|
}
|
|
4133
4458
|
}
|
|
4134
4459
|
/*************
|
|
@@ -4156,22 +4481,13 @@ const MgMenu = class {
|
|
|
4156
4481
|
this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
4157
4482
|
this.isChildMenu = this.element.closest('mg-menu-item') !== null;
|
|
4158
4483
|
// add mg-item-more to manage OverflowBehavior
|
|
4159
|
-
|
|
4484
|
+
// when all props, states and DOM are already rendered we can render the mg-item-more
|
|
4485
|
+
this.renderMgItemMore();
|
|
4486
|
+
// then use mutation observer on children to improve reactivity
|
|
4487
|
+
new MutationObserver(() => {
|
|
4160
4488
|
this.renderMgItemMore();
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
const mgItemMore = this.getItemMore();
|
|
4164
|
-
// prevent infinit loop by exclude mg-item-more deletion entry
|
|
4165
|
-
if (entries.some(entry => entry.type === 'childList' && Array.from(entry.removedNodes).some(node => node.nodeName === 'MG-ITEM-MORE')))
|
|
4166
|
-
return;
|
|
4167
|
-
else if (mgItemMore !== null) {
|
|
4168
|
-
// render a new mg-item-more
|
|
4169
|
-
mgItemMore.remove();
|
|
4170
|
-
mgItemMore.removeEventListener('item-loaded', this.handleItemLoaded);
|
|
4171
|
-
this.renderMgItemMore();
|
|
4172
|
-
}
|
|
4173
|
-
}).observe(this.element, { childList: true, characterData: true, subtree: true });
|
|
4174
|
-
}, 0);
|
|
4489
|
+
}).observe(this.element, { childList: true });
|
|
4490
|
+
});
|
|
4175
4491
|
}
|
|
4176
4492
|
/**
|
|
4177
4493
|
* Add listeners to items
|
|
@@ -4184,7 +4500,7 @@ const MgMenu = class {
|
|
|
4184
4500
|
* @returns HTML Element
|
|
4185
4501
|
*/
|
|
4186
4502
|
render() {
|
|
4187
|
-
return (index.h(index.Host, { key: '
|
|
4503
|
+
return (index.h(index.Host, { key: 'cf7e1a8ea713af4019295c4147d3023223fc8a79', role: "list", "aria-label": this.label }, index.h("slot", { key: 'dcb316d5c13b3b01bfd0c7b891cbd3728a37fa11' })));
|
|
4188
4504
|
}
|
|
4189
4505
|
get element() { return index.getElement(this); }
|
|
4190
4506
|
static get watchers() { return {
|
|
@@ -4204,6 +4520,7 @@ const MgMenuItem = class {
|
|
|
4204
4520
|
index.registerInstance(this, hostRef);
|
|
4205
4521
|
this.statusChange = index.createEvent(this, "status-change", 7);
|
|
4206
4522
|
this.itemLoaded = index.createEvent(this, "item-loaded", 7);
|
|
4523
|
+
this.itemUpdated = index.createEvent(this, "item-updated", 7);
|
|
4207
4524
|
/************
|
|
4208
4525
|
* Internal *
|
|
4209
4526
|
************/
|
|
@@ -4301,7 +4618,7 @@ const MgMenuItem = class {
|
|
|
4301
4618
|
* Condition to know if component should display a mg-popover
|
|
4302
4619
|
* @returns truthy if component display popover
|
|
4303
4620
|
*/
|
|
4304
|
-
this.displayPopover = () => this.isDirection(
|
|
4621
|
+
this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
|
|
4305
4622
|
/************
|
|
4306
4623
|
* Handlers *
|
|
4307
4624
|
************/
|
|
@@ -4386,7 +4703,7 @@ const MgMenuItem = class {
|
|
|
4386
4703
|
this.element.setAttribute('data-style-direction', newValue);
|
|
4387
4704
|
this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
|
|
4388
4705
|
// manage all sub levels child menu-items level with data-level attribut
|
|
4389
|
-
if (this.isDirection(
|
|
4706
|
+
if (this.isDirection(Direction.VERTICAL, newValue)) {
|
|
4390
4707
|
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
|
|
4391
4708
|
item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
|
|
4392
4709
|
});
|
|
@@ -4438,7 +4755,7 @@ const MgMenuItem = class {
|
|
|
4438
4755
|
return setTimeout(() => {
|
|
4439
4756
|
// define menu-item context states
|
|
4440
4757
|
const menu = this.element.closest('mg-menu');
|
|
4441
|
-
this.direction = this.isItemMore || menu === null ?
|
|
4758
|
+
this.direction = this.isItemMore || menu === null ? Direction.HORIZONTAL : menu.direction;
|
|
4442
4759
|
this.isInMainMenu = menu !== null && this.element.parentElement.closest('mg-menu-item') === null;
|
|
4443
4760
|
if ((menu === null || menu === void 0 ? void 0 : menu.size) !== undefined)
|
|
4444
4761
|
this.size = menu.size;
|
|
@@ -4447,7 +4764,7 @@ const MgMenuItem = class {
|
|
|
4447
4764
|
// when main menu item contain an active item it will get the active style
|
|
4448
4765
|
// AND if item is in vertical menu it will be expanded
|
|
4449
4766
|
if (this.hasActiveChild() && this.isInMainMenu)
|
|
4450
|
-
this.expanded = this.isDirection(
|
|
4767
|
+
this.expanded = this.isDirection(Direction.VERTICAL);
|
|
4451
4768
|
this.updateStatus([Status$1.ACTIVE]);
|
|
4452
4769
|
this.updateDisplayNotificationBadge();
|
|
4453
4770
|
this.updatePopoverGuard();
|
|
@@ -4457,10 +4774,11 @@ const MgMenuItem = class {
|
|
|
4457
4774
|
this.itemLoaded.emit();
|
|
4458
4775
|
new MutationObserver(mutationsList => {
|
|
4459
4776
|
if (mutationsList.some(mutation => mutation.attributeName === 'hidden'))
|
|
4460
|
-
this.updateStatus();
|
|
4777
|
+
this.updateStatus([Status$1.ACTIVE]);
|
|
4461
4778
|
if (mutationsList.some(mutation => mutation.type === 'characterData'))
|
|
4462
4779
|
this.validateSlot();
|
|
4463
4780
|
this.updateDisplayNotificationBadge();
|
|
4781
|
+
this.itemUpdated.emit();
|
|
4464
4782
|
}).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });
|
|
4465
4783
|
}, 0);
|
|
4466
4784
|
}
|
|
@@ -4478,6 +4796,14 @@ const MgMenuItem = class {
|
|
|
4478
4796
|
[`${this.navigationButton}-chevron--rotate`]: this.expanded === true,
|
|
4479
4797
|
} }, index.h("mg-icon", { icon: "chevron-down", size: "small" })))));
|
|
4480
4798
|
}
|
|
4799
|
+
/**
|
|
4800
|
+
* Emit event when component is updated
|
|
4801
|
+
*/
|
|
4802
|
+
componentShouldUpdate() {
|
|
4803
|
+
return index$1.Ue(() => {
|
|
4804
|
+
this.itemUpdated.emit();
|
|
4805
|
+
});
|
|
4806
|
+
}
|
|
4481
4807
|
/**
|
|
4482
4808
|
* Render
|
|
4483
4809
|
* @returns HTML Element
|
|
@@ -4485,9 +4811,9 @@ const MgMenuItem = class {
|
|
|
4485
4811
|
render() {
|
|
4486
4812
|
const getContainerClasses = () => ({
|
|
4487
4813
|
['mg-c-menu-item__collapse-container']: true,
|
|
4488
|
-
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(
|
|
4814
|
+
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu || this.isItemMore) && this.isDirection(Direction.HORIZONTAL),
|
|
4489
4815
|
});
|
|
4490
|
-
return (index.h(index.Host, { key: '
|
|
4816
|
+
return (index.h(index.Host, { key: 'a340655f5b46ed3019e1be29cfade7dfbc480ec2', role: this.isItemMore ? 'presentation' : 'listitem' }, this.displayPopover() ? (index.h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.getPopoverIdentifier() }, this.renderInteractiveElement(), index.h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
4491
4817
|
this.renderInteractiveElement(),
|
|
4492
4818
|
index.h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
4493
4819
|
])));
|
|
@@ -4665,7 +4991,7 @@ const MgMessage = class {
|
|
|
4665
4991
|
let role;
|
|
4666
4992
|
if (!this.noAriaRole)
|
|
4667
4993
|
role = this.variant === 'info' ? 'status' : 'alert';
|
|
4668
|
-
return (index.h("div", { key: '
|
|
4994
|
+
return (index.h("div", { key: '2a2a66325834f5072ee6e89de0bcc40c3e0e6753', id: this.identifier, class: this.classCollection.join(), role: role }, index.h("mg-card", { key: '573448d09a88125eecf6b0c482cc589602238fea', variant: this.variant, "variant-style": "bar-left" }, index.h("span", { key: '81295346d39fdfeda74b9cdab5c468cce52cbc43', class: "mg-c-message__icon" }, index.h("mg-icon", { key: 'b8d655f6cffd963d601b8001f6b066e9e6ca379f', icon: this.getIcon() })), index.h("div", { key: '831938b7c2be97edb8dd37d2f28af6798bb32896', class: "mg-c-message__content" }, index.h("span", { key: '2c2d085285ec3feca97fa046ae038c725d0f05db', class: "mg-c-message__content-slot" }, index.h("slot", { key: '1907d1d60816a5e2d53e6ae87e60f66df253208b' })), this.hasActions && index.h("span", { class: "mg-c-message__content-separator" }), this.hasActions && (index.h("span", { class: "mg-c-message__content-actions-slot" }, index.h("slot", { name: "actions" })))), this.closeButton && (index.h("span", { class: "mg-c-message__close-button" }, index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, index.h("mg-icon", { icon: "cross" })))))));
|
|
4669
4995
|
}
|
|
4670
4996
|
get element() { return index.getElement(this); }
|
|
4671
4997
|
static get watchers() { return {
|
|
@@ -4838,14 +5164,14 @@ const MgModal = class {
|
|
|
4838
5164
|
* @returns HTML Element
|
|
4839
5165
|
*/
|
|
4840
5166
|
render() {
|
|
4841
|
-
return (index.h("div", { key: '
|
|
5167
|
+
return (index.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 }, index.h("mg-card", { key: 'd192af0bfa6105f8ddb43ec73cfffb1d0469aca8' }, index.h("div", { key: '4f4f5b08ce39f20ca4f65686da294487d955ebd4', class: "mg-c-modal__dialog" }, index.h("header", { key: 'fd87c3a17a5b2783f4ffb79d23c6005cbf82af53', class: "mg-c-modal__header" }, this.closeButton && (index.h("span", { class: "mg-c-modal__close-button" }, index.h("mg-button", { identifier: `${this.identifier}-close-button`, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose, ref: (el) => {
|
|
4842
5168
|
if (el !== null) {
|
|
4843
5169
|
// store closeButton Element
|
|
4844
5170
|
this.closeButtonElement = el;
|
|
4845
5171
|
// add close button element to modalFocusableElements when it is render
|
|
4846
5172
|
this.modalFocusableElements.unshift(this.closeButtonElement);
|
|
4847
5173
|
}
|
|
4848
|
-
} }, index.h("mg-icon", { icon: "cross" })))), index.h("h1", { key: '
|
|
5174
|
+
} }, index.h("mg-icon", { icon: "cross" })))), index.h("h1", { key: '363962112d7d1db2f13cf91a7964588c4c2be71f', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (index.h("article", { class: "mg-c-modal__content" }, index.h("slot", { name: "content" }))), this.hasActions && (index.h("footer", { class: "mg-c-modal__footer" }, index.h("slot", { name: "actions" })))))));
|
|
4849
5175
|
}
|
|
4850
5176
|
get element() { return index.getElement(this); }
|
|
4851
5177
|
static get watchers() { return {
|
|
@@ -5147,7 +5473,7 @@ const MgPanel = class {
|
|
|
5147
5473
|
*/
|
|
5148
5474
|
render() {
|
|
5149
5475
|
const headerId = `${this.identifier}-header`;
|
|
5150
|
-
return (index.h("section", { key: '
|
|
5476
|
+
return (index.h("section", { key: '75509a6a7fdba04cea71380d46f5d0b66bbc9602', class: this.classCollection.join(), id: this.identifier }, index.h("mg-card", { key: '8ec07f87babeae31db85b5181d5884119010e8ce' }, index.h("header", { key: '045e43ab54c95691e1c4b758504bffc995f63340', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), index.h("article", { key: '096d93e147c30c6ece4a6a3f5ee3acff05dc5143', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, index.h("slot", { key: '37f2d61903662b519e583eca0ca90c044386e539' })))));
|
|
5151
5477
|
}
|
|
5152
5478
|
get element() { return index.getElement(this); }
|
|
5153
5479
|
static get watchers() { return {
|
|
@@ -7152,7 +7478,7 @@ const MgPopover = class {
|
|
|
7152
7478
|
* @returns HTML Element
|
|
7153
7479
|
*/
|
|
7154
7480
|
render() {
|
|
7155
|
-
return (index.h(index.Host, { key: '
|
|
7481
|
+
return (index.h(index.Host, { key: '2faad932884b3c0a13e42f960470096ad7c2a4e9' }, index.h("slot", { key: '270b328576a6772d54d4cff826f2b7c63a9a6cda' }), index.h("slot", { key: '9fc11feb085c19562bdef1966135edee44799e21', name: "content" })));
|
|
7156
7482
|
}
|
|
7157
7483
|
get element() { return index.getElement(this); }
|
|
7158
7484
|
static get watchers() { return {
|
|
@@ -7205,7 +7531,7 @@ const MgPopoverContent = class {
|
|
|
7205
7531
|
* @returns HTML Element
|
|
7206
7532
|
*/
|
|
7207
7533
|
render() {
|
|
7208
|
-
return (index.h(index.Host, { key: '
|
|
7534
|
+
return (index.h(index.Host, { key: 'e2ec01fc83727038047673eb89fa7a1fc6b90abe' }, index.h("mg-card", { key: '2ba199e78605edc19a6a0ddefb5a6749d80f6119', class: this.classCollection.join() }, this.closeButton && (index.h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { icon: "cross" }))), index.h("div", { key: '1b6275e0da818d3f5606a9a49974f85b2aedda8a', class: "mg-c-popover-content__title" }, index.h("slot", { key: '6205bd6ccfba59e5526388b2f24251f5ff6cb6dc', name: "title" })), index.h("slot", { key: 'f1bc97234ef01af903e1c507bc79805ad252f02e', name: "content" })), index.h("slot", { key: '5f1a1a4fd2b0e86384b2b3d46da2d408fcec2e4e', name: "arrow" })));
|
|
7209
7535
|
}
|
|
7210
7536
|
get element() { return index.getElement(this); }
|
|
7211
7537
|
};
|
|
@@ -7482,7 +7808,7 @@ const MgTabs = class {
|
|
|
7482
7808
|
* @returns HTML Element
|
|
7483
7809
|
*/
|
|
7484
7810
|
render() {
|
|
7485
|
-
return (index.h("div", { key: '
|
|
7811
|
+
return (index.h("div", { key: '6aa138347fc29ccb2ebadc034a50ad6daa61fcee', class: this.classCollection.join() }, index.h("header", { key: 'c5a350bd2e66f3fad27eec61d51dcd7aebd8e5c2', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index$1) => (index.h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index$1), class: {
|
|
7486
7812
|
[`${this.buttonTabBaseClass}`]: true,
|
|
7487
7813
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
7488
7814
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -7577,7 +7903,7 @@ const MgTag = class {
|
|
|
7577
7903
|
* @returns HTML Element
|
|
7578
7904
|
*/
|
|
7579
7905
|
render() {
|
|
7580
|
-
return (index.h("span", { key: '
|
|
7906
|
+
return (index.h("span", { key: 'f107390f5fb47c34faac9de08a08739499d0e409', class: this.classCollection.join() }, index.h("slot", { key: '04b346f71dff32aa32f52b96553154434ba231eb' })));
|
|
7581
7907
|
}
|
|
7582
7908
|
get element() { return index.getElement(this); }
|
|
7583
7909
|
static get watchers() { return {
|
|
@@ -7593,6 +7919,7 @@ var Guard;
|
|
|
7593
7919
|
Guard["FOCUS"] = "focus";
|
|
7594
7920
|
Guard["HOVER_TOOLTIP_ELEMENT"] = "hoverTooltipGuard";
|
|
7595
7921
|
Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
|
|
7922
|
+
Guard["DISABLE_ON_CLICK"] = "disableOnClick";
|
|
7596
7923
|
})(Guard || (Guard = {}));
|
|
7597
7924
|
|
|
7598
7925
|
const mgTooltipCss = ":host{display:inline-block}mg-tooltip-content{font-family:var(--font-family);font-size:var(--font-size);font-weight:200}";
|
|
@@ -7672,7 +7999,7 @@ const MgTooltip = class {
|
|
|
7672
7999
|
*/
|
|
7673
8000
|
this.tooltipMouseListenerAction = (elementGuard, isMouseenter, conditionalGuard) => {
|
|
7674
8001
|
// we mutate elementGuard
|
|
7675
|
-
if (
|
|
8002
|
+
if (![Guard.FOCUS, Guard.DISABLE_ON_CLICK].includes(this.guard)) {
|
|
7676
8003
|
this.guard = elementGuard;
|
|
7677
8004
|
if (!isMouseenter) {
|
|
7678
8005
|
// process action in the next event loop macro task
|
|
@@ -7753,6 +8080,12 @@ const MgTooltip = class {
|
|
|
7753
8080
|
],
|
|
7754
8081
|
});
|
|
7755
8082
|
// Manage tooltipedElement focus/blur events
|
|
8083
|
+
this.tooltipedElement.addEventListener('disabled-change', (event) => {
|
|
8084
|
+
if (event.target.disableOnClick) {
|
|
8085
|
+
this.guard = event.detail ? Guard.DISABLE_ON_CLICK : null;
|
|
8086
|
+
}
|
|
8087
|
+
});
|
|
8088
|
+
// Manage tooltipedElement focus/blur events
|
|
7756
8089
|
this.tooltipedElement.addEventListener('focus', () => {
|
|
7757
8090
|
this.guard = Guard.FOCUS;
|
|
7758
8091
|
this.setDisplay(true);
|
|
@@ -7867,7 +8200,7 @@ const MgTooltip = class {
|
|
|
7867
8200
|
// In this case we wrap the mg-button into a div to enable the tooltip
|
|
7868
8201
|
if (isButton(slotElement)) {
|
|
7869
8202
|
new MutationObserver(mutationList => {
|
|
7870
|
-
if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName))) {
|
|
8203
|
+
if (mutationList.some(mutation => ['aria-disabled', 'disabled'].includes(mutation.attributeName)) && this.guard !== Guard.DISABLE_ON_CLICK) {
|
|
7871
8204
|
this.setMgButtonWrapper(slotElement);
|
|
7872
8205
|
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
7873
8206
|
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
@@ -7892,7 +8225,7 @@ const MgTooltip = class {
|
|
|
7892
8225
|
* @returns HTML Element
|
|
7893
8226
|
*/
|
|
7894
8227
|
render() {
|
|
7895
|
-
return (index.h(index.Host, { key: '
|
|
8228
|
+
return (index.h(index.Host, { key: '1e78ccb946f44e44298b967286535bd5cb74f00d' }, index.h("slot", { key: 'cbc51e25225889f1b151499e98ab903a7daed059' }), index.h("slot", { key: '3e45bf6b40fc00b245f36d1cead2cb2659786ef9', name: "content" })));
|
|
7896
8229
|
}
|
|
7897
8230
|
get element() { return index.getElement(this); }
|
|
7898
8231
|
static get watchers() { return {
|
|
@@ -7920,7 +8253,7 @@ const MgTooltipContent = class {
|
|
|
7920
8253
|
* @returns HTML Element
|
|
7921
8254
|
*/
|
|
7922
8255
|
render() {
|
|
7923
|
-
return (index.h(index.Host, { key: '
|
|
8256
|
+
return (index.h(index.Host, { key: '81cff61f9230149078ace113a6661ae15ab6482e', role: "tooltip" }, index.h("span", { key: '11c2076354834ff3e51055197422726933154540', innerHTML: this.message, class: "mg-tooltip-content__message" }), index.h("slot", { key: 'ce2da739d5ac72a4ae3927a0b528a760f3f6422e', name: "arrow" })));
|
|
7924
8257
|
}
|
|
7925
8258
|
};
|
|
7926
8259
|
MgTooltipContent.style = MgTooltipContentStyle0;
|
|
@@ -7947,6 +8280,7 @@ exports.mg_input_text = MgInputText;
|
|
|
7947
8280
|
exports.mg_input_textarea = MgInputTextarea;
|
|
7948
8281
|
exports.mg_input_title = MgInputTitle;
|
|
7949
8282
|
exports.mg_input_toggle = MgInputToggle;
|
|
8283
|
+
exports.mg_item_more = MgItemMore;
|
|
7950
8284
|
exports.mg_menu = MgMenu;
|
|
7951
8285
|
exports.mg_menu_item = MgMenuItem;
|
|
7952
8286
|
exports.mg_message = MgMessage;
|
|
@@ -7961,4 +8295,4 @@ exports.mg_tag = MgTag;
|
|
|
7961
8295
|
exports.mg_tooltip = MgTooltip;
|
|
7962
8296
|
exports.mg_tooltip_content = MgTooltipContent;
|
|
7963
8297
|
|
|
7964
|
-
//# sourceMappingURL=mg-action-
|
|
8298
|
+
//# sourceMappingURL=mg-action-more_36.cjs.entry.js.map
|