@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,7 +1,8 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-CAuxALt5.js';
|
|
2
|
-
import {
|
|
3
|
-
import { i as initLocales } from './index-
|
|
4
|
-
import {
|
|
2
|
+
import { P as Pt, G as Gt, Z as Zt, a as De, X as Xt, U as Ut, b as qt, J as Jt, L as Lt, F as Ft, c as ar, d as ir, l as lr, f as fr, e as cr, o as or, D as Dt, B as Bt, g as Ht } from './index.es-rLV3KFPd.js';
|
|
3
|
+
import { i as initLocales } from './index-DmsGewMC.js';
|
|
4
|
+
import { K as Keys } from './events.utils-yMGqY8YG.js';
|
|
5
|
+
import { t as tooltipPositions, b as classFieldset, c as classReadonly, a as classDisabled, d as classVerticalList, w as widths } from './mg-input.conf-CNgv8hc5.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Available menu item status values
|
|
@@ -73,7 +74,7 @@ const MgActionMore = class {
|
|
|
73
74
|
************/
|
|
74
75
|
this.name = 'mg-action-more';
|
|
75
76
|
this.classBase = 'mg-c-action-more';
|
|
76
|
-
this.mgPopoverIdentifier =
|
|
77
|
+
this.mgPopoverIdentifier = Pt(this.name);
|
|
77
78
|
/**
|
|
78
79
|
* Define button properties
|
|
79
80
|
*/
|
|
@@ -120,15 +121,15 @@ const MgActionMore = class {
|
|
|
120
121
|
}
|
|
121
122
|
validateItems(newValue) {
|
|
122
123
|
if (!isMgActionMoreItems(newValue)) {
|
|
123
|
-
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${
|
|
124
|
+
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${Gt(newValue)}.`);
|
|
124
125
|
}
|
|
125
126
|
else if (isMgActionMoreItems(newValue) && newValue.length > 0 && (isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {
|
|
126
|
-
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${
|
|
127
|
+
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${Gt(newValue)}.`);
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
validateIcon(newValue) {
|
|
130
131
|
if (newValue && !isMgActionMoreIcon(newValue)) {
|
|
131
|
-
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${
|
|
132
|
+
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${Gt(newValue)}.`);
|
|
132
133
|
}
|
|
133
134
|
else if ((newValue === null || newValue === void 0 ? void 0 : newValue.icon) === undefined && Boolean(this.button.isIcon)) {
|
|
134
135
|
this.icon = { icon: 'ellipsis' };
|
|
@@ -136,7 +137,7 @@ const MgActionMore = class {
|
|
|
136
137
|
}
|
|
137
138
|
validateButton(newValue) {
|
|
138
139
|
if (newValue && !isMgActionMoreButton(newValue)) {
|
|
139
|
-
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${
|
|
140
|
+
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${Gt(newValue)}.`);
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
validateDisplayChevron(newValue) {
|
|
@@ -170,9 +171,9 @@ const MgActionMore = class {
|
|
|
170
171
|
[`${this.classBase}__chevron--rotate`]: this.expanded === true,
|
|
171
172
|
} }, h("mg-icon", { icon: "chevron-down" })));
|
|
172
173
|
}
|
|
173
|
-
return (h(Host, { key: '
|
|
174
|
+
return (h(Host, { key: '655b4be7b0b17db8ad6e2d688f59c18f2750dfe4', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: '19f5763f7732fb156803fb6a24f776f182d230f4', class: this.classBase }, h("mg-popover", { key: '617fefddd54794e3f3da60e700e1c60e0758c66b', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange }, 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 && h("mg-icon", Object.assign({ key: 'ded976da4cd3a457a232aee9613dc9e108c35358' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: 'e3308c1e0ae198f204c283408f9c3afc154ddf21', slot: "content" }, h("mg-menu", { key: '70c222a09f42b938f56a5bb02fa4193ca8f47788', direction: directions$1.VERTICAL, label: this.messages.label }, this.items.map(item => {
|
|
174
175
|
var _a, _b;
|
|
175
|
-
return isMgActionMoreDivider(item) ? (h("mg-divider", { class: "mg-c-action-more__divider", key: "divider" })) : (h("mg-menu-item", { key: item.label, status: item.status || Status$1.VISIBLE, target: item.target, href: item.href,
|
|
176
|
+
return isMgActionMoreDivider(item) ? (h("mg-divider", { class: "mg-c-action-more__divider", key: "divider", "full-width": true })) : (h("mg-menu-item", { key: item.label, status: item.status || Status$1.VISIBLE, target: item.target, href: item.href,
|
|
176
177
|
// eslint-disable-next-line react/jsx-no-bind
|
|
177
178
|
onClick: e => this.handleItemClick(e, item.mouseEventHandler) }, ((_a = item.icon) === null || _a === void 0 ? void 0 : _a.icon) && h("mg-icon", { icon: item.icon.icon, variant: item.icon.variant, variantStyle: item.icon.variantStyle, slot: "image" }), h("span", { slot: "label" }, item.label), ((_b = item.badge) === null || _b === void 0 ? void 0 : _b.label) && h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" })));
|
|
178
179
|
})))))));
|
|
@@ -213,21 +214,21 @@ const MgBadge = class {
|
|
|
213
214
|
/**
|
|
214
215
|
* Component classes
|
|
215
216
|
*/
|
|
216
|
-
this.classCollection = new
|
|
217
|
+
this.classCollection = new Zt(['mg-c-badge']);
|
|
217
218
|
}
|
|
218
219
|
validateValue(newValue) {
|
|
219
220
|
if (/^[^A-Z]+$/i.exec(`${newValue}`) === null) {
|
|
220
|
-
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${
|
|
221
|
+
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${Gt(newValue)}.`);
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
224
|
validateLabel(newValue) {
|
|
224
|
-
if (!
|
|
225
|
-
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${
|
|
225
|
+
if (!De(newValue)) {
|
|
226
|
+
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${Gt(newValue)}.`);
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
229
|
validateVariant(newValue, oldValue) {
|
|
229
230
|
if (!variants$4.includes(newValue)) {
|
|
230
|
-
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${
|
|
231
|
+
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
231
232
|
}
|
|
232
233
|
else {
|
|
233
234
|
if (oldValue !== undefined) {
|
|
@@ -320,7 +321,7 @@ const MgButton = class {
|
|
|
320
321
|
/**
|
|
321
322
|
* Component classes
|
|
322
323
|
*/
|
|
323
|
-
this.classCollection = new
|
|
324
|
+
this.classCollection = new Zt(['mg-c-button']);
|
|
324
325
|
/**
|
|
325
326
|
* Trigger actions onClick event
|
|
326
327
|
* @param event - click event
|
|
@@ -342,7 +343,7 @@ const MgButton = class {
|
|
|
342
343
|
if (!this.disabled && event.key === ' ') {
|
|
343
344
|
event.preventDefault();
|
|
344
345
|
}
|
|
345
|
-
else if (!this.disabled && [
|
|
346
|
+
else if (!this.disabled && [Keys.ENTER, Keys.NUMPADENTER, Keys.SPACE].includes(event.key)) {
|
|
346
347
|
event.preventDefault();
|
|
347
348
|
this.element.dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
348
349
|
}
|
|
@@ -378,7 +379,7 @@ const MgButton = class {
|
|
|
378
379
|
this.variant = variants$3[0];
|
|
379
380
|
return;
|
|
380
381
|
}
|
|
381
|
-
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${
|
|
382
|
+
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
382
383
|
}
|
|
383
384
|
else {
|
|
384
385
|
if (oldValue !== undefined) {
|
|
@@ -390,7 +391,7 @@ const MgButton = class {
|
|
|
390
391
|
validateSize(newValue, oldValue) {
|
|
391
392
|
// validate new value
|
|
392
393
|
if (!sizes$4.includes(newValue)) {
|
|
393
|
-
throw new Error(`<mg-button> prop "size" must be one of: ${sizes$4.join(', ')}. Passed value: ${
|
|
394
|
+
throw new Error(`<mg-button> prop "size" must be one of: ${sizes$4.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
394
395
|
}
|
|
395
396
|
else {
|
|
396
397
|
if (oldValue !== undefined) {
|
|
@@ -432,7 +433,7 @@ const MgButton = class {
|
|
|
432
433
|
watchIsIcon(newValue) {
|
|
433
434
|
if (newValue) {
|
|
434
435
|
this.classCollection.add(`mg-c-button--icon`);
|
|
435
|
-
if (!
|
|
436
|
+
if (!De(this.label)) {
|
|
436
437
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
437
438
|
}
|
|
438
439
|
}
|
|
@@ -463,7 +464,7 @@ const MgButton = class {
|
|
|
463
464
|
* Add listners
|
|
464
465
|
*/
|
|
465
466
|
componentDidLoad() {
|
|
466
|
-
|
|
467
|
+
Xt(() => {
|
|
467
468
|
var _a;
|
|
468
469
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
469
470
|
// submit buttons should trigger form submition;
|
|
@@ -480,7 +481,7 @@ const MgButton = class {
|
|
|
480
481
|
*/
|
|
481
482
|
render() {
|
|
482
483
|
var _a;
|
|
483
|
-
return (h(Host, { key: '
|
|
484
|
+
return (h(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 }, h("div", { key: 'e4fc763ce10eb5958ebd9330f778380bb93100d6', class: this.classCollection.join() }, this.loading && h("mg-icon", { key: '6796487254b12a33339ac6b3a5f6c67000d8fe04', icon: "loader", spin: true }), h("div", { key: '469136ef8519825ebff3e6ee2bfe8c55e64a807d', class: "mg-c-button__content" }, h("slot", { key: 'eda514d71eaab7f7cf5cd3a65b64ffb6c9ed2e02' })))));
|
|
484
485
|
}
|
|
485
486
|
get element() { return getElement(this); }
|
|
486
487
|
static get watchers() { return {
|
|
@@ -524,13 +525,13 @@ const MgCharacterLeft = class {
|
|
|
524
525
|
this.characters = '';
|
|
525
526
|
}
|
|
526
527
|
watchIdentifier(newValue) {
|
|
527
|
-
if (newValue !== undefined && !
|
|
528
|
-
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${
|
|
528
|
+
if (newValue !== undefined && !Ut(newValue)) {
|
|
529
|
+
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
529
530
|
}
|
|
530
531
|
}
|
|
531
532
|
validateMaxlength(newValue) {
|
|
532
533
|
if (typeof newValue !== 'number') {
|
|
533
|
-
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${
|
|
534
|
+
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${Gt(newValue)}.`);
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
537
|
/*************
|
|
@@ -559,7 +560,7 @@ const MgCharacterLeft = class {
|
|
|
559
560
|
};
|
|
560
561
|
MgCharacterLeft.style = mgCharacterLeftCss;
|
|
561
562
|
|
|
562
|
-
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}}";
|
|
563
|
+
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}}";
|
|
563
564
|
|
|
564
565
|
const MgDetails = class {
|
|
565
566
|
constructor(hostRef) {
|
|
@@ -581,7 +582,7 @@ const MgDetails = class {
|
|
|
581
582
|
};
|
|
582
583
|
}
|
|
583
584
|
validateTitles(newValue) {
|
|
584
|
-
if (!
|
|
585
|
+
if (!De(newValue)) {
|
|
585
586
|
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}'".`);
|
|
586
587
|
}
|
|
587
588
|
}
|
|
@@ -608,7 +609,7 @@ const MgDetails = class {
|
|
|
608
609
|
* @returns HTML Element
|
|
609
610
|
*/
|
|
610
611
|
render() {
|
|
611
|
-
return (h("details", { key: '
|
|
612
|
+
return (h("details", { key: 'e43aa4f4262d7006b9fdd0e75666649498081d55', class: "mg-c-details", onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '050d5c0a645a017aaa784a4034201122b27238f0' }, h("slot", { key: 'e0d7ed83952bdd74a23ecabe93c4d0c922cda286', name: "summary" }), h("span", { key: '27238089072f0f0ca8f3263ec39e41291ab89907', class: "mg-c-details__toggle" }, h("mg-icon", { key: 'f1702911d70e2a95ecaac17a7a0c43a075ea8c18', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: '6854f4ecd77d04e297b807060a0d064401d6537f', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: '85e57b346ff8327d31f92a1e86c42fd8f131f6dc', class: "mg-c-details__details" }, h("slot", { key: 'bd016ab29d695bb1ccd99b9fd402ed23bbdc19ea', name: "details" }))));
|
|
612
613
|
}
|
|
613
614
|
get element() { return getElement(this); }
|
|
614
615
|
static get watchers() { return {
|
|
@@ -668,7 +669,7 @@ const MgForm = class {
|
|
|
668
669
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
669
670
|
* If not set, it will be created.
|
|
670
671
|
*/
|
|
671
|
-
this.identifier =
|
|
672
|
+
this.identifier = Pt('mg-form');
|
|
672
673
|
/**
|
|
673
674
|
* Input name
|
|
674
675
|
* If not set the value equals the identifier
|
|
@@ -689,7 +690,7 @@ const MgForm = class {
|
|
|
689
690
|
/**
|
|
690
691
|
* Component classes
|
|
691
692
|
*/
|
|
692
|
-
this.classCollection = new
|
|
693
|
+
this.classCollection = new Zt(['mg-c-form']);
|
|
693
694
|
/**
|
|
694
695
|
* Define required message based on mg-inputs required elements
|
|
695
696
|
*/
|
|
@@ -777,18 +778,18 @@ const MgForm = class {
|
|
|
777
778
|
};
|
|
778
779
|
}
|
|
779
780
|
watchIdentifier(newValue) {
|
|
780
|
-
if (!
|
|
781
|
-
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${
|
|
781
|
+
if (!Ut(newValue)) {
|
|
782
|
+
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
782
783
|
}
|
|
783
784
|
}
|
|
784
785
|
validateRequiredMessage(newValue) {
|
|
785
786
|
if (newValue && !requiredMessageStatus.includes(newValue)) {
|
|
786
|
-
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${
|
|
787
|
+
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
787
788
|
}
|
|
788
789
|
}
|
|
789
790
|
validateAriaRole(newValue) {
|
|
790
791
|
if (newValue && !roles.includes(newValue)) {
|
|
791
|
-
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${
|
|
792
|
+
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
792
793
|
}
|
|
793
794
|
}
|
|
794
795
|
handlelabelOnTop(newValue) {
|
|
@@ -877,7 +878,7 @@ const MgForm = class {
|
|
|
877
878
|
* @returns HTML Element
|
|
878
879
|
*/
|
|
879
880
|
render() {
|
|
880
|
-
return (h("form", { key: '
|
|
881
|
+
return (h("form", { key: '444703cae8a5374a86adc1dcaf048665f06e795f', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: '1a936dfeb41a257be7b44afada7bd435f9a357f0', innerHTML: this.requiredMessageText }), h("slot", { key: 'a446094e8658b02c5a9baf7b19d77ca11b1432e9' }), !this.readonly && !this.disabled && h("slot", { key: '41f4e1c80a0f78b112eaac1d5bc53a219eee926e', name: "actions" })));
|
|
881
882
|
}
|
|
882
883
|
get element() { return getElement(this); }
|
|
883
884
|
static get watchers() { return {
|
|
@@ -922,7 +923,7 @@ const MgIcon = class {
|
|
|
922
923
|
/**
|
|
923
924
|
* Component classes
|
|
924
925
|
*/
|
|
925
|
-
this.classCollection = new
|
|
926
|
+
this.classCollection = new Zt(['mg-c-icon']);
|
|
926
927
|
/**
|
|
927
928
|
* Method to set default varianStyle props
|
|
928
929
|
* needeed has stencil doesn't know that props is mutated when updated in prop watcher
|
|
@@ -953,7 +954,7 @@ const MgIcon = class {
|
|
|
953
954
|
}
|
|
954
955
|
validateIcon(newValue, oldValue) {
|
|
955
956
|
if (!Object.keys(icons).includes(newValue)) {
|
|
956
|
-
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${
|
|
957
|
+
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
957
958
|
}
|
|
958
959
|
else {
|
|
959
960
|
if (oldValue !== undefined) {
|
|
@@ -969,7 +970,7 @@ const MgIcon = class {
|
|
|
969
970
|
newValue = 'medium';
|
|
970
971
|
}
|
|
971
972
|
if (!sizes$3.includes(newValue)) {
|
|
972
|
-
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${
|
|
973
|
+
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$3.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
973
974
|
}
|
|
974
975
|
else {
|
|
975
976
|
if (oldValue !== undefined) {
|
|
@@ -981,7 +982,7 @@ const MgIcon = class {
|
|
|
981
982
|
validateVariant(newValue, oldValue) {
|
|
982
983
|
if (newValue !== undefined) {
|
|
983
984
|
if (!variants$2.includes(newValue))
|
|
984
|
-
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${
|
|
985
|
+
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
985
986
|
else {
|
|
986
987
|
this.setDefaultVariantStyle();
|
|
987
988
|
if (oldValue !== undefined)
|
|
@@ -993,7 +994,7 @@ const MgIcon = class {
|
|
|
993
994
|
validateVariantStyle(newValue, oldValue) {
|
|
994
995
|
if (newValue !== undefined) {
|
|
995
996
|
if (!variantStyles$1.includes(newValue))
|
|
996
|
-
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${
|
|
997
|
+
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
997
998
|
else {
|
|
998
999
|
if (oldValue !== undefined)
|
|
999
1000
|
this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);
|
|
@@ -1063,11 +1064,11 @@ const MgIllustratedMessage = class {
|
|
|
1063
1064
|
/**
|
|
1064
1065
|
* Component classes
|
|
1065
1066
|
*/
|
|
1066
|
-
this.classCollection = new
|
|
1067
|
+
this.classCollection = new Zt(['mg-c-illustrated-message']);
|
|
1067
1068
|
}
|
|
1068
1069
|
watchSize(newValue, oldValue) {
|
|
1069
1070
|
if (!sizes$2.includes(newValue)) {
|
|
1070
|
-
throw new Error(`<mg-illustrated-message> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${
|
|
1071
|
+
throw new Error(`<mg-illustrated-message> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
1071
1072
|
}
|
|
1072
1073
|
else {
|
|
1073
1074
|
if (oldValue !== undefined) {
|
|
@@ -1078,7 +1079,7 @@ const MgIllustratedMessage = class {
|
|
|
1078
1079
|
}
|
|
1079
1080
|
watchDirection(newValue, oldValue) {
|
|
1080
1081
|
if (newValue !== undefined && !directions.includes(newValue)) {
|
|
1081
|
-
throw new Error(`<mg-illustrated-message> prop "direction" must be one of: ${directions.join(', ')}. Passed value: ${
|
|
1082
|
+
throw new Error(`<mg-illustrated-message> prop "direction" must be one of: ${directions.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
1082
1083
|
}
|
|
1083
1084
|
else if (newValue === 'horizontal') {
|
|
1084
1085
|
this.classCollection.add('mg-c-illustrated-message--direction-horizontal');
|
|
@@ -1101,7 +1102,7 @@ const MgIllustratedMessage = class {
|
|
|
1101
1102
|
if (slottedDetails.length === 0 && slottedTitle === null) {
|
|
1102
1103
|
throw new Error('<mg-illustrated-message> Slot "title" or "details" must be present.');
|
|
1103
1104
|
}
|
|
1104
|
-
else if (slottedTitle !== null && !
|
|
1105
|
+
else if (slottedTitle !== null && !qt(slottedTitle, headingTags)) {
|
|
1105
1106
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
1106
1107
|
}
|
|
1107
1108
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -1125,7 +1126,7 @@ const MgIllustratedMessage = class {
|
|
|
1125
1126
|
* @returns HTML Element
|
|
1126
1127
|
*/
|
|
1127
1128
|
render() {
|
|
1128
|
-
return (h("div", { key: '
|
|
1129
|
+
return (h("div", { key: '60c53ef4294aa36a8c354b42f47f5c7d9fc409f6', class: this.classCollection.join() }, h("div", { key: '254673ae5b7183a1adfa53c18d9e632bcdd67607', class: "mg-c-illustrated-message__illustration" }, h("slot", { key: '16b9bbe8abaae4d0f7b713fbe345e54b5b966ac0', name: "illustration" })), h("div", { key: 'c272c168ea520f8c71261e8f84297fb1bd44c044', class: "mg-c-illustrated-message__slots" }, h("slot", { key: '7ba11d5f5fe293175a01768619bc43b0632ba0a5', name: "title" }), h("slot", { key: 'f03540939af486bb44134298b12eaf9de32f814a', name: "details" }))));
|
|
1129
1130
|
}
|
|
1130
1131
|
get element() { return getElement(this); }
|
|
1131
1132
|
static get watchers() { return {
|
|
@@ -1186,11 +1187,11 @@ const MgInput = class {
|
|
|
1186
1187
|
this.renderTooltip = () => (h("mg-tooltip", { identifier: `${this.identifier}-tooltip`, message: this.tooltip }, h("mg-icon", { icon: "info-circle" })));
|
|
1187
1188
|
}
|
|
1188
1189
|
watchIdentifier(newValue) {
|
|
1189
|
-
if (!
|
|
1190
|
-
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${
|
|
1190
|
+
if (!De(newValue)) {
|
|
1191
|
+
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${Gt(newValue)}.`);
|
|
1191
1192
|
}
|
|
1192
|
-
else if (!
|
|
1193
|
-
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${
|
|
1193
|
+
else if (!Ut(newValue)) {
|
|
1194
|
+
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
1194
1195
|
}
|
|
1195
1196
|
else {
|
|
1196
1197
|
this.helpTextId = `${this.identifier}-help-text`;
|
|
@@ -1212,7 +1213,7 @@ const MgInput = class {
|
|
|
1212
1213
|
}
|
|
1213
1214
|
watchTooltipPosition(newValue) {
|
|
1214
1215
|
if (!tooltipPositions.includes(newValue)) {
|
|
1215
|
-
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${
|
|
1216
|
+
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
1216
1217
|
}
|
|
1217
1218
|
}
|
|
1218
1219
|
watchErrorMessage(newValue) {
|
|
@@ -1281,8 +1282,8 @@ const MgInput = class {
|
|
|
1281
1282
|
*/
|
|
1282
1283
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1283
1284
|
watchLabel() {
|
|
1284
|
-
if (!
|
|
1285
|
-
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${
|
|
1285
|
+
if (!De(this.label)) {
|
|
1286
|
+
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${Gt(this.label)}.`);
|
|
1286
1287
|
}
|
|
1287
1288
|
else {
|
|
1288
1289
|
this.watchAriaDescribedbyIDs();
|
|
@@ -1486,7 +1487,7 @@ const MgInputCheckbox = class {
|
|
|
1486
1487
|
/**
|
|
1487
1488
|
* Component classes
|
|
1488
1489
|
*/
|
|
1489
|
-
this.classCollection = new
|
|
1490
|
+
this.classCollection = new Zt([this.baseClassName, classFieldset]);
|
|
1490
1491
|
/**
|
|
1491
1492
|
* Formated value to display in list
|
|
1492
1493
|
*/
|
|
@@ -1604,7 +1605,7 @@ const MgInputCheckbox = class {
|
|
|
1604
1605
|
* Method to update searchResults
|
|
1605
1606
|
*/
|
|
1606
1607
|
this.updateSearchResults = () => {
|
|
1607
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
1608
|
+
this.searchResults = this.checkboxItems.filter(item => Jt(item.title).includes(Jt(this.searchValue)));
|
|
1608
1609
|
};
|
|
1609
1610
|
/**
|
|
1610
1611
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1636,13 +1637,13 @@ const MgInputCheckbox = class {
|
|
|
1636
1637
|
* @returns message to display
|
|
1637
1638
|
*/
|
|
1638
1639
|
this.getSelectValuesButtonMessage = () => {
|
|
1639
|
-
if (this.selectValuesButtonKey === 'editButton' &&
|
|
1640
|
+
if (this.selectValuesButtonKey === 'editButton' && De(this.editButtonMessage)) {
|
|
1640
1641
|
return this.editButtonMessage;
|
|
1641
1642
|
}
|
|
1642
|
-
else if (this.selectValuesButtonKey === 'showButton' &&
|
|
1643
|
+
else if (this.selectValuesButtonKey === 'showButton' && De(this.showButtonMessage)) {
|
|
1643
1644
|
return this.showButtonMessage;
|
|
1644
1645
|
}
|
|
1645
|
-
else if (this.selectValuesButtonKey === 'selectButton' &&
|
|
1646
|
+
else if (this.selectValuesButtonKey === 'selectButton' && De(this.selectButtonMessage)) {
|
|
1646
1647
|
return this.selectButtonMessage;
|
|
1647
1648
|
}
|
|
1648
1649
|
else {
|
|
@@ -1698,12 +1699,12 @@ const MgInputCheckbox = class {
|
|
|
1698
1699
|
this.valueChange.emit(newValue);
|
|
1699
1700
|
}
|
|
1700
1701
|
else {
|
|
1701
|
-
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${
|
|
1702
|
+
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${Gt(newValue)}.`);
|
|
1702
1703
|
}
|
|
1703
1704
|
}
|
|
1704
1705
|
validateType(newValue) {
|
|
1705
1706
|
if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
|
|
1706
|
-
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${
|
|
1707
|
+
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${Gt(newValue)}.`);
|
|
1707
1708
|
}
|
|
1708
1709
|
else if (newValue === undefined) {
|
|
1709
1710
|
this.mode = 'auto';
|
|
@@ -1803,7 +1804,7 @@ const MgInputCheckbox = class {
|
|
|
1803
1804
|
if (typeof valid !== 'boolean') {
|
|
1804
1805
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
|
|
1805
1806
|
}
|
|
1806
|
-
else if (!
|
|
1807
|
+
else if (!De(errorMessage)) {
|
|
1807
1808
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
|
|
1808
1809
|
}
|
|
1809
1810
|
else {
|
|
@@ -2075,7 +2076,7 @@ const MgInputCheckboxPaginated = class {
|
|
|
2075
2076
|
|
|
2076
2077
|
const DEFAULT_MAX_DATE = '9999-12-31';
|
|
2077
2078
|
|
|
2078
|
-
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}}";
|
|
2079
|
+
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}}";
|
|
2079
2080
|
|
|
2080
2081
|
const MgInputDate = class {
|
|
2081
2082
|
constructor(hostRef) {
|
|
@@ -2121,13 +2122,13 @@ const MgInputDate = class {
|
|
|
2121
2122
|
/**
|
|
2122
2123
|
* Component classes
|
|
2123
2124
|
*/
|
|
2124
|
-
this.classCollection = new
|
|
2125
|
+
this.classCollection = new Zt(['mg-c-input--date']);
|
|
2125
2126
|
/**
|
|
2126
2127
|
* Method to validate date pattern string
|
|
2127
2128
|
* @param value - value to test
|
|
2128
2129
|
* @returns truthy when value match the pattern
|
|
2129
2130
|
*/
|
|
2130
|
-
this.isValidPattern = (value) =>
|
|
2131
|
+
this.isValidPattern = (value) => De(value) && Lt.test(value);
|
|
2131
2132
|
/**
|
|
2132
2133
|
* Format help text to display
|
|
2133
2134
|
* @param helpText - help text format
|
|
@@ -2141,23 +2142,23 @@ const MgInputDate = class {
|
|
|
2141
2142
|
}
|
|
2142
2143
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
2143
2144
|
// If a custom helpText is provided, store it but don't return it directly
|
|
2144
|
-
let text =
|
|
2145
|
+
let text = De(helpText) ? helpText : this.messages.input.date.helpText.expectedFormat;
|
|
2145
2146
|
// Handle defaultHelpText
|
|
2146
2147
|
if (text.includes(defaultHelpTextVariable)) {
|
|
2147
2148
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText.expectedFormat));
|
|
2148
2149
|
}
|
|
2149
2150
|
// Replace pattern and date variables
|
|
2150
|
-
text = text.replace('{pattern}', this.renderPattern()).replace('{date}',
|
|
2151
|
+
text = text.replace('{pattern}', this.renderPattern()).replace('{date}', Ft(ar(new Date('2025-12-24')), this.systemLocale));
|
|
2151
2152
|
// Add additional message for min/max if necessary
|
|
2152
2153
|
let rangeMessage;
|
|
2153
2154
|
if (((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.max !== DEFAULT_MAX_DATE) {
|
|
2154
|
-
rangeMessage = this.messages.input.date.helpText.minMax.replace('{min}',
|
|
2155
|
+
rangeMessage = this.messages.input.date.helpText.minMax.replace('{min}', Ft(this.min, this.systemLocale)).replace('{max}', Ft(this.max, this.systemLocale));
|
|
2155
2156
|
}
|
|
2156
2157
|
else if (((_b = this.min) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
2157
|
-
rangeMessage = this.messages.input.date.helpText.min.replace('{min}',
|
|
2158
|
+
rangeMessage = this.messages.input.date.helpText.min.replace('{min}', Ft(this.min, this.systemLocale));
|
|
2158
2159
|
}
|
|
2159
2160
|
else if (this.max !== DEFAULT_MAX_DATE) {
|
|
2160
|
-
rangeMessage = this.messages.input.date.helpText.max.replace('{max}',
|
|
2161
|
+
rangeMessage = this.messages.input.date.helpText.max.replace('{max}', Ft(this.max, this.systemLocale));
|
|
2161
2162
|
}
|
|
2162
2163
|
// Combine custom helpText with range message if both exist
|
|
2163
2164
|
if (text !== undefined && rangeMessage !== undefined) {
|
|
@@ -2254,15 +2255,15 @@ const MgInputDate = class {
|
|
|
2254
2255
|
// min, max & minMax
|
|
2255
2256
|
else if (['min', 'max', 'minMax'].includes(inputError)) {
|
|
2256
2257
|
this.errorMessage = this.messages.input.date.helpText[inputError]
|
|
2257
|
-
.replace('{min}',
|
|
2258
|
-
.replace('{max}',
|
|
2258
|
+
.replace('{min}', Ft(this.min, this.systemLocale))
|
|
2259
|
+
.replace('{max}', Ft(this.max, this.systemLocale));
|
|
2259
2260
|
}
|
|
2260
2261
|
// wrong date format
|
|
2261
2262
|
// element.validity.badInput is default error message
|
|
2262
2263
|
else {
|
|
2263
2264
|
this.errorMessage = this.messages.input.date.error.badInput
|
|
2264
2265
|
.replace('{pattern}', this.renderPattern())
|
|
2265
|
-
.replace('{date}',
|
|
2266
|
+
.replace('{date}', Ft(ar(new Date('2025-12-24')), this.systemLocale));
|
|
2266
2267
|
}
|
|
2267
2268
|
}
|
|
2268
2269
|
};
|
|
@@ -2271,7 +2272,7 @@ const MgInputDate = class {
|
|
|
2271
2272
|
* @returns translated html pattern
|
|
2272
2273
|
*/
|
|
2273
2274
|
this.renderPattern = () => {
|
|
2274
|
-
let patternLocal =
|
|
2275
|
+
let patternLocal = ir(this.systemLocale);
|
|
2275
2276
|
for (const key in this.messages.input.date.pattern) {
|
|
2276
2277
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
2277
2278
|
}
|
|
@@ -2286,9 +2287,9 @@ const MgInputDate = class {
|
|
|
2286
2287
|
// - `undefined` is not allowed in CustomEvent['detail']
|
|
2287
2288
|
this.value = null;
|
|
2288
2289
|
}
|
|
2289
|
-
else if (newValue && !
|
|
2290
|
+
else if (newValue && !De(newValue)) {
|
|
2290
2291
|
// check value validity
|
|
2291
|
-
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${
|
|
2292
|
+
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${Gt(newValue)}.`);
|
|
2292
2293
|
}
|
|
2293
2294
|
else if (newValue === null || this.isValidPattern(newValue)) {
|
|
2294
2295
|
this.valueChange.emit(newValue);
|
|
@@ -2305,7 +2306,7 @@ const MgInputDate = class {
|
|
|
2305
2306
|
}
|
|
2306
2307
|
validateMinMax(newValue) {
|
|
2307
2308
|
if (newValue && !this.isValidPattern(newValue)) {
|
|
2308
|
-
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${
|
|
2309
|
+
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${Gt(newValue)}.`);
|
|
2309
2310
|
}
|
|
2310
2311
|
}
|
|
2311
2312
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -2355,7 +2356,7 @@ const MgInputDate = class {
|
|
|
2355
2356
|
if (typeof valid !== 'boolean') {
|
|
2356
2357
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean.');
|
|
2357
2358
|
}
|
|
2358
|
-
else if (!
|
|
2359
|
+
else if (!De(errorMessage)) {
|
|
2359
2360
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string.');
|
|
2360
2361
|
}
|
|
2361
2362
|
else {
|
|
@@ -2421,7 +2422,7 @@ const MgInputDate = class {
|
|
|
2421
2422
|
* @returns HTML Element
|
|
2422
2423
|
*/
|
|
2423
2424
|
render() {
|
|
2424
|
-
return (h("mg-input", { key: '
|
|
2425
|
+
return (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 && h("b", { class: "mg-c-input__readonly-value" }, Ft(this.value, this.locale))) : (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) => {
|
|
2425
2426
|
if (el !== null)
|
|
2426
2427
|
this.input = el;
|
|
2427
2428
|
} }))));
|
|
@@ -2444,7 +2445,7 @@ MgInputDate.style = mgInputDateCss;
|
|
|
2444
2445
|
const types = ['decimal', 'integer'];
|
|
2445
2446
|
const formats = ['none', 'number', 'currency', 'percent', 'unit'];
|
|
2446
2447
|
|
|
2447
|
-
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)}";
|
|
2448
|
+
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)}";
|
|
2448
2449
|
|
|
2449
2450
|
const MgInputNumeric = class {
|
|
2450
2451
|
constructor(hostRef) {
|
|
@@ -2512,17 +2513,17 @@ const MgInputNumeric = class {
|
|
|
2512
2513
|
/**
|
|
2513
2514
|
* Component classes
|
|
2514
2515
|
*/
|
|
2515
|
-
this.classCollection = new
|
|
2516
|
+
this.classCollection = new Zt(['mg-c-input--numeric']);
|
|
2516
2517
|
/**
|
|
2517
2518
|
* Handle input event
|
|
2518
2519
|
*/
|
|
2519
2520
|
this.handleInput = () => {
|
|
2521
|
+
this.value = this.input.value;
|
|
2520
2522
|
// Check validity
|
|
2521
2523
|
this.checkValidity();
|
|
2522
2524
|
if (this.hasDisplayedError) {
|
|
2523
2525
|
this.setErrorMessage();
|
|
2524
2526
|
}
|
|
2525
|
-
this.value = this.input.value;
|
|
2526
2527
|
};
|
|
2527
2528
|
/**
|
|
2528
2529
|
* Handle focus event
|
|
@@ -2555,7 +2556,7 @@ const MgInputNumeric = class {
|
|
|
2555
2556
|
* @param value - value to format
|
|
2556
2557
|
* @returns formatted value according to locale
|
|
2557
2558
|
*/
|
|
2558
|
-
this.formatErrorValue = (value) =>
|
|
2559
|
+
this.formatErrorValue = (value) => lr(value, this.locale, !Number.isInteger(value) && this.type === 'decimal' ? this.decimalLength : 0);
|
|
2559
2560
|
/**
|
|
2560
2561
|
* Set input error message
|
|
2561
2562
|
* @param errorMessage - errorMessage override
|
|
@@ -2610,13 +2611,13 @@ const MgInputNumeric = class {
|
|
|
2610
2611
|
this.formatValue = (value) => {
|
|
2611
2612
|
switch (this.format) {
|
|
2612
2613
|
case 'number':
|
|
2613
|
-
return
|
|
2614
|
+
return lr(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2614
2615
|
case 'currency':
|
|
2615
|
-
return
|
|
2616
|
+
return or(value, this.locale, this.currency);
|
|
2616
2617
|
case 'percent':
|
|
2617
|
-
return
|
|
2618
|
+
return cr(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2618
2619
|
case 'unit':
|
|
2619
|
-
return
|
|
2620
|
+
return fr(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2620
2621
|
case 'none':
|
|
2621
2622
|
return value.toString();
|
|
2622
2623
|
}
|
|
@@ -2647,7 +2648,7 @@ const MgInputNumeric = class {
|
|
|
2647
2648
|
return undefined;
|
|
2648
2649
|
}
|
|
2649
2650
|
// If a custom helpText is provided, store it but don't return it directly
|
|
2650
|
-
const text =
|
|
2651
|
+
const text = De(helpText) ? helpText : undefined;
|
|
2651
2652
|
// If neither min nor max are defined, and there's no custom helpText,
|
|
2652
2653
|
// we can return undefined as there's no message to display
|
|
2653
2654
|
if (this.min === undefined && this.max === undefined && text === undefined) {
|
|
@@ -2731,22 +2732,22 @@ const MgInputNumeric = class {
|
|
|
2731
2732
|
}
|
|
2732
2733
|
validateType(newValue) {
|
|
2733
2734
|
if (!types.includes(newValue)) {
|
|
2734
|
-
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${
|
|
2735
|
+
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
2735
2736
|
}
|
|
2736
2737
|
}
|
|
2737
2738
|
watchFormat(newValue) {
|
|
2738
2739
|
if (!formats.includes(newValue)) {
|
|
2739
|
-
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${
|
|
2740
|
+
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
2740
2741
|
}
|
|
2741
2742
|
}
|
|
2742
2743
|
validateIntegerLength(newValue) {
|
|
2743
2744
|
if (newValue < 1) {
|
|
2744
|
-
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${
|
|
2745
|
+
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${Gt(newValue)}.`);
|
|
2745
2746
|
}
|
|
2746
2747
|
}
|
|
2747
2748
|
validateDecimalLength(newValue) {
|
|
2748
2749
|
if (newValue < 1) {
|
|
2749
|
-
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${
|
|
2750
|
+
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${Gt(newValue)}.`);
|
|
2750
2751
|
}
|
|
2751
2752
|
}
|
|
2752
2753
|
/**
|
|
@@ -2780,7 +2781,7 @@ const MgInputNumeric = class {
|
|
|
2780
2781
|
if (typeof valid !== 'boolean') {
|
|
2781
2782
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
|
|
2782
2783
|
}
|
|
2783
|
-
else if (!
|
|
2784
|
+
else if (!De(errorMessage)) {
|
|
2784
2785
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
|
|
2785
2786
|
}
|
|
2786
2787
|
else {
|
|
@@ -2881,7 +2882,7 @@ const MgInputNumeric = class {
|
|
|
2881
2882
|
* @returns HTML Element
|
|
2882
2883
|
*/
|
|
2883
2884
|
render() {
|
|
2884
|
-
return (h("mg-input", { key: '
|
|
2885
|
+
return (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
|
|
2885
2886
|
? this.readonlyValue && this.renderReadonly()
|
|
2886
2887
|
: [
|
|
2887
2888
|
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) => {
|
|
@@ -2908,7 +2909,7 @@ const MgInputNumeric = class {
|
|
|
2908
2909
|
};
|
|
2909
2910
|
MgInputNumeric.style = mgInputNumericCss;
|
|
2910
2911
|
|
|
2911
|
-
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}";
|
|
2912
|
+
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}";
|
|
2912
2913
|
|
|
2913
2914
|
const MgInputPassword = class {
|
|
2914
2915
|
constructor(hostRef) {
|
|
@@ -2953,7 +2954,7 @@ const MgInputPassword = class {
|
|
|
2953
2954
|
/**
|
|
2954
2955
|
* Component classes
|
|
2955
2956
|
*/
|
|
2956
|
-
this.classCollection = new
|
|
2957
|
+
this.classCollection = new Zt(['mg-c-input--password']);
|
|
2957
2958
|
/**
|
|
2958
2959
|
* Indicates if password is displayed or not
|
|
2959
2960
|
*/
|
|
@@ -3073,7 +3074,7 @@ const MgInputPassword = class {
|
|
|
3073
3074
|
if (typeof valid !== 'boolean') {
|
|
3074
3075
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
|
|
3075
3076
|
}
|
|
3076
|
-
else if (!
|
|
3077
|
+
else if (!De(errorMessage)) {
|
|
3077
3078
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
|
|
3078
3079
|
}
|
|
3079
3080
|
else {
|
|
@@ -3130,7 +3131,7 @@ const MgInputPassword = class {
|
|
|
3130
3131
|
* @returns HTML Element
|
|
3131
3132
|
*/
|
|
3132
3133
|
render() {
|
|
3133
|
-
return (h("mg-input", { key: '
|
|
3134
|
+
return (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 && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, 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) => {
|
|
3134
3135
|
if (el !== null)
|
|
3135
3136
|
this.input = el;
|
|
3136
3137
|
} }), 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 }, h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
|
|
@@ -3204,7 +3205,7 @@ const MgInputRadio = class {
|
|
|
3204
3205
|
/**
|
|
3205
3206
|
* Component classes
|
|
3206
3207
|
*/
|
|
3207
|
-
this.classCollection = new
|
|
3208
|
+
this.classCollection = new Zt(['mg-c-input--radio', classFieldset]);
|
|
3208
3209
|
/**
|
|
3209
3210
|
* Handle input event
|
|
3210
3211
|
* @param event - input event
|
|
@@ -3255,7 +3256,7 @@ const MgInputRadio = class {
|
|
|
3255
3256
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3256
3257
|
watchValue(newValue) {
|
|
3257
3258
|
var _a;
|
|
3258
|
-
if (
|
|
3259
|
+
if (Dt(this.items) && typeof newValue === 'string') {
|
|
3259
3260
|
this.readonlyValue = newValue;
|
|
3260
3261
|
}
|
|
3261
3262
|
else if (Array.isArray(this.items) && this.items.every(isOption$3)) {
|
|
@@ -3269,10 +3270,10 @@ const MgInputRadio = class {
|
|
|
3269
3270
|
validateItems(newValue) {
|
|
3270
3271
|
// Validate if items have required min length
|
|
3271
3272
|
if (typeof newValue === 'object' && newValue.length < 2) {
|
|
3272
|
-
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${
|
|
3273
|
+
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${Gt(newValue)}.`);
|
|
3273
3274
|
}
|
|
3274
3275
|
// String array
|
|
3275
|
-
else if (
|
|
3276
|
+
else if (Dt(newValue)) {
|
|
3276
3277
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
3277
3278
|
}
|
|
3278
3279
|
// Object array
|
|
@@ -3280,7 +3281,7 @@ const MgInputRadio = class {
|
|
|
3280
3281
|
this.options = newValue;
|
|
3281
3282
|
}
|
|
3282
3283
|
else {
|
|
3283
|
-
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${
|
|
3284
|
+
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${Gt(newValue)}.`);
|
|
3284
3285
|
}
|
|
3285
3286
|
}
|
|
3286
3287
|
watchInputVerticalList(newValue) {
|
|
@@ -3342,7 +3343,7 @@ const MgInputRadio = class {
|
|
|
3342
3343
|
if (typeof valid !== 'boolean') {
|
|
3343
3344
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');
|
|
3344
3345
|
}
|
|
3345
|
-
else if (!
|
|
3346
|
+
else if (!De(errorMessage)) {
|
|
3346
3347
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');
|
|
3347
3348
|
}
|
|
3348
3349
|
else {
|
|
@@ -3402,7 +3403,7 @@ const MgInputRadio = class {
|
|
|
3402
3403
|
* @returns HTML Element
|
|
3403
3404
|
*/
|
|
3404
3405
|
render() {
|
|
3405
|
-
return (h("mg-input", { key: '
|
|
3406
|
+
return (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 && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
3406
3407
|
if (el !== null)
|
|
3407
3408
|
this.inputs[index] = el;
|
|
3408
3409
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
|
|
@@ -3419,7 +3420,7 @@ const MgInputRadio = class {
|
|
|
3419
3420
|
};
|
|
3420
3421
|
MgInputRadio.style = mgInputRadioCss;
|
|
3421
3422
|
|
|
3422
|
-
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%}}";
|
|
3423
|
+
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%}}";
|
|
3423
3424
|
|
|
3424
3425
|
/**
|
|
3425
3426
|
* Check if item is a well configured option
|
|
@@ -3510,7 +3511,7 @@ const MgInputSelect = class {
|
|
|
3510
3511
|
/**
|
|
3511
3512
|
* Component classes
|
|
3512
3513
|
*/
|
|
3513
|
-
this.classCollection = new
|
|
3514
|
+
this.classCollection = new Zt(['mg-c-input--select']);
|
|
3514
3515
|
/**
|
|
3515
3516
|
* Handle input event
|
|
3516
3517
|
*/
|
|
@@ -3540,7 +3541,7 @@ const MgInputSelect = class {
|
|
|
3540
3541
|
if (this.input.value === '') {
|
|
3541
3542
|
this.setValue(null);
|
|
3542
3543
|
}
|
|
3543
|
-
else if (
|
|
3544
|
+
else if (Dt(this.items) && this.items.includes(this.input.value)) {
|
|
3544
3545
|
this.setValue(this.input.value);
|
|
3545
3546
|
}
|
|
3546
3547
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3598,7 +3599,7 @@ const MgInputSelect = class {
|
|
|
3598
3599
|
}
|
|
3599
3600
|
validateValue(newValue) {
|
|
3600
3601
|
var _a, _b;
|
|
3601
|
-
if (
|
|
3602
|
+
if (Dt(this.items) && typeof newValue === 'string') {
|
|
3602
3603
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? this.input.value : newValue;
|
|
3603
3604
|
}
|
|
3604
3605
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3615,7 +3616,7 @@ const MgInputSelect = class {
|
|
|
3615
3616
|
this.options = [];
|
|
3616
3617
|
}
|
|
3617
3618
|
// String array
|
|
3618
|
-
else if (
|
|
3619
|
+
else if (Dt(newValue)) {
|
|
3619
3620
|
if (typeof this.value === 'string')
|
|
3620
3621
|
this.valueExist = newValue.includes(this.value);
|
|
3621
3622
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3633,7 +3634,7 @@ const MgInputSelect = class {
|
|
|
3633
3634
|
}
|
|
3634
3635
|
}
|
|
3635
3636
|
else {
|
|
3636
|
-
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: ${
|
|
3637
|
+
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: ${Gt(newValue)}.`);
|
|
3637
3638
|
}
|
|
3638
3639
|
}
|
|
3639
3640
|
watchReadonly(newValue) {
|
|
@@ -3698,7 +3699,7 @@ const MgInputSelect = class {
|
|
|
3698
3699
|
if (typeof valid !== 'boolean') {
|
|
3699
3700
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean.');
|
|
3700
3701
|
}
|
|
3701
|
-
else if (!
|
|
3702
|
+
else if (!De(errorMessage)) {
|
|
3702
3703
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string.');
|
|
3703
3704
|
}
|
|
3704
3705
|
else {
|
|
@@ -3762,7 +3763,7 @@ const MgInputSelect = class {
|
|
|
3762
3763
|
* @returns HTML Element
|
|
3763
3764
|
*/
|
|
3764
3765
|
render() {
|
|
3765
|
-
return (h("mg-input", { key: '
|
|
3766
|
+
return (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 && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (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) => {
|
|
3766
3767
|
if (el !== null)
|
|
3767
3768
|
this.input = el;
|
|
3768
3769
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -3788,7 +3789,7 @@ const helpTextTypes = ['email', 'emails', 'url'];
|
|
|
3788
3789
|
// Define possible text types
|
|
3789
3790
|
const textTypes = ['text', 'search', 'tel', ...helpTextTypes];
|
|
3790
3791
|
|
|
3791
|
-
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}
|
|
3792
|
+
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}";
|
|
3792
3793
|
|
|
3793
3794
|
/**
|
|
3794
3795
|
* Check if object is an option
|
|
@@ -3801,7 +3802,7 @@ const isOption$1 = (option) => typeof option === 'object' && typeof option.title
|
|
|
3801
3802
|
* @param options - Datalist options to check.
|
|
3802
3803
|
* @returns True if datalist is well structured.
|
|
3803
3804
|
*/
|
|
3804
|
-
const isDatalistOptions = (options) =>
|
|
3805
|
+
const isDatalistOptions = (options) => Dt(options) || (Array.isArray(options) && options.every(isOption$1));
|
|
3805
3806
|
const MgInputText = class {
|
|
3806
3807
|
constructor(hostRef) {
|
|
3807
3808
|
registerInstance(this, hostRef);
|
|
@@ -3866,13 +3867,13 @@ const MgInputText = class {
|
|
|
3866
3867
|
/**
|
|
3867
3868
|
* Component classes
|
|
3868
3869
|
*/
|
|
3869
|
-
this.classCollection = new
|
|
3870
|
+
this.classCollection = new Zt(['mg-c-input--text']);
|
|
3870
3871
|
/**
|
|
3871
3872
|
* Validate pattern configuration
|
|
3872
3873
|
*/
|
|
3873
3874
|
this.validatePattern = () => {
|
|
3874
3875
|
if ((this.pattern !== undefined || this.patternErrorMessage !== undefined) && // At least one is defined
|
|
3875
|
-
(!
|
|
3876
|
+
(!De(this.pattern) || (!helpTextTypes.includes(this.type) && !De(this.patternErrorMessage))) // Both must be defined
|
|
3876
3877
|
) {
|
|
3877
3878
|
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}'".`);
|
|
3878
3879
|
}
|
|
@@ -3892,7 +3893,7 @@ const MgInputText = class {
|
|
|
3892
3893
|
*/
|
|
3893
3894
|
this.handleFocus = () => {
|
|
3894
3895
|
this.classCollection.add(this.classFocus);
|
|
3895
|
-
this.classCollection = new
|
|
3896
|
+
this.classCollection = new Zt(this.classCollection.classes);
|
|
3896
3897
|
};
|
|
3897
3898
|
/**
|
|
3898
3899
|
* Handle blur event
|
|
@@ -3900,7 +3901,7 @@ const MgInputText = class {
|
|
|
3900
3901
|
this.handleBlur = () => {
|
|
3901
3902
|
// Manage focus
|
|
3902
3903
|
this.classCollection.delete(this.classFocus);
|
|
3903
|
-
this.classCollection = new
|
|
3904
|
+
this.classCollection = new Zt(this.classCollection.classes);
|
|
3904
3905
|
// Display Error
|
|
3905
3906
|
this.handlerInProgress = 'blur';
|
|
3906
3907
|
this.displayError().finally(() => {
|
|
@@ -3995,7 +3996,7 @@ const MgInputText = class {
|
|
|
3995
3996
|
}
|
|
3996
3997
|
validateDatalistoptions(newValue) {
|
|
3997
3998
|
if (Boolean(newValue) && !isDatalistOptions(newValue)) {
|
|
3998
|
-
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${
|
|
3999
|
+
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${Gt(newValue)}.`);
|
|
3999
4000
|
}
|
|
4000
4001
|
}
|
|
4001
4002
|
watchReadonly(newValue) {
|
|
@@ -4033,7 +4034,7 @@ const MgInputText = class {
|
|
|
4033
4034
|
this.validatePattern();
|
|
4034
4035
|
}
|
|
4035
4036
|
watchHelpText(newValue) {
|
|
4036
|
-
if (!
|
|
4037
|
+
if (!De(newValue) && helpTextTypes.includes(this.type)) {
|
|
4037
4038
|
this.helpText = this.messages.input.text.helpText[this.type];
|
|
4038
4039
|
}
|
|
4039
4040
|
}
|
|
@@ -4074,7 +4075,7 @@ const MgInputText = class {
|
|
|
4074
4075
|
if (typeof valid !== 'boolean') {
|
|
4075
4076
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
|
|
4076
4077
|
}
|
|
4077
|
-
else if (!
|
|
4078
|
+
else if (!De(errorMessage)) {
|
|
4078
4079
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
|
|
4079
4080
|
}
|
|
4080
4081
|
else {
|
|
@@ -4140,7 +4141,7 @@ const MgInputText = class {
|
|
|
4140
4141
|
* @returns HTML Element
|
|
4141
4142
|
*/
|
|
4142
4143
|
render() {
|
|
4143
|
-
return (h("mg-input", { key: '
|
|
4144
|
+
return (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
|
|
4144
4145
|
? this.value && this.renderReadonly()
|
|
4145
4146
|
: [
|
|
4146
4147
|
h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
|
|
@@ -4169,7 +4170,7 @@ const MgInputText = class {
|
|
|
4169
4170
|
};
|
|
4170
4171
|
MgInputText.style = mgInputTextCss;
|
|
4171
4172
|
|
|
4172
|
-
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}}";
|
|
4173
|
+
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}}";
|
|
4173
4174
|
|
|
4174
4175
|
const MgInputTextarea = class {
|
|
4175
4176
|
constructor(hostRef) {
|
|
@@ -4236,7 +4237,7 @@ const MgInputTextarea = class {
|
|
|
4236
4237
|
/**
|
|
4237
4238
|
* Component classes
|
|
4238
4239
|
*/
|
|
4239
|
-
this.classCollection = new
|
|
4240
|
+
this.classCollection = new Zt(['mg-c-input--textarea']);
|
|
4240
4241
|
/**
|
|
4241
4242
|
* Handle input event
|
|
4242
4243
|
*/
|
|
@@ -4252,7 +4253,7 @@ const MgInputTextarea = class {
|
|
|
4252
4253
|
*/
|
|
4253
4254
|
this.handleFocus = () => {
|
|
4254
4255
|
this.classCollection.add(this.classFocus);
|
|
4255
|
-
this.classCollection = new
|
|
4256
|
+
this.classCollection = new Zt(this.classCollection.classes);
|
|
4256
4257
|
};
|
|
4257
4258
|
/**
|
|
4258
4259
|
* Handle blur event
|
|
@@ -4260,7 +4261,7 @@ const MgInputTextarea = class {
|
|
|
4260
4261
|
this.handleBlur = () => {
|
|
4261
4262
|
// Manage focus
|
|
4262
4263
|
this.classCollection.delete(this.classFocus);
|
|
4263
|
-
this.classCollection = new
|
|
4264
|
+
this.classCollection = new Zt(this.classCollection.classes);
|
|
4264
4265
|
// Display Error
|
|
4265
4266
|
this.handlerInProgress = 'blur';
|
|
4266
4267
|
this.displayError().finally(() => {
|
|
@@ -4338,8 +4339,8 @@ const MgInputTextarea = class {
|
|
|
4338
4339
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
4339
4340
|
}
|
|
4340
4341
|
validatePattern(newValue) {
|
|
4341
|
-
if (newValue !== undefined && !(
|
|
4342
|
-
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${
|
|
4342
|
+
if (newValue !== undefined && !(De(this.pattern) && De(this.patternErrorMessage))) {
|
|
4343
|
+
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${Gt(this.pattern)}'" and "patternErrorMessage='${Gt(this.patternErrorMessage)}'".`);
|
|
4343
4344
|
}
|
|
4344
4345
|
}
|
|
4345
4346
|
validatecharacterLeftHide(newValue) {
|
|
@@ -4381,7 +4382,7 @@ const MgInputTextarea = class {
|
|
|
4381
4382
|
if (typeof valid !== 'boolean') {
|
|
4382
4383
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
|
|
4383
4384
|
}
|
|
4384
|
-
else if (!
|
|
4385
|
+
else if (!De(errorMessage)) {
|
|
4385
4386
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
|
|
4386
4387
|
}
|
|
4387
4388
|
else {
|
|
@@ -4443,7 +4444,7 @@ const MgInputTextarea = class {
|
|
|
4443
4444
|
* @returns HTML Element
|
|
4444
4445
|
*/
|
|
4445
4446
|
render() {
|
|
4446
|
-
return (h("mg-input", { key: '
|
|
4447
|
+
return (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 && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
|
|
4447
4448
|
'mg-c-input__box': true,
|
|
4448
4449
|
'mg-c-input__box--width': true,
|
|
4449
4450
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
@@ -4483,11 +4484,11 @@ const MgInputTitle = class {
|
|
|
4483
4484
|
this.tagName = 'label';
|
|
4484
4485
|
}
|
|
4485
4486
|
validateIdentifier(newValue) {
|
|
4486
|
-
if (!
|
|
4487
|
+
if (!De(newValue)) {
|
|
4487
4488
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
4488
4489
|
}
|
|
4489
|
-
else if (!
|
|
4490
|
-
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${
|
|
4490
|
+
else if (!Ut(newValue)) {
|
|
4491
|
+
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
4491
4492
|
}
|
|
4492
4493
|
}
|
|
4493
4494
|
validateIsLegend(newValue) {
|
|
@@ -4575,7 +4576,7 @@ const MgInputToggle = class {
|
|
|
4575
4576
|
/**
|
|
4576
4577
|
* Component classes
|
|
4577
4578
|
*/
|
|
4578
|
-
this.classCollection = new
|
|
4579
|
+
this.classCollection = new Zt(['mg-c-input--toggle']);
|
|
4579
4580
|
/**
|
|
4580
4581
|
* Checked internal value
|
|
4581
4582
|
*/
|
|
@@ -4636,10 +4637,10 @@ const MgInputToggle = class {
|
|
|
4636
4637
|
}
|
|
4637
4638
|
validateItems(newValue) {
|
|
4638
4639
|
if (typeof newValue === 'object' && this.items.length !== 2) {
|
|
4639
|
-
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${
|
|
4640
|
+
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${Gt(newValue)}.`);
|
|
4640
4641
|
}
|
|
4641
4642
|
// String array
|
|
4642
|
-
else if (
|
|
4643
|
+
else if (Dt(newValue)) {
|
|
4643
4644
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
4644
4645
|
}
|
|
4645
4646
|
// Object array
|
|
@@ -4647,7 +4648,7 @@ const MgInputToggle = class {
|
|
|
4647
4648
|
this.options = newValue;
|
|
4648
4649
|
}
|
|
4649
4650
|
else {
|
|
4650
|
-
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${
|
|
4651
|
+
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${Gt(newValue)}.`);
|
|
4651
4652
|
}
|
|
4652
4653
|
}
|
|
4653
4654
|
watchIsOnOff(newValue) {
|
|
@@ -4695,7 +4696,7 @@ const MgInputToggle = class {
|
|
|
4695
4696
|
if (typeof valid !== 'boolean') {
|
|
4696
4697
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
|
|
4697
4698
|
}
|
|
4698
|
-
else if (!
|
|
4699
|
+
else if (!De(errorMessage)) {
|
|
4699
4700
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
|
|
4700
4701
|
}
|
|
4701
4702
|
else {
|
|
@@ -4762,7 +4763,7 @@ const MgInputToggle = class {
|
|
|
4762
4763
|
*/
|
|
4763
4764
|
render() {
|
|
4764
4765
|
const checkedItem = this.getCheckedItem(this.checked);
|
|
4765
|
-
return (h("mg-input", { key: '
|
|
4766
|
+
return (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 && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (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 }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
|
|
4766
4767
|
}
|
|
4767
4768
|
get element() { return getElement(this); }
|
|
4768
4769
|
static get watchers() { return {
|
|
@@ -4835,8 +4836,8 @@ class OverflowBehavior {
|
|
|
4835
4836
|
else if (!this.isMoreElement(item) && item.parentElement !== this.parentElement)
|
|
4836
4837
|
this.parentElement.insertBefore(item, this.itemMoreElement);
|
|
4837
4838
|
};
|
|
4838
|
-
if (
|
|
4839
|
-
throw new Error('OverflowBehavior - all
|
|
4839
|
+
if (this.parentElement === null || this.itemMoreElement === null || this.itemMoreContainerElement === null) {
|
|
4840
|
+
throw new Error('OverflowBehavior - all constructor params are required');
|
|
4840
4841
|
}
|
|
4841
4842
|
const items = Array.from(this.parentElement.children);
|
|
4842
4843
|
this._resizeObserver = new ResizeObserver(entries => {
|
|
@@ -4849,7 +4850,7 @@ class OverflowBehavior {
|
|
|
4849
4850
|
let accWidth = 0;
|
|
4850
4851
|
items.forEach((item, index) => {
|
|
4851
4852
|
accWidth += item.offsetWidth;
|
|
4852
|
-
if (index)
|
|
4853
|
+
if (index > 0)
|
|
4853
4854
|
this.toggleItem(item, this.isOverflowElement(accWidth, item));
|
|
4854
4855
|
});
|
|
4855
4856
|
});
|
|
@@ -4877,17 +4878,17 @@ const MgItemMore = class {
|
|
|
4877
4878
|
}
|
|
4878
4879
|
validateIcon(newValue) {
|
|
4879
4880
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
|
|
4880
|
-
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${
|
|
4881
|
+
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${Gt(newValue)}.`);
|
|
4881
4882
|
}
|
|
4882
4883
|
validateSlotLabel(newValue) {
|
|
4883
4884
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
|
|
4884
|
-
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${
|
|
4885
|
+
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${Gt(newValue)}.`);
|
|
4885
4886
|
else if (typeof newValue.label !== 'string')
|
|
4886
4887
|
this.slotlabel.label = this.messages.menuLabel;
|
|
4887
4888
|
}
|
|
4888
4889
|
validateSize(newValue) {
|
|
4889
4890
|
if (newValue && !sizes$5.includes(newValue))
|
|
4890
|
-
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${
|
|
4891
|
+
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${Gt(newValue)}.`);
|
|
4891
4892
|
}
|
|
4892
4893
|
/*************
|
|
4893
4894
|
* Lifecycle *
|
|
@@ -4981,7 +4982,7 @@ const MgMenu = class {
|
|
|
4981
4982
|
var _a, _b;
|
|
4982
4983
|
const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
4983
4984
|
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');
|
|
4984
|
-
if (itemMoreMenuItem) {
|
|
4985
|
+
if (itemMoreMenuItem !== null && itemMoreMenuItem !== undefined) {
|
|
4985
4986
|
menuItems.push(itemMoreMenuItem);
|
|
4986
4987
|
}
|
|
4987
4988
|
return menuItems;
|
|
@@ -5020,12 +5021,12 @@ const MgMenu = class {
|
|
|
5020
5021
|
}
|
|
5021
5022
|
validateLabel(newValue) {
|
|
5022
5023
|
if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
|
|
5023
|
-
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${
|
|
5024
|
+
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${Gt(newValue)}.`);
|
|
5024
5025
|
}
|
|
5025
5026
|
}
|
|
5026
5027
|
validateDirection(newValue) {
|
|
5027
5028
|
if (![directions$1.VERTICAL, directions$1.HORIZONTAL].includes(newValue)) {
|
|
5028
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${directions$1.HORIZONTAL}, ${directions$1.VERTICAL}. Passed value: ${
|
|
5029
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${directions$1.HORIZONTAL}, ${directions$1.VERTICAL}. Passed value: ${Gt(newValue)}.`);
|
|
5029
5030
|
}
|
|
5030
5031
|
else {
|
|
5031
5032
|
this.updateMenuItems();
|
|
@@ -5041,7 +5042,7 @@ const MgMenu = class {
|
|
|
5041
5042
|
}
|
|
5042
5043
|
validateSize(newValue) {
|
|
5043
5044
|
if (!sizes$5.includes(newValue)) {
|
|
5044
|
-
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$5.join(', ')}. Passed value: ${
|
|
5045
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$5.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
5045
5046
|
}
|
|
5046
5047
|
}
|
|
5047
5048
|
/**
|
|
@@ -5109,7 +5110,7 @@ const MgMenu = class {
|
|
|
5109
5110
|
* @returns HTML Element
|
|
5110
5111
|
*/
|
|
5111
5112
|
render() {
|
|
5112
|
-
return (h(Host, { key: '
|
|
5113
|
+
return (h(Host, { key: '027cd6b867d852c1d238ffedd9ea9c8d40eb82f0', role: "list", "aria-label": this.label }, h("slot", { key: 'cb6dfa4a26800f3dd3fc820954a45aad025cc4a3' })));
|
|
5113
5114
|
}
|
|
5114
5115
|
get element() { return getElement(this); }
|
|
5115
5116
|
static get watchers() { return {
|
|
@@ -5139,7 +5140,7 @@ const MgMenuItem = class {
|
|
|
5139
5140
|
/**
|
|
5140
5141
|
* Identifier is used to control mg-popover
|
|
5141
5142
|
*/
|
|
5142
|
-
this.identifier =
|
|
5143
|
+
this.identifier = Pt('mg-menu-item');
|
|
5143
5144
|
/**
|
|
5144
5145
|
* Define menu-item status.
|
|
5145
5146
|
*/
|
|
@@ -5158,7 +5159,7 @@ const MgMenuItem = class {
|
|
|
5158
5159
|
/**
|
|
5159
5160
|
* Component button classes
|
|
5160
5161
|
*/
|
|
5161
|
-
this.navigationButtonClassList = new
|
|
5162
|
+
this.navigationButtonClassList = new Zt([this.navigationButton]);
|
|
5162
5163
|
/**
|
|
5163
5164
|
* Does component have children.
|
|
5164
5165
|
*/
|
|
@@ -5197,7 +5198,7 @@ const MgMenuItem = class {
|
|
|
5197
5198
|
* Is component an interactive item
|
|
5198
5199
|
* @returns truthy if element is clickable
|
|
5199
5200
|
*/
|
|
5200
|
-
this.isInteractiveItem = () => this.hasChildren || !
|
|
5201
|
+
this.isInteractiveItem = () => this.hasChildren || !De(this.href);
|
|
5201
5202
|
/**
|
|
5202
5203
|
* Is component contextual direction match the given direction
|
|
5203
5204
|
* @param direction - in parent menu
|
|
@@ -5250,7 +5251,7 @@ const MgMenuItem = class {
|
|
|
5250
5251
|
}
|
|
5251
5252
|
['label', 'metadata'].forEach(slot => {
|
|
5252
5253
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
5253
|
-
if (!
|
|
5254
|
+
if (!De(element.textContent))
|
|
5254
5255
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
5255
5256
|
if ((guard && !element.hasAttribute('title')) || !guard)
|
|
5256
5257
|
element.setAttribute('title', element.textContent);
|
|
@@ -5291,7 +5292,7 @@ const MgMenuItem = class {
|
|
|
5291
5292
|
// when item is the last clickable item we close the parent popover
|
|
5292
5293
|
if (!this.isInteractiveItem()) {
|
|
5293
5294
|
const closePopover = (element) => {
|
|
5294
|
-
if (
|
|
5295
|
+
if (element === null)
|
|
5295
5296
|
return;
|
|
5296
5297
|
else if (element !== this.element && element.expanded && element.shadowRoot.querySelector('mg-popover') !== null) {
|
|
5297
5298
|
element.expanded = false;
|
|
@@ -5317,8 +5318,8 @@ const MgMenuItem = class {
|
|
|
5317
5318
|
this.renderSlot = () => h("slot", null);
|
|
5318
5319
|
}
|
|
5319
5320
|
watchIdentifier(newValue) {
|
|
5320
|
-
if (!
|
|
5321
|
-
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${
|
|
5321
|
+
if (!Ut(newValue)) {
|
|
5322
|
+
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
5322
5323
|
}
|
|
5323
5324
|
else {
|
|
5324
5325
|
this.popoverIdentifier = `${this.identifier}-popover`;
|
|
@@ -5326,7 +5327,7 @@ const MgMenuItem = class {
|
|
|
5326
5327
|
}
|
|
5327
5328
|
watchTarget(newValue) {
|
|
5328
5329
|
if (newValue && !targets.includes(newValue)) {
|
|
5329
|
-
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${
|
|
5330
|
+
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
5330
5331
|
}
|
|
5331
5332
|
}
|
|
5332
5333
|
watchStatus(newValue, oldValue) {
|
|
@@ -5336,7 +5337,7 @@ const MgMenuItem = class {
|
|
|
5336
5337
|
}
|
|
5337
5338
|
watchExpanded(newValue) {
|
|
5338
5339
|
if (typeof newValue !== 'boolean') {
|
|
5339
|
-
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${
|
|
5340
|
+
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${Gt(newValue)}.`);
|
|
5340
5341
|
}
|
|
5341
5342
|
else {
|
|
5342
5343
|
this.updateExpanded(newValue);
|
|
@@ -5385,7 +5386,7 @@ const MgMenuItem = class {
|
|
|
5385
5386
|
*/
|
|
5386
5387
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
5387
5388
|
watchDataHasFocus(newValue) {
|
|
5388
|
-
if (!newValue)
|
|
5389
|
+
if (!De(newValue))
|
|
5389
5390
|
this.updateExpanded(Boolean(newValue));
|
|
5390
5391
|
}
|
|
5391
5392
|
/**
|
|
@@ -5451,7 +5452,7 @@ const MgMenuItem = class {
|
|
|
5451
5452
|
* @returns promise process wich emit the 'item-updated' event
|
|
5452
5453
|
*/
|
|
5453
5454
|
componentShouldUpdate() {
|
|
5454
|
-
return
|
|
5455
|
+
return Xt(() => {
|
|
5455
5456
|
this.itemUpdated.emit();
|
|
5456
5457
|
});
|
|
5457
5458
|
}
|
|
@@ -5478,7 +5479,7 @@ const MgMenuItem = class {
|
|
|
5478
5479
|
['mg-c-menu-item__collapse-container']: true,
|
|
5479
5480
|
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu() || this.isItemMore) && this.isDirection(directions$1.HORIZONTAL),
|
|
5480
5481
|
});
|
|
5481
|
-
return (h(Host, { key: '
|
|
5482
|
+
return (h(Host, { key: 'caeeabd1d1c9f7de3c8ecda6a315b85215b9e656', role: this.isItemMore ? 'presentation' : 'listitem' }, this.hasPopover() ? (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
|
|
5482
5483
|
}, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
5483
5484
|
this.renderInteractiveElement(),
|
|
5484
5485
|
h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
@@ -5528,7 +5529,7 @@ const MgMessage = class {
|
|
|
5528
5529
|
/**
|
|
5529
5530
|
* Component classes
|
|
5530
5531
|
*/
|
|
5531
|
-
this.classCollection = new
|
|
5532
|
+
this.classCollection = new Zt(['mg-c-message']);
|
|
5532
5533
|
/**
|
|
5533
5534
|
* Define if component is using actions slot
|
|
5534
5535
|
*/
|
|
@@ -5552,7 +5553,7 @@ const MgMessage = class {
|
|
|
5552
5553
|
}
|
|
5553
5554
|
watchVariant(newValue, oldValue) {
|
|
5554
5555
|
if (!variants$1.includes(newValue)) {
|
|
5555
|
-
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${
|
|
5556
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
5556
5557
|
}
|
|
5557
5558
|
else {
|
|
5558
5559
|
if (newValue !== undefined)
|
|
@@ -5563,7 +5564,7 @@ const MgMessage = class {
|
|
|
5563
5564
|
}
|
|
5564
5565
|
watchVariantStyle(newValue, oldValue) {
|
|
5565
5566
|
if (!variantStyles.includes(newValue)) {
|
|
5566
|
-
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${
|
|
5567
|
+
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
5567
5568
|
}
|
|
5568
5569
|
else {
|
|
5569
5570
|
if (newValue !== undefined)
|
|
@@ -5590,9 +5591,9 @@ const MgMessage = class {
|
|
|
5590
5591
|
* @returns HTML Element
|
|
5591
5592
|
*/
|
|
5592
5593
|
render() {
|
|
5593
|
-
return (h("div", { key: '
|
|
5594
|
+
return (h("div", { key: '851d97fde6f05799e1420f8825fcff986d9af1d6', class: this.classCollection.join() }, h("mg-card", { key: '40f85f1fb3240ab709b1ab46286e9a953f2d5dc8' }, this.variantStyle === 'bar-left' && h("span", { key: '50b078ec379c7774d2f409c64b56108041bf3053', class: "mg-c-message__bar" }), h("span", { key: 'bc6b1019e1103fc8cd5e4e92f95b62374207be2b', class: "mg-c-message__icon" }, h("mg-icon", { key: 'e461ddc1eb1ddcb7ecc673f59dc59f400efbe916', icon: this.getIcon() })), h("div", { key: 'edf836b375d7f1fd413b53711b99acbe2bef3e92', class: "mg-c-message__content" }, h("span", { key: 'c6ce4628e450b7e89ef3715126b3a2dee081224e', class: "mg-c-message__content-slot" }, h("slot", { key: '36ecf7417e61ab84695078e2fd4ebe829bd769a7' })), this.hasActions && [
|
|
5594
5595
|
h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
|
|
5595
|
-
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '
|
|
5596
|
+
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '43be5769165cac1ab702b2ba80fb885c2ec1834f', name: "actions" })),
|
|
5596
5597
|
]))));
|
|
5597
5598
|
}
|
|
5598
5599
|
get element() { return getElement(this); }
|
|
@@ -5622,7 +5623,7 @@ const MgModal = class {
|
|
|
5622
5623
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
5623
5624
|
* If not set, it will be created.
|
|
5624
5625
|
*/
|
|
5625
|
-
this.identifier =
|
|
5626
|
+
this.identifier = Pt('mg-modal');
|
|
5626
5627
|
/**
|
|
5627
5628
|
* Modal dialog role.
|
|
5628
5629
|
*/
|
|
@@ -5642,7 +5643,7 @@ const MgModal = class {
|
|
|
5642
5643
|
/**
|
|
5643
5644
|
* Component classes
|
|
5644
5645
|
*/
|
|
5645
|
-
this.classCollection = new
|
|
5646
|
+
this.classCollection = new Zt(['mg-c-modal']);
|
|
5646
5647
|
/***********
|
|
5647
5648
|
* Handles *
|
|
5648
5649
|
***********/
|
|
@@ -5655,17 +5656,17 @@ const MgModal = class {
|
|
|
5655
5656
|
};
|
|
5656
5657
|
}
|
|
5657
5658
|
watchIdentifier(newValue) {
|
|
5658
|
-
if (!
|
|
5659
|
-
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${
|
|
5659
|
+
if (!Ut(newValue)) {
|
|
5660
|
+
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
5660
5661
|
}
|
|
5661
5662
|
}
|
|
5662
5663
|
validateDialogRole(newValue) {
|
|
5663
5664
|
if (!dialogRoles.includes(newValue))
|
|
5664
|
-
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${
|
|
5665
|
+
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
5665
5666
|
}
|
|
5666
5667
|
validateModalTitle(newValue) {
|
|
5667
|
-
if (!
|
|
5668
|
-
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${
|
|
5668
|
+
if (!De(newValue)) {
|
|
5669
|
+
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${Gt(newValue)}.`);
|
|
5669
5670
|
}
|
|
5670
5671
|
}
|
|
5671
5672
|
watchOpen(newValue) {
|
|
@@ -5714,11 +5715,11 @@ const MgModal = class {
|
|
|
5714
5715
|
* @returns HTML Element
|
|
5715
5716
|
*/
|
|
5716
5717
|
render() {
|
|
5717
|
-
return (h("dialog", { key: '
|
|
5718
|
+
return (h("dialog", { key: '4b7346b707b895a8a110bb7553f0db32d1c5778c', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
5718
5719
|
if (el !== null) {
|
|
5719
5720
|
this.dialog = el;
|
|
5720
5721
|
}
|
|
5721
|
-
} }, h("mg-card", { key: '
|
|
5722
|
+
} }, h("mg-card", { key: '2aaabab2e1be14013bcae66d100ac56c1a9bbf4d' }, h("div", { key: '56a03d6cbda094d7ae4444ca3fab924982f73e2a', class: "mg-c-modal__dialog" }, h("header", { key: 'e7eb70e614a9e6c6b3f14f9e165bf801b780b031', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: 'c57ccc8f049893c5e46d769b527cc2e2c5ff14c0', class: "mg-c-modal__close-button" }, h("mg-button", { key: 'b1b4357af8c875aab9f1104895de3cc228d12feb', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: 'cfe5fba2577ece682368332d3836cf709bb1b0e1', icon: "cross" })))), h("h1", { key: '718527902ea4814d55bf4d1c89d111a965233f0a', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: '78603fdb8fffa93e5caa6cf0ece9c6dbdbdfefde', class: "mg-c-modal__content" }, h("slot", { key: '1cd5a0415e53cb836428f8b9c4fc02dac11447a9' })), this.hasActions && (h("footer", { key: 'da72e5c2f43308d0f94d4e2eb36e317a13b5b16e', class: "mg-c-modal__footer" }, h("slot", { key: '49467ef13123cb4f4e2b315d293379d857ca3245', name: "actions" })))))));
|
|
5722
5723
|
}
|
|
5723
5724
|
get element() { return getElement(this); }
|
|
5724
5725
|
static get watchers() { return {
|
|
@@ -5767,7 +5768,7 @@ const MgPagination = class {
|
|
|
5767
5768
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
5768
5769
|
* If not set, it will be created.
|
|
5769
5770
|
*/
|
|
5770
|
-
this.identifier =
|
|
5771
|
+
this.identifier = Pt('mg-pagination');
|
|
5771
5772
|
/**
|
|
5772
5773
|
* Hide navigation label
|
|
5773
5774
|
*/
|
|
@@ -5812,18 +5813,18 @@ const MgPagination = class {
|
|
|
5812
5813
|
};
|
|
5813
5814
|
}
|
|
5814
5815
|
watchIdentifier(newValue) {
|
|
5815
|
-
if (!
|
|
5816
|
-
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${
|
|
5816
|
+
if (!Ut(newValue)) {
|
|
5817
|
+
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
5817
5818
|
}
|
|
5818
5819
|
}
|
|
5819
5820
|
validateTotalPages(newValue) {
|
|
5820
5821
|
if (newValue < 1) {
|
|
5821
|
-
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${
|
|
5822
|
+
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${Gt(newValue)}.`);
|
|
5822
5823
|
}
|
|
5823
5824
|
}
|
|
5824
5825
|
validateCurrentPage(newValue) {
|
|
5825
5826
|
if (newValue < 1) {
|
|
5826
|
-
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${
|
|
5827
|
+
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${Gt(newValue)}.`);
|
|
5827
5828
|
}
|
|
5828
5829
|
else if (newValue > this.totalPages) {
|
|
5829
5830
|
throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
|
|
@@ -5853,10 +5854,10 @@ const MgPagination = class {
|
|
|
5853
5854
|
* @returns HTML Element
|
|
5854
5855
|
*/
|
|
5855
5856
|
render() {
|
|
5856
|
-
const navigationActionButton = (disabled, action) => (h("mg-button", { key: '
|
|
5857
|
+
const navigationActionButton = (disabled, action) => (h("mg-button", { key: 'b6983bde889955b35b1e580ffd5ece96a2919eca', label: this.messages.pagination[`${action}Page`],
|
|
5857
5858
|
// eslint-disable-next-line react/jsx-no-bind
|
|
5858
|
-
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { key: '
|
|
5859
|
-
return (h(Host, { key: '
|
|
5859
|
+
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { key: '64316742287d7cb9adf0c4bb3cb902a3c1cea6b5', icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { key: '2c405c1530509f3e6938e7c1d754b7aff216a6f7', icon: "chevron-right" })));
|
|
5860
|
+
return (h(Host, { key: 'a341519e24868b594c1bb91c12549c0338fc0f49', hidden: this.totalPages < 2 }, 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 && (h("div", { key: '32498b13867e363f6f51ffbaff6f18623cbd698d', class: "mg-c-pagination__page-count" }, 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 }), 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))));
|
|
5860
5861
|
}
|
|
5861
5862
|
get element() { return getElement(this); }
|
|
5862
5863
|
static get watchers() { return {
|
|
@@ -5887,7 +5888,7 @@ const MgPanel = class {
|
|
|
5887
5888
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
5888
5889
|
* If not set, it will be created.
|
|
5889
5890
|
*/
|
|
5890
|
-
this.identifier =
|
|
5891
|
+
this.identifier = Pt('mg-panel');
|
|
5891
5892
|
/**
|
|
5892
5893
|
* Define if panel title is editable
|
|
5893
5894
|
*/
|
|
@@ -5911,7 +5912,7 @@ const MgPanel = class {
|
|
|
5911
5912
|
/**
|
|
5912
5913
|
* Component classes
|
|
5913
5914
|
*/
|
|
5914
|
-
this.classCollection = new
|
|
5915
|
+
this.classCollection = new Zt(['mg-c-panel']);
|
|
5915
5916
|
/**
|
|
5916
5917
|
* Title is in edition mode
|
|
5917
5918
|
*/
|
|
@@ -6010,13 +6011,13 @@ const MgPanel = class {
|
|
|
6010
6011
|
};
|
|
6011
6012
|
}
|
|
6012
6013
|
watchIdentifier(newValue) {
|
|
6013
|
-
if (!
|
|
6014
|
-
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${
|
|
6014
|
+
if (!Ut(newValue)) {
|
|
6015
|
+
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
6015
6016
|
}
|
|
6016
6017
|
}
|
|
6017
6018
|
validatePanelTitle(newValue) {
|
|
6018
|
-
if (!
|
|
6019
|
-
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${
|
|
6019
|
+
if (!De(newValue))
|
|
6020
|
+
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${Gt(newValue)}.`);
|
|
6020
6021
|
this.titleChange.emit(newValue);
|
|
6021
6022
|
}
|
|
6022
6023
|
validateTitlePattern(newValue) {
|
|
@@ -6025,14 +6026,14 @@ const MgPanel = class {
|
|
|
6025
6026
|
}
|
|
6026
6027
|
validateTitlePosition(newValue) {
|
|
6027
6028
|
if (!titlePositions.includes(newValue))
|
|
6028
|
-
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${
|
|
6029
|
+
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
6029
6030
|
}
|
|
6030
6031
|
handleExpanded(newValue) {
|
|
6031
6032
|
this.expandedChange.emit(newValue);
|
|
6032
6033
|
}
|
|
6033
6034
|
validateExpandToggleDisplay(newValue) {
|
|
6034
6035
|
if (!expandToggleDisplays.includes(newValue))
|
|
6035
|
-
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${
|
|
6036
|
+
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
6036
6037
|
if (newValue === 'icon' && this.titleEditable)
|
|
6037
6038
|
this.titleEditable = false;
|
|
6038
6039
|
}
|
|
@@ -6067,7 +6068,7 @@ const MgPanel = class {
|
|
|
6067
6068
|
*/
|
|
6068
6069
|
render() {
|
|
6069
6070
|
const headerId = `${this.identifier}-header`;
|
|
6070
|
-
return (h("section", { key: '
|
|
6071
|
+
return (h("section", { key: '73b9b1ab03307718bc7085799675da7447787c73', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '91702feab4cde0548c276f3d32fa193ff1093cae' }, h("header", { key: '442a17d42f86e73648ffa33124a1745fef3b07e3', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: '0df72fb9e53f0a8307c062d506e8c744fd6780f3', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '44fa7501182e1c671d229929ebc12031c3048fdb' })))));
|
|
6071
6072
|
}
|
|
6072
6073
|
get element() { return getElement(this); }
|
|
6073
6074
|
static get watchers() { return {
|
|
@@ -7746,14 +7747,58 @@ const placements = [
|
|
|
7746
7747
|
'left-start',
|
|
7747
7748
|
'left-end',
|
|
7748
7749
|
];
|
|
7750
|
+
// Alignments constants
|
|
7751
|
+
const alignments = ['start', null, 'end'];
|
|
7749
7752
|
/**
|
|
7750
7753
|
* FloatingUI Placement type guard
|
|
7751
7754
|
* @param placement - value to check
|
|
7752
7755
|
* @returns truthy if placement is valid
|
|
7753
7756
|
*/
|
|
7754
7757
|
const isFloatingUIPlacement = (placement) => placements.filter(p => !p.includes('auto')).includes(placement);
|
|
7755
|
-
|
|
7756
|
-
|
|
7758
|
+
/**
|
|
7759
|
+
* Round value by device pixel ratio
|
|
7760
|
+
* @param value - value to round
|
|
7761
|
+
* @returns rounded value
|
|
7762
|
+
*/
|
|
7763
|
+
const roundByDPR = (value) => {
|
|
7764
|
+
const dpr = window.devicePixelRatio || 1;
|
|
7765
|
+
return Math.round(value * dpr) / dpr;
|
|
7766
|
+
};
|
|
7767
|
+
/**
|
|
7768
|
+
* Get translation for tooltip
|
|
7769
|
+
* @param x - x-axis value
|
|
7770
|
+
* @param y - y-axis value
|
|
7771
|
+
* @returns translation string
|
|
7772
|
+
*/
|
|
7773
|
+
const getTransformation = (x, y) => {
|
|
7774
|
+
const tooltipX = isNaN(x) ? 0 : roundByDPR(x);
|
|
7775
|
+
const tooltipY = isNaN(y) ? 0 : roundByDPR(y);
|
|
7776
|
+
// No translation needed
|
|
7777
|
+
if (tooltipX === 0 && tooltipY === 0)
|
|
7778
|
+
return '';
|
|
7779
|
+
// Only one axis needs translation
|
|
7780
|
+
if (tooltipX === 0)
|
|
7781
|
+
return `translateY(${tooltipY}px)`;
|
|
7782
|
+
if (tooltipY === 0)
|
|
7783
|
+
return `translateX(${tooltipX}px)`;
|
|
7784
|
+
// Both axes need translation
|
|
7785
|
+
return `translate(${tooltipX}px,${tooltipY}px)`;
|
|
7786
|
+
};
|
|
7787
|
+
// https://floating-ui.com/docs/arrow
|
|
7788
|
+
// Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.
|
|
7789
|
+
// Due to this, either x or y will be undefined, depending on the side of placement.
|
|
7790
|
+
// The above code uses `isNaN` to check for null and undefined simultaneously.
|
|
7791
|
+
// Don't remove `isNaN`, because either value can be falsy (0), causing a bug!
|
|
7792
|
+
const numberToPx = (number) => {
|
|
7793
|
+
if (number !== null && !isNaN(number)) {
|
|
7794
|
+
if (number === 0)
|
|
7795
|
+
return '0';
|
|
7796
|
+
else
|
|
7797
|
+
return `${number}px`;
|
|
7798
|
+
}
|
|
7799
|
+
else
|
|
7800
|
+
return '';
|
|
7801
|
+
};
|
|
7757
7802
|
|
|
7758
7803
|
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}";
|
|
7759
7804
|
|
|
@@ -7766,7 +7811,7 @@ const MgPopover = class {
|
|
|
7766
7811
|
* Sets an `id` attribute.
|
|
7767
7812
|
* Needed by the input for accessibility `aria-decribedby`.
|
|
7768
7813
|
*/
|
|
7769
|
-
this.identifier =
|
|
7814
|
+
this.identifier = Pt('mg-popover');
|
|
7770
7815
|
/**
|
|
7771
7816
|
* Popover placement
|
|
7772
7817
|
*/
|
|
@@ -7796,16 +7841,6 @@ const MgPopover = class {
|
|
|
7796
7841
|
this.display = false;
|
|
7797
7842
|
}
|
|
7798
7843
|
};
|
|
7799
|
-
/**
|
|
7800
|
-
* Update aria-expanded attribute on interactive element
|
|
7801
|
-
* @param expanded - expanded state
|
|
7802
|
-
*/
|
|
7803
|
-
this.updateAriaExpanded = (expanded) => {
|
|
7804
|
-
const interactiveElement = this.element.querySelector(':not([slot])');
|
|
7805
|
-
if (interactiveElement !== null) {
|
|
7806
|
-
interactiveElement.setAttribute('aria-expanded', String(expanded));
|
|
7807
|
-
}
|
|
7808
|
-
};
|
|
7809
7844
|
/**
|
|
7810
7845
|
* Show popover
|
|
7811
7846
|
*/
|
|
@@ -7813,12 +7848,13 @@ const MgPopover = class {
|
|
|
7813
7848
|
// Make the popover visible
|
|
7814
7849
|
this.mgPopover.dataset.show = '';
|
|
7815
7850
|
// Update aria-expanded
|
|
7816
|
-
this.
|
|
7851
|
+
this.interactiveElement.setAttribute('aria-expanded', 'true');
|
|
7817
7852
|
// hide when click outside
|
|
7818
7853
|
// setTimeout is used to prevent event to trigger after creation
|
|
7819
7854
|
setTimeout(() => {
|
|
7820
7855
|
this.manageClickOutsideListeners('addEventListener');
|
|
7821
7856
|
});
|
|
7857
|
+
this.updatePopover();
|
|
7822
7858
|
};
|
|
7823
7859
|
/**
|
|
7824
7860
|
* Hide popover
|
|
@@ -7827,7 +7863,7 @@ const MgPopover = class {
|
|
|
7827
7863
|
// Hide the popover
|
|
7828
7864
|
this.mgPopover.removeAttribute('data-show');
|
|
7829
7865
|
// Update aria-expanded
|
|
7830
|
-
this.
|
|
7866
|
+
this.interactiveElement.setAttribute('aria-expanded', 'false');
|
|
7831
7867
|
// Remove event listener
|
|
7832
7868
|
this.manageClickOutsideListeners('removeEventListener');
|
|
7833
7869
|
};
|
|
@@ -7906,63 +7942,50 @@ const MgPopover = class {
|
|
|
7906
7942
|
return Array.from(new Set([...currentSidePlacements, ...sides.filter(otherSide => otherSide !== side)])).filter(isFloatingUIPlacement);
|
|
7907
7943
|
};
|
|
7908
7944
|
/**
|
|
7909
|
-
*
|
|
7910
|
-
* @
|
|
7911
|
-
*/
|
|
7912
|
-
this.
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
],
|
|
7929
|
-
}).then(({ x, y, placement, middlewareData }) => {
|
|
7930
|
-
Object.assign(this.mgPopover.style, {
|
|
7931
|
-
position: 'fixed',
|
|
7932
|
-
top: '0',
|
|
7933
|
-
left: '0',
|
|
7934
|
-
transform: `translate(${Math.round(x)}px, ${Math.round(y)}px)`,
|
|
7935
|
-
});
|
|
7936
|
-
// Update arrow style
|
|
7937
|
-
const staticSide = {
|
|
7938
|
-
top: 'bottom',
|
|
7939
|
-
right: 'left',
|
|
7940
|
-
bottom: 'top',
|
|
7941
|
-
left: 'right',
|
|
7942
|
-
}[placement.split('-')[0]];
|
|
7943
|
-
const arrowElement = this.mgPopover.querySelector('[data-floating-arrow]');
|
|
7944
|
-
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
7945
|
-
// https://floating-ui.com/docs/arrow
|
|
7946
|
-
// Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.
|
|
7947
|
-
// Due to this, either x or y will be undefined, depending on the side of placement.
|
|
7948
|
-
// The above code uses `isNaN` to check for null and undefined simultaneously.
|
|
7949
|
-
// Don't remove `isNaN`, because either value can be falsy (0), causing a bug!
|
|
7950
|
-
const numberToPx = (number) => (!isNaN(number) ? `${number}px` : '');
|
|
7951
|
-
if (arrowElement !== null)
|
|
7952
|
-
Object.assign(arrowElement.style, {
|
|
7953
|
-
position: 'absolute',
|
|
7954
|
-
left: numberToPx(arrowX),
|
|
7955
|
-
top: numberToPx(arrowY),
|
|
7956
|
-
[staticSide]: '1px',
|
|
7957
|
-
});
|
|
7958
|
-
this.mgPopover.setAttribute('data-placement', placement);
|
|
7959
|
-
});
|
|
7945
|
+
* Update popover position
|
|
7946
|
+
* @returns autoUpdate function
|
|
7947
|
+
*/
|
|
7948
|
+
this.updatePopover = () => autoUpdate(this.interactiveElement, this.mgPopover, async () => {
|
|
7949
|
+
const { x, y, placement, middlewareData } = await computePosition(this.interactiveElement, this.mgPopover, {
|
|
7950
|
+
placement: this.placement,
|
|
7951
|
+
strategy: 'fixed',
|
|
7952
|
+
middleware: [
|
|
7953
|
+
offset(0),
|
|
7954
|
+
flip({
|
|
7955
|
+
fallbackPlacements: this.getClosestPlacements(this.placement),
|
|
7956
|
+
}),
|
|
7957
|
+
shift({
|
|
7958
|
+
limiter: limitShift(),
|
|
7959
|
+
}),
|
|
7960
|
+
arrow({
|
|
7961
|
+
element: this.arrowElement,
|
|
7962
|
+
}),
|
|
7963
|
+
],
|
|
7960
7964
|
});
|
|
7961
|
-
|
|
7965
|
+
Object.assign(this.mgPopover.style, {
|
|
7966
|
+
transform: getTransformation(x, y),
|
|
7967
|
+
});
|
|
7968
|
+
// Arrow positioning
|
|
7969
|
+
if (this.arrowElement !== null) {
|
|
7970
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
7971
|
+
const staticSide = {
|
|
7972
|
+
top: 'bottom',
|
|
7973
|
+
right: 'left',
|
|
7974
|
+
bottom: 'top',
|
|
7975
|
+
left: 'right',
|
|
7976
|
+
}[placement.split('-')[0]];
|
|
7977
|
+
Object.assign(this.arrowElement.style, {
|
|
7978
|
+
left: numberToPx(arrowX),
|
|
7979
|
+
top: numberToPx(arrowY),
|
|
7980
|
+
[staticSide]: '1px',
|
|
7981
|
+
});
|
|
7982
|
+
this.mgPopover.setAttribute('data-placement', placement);
|
|
7983
|
+
}
|
|
7984
|
+
});
|
|
7962
7985
|
}
|
|
7963
7986
|
validateIdentifier(newValue) {
|
|
7964
|
-
if (!
|
|
7965
|
-
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${
|
|
7987
|
+
if (!Ut(newValue)) {
|
|
7988
|
+
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
7966
7989
|
}
|
|
7967
7990
|
// use renderPopoverContent to update popover-content id
|
|
7968
7991
|
this.renderPopoverContent();
|
|
@@ -7996,14 +8019,14 @@ const MgPopover = class {
|
|
|
7996
8019
|
* update popper position after props change on component did update hook to benefit from render ended
|
|
7997
8020
|
*/
|
|
7998
8021
|
componentDidUpdate() {
|
|
7999
|
-
this.
|
|
8022
|
+
this.updatePopover();
|
|
8000
8023
|
}
|
|
8001
8024
|
/**
|
|
8002
8025
|
* Check if component props are well configured on init
|
|
8003
8026
|
*/
|
|
8004
8027
|
componentWillLoad() {
|
|
8005
8028
|
// Get windows to attach events
|
|
8006
|
-
this.windows =
|
|
8029
|
+
this.windows = Bt(window);
|
|
8007
8030
|
// render mg-popover-content slot
|
|
8008
8031
|
this.renderPopoverContent();
|
|
8009
8032
|
this.validateCloseButton(this.closeButton);
|
|
@@ -8017,26 +8040,21 @@ const MgPopover = class {
|
|
|
8017
8040
|
componentDidLoad() {
|
|
8018
8041
|
// Get popover content
|
|
8019
8042
|
this.mgPopover = this.element.querySelector(`#${this.identifier}`);
|
|
8043
|
+
// Get arrow element
|
|
8044
|
+
this.arrowElement = this.mgPopover.querySelector('[data-floating-arrow]');
|
|
8020
8045
|
// Get interactive element (first element without slot attribute)
|
|
8021
|
-
|
|
8046
|
+
this.interactiveElement = this.element.querySelector(':not([slot])');
|
|
8022
8047
|
// Add aria attributes
|
|
8023
|
-
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
8024
|
-
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
8025
|
-
// Initial styles configuration
|
|
8026
|
-
Object.assign(this.mgPopover.style, {
|
|
8027
|
-
position: 'fixed',
|
|
8028
|
-
});
|
|
8029
|
-
// Create Floating UI instance
|
|
8030
|
-
this.setFloatingUI(interactiveElement);
|
|
8048
|
+
this.interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
8049
|
+
this.interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
8031
8050
|
// Add resize observer
|
|
8032
|
-
[interactiveElement, this.mgPopoverContent].forEach(element => {
|
|
8051
|
+
[this.interactiveElement, this.mgPopoverContent].forEach(element => {
|
|
8033
8052
|
new ResizeObserver(() => {
|
|
8034
|
-
this.
|
|
8035
|
-
this.setFloatingUI(interactiveElement);
|
|
8053
|
+
this.updatePopover();
|
|
8036
8054
|
}).observe(element);
|
|
8037
8055
|
});
|
|
8038
8056
|
// Add events to toggle display
|
|
8039
|
-
interactiveElement.addEventListener('click', () => {
|
|
8057
|
+
this.interactiveElement.addEventListener('click', () => {
|
|
8040
8058
|
if (!this.disabled)
|
|
8041
8059
|
this.display = !this.display;
|
|
8042
8060
|
});
|
|
@@ -8051,7 +8069,7 @@ const MgPopover = class {
|
|
|
8051
8069
|
if (!this.disabled && e.code === 'Escape') {
|
|
8052
8070
|
this.display = false;
|
|
8053
8071
|
this.componentClose.emit();
|
|
8054
|
-
interactiveElement.focus();
|
|
8072
|
+
this.interactiveElement.focus();
|
|
8055
8073
|
}
|
|
8056
8074
|
});
|
|
8057
8075
|
this.handleDisplay(this.display);
|
|
@@ -8060,15 +8078,16 @@ const MgPopover = class {
|
|
|
8060
8078
|
* Cleanup when component is disconnected
|
|
8061
8079
|
*/
|
|
8062
8080
|
disconnectedCallback() {
|
|
8081
|
+
var _a;
|
|
8063
8082
|
// Cleanup Floating UI instance
|
|
8064
|
-
this.
|
|
8083
|
+
(_a = this.updatePopover) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
8065
8084
|
}
|
|
8066
8085
|
/**
|
|
8067
8086
|
* Render
|
|
8068
8087
|
* @returns HTML Element
|
|
8069
8088
|
*/
|
|
8070
8089
|
render() {
|
|
8071
|
-
return (h(Host, { key: '
|
|
8090
|
+
return (h(Host, { key: '26244db5e6a35b731b5220c06b77ad1f14378245' }, h("slot", { key: '92ca05ac9637cf9634d86b177393fd6d0e6c6796' }), h("slot", { key: 'bdc8f8a8b4f2c891e473cdac5a305c3f1ab615b0', name: "content" })));
|
|
8072
8091
|
}
|
|
8073
8092
|
get element() { return getElement(this); }
|
|
8074
8093
|
static get watchers() { return {
|
|
@@ -8081,7 +8100,7 @@ const MgPopover = class {
|
|
|
8081
8100
|
};
|
|
8082
8101
|
MgPopover.style = mgPopoverCss;
|
|
8083
8102
|
|
|
8084
|
-
const mgPopoverContentCss = ":host{position:
|
|
8103
|
+
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)}";
|
|
8085
8104
|
|
|
8086
8105
|
const MgPopoverContent = class {
|
|
8087
8106
|
constructor(hostRef) {
|
|
@@ -8094,7 +8113,7 @@ const MgPopoverContent = class {
|
|
|
8094
8113
|
/**
|
|
8095
8114
|
* Component classes
|
|
8096
8115
|
*/
|
|
8097
|
-
this.classCollection = new
|
|
8116
|
+
this.classCollection = new Zt(['mg-c-popover-content']);
|
|
8098
8117
|
/**
|
|
8099
8118
|
* Handle action for close button
|
|
8100
8119
|
*/
|
|
@@ -8118,7 +8137,7 @@ const MgPopoverContent = class {
|
|
|
8118
8137
|
componentDidLoad() {
|
|
8119
8138
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
8120
8139
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
8121
|
-
if (slottedTitleElement && !
|
|
8140
|
+
if (slottedTitleElement && !qt(slottedTitleElement, headingTags)) {
|
|
8122
8141
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
8123
8142
|
}
|
|
8124
8143
|
}
|
|
@@ -8127,7 +8146,7 @@ const MgPopoverContent = class {
|
|
|
8127
8146
|
* @returns HTML Element
|
|
8128
8147
|
*/
|
|
8129
8148
|
render() {
|
|
8130
|
-
return (h(Host, { key: '
|
|
8149
|
+
return (h(Host, { key: '8d2dd7d21518de744c18f0280b7b418f3a76acca' }, h("mg-card", { key: '8beab7c9fb692c1983515709a1ee888dc7e5157a', class: this.classCollection.join() }, this.closeButton && (h("mg-button", { key: 'e636569be26b0c741e0b03e806787d91b47ded5c', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: '3edc717cbe542494d892566c182883e20b1ca4cb', icon: "cross" }))), h("div", { key: 'd18525218972d92b6932984edb50844658e12970', class: "mg-c-popover-content__title" }, h("slot", { key: '2cceb41fd4ebb00b889e71cab211431e5894d04c', name: "title" })), h("slot", { key: 'a6615d9d7c85b32fb63d3d89db02fae2f8d5c1b2', name: "content" })), h("slot", { key: '0ff4bf72de19a3d56aafb64391cfc276d70e2f18', name: "arrow" })));
|
|
8131
8150
|
}
|
|
8132
8151
|
get element() { return getElement(this); }
|
|
8133
8152
|
};
|
|
@@ -8152,7 +8171,7 @@ const MgSkipLinks = class {
|
|
|
8152
8171
|
};
|
|
8153
8172
|
}
|
|
8154
8173
|
validateLinks(links) {
|
|
8155
|
-
if (links === undefined || links.length === 0 || links.some(link => !
|
|
8174
|
+
if (links === undefined || links.length === 0 || links.some(link => !De(link.href) || !link.href.startsWith('#') || !De(link.label))) {
|
|
8156
8175
|
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.`);
|
|
8157
8176
|
}
|
|
8158
8177
|
}
|
|
@@ -8171,7 +8190,7 @@ const MgSkipLinks = class {
|
|
|
8171
8190
|
* @returns HTML Element
|
|
8172
8191
|
*/
|
|
8173
8192
|
render() {
|
|
8174
|
-
return (h("nav", { key: '
|
|
8193
|
+
return (h("nav", { key: '0b4e4d6b9481a88faae78602b07c4f5e851da517', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: 'aaa15193eb2c9e1d9ee3b2e2a7d8d0fd37836ed7', class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
8175
8194
|
}
|
|
8176
8195
|
get element() { return getElement(this); }
|
|
8177
8196
|
static get watchers() { return {
|
|
@@ -8258,11 +8277,11 @@ const MgTable = class {
|
|
|
8258
8277
|
/**
|
|
8259
8278
|
* Class collection
|
|
8260
8279
|
*/
|
|
8261
|
-
this.classCollection = new
|
|
8280
|
+
this.classCollection = new Zt([this.componentClass]);
|
|
8262
8281
|
}
|
|
8263
8282
|
watchSize(newValue, oldValue) {
|
|
8264
8283
|
if (!sizes$1.includes(newValue)) {
|
|
8265
|
-
throw new Error(`<mg-table> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${
|
|
8284
|
+
throw new Error(`<mg-table> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
8266
8285
|
}
|
|
8267
8286
|
else {
|
|
8268
8287
|
if (oldValue !== undefined) {
|
|
@@ -8281,7 +8300,7 @@ const MgTable = class {
|
|
|
8281
8300
|
}
|
|
8282
8301
|
watchColumns(newValue) {
|
|
8283
8302
|
if (newValue !== undefined && !isValidColumnsObject(newValue)) {
|
|
8284
|
-
throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${
|
|
8303
|
+
throw new Error(`<mg-table> prop "columns" must be a ColumnsType object. Passed value: ${Gt(newValue)}.`);
|
|
8285
8304
|
}
|
|
8286
8305
|
}
|
|
8287
8306
|
/**
|
|
@@ -8410,8 +8429,8 @@ const MgTable = class {
|
|
|
8410
8429
|
// Ensure caption is not visible (otherwhise the table does not have rounded corners)
|
|
8411
8430
|
captionTable.className = 'mg-u-visually-hidden';
|
|
8412
8431
|
// Link caption to div
|
|
8413
|
-
if (!
|
|
8414
|
-
captionTable.setAttribute('id',
|
|
8432
|
+
if (!De(captionTable.id)) {
|
|
8433
|
+
captionTable.setAttribute('id', Pt(`${this.componentClass}-caption`));
|
|
8415
8434
|
}
|
|
8416
8435
|
divWrapper.setAttribute('aria-labelledby', captionTable.id);
|
|
8417
8436
|
// Add sortable caption if neeeded
|
|
@@ -8495,7 +8514,7 @@ const MgTabs = class {
|
|
|
8495
8514
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
8496
8515
|
* If not set, it will be created.
|
|
8497
8516
|
*/
|
|
8498
|
-
this.identifier =
|
|
8517
|
+
this.identifier = Pt('mg-tabs');
|
|
8499
8518
|
/**
|
|
8500
8519
|
* Define tabs size
|
|
8501
8520
|
*/
|
|
@@ -8507,7 +8526,7 @@ const MgTabs = class {
|
|
|
8507
8526
|
/**
|
|
8508
8527
|
* Component classes
|
|
8509
8528
|
*/
|
|
8510
|
-
this.classCollection = new
|
|
8529
|
+
this.classCollection = new Zt(['mg-c-tabs']);
|
|
8511
8530
|
/**
|
|
8512
8531
|
* Validate that new tab status can be `Status.ACTIVE`
|
|
8513
8532
|
* @param tab - tab item
|
|
@@ -8560,18 +8579,18 @@ const MgTabs = class {
|
|
|
8560
8579
|
*/
|
|
8561
8580
|
this.handleKeydown = (event) => {
|
|
8562
8581
|
const parent = event.target.parentElement;
|
|
8563
|
-
if ([
|
|
8582
|
+
if ([Keys.ARROWLEFT, Keys.ARROWRIGHT].includes(event.key)) {
|
|
8564
8583
|
this.tabFocus = Number(event.target.dataset.index);
|
|
8565
8584
|
parent.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute('tabindex', '-1');
|
|
8566
8585
|
// Move right
|
|
8567
|
-
if (event.key ===
|
|
8586
|
+
if (event.key === Keys.ARROWRIGHT) {
|
|
8568
8587
|
this.tabFocus++;
|
|
8569
8588
|
// If we're at the end, go to the start
|
|
8570
8589
|
if (this.tabFocus > this.tabs.length)
|
|
8571
8590
|
this.tabFocus = this.startIndex;
|
|
8572
8591
|
// Move left
|
|
8573
8592
|
}
|
|
8574
|
-
else if (event.key ===
|
|
8593
|
+
else if (event.key === Keys.ARROWLEFT) {
|
|
8575
8594
|
this.tabFocus--;
|
|
8576
8595
|
// If we're at the start, move to the end
|
|
8577
8596
|
if (this.tabFocus < this.startIndex)
|
|
@@ -8588,7 +8607,7 @@ const MgTabs = class {
|
|
|
8588
8607
|
parentButtonElement.focus();
|
|
8589
8608
|
}
|
|
8590
8609
|
}
|
|
8591
|
-
else if (event.key ===
|
|
8610
|
+
else if (event.key === Keys.TAB) {
|
|
8592
8611
|
this.resetFocus();
|
|
8593
8612
|
}
|
|
8594
8613
|
};
|
|
@@ -8605,7 +8624,7 @@ const MgTabs = class {
|
|
|
8605
8624
|
*/
|
|
8606
8625
|
this.resetFocus = () => {
|
|
8607
8626
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
8608
|
-
|
|
8627
|
+
Xt(() => {
|
|
8609
8628
|
this.tabFocus = undefined;
|
|
8610
8629
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
8611
8630
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -8622,30 +8641,30 @@ const MgTabs = class {
|
|
|
8622
8641
|
};
|
|
8623
8642
|
}
|
|
8624
8643
|
watchIdentifier(newValue) {
|
|
8625
|
-
if (!
|
|
8626
|
-
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${
|
|
8644
|
+
if (!Ut(newValue)) {
|
|
8645
|
+
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
8627
8646
|
}
|
|
8628
8647
|
}
|
|
8629
8648
|
validateLabel(newValue) {
|
|
8630
|
-
if (!
|
|
8631
|
-
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${
|
|
8649
|
+
if (!De(newValue)) {
|
|
8650
|
+
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${Gt(newValue)}.`);
|
|
8632
8651
|
}
|
|
8633
8652
|
}
|
|
8634
8653
|
validateSize(newValue) {
|
|
8635
8654
|
if (!sizes.includes(newValue)) {
|
|
8636
|
-
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${
|
|
8655
|
+
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
8637
8656
|
}
|
|
8638
8657
|
this.classCollection.add(`mg-c-tabs--size-${this.size}`);
|
|
8639
8658
|
}
|
|
8640
8659
|
validateItems(newValue) {
|
|
8641
8660
|
// String array
|
|
8642
|
-
if (
|
|
8661
|
+
if (Dt(newValue))
|
|
8643
8662
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
8644
8663
|
// Object array
|
|
8645
8664
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
8646
8665
|
this.tabs = newValue;
|
|
8647
8666
|
else
|
|
8648
|
-
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${
|
|
8667
|
+
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${Gt(newValue)}.`);
|
|
8649
8668
|
}
|
|
8650
8669
|
validateActiveTab(newValue) {
|
|
8651
8670
|
// when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
|
|
@@ -8670,7 +8689,7 @@ const MgTabs = class {
|
|
|
8670
8689
|
this.activeTabChange.emit(newValue);
|
|
8671
8690
|
}
|
|
8672
8691
|
else {
|
|
8673
|
-
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: ${
|
|
8692
|
+
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: ${Gt(newValue)}.`);
|
|
8674
8693
|
}
|
|
8675
8694
|
}
|
|
8676
8695
|
/*************
|
|
@@ -8705,7 +8724,7 @@ const MgTabs = class {
|
|
|
8705
8724
|
* @returns HTML Element
|
|
8706
8725
|
*/
|
|
8707
8726
|
render() {
|
|
8708
|
-
return (h("div", { key: '
|
|
8727
|
+
return (h("div", { key: '558c5ba517bef98ba711dd8992f901768d6770de', class: this.classCollection.join() }, h("header", { key: '0d36d49d51bbbb78bbf68c05e47271349fc58b96', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
8709
8728
|
[`${this.buttonTabBaseClass}`]: true,
|
|
8710
8729
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
8711
8730
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -8755,11 +8774,11 @@ const MgTag = class {
|
|
|
8755
8774
|
/**
|
|
8756
8775
|
* Component classes
|
|
8757
8776
|
*/
|
|
8758
|
-
this.classCollection = new
|
|
8777
|
+
this.classCollection = new Zt(['mg-c-tag']);
|
|
8759
8778
|
}
|
|
8760
8779
|
validateVariant(newValue, oldValue) {
|
|
8761
8780
|
if (!variants.includes(newValue)) {
|
|
8762
|
-
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${
|
|
8781
|
+
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${Gt(newValue)}.`);
|
|
8763
8782
|
}
|
|
8764
8783
|
else {
|
|
8765
8784
|
if (oldValue !== undefined) {
|
|
@@ -8792,7 +8811,7 @@ const MgTag = class {
|
|
|
8792
8811
|
* @param textContent - html element textContent property
|
|
8793
8812
|
*/
|
|
8794
8813
|
validateTextContent(textContent) {
|
|
8795
|
-
if (!
|
|
8814
|
+
if (!De(textContent))
|
|
8796
8815
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
8797
8816
|
}
|
|
8798
8817
|
/*************
|
|
@@ -8845,7 +8864,7 @@ const MgTooltip = class {
|
|
|
8845
8864
|
* Sets an `id` attribute.
|
|
8846
8865
|
* Needed by the input for accessibility `aria-decribedby`.
|
|
8847
8866
|
*/
|
|
8848
|
-
this.identifier =
|
|
8867
|
+
this.identifier = Pt('mg-tooltip');
|
|
8849
8868
|
/**
|
|
8850
8869
|
* Tooltip placement
|
|
8851
8870
|
*/
|
|
@@ -8865,12 +8884,13 @@ const MgTooltip = class {
|
|
|
8865
8884
|
// Make the tooltip visible
|
|
8866
8885
|
this.mgTooltipContent.dataset.show = '';
|
|
8867
8886
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
8868
|
-
|
|
8887
|
+
Xt(() => {
|
|
8869
8888
|
this.windows.forEach((localWindow) => {
|
|
8870
8889
|
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
8871
8890
|
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
8872
8891
|
});
|
|
8873
8892
|
});
|
|
8893
|
+
this.updateTooltip();
|
|
8874
8894
|
};
|
|
8875
8895
|
/**
|
|
8876
8896
|
* Hide tooltip
|
|
@@ -8908,8 +8928,9 @@ const MgTooltip = class {
|
|
|
8908
8928
|
* @param condition - additionnal condition to apply display prop newValue
|
|
8909
8929
|
*/
|
|
8910
8930
|
this.setDisplay = (newValue, condition = true) => {
|
|
8911
|
-
if (!this.disabled && condition)
|
|
8931
|
+
if (!this.disabled && condition && this.display !== newValue) {
|
|
8912
8932
|
this.display = newValue;
|
|
8933
|
+
}
|
|
8913
8934
|
};
|
|
8914
8935
|
/**
|
|
8915
8936
|
* Action for tooltip element and tooltiped element mouse listener
|
|
@@ -8967,52 +8988,43 @@ const MgTooltip = class {
|
|
|
8967
8988
|
}
|
|
8968
8989
|
};
|
|
8969
8990
|
/**
|
|
8970
|
-
*
|
|
8971
|
-
* @
|
|
8991
|
+
* Update tooltip position
|
|
8992
|
+
* @returns autoUpdate function
|
|
8972
8993
|
*/
|
|
8973
|
-
this.
|
|
8974
|
-
//
|
|
8994
|
+
this.updateTooltip = () => autoUpdate(this.tooltipedElement, this.mgTooltipContent, async () => {
|
|
8995
|
+
// Placement
|
|
8996
|
+
const { x, y, placement, middlewareData } = await computePosition(this.tooltipedElement, this.mgTooltipContent, {
|
|
8997
|
+
placement: this.placement,
|
|
8998
|
+
strategy: this.tooltipStrategy,
|
|
8999
|
+
middleware: [
|
|
9000
|
+
offset(8),
|
|
9001
|
+
flip(),
|
|
9002
|
+
shift({
|
|
9003
|
+
limiter: limitShift(),
|
|
9004
|
+
}),
|
|
9005
|
+
arrow({ element: this.arrowElement }),
|
|
9006
|
+
],
|
|
9007
|
+
});
|
|
9008
|
+
// Positioning
|
|
8975
9009
|
Object.assign(this.mgTooltipContent.style, {
|
|
8976
|
-
position:
|
|
8977
|
-
|
|
8978
|
-
left: '0',
|
|
8979
|
-
transform: 'translate(0, 0)',
|
|
9010
|
+
position: this.tooltipStrategy,
|
|
9011
|
+
transform: getTransformation(x, y),
|
|
8980
9012
|
});
|
|
8981
|
-
//
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8986
|
-
|
|
8987
|
-
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
const staticSide = {
|
|
8994
|
-
top: 'bottom',
|
|
8995
|
-
right: 'left',
|
|
8996
|
-
bottom: 'top',
|
|
8997
|
-
left: 'right',
|
|
8998
|
-
}[placement.split('-')[0]];
|
|
8999
|
-
const arrowElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');
|
|
9000
|
-
// https://floating-ui.com/docs/arrow
|
|
9001
|
-
// Unlike the floating element, which has both coordinates defined at all times, the arrow only has one defined.
|
|
9002
|
-
// Due to this, either x or y will be undefined, depending on the side of placement.
|
|
9003
|
-
// The above code uses `isNaN` to check for null and undefined simultaneously.
|
|
9004
|
-
// Don’t remove `isNaN`, because either value can be falsy (0), causing a bug!
|
|
9005
|
-
const numberToPx = (number) => (!isNaN(number) ? `${number}px` : '');
|
|
9006
|
-
Object.assign(arrowElement.style, {
|
|
9007
|
-
left: numberToPx(arrowX),
|
|
9008
|
-
top: numberToPx(arrowY),
|
|
9009
|
-
[staticSide]: '-4px',
|
|
9010
|
-
position: 'absolute',
|
|
9011
|
-
});
|
|
9012
|
-
this.mgTooltipContent.setAttribute('data-placement', placement);
|
|
9013
|
-
});
|
|
9013
|
+
// Arrow positioning
|
|
9014
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
9015
|
+
const staticSide = {
|
|
9016
|
+
top: 'bottom',
|
|
9017
|
+
right: 'left',
|
|
9018
|
+
bottom: 'top',
|
|
9019
|
+
left: 'right',
|
|
9020
|
+
}[placement.split('-')[0]];
|
|
9021
|
+
Object.assign(this.arrowElement.style, {
|
|
9022
|
+
left: numberToPx(arrowX),
|
|
9023
|
+
top: numberToPx(arrowY),
|
|
9024
|
+
[staticSide]: '-4px',
|
|
9014
9025
|
});
|
|
9015
|
-
|
|
9026
|
+
this.mgTooltipContent.setAttribute('data-placement', placement);
|
|
9027
|
+
});
|
|
9016
9028
|
/**
|
|
9017
9029
|
* Define selected element to become tooltip selector and init listeners
|
|
9018
9030
|
* @param element - tooltiped element
|
|
@@ -9054,18 +9066,15 @@ const MgTooltip = class {
|
|
|
9054
9066
|
// set guard when one of mutations is for a disabled with disabled-on-click
|
|
9055
9067
|
if (mutationList.some((mutation) => mutation.target.disabled && mutation.target.disableOnClick)) {
|
|
9056
9068
|
this.guard = Guard.DISABLE_ON_CLICK;
|
|
9057
|
-
}
|
|
9058
|
-
// when the disabled-on-click guard is running we stop process
|
|
9059
|
-
if (this.guard === Guard.DISABLE_ON_CLICK)
|
|
9060
9069
|
return;
|
|
9070
|
+
}
|
|
9061
9071
|
// update button wrapper
|
|
9062
9072
|
this.setMgButtonWrapper(mgButton);
|
|
9063
9073
|
// Since Firefox doesn't trigger a "blur" event when the "disabled" attribute is added or removed from a button
|
|
9064
9074
|
// we have to manually unlock the guard because the "blur" handler of the tooltipedElement won't do it.
|
|
9065
9075
|
this.resetGuard();
|
|
9066
9076
|
// update Floating UI instance
|
|
9067
|
-
this.
|
|
9068
|
-
this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
|
|
9077
|
+
this.updateTooltip();
|
|
9069
9078
|
}).observe(mgButton, { attributes: true });
|
|
9070
9079
|
};
|
|
9071
9080
|
/**
|
|
@@ -9084,15 +9093,15 @@ const MgTooltip = class {
|
|
|
9084
9093
|
};
|
|
9085
9094
|
}
|
|
9086
9095
|
watchIdentifier(newValue) {
|
|
9087
|
-
if (!
|
|
9088
|
-
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${
|
|
9096
|
+
if (!Ut(newValue)) {
|
|
9097
|
+
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${Gt(newValue)}.`);
|
|
9089
9098
|
}
|
|
9090
9099
|
// use renderTooltipContent to update tooltip-content id
|
|
9091
9100
|
this.renderTooltipContent();
|
|
9092
9101
|
}
|
|
9093
9102
|
watchMessage(newValue) {
|
|
9094
|
-
if (!
|
|
9095
|
-
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${
|
|
9103
|
+
if (!De(newValue)) {
|
|
9104
|
+
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${Gt(newValue)}.`);
|
|
9096
9105
|
}
|
|
9097
9106
|
if (this.mgTooltipContent !== undefined)
|
|
9098
9107
|
this.mgTooltipContent.message = newValue;
|
|
@@ -9151,7 +9160,7 @@ const MgTooltip = class {
|
|
|
9151
9160
|
*/
|
|
9152
9161
|
componentWillLoad() {
|
|
9153
9162
|
// Get windows to attach events
|
|
9154
|
-
this.windows =
|
|
9163
|
+
this.windows = Bt(window);
|
|
9155
9164
|
// Get tooltip element
|
|
9156
9165
|
this.renderTooltipContent();
|
|
9157
9166
|
//validate properties
|
|
@@ -9159,6 +9168,8 @@ const MgTooltip = class {
|
|
|
9159
9168
|
this.watchDisabled(this.disabled);
|
|
9160
9169
|
this.watchMessage(this.message);
|
|
9161
9170
|
this.watchIdentifier(this.identifier);
|
|
9171
|
+
// define if the tooltip is inside a popover
|
|
9172
|
+
this.tooltipStrategy = this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed';
|
|
9162
9173
|
}
|
|
9163
9174
|
/**
|
|
9164
9175
|
* Get slotted element
|
|
@@ -9170,8 +9181,10 @@ const MgTooltip = class {
|
|
|
9170
9181
|
// get slotted element wich is not the tooltip
|
|
9171
9182
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
9172
9183
|
// Get interactive element
|
|
9173
|
-
const interactiveElement = slotElement.matches(
|
|
9184
|
+
const interactiveElement = slotElement.matches(Ht) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(Ht);
|
|
9174
9185
|
this.setTooltipedElement(interactiveElement || slotElement);
|
|
9186
|
+
// Set arrow element
|
|
9187
|
+
this.arrowElement = this.mgTooltipContent.querySelector('[data-floating-arrow]');
|
|
9175
9188
|
// Check if slotted element is a disabled mg-button
|
|
9176
9189
|
// In this case we wrap the mg-button into a div to enable the tooltip
|
|
9177
9190
|
if (isButton(slotElement)) {
|
|
@@ -9187,8 +9200,6 @@ const MgTooltip = class {
|
|
|
9187
9200
|
}
|
|
9188
9201
|
// apply a11y aria
|
|
9189
9202
|
this.setAriaDescribedby(slotElement);
|
|
9190
|
-
// set Tooltip
|
|
9191
|
-
this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
|
|
9192
9203
|
// add document keyboard handler
|
|
9193
9204
|
document.addEventListener('keydown', this.handlePressEscape);
|
|
9194
9205
|
// check props
|
|
@@ -9198,28 +9209,26 @@ const MgTooltip = class {
|
|
|
9198
9209
|
* update popper position after props change on component did update hook to benefit from render ended
|
|
9199
9210
|
*/
|
|
9200
9211
|
componentDidUpdate() {
|
|
9201
|
-
this.
|
|
9202
|
-
this.setFloatingUI(this.element.closest('mg-popover') !== null ? 'absolute' : 'fixed');
|
|
9212
|
+
this.updateTooltip();
|
|
9203
9213
|
}
|
|
9204
9214
|
/**
|
|
9205
9215
|
* remove listeners
|
|
9206
9216
|
*/
|
|
9207
9217
|
disconnectedCallback() {
|
|
9208
|
-
var _a;
|
|
9218
|
+
var _a, _b;
|
|
9209
9219
|
document.removeEventListener('keydown', this.handlePressEscape);
|
|
9210
9220
|
(_a = this.windows) === null || _a === void 0 ? void 0 : _a.forEach((localWindow) => {
|
|
9211
9221
|
localWindow.removeEventListener('click', this.handleClickOutside, false);
|
|
9212
9222
|
localWindow.removeEventListener('keydown', this.handlePressEscape, false);
|
|
9213
9223
|
});
|
|
9214
|
-
|
|
9215
|
-
this.floatingUICleanup();
|
|
9224
|
+
(_b = this.updateTooltip) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
9216
9225
|
}
|
|
9217
9226
|
/**
|
|
9218
9227
|
* Render
|
|
9219
9228
|
* @returns HTML Element
|
|
9220
9229
|
*/
|
|
9221
9230
|
render() {
|
|
9222
|
-
return (h(Host, { key: '
|
|
9231
|
+
return (h(Host, { key: 'dab470c730b1541ab5be487222da8ba3643501ae' }, h("slot", { key: 'a6f5d444e3521d93cf9f39ccffcd68cfde4f8101' }), h("slot", { key: 'ba4d98f953453a710379cb4ce28f1c468a34ffc4', name: "content" })));
|
|
9223
9232
|
}
|
|
9224
9233
|
get element() { return getElement(this); }
|
|
9225
9234
|
static get watchers() { return {
|
|
@@ -9232,7 +9241,7 @@ const MgTooltip = class {
|
|
|
9232
9241
|
};
|
|
9233
9242
|
MgTooltip.style = mgTooltipCss;
|
|
9234
9243
|
|
|
9235
|
-
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))}";
|
|
9244
|
+
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))}";
|
|
9236
9245
|
|
|
9237
9246
|
const MgTooltipContent = class {
|
|
9238
9247
|
constructor(hostRef) {
|