@mgdis/mg-components 6.9.0 → 6.10.0
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/events.utils-D5SAtkpQ.js +28 -0
- package/dist/cjs/events.utils-D5SAtkpQ.js.map +1 -0
- package/dist/cjs/index-CATFkm3O.js +4 -0
- package/dist/cjs/{index-CTU2m-sy.js → index-CfIlskRh.js} +20 -6
- package/dist/cjs/{index-CTU2m-sy.js.map → index-CfIlskRh.js.map} +1 -1
- package/dist/cjs/index.es-BCLy9yYb.js +250 -0
- package/dist/cjs/index.es-BCLy9yYb.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +382 -373
- package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +7 -7
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-input-combobox.cjs.entry.js +774 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -0
- package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +16 -14
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-input-rich-text-editor.entry.cjs.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +5 -5
- package/dist/cjs/mg-progress.cjs.entry.js +11 -11
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js +3 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +47 -57
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1443 -0
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +2 -2
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js.map +1 -1
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +3 -3
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +3 -3
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +55 -81
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +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 +6 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
- package/dist/collection/locales/en/messages.json +8 -1
- package/dist/collection/locales/fr/messages.json +8 -1
- package/dist/collection/utils/behaviors.utils.js +3 -3
- package/dist/collection/utils/behaviors.utils.js.map +1 -1
- package/dist/collection/utils/events.utils.js +22 -0
- package/dist/collection/utils/events.utils.js.map +1 -0
- package/dist/collection/utils/floating-ui.utils.js +46 -2
- package/dist/collection/utils/floating-ui.utils.js.map +1 -1
- package/dist/components/events.utils.js +26 -0
- package/dist/components/events.utils.js.map +1 -0
- package/dist/components/floating-ui.utils.js +47 -3
- package/dist/components/floating-ui.utils.js.map +1 -1
- package/dist/components/index.es.js +136 -43
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +18 -4
- package/dist/components/index2.js.map +1 -1
- package/dist/components/mg-action-more.js +8 -8
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-alert.js +6 -6
- package/dist/components/mg-badge2.js +6 -6
- package/dist/components/mg-button2.js +9 -8
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-character-left2.js +4 -4
- package/dist/components/mg-details.js +4 -4
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-form.js +8 -8
- package/dist/components/mg-icon2.js +6 -6
- package/dist/components/mg-illustrated-message.js +6 -6
- package/dist/components/mg-input-checkbox.js +9 -9
- package/dist/components/mg-input-combobox.d.ts +11 -0
- package/dist/components/mg-input-combobox.js +897 -0
- package/dist/components/mg-input-combobox.js.map +1 -0
- package/dist/components/mg-input-date.js +18 -18
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +16 -16
- 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 +8 -8
- package/dist/components/mg-input-rich-text-editor.js +15 -13
- package/dist/components/mg-input-rich-text-editor.js.map +1 -1
- package/dist/components/mg-input-select2.js +9 -9
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +11 -11
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +9 -9
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-title2.js +4 -4
- package/dist/components/mg-input-toggle.js +7 -7
- package/dist/components/mg-input2.js +8 -8
- package/dist/components/mg-item-more2.js +12 -12
- package/dist/components/mg-item-more2.js.map +1 -1
- package/dist/components/mg-loader.js +1 -70
- package/dist/components/mg-loader.js.map +1 -1
- package/dist/components/mg-loader2.js +75 -0
- package/dist/components/mg-loader2.js.map +1 -0
- package/dist/components/mg-menu-item2.js +13 -13
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-message2.js +6 -6
- package/dist/components/mg-modal.js +10 -10
- package/dist/components/mg-pagination2.js +9 -9
- package/dist/components/mg-panel.js +10 -10
- package/dist/components/mg-popover-content2.js +5 -5
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover2.js +60 -86
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-progress.js +11 -11
- package/dist/components/mg-skip-links.js +3 -3
- package/dist/components/mg-table.js +6 -6
- package/dist/components/mg-tabs.js +18 -17
- package/dist/components/mg-tabs.js.map +1 -1
- package/dist/components/mg-tag.js +4 -4
- 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 +56 -66
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/events.utils-yMGqY8YG.js +26 -0
- package/dist/esm/events.utils-yMGqY8YG.js.map +1 -0
- package/dist/esm/index-CAuxALt5.js +4 -0
- package/dist/esm/{index-SQlkEaXW.js → index-DmsGewMC.js} +20 -6
- package/dist/esm/{index-SQlkEaXW.js.map → index-DmsGewMC.js.map} +1 -1
- package/dist/esm/index.es-rLV3KFPd.js +223 -0
- package/dist/esm/index.es-rLV3KFPd.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_37.entry.js +383 -374
- package/dist/esm/mg-action-more_37.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +7 -7
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-input-combobox.entry.js +772 -0
- package/dist/esm/mg-input-combobox.entry.js.map +1 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js +17 -15
- package/dist/esm/mg-input-rich-text-editor.entry.js.map +1 -1
- package/dist/esm/{mg-input.conf-BtkqaBXm.js → mg-input.conf-CNgv8hc5.js} +3 -3
- package/dist/esm/{mg-input.conf-BtkqaBXm.js.map → mg-input.conf-CNgv8hc5.js.map} +1 -1
- package/dist/esm/mg-loader.entry.js +5 -5
- package/dist/esm/mg-progress.entry.js +11 -11
- package/dist/mg-components/locales/en/messages.json +8 -1
- package/dist/mg-components/locales/fr/messages.json +8 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -0
- package/dist/mg-components/mg-input-rich-text-editor.entry.esm.js.map +1 -1
- package/dist/mg-components/p-0f761c6c.entry.js +2 -0
- package/dist/mg-components/p-0f761c6c.entry.js.map +1 -0
- package/dist/mg-components/{p-650d6986.entry.js → p-73099ed7.entry.js} +3 -3
- package/dist/mg-components/p-73099ed7.entry.js.map +1 -0
- package/dist/mg-components/p-88f77de2.entry.js +2 -0
- package/dist/mg-components/{p-680948e3.entry.js.map → p-88f77de2.entry.js.map} +1 -1
- package/dist/mg-components/p-CNgv8hc5.js +2 -0
- package/dist/mg-components/{p-BtkqaBXm.js.map → p-CNgv8hc5.js.map} +1 -1
- package/dist/mg-components/p-DK9teKTo.js +2 -0
- package/dist/mg-components/{p-CqGbLOnN.js.map → p-DK9teKTo.js.map} +1 -1
- package/dist/mg-components/{p-583b3769.entry.js → p-ad66e7b3.entry.js} +2 -2
- package/dist/mg-components/p-cdbe689e.entry.js +2 -0
- package/dist/mg-components/{p-9acc6504.entry.js.map → p-cdbe689e.entry.js.map} +1 -1
- package/dist/mg-components/p-d3a868f0.entry.js +2 -0
- package/dist/mg-components/p-d3a868f0.entry.js.map +1 -0
- package/dist/mg-components/p-rLV3KFPd.js +2 -0
- package/dist/mg-components/p-rLV3KFPd.js.map +1 -0
- package/dist/mg-components/p-yMGqY8YG.js +2 -0
- package/dist/mg-components/p-yMGqY8YG.js.map +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -5
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +24 -0
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +340 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +5 -9
- package/dist/types/components.d.ts +247 -2
- package/dist/types/utils/events.utils.d.ts +4 -0
- package/dist/types/utils/floating-ui.utils.d.ts +9 -1
- package/ide/intellij/web-types.json +400 -1
- package/ide/vscode/html-custom-data.json +332 -0
- package/package.json +12 -12
- package/dist/cjs/index.es-jXqiN1uw.js +0 -152
- package/dist/cjs/index.es-jXqiN1uw.js.map +0 -1
- package/dist/esm/index.es-DDBtzymI.js +0 -130
- package/dist/esm/index.es-DDBtzymI.js.map +0 -1
- package/dist/mg-components/p-650d6986.entry.js.map +0 -1
- package/dist/mg-components/p-680948e3.entry.js +0 -2
- package/dist/mg-components/p-9acc6504.entry.js +0 -2
- package/dist/mg-components/p-BtkqaBXm.js +0 -2
- package/dist/mg-components/p-CqGbLOnN.js +0 -2
- package/dist/mg-components/p-DDBtzymI.js +0 -2
- package/dist/mg-components/p-DDBtzymI.js.map +0 -1
- package/dist/mg-components/p-c0fb6f62.entry.js +0 -2
- package/dist/mg-components/p-c0fb6f62.entry.js.map +0 -1
- /package/dist/mg-components/{p-583b3769.entry.js.map → p-ad66e7b3.entry.js.map} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-CATFkm3O.js');
|
|
4
|
-
var index_es = require('./index.es-
|
|
5
|
-
var index$1 = require('./index-
|
|
4
|
+
var index_es = require('./index.es-BCLy9yYb.js');
|
|
5
|
+
var index$1 = require('./index-CfIlskRh.js');
|
|
6
|
+
var events_utils = require('./events.utils-D5SAtkpQ.js');
|
|
6
7
|
var mgInput_conf = require('./mg-input.conf-WTsvDfpC.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -75,7 +76,7 @@ const MgActionMore = class {
|
|
|
75
76
|
************/
|
|
76
77
|
this.name = 'mg-action-more';
|
|
77
78
|
this.classBase = 'mg-c-action-more';
|
|
78
|
-
this.mgPopoverIdentifier = index_es.
|
|
79
|
+
this.mgPopoverIdentifier = index_es.Pt(this.name);
|
|
79
80
|
/**
|
|
80
81
|
* Define button properties
|
|
81
82
|
*/
|
|
@@ -122,15 +123,15 @@ const MgActionMore = class {
|
|
|
122
123
|
}
|
|
123
124
|
validateItems(newValue) {
|
|
124
125
|
if (!isMgActionMoreItems(newValue)) {
|
|
125
|
-
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${index_es.
|
|
126
|
+
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${index_es.Gt(newValue)}.`);
|
|
126
127
|
}
|
|
127
128
|
else if (isMgActionMoreItems(newValue) && newValue.length > 0 && (isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {
|
|
128
|
-
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${index_es.
|
|
129
|
+
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${index_es.Gt(newValue)}.`);
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
validateIcon(newValue) {
|
|
132
133
|
if (newValue && !isMgActionMoreIcon(newValue)) {
|
|
133
|
-
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${index_es.
|
|
134
|
+
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${index_es.Gt(newValue)}.`);
|
|
134
135
|
}
|
|
135
136
|
else if ((newValue === null || newValue === void 0 ? void 0 : newValue.icon) === undefined && Boolean(this.button.isIcon)) {
|
|
136
137
|
this.icon = { icon: 'ellipsis' };
|
|
@@ -138,7 +139,7 @@ const MgActionMore = class {
|
|
|
138
139
|
}
|
|
139
140
|
validateButton(newValue) {
|
|
140
141
|
if (newValue && !isMgActionMoreButton(newValue)) {
|
|
141
|
-
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${index_es.
|
|
142
|
+
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${index_es.Gt(newValue)}.`);
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
validateDisplayChevron(newValue) {
|
|
@@ -172,9 +173,9 @@ const MgActionMore = class {
|
|
|
172
173
|
[`${this.classBase}__chevron--rotate`]: this.expanded === true,
|
|
173
174
|
} }, index.h("mg-icon", { icon: "chevron-down" })));
|
|
174
175
|
}
|
|
175
|
-
return (index.h(index.Host, { key: '
|
|
176
|
+
return (index.h(index.Host, { key: '655b4be7b0b17db8ad6e2d688f59c18f2750dfe4', "data-mg-popover-guard": this.mgPopoverIdentifier }, index.h("span", { key: '19f5763f7732fb156803fb6a24f776f182d230f4', class: this.classBase }, index.h("mg-popover", { key: '617fefddd54794e3f3da60e700e1c60e0758c66b', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, index.h("mg-button", { key: 'c9ef1d8f771b015ddb5b8f280c3657e74606ef22', 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: 'ded976da4cd3a457a232aee9613dc9e108c35358' }, this.icon)), !this.button.isIcon && buttonContent), index.h("div", { key: 'e3308c1e0ae198f204c283408f9c3afc154ddf21', slot: "content" }, index.h("mg-menu", { key: '70c222a09f42b938f56a5bb02fa4193ca8f47788', direction: directions$1.VERTICAL, label: this.messages.label }, this.items.map(item => {
|
|
176
177
|
var _a, _b;
|
|
177
|
-
return isMgActionMoreDivider(item) ? (index.h("mg-divider", { class: "mg-c-action-more__divider", key: "divider" })) : (index.h("mg-menu-item", { key: item.label, status: item.status || Status$1.VISIBLE, target: item.target, href: item.href,
|
|
178
|
+
return isMgActionMoreDivider(item) ? (index.h("mg-divider", { class: "mg-c-action-more__divider", key: "divider", "full-width": true })) : (index.h("mg-menu-item", { key: item.label, status: item.status || Status$1.VISIBLE, target: item.target, href: item.href,
|
|
178
179
|
// eslint-disable-next-line react/jsx-no-bind
|
|
179
180
|
onClick: e => this.handleItemClick(e, item.mouseEventHandler) }, ((_a = item.icon) === null || _a === void 0 ? void 0 : _a.icon) && index.h("mg-icon", { icon: item.icon.icon, variant: item.icon.variant, variantStyle: item.icon.variantStyle, slot: "image" }), index.h("span", { slot: "label" }, item.label), ((_b = item.badge) === null || _b === void 0 ? void 0 : _b.label) && index.h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" })));
|
|
180
181
|
})))))));
|
|
@@ -215,21 +216,21 @@ const MgBadge = class {
|
|
|
215
216
|
/**
|
|
216
217
|
* Component classes
|
|
217
218
|
*/
|
|
218
|
-
this.classCollection = new index_es.
|
|
219
|
+
this.classCollection = new index_es.Zt(['mg-c-badge']);
|
|
219
220
|
}
|
|
220
221
|
validateValue(newValue) {
|
|
221
222
|
if (/^[^A-Z]+$/i.exec(`${newValue}`) === null) {
|
|
222
|
-
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${index_es.
|
|
223
|
+
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${index_es.Gt(newValue)}.`);
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
validateLabel(newValue) {
|
|
226
|
-
if (!index_es.
|
|
227
|
-
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${index_es.
|
|
227
|
+
if (!index_es.De(newValue)) {
|
|
228
|
+
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${index_es.Gt(newValue)}.`);
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
validateVariant(newValue, oldValue) {
|
|
231
232
|
if (!variants$4.includes(newValue)) {
|
|
232
|
-
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${index_es.
|
|
233
|
+
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
233
234
|
}
|
|
234
235
|
else {
|
|
235
236
|
if (oldValue !== undefined) {
|
|
@@ -322,7 +323,7 @@ const MgButton = class {
|
|
|
322
323
|
/**
|
|
323
324
|
* Component classes
|
|
324
325
|
*/
|
|
325
|
-
this.classCollection = new index_es.
|
|
326
|
+
this.classCollection = new index_es.Zt(['mg-c-button']);
|
|
326
327
|
/**
|
|
327
328
|
* Trigger actions onClick event
|
|
328
329
|
* @param event - click event
|
|
@@ -344,7 +345,7 @@ const MgButton = class {
|
|
|
344
345
|
if (!this.disabled && event.key === ' ') {
|
|
345
346
|
event.preventDefault();
|
|
346
347
|
}
|
|
347
|
-
else if (!this.disabled && [
|
|
348
|
+
else if (!this.disabled && [events_utils.Keys.ENTER, events_utils.Keys.NUMPADENTER, events_utils.Keys.SPACE].includes(event.key)) {
|
|
348
349
|
event.preventDefault();
|
|
349
350
|
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
350
351
|
}
|
|
@@ -380,7 +381,7 @@ const MgButton = class {
|
|
|
380
381
|
this.variant = variants$3[0];
|
|
381
382
|
return;
|
|
382
383
|
}
|
|
383
|
-
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${index_es.
|
|
384
|
+
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
384
385
|
}
|
|
385
386
|
else {
|
|
386
387
|
if (oldValue !== undefined) {
|
|
@@ -392,7 +393,7 @@ const MgButton = class {
|
|
|
392
393
|
validateSize(newValue, oldValue) {
|
|
393
394
|
// validate new value
|
|
394
395
|
if (!sizes$4.includes(newValue)) {
|
|
395
|
-
throw new Error(`<mg-button> prop "size" must be one of: ${sizes$4.join(', ')}. Passed value: ${index_es.
|
|
396
|
+
throw new Error(`<mg-button> prop "size" must be one of: ${sizes$4.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
396
397
|
}
|
|
397
398
|
else {
|
|
398
399
|
if (oldValue !== undefined) {
|
|
@@ -434,7 +435,7 @@ const MgButton = class {
|
|
|
434
435
|
watchIsIcon(newValue) {
|
|
435
436
|
if (newValue) {
|
|
436
437
|
this.classCollection.add(`mg-c-button--icon`);
|
|
437
|
-
if (!index_es.
|
|
438
|
+
if (!index_es.De(this.label)) {
|
|
438
439
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
439
440
|
}
|
|
440
441
|
}
|
|
@@ -465,7 +466,7 @@ const MgButton = class {
|
|
|
465
466
|
* Add listners
|
|
466
467
|
*/
|
|
467
468
|
componentDidLoad() {
|
|
468
|
-
index_es.
|
|
469
|
+
index_es.Xt(() => {
|
|
469
470
|
var _a;
|
|
470
471
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
471
472
|
// submit buttons should trigger form submition;
|
|
@@ -482,7 +483,7 @@ const MgButton = class {
|
|
|
482
483
|
*/
|
|
483
484
|
render() {
|
|
484
485
|
var _a;
|
|
485
|
-
return (index.h(index.Host, { key: '
|
|
486
|
+
return (index.h(index.Host, { key: '9cf0c234da7c2f0ca5ab1d6578fc1a00b7b6aa71', 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: 'e4fc763ce10eb5958ebd9330f778380bb93100d6', class: this.classCollection.join() }, this.loading && index.h("mg-icon", { key: '6796487254b12a33339ac6b3a5f6c67000d8fe04', icon: "loader", spin: true }), index.h("div", { key: '469136ef8519825ebff3e6ee2bfe8c55e64a807d', class: "mg-c-button__content" }, index.h("slot", { key: 'eda514d71eaab7f7cf5cd3a65b64ffb6c9ed2e02' })))));
|
|
486
487
|
}
|
|
487
488
|
get element() { return index.getElement(this); }
|
|
488
489
|
static get watchers() { return {
|
|
@@ -526,13 +527,13 @@ const MgCharacterLeft = class {
|
|
|
526
527
|
this.characters = '';
|
|
527
528
|
}
|
|
528
529
|
watchIdentifier(newValue) {
|
|
529
|
-
if (newValue !== undefined && !index_es.
|
|
530
|
-
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
530
|
+
if (newValue !== undefined && !index_es.Ut(newValue)) {
|
|
531
|
+
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
531
532
|
}
|
|
532
533
|
}
|
|
533
534
|
validateMaxlength(newValue) {
|
|
534
535
|
if (typeof newValue !== 'number') {
|
|
535
|
-
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${index_es.
|
|
536
|
+
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${index_es.Gt(newValue)}.`);
|
|
536
537
|
}
|
|
537
538
|
}
|
|
538
539
|
/*************
|
|
@@ -561,7 +562,7 @@ const MgCharacterLeft = class {
|
|
|
561
562
|
};
|
|
562
563
|
MgCharacterLeft.style = mgCharacterLeftCss;
|
|
563
564
|
|
|
564
|
-
const mgDetailsCss = ".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}}/*!\n * @prop --mg-c-details-spacing: Defines the spacing between the summary and the details. Default value: `--mg-b-size-8`.\n */.mg-c-details summary{display:flex;align-items:baseline;cursor:pointer;gap:var(--mg-b-size-16)}.mg-c-details summary::-webkit-details-marker{display:none}.mg-c-details__toggle{display:flex;min-height:calc(var(--mg-b-font-size)*var(--mg-b-line-height));flex-shrink:0;align-items:center;align-self:flex-start;gap:var(--mg-b-size-4)}.mg-c-details__toggle-icon.mg-c-details__toggle-icon--reverse{transform:rotate(180deg)}.mg-c-details__details{margin-top:var(--mg-c-details-spacing)}@media (width < 43.75rem){.mg-c-details__toggle>span{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}}";
|
|
565
|
+
const mgDetailsCss = ".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}}/*!\n * @prop --mg-c-details-spacing: Defines the spacing between the summary and the details. Default value: `--mg-b-size-8`.\n */.mg-c-details summary{display:inline-flex;align-items:baseline;cursor:pointer;gap:var(--mg-b-size-16)}.mg-c-details summary::-webkit-details-marker{display:none}.mg-c-details__toggle{display:flex;min-height:calc(var(--mg-b-font-size)*var(--mg-b-line-height));flex-shrink:0;align-items:center;align-self:flex-start;gap:var(--mg-b-size-4)}.mg-c-details__toggle-icon.mg-c-details__toggle-icon--reverse{transform:rotate(180deg)}.mg-c-details__details{margin-top:var(--mg-c-details-spacing)}@media (width < 43.75rem){.mg-c-details__toggle>span{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}}";
|
|
565
566
|
|
|
566
567
|
const MgDetails = class {
|
|
567
568
|
constructor(hostRef) {
|
|
@@ -583,7 +584,7 @@ const MgDetails = class {
|
|
|
583
584
|
};
|
|
584
585
|
}
|
|
585
586
|
validateTitles(newValue) {
|
|
586
|
-
if (!index_es.
|
|
587
|
+
if (!index_es.De(newValue)) {
|
|
587
588
|
throw new Error(`<mg-details> prop "toggleClosed" and "toggleOpened" is required and must be a valid string. Passed value: "toggleClosed='${this.toggleClosed}'" and "toggleOpened='${this.toggleOpened}'".`);
|
|
588
589
|
}
|
|
589
590
|
}
|
|
@@ -610,7 +611,7 @@ const MgDetails = class {
|
|
|
610
611
|
* @returns HTML Element
|
|
611
612
|
*/
|
|
612
613
|
render() {
|
|
613
|
-
return (index.h("details", { key: '
|
|
614
|
+
return (index.h("details", { key: 'e43aa4f4262d7006b9fdd0e75666649498081d55', class: "mg-c-details", onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, index.h("summary", { key: '050d5c0a645a017aaa784a4034201122b27238f0' }, index.h("slot", { key: 'e0d7ed83952bdd74a23ecabe93c4d0c922cda286', name: "summary" }), index.h("span", { key: '27238089072f0f0ca8f3263ec39e41291ab89907', class: "mg-c-details__toggle" }, index.h("mg-icon", { key: 'f1702911d70e2a95ecaac17a7a0c43a075ea8c18', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), index.h("span", { key: '6854f4ecd77d04e297b807060a0d064401d6537f', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), index.h("div", { key: '85e57b346ff8327d31f92a1e86c42fd8f131f6dc', class: "mg-c-details__details" }, index.h("slot", { key: 'bd016ab29d695bb1ccd99b9fd402ed23bbdc19ea', name: "details" }))));
|
|
614
615
|
}
|
|
615
616
|
get element() { return index.getElement(this); }
|
|
616
617
|
static get watchers() { return {
|
|
@@ -670,7 +671,7 @@ const MgForm = class {
|
|
|
670
671
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
671
672
|
* If not set, it will be created.
|
|
672
673
|
*/
|
|
673
|
-
this.identifier = index_es.
|
|
674
|
+
this.identifier = index_es.Pt('mg-form');
|
|
674
675
|
/**
|
|
675
676
|
* Input name
|
|
676
677
|
* If not set the value equals the identifier
|
|
@@ -691,7 +692,7 @@ const MgForm = class {
|
|
|
691
692
|
/**
|
|
692
693
|
* Component classes
|
|
693
694
|
*/
|
|
694
|
-
this.classCollection = new index_es.
|
|
695
|
+
this.classCollection = new index_es.Zt(['mg-c-form']);
|
|
695
696
|
/**
|
|
696
697
|
* Define required message based on mg-inputs required elements
|
|
697
698
|
*/
|
|
@@ -779,18 +780,18 @@ const MgForm = class {
|
|
|
779
780
|
};
|
|
780
781
|
}
|
|
781
782
|
watchIdentifier(newValue) {
|
|
782
|
-
if (!index_es.
|
|
783
|
-
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
783
|
+
if (!index_es.Ut(newValue)) {
|
|
784
|
+
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
784
785
|
}
|
|
785
786
|
}
|
|
786
787
|
validateRequiredMessage(newValue) {
|
|
787
788
|
if (newValue && !requiredMessageStatus.includes(newValue)) {
|
|
788
|
-
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${index_es.
|
|
789
|
+
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
789
790
|
}
|
|
790
791
|
}
|
|
791
792
|
validateAriaRole(newValue) {
|
|
792
793
|
if (newValue && !roles.includes(newValue)) {
|
|
793
|
-
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${index_es.
|
|
794
|
+
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
794
795
|
}
|
|
795
796
|
}
|
|
796
797
|
handlelabelOnTop(newValue) {
|
|
@@ -879,7 +880,7 @@ const MgForm = class {
|
|
|
879
880
|
* @returns HTML Element
|
|
880
881
|
*/
|
|
881
882
|
render() {
|
|
882
|
-
return (index.h("form", { key: '
|
|
883
|
+
return (index.h("form", { key: '444703cae8a5374a86adc1dcaf048665f06e795f', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && index.h("p", { key: '1a936dfeb41a257be7b44afada7bd435f9a357f0', innerHTML: this.requiredMessageText }), index.h("slot", { key: 'a446094e8658b02c5a9baf7b19d77ca11b1432e9' }), !this.readonly && !this.disabled && index.h("slot", { key: '41f4e1c80a0f78b112eaac1d5bc53a219eee926e', name: "actions" })));
|
|
883
884
|
}
|
|
884
885
|
get element() { return index.getElement(this); }
|
|
885
886
|
static get watchers() { return {
|
|
@@ -924,7 +925,7 @@ const MgIcon = class {
|
|
|
924
925
|
/**
|
|
925
926
|
* Component classes
|
|
926
927
|
*/
|
|
927
|
-
this.classCollection = new index_es.
|
|
928
|
+
this.classCollection = new index_es.Zt(['mg-c-icon']);
|
|
928
929
|
/**
|
|
929
930
|
* Method to set default varianStyle props
|
|
930
931
|
* needeed has stencil doesn't know that props is mutated when updated in prop watcher
|
|
@@ -955,7 +956,7 @@ const MgIcon = class {
|
|
|
955
956
|
}
|
|
956
957
|
validateIcon(newValue, oldValue) {
|
|
957
958
|
if (!Object.keys(icons).includes(newValue)) {
|
|
958
|
-
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${index_es.
|
|
959
|
+
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
959
960
|
}
|
|
960
961
|
else {
|
|
961
962
|
if (oldValue !== undefined) {
|
|
@@ -971,7 +972,7 @@ const MgIcon = class {
|
|
|
971
972
|
newValue = 'medium';
|
|
972
973
|
}
|
|
973
974
|
if (!sizes$3.includes(newValue)) {
|
|
974
|
-
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${index_es.
|
|
975
|
+
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
975
976
|
}
|
|
976
977
|
else {
|
|
977
978
|
if (oldValue !== undefined) {
|
|
@@ -983,7 +984,7 @@ const MgIcon = class {
|
|
|
983
984
|
validateVariant(newValue, oldValue) {
|
|
984
985
|
if (newValue !== undefined) {
|
|
985
986
|
if (!variants$2.includes(newValue))
|
|
986
|
-
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${index_es.
|
|
987
|
+
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
987
988
|
else {
|
|
988
989
|
this.setDefaultVariantStyle();
|
|
989
990
|
if (oldValue !== undefined)
|
|
@@ -995,7 +996,7 @@ const MgIcon = class {
|
|
|
995
996
|
validateVariantStyle(newValue, oldValue) {
|
|
996
997
|
if (newValue !== undefined) {
|
|
997
998
|
if (!variantStyles$1.includes(newValue))
|
|
998
|
-
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${index_es.
|
|
999
|
+
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
999
1000
|
else {
|
|
1000
1001
|
if (oldValue !== undefined)
|
|
1001
1002
|
this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);
|
|
@@ -1065,11 +1066,11 @@ const MgIllustratedMessage = class {
|
|
|
1065
1066
|
/**
|
|
1066
1067
|
* Component classes
|
|
1067
1068
|
*/
|
|
1068
|
-
this.classCollection = new index_es.
|
|
1069
|
+
this.classCollection = new index_es.Zt(['mg-c-illustrated-message']);
|
|
1069
1070
|
}
|
|
1070
1071
|
watchSize(newValue, oldValue) {
|
|
1071
1072
|
if (!sizes$2.includes(newValue)) {
|
|
1072
|
-
throw new Error(`<mg-illustrated-message> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${index_es.
|
|
1073
|
+
throw new Error(`<mg-illustrated-message> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
1073
1074
|
}
|
|
1074
1075
|
else {
|
|
1075
1076
|
if (oldValue !== undefined) {
|
|
@@ -1080,7 +1081,7 @@ const MgIllustratedMessage = class {
|
|
|
1080
1081
|
}
|
|
1081
1082
|
watchDirection(newValue, oldValue) {
|
|
1082
1083
|
if (newValue !== undefined && !directions.includes(newValue)) {
|
|
1083
|
-
throw new Error(`<mg-illustrated-message> prop "direction" must be one of: ${directions.join(', ')}. Passed value: ${index_es.
|
|
1084
|
+
throw new Error(`<mg-illustrated-message> prop "direction" must be one of: ${directions.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
1084
1085
|
}
|
|
1085
1086
|
else if (newValue === 'horizontal') {
|
|
1086
1087
|
this.classCollection.add('mg-c-illustrated-message--direction-horizontal');
|
|
@@ -1103,7 +1104,7 @@ const MgIllustratedMessage = class {
|
|
|
1103
1104
|
if (slottedDetails.length === 0 && slottedTitle === null) {
|
|
1104
1105
|
throw new Error('<mg-illustrated-message> Slot "title" or "details" must be present.');
|
|
1105
1106
|
}
|
|
1106
|
-
else if (slottedTitle !== null && !index_es.
|
|
1107
|
+
else if (slottedTitle !== null && !index_es.qt(slottedTitle, headingTags)) {
|
|
1107
1108
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
1108
1109
|
}
|
|
1109
1110
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -1127,7 +1128,7 @@ const MgIllustratedMessage = class {
|
|
|
1127
1128
|
* @returns HTML Element
|
|
1128
1129
|
*/
|
|
1129
1130
|
render() {
|
|
1130
|
-
return (index.h("div", { key: '
|
|
1131
|
+
return (index.h("div", { key: '60c53ef4294aa36a8c354b42f47f5c7d9fc409f6', class: this.classCollection.join() }, index.h("div", { key: '254673ae5b7183a1adfa53c18d9e632bcdd67607', class: "mg-c-illustrated-message__illustration" }, index.h("slot", { key: '16b9bbe8abaae4d0f7b713fbe345e54b5b966ac0', name: "illustration" })), index.h("div", { key: 'c272c168ea520f8c71261e8f84297fb1bd44c044', class: "mg-c-illustrated-message__slots" }, index.h("slot", { key: '7ba11d5f5fe293175a01768619bc43b0632ba0a5', name: "title" }), index.h("slot", { key: 'f03540939af486bb44134298b12eaf9de32f814a', name: "details" }))));
|
|
1131
1132
|
}
|
|
1132
1133
|
get element() { return index.getElement(this); }
|
|
1133
1134
|
static get watchers() { return {
|
|
@@ -1188,11 +1189,11 @@ const MgInput = class {
|
|
|
1188
1189
|
this.renderTooltip = () => (index.h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, index.h("mg-icon", { icon: "info-circle" })));
|
|
1189
1190
|
}
|
|
1190
1191
|
watchIdentifier(newValue) {
|
|
1191
|
-
if (!index_es.
|
|
1192
|
-
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${index_es.
|
|
1192
|
+
if (!index_es.De(newValue)) {
|
|
1193
|
+
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${index_es.Gt(newValue)}.`);
|
|
1193
1194
|
}
|
|
1194
|
-
else if (!index_es.
|
|
1195
|
-
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
1195
|
+
else if (!index_es.Ut(newValue)) {
|
|
1196
|
+
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
1196
1197
|
}
|
|
1197
1198
|
else {
|
|
1198
1199
|
this.helpTextId = `${this.identifier}-help-text`;
|
|
@@ -1214,7 +1215,7 @@ const MgInput = class {
|
|
|
1214
1215
|
}
|
|
1215
1216
|
watchTooltipPosition(newValue) {
|
|
1216
1217
|
if (!mgInput_conf.tooltipPositions.includes(newValue)) {
|
|
1217
|
-
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${mgInput_conf.tooltipPositions.join(', ')}. Passed value: ${index_es.
|
|
1218
|
+
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${mgInput_conf.tooltipPositions.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
1218
1219
|
}
|
|
1219
1220
|
}
|
|
1220
1221
|
watchErrorMessage(newValue) {
|
|
@@ -1283,8 +1284,8 @@ const MgInput = class {
|
|
|
1283
1284
|
*/
|
|
1284
1285
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1285
1286
|
watchLabel() {
|
|
1286
|
-
if (!index_es.
|
|
1287
|
-
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${index_es.
|
|
1287
|
+
if (!index_es.De(this.label)) {
|
|
1288
|
+
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${index_es.Gt(this.label)}.`);
|
|
1288
1289
|
}
|
|
1289
1290
|
else {
|
|
1290
1291
|
this.watchAriaDescribedbyIDs();
|
|
@@ -1488,7 +1489,7 @@ const MgInputCheckbox = class {
|
|
|
1488
1489
|
/**
|
|
1489
1490
|
* Component classes
|
|
1490
1491
|
*/
|
|
1491
|
-
this.classCollection = new index_es.
|
|
1492
|
+
this.classCollection = new index_es.Zt([this.baseClassName, mgInput_conf.classFieldset]);
|
|
1492
1493
|
/**
|
|
1493
1494
|
* Formated value to display in list
|
|
1494
1495
|
*/
|
|
@@ -1606,7 +1607,7 @@ const MgInputCheckbox = class {
|
|
|
1606
1607
|
* Method to update searchResults
|
|
1607
1608
|
*/
|
|
1608
1609
|
this.updateSearchResults = () => {
|
|
1609
|
-
this.searchResults = this.checkboxItems.filter(item => index_es.
|
|
1610
|
+
this.searchResults = this.checkboxItems.filter(item => index_es.Jt(item.title).includes(index_es.Jt(this.searchValue)));
|
|
1610
1611
|
};
|
|
1611
1612
|
/**
|
|
1612
1613
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1638,13 +1639,13 @@ const MgInputCheckbox = class {
|
|
|
1638
1639
|
* @returns message to display
|
|
1639
1640
|
*/
|
|
1640
1641
|
this.getSelectValuesButtonMessage = () => {
|
|
1641
|
-
if (this.selectValuesButtonKey === 'editButton' && index_es.
|
|
1642
|
+
if (this.selectValuesButtonKey === 'editButton' && index_es.De(this.editButtonMessage)) {
|
|
1642
1643
|
return this.editButtonMessage;
|
|
1643
1644
|
}
|
|
1644
|
-
else if (this.selectValuesButtonKey === 'showButton' && index_es.
|
|
1645
|
+
else if (this.selectValuesButtonKey === 'showButton' && index_es.De(this.showButtonMessage)) {
|
|
1645
1646
|
return this.showButtonMessage;
|
|
1646
1647
|
}
|
|
1647
|
-
else if (this.selectValuesButtonKey === 'selectButton' && index_es.
|
|
1648
|
+
else if (this.selectValuesButtonKey === 'selectButton' && index_es.De(this.selectButtonMessage)) {
|
|
1648
1649
|
return this.selectButtonMessage;
|
|
1649
1650
|
}
|
|
1650
1651
|
else {
|
|
@@ -1700,12 +1701,12 @@ const MgInputCheckbox = class {
|
|
|
1700
1701
|
this.valueChange.emit(newValue);
|
|
1701
1702
|
}
|
|
1702
1703
|
else {
|
|
1703
|
-
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${index_es.
|
|
1704
|
+
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${index_es.Gt(newValue)}.`);
|
|
1704
1705
|
}
|
|
1705
1706
|
}
|
|
1706
1707
|
validateType(newValue) {
|
|
1707
1708
|
if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
|
|
1708
|
-
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${index_es.
|
|
1709
|
+
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${index_es.Gt(newValue)}.`);
|
|
1709
1710
|
}
|
|
1710
1711
|
else if (newValue === undefined) {
|
|
1711
1712
|
this.mode = 'auto';
|
|
@@ -1805,7 +1806,7 @@ const MgInputCheckbox = class {
|
|
|
1805
1806
|
if (typeof valid !== 'boolean') {
|
|
1806
1807
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
|
|
1807
1808
|
}
|
|
1808
|
-
else if (!index_es.
|
|
1809
|
+
else if (!index_es.De(errorMessage)) {
|
|
1809
1810
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
|
|
1810
1811
|
}
|
|
1811
1812
|
else {
|
|
@@ -2077,7 +2078,7 @@ const MgInputCheckboxPaginated = class {
|
|
|
2077
2078
|
|
|
2078
2079
|
const DEFAULT_MAX_DATE = '9999-12-31';
|
|
2079
2080
|
|
|
2080
|
-
const mgInputDateCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/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}}";
|
|
2081
|
+
const mgInputDateCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*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}}";
|
|
2081
2082
|
|
|
2082
2083
|
const MgInputDate = class {
|
|
2083
2084
|
constructor(hostRef) {
|
|
@@ -2123,13 +2124,13 @@ const MgInputDate = class {
|
|
|
2123
2124
|
/**
|
|
2124
2125
|
* Component classes
|
|
2125
2126
|
*/
|
|
2126
|
-
this.classCollection = new index_es.
|
|
2127
|
+
this.classCollection = new index_es.Zt(['mg-c-input--date']);
|
|
2127
2128
|
/**
|
|
2128
2129
|
* Method to validate date pattern string
|
|
2129
2130
|
* @param value - value to test
|
|
2130
2131
|
* @returns truthy when value match the pattern
|
|
2131
2132
|
*/
|
|
2132
|
-
this.isValidPattern = (value) => index_es.
|
|
2133
|
+
this.isValidPattern = (value) => index_es.De(value) && index_es.Lt.test(value);
|
|
2133
2134
|
/**
|
|
2134
2135
|
* Format help text to display
|
|
2135
2136
|
* @param helpText - help text format
|
|
@@ -2143,23 +2144,23 @@ const MgInputDate = class {
|
|
|
2143
2144
|
}
|
|
2144
2145
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
2145
2146
|
// If a custom helpText is provided, store it but don't return it directly
|
|
2146
|
-
let text = index_es.
|
|
2147
|
+
let text = index_es.De(helpText) ? helpText : this.messages.input.date.helpText.expectedFormat;
|
|
2147
2148
|
// Handle defaultHelpText
|
|
2148
2149
|
if (text.includes(defaultHelpTextVariable)) {
|
|
2149
2150
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText.expectedFormat));
|
|
2150
2151
|
}
|
|
2151
2152
|
// Replace pattern and date variables
|
|
2152
|
-
text = text.replace('{pattern}', this.renderPattern()).replace('{date}', index_es.
|
|
2153
|
+
text = text.replace('{pattern}', this.renderPattern()).replace('{date}', index_es.Ft(index_es.ar(new Date('2025-12-24')), this.systemLocale));
|
|
2153
2154
|
// Add additional message for min/max if necessary
|
|
2154
2155
|
let rangeMessage;
|
|
2155
2156
|
if (((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.max !== DEFAULT_MAX_DATE) {
|
|
2156
|
-
rangeMessage = this.messages.input.date.helpText.minMax.replace('{min}', index_es.
|
|
2157
|
+
rangeMessage = this.messages.input.date.helpText.minMax.replace('{min}', index_es.Ft(this.min, this.systemLocale)).replace('{max}', index_es.Ft(this.max, this.systemLocale));
|
|
2157
2158
|
}
|
|
2158
2159
|
else if (((_b = this.min) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
2159
|
-
rangeMessage = this.messages.input.date.helpText.min.replace('{min}', index_es.
|
|
2160
|
+
rangeMessage = this.messages.input.date.helpText.min.replace('{min}', index_es.Ft(this.min, this.systemLocale));
|
|
2160
2161
|
}
|
|
2161
2162
|
else if (this.max !== DEFAULT_MAX_DATE) {
|
|
2162
|
-
rangeMessage = this.messages.input.date.helpText.max.replace('{max}', index_es.
|
|
2163
|
+
rangeMessage = this.messages.input.date.helpText.max.replace('{max}', index_es.Ft(this.max, this.systemLocale));
|
|
2163
2164
|
}
|
|
2164
2165
|
// Combine custom helpText with range message if both exist
|
|
2165
2166
|
if (text !== undefined && rangeMessage !== undefined) {
|
|
@@ -2256,15 +2257,15 @@ const MgInputDate = class {
|
|
|
2256
2257
|
// min, max & minMax
|
|
2257
2258
|
else if (['min', 'max', 'minMax'].includes(inputError)) {
|
|
2258
2259
|
this.errorMessage = this.messages.input.date.helpText[inputError]
|
|
2259
|
-
.replace('{min}', index_es.
|
|
2260
|
-
.replace('{max}', index_es.
|
|
2260
|
+
.replace('{min}', index_es.Ft(this.min, this.systemLocale))
|
|
2261
|
+
.replace('{max}', index_es.Ft(this.max, this.systemLocale));
|
|
2261
2262
|
}
|
|
2262
2263
|
// wrong date format
|
|
2263
2264
|
// element.validity.badInput is default error message
|
|
2264
2265
|
else {
|
|
2265
2266
|
this.errorMessage = this.messages.input.date.error.badInput
|
|
2266
2267
|
.replace('{pattern}', this.renderPattern())
|
|
2267
|
-
.replace('{date}', index_es.
|
|
2268
|
+
.replace('{date}', index_es.Ft(index_es.ar(new Date('2025-12-24')), this.systemLocale));
|
|
2268
2269
|
}
|
|
2269
2270
|
}
|
|
2270
2271
|
};
|
|
@@ -2273,7 +2274,7 @@ const MgInputDate = class {
|
|
|
2273
2274
|
* @returns translated html pattern
|
|
2274
2275
|
*/
|
|
2275
2276
|
this.renderPattern = () => {
|
|
2276
|
-
let patternLocal = index_es.
|
|
2277
|
+
let patternLocal = index_es.ir(this.systemLocale);
|
|
2277
2278
|
for (const key in this.messages.input.date.pattern) {
|
|
2278
2279
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
2279
2280
|
}
|
|
@@ -2288,9 +2289,9 @@ const MgInputDate = class {
|
|
|
2288
2289
|
// - `undefined` is not allowed in CustomEvent['detail']
|
|
2289
2290
|
this.value = null;
|
|
2290
2291
|
}
|
|
2291
|
-
else if (newValue && !index_es.
|
|
2292
|
+
else if (newValue && !index_es.De(newValue)) {
|
|
2292
2293
|
// check value validity
|
|
2293
|
-
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${index_es.
|
|
2294
|
+
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${index_es.Gt(newValue)}.`);
|
|
2294
2295
|
}
|
|
2295
2296
|
else if (newValue === null || this.isValidPattern(newValue)) {
|
|
2296
2297
|
this.valueChange.emit(newValue);
|
|
@@ -2307,7 +2308,7 @@ const MgInputDate = class {
|
|
|
2307
2308
|
}
|
|
2308
2309
|
validateMinMax(newValue) {
|
|
2309
2310
|
if (newValue && !this.isValidPattern(newValue)) {
|
|
2310
|
-
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${index_es.
|
|
2311
|
+
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${index_es.Gt(newValue)}.`);
|
|
2311
2312
|
}
|
|
2312
2313
|
}
|
|
2313
2314
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -2357,7 +2358,7 @@ const MgInputDate = class {
|
|
|
2357
2358
|
if (typeof valid !== 'boolean') {
|
|
2358
2359
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean.');
|
|
2359
2360
|
}
|
|
2360
|
-
else if (!index_es.
|
|
2361
|
+
else if (!index_es.De(errorMessage)) {
|
|
2361
2362
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string.');
|
|
2362
2363
|
}
|
|
2363
2364
|
else {
|
|
@@ -2423,7 +2424,7 @@ const MgInputDate = class {
|
|
|
2423
2424
|
* @returns HTML Element
|
|
2424
2425
|
*/
|
|
2425
2426
|
render() {
|
|
2426
|
-
return (index.h("mg-input", { key: '
|
|
2427
|
+
return (index.h("mg-input", { key: '504777cb807b9747a6c854d7056cb5420eb2cdcf', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === null ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly ? (this.value && index.h("b", { class: "mg-c-input__readonly-value" }, index_es.Ft(this.value, this.locale))) : (index.h("input", { 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) => {
|
|
2427
2428
|
if (el !== null)
|
|
2428
2429
|
this.input = el;
|
|
2429
2430
|
} }))));
|
|
@@ -2446,7 +2447,7 @@ MgInputDate.style = mgInputDateCss;
|
|
|
2446
2447
|
const types = ['decimal', 'integer'];
|
|
2447
2448
|
const formats = ['none', 'number', 'currency', 'percent', 'unit'];
|
|
2448
2449
|
|
|
2449
|
-
const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
|
|
2450
|
+
const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
|
|
2450
2451
|
|
|
2451
2452
|
const MgInputNumeric = class {
|
|
2452
2453
|
constructor(hostRef) {
|
|
@@ -2514,17 +2515,17 @@ const MgInputNumeric = class {
|
|
|
2514
2515
|
/**
|
|
2515
2516
|
* Component classes
|
|
2516
2517
|
*/
|
|
2517
|
-
this.classCollection = new index_es.
|
|
2518
|
+
this.classCollection = new index_es.Zt(['mg-c-input--numeric']);
|
|
2518
2519
|
/**
|
|
2519
2520
|
* Handle input event
|
|
2520
2521
|
*/
|
|
2521
2522
|
this.handleInput = () => {
|
|
2523
|
+
this.value = this.input.value;
|
|
2522
2524
|
// Check validity
|
|
2523
2525
|
this.checkValidity();
|
|
2524
2526
|
if (this.hasDisplayedError) {
|
|
2525
2527
|
this.setErrorMessage();
|
|
2526
2528
|
}
|
|
2527
|
-
this.value = this.input.value;
|
|
2528
2529
|
};
|
|
2529
2530
|
/**
|
|
2530
2531
|
* Handle focus event
|
|
@@ -2557,7 +2558,7 @@ const MgInputNumeric = class {
|
|
|
2557
2558
|
* @param value - value to format
|
|
2558
2559
|
* @returns formatted value according to locale
|
|
2559
2560
|
*/
|
|
2560
|
-
this.formatErrorValue = (value) => index_es.
|
|
2561
|
+
this.formatErrorValue = (value) => index_es.lr(value, this.locale, !Number.isInteger(value) && this.type === 'decimal' ? this.decimalLength : 0);
|
|
2561
2562
|
/**
|
|
2562
2563
|
* Set input error message
|
|
2563
2564
|
* @param errorMessage - errorMessage override
|
|
@@ -2612,13 +2613,13 @@ const MgInputNumeric = class {
|
|
|
2612
2613
|
this.formatValue = (value) => {
|
|
2613
2614
|
switch (this.format) {
|
|
2614
2615
|
case 'number':
|
|
2615
|
-
return index_es.
|
|
2616
|
+
return index_es.lr(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2616
2617
|
case 'currency':
|
|
2617
|
-
return index_es.
|
|
2618
|
+
return index_es.or(value, this.locale, this.currency);
|
|
2618
2619
|
case 'percent':
|
|
2619
|
-
return index_es.
|
|
2620
|
+
return index_es.cr(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2620
2621
|
case 'unit':
|
|
2621
|
-
return index_es.
|
|
2622
|
+
return index_es.fr(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2622
2623
|
case 'none':
|
|
2623
2624
|
return value.toString();
|
|
2624
2625
|
}
|
|
@@ -2649,7 +2650,7 @@ const MgInputNumeric = class {
|
|
|
2649
2650
|
return undefined;
|
|
2650
2651
|
}
|
|
2651
2652
|
// If a custom helpText is provided, store it but don't return it directly
|
|
2652
|
-
const text = index_es.
|
|
2653
|
+
const text = index_es.De(helpText) ? helpText : undefined;
|
|
2653
2654
|
// If neither min nor max are defined, and there's no custom helpText,
|
|
2654
2655
|
// we can return undefined as there's no message to display
|
|
2655
2656
|
if (this.min === undefined && this.max === undefined && text === undefined) {
|
|
@@ -2733,22 +2734,22 @@ const MgInputNumeric = class {
|
|
|
2733
2734
|
}
|
|
2734
2735
|
validateType(newValue) {
|
|
2735
2736
|
if (!types.includes(newValue)) {
|
|
2736
|
-
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${index_es.
|
|
2737
|
+
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
2737
2738
|
}
|
|
2738
2739
|
}
|
|
2739
2740
|
watchFormat(newValue) {
|
|
2740
2741
|
if (!formats.includes(newValue)) {
|
|
2741
|
-
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${index_es.
|
|
2742
|
+
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
2742
2743
|
}
|
|
2743
2744
|
}
|
|
2744
2745
|
validateIntegerLength(newValue) {
|
|
2745
2746
|
if (newValue < 1) {
|
|
2746
|
-
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${index_es.
|
|
2747
|
+
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${index_es.Gt(newValue)}.`);
|
|
2747
2748
|
}
|
|
2748
2749
|
}
|
|
2749
2750
|
validateDecimalLength(newValue) {
|
|
2750
2751
|
if (newValue < 1) {
|
|
2751
|
-
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${index_es.
|
|
2752
|
+
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${index_es.Gt(newValue)}.`);
|
|
2752
2753
|
}
|
|
2753
2754
|
}
|
|
2754
2755
|
/**
|
|
@@ -2782,7 +2783,7 @@ const MgInputNumeric = class {
|
|
|
2782
2783
|
if (typeof valid !== 'boolean') {
|
|
2783
2784
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
|
|
2784
2785
|
}
|
|
2785
|
-
else if (!index_es.
|
|
2786
|
+
else if (!index_es.De(errorMessage)) {
|
|
2786
2787
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
|
|
2787
2788
|
}
|
|
2788
2789
|
else {
|
|
@@ -2883,7 +2884,7 @@ const MgInputNumeric = class {
|
|
|
2883
2884
|
* @returns HTML Element
|
|
2884
2885
|
*/
|
|
2885
2886
|
render() {
|
|
2886
|
-
return (index.h("mg-input", { key: '
|
|
2887
|
+
return (index.h("mg-input", { key: '3f78e44ccfd37e0d9245b368e66d5650fa3c642c', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly
|
|
2887
2888
|
? this.readonlyValue && this.renderReadonly()
|
|
2888
2889
|
: [
|
|
2889
2890
|
index.h("input", { key: "input", 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, autocomplete: "off", "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
@@ -2910,7 +2911,7 @@ const MgInputNumeric = class {
|
|
|
2910
2911
|
};
|
|
2911
2912
|
MgInputNumeric.style = mgInputNumericCss;
|
|
2912
2913
|
|
|
2913
|
-
const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--password .mg-c-input__input-icon{color:var(--mg-b-color-dark)}.mg-c-input.mg-c-input--password .mg-c-input__input-group{position:relative;flex-grow:1}.mg-c-input.mg-c-input--password .mg-c-input__append-button{position:absolute;right:0}.mg-c-input.mg-c-input--password .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-8))}.mg-c-input.mg-c-input--password .mg-c-input__box::-ms-reveal{display:none}";
|
|
2914
|
+
const mgInputPasswordCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--password .mg-c-input__input-icon{color:var(--mg-b-color-dark)}.mg-c-input.mg-c-input--password .mg-c-input__input-group{position:relative;flex-grow:1}.mg-c-input.mg-c-input--password .mg-c-input__append-button{position:absolute;right:0}.mg-c-input.mg-c-input--password .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-8))}.mg-c-input.mg-c-input--password .mg-c-input__box::-ms-reveal{display:none}";
|
|
2914
2915
|
|
|
2915
2916
|
const MgInputPassword = class {
|
|
2916
2917
|
constructor(hostRef) {
|
|
@@ -2955,7 +2956,7 @@ const MgInputPassword = class {
|
|
|
2955
2956
|
/**
|
|
2956
2957
|
* Component classes
|
|
2957
2958
|
*/
|
|
2958
|
-
this.classCollection = new index_es.
|
|
2959
|
+
this.classCollection = new index_es.Zt(['mg-c-input--password']);
|
|
2959
2960
|
/**
|
|
2960
2961
|
* Indicates if password is displayed or not
|
|
2961
2962
|
*/
|
|
@@ -3075,7 +3076,7 @@ const MgInputPassword = class {
|
|
|
3075
3076
|
if (typeof valid !== 'boolean') {
|
|
3076
3077
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
|
|
3077
3078
|
}
|
|
3078
|
-
else if (!index_es.
|
|
3079
|
+
else if (!index_es.De(errorMessage)) {
|
|
3079
3080
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
|
|
3080
3081
|
}
|
|
3081
3082
|
else {
|
|
@@ -3132,7 +3133,7 @@ const MgInputPassword = class {
|
|
|
3132
3133
|
* @returns HTML Element
|
|
3133
3134
|
*/
|
|
3134
3135
|
render() {
|
|
3135
|
-
return (index.h("mg-input", { key: '
|
|
3136
|
+
return (index.h("mg-input", { key: 'ac5e6acb05dbad179aa6c216bf49531399276563', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && index.h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (index.h("span", { class: "mg-c-input__input-group" }, index.h("input", { 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, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
3136
3137
|
if (el !== null)
|
|
3137
3138
|
this.input = el;
|
|
3138
3139
|
} }), index.h("mg-button", { 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", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
|
|
@@ -3206,7 +3207,7 @@ const MgInputRadio = class {
|
|
|
3206
3207
|
/**
|
|
3207
3208
|
* Component classes
|
|
3208
3209
|
*/
|
|
3209
|
-
this.classCollection = new index_es.
|
|
3210
|
+
this.classCollection = new index_es.Zt(['mg-c-input--radio', mgInput_conf.classFieldset]);
|
|
3210
3211
|
/**
|
|
3211
3212
|
* Handle input event
|
|
3212
3213
|
* @param event - input event
|
|
@@ -3257,7 +3258,7 @@ const MgInputRadio = class {
|
|
|
3257
3258
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3258
3259
|
watchValue(newValue) {
|
|
3259
3260
|
var _a;
|
|
3260
|
-
if (index_es.
|
|
3261
|
+
if (index_es.Dt(this.items) && typeof newValue === 'string') {
|
|
3261
3262
|
this.readonlyValue = newValue;
|
|
3262
3263
|
}
|
|
3263
3264
|
else if (Array.isArray(this.items) && this.items.every(isOption$3)) {
|
|
@@ -3271,10 +3272,10 @@ const MgInputRadio = class {
|
|
|
3271
3272
|
validateItems(newValue) {
|
|
3272
3273
|
// Validate if items have required min length
|
|
3273
3274
|
if (typeof newValue === 'object' && newValue.length < 2) {
|
|
3274
|
-
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${index_es.
|
|
3275
|
+
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${index_es.Gt(newValue)}.`);
|
|
3275
3276
|
}
|
|
3276
3277
|
// String array
|
|
3277
|
-
else if (index_es.
|
|
3278
|
+
else if (index_es.Dt(newValue)) {
|
|
3278
3279
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
3279
3280
|
}
|
|
3280
3281
|
// Object array
|
|
@@ -3282,7 +3283,7 @@ const MgInputRadio = class {
|
|
|
3282
3283
|
this.options = newValue;
|
|
3283
3284
|
}
|
|
3284
3285
|
else {
|
|
3285
|
-
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${index_es.
|
|
3286
|
+
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${index_es.Gt(newValue)}.`);
|
|
3286
3287
|
}
|
|
3287
3288
|
}
|
|
3288
3289
|
watchInputVerticalList(newValue) {
|
|
@@ -3344,7 +3345,7 @@ const MgInputRadio = class {
|
|
|
3344
3345
|
if (typeof valid !== 'boolean') {
|
|
3345
3346
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');
|
|
3346
3347
|
}
|
|
3347
|
-
else if (!index_es.
|
|
3348
|
+
else if (!index_es.De(errorMessage)) {
|
|
3348
3349
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');
|
|
3349
3350
|
}
|
|
3350
3351
|
else {
|
|
@@ -3404,7 +3405,7 @@ const MgInputRadio = class {
|
|
|
3404
3405
|
* @returns HTML Element
|
|
3405
3406
|
*/
|
|
3406
3407
|
render() {
|
|
3407
|
-
return (index.h("mg-input", { key: '
|
|
3408
|
+
return (index.h("mg-input", { key: '9d8c6fb134330e0d126f3585f3c4c4145d39515a', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && index.h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (index.h("ul", { 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) => {
|
|
3408
3409
|
if (el !== null)
|
|
3409
3410
|
this.inputs[index$1] = el;
|
|
3410
3411
|
} }), index.h("label", { htmlFor: this.identifier + '_' + index$1 }, input.title))))))));
|
|
@@ -3421,7 +3422,7 @@ const MgInputRadio = class {
|
|
|
3421
3422
|
};
|
|
3422
3423
|
MgInputRadio.style = mgInputRadioCss;
|
|
3423
3424
|
|
|
3424
|
-
const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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-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__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
|
|
3425
|
+
const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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-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__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
|
|
3425
3426
|
|
|
3426
3427
|
/**
|
|
3427
3428
|
* Check if item is a well configured option
|
|
@@ -3512,7 +3513,7 @@ const MgInputSelect = class {
|
|
|
3512
3513
|
/**
|
|
3513
3514
|
* Component classes
|
|
3514
3515
|
*/
|
|
3515
|
-
this.classCollection = new index_es.
|
|
3516
|
+
this.classCollection = new index_es.Zt(['mg-c-input--select']);
|
|
3516
3517
|
/**
|
|
3517
3518
|
* Handle input event
|
|
3518
3519
|
*/
|
|
@@ -3542,7 +3543,7 @@ const MgInputSelect = class {
|
|
|
3542
3543
|
if (this.input.value === '') {
|
|
3543
3544
|
this.setValue(null);
|
|
3544
3545
|
}
|
|
3545
|
-
else if (index_es.
|
|
3546
|
+
else if (index_es.Dt(this.items) && this.items.includes(this.input.value)) {
|
|
3546
3547
|
this.setValue(this.input.value);
|
|
3547
3548
|
}
|
|
3548
3549
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3600,7 +3601,7 @@ const MgInputSelect = class {
|
|
|
3600
3601
|
}
|
|
3601
3602
|
validateValue(newValue) {
|
|
3602
3603
|
var _a, _b;
|
|
3603
|
-
if (index_es.
|
|
3604
|
+
if (index_es.Dt(this.items) && typeof newValue === 'string') {
|
|
3604
3605
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? this.input.value : newValue;
|
|
3605
3606
|
}
|
|
3606
3607
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3617,7 +3618,7 @@ const MgInputSelect = class {
|
|
|
3617
3618
|
this.options = [];
|
|
3618
3619
|
}
|
|
3619
3620
|
// String array
|
|
3620
|
-
else if (index_es.
|
|
3621
|
+
else if (index_es.Dt(newValue)) {
|
|
3621
3622
|
if (typeof this.value === 'string')
|
|
3622
3623
|
this.valueExist = newValue.includes(this.value);
|
|
3623
3624
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3635,7 +3636,7 @@ const MgInputSelect = class {
|
|
|
3635
3636
|
}
|
|
3636
3637
|
}
|
|
3637
3638
|
else {
|
|
3638
|
-
throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${index_es.
|
|
3639
|
+
throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${index_es.Gt(newValue)}.`);
|
|
3639
3640
|
}
|
|
3640
3641
|
}
|
|
3641
3642
|
watchReadonly(newValue) {
|
|
@@ -3700,7 +3701,7 @@ const MgInputSelect = class {
|
|
|
3700
3701
|
if (typeof valid !== 'boolean') {
|
|
3701
3702
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean.');
|
|
3702
3703
|
}
|
|
3703
|
-
else if (!index_es.
|
|
3704
|
+
else if (!index_es.De(errorMessage)) {
|
|
3704
3705
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string.');
|
|
3705
3706
|
}
|
|
3706
3707
|
else {
|
|
@@ -3764,7 +3765,7 @@ const MgInputSelect = class {
|
|
|
3764
3765
|
* @returns HTML Element
|
|
3765
3766
|
*/
|
|
3766
3767
|
render() {
|
|
3767
|
-
return (index.h("mg-input", { key: '
|
|
3768
|
+
return (index.h("mg-input", { key: '8fc77d20fe8fda510ea0352bc7246fafea31f8d8', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && index.h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (index.h("select", { 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) => {
|
|
3768
3769
|
if (el !== null)
|
|
3769
3770
|
this.input = el;
|
|
3770
3771
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -3790,7 +3791,7 @@ const helpTextTypes = ['email', 'emails', 'url'];
|
|
|
3790
3791
|
// Define possible text types
|
|
3791
3792
|
const textTypes = ['text', 'search', 'tel', ...helpTextTypes];
|
|
3792
3793
|
|
|
3793
|
-
const mgInputTextCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--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:max(var(--mg-c-character-left-message-length)*(.35ch + .3rem) + var(--mg-b-size-16)*clamp(0,var(--mg-c-character-left-message-length),1),var(--mg-b-size-8))}.mg-c-input__with-character-left mg-character-left{position:absolute;top:50%;right:var(--mg-b-size-8);display:none;font-size:var(--mg-b-font-size-small);opacity:.6;transform:translateY(-50%)}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{display:block}
|
|
3794
|
+
const mgInputTextCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--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:max(var(--mg-c-character-left-message-length)*(.35ch + .3rem) + var(--mg-b-size-16)*clamp(0,var(--mg-c-character-left-message-length),1),var(--mg-b-size-8))}.mg-c-input__with-character-left mg-character-left{position:absolute;top:50%;right:var(--mg-b-size-8);display:none;font-size:var(--mg-b-font-size-small);opacity:.6;transform:translateY(-50%)}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{display:block}";
|
|
3794
3795
|
|
|
3795
3796
|
/**
|
|
3796
3797
|
* Check if object is an option
|
|
@@ -3803,7 +3804,7 @@ const isOption$1 = (option) => typeof option === 'object' && typeof option.title
|
|
|
3803
3804
|
* @param options - Datalist options to check.
|
|
3804
3805
|
* @returns True if datalist is well structured.
|
|
3805
3806
|
*/
|
|
3806
|
-
const isDatalistOptions = (options) => index_es.
|
|
3807
|
+
const isDatalistOptions = (options) => index_es.Dt(options) || (Array.isArray(options) && options.every(isOption$1));
|
|
3807
3808
|
const MgInputText = class {
|
|
3808
3809
|
constructor(hostRef) {
|
|
3809
3810
|
index.registerInstance(this, hostRef);
|
|
@@ -3868,13 +3869,13 @@ const MgInputText = class {
|
|
|
3868
3869
|
/**
|
|
3869
3870
|
* Component classes
|
|
3870
3871
|
*/
|
|
3871
|
-
this.classCollection = new index_es.
|
|
3872
|
+
this.classCollection = new index_es.Zt(['mg-c-input--text']);
|
|
3872
3873
|
/**
|
|
3873
3874
|
* Validate pattern configuration
|
|
3874
3875
|
*/
|
|
3875
3876
|
this.validatePattern = () => {
|
|
3876
3877
|
if ((this.pattern !== undefined || this.patternErrorMessage !== undefined) && // At least one is defined
|
|
3877
|
-
(!index_es.
|
|
3878
|
+
(!index_es.De(this.pattern) || (!helpTextTypes.includes(this.type) && !index_es.De(this.patternErrorMessage))) // Both must be defined
|
|
3878
3879
|
) {
|
|
3879
3880
|
throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${this.pattern}'" and "patternErrorMessage='${this.patternErrorMessage}'".`);
|
|
3880
3881
|
}
|
|
@@ -3894,7 +3895,7 @@ const MgInputText = class {
|
|
|
3894
3895
|
*/
|
|
3895
3896
|
this.handleFocus = () => {
|
|
3896
3897
|
this.classCollection.add(this.classFocus);
|
|
3897
|
-
this.classCollection = new index_es.
|
|
3898
|
+
this.classCollection = new index_es.Zt(this.classCollection.classes);
|
|
3898
3899
|
};
|
|
3899
3900
|
/**
|
|
3900
3901
|
* Handle blur event
|
|
@@ -3902,7 +3903,7 @@ const MgInputText = class {
|
|
|
3902
3903
|
this.handleBlur = () => {
|
|
3903
3904
|
// Manage focus
|
|
3904
3905
|
this.classCollection.delete(this.classFocus);
|
|
3905
|
-
this.classCollection = new index_es.
|
|
3906
|
+
this.classCollection = new index_es.Zt(this.classCollection.classes);
|
|
3906
3907
|
// Display Error
|
|
3907
3908
|
this.handlerInProgress = 'blur';
|
|
3908
3909
|
this.displayError().finally(() => {
|
|
@@ -3997,7 +3998,7 @@ const MgInputText = class {
|
|
|
3997
3998
|
}
|
|
3998
3999
|
validateDatalistoptions(newValue) {
|
|
3999
4000
|
if (Boolean(newValue) && !isDatalistOptions(newValue)) {
|
|
4000
|
-
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${index_es.
|
|
4001
|
+
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${index_es.Gt(newValue)}.`);
|
|
4001
4002
|
}
|
|
4002
4003
|
}
|
|
4003
4004
|
watchReadonly(newValue) {
|
|
@@ -4035,7 +4036,7 @@ const MgInputText = class {
|
|
|
4035
4036
|
this.validatePattern();
|
|
4036
4037
|
}
|
|
4037
4038
|
watchHelpText(newValue) {
|
|
4038
|
-
if (!index_es.
|
|
4039
|
+
if (!index_es.De(newValue) && helpTextTypes.includes(this.type)) {
|
|
4039
4040
|
this.helpText = this.messages.input.text.helpText[this.type];
|
|
4040
4041
|
}
|
|
4041
4042
|
}
|
|
@@ -4076,7 +4077,7 @@ const MgInputText = class {
|
|
|
4076
4077
|
if (typeof valid !== 'boolean') {
|
|
4077
4078
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
|
|
4078
4079
|
}
|
|
4079
|
-
else if (!index_es.
|
|
4080
|
+
else if (!index_es.De(errorMessage)) {
|
|
4080
4081
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
|
|
4081
4082
|
}
|
|
4082
4083
|
else {
|
|
@@ -4142,7 +4143,7 @@ const MgInputText = class {
|
|
|
4142
4143
|
* @returns HTML Element
|
|
4143
4144
|
*/
|
|
4144
4145
|
render() {
|
|
4145
|
-
return (index.h("mg-input", { key: '
|
|
4146
|
+
return (index.h("mg-input", { key: 'ef5b732baa01518f61610cfc36dc8574782f12cc', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
|
|
4146
4147
|
? this.value && this.renderReadonly()
|
|
4147
4148
|
: [
|
|
4148
4149
|
index.h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
|
|
@@ -4171,7 +4172,7 @@ const MgInputText = class {
|
|
|
4171
4172
|
};
|
|
4172
4173
|
MgInputText.style = mgInputTextCss;
|
|
4173
4174
|
|
|
4174
|
-
const mgInputTextareaCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--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__input{align-items:start}.mg-c-input__box{display:block;height:auto;resize:none}.mg-c-input__box.mg-c-input__box--resizable{resize:both}.mg-c-input__box.mg-c-input__box--resizable-horizontal{resize:horizontal}.mg-c-input__box.mg-c-input__box--resizable-vertical{resize:vertical}.mg-c-input__readonly-value{white-space:pre-line}.mg-c-input__with-character-left{flex-grow:1}.mg-c-input__with-character-left mg-character-left{display:block;text-align:end;visibility:hidden}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-c-input__box{overflow-x:hidden}}";
|
|
4175
|
+
const mgInputTextareaCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));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-c-button-border-radius-top-right:0;--mg-c-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-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-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(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.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__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--display-character-left mg-character-left{font-size:var(--mg-b-font-size-small);opacity:.6}.mg-c-input.mg-c-input--display-character-left .mg-c-input__input+.mg-c-input__help-text ::slotted(*),.mg-c-input.mg-c-input--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__input{align-items:start}.mg-c-input__box{display:block;height:auto;resize:none}.mg-c-input__box.mg-c-input__box--resizable{resize:both}.mg-c-input__box.mg-c-input__box--resizable-horizontal{resize:horizontal}.mg-c-input__box.mg-c-input__box--resizable-vertical{resize:vertical}.mg-c-input__readonly-value{white-space:pre-line}.mg-c-input__with-character-left{flex-grow:1}.mg-c-input__with-character-left mg-character-left{display:block;text-align:end;visibility:hidden}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-c-input__box{overflow-x:hidden}}";
|
|
4175
4176
|
|
|
4176
4177
|
const MgInputTextarea = class {
|
|
4177
4178
|
constructor(hostRef) {
|
|
@@ -4238,7 +4239,7 @@ const MgInputTextarea = class {
|
|
|
4238
4239
|
/**
|
|
4239
4240
|
* Component classes
|
|
4240
4241
|
*/
|
|
4241
|
-
this.classCollection = new index_es.
|
|
4242
|
+
this.classCollection = new index_es.Zt(['mg-c-input--textarea']);
|
|
4242
4243
|
/**
|
|
4243
4244
|
* Handle input event
|
|
4244
4245
|
*/
|
|
@@ -4254,7 +4255,7 @@ const MgInputTextarea = class {
|
|
|
4254
4255
|
*/
|
|
4255
4256
|
this.handleFocus = () => {
|
|
4256
4257
|
this.classCollection.add(this.classFocus);
|
|
4257
|
-
this.classCollection = new index_es.
|
|
4258
|
+
this.classCollection = new index_es.Zt(this.classCollection.classes);
|
|
4258
4259
|
};
|
|
4259
4260
|
/**
|
|
4260
4261
|
* Handle blur event
|
|
@@ -4262,7 +4263,7 @@ const MgInputTextarea = class {
|
|
|
4262
4263
|
this.handleBlur = () => {
|
|
4263
4264
|
// Manage focus
|
|
4264
4265
|
this.classCollection.delete(this.classFocus);
|
|
4265
|
-
this.classCollection = new index_es.
|
|
4266
|
+
this.classCollection = new index_es.Zt(this.classCollection.classes);
|
|
4266
4267
|
// Display Error
|
|
4267
4268
|
this.handlerInProgress = 'blur';
|
|
4268
4269
|
this.displayError().finally(() => {
|
|
@@ -4340,8 +4341,8 @@ const MgInputTextarea = class {
|
|
|
4340
4341
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
4341
4342
|
}
|
|
4342
4343
|
validatePattern(newValue) {
|
|
4343
|
-
if (newValue !== undefined && !(index_es.
|
|
4344
|
-
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.
|
|
4344
|
+
if (newValue !== undefined && !(index_es.De(this.pattern) && index_es.De(this.patternErrorMessage))) {
|
|
4345
|
+
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.Gt(this.pattern)}'" and "patternErrorMessage='${index_es.Gt(this.patternErrorMessage)}'".`);
|
|
4345
4346
|
}
|
|
4346
4347
|
}
|
|
4347
4348
|
validatecharacterLeftHide(newValue) {
|
|
@@ -4383,7 +4384,7 @@ const MgInputTextarea = class {
|
|
|
4383
4384
|
if (typeof valid !== 'boolean') {
|
|
4384
4385
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
|
|
4385
4386
|
}
|
|
4386
|
-
else if (!index_es.
|
|
4387
|
+
else if (!index_es.De(errorMessage)) {
|
|
4387
4388
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
|
|
4388
4389
|
}
|
|
4389
4390
|
else {
|
|
@@ -4445,7 +4446,7 @@ const MgInputTextarea = class {
|
|
|
4445
4446
|
* @returns HTML Element
|
|
4446
4447
|
*/
|
|
4447
4448
|
render() {
|
|
4448
|
-
return (index.h("mg-input", { key: '
|
|
4449
|
+
return (index.h("mg-input", { key: '6ae7c6f9cfce48886d68e079ed6ac7e5b6e52eb4', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && index.h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (index.h("div", { class: "mg-c-input__with-character-left" }, index.h("textarea", { class: {
|
|
4449
4450
|
'mg-c-input__box': true,
|
|
4450
4451
|
'mg-c-input__box--width': true,
|
|
4451
4452
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
@@ -4485,11 +4486,11 @@ const MgInputTitle = class {
|
|
|
4485
4486
|
this.tagName = 'label';
|
|
4486
4487
|
}
|
|
4487
4488
|
validateIdentifier(newValue) {
|
|
4488
|
-
if (!index_es.
|
|
4489
|
+
if (!index_es.De(newValue)) {
|
|
4489
4490
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
4490
4491
|
}
|
|
4491
|
-
else if (!index_es.
|
|
4492
|
-
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
4492
|
+
else if (!index_es.Ut(newValue)) {
|
|
4493
|
+
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
4493
4494
|
}
|
|
4494
4495
|
}
|
|
4495
4496
|
validateIsLegend(newValue) {
|
|
@@ -4577,7 +4578,7 @@ const MgInputToggle = class {
|
|
|
4577
4578
|
/**
|
|
4578
4579
|
* Component classes
|
|
4579
4580
|
*/
|
|
4580
|
-
this.classCollection = new index_es.
|
|
4581
|
+
this.classCollection = new index_es.Zt(['mg-c-input--toggle']);
|
|
4581
4582
|
/**
|
|
4582
4583
|
* Checked internal value
|
|
4583
4584
|
*/
|
|
@@ -4638,10 +4639,10 @@ const MgInputToggle = class {
|
|
|
4638
4639
|
}
|
|
4639
4640
|
validateItems(newValue) {
|
|
4640
4641
|
if (typeof newValue === 'object' && this.items.length !== 2) {
|
|
4641
|
-
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${index_es.
|
|
4642
|
+
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${index_es.Gt(newValue)}.`);
|
|
4642
4643
|
}
|
|
4643
4644
|
// String array
|
|
4644
|
-
else if (index_es.
|
|
4645
|
+
else if (index_es.Dt(newValue)) {
|
|
4645
4646
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
4646
4647
|
}
|
|
4647
4648
|
// Object array
|
|
@@ -4649,7 +4650,7 @@ const MgInputToggle = class {
|
|
|
4649
4650
|
this.options = newValue;
|
|
4650
4651
|
}
|
|
4651
4652
|
else {
|
|
4652
|
-
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${index_es.
|
|
4653
|
+
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${index_es.Gt(newValue)}.`);
|
|
4653
4654
|
}
|
|
4654
4655
|
}
|
|
4655
4656
|
watchIsOnOff(newValue) {
|
|
@@ -4697,7 +4698,7 @@ const MgInputToggle = class {
|
|
|
4697
4698
|
if (typeof valid !== 'boolean') {
|
|
4698
4699
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
|
|
4699
4700
|
}
|
|
4700
|
-
else if (!index_es.
|
|
4701
|
+
else if (!index_es.De(errorMessage)) {
|
|
4701
4702
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
|
|
4702
4703
|
}
|
|
4703
4704
|
else {
|
|
@@ -4764,7 +4765,7 @@ const MgInputToggle = class {
|
|
|
4764
4765
|
*/
|
|
4765
4766
|
render() {
|
|
4766
4767
|
const checkedItem = this.getCheckedItem(this.checked);
|
|
4767
|
-
return (index.h("mg-input", { key: '
|
|
4768
|
+
return (index.h("mg-input", { key: '3886ea7cfdb32db9bbc2b7d38760c91aac30c004', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && index.h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (index.h("button", { 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", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { name: "item-1" })), index.h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { name: "item-2" }))))));
|
|
4768
4769
|
}
|
|
4769
4770
|
get element() { return index.getElement(this); }
|
|
4770
4771
|
static get watchers() { return {
|
|
@@ -4837,8 +4838,8 @@ class OverflowBehavior {
|
|
|
4837
4838
|
else if (!this.isMoreElement(item) && item.parentElement !== this.parentElement)
|
|
4838
4839
|
this.parentElement.insertBefore(item, this.itemMoreElement);
|
|
4839
4840
|
};
|
|
4840
|
-
if (
|
|
4841
|
-
throw new Error('OverflowBehavior - all
|
|
4841
|
+
if (this.parentElement === null || this.itemMoreElement === null || this.itemMoreContainerElement === null) {
|
|
4842
|
+
throw new Error('OverflowBehavior - all constructor params are required');
|
|
4842
4843
|
}
|
|
4843
4844
|
const items = Array.from(this.parentElement.children);
|
|
4844
4845
|
this._resizeObserver = new ResizeObserver(entries => {
|
|
@@ -4851,7 +4852,7 @@ class OverflowBehavior {
|
|
|
4851
4852
|
let accWidth = 0;
|
|
4852
4853
|
items.forEach((item, index) => {
|
|
4853
4854
|
accWidth += item.offsetWidth;
|
|
4854
|
-
if (index)
|
|
4855
|
+
if (index > 0)
|
|
4855
4856
|
this.toggleItem(item, this.isOverflowElement(accWidth, item));
|
|
4856
4857
|
});
|
|
4857
4858
|
});
|
|
@@ -4879,17 +4880,17 @@ const MgItemMore = class {
|
|
|
4879
4880
|
}
|
|
4880
4881
|
validateIcon(newValue) {
|
|
4881
4882
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
|
|
4882
|
-
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${index_es.
|
|
4883
|
+
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${index_es.Gt(newValue)}.`);
|
|
4883
4884
|
}
|
|
4884
4885
|
validateSlotLabel(newValue) {
|
|
4885
4886
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
|
|
4886
|
-
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${index_es.
|
|
4887
|
+
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${index_es.Gt(newValue)}.`);
|
|
4887
4888
|
else if (typeof newValue.label !== 'string')
|
|
4888
4889
|
this.slotlabel.label = this.messages.menuLabel;
|
|
4889
4890
|
}
|
|
4890
4891
|
validateSize(newValue) {
|
|
4891
4892
|
if (newValue && !sizes$5.includes(newValue))
|
|
4892
|
-
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${index_es.
|
|
4893
|
+
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${index_es.Gt(newValue)}.`);
|
|
4893
4894
|
}
|
|
4894
4895
|
/*************
|
|
4895
4896
|
* Lifecycle *
|
|
@@ -4983,7 +4984,7 @@ const MgMenu = class {
|
|
|
4983
4984
|
var _a, _b;
|
|
4984
4985
|
const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
4985
4986
|
const itemMoreMenuItem = (_b = (_a = menu.querySelector('mg-item-more')) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item');
|
|
4986
|
-
if (itemMoreMenuItem) {
|
|
4987
|
+
if (itemMoreMenuItem !== null && itemMoreMenuItem !== undefined) {
|
|
4987
4988
|
menuItems.push(itemMoreMenuItem);
|
|
4988
4989
|
}
|
|
4989
4990
|
return menuItems;
|
|
@@ -5022,12 +5023,12 @@ const MgMenu = class {
|
|
|
5022
5023
|
}
|
|
5023
5024
|
validateLabel(newValue) {
|
|
5024
5025
|
if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
|
|
5025
|
-
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${index_es.
|
|
5026
|
+
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5026
5027
|
}
|
|
5027
5028
|
}
|
|
5028
5029
|
validateDirection(newValue) {
|
|
5029
5030
|
if (![directions$1.VERTICAL, directions$1.HORIZONTAL].includes(newValue)) {
|
|
5030
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${directions$1.HORIZONTAL}, ${directions$1.VERTICAL}. Passed value: ${index_es.
|
|
5031
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${directions$1.HORIZONTAL}, ${directions$1.VERTICAL}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5031
5032
|
}
|
|
5032
5033
|
else {
|
|
5033
5034
|
this.updateMenuItems();
|
|
@@ -5043,7 +5044,7 @@ const MgMenu = class {
|
|
|
5043
5044
|
}
|
|
5044
5045
|
validateSize(newValue) {
|
|
5045
5046
|
if (!sizes$5.includes(newValue)) {
|
|
5046
|
-
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$5.join(', ')}. Passed value: ${index_es.
|
|
5047
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$5.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5047
5048
|
}
|
|
5048
5049
|
}
|
|
5049
5050
|
/**
|
|
@@ -5111,7 +5112,7 @@ const MgMenu = class {
|
|
|
5111
5112
|
* @returns HTML Element
|
|
5112
5113
|
*/
|
|
5113
5114
|
render() {
|
|
5114
|
-
return (index.h(index.Host, { key: '
|
|
5115
|
+
return (index.h(index.Host, { key: '027cd6b867d852c1d238ffedd9ea9c8d40eb82f0', role: "list", "aria-label": this.label }, index.h("slot", { key: 'cb6dfa4a26800f3dd3fc820954a45aad025cc4a3' })));
|
|
5115
5116
|
}
|
|
5116
5117
|
get element() { return index.getElement(this); }
|
|
5117
5118
|
static get watchers() { return {
|
|
@@ -5141,7 +5142,7 @@ const MgMenuItem = class {
|
|
|
5141
5142
|
/**
|
|
5142
5143
|
* Identifier is used to control mg-popover
|
|
5143
5144
|
*/
|
|
5144
|
-
this.identifier = index_es.
|
|
5145
|
+
this.identifier = index_es.Pt('mg-menu-item');
|
|
5145
5146
|
/**
|
|
5146
5147
|
* Define menu-item status.
|
|
5147
5148
|
*/
|
|
@@ -5160,7 +5161,7 @@ const MgMenuItem = class {
|
|
|
5160
5161
|
/**
|
|
5161
5162
|
* Component button classes
|
|
5162
5163
|
*/
|
|
5163
|
-
this.navigationButtonClassList = new index_es.
|
|
5164
|
+
this.navigationButtonClassList = new index_es.Zt([this.navigationButton]);
|
|
5164
5165
|
/**
|
|
5165
5166
|
* Does component have children.
|
|
5166
5167
|
*/
|
|
@@ -5199,7 +5200,7 @@ const MgMenuItem = class {
|
|
|
5199
5200
|
* Is component an interactive item
|
|
5200
5201
|
* @returns truthy if element is clickable
|
|
5201
5202
|
*/
|
|
5202
|
-
this.isInteractiveItem = () => this.hasChildren || !index_es.
|
|
5203
|
+
this.isInteractiveItem = () => this.hasChildren || !index_es.De(this.href);
|
|
5203
5204
|
/**
|
|
5204
5205
|
* Is component contextual direction match the given direction
|
|
5205
5206
|
* @param direction - in parent menu
|
|
@@ -5252,7 +5253,7 @@ const MgMenuItem = class {
|
|
|
5252
5253
|
}
|
|
5253
5254
|
['label', 'metadata'].forEach(slot => {
|
|
5254
5255
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
5255
|
-
if (!index_es.
|
|
5256
|
+
if (!index_es.De(element.textContent))
|
|
5256
5257
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
5257
5258
|
if ((guard && !element.hasAttribute('title')) || !guard)
|
|
5258
5259
|
element.setAttribute('title', element.textContent);
|
|
@@ -5293,7 +5294,7 @@ const MgMenuItem = class {
|
|
|
5293
5294
|
// when item is the last clickable item we close the parent popover
|
|
5294
5295
|
if (!this.isInteractiveItem()) {
|
|
5295
5296
|
const closePopover = (element) => {
|
|
5296
|
-
if (
|
|
5297
|
+
if (element === null)
|
|
5297
5298
|
return;
|
|
5298
5299
|
else if (element !== this.element && element.expanded && element.shadowRoot.querySelector('mg-popover') !== null) {
|
|
5299
5300
|
element.expanded = false;
|
|
@@ -5319,8 +5320,8 @@ const MgMenuItem = class {
|
|
|
5319
5320
|
this.renderSlot = () => index.h("slot", null);
|
|
5320
5321
|
}
|
|
5321
5322
|
watchIdentifier(newValue) {
|
|
5322
|
-
if (!index_es.
|
|
5323
|
-
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
5323
|
+
if (!index_es.Ut(newValue)) {
|
|
5324
|
+
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5324
5325
|
}
|
|
5325
5326
|
else {
|
|
5326
5327
|
this.popoverIdentifier = `${this.identifier}-popover`;
|
|
@@ -5328,7 +5329,7 @@ const MgMenuItem = class {
|
|
|
5328
5329
|
}
|
|
5329
5330
|
watchTarget(newValue) {
|
|
5330
5331
|
if (newValue && !targets.includes(newValue)) {
|
|
5331
|
-
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${index_es.
|
|
5332
|
+
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5332
5333
|
}
|
|
5333
5334
|
}
|
|
5334
5335
|
watchStatus(newValue, oldValue) {
|
|
@@ -5338,7 +5339,7 @@ const MgMenuItem = class {
|
|
|
5338
5339
|
}
|
|
5339
5340
|
watchExpanded(newValue) {
|
|
5340
5341
|
if (typeof newValue !== 'boolean') {
|
|
5341
|
-
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${index_es.
|
|
5342
|
+
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5342
5343
|
}
|
|
5343
5344
|
else {
|
|
5344
5345
|
this.updateExpanded(newValue);
|
|
@@ -5387,7 +5388,7 @@ const MgMenuItem = class {
|
|
|
5387
5388
|
*/
|
|
5388
5389
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
5389
5390
|
watchDataHasFocus(newValue) {
|
|
5390
|
-
if (!newValue)
|
|
5391
|
+
if (!index_es.De(newValue))
|
|
5391
5392
|
this.updateExpanded(Boolean(newValue));
|
|
5392
5393
|
}
|
|
5393
5394
|
/**
|
|
@@ -5453,7 +5454,7 @@ const MgMenuItem = class {
|
|
|
5453
5454
|
* @returns promise process wich emit the 'item-updated' event
|
|
5454
5455
|
*/
|
|
5455
5456
|
componentShouldUpdate() {
|
|
5456
|
-
return index_es.
|
|
5457
|
+
return index_es.Xt(() => {
|
|
5457
5458
|
this.itemUpdated.emit();
|
|
5458
5459
|
});
|
|
5459
5460
|
}
|
|
@@ -5480,7 +5481,7 @@ const MgMenuItem = class {
|
|
|
5480
5481
|
['mg-c-menu-item__collapse-container']: true,
|
|
5481
5482
|
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu() || this.isItemMore) && this.isDirection(directions$1.HORIZONTAL),
|
|
5482
5483
|
});
|
|
5483
|
-
return (index.h(index.Host, { key: '
|
|
5484
|
+
return (index.h(index.Host, { key: 'caeeabd1d1c9f7de3c8ecda6a315b85215b9e656', role: this.isItemMore ? 'presentation' : 'listitem' }, this.hasPopover() ? (index.h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "onDisplay-change": this.handlePopoverDisplay, identifier: this.popoverIdentifier, "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
|
|
5484
5485
|
}, this.renderInteractiveElement(), index.h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
5485
5486
|
this.renderInteractiveElement(),
|
|
5486
5487
|
index.h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
@@ -5530,7 +5531,7 @@ const MgMessage = class {
|
|
|
5530
5531
|
/**
|
|
5531
5532
|
* Component classes
|
|
5532
5533
|
*/
|
|
5533
|
-
this.classCollection = new index_es.
|
|
5534
|
+
this.classCollection = new index_es.Zt(['mg-c-message']);
|
|
5534
5535
|
/**
|
|
5535
5536
|
* Define if component is using actions slot
|
|
5536
5537
|
*/
|
|
@@ -5554,7 +5555,7 @@ const MgMessage = class {
|
|
|
5554
5555
|
}
|
|
5555
5556
|
watchVariant(newValue, oldValue) {
|
|
5556
5557
|
if (!variants$1.includes(newValue)) {
|
|
5557
|
-
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${index_es.
|
|
5558
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5558
5559
|
}
|
|
5559
5560
|
else {
|
|
5560
5561
|
if (newValue !== undefined)
|
|
@@ -5565,7 +5566,7 @@ const MgMessage = class {
|
|
|
5565
5566
|
}
|
|
5566
5567
|
watchVariantStyle(newValue, oldValue) {
|
|
5567
5568
|
if (!variantStyles.includes(newValue)) {
|
|
5568
|
-
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${index_es.
|
|
5569
|
+
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5569
5570
|
}
|
|
5570
5571
|
else {
|
|
5571
5572
|
if (newValue !== undefined)
|
|
@@ -5592,9 +5593,9 @@ const MgMessage = class {
|
|
|
5592
5593
|
* @returns HTML Element
|
|
5593
5594
|
*/
|
|
5594
5595
|
render() {
|
|
5595
|
-
return (index.h("div", { key: '
|
|
5596
|
+
return (index.h("div", { key: '851d97fde6f05799e1420f8825fcff986d9af1d6', class: this.classCollection.join() }, index.h("mg-card", { key: '40f85f1fb3240ab709b1ab46286e9a953f2d5dc8' }, this.variantStyle === 'bar-left' && index.h("span", { key: '50b078ec379c7774d2f409c64b56108041bf3053', class: "mg-c-message__bar" }), index.h("span", { key: 'bc6b1019e1103fc8cd5e4e92f95b62374207be2b', class: "mg-c-message__icon" }, index.h("mg-icon", { key: 'e461ddc1eb1ddcb7ecc673f59dc59f400efbe916', icon: this.getIcon() })), index.h("div", { key: 'edf836b375d7f1fd413b53711b99acbe2bef3e92', class: "mg-c-message__content" }, index.h("span", { key: 'c6ce4628e450b7e89ef3715126b3a2dee081224e', class: "mg-c-message__content-slot" }, index.h("slot", { key: '36ecf7417e61ab84695078e2fd4ebe829bd769a7' })), this.hasActions && [
|
|
5596
5597
|
index.h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
|
|
5597
|
-
index.h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, index.h("slot", { key: '
|
|
5598
|
+
index.h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, index.h("slot", { key: '43be5769165cac1ab702b2ba80fb885c2ec1834f', name: "actions" })),
|
|
5598
5599
|
]))));
|
|
5599
5600
|
}
|
|
5600
5601
|
get element() { return index.getElement(this); }
|
|
@@ -5624,7 +5625,7 @@ const MgModal = class {
|
|
|
5624
5625
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
5625
5626
|
* If not set, it will be created.
|
|
5626
5627
|
*/
|
|
5627
|
-
this.identifier = index_es.
|
|
5628
|
+
this.identifier = index_es.Pt('mg-modal');
|
|
5628
5629
|
/**
|
|
5629
5630
|
* Modal dialog role.
|
|
5630
5631
|
*/
|
|
@@ -5644,7 +5645,7 @@ const MgModal = class {
|
|
|
5644
5645
|
/**
|
|
5645
5646
|
* Component classes
|
|
5646
5647
|
*/
|
|
5647
|
-
this.classCollection = new index_es.
|
|
5648
|
+
this.classCollection = new index_es.Zt(['mg-c-modal']);
|
|
5648
5649
|
/***********
|
|
5649
5650
|
* Handles *
|
|
5650
5651
|
***********/
|
|
@@ -5657,17 +5658,17 @@ const MgModal = class {
|
|
|
5657
5658
|
};
|
|
5658
5659
|
}
|
|
5659
5660
|
watchIdentifier(newValue) {
|
|
5660
|
-
if (!index_es.
|
|
5661
|
-
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
5661
|
+
if (!index_es.Ut(newValue)) {
|
|
5662
|
+
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5662
5663
|
}
|
|
5663
5664
|
}
|
|
5664
5665
|
validateDialogRole(newValue) {
|
|
5665
5666
|
if (!dialogRoles.includes(newValue))
|
|
5666
|
-
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${index_es.
|
|
5667
|
+
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5667
5668
|
}
|
|
5668
5669
|
validateModalTitle(newValue) {
|
|
5669
|
-
if (!index_es.
|
|
5670
|
-
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${index_es.
|
|
5670
|
+
if (!index_es.De(newValue)) {
|
|
5671
|
+
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5671
5672
|
}
|
|
5672
5673
|
}
|
|
5673
5674
|
watchOpen(newValue) {
|
|
@@ -5716,11 +5717,11 @@ const MgModal = class {
|
|
|
5716
5717
|
* @returns HTML Element
|
|
5717
5718
|
*/
|
|
5718
5719
|
render() {
|
|
5719
|
-
return (index.h("dialog", { key: '
|
|
5720
|
+
return (index.h("dialog", { key: '4b7346b707b895a8a110bb7553f0db32d1c5778c', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
5720
5721
|
if (el !== null) {
|
|
5721
5722
|
this.dialog = el;
|
|
5722
5723
|
}
|
|
5723
|
-
} }, index.h("mg-card", { key: '
|
|
5724
|
+
} }, index.h("mg-card", { key: '2aaabab2e1be14013bcae66d100ac56c1a9bbf4d' }, index.h("div", { key: '56a03d6cbda094d7ae4444ca3fab924982f73e2a', class: "mg-c-modal__dialog" }, index.h("header", { key: 'e7eb70e614a9e6c6b3f14f9e165bf801b780b031', class: "mg-c-modal__header" }, this.closeButton && (index.h("span", { key: 'c57ccc8f049893c5e46d769b527cc2e2c5ff14c0', class: "mg-c-modal__close-button" }, index.h("mg-button", { key: 'b1b4357af8c875aab9f1104895de3cc228d12feb', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, index.h("mg-icon", { key: 'cfe5fba2577ece682368332d3836cf709bb1b0e1', icon: "cross" })))), index.h("h1", { key: '718527902ea4814d55bf4d1c89d111a965233f0a', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), index.h("article", { key: '78603fdb8fffa93e5caa6cf0ece9c6dbdbdfefde', class: "mg-c-modal__content" }, index.h("slot", { key: '1cd5a0415e53cb836428f8b9c4fc02dac11447a9' })), this.hasActions && (index.h("footer", { key: 'da72e5c2f43308d0f94d4e2eb36e317a13b5b16e', class: "mg-c-modal__footer" }, index.h("slot", { key: '49467ef13123cb4f4e2b315d293379d857ca3245', name: "actions" })))))));
|
|
5724
5725
|
}
|
|
5725
5726
|
get element() { return index.getElement(this); }
|
|
5726
5727
|
static get watchers() { return {
|
|
@@ -5769,7 +5770,7 @@ const MgPagination = class {
|
|
|
5769
5770
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
5770
5771
|
* If not set, it will be created.
|
|
5771
5772
|
*/
|
|
5772
|
-
this.identifier = index_es.
|
|
5773
|
+
this.identifier = index_es.Pt('mg-pagination');
|
|
5773
5774
|
/**
|
|
5774
5775
|
* Hide navigation label
|
|
5775
5776
|
*/
|
|
@@ -5814,18 +5815,18 @@ const MgPagination = class {
|
|
|
5814
5815
|
};
|
|
5815
5816
|
}
|
|
5816
5817
|
watchIdentifier(newValue) {
|
|
5817
|
-
if (!index_es.
|
|
5818
|
-
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
5818
|
+
if (!index_es.Ut(newValue)) {
|
|
5819
|
+
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5819
5820
|
}
|
|
5820
5821
|
}
|
|
5821
5822
|
validateTotalPages(newValue) {
|
|
5822
5823
|
if (newValue < 1) {
|
|
5823
|
-
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${index_es.
|
|
5824
|
+
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5824
5825
|
}
|
|
5825
5826
|
}
|
|
5826
5827
|
validateCurrentPage(newValue) {
|
|
5827
5828
|
if (newValue < 1) {
|
|
5828
|
-
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${index_es.
|
|
5829
|
+
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${index_es.Gt(newValue)}.`);
|
|
5829
5830
|
}
|
|
5830
5831
|
else if (newValue > this.totalPages) {
|
|
5831
5832
|
throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
|
|
@@ -5855,10 +5856,10 @@ const MgPagination = class {
|
|
|
5855
5856
|
* @returns HTML Element
|
|
5856
5857
|
*/
|
|
5857
5858
|
render() {
|
|
5858
|
-
const navigationActionButton = (disabled, action) => (index.h("mg-button", { key: '
|
|
5859
|
+
const navigationActionButton = (disabled, action) => (index.h("mg-button", { key: 'b6983bde889955b35b1e580ffd5ece96a2919eca', label: this.messages.pagination[`${action}Page`],
|
|
5859
5860
|
// eslint-disable-next-line react/jsx-no-bind
|
|
5860
|
-
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && index.h("mg-icon", { key: '
|
|
5861
|
-
return (index.h(index.Host, { key: '
|
|
5861
|
+
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && index.h("mg-icon", { key: '64316742287d7cb9adf0c4bb3cb902a3c1cea6b5', icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && index.h("mg-icon", { key: '2c405c1530509f3e6938e7c1d754b7aff216a6f7', icon: "chevron-right" })));
|
|
5862
|
+
return (index.h(index.Host, { key: 'a341519e24868b594c1bb91c12549c0338fc0f49', hidden: this.totalPages < 2 }, index.h("nav", { key: '1102f256da9b8c25e8dbe6be64b934267d58f4b8', 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("div", { key: '32498b13867e363f6f51ffbaff6f18623cbd698d', class: "mg-c-pagination__page-count" }, index.h("mg-input-select", { key: 'ff80a43e9fa1bf7cc13c7104e41730df0c044c3e', 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: 'c3e331768f997740ed95cde7dc7433df7d065122', class: "mg-u-visually-hidden" }, this.messages.pagination.page, " ", this.currentPage), "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page)), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
|
|
5862
5863
|
}
|
|
5863
5864
|
get element() { return index.getElement(this); }
|
|
5864
5865
|
static get watchers() { return {
|
|
@@ -5889,7 +5890,7 @@ const MgPanel = class {
|
|
|
5889
5890
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
5890
5891
|
* If not set, it will be created.
|
|
5891
5892
|
*/
|
|
5892
|
-
this.identifier = index_es.
|
|
5893
|
+
this.identifier = index_es.Pt('mg-panel');
|
|
5893
5894
|
/**
|
|
5894
5895
|
* Define if panel title is editable
|
|
5895
5896
|
*/
|
|
@@ -5913,7 +5914,7 @@ const MgPanel = class {
|
|
|
5913
5914
|
/**
|
|
5914
5915
|
* Component classes
|
|
5915
5916
|
*/
|
|
5916
|
-
this.classCollection = new index_es.
|
|
5917
|
+
this.classCollection = new index_es.Zt(['mg-c-panel']);
|
|
5917
5918
|
/**
|
|
5918
5919
|
* Title is in edition mode
|
|
5919
5920
|
*/
|
|
@@ -6012,13 +6013,13 @@ const MgPanel = class {
|
|
|
6012
6013
|
};
|
|
6013
6014
|
}
|
|
6014
6015
|
watchIdentifier(newValue) {
|
|
6015
|
-
if (!index_es.
|
|
6016
|
-
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
6016
|
+
if (!index_es.Ut(newValue)) {
|
|
6017
|
+
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
6017
6018
|
}
|
|
6018
6019
|
}
|
|
6019
6020
|
validatePanelTitle(newValue) {
|
|
6020
|
-
if (!index_es.
|
|
6021
|
-
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${index_es.
|
|
6021
|
+
if (!index_es.De(newValue))
|
|
6022
|
+
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${index_es.Gt(newValue)}.`);
|
|
6022
6023
|
this.titleChange.emit(newValue);
|
|
6023
6024
|
}
|
|
6024
6025
|
validateTitlePattern(newValue) {
|
|
@@ -6027,14 +6028,14 @@ const MgPanel = class {
|
|
|
6027
6028
|
}
|
|
6028
6029
|
validateTitlePosition(newValue) {
|
|
6029
6030
|
if (!titlePositions.includes(newValue))
|
|
6030
|
-
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${index_es.
|
|
6031
|
+
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
6031
6032
|
}
|
|
6032
6033
|
handleExpanded(newValue) {
|
|
6033
6034
|
this.expandedChange.emit(newValue);
|
|
6034
6035
|
}
|
|
6035
6036
|
validateExpandToggleDisplay(newValue) {
|
|
6036
6037
|
if (!expandToggleDisplays.includes(newValue))
|
|
6037
|
-
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${index_es.
|
|
6038
|
+
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
6038
6039
|
if (newValue === 'icon' && this.titleEditable)
|
|
6039
6040
|
this.titleEditable = false;
|
|
6040
6041
|
}
|
|
@@ -6069,7 +6070,7 @@ const MgPanel = class {
|
|
|
6069
6070
|
*/
|
|
6070
6071
|
render() {
|
|
6071
6072
|
const headerId = `${this.identifier}-header`;
|
|
6072
|
-
return (index.h("section", { key: '
|
|
6073
|
+
return (index.h("section", { key: '73b9b1ab03307718bc7085799675da7447787c73', class: this.classCollection.join(), id: this.identifier }, index.h("mg-card", { key: '91702feab4cde0548c276f3d32fa193ff1093cae' }, index.h("header", { key: '442a17d42f86e73648ffa33124a1745fef3b07e3', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), index.h("article", { key: '0df72fb9e53f0a8307c062d506e8c744fd6780f3', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, index.h("slot", { key: '44fa7501182e1c671d229929ebc12031c3048fdb' })))));
|
|
6073
6074
|
}
|
|
6074
6075
|
get element() { return index.getElement(this); }
|
|
6075
6076
|
static get watchers() { return {
|
|
@@ -7748,14 +7749,58 @@ const placements = [
|
|
|
7748
7749
|
'left-start',
|
|
7749
7750
|
'left-end',
|
|
7750
7751
|
];
|
|
7752
|
+
// Alignments constants
|
|
7753
|
+
const alignments = ['start', null, 'end'];
|
|
7751
7754
|
/**
|
|
7752
7755
|
* FloatingUI Placement type guard
|
|
7753
7756
|
* @param placement - value to check
|
|
7754
7757
|
* @returns truthy if placement is valid
|
|
7755
7758
|
*/
|
|
7756
7759
|
const isFloatingUIPlacement = (placement) => placements.filter(p => !p.includes('auto')).includes(placement);
|
|
7757
|
-
|
|
7758
|
-
|
|
7760
|
+
/**
|
|
7761
|
+
* Round value by device pixel ratio
|
|
7762
|
+
* @param value - value to round
|
|
7763
|
+
* @returns rounded value
|
|
7764
|
+
*/
|
|
7765
|
+
const roundByDPR = (value) => {
|
|
7766
|
+
const dpr = window.devicePixelRatio || 1;
|
|
7767
|
+
return Math.round(value * dpr) / dpr;
|
|
7768
|
+
};
|
|
7769
|
+
/**
|
|
7770
|
+
* Get translation for tooltip
|
|
7771
|
+
* @param x - x-axis value
|
|
7772
|
+
* @param y - y-axis value
|
|
7773
|
+
* @returns translation string
|
|
7774
|
+
*/
|
|
7775
|
+
const getTransformation = (x, y) => {
|
|
7776
|
+
const tooltipX = isNaN(x) ? 0 : roundByDPR(x);
|
|
7777
|
+
const tooltipY = isNaN(y) ? 0 : roundByDPR(y);
|
|
7778
|
+
// No translation needed
|
|
7779
|
+
if (tooltipX === 0 && tooltipY === 0)
|
|
7780
|
+
return '';
|
|
7781
|
+
// Only one axis needs translation
|
|
7782
|
+
if (tooltipX === 0)
|
|
7783
|
+
return `translateY(${tooltipY}px)`;
|
|
7784
|
+
if (tooltipY === 0)
|
|
7785
|
+
return `translateX(${tooltipX}px)`;
|
|
7786
|
+
// Both axes need translation
|
|
7787
|
+
return `translate(${tooltipX}px,${tooltipY}px)`;
|
|
7788
|
+
};
|
|
7789
|
+
// https://floating-ui.com/docs/arrow
|
|
7790
|
+
// Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.
|
|
7791
|
+
// Due to this, either x or y will be undefined, depending on the side of placement.
|
|
7792
|
+
// The above code uses `isNaN` to check for null and undefined simultaneously.
|
|
7793
|
+
// Don't remove `isNaN`, because either value can be falsy (0), causing a bug!
|
|
7794
|
+
const numberToPx = (number) => {
|
|
7795
|
+
if (number !== null && !isNaN(number)) {
|
|
7796
|
+
if (number === 0)
|
|
7797
|
+
return '0';
|
|
7798
|
+
else
|
|
7799
|
+
return `${number}px`;
|
|
7800
|
+
}
|
|
7801
|
+
else
|
|
7802
|
+
return '';
|
|
7803
|
+
};
|
|
7759
7804
|
|
|
7760
7805
|
const mgPopoverCss = "/*!\n * @prop --mg-c-popover-color-background: Defines the background color of the popover. Default value: `--mg-b-color-light`.\n * @prop --mg-c-popover-color-text: Defines the font color of the popover. Default value: `--mg-b-color-font-dark`.\n * @prop --mg-c-popover-title-font-size: Defines the font size of the popover title. Default value: `--mg-b-font-size-h5`.\n * @prop --mg-c-popover-padding-vertical: Defines the vertical padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-padding-horizontal: Defines the horizontal padding of the popover. Default value: `unset`, fallback to `--mg-b-size-16`.\n * @prop --mg-c-popover-max-width: Defines the max-width of the popover. Default value: `--mg-b-size-floating-element-max-width`.\n * @prop --mg-c-popover-min-width: Defines the min-width of the popover. Default value: `unset`.\n */:host{--mg-c-card-spacing:var(--mg-c-popover-padding-vertical, var(--mg-b-size-16)) var(--mg-c-popover-padding-horizontal, var(--mg-b-size-16));--mg-c-card-border:none;--mg-c-card-border-radius:var(--mg-b-size-radius);--mg-c-card-color-background:var(--mg-c-popover-color-background);position:relative;display:contents}:host::slotted(*){display:inline-block}";
|
|
7761
7806
|
|
|
@@ -7768,7 +7813,7 @@ const MgPopover = class {
|
|
|
7768
7813
|
* Sets an `id` attribute.
|
|
7769
7814
|
* Needed by the input for accessibility `aria-decribedby`.
|
|
7770
7815
|
*/
|
|
7771
|
-
this.identifier = index_es.
|
|
7816
|
+
this.identifier = index_es.Pt('mg-popover');
|
|
7772
7817
|
/**
|
|
7773
7818
|
* Popover placement
|
|
7774
7819
|
*/
|
|
@@ -7798,16 +7843,6 @@ const MgPopover = class {
|
|
|
7798
7843
|
this.display = false;
|
|
7799
7844
|
}
|
|
7800
7845
|
};
|
|
7801
|
-
/**
|
|
7802
|
-
* Update aria-expanded attribute on interactive element
|
|
7803
|
-
* @param expanded - expanded state
|
|
7804
|
-
*/
|
|
7805
|
-
this.updateAriaExpanded = (expanded) => {
|
|
7806
|
-
const interactiveElement = this.element.querySelector(':not([slot])');
|
|
7807
|
-
if (interactiveElement !== null) {
|
|
7808
|
-
interactiveElement.setAttribute('aria-expanded', String(expanded));
|
|
7809
|
-
}
|
|
7810
|
-
};
|
|
7811
7846
|
/**
|
|
7812
7847
|
* Show popover
|
|
7813
7848
|
*/
|
|
@@ -7815,12 +7850,13 @@ const MgPopover = class {
|
|
|
7815
7850
|
// Make the popover visible
|
|
7816
7851
|
this.mgPopover.dataset.show = '';
|
|
7817
7852
|
// Update aria-expanded
|
|
7818
|
-
this.
|
|
7853
|
+
this.interactiveElement.setAttribute('aria-expanded', 'true');
|
|
7819
7854
|
// hide when click outside
|
|
7820
7855
|
// setTimeout is used to prevent event to trigger after creation
|
|
7821
7856
|
setTimeout(() => {
|
|
7822
7857
|
this.manageClickOutsideListeners('addEventListener');
|
|
7823
7858
|
});
|
|
7859
|
+
this.updatePopover();
|
|
7824
7860
|
};
|
|
7825
7861
|
/**
|
|
7826
7862
|
* Hide popover
|
|
@@ -7829,7 +7865,7 @@ const MgPopover = class {
|
|
|
7829
7865
|
// Hide the popover
|
|
7830
7866
|
this.mgPopover.removeAttribute('data-show');
|
|
7831
7867
|
// Update aria-expanded
|
|
7832
|
-
this.
|
|
7868
|
+
this.interactiveElement.setAttribute('aria-expanded', 'false');
|
|
7833
7869
|
// Remove event listener
|
|
7834
7870
|
this.manageClickOutsideListeners('removeEventListener');
|
|
7835
7871
|
};
|
|
@@ -7908,63 +7944,50 @@ const MgPopover = class {
|
|
|
7908
7944
|
return Array.from(new Set([...currentSidePlacements, ...sides.filter(otherSide => otherSide !== side)])).filter(isFloatingUIPlacement);
|
|
7909
7945
|
};
|
|
7910
7946
|
/**
|
|
7911
|
-
*
|
|
7912
|
-
* @
|
|
7913
|
-
*/
|
|
7914
|
-
this.
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
],
|
|
7931
|
-
}).then(({ x, y, placement, middlewareData }) => {
|
|
7932
|
-
Object.assign(this.mgPopover.style, {
|
|
7933
|
-
position: 'fixed',
|
|
7934
|
-
top: '0',
|
|
7935
|
-
left: '0',
|
|
7936
|
-
transform: `translate(${Math.round(x)}px, ${Math.round(y)}px)`,
|
|
7937
|
-
});
|
|
7938
|
-
// Update arrow style
|
|
7939
|
-
const staticSide = {
|
|
7940
|
-
top: 'bottom',
|
|
7941
|
-
right: 'left',
|
|
7942
|
-
bottom: 'top',
|
|
7943
|
-
left: 'right',
|
|
7944
|
-
}[placement.split('-')[0]];
|
|
7945
|
-
const arrowElement = this.mgPopover.querySelector('[data-floating-arrow]');
|
|
7946
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
7947
|
-
// https://floating-ui.com/docs/arrow
|
|
7948
|
-
// Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.
|
|
7949
|
-
// Due to this, either x or y will be undefined, depending on the side of placement.
|
|
7950
|
-
// The above code uses `isNaN` to check for null and undefined simultaneously.
|
|
7951
|
-
// Don't remove `isNaN`, because either value can be falsy (0), causing a bug!
|
|
7952
|
-
const numberToPx = (number) => (!isNaN(number) ? `${number}px` : '');
|
|
7953
|
-
if (arrowElement !== null)
|
|
7954
|
-
Object.assign(arrowElement.style, {
|
|
7955
|
-
position: 'absolute',
|
|
7956
|
-
left: numberToPx(arrowX),
|
|
7957
|
-
top: numberToPx(arrowY),
|
|
7958
|
-
[staticSide]: '1px',
|
|
7959
|
-
});
|
|
7960
|
-
this.mgPopover.setAttribute('data-placement', placement);
|
|
7961
|
-
});
|
|
7947
|
+
* Update popover position
|
|
7948
|
+
* @returns autoUpdate function
|
|
7949
|
+
*/
|
|
7950
|
+
this.updatePopover = () => autoUpdate(this.interactiveElement, this.mgPopover, async () => {
|
|
7951
|
+
const { x, y, placement, middlewareData } = await computePosition(this.interactiveElement, this.mgPopover, {
|
|
7952
|
+
placement: this.placement,
|
|
7953
|
+
strategy: 'fixed',
|
|
7954
|
+
middleware: [
|
|
7955
|
+
offset(0),
|
|
7956
|
+
flip({
|
|
7957
|
+
fallbackPlacements: this.getClosestPlacements(this.placement),
|
|
7958
|
+
}),
|
|
7959
|
+
shift({
|
|
7960
|
+
limiter: limitShift(),
|
|
7961
|
+
}),
|
|
7962
|
+
arrow({
|
|
7963
|
+
element: this.arrowElement,
|
|
7964
|
+
}),
|
|
7965
|
+
],
|
|
7962
7966
|
});
|
|
7963
|
-
|
|
7967
|
+
Object.assign(this.mgPopover.style, {
|
|
7968
|
+
transform: getTransformation(x, y),
|
|
7969
|
+
});
|
|
7970
|
+
// Arrow positioning
|
|
7971
|
+
if (this.arrowElement !== null) {
|
|
7972
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
7973
|
+
const staticSide = {
|
|
7974
|
+
top: 'bottom',
|
|
7975
|
+
right: 'left',
|
|
7976
|
+
bottom: 'top',
|
|
7977
|
+
left: 'right',
|
|
7978
|
+
}[placement.split('-')[0]];
|
|
7979
|
+
Object.assign(this.arrowElement.style, {
|
|
7980
|
+
left: numberToPx(arrowX),
|
|
7981
|
+
top: numberToPx(arrowY),
|
|
7982
|
+
[staticSide]: '1px',
|
|
7983
|
+
});
|
|
7984
|
+
this.mgPopover.setAttribute('data-placement', placement);
|
|
7985
|
+
}
|
|
7986
|
+
});
|
|
7964
7987
|
}
|
|
7965
7988
|
validateIdentifier(newValue) {
|
|
7966
|
-
if (!index_es.
|
|
7967
|
-
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
7989
|
+
if (!index_es.Ut(newValue)) {
|
|
7990
|
+
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
7968
7991
|
}
|
|
7969
7992
|
// use renderPopoverContent to update popover-content id
|
|
7970
7993
|
this.renderPopoverContent();
|
|
@@ -7998,14 +8021,14 @@ const MgPopover = class {
|
|
|
7998
8021
|
* update popper position after props change on component did update hook to benefit from render ended
|
|
7999
8022
|
*/
|
|
8000
8023
|
componentDidUpdate() {
|
|
8001
|
-
this.
|
|
8024
|
+
this.updatePopover();
|
|
8002
8025
|
}
|
|
8003
8026
|
/**
|
|
8004
8027
|
* Check if component props are well configured on init
|
|
8005
8028
|
*/
|
|
8006
8029
|
componentWillLoad() {
|
|
8007
8030
|
// Get windows to attach events
|
|
8008
|
-
this.windows = index_es.
|
|
8031
|
+
this.windows = index_es.Bt(window);
|
|
8009
8032
|
// render mg-popover-content slot
|
|
8010
8033
|
this.renderPopoverContent();
|
|
8011
8034
|
this.validateCloseButton(this.closeButton);
|
|
@@ -8019,26 +8042,21 @@ const MgPopover = class {
|
|
|
8019
8042
|
componentDidLoad() {
|
|
8020
8043
|
// Get popover content
|
|
8021
8044
|
this.mgPopover = this.element.querySelector(`#${this.identifier}`);
|
|
8045
|
+
// Get arrow element
|
|
8046
|
+
this.arrowElement = this.mgPopover.querySelector('[data-floating-arrow]');
|
|
8022
8047
|
// Get interactive element (first element without slot attribute)
|
|
8023
|
-
|
|
8048
|
+
this.interactiveElement = this.element.querySelector(':not([slot])');
|
|
8024
8049
|
// Add aria attributes
|
|
8025
|
-
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
8026
|
-
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
8027
|
-
// Initial styles configuration
|
|
8028
|
-
Object.assign(this.mgPopover.style, {
|
|
8029
|
-
position: 'fixed',
|
|
8030
|
-
});
|
|
8031
|
-
// Create Floating UI instance
|
|
8032
|
-
this.setFloatingUI(interactiveElement);
|
|
8050
|
+
this.interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
8051
|
+
this.interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
8033
8052
|
// Add resize observer
|
|
8034
|
-
[interactiveElement, this.mgPopoverContent].forEach(element => {
|
|
8053
|
+
[this.interactiveElement, this.mgPopoverContent].forEach(element => {
|
|
8035
8054
|
new ResizeObserver(() => {
|
|
8036
|
-
this.
|
|
8037
|
-
this.setFloatingUI(interactiveElement);
|
|
8055
|
+
this.updatePopover();
|
|
8038
8056
|
}).observe(element);
|
|
8039
8057
|
});
|
|
8040
8058
|
// Add events to toggle display
|
|
8041
|
-
interactiveElement.addEventListener('click', () => {
|
|
8059
|
+
this.interactiveElement.addEventListener('click', () => {
|
|
8042
8060
|
if (!this.disabled)
|
|
8043
8061
|
this.display = !this.display;
|
|
8044
8062
|
});
|
|
@@ -8053,7 +8071,7 @@ const MgPopover = class {
|
|
|
8053
8071
|
if (!this.disabled && e.code === 'Escape') {
|
|
8054
8072
|
this.display = false;
|
|
8055
8073
|
this.componentClose.emit();
|
|
8056
|
-
interactiveElement.focus();
|
|
8074
|
+
this.interactiveElement.focus();
|
|
8057
8075
|
}
|
|
8058
8076
|
});
|
|
8059
8077
|
this.handleDisplay(this.display);
|
|
@@ -8062,15 +8080,16 @@ const MgPopover = class {
|
|
|
8062
8080
|
* Cleanup when component is disconnected
|
|
8063
8081
|
*/
|
|
8064
8082
|
disconnectedCallback() {
|
|
8083
|
+
var _a;
|
|
8065
8084
|
// Cleanup Floating UI instance
|
|
8066
|
-
this.
|
|
8085
|
+
(_a = this.updatePopover) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
8067
8086
|
}
|
|
8068
8087
|
/**
|
|
8069
8088
|
* Render
|
|
8070
8089
|
* @returns HTML Element
|
|
8071
8090
|
*/
|
|
8072
8091
|
render() {
|
|
8073
|
-
return (index.h(index.Host, { key: '
|
|
8092
|
+
return (index.h(index.Host, { key: '26244db5e6a35b731b5220c06b77ad1f14378245' }, index.h("slot", { key: '92ca05ac9637cf9634d86b177393fd6d0e6c6796' }), index.h("slot", { key: 'bdc8f8a8b4f2c891e473cdac5a305c3f1ab615b0', name: "content" })));
|
|
8074
8093
|
}
|
|
8075
8094
|
get element() { return index.getElement(this); }
|
|
8076
8095
|
static get watchers() { return {
|
|
@@ -8083,7 +8102,7 @@ const MgPopover = class {
|
|
|
8083
8102
|
};
|
|
8084
8103
|
MgPopover.style = mgPopoverCss;
|
|
8085
8104
|
|
|
8086
|
-
const mgPopoverContentCss = ":host{position:
|
|
8105
|
+
const mgPopoverContentCss = ":host{position:fixed;z-index:2000;top:0;left:0;display:none;padding:var(--mg-b-size-8);color:var(--mg-c-popover-color-text)}:host([data-show]){display:block}:host([data-placement^=left-start]),:host([data-placement^=left-end]),:host([data-placement^=right-start]),:host([data-placement^=right-end]){padding:0 var(--mg-b-size-8)}.mg-c-popover-content{--mg-c-card-max-width:var(--mg-c-popover-max-width);--mg-c-card-min-width:var(--mg-c-popover-min-width)}.mg-c-popover-content mg-button{margin-top:calc(-1*(var(--mg-b-size-min-height) - var(--mg-c-popover-title-font-size)*var(--mg-b-line-height))/2);margin-right:calc(-1*(var(--mg-b-size-min-height) - var(--mg-b-size-16))/2);margin-left:var(--mg-b-size-32);float:right}.mg-c-popover-content__title ::slotted([slot=title]){margin:0 0 var(--mg-b-size-8) !important;font-size:var(--mg-c-popover-title-font-size) !important;font-weight:600 !important}.mg-c-popover-content ::slotted(*:not(mg-panel,mg-message,mg-modal)){--mg-c-card-border:var(--mg-c-card-border-default);--mg-c-card-spacing:var(--mg-c-card-spacing-default);--mg-c-card-border-radius:var(--mg-c-card-border-radius-default);--mg-c-card-color-background:var(--mg-c-card-color-background-default);--mg-c-card-box-shadow:var(--mg-c-card-box-shadow-default);--mg-c-card-max-width:unset;--mg-c-card-min-width:unset}:host([data-placement^=top][data-arrow-hide]){padding-bottom:0}:host([data-placement^=bottom][data-arrow-hide]){padding-top:0}:host([data-placement$=end][data-arrow-hide]),:host([data-placement^=left][data-arrow-hide]){padding-right:0}:host([data-placement$=start][data-arrow-hide]),:host([data-placement^=right][data-arrow-hide]){padding-left:0}::slotted([slot=arrow]){position:absolute;width:calc(var(--mg-b-size-24) + 2*var(--mg-c-card-border-radius) + 2*var(--mg-b-size-8));height:calc(var(--mg-b-size-24) + 2*var(--mg-c-card-border-radius) + 2*var(--mg-b-size-8));visibility:hidden}::slotted([slot=arrow])::before{position:absolute;content:\"\";visibility:visible}:host([data-arrow-hide]) ::slotted([slot=arrow]){display:none}:host([data-placement^=top]) ::slotted([slot=arrow]),:host([data-placement^=bottom]) ::slotted([slot=arrow]){height:var(--mg-b-size-8)}:host([data-placement^=top]) ::slotted([slot=arrow])::before,:host([data-placement^=bottom]) ::slotted([slot=arrow])::before{left:calc(var(--mg-c-card-border-radius) + var(--mg-b-size-8));border-right:calc(var(--mg-b-size-24)/2) solid rgba(0,0,0,0);border-left:calc(var(--mg-b-size-24)/2) solid rgba(0,0,0,0)}:host([data-placement^=top]) ::slotted([slot=arrow]){bottom:var(--mg-b-size-border);filter:drop-shadow(0 0.5rem 0.25rem color-mix(in srgb, var(--mg-b-color-dark), transparent 85%))}:host([data-placement^=top]) ::slotted([slot=arrow])::before{border-top:var(--mg-b-size-8) solid var(--mg-c-popover-color-background)}:host([data-placement^=bottom]) ::slotted([slot=arrow]){top:var(--mg-b-size-border);filter:drop-shadow(0 -0.5rem 0.25rem color-mix(in srgb, var(--mg-b-color-dark), transparent 85%))}:host([data-placement^=bottom]) ::slotted([slot=arrow])::before{border-bottom:var(--mg-b-size-8) solid var(--mg-c-popover-color-background)}:host([data-placement^=left]) ::slotted([slot=arrow]),:host([data-placement^=right]) ::slotted([slot=arrow]){width:var(--mg-b-size-8)}:host([data-placement^=left]) ::slotted([slot=arrow])::before,:host([data-placement^=right]) ::slotted([slot=arrow])::before{top:calc(var(--mg-c-card-border-radius) + var(--mg-b-size-8));border-top:calc(var(--mg-b-size-24)/2) solid rgba(0,0,0,0);border-bottom:calc(var(--mg-b-size-24)/2) solid rgba(0,0,0,0)}:host([data-placement^=left]) ::slotted([slot=arrow]){right:var(--mg-b-size-border);filter:drop-shadow(0.5rem 0 0.25rem color-mix(in srgb, var(--mg-b-color-dark), transparent 85%))}:host([data-placement^=left]) ::slotted([slot=arrow])::before{border-left:var(--mg-b-size-8) solid var(--mg-c-popover-color-background)}:host([data-placement^=right]) ::slotted([slot=arrow]){left:var(--mg-b-size-border);filter:drop-shadow(-0.5rem 0 0.25rem color-mix(in srgb, var(--mg-b-color-dark), transparent 85%))}:host([data-placement^=right]) ::slotted([slot=arrow])::before{border-right:var(--mg-b-size-8) solid var(--mg-c-popover-color-background)}:host([data-placement^=left-start]) ::slotted([slot=arrow]),:host([data-placement^=left-end]) ::slotted([slot=arrow]),:host([data-placement^=right-start]) ::slotted([slot=arrow]),:host([data-placement^=right-end]) ::slotted([slot=arrow]){height:calc(var(--mg-b-size-24) + 2*var(--mg-c-card-border-radius))}:host([data-placement^=left-start]) ::slotted([slot=arrow])::before,:host([data-placement^=left-end]) ::slotted([slot=arrow])::before,:host([data-placement^=right-start]) ::slotted([slot=arrow])::before,:host([data-placement^=right-end]) ::slotted([slot=arrow])::before{top:var(--mg-c-card-border-radius)}";
|
|
8087
8106
|
|
|
8088
8107
|
const MgPopoverContent = class {
|
|
8089
8108
|
constructor(hostRef) {
|
|
@@ -8096,7 +8115,7 @@ const MgPopoverContent = class {
|
|
|
8096
8115
|
/**
|
|
8097
8116
|
* Component classes
|
|
8098
8117
|
*/
|
|
8099
|
-
this.classCollection = new index_es.
|
|
8118
|
+
this.classCollection = new index_es.Zt(['mg-c-popover-content']);
|
|
8100
8119
|
/**
|
|
8101
8120
|
* Handle action for close button
|
|
8102
8121
|
*/
|
|
@@ -8120,7 +8139,7 @@ const MgPopoverContent = class {
|
|
|
8120
8139
|
componentDidLoad() {
|
|
8121
8140
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
8122
8141
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
8123
|
-
if (slottedTitleElement && !index_es.
|
|
8142
|
+
if (slottedTitleElement && !index_es.qt(slottedTitleElement, headingTags)) {
|
|
8124
8143
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
8125
8144
|
}
|
|
8126
8145
|
}
|
|
@@ -8129,7 +8148,7 @@ const MgPopoverContent = class {
|
|
|
8129
8148
|
* @returns HTML Element
|
|
8130
8149
|
*/
|
|
8131
8150
|
render() {
|
|
8132
|
-
return (index.h(index.Host, { key: '
|
|
8151
|
+
return (index.h(index.Host, { key: '8d2dd7d21518de744c18f0280b7b418f3a76acca' }, index.h("mg-card", { key: '8beab7c9fb692c1983515709a1ee888dc7e5157a', class: this.classCollection.join() }, this.closeButton && (index.h("mg-button", { key: 'e636569be26b0c741e0b03e806787d91b47ded5c', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { key: '3edc717cbe542494d892566c182883e20b1ca4cb', icon: "cross" }))), index.h("div", { key: 'd18525218972d92b6932984edb50844658e12970', class: "mg-c-popover-content__title" }, index.h("slot", { key: '2cceb41fd4ebb00b889e71cab211431e5894d04c', name: "title" })), index.h("slot", { key: 'a6615d9d7c85b32fb63d3d89db02fae2f8d5c1b2', name: "content" })), index.h("slot", { key: '0ff4bf72de19a3d56aafb64391cfc276d70e2f18', name: "arrow" })));
|
|
8133
8152
|
}
|
|
8134
8153
|
get element() { return index.getElement(this); }
|
|
8135
8154
|
};
|
|
@@ -8154,7 +8173,7 @@ const MgSkipLinks = class {
|
|
|
8154
8173
|
};
|
|
8155
8174
|
}
|
|
8156
8175
|
validateLinks(links) {
|
|
8157
|
-
if (links === undefined || links.length === 0 || links.some(link => !index_es.
|
|
8176
|
+
if (links === undefined || links.length === 0 || links.some(link => !index_es.De(link.href) || !link.href.startsWith('#') || !index_es.De(link.label))) {
|
|
8158
8177
|
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.`);
|
|
8159
8178
|
}
|
|
8160
8179
|
}
|
|
@@ -8173,7 +8192,7 @@ const MgSkipLinks = class {
|
|
|
8173
8192
|
* @returns HTML Element
|
|
8174
8193
|
*/
|
|
8175
8194
|
render() {
|
|
8176
|
-
return (index.h("nav", { key: '
|
|
8195
|
+
return (index.h("nav", { key: '0b4e4d6b9481a88faae78602b07c4f5e851da517', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, index.h("ul", { key: 'aaa15193eb2c9e1d9ee3b2e2a7d8d0fd37836ed7', 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)))))));
|
|
8177
8196
|
}
|
|
8178
8197
|
get element() { return index.getElement(this); }
|
|
8179
8198
|
static get watchers() { return {
|
|
@@ -8260,11 +8279,11 @@ const MgTable = class {
|
|
|
8260
8279
|
/**
|
|
8261
8280
|
* Class collection
|
|
8262
8281
|
*/
|
|
8263
|
-
this.classCollection = new index_es.
|
|
8282
|
+
this.classCollection = new index_es.Zt([this.componentClass]);
|
|
8264
8283
|
}
|
|
8265
8284
|
watchSize(newValue, oldValue) {
|
|
8266
8285
|
if (!sizes$1.includes(newValue)) {
|
|
8267
|
-
throw new Error(`<mg-table> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${index_es.
|
|
8286
|
+
throw new Error(`<mg-table> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
8268
8287
|
}
|
|
8269
8288
|
else {
|
|
8270
8289
|
if (oldValue !== undefined) {
|
|
@@ -8283,7 +8302,7 @@ const MgTable = class {
|
|
|
8283
8302
|
}
|
|
8284
8303
|
watchColumns(newValue) {
|
|
8285
8304
|
if (newValue !== undefined && !isValidColumnsObject(newValue)) {
|
|
8286
|
-
throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${index_es.
|
|
8305
|
+
throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${index_es.Gt(newValue)}.`);
|
|
8287
8306
|
}
|
|
8288
8307
|
}
|
|
8289
8308
|
/**
|
|
@@ -8412,8 +8431,8 @@ const MgTable = class {
|
|
|
8412
8431
|
// Ensure caption is not visible (otherwhise the table does not have rounded corners)
|
|
8413
8432
|
captionTable.className = 'mg-u-visually-hidden';
|
|
8414
8433
|
// Link caption to div
|
|
8415
|
-
if (!index_es.
|
|
8416
|
-
captionTable.setAttribute('id', index_es.
|
|
8434
|
+
if (!index_es.De(captionTable.id)) {
|
|
8435
|
+
captionTable.setAttribute('id', index_es.Pt(`${this.componentClass}-caption`));
|
|
8417
8436
|
}
|
|
8418
8437
|
divWrapper.setAttribute('aria-labelledby', captionTable.id);
|
|
8419
8438
|
// Add sortable caption if neeeded
|
|
@@ -8497,7 +8516,7 @@ const MgTabs = class {
|
|
|
8497
8516
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
8498
8517
|
* If not set, it will be created.
|
|
8499
8518
|
*/
|
|
8500
|
-
this.identifier = index_es.
|
|
8519
|
+
this.identifier = index_es.Pt('mg-tabs');
|
|
8501
8520
|
/**
|
|
8502
8521
|
* Define tabs size
|
|
8503
8522
|
*/
|
|
@@ -8509,7 +8528,7 @@ const MgTabs = class {
|
|
|
8509
8528
|
/**
|
|
8510
8529
|
* Component classes
|
|
8511
8530
|
*/
|
|
8512
|
-
this.classCollection = new index_es.
|
|
8531
|
+
this.classCollection = new index_es.Zt(['mg-c-tabs']);
|
|
8513
8532
|
/**
|
|
8514
8533
|
* Validate that new tab status can be `Status.ACTIVE`
|
|
8515
8534
|
* @param tab - tab item
|
|
@@ -8562,18 +8581,18 @@ const MgTabs = class {
|
|
|
8562
8581
|
*/
|
|
8563
8582
|
this.handleKeydown = (event) => {
|
|
8564
8583
|
const parent = event.target.parentElement;
|
|
8565
|
-
if ([
|
|
8584
|
+
if ([events_utils.Keys.ARROWLEFT, events_utils.Keys.ARROWRIGHT].includes(event.key)) {
|
|
8566
8585
|
this.tabFocus = Number(event.target.dataset.index);
|
|
8567
8586
|
parent.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute('tabindex', '-1');
|
|
8568
8587
|
// Move right
|
|
8569
|
-
if (event.key ===
|
|
8588
|
+
if (event.key === events_utils.Keys.ARROWRIGHT) {
|
|
8570
8589
|
this.tabFocus++;
|
|
8571
8590
|
// If we're at the end, go to the start
|
|
8572
8591
|
if (this.tabFocus > this.tabs.length)
|
|
8573
8592
|
this.tabFocus = this.startIndex;
|
|
8574
8593
|
// Move left
|
|
8575
8594
|
}
|
|
8576
|
-
else if (event.key ===
|
|
8595
|
+
else if (event.key === events_utils.Keys.ARROWLEFT) {
|
|
8577
8596
|
this.tabFocus--;
|
|
8578
8597
|
// If we're at the start, move to the end
|
|
8579
8598
|
if (this.tabFocus < this.startIndex)
|
|
@@ -8590,7 +8609,7 @@ const MgTabs = class {
|
|
|
8590
8609
|
parentButtonElement.focus();
|
|
8591
8610
|
}
|
|
8592
8611
|
}
|
|
8593
|
-
else if (event.key ===
|
|
8612
|
+
else if (event.key === events_utils.Keys.TAB) {
|
|
8594
8613
|
this.resetFocus();
|
|
8595
8614
|
}
|
|
8596
8615
|
};
|
|
@@ -8607,7 +8626,7 @@ const MgTabs = class {
|
|
|
8607
8626
|
*/
|
|
8608
8627
|
this.resetFocus = () => {
|
|
8609
8628
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
8610
|
-
index_es.
|
|
8629
|
+
index_es.Xt(() => {
|
|
8611
8630
|
this.tabFocus = undefined;
|
|
8612
8631
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
8613
8632
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -8624,30 +8643,30 @@ const MgTabs = class {
|
|
|
8624
8643
|
};
|
|
8625
8644
|
}
|
|
8626
8645
|
watchIdentifier(newValue) {
|
|
8627
|
-
if (!index_es.
|
|
8628
|
-
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
8646
|
+
if (!index_es.Ut(newValue)) {
|
|
8647
|
+
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
8629
8648
|
}
|
|
8630
8649
|
}
|
|
8631
8650
|
validateLabel(newValue) {
|
|
8632
|
-
if (!index_es.
|
|
8633
|
-
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${index_es.
|
|
8651
|
+
if (!index_es.De(newValue)) {
|
|
8652
|
+
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${index_es.Gt(newValue)}.`);
|
|
8634
8653
|
}
|
|
8635
8654
|
}
|
|
8636
8655
|
validateSize(newValue) {
|
|
8637
8656
|
if (!sizes.includes(newValue)) {
|
|
8638
|
-
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${index_es.
|
|
8657
|
+
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
8639
8658
|
}
|
|
8640
8659
|
this.classCollection.add(`mg-c-tabs--size-${this.size}`);
|
|
8641
8660
|
}
|
|
8642
8661
|
validateItems(newValue) {
|
|
8643
8662
|
// String array
|
|
8644
|
-
if (index_es.
|
|
8663
|
+
if (index_es.Dt(newValue))
|
|
8645
8664
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
8646
8665
|
// Object array
|
|
8647
8666
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
8648
8667
|
this.tabs = newValue;
|
|
8649
8668
|
else
|
|
8650
|
-
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${index_es.
|
|
8669
|
+
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${index_es.Gt(newValue)}.`);
|
|
8651
8670
|
}
|
|
8652
8671
|
validateActiveTab(newValue) {
|
|
8653
8672
|
// when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
|
|
@@ -8672,7 +8691,7 @@ const MgTabs = class {
|
|
|
8672
8691
|
this.activeTabChange.emit(newValue);
|
|
8673
8692
|
}
|
|
8674
8693
|
else {
|
|
8675
|
-
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${index_es.
|
|
8694
|
+
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${index_es.Gt(newValue)}.`);
|
|
8676
8695
|
}
|
|
8677
8696
|
}
|
|
8678
8697
|
/*************
|
|
@@ -8707,7 +8726,7 @@ const MgTabs = class {
|
|
|
8707
8726
|
* @returns HTML Element
|
|
8708
8727
|
*/
|
|
8709
8728
|
render() {
|
|
8710
|
-
return (index.h("div", { key: '
|
|
8729
|
+
return (index.h("div", { key: '558c5ba517bef98ba711dd8992f901768d6770de', class: this.classCollection.join() }, index.h("header", { key: '0d36d49d51bbbb78bbf68c05e47271349fc58b96', 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: {
|
|
8711
8730
|
[`${this.buttonTabBaseClass}`]: true,
|
|
8712
8731
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
8713
8732
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -8757,11 +8776,11 @@ const MgTag = class {
|
|
|
8757
8776
|
/**
|
|
8758
8777
|
* Component classes
|
|
8759
8778
|
*/
|
|
8760
|
-
this.classCollection = new index_es.
|
|
8779
|
+
this.classCollection = new index_es.Zt(['mg-c-tag']);
|
|
8761
8780
|
}
|
|
8762
8781
|
validateVariant(newValue, oldValue) {
|
|
8763
8782
|
if (!variants.includes(newValue)) {
|
|
8764
|
-
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${index_es.
|
|
8783
|
+
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${index_es.Gt(newValue)}.`);
|
|
8765
8784
|
}
|
|
8766
8785
|
else {
|
|
8767
8786
|
if (oldValue !== undefined) {
|
|
@@ -8794,7 +8813,7 @@ const MgTag = class {
|
|
|
8794
8813
|
* @param textContent - html element textContent property
|
|
8795
8814
|
*/
|
|
8796
8815
|
validateTextContent(textContent) {
|
|
8797
|
-
if (!index_es.
|
|
8816
|
+
if (!index_es.De(textContent))
|
|
8798
8817
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
8799
8818
|
}
|
|
8800
8819
|
/*************
|
|
@@ -8847,7 +8866,7 @@ const MgTooltip = class {
|
|
|
8847
8866
|
* Sets an `id` attribute.
|
|
8848
8867
|
* Needed by the input for accessibility `aria-decribedby`.
|
|
8849
8868
|
*/
|
|
8850
|
-
this.identifier = index_es.
|
|
8869
|
+
this.identifier = index_es.Pt('mg-tooltip');
|
|
8851
8870
|
/**
|
|
8852
8871
|
* Tooltip placement
|
|
8853
8872
|
*/
|
|
@@ -8867,12 +8886,13 @@ const MgTooltip = class {
|
|
|
8867
8886
|
// Make the tooltip visible
|
|
8868
8887
|
this.mgTooltipContent.dataset.show = '';
|
|
8869
8888
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
8870
|
-
index_es.
|
|
8889
|
+
index_es.Xt(() => {
|
|
8871
8890
|
this.windows.forEach((localWindow) => {
|
|
8872
8891
|
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
8873
8892
|
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
8874
8893
|
});
|
|
8875
8894
|
});
|
|
8895
|
+
this.updateTooltip();
|
|
8876
8896
|
};
|
|
8877
8897
|
/**
|
|
8878
8898
|
* Hide tooltip
|
|
@@ -8910,8 +8930,9 @@ const MgTooltip = class {
|
|
|
8910
8930
|
* @param condition - additionnal condition to apply display prop newValue
|
|
8911
8931
|
*/
|
|
8912
8932
|
this.setDisplay = (newValue, condition = true) => {
|
|
8913
|
-
if (!this.disabled && condition)
|
|
8933
|
+
if (!this.disabled && condition && this.display !== newValue) {
|
|
8914
8934
|
this.display = newValue;
|
|
8935
|
+
}
|
|
8915
8936
|
};
|
|
8916
8937
|
/**
|
|
8917
8938
|
* Action for tooltip element and tooltiped element mouse listener
|
|
@@ -8969,52 +8990,43 @@ const MgTooltip = class {
|
|
|
8969
8990
|
}
|
|
8970
8991
|
};
|
|
8971
8992
|
/**
|
|
8972
|
-
*
|
|
8973
|
-
* @
|
|
8993
|
+
* Update tooltip position
|
|
8994
|
+
* @returns autoUpdate function
|
|
8974
8995
|
*/
|
|
8975
|
-
this.
|
|
8976
|
-
//
|
|
8996
|
+
this.updateTooltip = () => autoUpdate(this.tooltipedElement, this.mgTooltipContent, async () => {
|
|
8997
|
+
// Placement
|
|
8998
|
+
const { x, y, placement, middlewareData } = await computePosition(this.tooltipedElement, this.mgTooltipContent, {
|
|
8999
|
+
placement: this.placement,
|
|
9000
|
+
strategy: this.tooltipStrategy,
|
|
9001
|
+
middleware: [
|
|
9002
|
+
offset(8),
|
|
9003
|
+
flip(),
|
|
9004
|
+
shift({
|
|
9005
|
+
limiter: limitShift(),
|
|
9006
|
+
}),
|
|
9007
|
+
arrow({ element: this.arrowElement }),
|
|
9008
|
+
],
|
|
9009
|
+
});
|
|
9010
|
+
// Positioning
|
|
8977
9011
|
Object.assign(this.mgTooltipContent.style, {
|
|
8978
|
-
position:
|
|
8979
|
-
|
|
8980
|
-
left: '0',
|
|
8981
|
-
transform: 'translate(0, 0)',
|
|
9012
|
+
position: this.tooltipStrategy,
|
|
9013
|
+
transform: getTransformation(x, y),
|
|
8982
9014
|
});
|
|
8983
|
-
//
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
const staticSide = {
|
|
8996
|
-
top: 'bottom',
|
|
8997
|
-
right: 'left',
|
|
8998
|
-
bottom: 'top',
|
|
8999
|
-
left: 'right',
|
|
9000
|
-
}[placement.split('-')[0]];
|
|
9001
|
-
const arrowElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');
|
|
9002
|
-
// https://floating-ui.com/docs/arrow
|
|
9003
|
-
// Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.
|
|
9004
|
-
// Due to this, either x or y will be undefined, depending on the side of placement.
|
|
9005
|
-
// The above code uses `isNaN` to check for null and undefined simultaneously.
|
|
9006
|
-
// Don’t remove `isNaN`, because either value can be falsy (0), causing a bug!
|
|
9007
|
-
const numberToPx = (number) => (!isNaN(number) ? `${number}px` : '');
|
|
9008
|
-
Object.assign(arrowElement.style, {
|
|
9009
|
-
left: numberToPx(arrowX),
|
|
9010
|
-
top: numberToPx(arrowY),
|
|
9011
|
-
[staticSide]: '-4px',
|
|
9012
|
-
position: 'absolute',
|
|
9013
|
-
});
|
|
9014
|
-
this.mgTooltipContent.setAttribute('data-placement', placement);
|
|
9015
|
-
});
|
|
9015
|
+
// Arrow positioning
|
|
9016
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
9017
|
+
const staticSide = {
|
|
9018
|
+
top: 'bottom',
|
|
9019
|
+
right: 'left',
|
|
9020
|
+
bottom: 'top',
|
|
9021
|
+
left: 'right',
|
|
9022
|
+
}[placement.split('-')[0]];
|
|
9023
|
+
Object.assign(this.arrowElement.style, {
|
|
9024
|
+
left: numberToPx(arrowX),
|
|
9025
|
+
top: numberToPx(arrowY),
|
|
9026
|
+
[staticSide]: '-4px',
|
|
9016
9027
|
});
|
|
9017
|
-
|
|
9028
|
+
this.mgTooltipContent.setAttribute('data-placement', placement);
|
|
9029
|
+
});
|
|
9018
9030
|
/**
|
|
9019
9031
|
* Define selected element to become tooltip selector and init listeners
|
|
9020
9032
|
* @param element - tooltiped element
|
|
@@ -9056,18 +9068,15 @@ const MgTooltip = class {
|
|
|
9056
9068
|
// set guard when one of mutations is for a disabled with disabled-on-click
|
|
9057
9069
|
if (mutationList.some((mutation) => mutation.target.disabled && mutation.target.disableOnClick)) {
|
|
9058
9070
|
this.guard = Guard.DISABLE_ON_CLICK;
|
|
9059
|
-
}
|
|
9060
|
-
// when the disabled-on-click guard is running we stop process
|
|
9061
|
-
if (this.guard === Guard.DISABLE_ON_CLICK)
|
|
9062
9071
|
return;
|
|
9072
|
+
}
|
|
9063
9073
|
// update button wrapper
|
|
9064
9074
|
this.setMgButtonWrapper(mgButton);
|
|
9065
9075
|
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
9066
9076
|
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
9067
9077
|
this.resetGuard();
|
|
9068
9078
|
// update Floating UI instance
|
|
9069
|
-
this.
|
|
9070
|
-
this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
|
|
9079
|
+
this.updateTooltip();
|
|
9071
9080
|
}).observe(mgButton, { attributes: true });
|
|
9072
9081
|
};
|
|
9073
9082
|
/**
|
|
@@ -9086,15 +9095,15 @@ const MgTooltip = class {
|
|
|
9086
9095
|
};
|
|
9087
9096
|
}
|
|
9088
9097
|
watchIdentifier(newValue) {
|
|
9089
|
-
if (!index_es.
|
|
9090
|
-
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${index_es.
|
|
9098
|
+
if (!index_es.Ut(newValue)) {
|
|
9099
|
+
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${index_es.Gt(newValue)}.`);
|
|
9091
9100
|
}
|
|
9092
9101
|
// use renderTooltipContent to update tooltip-content id
|
|
9093
9102
|
this.renderTooltipContent();
|
|
9094
9103
|
}
|
|
9095
9104
|
watchMessage(newValue) {
|
|
9096
|
-
if (!index_es.
|
|
9097
|
-
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${index_es.
|
|
9105
|
+
if (!index_es.De(newValue)) {
|
|
9106
|
+
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${index_es.Gt(newValue)}.`);
|
|
9098
9107
|
}
|
|
9099
9108
|
if (this.mgTooltipContent !== undefined)
|
|
9100
9109
|
this.mgTooltipContent.message = newValue;
|
|
@@ -9153,7 +9162,7 @@ const MgTooltip = class {
|
|
|
9153
9162
|
*/
|
|
9154
9163
|
componentWillLoad() {
|
|
9155
9164
|
// Get windows to attach events
|
|
9156
|
-
this.windows = index_es.
|
|
9165
|
+
this.windows = index_es.Bt(window);
|
|
9157
9166
|
// Get tooltip element
|
|
9158
9167
|
this.renderTooltipContent();
|
|
9159
9168
|
//validate properties
|
|
@@ -9161,6 +9170,8 @@ const MgTooltip = class {
|
|
|
9161
9170
|
this.watchDisabled(this.disabled);
|
|
9162
9171
|
this.watchMessage(this.message);
|
|
9163
9172
|
this.watchIdentifier(this.identifier);
|
|
9173
|
+
// define if the tooltip is inside a popover
|
|
9174
|
+
this.tooltipStrategy = this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed';
|
|
9164
9175
|
}
|
|
9165
9176
|
/**
|
|
9166
9177
|
* Get slotted element
|
|
@@ -9172,8 +9183,10 @@ const MgTooltip = class {
|
|
|
9172
9183
|
// get slotted element wich is not the tooltip
|
|
9173
9184
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
9174
9185
|
// Get interactive element
|
|
9175
|
-
const interactiveElement = slotElement.matches(index_es.
|
|
9186
|
+
const interactiveElement = slotElement.matches(index_es.Ht) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(index_es.Ht);
|
|
9176
9187
|
this.setTooltipedElement(interactiveElement || slotElement);
|
|
9188
|
+
// Set arrow element
|
|
9189
|
+
this.arrowElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');
|
|
9177
9190
|
// Check if slotted element is a disabled mg-button
|
|
9178
9191
|
// In this case we wrap the mg-button into a div to enable the tooltip
|
|
9179
9192
|
if (isButton(slotElement)) {
|
|
@@ -9189,8 +9202,6 @@ const MgTooltip = class {
|
|
|
9189
9202
|
}
|
|
9190
9203
|
// apply a11y aria
|
|
9191
9204
|
this.setAriaDescribedby(slotElement);
|
|
9192
|
-
// set Tooltip
|
|
9193
|
-
this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
|
|
9194
9205
|
// add document keyboard handler
|
|
9195
9206
|
document.addEventListener('keydown', this.handlePressEscape);
|
|
9196
9207
|
// check props
|
|
@@ -9200,28 +9211,26 @@ const MgTooltip = class {
|
|
|
9200
9211
|
* update popper position after props change on component did update hook to benefit from render ended
|
|
9201
9212
|
*/
|
|
9202
9213
|
componentDidUpdate() {
|
|
9203
|
-
this.
|
|
9204
|
-
this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
|
|
9214
|
+
this.updateTooltip();
|
|
9205
9215
|
}
|
|
9206
9216
|
/**
|
|
9207
9217
|
* remove listeners
|
|
9208
9218
|
*/
|
|
9209
9219
|
disconnectedCallback() {
|
|
9210
|
-
var _a;
|
|
9220
|
+
var _a, _b;
|
|
9211
9221
|
document.removeEventListener('keydown', this.handlePressEscape);
|
|
9212
9222
|
(_a = this.windows) === null || _a === void 0 ? void 0 : _a.forEach((localWindow) => {
|
|
9213
9223
|
localWindow.removeEventListener('click', this.handleClickOutside, false);
|
|
9214
9224
|
localWindow.removeEventListener('keydown', this.handlePressEscape, false);
|
|
9215
9225
|
});
|
|
9216
|
-
|
|
9217
|
-
this.floatingUICleanup();
|
|
9226
|
+
(_b = this.updateTooltip) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
9218
9227
|
}
|
|
9219
9228
|
/**
|
|
9220
9229
|
* Render
|
|
9221
9230
|
* @returns HTML Element
|
|
9222
9231
|
*/
|
|
9223
9232
|
render() {
|
|
9224
|
-
return (index.h(index.Host, { key: '
|
|
9233
|
+
return (index.h(index.Host, { key: 'dab470c730b1541ab5be487222da8ba3643501ae' }, index.h("slot", { key: 'a6f5d444e3521d93cf9f39ccffcd68cfde4f8101' }), index.h("slot", { key: 'ba4d98f953453a710379cb4ce28f1c468a34ffc4', name: "content" })));
|
|
9225
9234
|
}
|
|
9226
9235
|
get element() { return index.getElement(this); }
|
|
9227
9236
|
static get watchers() { return {
|
|
@@ -9234,7 +9243,7 @@ const MgTooltip = class {
|
|
|
9234
9243
|
};
|
|
9235
9244
|
MgTooltip.style = mgTooltipCss;
|
|
9236
9245
|
|
|
9237
|
-
const mgTooltipContentCss = ":host{z-index:1000;display:none;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}";
|
|
9246
|
+
const mgTooltipContentCss = ":host{z-index:1000;top:0;left:0;display:none;width:max-content;max-width:var(--mg-b-size-floating-element-max-width);box-sizing:border-box;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-c-tooltip-border-radius);background-color:var(--mg-c-tooltip-color-background);color:var(--mg-c-tooltip-color-text);font-family:var(--mg-b-font-family);font-size:var(--mg-b-font-size);font-weight:400;text-align:start}:host([data-show]){display:block}::slotted([slot=arrow]){position:absolute;visibility:hidden}::slotted([slot=arrow])::before{content:\"\";transform:rotate(45deg);visibility:visible}::slotted([slot=arrow]),::slotted([slot=arrow])::before{position:absolute;z-index:9999;width:var(--mg-b-size-8);height:var(--mg-b-size-8);background-color:var(--mg-c-tooltip-color-background)}:host([data-placement^=top])>::slotted([slot=arrow]){bottom:calc(-1*var(--mg-b-size-4))}:host([data-placement^=bottom])>::slotted([slot=arrow]){top:calc(-1*var(--mg-b-size-4))}:host([data-placement^=left])>::slotted([slot=arrow]){right:calc(-1*var(--mg-b-size-4))}:host([data-placement^=right])>::slotted([slot=arrow]){left:calc(-1*var(--mg-b-size-4))}";
|
|
9238
9247
|
|
|
9239
9248
|
const MgTooltipContent = class {
|
|
9240
9249
|
constructor(hostRef) {
|