@mgdis/mg-components 5.27.0 → 5.27.2
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-00072168.js} +46 -46
- package/dist/cjs/index-00072168.js.map +1 -0
- package/dist/cjs/{index-7072369e.js → index-7e27c7ae.js} +34 -10
- package/dist/cjs/index-7e27c7ae.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} +513 -179
- 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 +4 -4
- 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-character-left/mg-character-left.js +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +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-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +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 +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.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-textarea/mg-input-textarea.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.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-action-more/mg-action-more.js +3 -3
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.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 +10 -4
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +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-pagination/mg-pagination.js +3 -3
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.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-skip-links/mg-skip-links.js +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 +42 -42
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +20 -16
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-badge2.js +3 -3
- package/dist/components/mg-button2.js +5 -5
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-card2.js +3 -3
- package/dist/components/mg-card2.js.map +1 -1
- package/dist/components/mg-character-left2.js +1 -1
- package/dist/components/mg-details.js +3 -3
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-divider.js +1 -1
- package/dist/components/mg-form.js +4 -4
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon2.js +2 -2
- package/dist/components/mg-illustrated-message.js +5 -5
- package/dist/components/mg-illustrated-message.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +5 -5
- package/dist/components/mg-input-date.js +49 -18
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +7 -7
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +5 -5
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +5 -5
- package/dist/components/mg-input-select2.js +8 -8
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +15 -9
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +8 -8
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-title2.js +3 -3
- package/dist/components/mg-input-title2.js.map +1 -1
- package/dist/components/mg-input-toggle.js +5 -5
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-input2.js +4 -4
- 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-loader.js +3 -3
- package/dist/components/mg-menu-item2.js +30 -8
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-menu.js +1 -1
- package/dist/components/mg-message.js +4 -4
- package/dist/components/mg-message.js.map +1 -1
- package/dist/components/mg-modal.js +8 -8
- package/dist/components/mg-modal.js.map +1 -1
- package/dist/components/mg-pagination2.js +5 -5
- package/dist/components/mg-pagination2.js.map +1 -1
- package/dist/components/mg-panel.js +5 -5
- package/dist/components/mg-panel.js.map +1 -1
- package/dist/components/mg-popover-content2.js +4 -4
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover2.js +4 -4
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-skip-links.js +3 -3
- package/dist/components/mg-tabs.js +7 -7
- package/dist/components/mg-tabs.js.map +1 -1
- package/dist/components/mg-tag.js +4 -4
- 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 +16 -9
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/{index-445fc2a0.js → index-8d5d1bfd.js} +44 -44
- package/dist/esm/index-8d5d1bfd.js.map +1 -0
- package/dist/esm/{index-629a42c7.js → index-e479d5ae.js} +34 -10
- package/dist/esm/index-e479d5ae.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} +501 -168
- 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 +4 -4
- 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-7315d4a6.js +3 -0
- package/dist/mg-components/p-7315d4a6.js.map +1 -0
- package/dist/mg-components/p-8800813b.js +2 -0
- package/dist/mg-components/p-8800813b.js.map +1 -0
- package/dist/mg-components/{p-fe347f48.entry.js → p-99e2f42a.entry.js} +2 -2
- package/dist/mg-components/p-f9ac8927.entry.js +2 -0
- package/dist/mg-components/p-f9ac8927.entry.js.map +1 -0
- 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 +25 -25
- 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-99e2f42a.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-7e27c7ae.js');
|
|
6
|
+
const index$1 = require('./index-00072168.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
|
|
|
@@ -67,7 +79,7 @@ const MgActionMore = class {
|
|
|
67
79
|
************/
|
|
68
80
|
this.name = 'mg-action-more';
|
|
69
81
|
this.classBase = 'mg-c-action-more';
|
|
70
|
-
this.mgPopoverIdentifier = index$1.
|
|
82
|
+
this.mgPopoverIdentifier = index$1.Me(this.name);
|
|
71
83
|
/************
|
|
72
84
|
* Methods *
|
|
73
85
|
***********/
|
|
@@ -149,12 +161,12 @@ const MgActionMore = class {
|
|
|
149
161
|
const buttonLabel = this.button.label || this.messages.label;
|
|
150
162
|
const buttonContent = [buttonLabel];
|
|
151
163
|
if (!this.button.isIcon && this.displayChevron) {
|
|
152
|
-
buttonContent.push(index.h("span", {
|
|
164
|
+
buttonContent.push(index.h("span", { class: {
|
|
153
165
|
[`${this.classBase}__chevron`]: true,
|
|
154
166
|
[`${this.classBase}__chevron--rotate`]: this.expanded === true,
|
|
155
|
-
} }, index.h("mg-icon", {
|
|
167
|
+
} }, index.h("mg-icon", { icon: "chevron-down", size: "small" })));
|
|
156
168
|
}
|
|
157
|
-
return (index.h(index.Host, { key: '
|
|
169
|
+
return (index.h(index.Host, { key: '3833ffe89499015c991ac366c5bb87283948962b', "data-mg-popover-guard": this.mgPopoverIdentifier }, index.h("span", { key: '3393bfd576f5bbef7570090a5813a4eecc944559', class: "mg-action-more" }, index.h("mg-popover", { key: '6c589e9efbbfef4adba6f2c59eb3f562c621daf1', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, index.h("mg-button", { key: '485538eb6f660de92c372ebd395e18ff7ef66c96', 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({ key: 'd385d7c69f118b8f20d59547357dad7d8a56766d' }, this.icon)), !this.button.isIcon && buttonContent), index.h("div", { key: '553f7704a5fc0b1a89062ce234607296d8bf53f2', slot: "content" }, index.h("mg-menu", { key: '4a161502b2d1dec2b17cd7c44cd492ec745cb7dd', 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
|
|
@@ -191,7 +203,7 @@ const MgBadge = class {
|
|
|
191
203
|
this.label = undefined;
|
|
192
204
|
this.variant = variants$5[0];
|
|
193
205
|
this.outline = undefined;
|
|
194
|
-
this.classCollection = new index$1.
|
|
206
|
+
this.classCollection = new index$1.Oe(['mg-c-badge']);
|
|
195
207
|
}
|
|
196
208
|
validateValue(newValue) {
|
|
197
209
|
if (/^(\d+\+*|[?*!a-z])$/i.exec(`${newValue}`) === null) {
|
|
@@ -199,7 +211,7 @@ const MgBadge = class {
|
|
|
199
211
|
}
|
|
200
212
|
}
|
|
201
213
|
validateLabel(newValue) {
|
|
202
|
-
if (!index$1.
|
|
214
|
+
if (!index$1.Ne(newValue)) {
|
|
203
215
|
throw new Error('<mg-badge> prop "label" is required.');
|
|
204
216
|
}
|
|
205
217
|
}
|
|
@@ -310,7 +322,7 @@ const MgButton = class {
|
|
|
310
322
|
this.isIcon = false;
|
|
311
323
|
this.disableOnClick = false;
|
|
312
324
|
this.loading = false;
|
|
313
|
-
this.classCollection = new index$1.
|
|
325
|
+
this.classCollection = new index$1.Oe(['mg-c-button']);
|
|
314
326
|
}
|
|
315
327
|
validateVariant(newValue, oldValue) {
|
|
316
328
|
if (!variants$4.includes(newValue)) {
|
|
@@ -369,7 +381,7 @@ const MgButton = class {
|
|
|
369
381
|
this.validateFullWidth(this.fullWidth);
|
|
370
382
|
if (this.isIcon) {
|
|
371
383
|
this.classCollection.add(`mg-c-button--icon`);
|
|
372
|
-
if (!index$1.
|
|
384
|
+
if (!index$1.Ne(this.label)) {
|
|
373
385
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
374
386
|
}
|
|
375
387
|
}
|
|
@@ -381,7 +393,7 @@ const MgButton = class {
|
|
|
381
393
|
* Add listners
|
|
382
394
|
*/
|
|
383
395
|
componentDidLoad() {
|
|
384
|
-
index$1.
|
|
396
|
+
index$1.Ce(() => {
|
|
385
397
|
var _a;
|
|
386
398
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
387
399
|
// submit buttons should trigger form submition;
|
|
@@ -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", { key: '543718fe45ad3e1901c4ef0c39b98705aa9fd64e', icon: "loader", spin: true }), index.h("div", { key: '21bc8c1a14f93db8b2373864a18da5c651e1ac4d', class: "mg-c-button__content" }, index.h("slot", { key: 'd16d710b4cb94ec1b7e3dfee2d4a70ee059528b4' })))));
|
|
402
414
|
}
|
|
403
415
|
get element() { return index.getElement(this); }
|
|
404
416
|
static get watchers() { return {
|
|
@@ -440,7 +452,7 @@ const MgCard = class {
|
|
|
440
452
|
};
|
|
441
453
|
this.variant = undefined;
|
|
442
454
|
this.variantStyle = undefined;
|
|
443
|
-
this.classCollection = new index$1.
|
|
455
|
+
this.classCollection = new index$1.Oe([this.classBase]);
|
|
444
456
|
}
|
|
445
457
|
validateVariant(newValue, oldValue) {
|
|
446
458
|
if (newValue && !variants$3.includes(newValue))
|
|
@@ -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: 'b786a9ff3b706dcb24f6b3218feef97e284e2b9a', class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && index.h("span", { key: '11a3b421c49864667832919e6d2cbe9ea19f9344', class: "mg-c-card__bar" }), index.h("slot", { key: '7421932644500c619d34cbe003a0f0bb50b612a7' })));
|
|
482
494
|
}
|
|
483
495
|
static get watchers() { return {
|
|
484
496
|
"variant": ["validateVariant"],
|
|
@@ -517,7 +529,7 @@ const MgCharacterLeft = class {
|
|
|
517
529
|
* @returns HTML Element
|
|
518
530
|
*/
|
|
519
531
|
render() {
|
|
520
|
-
return (index.h("span", { key: '
|
|
532
|
+
return (index.h("span", { key: 'd67db2514f27a2c0de9c187036f8f7e192761ce2', id: this.identifier, "aria-live": "polite" }, index.h("span", { key: 'e0622c110944075e1d659347965b20a9bfb5ebac', "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), index.h("span", { key: '82a7deaf6f6f2ad32a8d2cfe57787b2b7a20fd4b', class: "mg-u-visually-hidden" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
|
|
521
533
|
}
|
|
522
534
|
get element() { return index.getElement(this); }
|
|
523
535
|
static get watchers() { return {
|
|
@@ -545,7 +557,7 @@ const MgDetails = class {
|
|
|
545
557
|
this.expanded = false;
|
|
546
558
|
}
|
|
547
559
|
validateTitles(newValue) {
|
|
548
|
-
if (!index$1.
|
|
560
|
+
if (!index$1.Ne(newValue)) {
|
|
549
561
|
throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
|
|
550
562
|
}
|
|
551
563
|
}
|
|
@@ -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: '9c629e03b5286afb8b9139aa4e182f10a1005c81', class: "mg-c-details", onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, index.h("summary", { key: 'a525137281cb20fe8b74db56fe0e6f4f59427e4d' }, index.h("slot", { key: '7fb96692cfa339e904894bbddffd2211ff7741b5', name: "summary" }), index.h("span", { key: 'b322eb9e02173a24bcff738d6f1333ce6ab68912', class: "mg-c-details__toggle" }, index.h("mg-icon", { key: 'fd952a2abf6b689360faa0ef5219eb400b1a6f61', icon: "chevron-up", size: "small", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), index.h("span", { key: '10b0a8a350f857296ae5600de5f68a9b528a3739', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), index.h("div", { key: 'e54fe3d881a04ccbb3d394b0492f6ab906eac1f8', class: "mg-c-details__details" }, index.h("slot", { key: 'ae05e78c61d9fa8e1d90aa58ac7d6ce8862128ff', name: "details" }))));
|
|
571
583
|
}
|
|
572
584
|
static get watchers() { return {
|
|
573
585
|
"toggleClosed": ["validateTitles"],
|
|
@@ -590,7 +602,7 @@ const MgDivider = class {
|
|
|
590
602
|
* @returns HTML Element
|
|
591
603
|
*/
|
|
592
604
|
render() {
|
|
593
|
-
return (index.h("div", { key: '
|
|
605
|
+
return (index.h("div", { key: '92413bf42dc057ea1dfd645b4d619a7f180e5aca', class: {
|
|
594
606
|
'mg-c-divider': true,
|
|
595
607
|
'mg-c-divider--full': this.size === 'full',
|
|
596
608
|
} }));
|
|
@@ -703,7 +715,7 @@ const MgForm = class {
|
|
|
703
715
|
}
|
|
704
716
|
});
|
|
705
717
|
};
|
|
706
|
-
this.identifier = index$1.
|
|
718
|
+
this.identifier = index$1.Me('mg-form');
|
|
707
719
|
this.name = this.identifier;
|
|
708
720
|
this.readonly = false;
|
|
709
721
|
this.requiredMessage = undefined;
|
|
@@ -712,7 +724,7 @@ const MgForm = class {
|
|
|
712
724
|
this.disabled = false;
|
|
713
725
|
this.valid = undefined;
|
|
714
726
|
this.invalid = undefined;
|
|
715
|
-
this.classCollection = new index$1.
|
|
727
|
+
this.classCollection = new index$1.Oe(['mg-c-form']);
|
|
716
728
|
this.requiredMessageText = undefined;
|
|
717
729
|
}
|
|
718
730
|
validateRequiredMessage(newValue) {
|
|
@@ -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: '498fe7564261b0aad99bab2686a6f0f4624785cc', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && index.h("p", { key: 'd0d0f1f6373eff660de65104afb3ba40835a58e3', innerHTML: this.requiredMessageText }), index.h("slot", { key: '9e98e1b0fda2a8b69f8efb8bacccb6cd1173ba4f' }), !this.readonly && !this.disabled && index.h("slot", { key: '083f5490c17548defa713bb697b731b02fad9198', name: "actions" })));
|
|
798
810
|
}
|
|
799
811
|
get element() { return index.getElement(this); }
|
|
800
812
|
static get watchers() { return {
|
|
@@ -853,7 +865,7 @@ const MgIcon = class {
|
|
|
853
865
|
this.variant = undefined;
|
|
854
866
|
this.variantStyle = undefined;
|
|
855
867
|
this.spin = false;
|
|
856
|
-
this.classCollection = new index$1.
|
|
868
|
+
this.classCollection = new index$1.Oe(['mg-c-icon']);
|
|
857
869
|
}
|
|
858
870
|
validateIcon(newValue, oldValue) {
|
|
859
871
|
if (!Object.keys(icons).includes(newValue))
|
|
@@ -952,7 +964,7 @@ const MgIllustratedMessage = class {
|
|
|
952
964
|
componentDidLoad() {
|
|
953
965
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
954
966
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
955
|
-
if (!index$1.
|
|
967
|
+
if (!index$1.De(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
956
968
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
957
969
|
}
|
|
958
970
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -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: '042f4e43323c30176c3d2b4d596d55a25a4382b7', 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: 'ebda1c1ca89ac40ff69820f96c10c0515ab9590a', 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: 'aa65a2f9ea28bba75b7b7ad8c0816ea9efe4c180', name: "illustration" })), index.h("div", { key: '8173740ede93f2800ef9de9645fd4cc05ee66e3b', class: "mg-c-illustrated-message__slots" }, index.h("div", { key: '970bba9668cd3ab806399cee83e6a8c9648adff0', class: "mg-c-illustrated-message__title" }, index.h("slot", { key: '590d7970e1845e48658ae6287fdf91e782fcfe57', name: "title" })), index.h("div", { key: '0c49e0842c7d12e6810fbf95404d8a66f7139320', class: "mg-c-illustrated-message__details" }, index.h("slot", { key: 'efec02b5d379d2a042591e4a02896691be8d67cb', name: "details" })))));
|
|
975
987
|
}
|
|
976
988
|
get element() { return index.getElement(this); }
|
|
977
989
|
};
|
|
@@ -1052,7 +1064,7 @@ const MgInput = class {
|
|
|
1052
1064
|
this.isVerticalList = false;
|
|
1053
1065
|
}
|
|
1054
1066
|
watchIdentifier(newValue) {
|
|
1055
|
-
if (!index$1.
|
|
1067
|
+
if (!index$1.Ne(newValue)) {
|
|
1056
1068
|
throw new Error('<mg-input> prop "identifier" is required.');
|
|
1057
1069
|
}
|
|
1058
1070
|
else {
|
|
@@ -1137,7 +1149,7 @@ const MgInput = class {
|
|
|
1137
1149
|
*/
|
|
1138
1150
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1139
1151
|
watchLabel() {
|
|
1140
|
-
if (!index$1.
|
|
1152
|
+
if (!index$1.Ne(this.label)) {
|
|
1141
1153
|
throw new Error('<mg-input> prop "label" is required.');
|
|
1142
1154
|
}
|
|
1143
1155
|
else {
|
|
@@ -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: '7a344b1c43f967771a6a3460adf83d60aa7fcc7e', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, index.h("div", { key: 'e88dbd6ad81f94b6ab3fdd2d73986b06f05f233d', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, index.h("slot", { key: '12f3e23bd14c710ef5ecad3dedeb4f3d058c49d7', name: this.slotLabel }), this.tooltip && !this.isReadonly && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), index.h("div", { key: 'd7adace17ac5d68597dd5ece286ec04e405abccd', 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" }),
|
|
@@ -1433,7 +1445,7 @@ const MgInputCheckbox = class {
|
|
|
1433
1445
|
* Method to update searchResults
|
|
1434
1446
|
*/
|
|
1435
1447
|
this.updateSearchResults = () => {
|
|
1436
|
-
this.searchResults = this.checkboxItems.filter(item => index$1.
|
|
1448
|
+
this.searchResults = this.checkboxItems.filter(item => index$1.Ue(item.title).includes(index$1.Ue(this.searchValue)));
|
|
1437
1449
|
};
|
|
1438
1450
|
/**
|
|
1439
1451
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1507,7 +1519,7 @@ const MgInputCheckbox = class {
|
|
|
1507
1519
|
this.helpText = undefined;
|
|
1508
1520
|
this.valid = undefined;
|
|
1509
1521
|
this.invalid = undefined;
|
|
1510
|
-
this.classCollection = new index$1.
|
|
1522
|
+
this.classCollection = new index$1.Oe([this.baseClassName, classFieldset]);
|
|
1511
1523
|
this.errorMessage = undefined;
|
|
1512
1524
|
this.checkboxItems = [];
|
|
1513
1525
|
this.displaySearchInput = undefined;
|
|
@@ -1615,7 +1627,7 @@ const MgInputCheckbox = class {
|
|
|
1615
1627
|
if (typeof valid !== 'boolean') {
|
|
1616
1628
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean');
|
|
1617
1629
|
}
|
|
1618
|
-
else if (!index$1.
|
|
1630
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
1619
1631
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string');
|
|
1620
1632
|
}
|
|
1621
1633
|
else {
|
|
@@ -1728,7 +1740,7 @@ const MgInputCheckbox = class {
|
|
|
1728
1740
|
* @returns HTML Element
|
|
1729
1741
|
*/
|
|
1730
1742
|
render() {
|
|
1731
|
-
return (index.h("mg-input", { key: '
|
|
1743
|
+
return (index.h("mg-input", { key: 'b695390b3a9525ba849c4442c6c6b0e643ec7348', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonlyValue: this.value.filter(({ value }) => value).map(({ title }) => title), tooltip: !this.readonly ? this.tooltip : undefined, tooltipPosition: this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, this.type === 'checkbox' || this.readonly ? (index.h(MgInputCheckboxList, { checkboxes: this.checkboxItems, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name, invalid: this.invalid })) : (this.renderCheckboxMulti())));
|
|
1732
1744
|
}
|
|
1733
1745
|
get element() { return index.getElement(this); }
|
|
1734
1746
|
static get watchers() { return {
|
|
@@ -1843,10 +1855,10 @@ const MgInputCheckboxPaginated = class {
|
|
|
1843
1855
|
* @returns HTML Element
|
|
1844
1856
|
*/
|
|
1845
1857
|
render() {
|
|
1846
|
-
const getText = (checkboxes) => (index.h("em", { key: '
|
|
1858
|
+
const getText = (checkboxes) => (index.h("em", { key: '0a1e9d02d508a27fda294b25d835f44b73d4c443', class: "mg-c-input__section-header-title-label" }, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`));
|
|
1847
1859
|
const [from, to] = this.getFromToIndexes();
|
|
1848
1860
|
const itemsContainerId = `items-${this.sectionKind}-container`;
|
|
1849
|
-
return (index.h(index.Host, { key: '
|
|
1861
|
+
return (index.h(index.Host, { key: '71c72a433b984a609046fdce7cf4c6130c8e1ada', hidden: this.checkboxes.length < 1 }, index.h("div", { key: 'b2bd73e01db4db0edca92c5e7fc64edfda9d3b6d', class: "mg-c-input__section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (index.h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, index.h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), index.h("span", { class: "mg-c-input__section-header-title" }, getText(this.checkboxes)))) : (index.h("p", { class: "mg-c-input__section-header-title mg-c-input__section-header-title--static" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (index.h("mg-tooltip", { key: 'dcc6b405032e5b59cc748f1cbc87ab087c37cc31', class: "mg-c-input__section-header-tootlip", message: this.messages.tooltip, "data-popper-strategy": "absolute" }, index.h("mg-button", { key: 'a1d38aedc328d81ac8139f70e8564538f7e4b4c4', variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (index.h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), index.h("div", { key: 'd9913a7ceeac5d91f0c58e5021a88f1bf37b1387', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__section-content" }, index.h(MgInputCheckboxList, { key: 'f262b871762d3c3f3e9828ed04cd735a89f9f27d', checkboxes: this.getArrayRange(this.checkboxes, from, to), displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, disabled: this.disabled, name: this.name, invalid: this.invalid }))));
|
|
1850
1862
|
}
|
|
1851
1863
|
static get watchers() { return {
|
|
1852
1864
|
"checkboxes": ["validateCheckboxes"],
|
|
@@ -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.Ne(value) && index$1.ge.test(value);
|
|
1875
1894
|
/**
|
|
1876
1895
|
* Format help text to display
|
|
1877
1896
|
* @param helpText - help text format
|
|
@@ -1879,10 +1898,10 @@ const MgInputDate = class {
|
|
|
1879
1898
|
*/
|
|
1880
1899
|
this.formatHelpText = (helpText) => {
|
|
1881
1900
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
1882
|
-
let text = index$1.
|
|
1901
|
+
let text = index$1.Ne(helpText) ? helpText : this.messages.input.date.helpText;
|
|
1883
1902
|
if (text.includes(defaultHelpTextVariable))
|
|
1884
1903
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
1885
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}', index$1.
|
|
1904
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', index$1.pe(index$1.ze(new Date('2023-12-24')), this.systemLocale));
|
|
1886
1905
|
};
|
|
1887
1906
|
/**
|
|
1888
1907
|
* Handle input event
|
|
@@ -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
|
}
|
|
@@ -1954,8 +1993,8 @@ const MgInputDate = class {
|
|
|
1954
1993
|
// min, max & minMax
|
|
1955
1994
|
else if ([InputError$1.MIN, InputError$1.MAX, InputError$1.MINMAX].includes(inputError)) {
|
|
1956
1995
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
1957
|
-
.replace('{min}', index$1.
|
|
1958
|
-
.replace('{max}', index$1.
|
|
1996
|
+
.replace('{min}', index$1.pe(this.min, this.systemLocale))
|
|
1997
|
+
.replace('{max}', index$1.pe(this.max, this.systemLocale));
|
|
1959
1998
|
}
|
|
1960
1999
|
// wrong date format
|
|
1961
2000
|
// element.validity.badInput is default error message
|
|
@@ -1969,7 +2008,7 @@ const MgInputDate = class {
|
|
|
1969
2008
|
* @returns translated html pattern
|
|
1970
2009
|
*/
|
|
1971
2010
|
this.renderPattern = () => {
|
|
1972
|
-
let patternLocal = index$1.
|
|
2011
|
+
let patternLocal = index$1.We(this.systemLocale);
|
|
1973
2012
|
for (const key in this.messages.input.date.pattern) {
|
|
1974
2013
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
1975
2014
|
}
|
|
@@ -1984,26 +2023,30 @@ 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';
|
|
1991
2030
|
this.helpText = undefined;
|
|
1992
2031
|
this.valid = undefined;
|
|
1993
2032
|
this.invalid = undefined;
|
|
1994
|
-
this.classCollection = new index$1.
|
|
2033
|
+
this.classCollection = new index$1.Oe(['mg-c-input--date']);
|
|
1995
2034
|
this.errorMessage = undefined;
|
|
1996
2035
|
}
|
|
1997
2036
|
validateValue(newValue) {
|
|
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.Ne(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
|
}
|
|
@@ -2052,7 +2095,7 @@ const MgInputDate = class {
|
|
|
2052
2095
|
if (typeof valid !== 'boolean') {
|
|
2053
2096
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean');
|
|
2054
2097
|
}
|
|
2055
|
-
else if (!index$1.
|
|
2098
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
2056
2099
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string');
|
|
2057
2100
|
}
|
|
2058
2101
|
else {
|
|
@@ -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: 'f38d79cb71311149b4d15885b65cd8f025dde15d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: index$1.pe(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, index.h("input", { key: '67bf6f0ad58ee1a506ffd0d3d41d5954db68465c', type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
2110
2153
|
if (el !== null)
|
|
2111
2154
|
this.input = el;
|
|
2112
2155
|
} })));
|
|
@@ -2237,9 +2280,9 @@ const MgInputNumeric = class {
|
|
|
2237
2280
|
this.formatValue = (value) => {
|
|
2238
2281
|
switch (this.format) {
|
|
2239
2282
|
case 'number':
|
|
2240
|
-
return index$1.
|
|
2283
|
+
return index$1.we(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2241
2284
|
case 'currency':
|
|
2242
|
-
return index$1.
|
|
2285
|
+
return index$1.qe(value, this.locale, this.currency);
|
|
2243
2286
|
case 'none':
|
|
2244
2287
|
return value.toString();
|
|
2245
2288
|
}
|
|
@@ -2276,7 +2319,7 @@ const MgInputNumeric = class {
|
|
|
2276
2319
|
this.decimalLength = 2;
|
|
2277
2320
|
this.valid = undefined;
|
|
2278
2321
|
this.invalid = undefined;
|
|
2279
|
-
this.classCollection = new index$1.
|
|
2322
|
+
this.classCollection = new index$1.Oe(['mg-c-input--numeric']);
|
|
2280
2323
|
this.errorMessage = undefined;
|
|
2281
2324
|
this.hasFocus = undefined;
|
|
2282
2325
|
}
|
|
@@ -2372,7 +2415,7 @@ const MgInputNumeric = class {
|
|
|
2372
2415
|
if (typeof valid !== 'boolean') {
|
|
2373
2416
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean');
|
|
2374
2417
|
}
|
|
2375
|
-
else if (!index$1.
|
|
2418
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
2376
2419
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string');
|
|
2377
2420
|
}
|
|
2378
2421
|
else {
|
|
@@ -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: '52a1e1cc7a6f16290a62c258e099cd8c0cc30567', 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: 'a36bbe191ff0fcacbf7bd459ad7d743a623eba44', 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: '6b6ae5ae8aa3de2c1d0360c2ddef962a7b3e6bc0', name: "append-input" })));
|
|
2474
2517
|
}
|
|
2475
2518
|
get element() { return index.getElement(this); }
|
|
2476
2519
|
static get watchers() { return {
|
|
@@ -2564,7 +2607,7 @@ const MgInputPassword = class {
|
|
|
2564
2607
|
this.helpText = undefined;
|
|
2565
2608
|
this.valid = undefined;
|
|
2566
2609
|
this.invalid = undefined;
|
|
2567
|
-
this.classCollection = new index$1.
|
|
2610
|
+
this.classCollection = new index$1.Oe(['mg-c-input--password']);
|
|
2568
2611
|
this.errorMessage = undefined;
|
|
2569
2612
|
this.displayPassword = false;
|
|
2570
2613
|
}
|
|
@@ -2622,7 +2665,7 @@ const MgInputPassword = class {
|
|
|
2622
2665
|
if (typeof valid !== 'boolean') {
|
|
2623
2666
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean');
|
|
2624
2667
|
}
|
|
2625
|
-
else if (!index$1.
|
|
2668
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
2626
2669
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string');
|
|
2627
2670
|
}
|
|
2628
2671
|
else {
|
|
@@ -2668,10 +2711,10 @@ const MgInputPassword = class {
|
|
|
2668
2711
|
* @returns HTML Element
|
|
2669
2712
|
*/
|
|
2670
2713
|
render() {
|
|
2671
|
-
return (index.h("mg-input", { key: '
|
|
2714
|
+
return (index.h("mg-input", { key: '39c2a1a17b4b64cb79ed6ca7036dd304ed01a8e6', 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: 'd85a4240b6d178cde418ee72164f337c4986aeff', class: "mg-c-input__input-group" }, index.h("input", { key: '2caccd24026632f5e65dd4cf12914bf71ca656d3', 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: '59bd6c94c412eb8bcd5ece82e569e7df6fadaf9a', 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: '22db9c43220335f258b8fa5978cb66a5d4c14c61', icon: this.displayPassword ? 'eye-slash' : 'eye' })))));
|
|
2675
2718
|
}
|
|
2676
2719
|
get element() { return index.getElement(this); }
|
|
2677
2720
|
static get watchers() { return {
|
|
@@ -2769,7 +2812,7 @@ const MgInputRadio = class {
|
|
|
2769
2812
|
this.helpText = undefined;
|
|
2770
2813
|
this.valid = undefined;
|
|
2771
2814
|
this.invalid = undefined;
|
|
2772
|
-
this.classCollection = new index$1.
|
|
2815
|
+
this.classCollection = new index$1.Oe(['mg-c-input--radio', classFieldset]);
|
|
2773
2816
|
this.errorMessage = undefined;
|
|
2774
2817
|
this.options = undefined;
|
|
2775
2818
|
}
|
|
@@ -2782,7 +2825,7 @@ const MgInputRadio = class {
|
|
|
2782
2825
|
throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
|
|
2783
2826
|
}
|
|
2784
2827
|
// String array
|
|
2785
|
-
else if (index$1.
|
|
2828
|
+
else if (index$1.Fe(newValue)) {
|
|
2786
2829
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
2787
2830
|
}
|
|
2788
2831
|
// Object array
|
|
@@ -2841,7 +2884,7 @@ const MgInputRadio = class {
|
|
|
2841
2884
|
if (typeof valid !== 'boolean') {
|
|
2842
2885
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean');
|
|
2843
2886
|
}
|
|
2844
|
-
else if (!index$1.
|
|
2887
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
2845
2888
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string');
|
|
2846
2889
|
}
|
|
2847
2890
|
else {
|
|
@@ -2890,7 +2933,7 @@ const MgInputRadio = class {
|
|
|
2890
2933
|
*/
|
|
2891
2934
|
render() {
|
|
2892
2935
|
var _a;
|
|
2893
|
-
return (index.h("mg-input", { key: '
|
|
2936
|
+
return (index.h("mg-input", { key: 'a987bc86a4bf97aead796cd7c91110cc0e3c90df', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString(), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, index.h("ul", { key: 'e5e249a744ecb1f09cdbe7f9ec9d8f44b8b20ece', class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index$1) => (index.h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, index.h("input", { type: "radio", id: this.identifier + '_' + index$1, name: this.identifier, value: index$1, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index$1].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
2894
2937
|
if (el !== null)
|
|
2895
2938
|
this.inputs[index$1] = el;
|
|
2896
2939
|
} }), index.h("label", { htmlFor: this.identifier + '_' + index$1 }, input.title)))))));
|
|
@@ -2988,7 +3031,7 @@ const MgInputSelect = class {
|
|
|
2988
3031
|
if (this.input.value === '') {
|
|
2989
3032
|
this.setValue(null);
|
|
2990
3033
|
}
|
|
2991
|
-
else if (index$1.
|
|
3034
|
+
else if (index$1.Fe(this.items) && this.items.includes(this.input.value)) {
|
|
2992
3035
|
this.setValue(this.input.value);
|
|
2993
3036
|
}
|
|
2994
3037
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3062,7 +3105,7 @@ const MgInputSelect = class {
|
|
|
3062
3105
|
this.helpText = undefined;
|
|
3063
3106
|
this.valid = undefined;
|
|
3064
3107
|
this.invalid = undefined;
|
|
3065
|
-
this.classCollection = new index$1.
|
|
3108
|
+
this.classCollection = new index$1.Oe(['mg-c-input--select']);
|
|
3066
3109
|
this.errorMessage = undefined;
|
|
3067
3110
|
this.options = undefined;
|
|
3068
3111
|
this.valueExist = undefined;
|
|
@@ -3070,7 +3113,7 @@ const MgInputSelect = class {
|
|
|
3070
3113
|
}
|
|
3071
3114
|
validateValue(newValue) {
|
|
3072
3115
|
var _a, _b;
|
|
3073
|
-
if (index$1.
|
|
3116
|
+
if (index$1.Fe(this.items) && typeof newValue === 'string') {
|
|
3074
3117
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
|
|
3075
3118
|
}
|
|
3076
3119
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3087,7 +3130,7 @@ const MgInputSelect = class {
|
|
|
3087
3130
|
this.options = [];
|
|
3088
3131
|
}
|
|
3089
3132
|
// String array
|
|
3090
|
-
else if (index$1.
|
|
3133
|
+
else if (index$1.Fe(newValue)) {
|
|
3091
3134
|
if (typeof this.value === 'string')
|
|
3092
3135
|
this.valueExist = newValue.includes(this.value);
|
|
3093
3136
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3159,7 +3202,7 @@ const MgInputSelect = class {
|
|
|
3159
3202
|
if (typeof valid !== 'boolean') {
|
|
3160
3203
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean');
|
|
3161
3204
|
}
|
|
3162
|
-
else if (!index$1.
|
|
3205
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
3163
3206
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string');
|
|
3164
3207
|
}
|
|
3165
3208
|
else {
|
|
@@ -3212,11 +3255,11 @@ const MgInputSelect = class {
|
|
|
3212
3255
|
* @returns HTML Element
|
|
3213
3256
|
*/
|
|
3214
3257
|
render() {
|
|
3215
|
-
return (index.h("mg-input", { key: '
|
|
3258
|
+
return (index.h("mg-input", { key: 'b6e431b881062928dfff44b35b40e2c16a8c56fc', 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("select", { key: '964162aae800e85cf9801c67c264736061fd80c6', class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
3216
3259
|
if (el !== null)
|
|
3217
3260
|
this.input = el;
|
|
3218
3261
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
3219
|
-
index.h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => isOptGroup(option) ? (index.h("optgroup", { label: option.group, key: option.group }, option.options.map(this.renderOption))) : (isOption$1(option) && this.renderOption(option))))));
|
|
3262
|
+
index.h("option", { key: '9c24f8983858810541a0a626a5705ac9d05e26e0', value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => isOptGroup(option) ? (index.h("optgroup", { label: option.group, key: option.group }, option.options.map(this.renderOption))) : (isOption$1(option) && this.renderOption(option))))));
|
|
3220
3263
|
}
|
|
3221
3264
|
get element() { return index.getElement(this); }
|
|
3222
3265
|
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) {
|
|
@@ -3265,7 +3314,7 @@ const MgInputText = class {
|
|
|
3265
3314
|
*/
|
|
3266
3315
|
this.handleFocus = () => {
|
|
3267
3316
|
this.classCollection.add(this.classFocus);
|
|
3268
|
-
this.classCollection = new index$1.
|
|
3317
|
+
this.classCollection = new index$1.Oe(this.classCollection.classes);
|
|
3269
3318
|
};
|
|
3270
3319
|
/**
|
|
3271
3320
|
* Handle blur event
|
|
@@ -3273,7 +3322,7 @@ const MgInputText = class {
|
|
|
3273
3322
|
this.handleBlur = () => {
|
|
3274
3323
|
// Manage focus
|
|
3275
3324
|
this.classCollection.delete(this.classFocus);
|
|
3276
|
-
this.classCollection = new index$1.
|
|
3325
|
+
this.classCollection = new index$1.Oe(this.classCollection.classes);
|
|
3277
3326
|
// Display Error
|
|
3278
3327
|
this.handlerInProgress = Handler.BLUR;
|
|
3279
3328
|
this.displayError().finally(() => {
|
|
@@ -3348,7 +3397,7 @@ const MgInputText = class {
|
|
|
3348
3397
|
this.helpText = undefined;
|
|
3349
3398
|
this.valid = undefined;
|
|
3350
3399
|
this.invalid = undefined;
|
|
3351
|
-
this.classCollection = new index$1.
|
|
3400
|
+
this.classCollection = new index$1.Oe(['mg-c-input--text']);
|
|
3352
3401
|
this.errorMessage = undefined;
|
|
3353
3402
|
}
|
|
3354
3403
|
handleValue(newValue) {
|
|
@@ -3399,7 +3448,7 @@ const MgInputText = class {
|
|
|
3399
3448
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3400
3449
|
}
|
|
3401
3450
|
validatePattern(newValue) {
|
|
3402
|
-
if (newValue !== undefined && !(index$1.
|
|
3451
|
+
if (newValue !== undefined && !(index$1.Ne(this.pattern) && index$1.Ne(this.patternErrorMessage))) {
|
|
3403
3452
|
throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3404
3453
|
}
|
|
3405
3454
|
}
|
|
@@ -3429,7 +3478,7 @@ const MgInputText = class {
|
|
|
3429
3478
|
if (typeof valid !== 'boolean') {
|
|
3430
3479
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
|
|
3431
3480
|
}
|
|
3432
|
-
else if (!index$1.
|
|
3481
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
3433
3482
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
|
|
3434
3483
|
}
|
|
3435
3484
|
else {
|
|
@@ -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: 'ee9b290a3c97af6c264b37958c3a6123d516f391', 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: 'e348db67a88f9941c549cb190aaca88c93aac54c', 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", { key: 'dfe0ce7e271c40d4da20f00b35ad4fe104e08c91', icon: this.icon }), index.h("input", { key: '451af2cff19f47d9b9d3de824546324b6bfaf235', 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", { key: '387530d84dd29575c5e8985ad40211e490bb04e4', id: this.datalistId }, this.datalistoptions.map(option => (index.h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (index.h("mg-character-left", { key: 'e0278d4295d5c923f21f617bbf37ee09bd907b54', identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), index.h("slot", { key: '3d896e5ad21380c04c58fe925b8186e9f0a9207b', name: "append-input" })));
|
|
3494
3543
|
}
|
|
3495
3544
|
get element() { return index.getElement(this); }
|
|
3496
3545
|
static get watchers() { return {
|
|
@@ -3538,7 +3587,7 @@ const MgInputTextarea = class {
|
|
|
3538
3587
|
*/
|
|
3539
3588
|
this.handleFocus = () => {
|
|
3540
3589
|
this.classCollection.add(this.classFocus);
|
|
3541
|
-
this.classCollection = new index$1.
|
|
3590
|
+
this.classCollection = new index$1.Oe(this.classCollection.classes);
|
|
3542
3591
|
};
|
|
3543
3592
|
/**
|
|
3544
3593
|
* Handle blur event
|
|
@@ -3546,7 +3595,7 @@ const MgInputTextarea = class {
|
|
|
3546
3595
|
this.handleBlur = () => {
|
|
3547
3596
|
// Manage focus
|
|
3548
3597
|
this.classCollection.delete(this.classFocus);
|
|
3549
|
-
this.classCollection = new index$1.
|
|
3598
|
+
this.classCollection = new index$1.Oe(this.classCollection.classes);
|
|
3550
3599
|
// Display Error
|
|
3551
3600
|
this.handlerInProgress = Handler.BLUR;
|
|
3552
3601
|
this.displayError().finally(() => {
|
|
@@ -3609,7 +3658,7 @@ const MgInputTextarea = class {
|
|
|
3609
3658
|
this.valid = undefined;
|
|
3610
3659
|
this.invalid = undefined;
|
|
3611
3660
|
this.resizable = 'none';
|
|
3612
|
-
this.classCollection = new index$1.
|
|
3661
|
+
this.classCollection = new index$1.Oe(['mg-c-input--textarea']);
|
|
3613
3662
|
this.errorMessage = undefined;
|
|
3614
3663
|
}
|
|
3615
3664
|
handleValue(newValue) {
|
|
@@ -3648,7 +3697,7 @@ const MgInputTextarea = class {
|
|
|
3648
3697
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3649
3698
|
}
|
|
3650
3699
|
validatePattern(newValue) {
|
|
3651
|
-
if (newValue !== undefined && !(index$1.
|
|
3700
|
+
if (newValue !== undefined && !(index$1.Ne(this.pattern) && index$1.Ne(this.patternErrorMessage))) {
|
|
3652
3701
|
throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3653
3702
|
}
|
|
3654
3703
|
}
|
|
@@ -3680,7 +3729,7 @@ const MgInputTextarea = class {
|
|
|
3680
3729
|
if (typeof valid !== 'boolean') {
|
|
3681
3730
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
|
|
3682
3731
|
}
|
|
3683
|
-
else if (!index$1.
|
|
3732
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
3684
3733
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
|
|
3685
3734
|
}
|
|
3686
3735
|
else {
|
|
@@ -3731,7 +3780,7 @@ const MgInputTextarea = class {
|
|
|
3731
3780
|
* @returns HTML Element
|
|
3732
3781
|
*/
|
|
3733
3782
|
render() {
|
|
3734
|
-
return (index.h("mg-input", { key: '
|
|
3783
|
+
return (index.h("mg-input", { key: 'c4386e9b6efe517276d3cd55d213819ff90d7e20', 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: '2d30db0ea21becffcdce57e46734e76877dc4858', class: "mg-c-input__with-character-left" }, index.h("textarea", { key: 'bc95d0db89014cafbb4e45893974e1ad09a41bf9', class: {
|
|
3735
3784
|
'mg-c-input__box': true,
|
|
3736
3785
|
'mg-c-input__box--width': true,
|
|
3737
3786
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
@@ -3740,7 +3789,7 @@ const MgInputTextarea = class {
|
|
|
3740
3789
|
}, value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, rows: this.rows, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
3741
3790
|
if (el !== null)
|
|
3742
3791
|
this.input = el;
|
|
3743
|
-
} }), this.displayCharacterLeft && this.maxlength > 0 && (index.h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength })))));
|
|
3792
|
+
} }), this.displayCharacterLeft && this.maxlength > 0 && (index.h("mg-character-left", { key: '522f8440ff28f9767c7273f56936cc994dfa17da', identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength })))));
|
|
3744
3793
|
}
|
|
3745
3794
|
get element() { return index.getElement(this); }
|
|
3746
3795
|
static get watchers() { return {
|
|
@@ -3769,7 +3818,7 @@ const MgInputTitle = class {
|
|
|
3769
3818
|
this.tagName = 'label';
|
|
3770
3819
|
}
|
|
3771
3820
|
validateIdentifier(newValue) {
|
|
3772
|
-
if (!index$1.
|
|
3821
|
+
if (!index$1.Ne(newValue)) {
|
|
3773
3822
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
3774
3823
|
}
|
|
3775
3824
|
}
|
|
@@ -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: '217fcd80f25886c71c9ec8da6673e3ba5dbb78f7', class: "mg-c-input-title", htmlFor: !this.isLegend && this.identifier, id: this.isLegend ? `${this.identifier}-title` : undefined }, index.h("slot", { key: '0efdaadd578a4a557e96f76ebfe1182af2ffdfac' }), this.required && !this.readonly && (index.h("span", { key: 'ebb62ba6769b0e6c8807d67aa0d4bcb80db76ac7', class: "mg-c-input-title__required" }, "\u00A0", index.h("span", { key: '9945e1bff4ec58e1c705a25cef538b2dab806fab', class: "mg-u-is-asterisk" }, "*")))));
|
|
3797
3846
|
}
|
|
3798
3847
|
static get watchers() { return {
|
|
3799
3848
|
"identifier": ["validateIdentifier"],
|
|
@@ -3883,7 +3932,7 @@ const MgInputToggle = class {
|
|
|
3883
3932
|
this.tooltip = undefined;
|
|
3884
3933
|
this.tooltipPosition = 'input';
|
|
3885
3934
|
this.helpText = undefined;
|
|
3886
|
-
this.classCollection = new index$1.
|
|
3935
|
+
this.classCollection = new index$1.Oe(['mg-c-input--toggle']);
|
|
3887
3936
|
this.options = undefined;
|
|
3888
3937
|
this.errorMessage = undefined;
|
|
3889
3938
|
this.valid = undefined;
|
|
@@ -3900,7 +3949,7 @@ const MgInputToggle = class {
|
|
|
3900
3949
|
throw new Error('<mg-input-toggle> prop "items" require 2 items.');
|
|
3901
3950
|
}
|
|
3902
3951
|
// String array
|
|
3903
|
-
else if (index$1.
|
|
3952
|
+
else if (index$1.Fe(newValue)) {
|
|
3904
3953
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
3905
3954
|
}
|
|
3906
3955
|
// Object array
|
|
@@ -3956,7 +4005,7 @@ const MgInputToggle = class {
|
|
|
3956
4005
|
if (typeof valid !== 'boolean') {
|
|
3957
4006
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean');
|
|
3958
4007
|
}
|
|
3959
|
-
else if (!index$1.
|
|
4008
|
+
else if (!index$1.Ne(errorMessage)) {
|
|
3960
4009
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string');
|
|
3961
4010
|
}
|
|
3962
4011
|
else {
|
|
@@ -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: '8d4b88c7a14660ee3cfc69c3fce7f35f41b8a199', 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: '9af8b4159d4159894b9c37867cd5581296c48295', 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: '7b11e8151dc231718c81c73f7d99980eec4bb1ed', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { key: '7efaeced52095c79b2d61f9b3628ec2f605d747b', name: "item-1" })), index.h("span", { key: 'd2e3775fbae5c6c679125ac99c56dfde431ecdc2', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { key: 'edbb817680e42f7012f5b8d69e1c47626d97a161', 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.Ne(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: '18e3ecec55a7078662bdb04ba6325a4d44ff1c78', role: "listitem" }, this.parentMenu && (index.h("mg-menu-item", { key: 'e04f4b62b1ce70eeae25f959ef6aeca2e4a2690d', "data-overflow-more": true, "data-size": this.parentMenu.size, ref: el => {
|
|
4334
|
+
if (el)
|
|
4335
|
+
this.moreElementMenuItem = el;
|
|
4336
|
+
} }, index.h("mg-icon", { key: '8f20ef688479578ebee9eabb63644837e1d45113', icon: this.icon.icon, slot: "image" }), index.h("span", { key: '7a4f08410d1e85682a8c3e1935525c418a4141de', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), index.h("mg-menu", { key: 'f67f53d289cf65883a3534f17fb2baaa91314a66', 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: 'a5fe4a1a61b4255cc9a06217f30ef2f154fd797d', role: "list", "aria-label": this.label }, index.h("slot", { key: '37de5388d1cca3fa46dfbb73ab26ba6e299940b5' })));
|
|
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
|
************/
|
|
@@ -4261,7 +4578,7 @@ const MgMenuItem = class {
|
|
|
4261
4578
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
4262
4579
|
['label', 'metadata'].forEach(slot => {
|
|
4263
4580
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
4264
|
-
if (!index$1.
|
|
4581
|
+
if (!index$1.Ne(element.textContent))
|
|
4265
4582
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
4266
4583
|
if ((guard && element.getAttribute('title') === null) || !guard)
|
|
4267
4584
|
element.setAttribute('title', element.textContent);
|
|
@@ -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
|
************/
|
|
@@ -4330,13 +4647,13 @@ const MgMenuItem = class {
|
|
|
4330
4647
|
* @returns HTML Element
|
|
4331
4648
|
*/
|
|
4332
4649
|
this.renderSlot = () => index.h("slot", null);
|
|
4333
|
-
this.identifier = index$1.
|
|
4650
|
+
this.identifier = index$1.Me('mg-menu-item');
|
|
4334
4651
|
this.href = undefined;
|
|
4335
4652
|
this.target = undefined;
|
|
4336
4653
|
this.status = Status$1.VISIBLE;
|
|
4337
4654
|
this.expanded = false;
|
|
4338
4655
|
this.size = 'regular';
|
|
4339
|
-
this.navigationButtonClassList = new index$1.
|
|
4656
|
+
this.navigationButtonClassList = new index$1.Oe([this.navigationButton]);
|
|
4340
4657
|
this.direction = undefined;
|
|
4341
4658
|
this.isInMainMenu = undefined;
|
|
4342
4659
|
this.isItemMore = undefined;
|
|
@@ -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.Ce(() => {
|
|
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: '10b41e1b90d01a0f0df082cd9fc50884e87c2e59', 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
|
])));
|
|
@@ -4580,13 +4906,13 @@ const MgMessage = class {
|
|
|
4580
4906
|
return 'exclamation-circle';
|
|
4581
4907
|
}
|
|
4582
4908
|
};
|
|
4583
|
-
this.identifier = index$1.
|
|
4909
|
+
this.identifier = index$1.Me('mg-message');
|
|
4584
4910
|
this.delay = undefined;
|
|
4585
4911
|
this.variant = variants$1[0];
|
|
4586
4912
|
this.closeButton = false;
|
|
4587
4913
|
this.hide = false;
|
|
4588
4914
|
this.noAriaRole = undefined;
|
|
4589
|
-
this.classCollection = new index$1.
|
|
4915
|
+
this.classCollection = new index$1.Oe(['mg-c-message']);
|
|
4590
4916
|
this.hasActions = false;
|
|
4591
4917
|
}
|
|
4592
4918
|
validateDelay(newValue) {
|
|
@@ -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: 'a30da97a75717852677dc66ba0e9bc0a000c8c35', id: this.identifier, class: this.classCollection.join(), role: role }, index.h("mg-card", { key: '9cea0e509146e245a91290e76bc3908fcf3e3806', variant: this.variant, "variant-style": "bar-left" }, index.h("span", { key: '0beb527b84230d6cafed7ac1d2c9caa59ad1f80f', class: "mg-c-message__icon" }, index.h("mg-icon", { key: 'e0346db73f7c2c4595bb09e1be93039763106a5d', icon: this.getIcon() })), index.h("div", { key: '128567f70f2d664688cf012ab995a57eea2bca17', class: "mg-c-message__content" }, index.h("span", { key: '2b1cc03309002908b6c54b95c6ad58bdc966e787', class: "mg-c-message__content-slot" }, index.h("slot", { key: 'fd7b3e74c3bd2a70d2cbbef0a9519cdee38da5ce' })), this.hasActions && index.h("span", { key: 'adb6d3b819226a5e6173f077650be05c64e69f13', class: "mg-c-message__content-separator" }), this.hasActions && (index.h("span", { key: '136b8a00d7b0dbb14750d7637bce7d83d8cfd112', class: "mg-c-message__content-actions-slot" }, index.h("slot", { key: '926939a26ee3fa4e3b4625cdc4003dccc9d2e2e3', name: "actions" })))), this.closeButton && (index.h("span", { key: '770a2313622d50f5dc027d65b878e2955a134ca3', class: "mg-c-message__close-button" }, index.h("mg-button", { key: '094652edc8aa518cb3c0322025b5bf5c66b3fa33', identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, index.h("mg-icon", { key: '2b0ee538aec157e9507bf3c14026e71c422fc365', icon: "cross" })))))));
|
|
4669
4995
|
}
|
|
4670
4996
|
get element() { return index.getElement(this); }
|
|
4671
4997
|
static get watchers() { return {
|
|
@@ -4729,12 +5055,12 @@ const MgModal = class {
|
|
|
4729
5055
|
*/
|
|
4730
5056
|
this.setFocus = () => {
|
|
4731
5057
|
// Get all focusable elements
|
|
4732
|
-
const slottedFocusableElements = Array.from(this.element.querySelectorAll(index$1.
|
|
5058
|
+
const slottedFocusableElements = Array.from(this.element.querySelectorAll(index$1._e));
|
|
4733
5059
|
// If close button is enabled or at least one of the slotted element is focusable
|
|
4734
5060
|
if (this.closeButton || slottedFocusableElements.length > 0) {
|
|
4735
5061
|
// Check if slotted focusable elements have shadowDom with focusable elements
|
|
4736
5062
|
this.modalFocusableElements = slottedFocusableElements.reduce((acc, focusableElement) => {
|
|
4737
|
-
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(index$1.
|
|
5063
|
+
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(index$1._e) || focusableElement : focusableElement);
|
|
4738
5064
|
return acc;
|
|
4739
5065
|
}, []);
|
|
4740
5066
|
// When close button is enabled it's the first focusable element.
|
|
@@ -4756,21 +5082,21 @@ const MgModal = class {
|
|
|
4756
5082
|
this.handleClose = () => {
|
|
4757
5083
|
this.hide = true;
|
|
4758
5084
|
};
|
|
4759
|
-
this.identifier = index$1.
|
|
5085
|
+
this.identifier = index$1.Me('mg-modal');
|
|
4760
5086
|
this.dialogRole = dialogRoles[0];
|
|
4761
5087
|
this.modalTitle = undefined;
|
|
4762
5088
|
this.closeButton = false;
|
|
4763
5089
|
this.hide = undefined;
|
|
4764
5090
|
this.hasActions = false;
|
|
4765
5091
|
this.hasContent = false;
|
|
4766
|
-
this.classCollection = new index$1.
|
|
5092
|
+
this.classCollection = new index$1.Oe(['mg-c-modal']);
|
|
4767
5093
|
}
|
|
4768
5094
|
validateDialogRole(newValue) {
|
|
4769
5095
|
if (!dialogRoles.includes(newValue))
|
|
4770
5096
|
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}.`);
|
|
4771
5097
|
}
|
|
4772
5098
|
validateModalTitle(newValue) {
|
|
4773
|
-
if (!index$1.
|
|
5099
|
+
if (!index$1.Ne(newValue)) {
|
|
4774
5100
|
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
4775
5101
|
}
|
|
4776
5102
|
}
|
|
@@ -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: '472cae1bd3a5291e14265d00ee594c726f179a1f', 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: '870e59e1126988fefe5c04380b5bbd593e8629af' }, index.h("div", { key: '9d49127cf8bf68b55549f379b760c6597b1a2d6c', class: "mg-c-modal__dialog" }, index.h("header", { key: 'b8629ece3524f5dd64b248080fa06f21980ddf7b', class: "mg-c-modal__header" }, this.closeButton && (index.h("span", { key: 'f38d648290d1db901fb2cc09ae8b8ed13bf7e0b6', class: "mg-c-modal__close-button" }, index.h("mg-button", { key: 'b12aecfd77b5fb7588c3b2f6487c10c2cba9f097', 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", { key: '2e5590b14d6b4da659f4f6d8630606a9bafdb9c6', icon: "cross" })))), index.h("h1", { key: '6ca12328af9955d0716c330c32004c68cca11b4c', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (index.h("article", { key: '0873f01de1bfe75c2e91ea89b762d433006e7878', class: "mg-c-modal__content" }, index.h("slot", { key: 'dd8fd2e6527d640c40261dcbae76846d107337dc', name: "content" }))), this.hasActions && (index.h("footer", { key: 'e97c6d3ad9bbca892afcabeb5b15e63425d05070', class: "mg-c-modal__footer" }, index.h("slot", { key: 'c865f0b4244f5ea4ed5e7733813a8b10bc985504', name: "actions" })))))));
|
|
4849
5175
|
}
|
|
4850
5176
|
get element() { return index.getElement(this); }
|
|
4851
5177
|
static get watchers() { return {
|
|
@@ -4917,7 +5243,7 @@ const MgPagination = class {
|
|
|
4917
5243
|
this.handleGoToPage = (action, disabled) => {
|
|
4918
5244
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
4919
5245
|
};
|
|
4920
|
-
this.identifier = index$1.
|
|
5246
|
+
this.identifier = index$1.Me('mg-pagination');
|
|
4921
5247
|
this.label = undefined;
|
|
4922
5248
|
this.hideNavigationLabels = undefined;
|
|
4923
5249
|
this.hidePageCount = undefined;
|
|
@@ -4960,10 +5286,10 @@ const MgPagination = class {
|
|
|
4960
5286
|
* @returns HTML Element
|
|
4961
5287
|
*/
|
|
4962
5288
|
render() {
|
|
4963
|
-
const navigationActionButton = (disabled, action) => (index.h("mg-button", { key: '
|
|
5289
|
+
const navigationActionButton = (disabled, action) => (index.h("mg-button", { key: 'b708c70615e0fb49d1628dc6cf83e54ea5ab0a61', identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
4964
5290
|
// eslint-disable-next-line react/jsx-no-bind
|
|
4965
|
-
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && index.h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && index.h("mg-icon", { icon: "chevron-right" })));
|
|
4966
|
-
return (index.h(index.Host, { key: '
|
|
5291
|
+
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && index.h("mg-icon", { key: '1c8375c68fd7729fb7ea91220ffb4f7267ac3a47', icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && index.h("mg-icon", { key: '1af0c20c2d5ce86e593b2eca82dee410a782c193', icon: "chevron-right" })));
|
|
5292
|
+
return (index.h(index.Host, { key: '4490a0b9d3c0ac55519d052b4d76ab8f682f0f3a', hidden: this.totalPages < 2 }, index.h("nav", { key: 'eaf362cd327e88290f3af5dcfd1d46fff6178ff9', role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (index.h("mg-input-select", { key: '06c9786c833302a4ee88ed7f2217875112ee7a20', identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true })), index.h("span", { key: '7877dbee55a509b13c8cf881154d96bbe1c5cee7', class: "mg-u-visually-hidden" }, this.messages.pagination.page, " ", this.currentPage), index.h("span", { key: 'd4615625b40108526f7aaa8f8a8505b2a61e43e9', class: { 'mg-u-visually-hidden': this.hidePageCount } }, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
|
|
4967
5293
|
}
|
|
4968
5294
|
get element() { return index.getElement(this); }
|
|
4969
5295
|
static get watchers() { return {
|
|
@@ -5082,7 +5408,7 @@ const MgPanel = class {
|
|
|
5082
5408
|
];
|
|
5083
5409
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5084
5410
|
};
|
|
5085
|
-
this.identifier = index$1.
|
|
5411
|
+
this.identifier = index$1.Me('mg-panel');
|
|
5086
5412
|
this.panelTitle = undefined;
|
|
5087
5413
|
this.titlePattern = undefined;
|
|
5088
5414
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -5091,12 +5417,12 @@ const MgPanel = class {
|
|
|
5091
5417
|
this.expanded = false;
|
|
5092
5418
|
this.expandToggleDisplay = expandToggleDisplays[0];
|
|
5093
5419
|
this.expandToggleDisabled = undefined;
|
|
5094
|
-
this.classCollection = new index$1.
|
|
5420
|
+
this.classCollection = new index$1.Oe(['mg-c-panel']);
|
|
5095
5421
|
this.isEditing = false;
|
|
5096
5422
|
this.updatedPanelTitle = undefined;
|
|
5097
5423
|
}
|
|
5098
5424
|
validatePanelTitle(newValue) {
|
|
5099
|
-
if (!index$1.
|
|
5425
|
+
if (!index$1.Ne(newValue))
|
|
5100
5426
|
throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
5101
5427
|
this.titleChange.emit(newValue);
|
|
5102
5428
|
}
|
|
@@ -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: 'd01136210425cb7790aab87d6c137ba74fc02af5', class: this.classCollection.join(), id: this.identifier }, index.h("mg-card", { key: '84084da775de623fd20c069de5e49d2542755907' }, index.h("header", { key: '9f3ef1d0d7b2dc275d0c7b39175e0f775cbb1e1b', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), index.h("article", { key: '4b6cd2b1b604515d657368642fe21b21eb33b55b', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, index.h("slot", { key: '45db8591e0b85ed5e9704dc1a42fa75d24e96e39' })))));
|
|
5151
5477
|
}
|
|
5152
5478
|
get element() { return index.getElement(this); }
|
|
5153
5479
|
static get watchers() { return {
|
|
@@ -7047,7 +7373,7 @@ const MgPopover = class {
|
|
|
7047
7373
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7048
7374
|
}
|
|
7049
7375
|
};
|
|
7050
|
-
this.identifier = index$1.
|
|
7376
|
+
this.identifier = index$1.Me('mg-popover');
|
|
7051
7377
|
this.placement = 'bottom';
|
|
7052
7378
|
this.arrowHide = false;
|
|
7053
7379
|
this.closeButton = false;
|
|
@@ -7090,7 +7416,7 @@ const MgPopover = class {
|
|
|
7090
7416
|
*/
|
|
7091
7417
|
componentWillLoad() {
|
|
7092
7418
|
// Get windows to attach events
|
|
7093
|
-
this.windows = index$1.
|
|
7419
|
+
this.windows = index$1.Be(window);
|
|
7094
7420
|
// render mg-popover-content slot
|
|
7095
7421
|
this.renderPopoverContent();
|
|
7096
7422
|
this.validateCloseButton(this.closeButton);
|
|
@@ -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: '788fd2a8f759f8ae9188b05395cbfc33b5b06c69' }, index.h("slot", { key: '9109948237f93d375e6d1b234274f8283c0260d3' }), index.h("slot", { key: 'e76a1093edab91746a4d3302d7976129ed7c6042', name: "content" })));
|
|
7156
7482
|
}
|
|
7157
7483
|
get element() { return index.getElement(this); }
|
|
7158
7484
|
static get watchers() { return {
|
|
@@ -7178,7 +7504,7 @@ const MgPopoverContent = class {
|
|
|
7178
7504
|
this.hideContent.emit();
|
|
7179
7505
|
};
|
|
7180
7506
|
this.closeButton = false;
|
|
7181
|
-
this.classCollection = new index$1.
|
|
7507
|
+
this.classCollection = new index$1.Oe(['mg-c-popover-content']);
|
|
7182
7508
|
}
|
|
7183
7509
|
/*************
|
|
7184
7510
|
* Lifecycle *
|
|
@@ -7196,7 +7522,7 @@ const MgPopoverContent = class {
|
|
|
7196
7522
|
componentDidLoad() {
|
|
7197
7523
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7198
7524
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
7199
|
-
if (slottedTitleElement && !index$1.
|
|
7525
|
+
if (slottedTitleElement && !index$1.De(slottedTitleElement, headingTags)) {
|
|
7200
7526
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
7201
7527
|
}
|
|
7202
7528
|
}
|
|
@@ -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: 'ffe73fca1c2d8ffa0f5ac2359b50a453b37df7be' }, index.h("mg-card", { key: 'f6e04d90892104abf496cf3ca3a601cb747346c9', class: this.classCollection.join() }, this.closeButton && (index.h("mg-button", { key: '53b6f7360b07321c0433fb2f44f1b1dd9016f204', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { key: 'aa638786bca9af815d36e1de905559d60e68e44c', icon: "cross" }))), index.h("div", { key: '0b9f1319e409a0b1d75d16236806fd024c8b804e', class: "mg-c-popover-content__title" }, index.h("slot", { key: '7f52704d2ed49ea048ffd06b763a238d288ccaf3', name: "title" })), index.h("slot", { key: '7a2fd6b013e592acb616793439b2f4e8458ec372', name: "content" })), index.h("slot", { key: 'ceb0a6453ece1b861fe5ab3d63e803b1f41cb148', name: "arrow" })));
|
|
7209
7535
|
}
|
|
7210
7536
|
get element() { return index.getElement(this); }
|
|
7211
7537
|
};
|
|
@@ -7232,7 +7558,7 @@ const MgSkipLinks = class {
|
|
|
7232
7558
|
this.links = undefined;
|
|
7233
7559
|
}
|
|
7234
7560
|
validateLinks(links) {
|
|
7235
|
-
if (links === undefined || links.length === 0 || links.some(link => !index$1.
|
|
7561
|
+
if (links === undefined || links.length === 0 || links.some(link => !index$1.Ne(link.href) || !link.href.startsWith('#') || !index$1.Ne(link.label))) {
|
|
7236
7562
|
throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
|
|
7237
7563
|
}
|
|
7238
7564
|
}
|
|
@@ -7251,7 +7577,7 @@ const MgSkipLinks = class {
|
|
|
7251
7577
|
* @returns HTML Element
|
|
7252
7578
|
*/
|
|
7253
7579
|
render() {
|
|
7254
|
-
return (index.h("nav", { key: '
|
|
7580
|
+
return (index.h("nav", { key: '2dac1b6dab0eb2634b803240325822ea3c8bae63', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, index.h("ul", { key: 'e050de2426d080ede6a2b983ec0f9452b0e0f43b', class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (index.h("li", { key: link.href }, index.h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
7255
7581
|
}
|
|
7256
7582
|
get element() { return index.getElement(this); }
|
|
7257
7583
|
static get watchers() { return {
|
|
@@ -7384,7 +7710,7 @@ const MgTabs = class {
|
|
|
7384
7710
|
*/
|
|
7385
7711
|
this.resetFocus = () => {
|
|
7386
7712
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7387
|
-
index$1.
|
|
7713
|
+
index$1.Ce(() => {
|
|
7388
7714
|
this.tabFocus = undefined;
|
|
7389
7715
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7390
7716
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7399,16 +7725,16 @@ const MgTabs = class {
|
|
|
7399
7725
|
if (slots.length !== this.tabs.length)
|
|
7400
7726
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7401
7727
|
};
|
|
7402
|
-
this.identifier = index$1.
|
|
7728
|
+
this.identifier = index$1.Me('mg-tabs');
|
|
7403
7729
|
this.label = undefined;
|
|
7404
7730
|
this.size = 'regular';
|
|
7405
7731
|
this.items = undefined;
|
|
7406
7732
|
this.activeTab = undefined;
|
|
7407
7733
|
this.tabs = [];
|
|
7408
|
-
this.classCollection = new index$1.
|
|
7734
|
+
this.classCollection = new index$1.Oe(['mg-c-tabs']);
|
|
7409
7735
|
}
|
|
7410
7736
|
validateLabel(newValue) {
|
|
7411
|
-
if (!index$1.
|
|
7737
|
+
if (!index$1.Ne(newValue)) {
|
|
7412
7738
|
throw new Error('<mg-tabs> prop "label" is required.');
|
|
7413
7739
|
}
|
|
7414
7740
|
}
|
|
@@ -7420,7 +7746,7 @@ const MgTabs = class {
|
|
|
7420
7746
|
}
|
|
7421
7747
|
validateItems(newValue) {
|
|
7422
7748
|
// String array
|
|
7423
|
-
if (index$1.
|
|
7749
|
+
if (index$1.Fe(newValue))
|
|
7424
7750
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
7425
7751
|
// Object array
|
|
7426
7752
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
@@ -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: '9327c6fb0d13d41d82b50e2f4f79696916ef142f', class: this.classCollection.join() }, index.h("header", { key: 'b783c343af1e817a2ab231d803e8ecf32df52566', 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),
|
|
@@ -7520,7 +7846,7 @@ const MgTag = class {
|
|
|
7520
7846
|
this.variant = variants[0];
|
|
7521
7847
|
this.outline = undefined;
|
|
7522
7848
|
this.soft = undefined;
|
|
7523
|
-
this.classCollection = new index$1.
|
|
7849
|
+
this.classCollection = new index$1.Oe(['mg-c-tag']);
|
|
7524
7850
|
}
|
|
7525
7851
|
validateVariant(newValue, oldValue) {
|
|
7526
7852
|
if (!variants.includes(newValue)) {
|
|
@@ -7557,7 +7883,7 @@ const MgTag = class {
|
|
|
7557
7883
|
* @param textContent - html element textContent property
|
|
7558
7884
|
*/
|
|
7559
7885
|
validateTextContent(textContent) {
|
|
7560
|
-
if (!index$1.
|
|
7886
|
+
if (!index$1.Ne(textContent))
|
|
7561
7887
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
7562
7888
|
}
|
|
7563
7889
|
/*************
|
|
@@ -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: '0746ab46695d72da229ea6b899c5ec9d4d09b0f0', class: this.classCollection.join() }, index.h("slot", { key: 'c1b246aaf9b5b199726c856b7e6a67be54e55b7c' })));
|
|
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}";
|
|
@@ -7616,7 +7943,7 @@ const MgTooltip = class {
|
|
|
7616
7943
|
// Enable the event listeners
|
|
7617
7944
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7618
7945
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7619
|
-
index$1.
|
|
7946
|
+
index$1.Ce(() => {
|
|
7620
7947
|
this.windows.forEach((localWindow) => {
|
|
7621
7948
|
localWindow.addEventListener('click', this.clickOutside, false);
|
|
7622
7949
|
localWindow.addEventListener('keydown', this.pressEscape, false);
|
|
@@ -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);
|
|
@@ -7781,7 +8114,7 @@ const MgTooltip = class {
|
|
|
7781
8114
|
});
|
|
7782
8115
|
});
|
|
7783
8116
|
};
|
|
7784
|
-
this.identifier = index$1.
|
|
8117
|
+
this.identifier = index$1.Me('mg-tooltip');
|
|
7785
8118
|
this.message = undefined;
|
|
7786
8119
|
this.placement = 'bottom';
|
|
7787
8120
|
this.display = false;
|
|
@@ -7792,7 +8125,7 @@ const MgTooltip = class {
|
|
|
7792
8125
|
this.renderTooltipContent();
|
|
7793
8126
|
}
|
|
7794
8127
|
validateMessage(newValue) {
|
|
7795
|
-
if (!index$1.
|
|
8128
|
+
if (!index$1.Ne(newValue)) {
|
|
7796
8129
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
7797
8130
|
}
|
|
7798
8131
|
this.mgTooltipContent.message = newValue;
|
|
@@ -7841,7 +8174,7 @@ const MgTooltip = class {
|
|
|
7841
8174
|
*/
|
|
7842
8175
|
componentWillLoad() {
|
|
7843
8176
|
// Get windows to attach events
|
|
7844
|
-
this.windows = index$1.
|
|
8177
|
+
this.windows = index$1.Be(window);
|
|
7845
8178
|
// Get tooltip element
|
|
7846
8179
|
this.renderTooltipContent();
|
|
7847
8180
|
this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);
|
|
@@ -7860,14 +8193,14 @@ const MgTooltip = class {
|
|
|
7860
8193
|
// get slotted element wich is not the tooltip
|
|
7861
8194
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
7862
8195
|
// Get interactive element
|
|
7863
|
-
const interactiveElement = slotElement.matches(index$1.
|
|
8196
|
+
const interactiveElement = slotElement.matches(index$1._e) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(index$1._e);
|
|
7864
8197
|
// define selected element to become tooltip selector
|
|
7865
8198
|
this.tooltipedElement = interactiveElement || slotElement;
|
|
7866
8199
|
// Check if slotted element is a disabled mg-button
|
|
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: 'bc92b38b5934945abf8657aeb56804c81274a11e' }, index.h("slot", { key: '5fca70b68f35c72c92252106d4b26766e2f671bb' }), index.h("slot", { key: '4426a5f6f55f549791ff22cc7220d728d2cca04f', 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: '749056e11074a73ef0bbe1aab102c334f0de8fed', role: "tooltip" }, index.h("span", { key: 'e7db4c4ab009e7ebd9908c86d151216919c59e9a', innerHTML: this.message, class: "mg-tooltip-content__message" }), index.h("slot", { key: 'f260fbe909763b8e221acd4178df0880f650a3a5', 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
|