@mgdis/mg-components 5.28.1 → 5.29.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/{index-ce4f7698.js → index-8a3adbd1.js} +40 -8
- package/dist/cjs/index-8a3adbd1.js.map +1 -0
- package/dist/cjs/{index-d8721674.js → index-e1a25816.js} +48 -47
- package/dist/cjs/index-e1a25816.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +112 -103
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +3 -3
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js +2 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +2 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- 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 +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 +18 -7
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -2
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js.map +1 -1
- package/dist/components/index.es.js +41 -40
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +2 -2
- package/dist/components/mg-badge2.js +3 -3
- package/dist/components/mg-button2.js +5 -5
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-card2.js +2 -2
- package/dist/components/mg-details.js +2 -2
- package/dist/components/mg-form.js +3 -3
- package/dist/components/mg-icon2.js +2 -2
- package/dist/components/mg-illustrated-message.js +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js +1 -3
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +5 -5
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +11 -11
- package/dist/components/mg-input-numeric.js +5 -5
- package/dist/components/mg-input-password.js +3 -3
- package/dist/components/mg-input-radio.js +21 -9
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +8 -8
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +6 -6
- package/dist/components/mg-input-textarea.js +6 -6
- package/dist/components/mg-input-title2.js +2 -2
- package/dist/components/mg-input-toggle.js +4 -4
- package/dist/components/mg-input2.js +3 -3
- package/dist/components/mg-item-more2.js +3 -3
- package/dist/components/mg-loader.js +2 -2
- package/dist/components/mg-menu-item2.js +5 -5
- package/dist/components/mg-message.js +3 -3
- package/dist/components/mg-modal.js +6 -6
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +4 -4
- package/dist/components/mg-popover-content2.js +3 -3
- package/dist/components/mg-popover2.js +3 -3
- package/dist/components/mg-skip-links.js +3 -3
- package/dist/components/mg-skip-links.js.map +1 -1
- package/dist/components/mg-tabs.js +6 -6
- package/dist/components/mg-tag.js +3 -3
- package/dist/components/mg-tooltip2.js +6 -6
- package/dist/esm/{index-9ed65b6d.js → index-0df3b137.js} +40 -8
- package/dist/esm/index-0df3b137.js.map +1 -0
- package/dist/esm/{index-817d7645.js → index-eed80cc2.js} +43 -42
- package/dist/esm/index-eed80cc2.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +112 -103
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +3 -3
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/{p-ef541188.entry.js → p-88f6c2f9.entry.js} +2 -2
- package/dist/mg-components/p-88f6c2f9.entry.js.map +1 -0
- package/dist/mg-components/{p-c4207303.entry.js → p-e5db08c5.entry.js} +2 -2
- package/dist/mg-components/p-efce3d8c.js +2 -0
- package/dist/mg-components/p-efce3d8c.js.map +1 -0
- package/dist/mg-components/p-f95b4418.js +3 -0
- package/dist/mg-components/p-f95b4418.js.map +1 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -1
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +1 -1
- package/dist/types/components.d.ts +10 -10
- package/ide/intellij/web-types.json +4 -4
- package/ide/vscode/html-custom-data.json +3 -3
- package/package.json +25 -26
- package/dist/cjs/index-ce4f7698.js.map +0 -1
- package/dist/cjs/index-d8721674.js.map +0 -1
- package/dist/esm/index-817d7645.js.map +0 -1
- package/dist/esm/index-9ed65b6d.js.map +0 -1
- package/dist/mg-components/p-06a9d801.js +0 -3
- package/dist/mg-components/p-06a9d801.js.map +0 -1
- package/dist/mg-components/p-eb6ec303.js +0 -2
- package/dist/mg-components/p-eb6ec303.js.map +0 -1
- package/dist/mg-components/p-ef541188.entry.js.map +0 -1
- /package/dist/mg-components/{p-c4207303.entry.js.map → p-e5db08c5.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-0df3b137.js';
|
|
2
|
+
import { z as ze, i as initLocales, I as Ie, Z as Ze, Y as Ye, X as Xe, J as Je, W as We, H as He, l as lt, n as nt, a as it, b as at, G as Ge, K as Ke, Q as Qe } from './index-eed80cc2.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Available menu-item positions
|
|
@@ -75,7 +75,7 @@ const MgActionMore = class {
|
|
|
75
75
|
************/
|
|
76
76
|
this.name = 'mg-action-more';
|
|
77
77
|
this.classBase = 'mg-c-action-more';
|
|
78
|
-
this.mgPopoverIdentifier =
|
|
78
|
+
this.mgPopoverIdentifier = ze(this.name);
|
|
79
79
|
/************
|
|
80
80
|
* Methods *
|
|
81
81
|
***********/
|
|
@@ -199,7 +199,7 @@ const MgBadge = class {
|
|
|
199
199
|
this.label = undefined;
|
|
200
200
|
this.variant = variants$5[0];
|
|
201
201
|
this.outline = undefined;
|
|
202
|
-
this.classCollection = new
|
|
202
|
+
this.classCollection = new Ie(['mg-c-badge']);
|
|
203
203
|
}
|
|
204
204
|
validateValue(newValue) {
|
|
205
205
|
if (/^(\d+\+*|[?*!a-z])$/i.exec(`${newValue}`) === null) {
|
|
@@ -207,7 +207,7 @@ const MgBadge = class {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
validateLabel(newValue) {
|
|
210
|
-
if (!
|
|
210
|
+
if (!Ze(newValue)) {
|
|
211
211
|
throw new Error('<mg-badge> prop "label" is required.');
|
|
212
212
|
}
|
|
213
213
|
}
|
|
@@ -318,7 +318,7 @@ const MgButton = class {
|
|
|
318
318
|
this.isIcon = false;
|
|
319
319
|
this.disableOnClick = false;
|
|
320
320
|
this.loading = false;
|
|
321
|
-
this.classCollection = new
|
|
321
|
+
this.classCollection = new Ie(['mg-c-button']);
|
|
322
322
|
}
|
|
323
323
|
validateVariant(newValue, oldValue) {
|
|
324
324
|
if (!variants$4.includes(newValue)) {
|
|
@@ -377,7 +377,7 @@ const MgButton = class {
|
|
|
377
377
|
this.validateFullWidth(this.fullWidth);
|
|
378
378
|
if (this.isIcon) {
|
|
379
379
|
this.classCollection.add(`mg-c-button--icon`);
|
|
380
|
-
if (!
|
|
380
|
+
if (!Ze(this.label)) {
|
|
381
381
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
382
382
|
}
|
|
383
383
|
}
|
|
@@ -389,7 +389,7 @@ const MgButton = class {
|
|
|
389
389
|
* Add listners
|
|
390
390
|
*/
|
|
391
391
|
componentDidLoad() {
|
|
392
|
-
|
|
392
|
+
Ye(() => {
|
|
393
393
|
var _a;
|
|
394
394
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
395
395
|
// submit buttons should trigger form submition;
|
|
@@ -406,7 +406,7 @@ const MgButton = class {
|
|
|
406
406
|
*/
|
|
407
407
|
render() {
|
|
408
408
|
var _a;
|
|
409
|
-
return (h(Host, { key: '
|
|
409
|
+
return (h(Host, { key: '1b54d5a3ae7656215f0f60dcebf13caed4afe09e', 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: 'ee66e5b1d78d7344634e736b39e29640de8c5755', class: this.classCollection.join(), id: this.identifier }, this.loading && h("mg-icon", { key: '6da3bfa9accafda3cf1d960d229bf3d75abc9250', icon: "loader", spin: true }), h("div", { key: '9ab6e8910210543fc7c0745d63f0e260003aa000', class: "mg-c-button__content" }, h("slot", { key: '44ba371bb96f86632f084610cdffb0b0fafa3980' })))));
|
|
410
410
|
}
|
|
411
411
|
get element() { return getElement(this); }
|
|
412
412
|
static get watchers() { return {
|
|
@@ -448,7 +448,7 @@ const MgCard = class {
|
|
|
448
448
|
};
|
|
449
449
|
this.variant = undefined;
|
|
450
450
|
this.variantStyle = undefined;
|
|
451
|
-
this.classCollection = new
|
|
451
|
+
this.classCollection = new Ie([this.classBase]);
|
|
452
452
|
}
|
|
453
453
|
validateVariant(newValue, oldValue) {
|
|
454
454
|
if (newValue && !variants$3.includes(newValue))
|
|
@@ -553,7 +553,7 @@ const MgDetails = class {
|
|
|
553
553
|
this.expanded = false;
|
|
554
554
|
}
|
|
555
555
|
validateTitles(newValue) {
|
|
556
|
-
if (!
|
|
556
|
+
if (!Ze(newValue)) {
|
|
557
557
|
throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
|
|
558
558
|
}
|
|
559
559
|
}
|
|
@@ -711,7 +711,7 @@ const MgForm = class {
|
|
|
711
711
|
}
|
|
712
712
|
});
|
|
713
713
|
};
|
|
714
|
-
this.identifier =
|
|
714
|
+
this.identifier = ze('mg-form');
|
|
715
715
|
this.name = this.identifier;
|
|
716
716
|
this.readonly = false;
|
|
717
717
|
this.requiredMessage = undefined;
|
|
@@ -720,7 +720,7 @@ const MgForm = class {
|
|
|
720
720
|
this.disabled = false;
|
|
721
721
|
this.valid = undefined;
|
|
722
722
|
this.invalid = undefined;
|
|
723
|
-
this.classCollection = new
|
|
723
|
+
this.classCollection = new Ie(['mg-c-form']);
|
|
724
724
|
this.requiredMessageText = undefined;
|
|
725
725
|
}
|
|
726
726
|
validateRequiredMessage(newValue) {
|
|
@@ -861,7 +861,7 @@ const MgIcon = class {
|
|
|
861
861
|
this.variant = undefined;
|
|
862
862
|
this.variantStyle = undefined;
|
|
863
863
|
this.spin = false;
|
|
864
|
-
this.classCollection = new
|
|
864
|
+
this.classCollection = new Ie(['mg-c-icon']);
|
|
865
865
|
}
|
|
866
866
|
validateIcon(newValue, oldValue) {
|
|
867
867
|
if (!Object.keys(icons).includes(newValue))
|
|
@@ -960,7 +960,7 @@ const MgIllustratedMessage = class {
|
|
|
960
960
|
componentDidLoad() {
|
|
961
961
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
962
962
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
963
|
-
if (!
|
|
963
|
+
if (!Xe(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
964
964
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
965
965
|
}
|
|
966
966
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -1061,7 +1061,7 @@ const MgInput = class {
|
|
|
1061
1061
|
this.isVerticalList = false;
|
|
1062
1062
|
}
|
|
1063
1063
|
watchIdentifier(newValue) {
|
|
1064
|
-
if (!
|
|
1064
|
+
if (!Ze(newValue)) {
|
|
1065
1065
|
throw new Error('<mg-input> prop "identifier" is required.');
|
|
1066
1066
|
}
|
|
1067
1067
|
else {
|
|
@@ -1146,7 +1146,7 @@ const MgInput = class {
|
|
|
1146
1146
|
*/
|
|
1147
1147
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1148
1148
|
watchLabel() {
|
|
1149
|
-
if (!
|
|
1149
|
+
if (!Ze(this.label)) {
|
|
1150
1150
|
throw new Error('<mg-input> prop "label" is required.');
|
|
1151
1151
|
}
|
|
1152
1152
|
else {
|
|
@@ -1301,9 +1301,7 @@ var SelectValuesButtonKey;
|
|
|
1301
1301
|
* @param props - MgInputCheckboxList Interface Props
|
|
1302
1302
|
* @returns input template
|
|
1303
1303
|
*/
|
|
1304
|
-
const MgInputCheckboxList = (props) => (
|
|
1305
|
-
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
1306
|
-
h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-describedby": props.displaySearchInput ? 'search-results' : undefined, "aria-label": props.displaySearchInput ? props.messages.searchResults : undefined, "aria-live": props.displaySearchInput ? 'polite' : undefined, id: props.id }, props.checkboxes.map(input => {
|
|
1304
|
+
const MgInputCheckboxList = (props) => (h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-describedby": props.displaySearchInput ? 'search-results' : undefined, "aria-label": props.displaySearchInput ? props.messages.searchResults : undefined, "aria-live": props.displaySearchInput ? 'polite' : undefined, id: props.id }, props.checkboxes.map(input => {
|
|
1307
1305
|
var _a, _b;
|
|
1308
1306
|
return (h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
|
|
1309
1307
|
h("input", { type: "checkbox", id: input._id, name: props.name, value: (_a = input.value) === null || _a === void 0 ? void 0 : _a.toString(), checked: Boolean(input.value), required: input.required, "aria-invalid": ((_b = props.invalid) === null || _b === void 0 ? void 0 : _b.toString()) || 'false', disabled: props.disabled || input.disabled, indeterminate: input.value === null, onInput: input._handleInput, onBlur: input._handleBlur, onKeyDown: input._handleKeydown }),
|
|
@@ -1460,7 +1458,7 @@ const MgInputCheckbox = class {
|
|
|
1460
1458
|
* Method to update searchResults
|
|
1461
1459
|
*/
|
|
1462
1460
|
this.updateSearchResults = () => {
|
|
1463
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
1461
|
+
this.searchResults = this.checkboxItems.filter(item => Je(item.title).includes(Je(this.searchValue)));
|
|
1464
1462
|
};
|
|
1465
1463
|
/**
|
|
1466
1464
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1534,7 +1532,7 @@ const MgInputCheckbox = class {
|
|
|
1534
1532
|
this.helpText = undefined;
|
|
1535
1533
|
this.valid = undefined;
|
|
1536
1534
|
this.invalid = undefined;
|
|
1537
|
-
this.classCollection = new
|
|
1535
|
+
this.classCollection = new Ie([this.baseClassName, classFieldset]);
|
|
1538
1536
|
this.errorMessage = undefined;
|
|
1539
1537
|
this.checkboxItems = [];
|
|
1540
1538
|
this.displaySearchInput = undefined;
|
|
@@ -1642,7 +1640,7 @@ const MgInputCheckbox = class {
|
|
|
1642
1640
|
if (typeof valid !== 'boolean') {
|
|
1643
1641
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean');
|
|
1644
1642
|
}
|
|
1645
|
-
else if (!
|
|
1643
|
+
else if (!Ze(errorMessage)) {
|
|
1646
1644
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string');
|
|
1647
1645
|
}
|
|
1648
1646
|
else {
|
|
@@ -1755,7 +1753,7 @@ const MgInputCheckbox = class {
|
|
|
1755
1753
|
* @returns HTML Element
|
|
1756
1754
|
*/
|
|
1757
1755
|
render() {
|
|
1758
|
-
return (h("mg-input", { key: '
|
|
1756
|
+
return (h("mg-input", { key: 'c0b23390de51d9be03440d1afbb0a058af4b8207', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonlyValue: this.value.filter(({ value }) => value).map(({ title }) => title), tooltip: !this.readonly ? this.tooltip : undefined, tooltipPosition: this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, this.type === 'checkbox' || this.readonly ? (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name, invalid: this.invalid })) : (this.renderCheckboxMulti())));
|
|
1759
1757
|
}
|
|
1760
1758
|
get element() { return getElement(this); }
|
|
1761
1759
|
static get watchers() { return {
|
|
@@ -1905,7 +1903,7 @@ const MgInputDate = class {
|
|
|
1905
1903
|
* @param value - value to test
|
|
1906
1904
|
* @returns truthy when value match the pattern
|
|
1907
1905
|
*/
|
|
1908
|
-
this.isValidPattern = (value) =>
|
|
1906
|
+
this.isValidPattern = (value) => Ze(value) && We.test(value);
|
|
1909
1907
|
/**
|
|
1910
1908
|
* Format help text to display
|
|
1911
1909
|
* @param helpText - help text format
|
|
@@ -1913,10 +1911,10 @@ const MgInputDate = class {
|
|
|
1913
1911
|
*/
|
|
1914
1912
|
this.formatHelpText = (helpText) => {
|
|
1915
1913
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
1916
|
-
let text =
|
|
1914
|
+
let text = Ze(helpText) ? helpText : this.messages.input.date.helpText;
|
|
1917
1915
|
if (text.includes(defaultHelpTextVariable))
|
|
1918
1916
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
1919
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}',
|
|
1917
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', He(lt(new Date('2023-12-24')), this.systemLocale));
|
|
1920
1918
|
};
|
|
1921
1919
|
/**
|
|
1922
1920
|
* Handle input event
|
|
@@ -2008,8 +2006,8 @@ const MgInputDate = class {
|
|
|
2008
2006
|
// min, max & minMax
|
|
2009
2007
|
else if ([InputError$1.MIN, InputError$1.MAX, InputError$1.MINMAX].includes(inputError)) {
|
|
2010
2008
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
2011
|
-
.replace('{min}',
|
|
2012
|
-
.replace('{max}',
|
|
2009
|
+
.replace('{min}', He(this.min, this.systemLocale))
|
|
2010
|
+
.replace('{max}', He(this.max, this.systemLocale));
|
|
2013
2011
|
}
|
|
2014
2012
|
// wrong date format
|
|
2015
2013
|
// element.validity.badInput is default error message
|
|
@@ -2023,7 +2021,7 @@ const MgInputDate = class {
|
|
|
2023
2021
|
* @returns translated html pattern
|
|
2024
2022
|
*/
|
|
2025
2023
|
this.renderPattern = () => {
|
|
2026
|
-
let patternLocal =
|
|
2024
|
+
let patternLocal = nt(this.systemLocale);
|
|
2027
2025
|
for (const key in this.messages.input.date.pattern) {
|
|
2028
2026
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
2029
2027
|
}
|
|
@@ -2045,7 +2043,7 @@ const MgInputDate = class {
|
|
|
2045
2043
|
this.helpText = undefined;
|
|
2046
2044
|
this.valid = undefined;
|
|
2047
2045
|
this.invalid = undefined;
|
|
2048
|
-
this.classCollection = new
|
|
2046
|
+
this.classCollection = new Ie(['mg-c-input--date']);
|
|
2049
2047
|
this.errorMessage = undefined;
|
|
2050
2048
|
}
|
|
2051
2049
|
validateValue(newValue) {
|
|
@@ -2053,7 +2051,7 @@ const MgInputDate = class {
|
|
|
2053
2051
|
if (newValue === '')
|
|
2054
2052
|
newValue = null;
|
|
2055
2053
|
// check value validity
|
|
2056
|
-
if (newValue && !
|
|
2054
|
+
if (newValue && !Ze(newValue)) {
|
|
2057
2055
|
throw new Error("<mg-input-date> props 'value' must be a valid string");
|
|
2058
2056
|
}
|
|
2059
2057
|
else if (!newValue || (newValue && this.isValidPattern(newValue))) {
|
|
@@ -2110,7 +2108,7 @@ const MgInputDate = class {
|
|
|
2110
2108
|
if (typeof valid !== 'boolean') {
|
|
2111
2109
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean');
|
|
2112
2110
|
}
|
|
2113
|
-
else if (!
|
|
2111
|
+
else if (!Ze(errorMessage)) {
|
|
2114
2112
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string');
|
|
2115
2113
|
}
|
|
2116
2114
|
else {
|
|
@@ -2164,7 +2162,7 @@ const MgInputDate = class {
|
|
|
2164
2162
|
* @returns HTML Element
|
|
2165
2163
|
*/
|
|
2166
2164
|
render() {
|
|
2167
|
-
return (h("mg-input", { key: 'f38d79cb71311149b4d15885b65cd8f025dde15d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue:
|
|
2165
|
+
return (h("mg-input", { key: 'f38d79cb71311149b4d15885b65cd8f025dde15d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: He(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, h("input", { key: '67bf6f0ad58ee1a506ffd0d3d41d5954db68465c', type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
2168
2166
|
if (el !== null)
|
|
2169
2167
|
this.input = el;
|
|
2170
2168
|
} })));
|
|
@@ -2295,9 +2293,9 @@ const MgInputNumeric = class {
|
|
|
2295
2293
|
this.formatValue = (value) => {
|
|
2296
2294
|
switch (this.format) {
|
|
2297
2295
|
case 'number':
|
|
2298
|
-
return
|
|
2296
|
+
return at(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2299
2297
|
case 'currency':
|
|
2300
|
-
return
|
|
2298
|
+
return it(value, this.locale, this.currency);
|
|
2301
2299
|
case 'none':
|
|
2302
2300
|
return value.toString();
|
|
2303
2301
|
}
|
|
@@ -2334,7 +2332,7 @@ const MgInputNumeric = class {
|
|
|
2334
2332
|
this.decimalLength = 2;
|
|
2335
2333
|
this.valid = undefined;
|
|
2336
2334
|
this.invalid = undefined;
|
|
2337
|
-
this.classCollection = new
|
|
2335
|
+
this.classCollection = new Ie(['mg-c-input--numeric']);
|
|
2338
2336
|
this.errorMessage = undefined;
|
|
2339
2337
|
this.hasFocus = undefined;
|
|
2340
2338
|
}
|
|
@@ -2430,7 +2428,7 @@ const MgInputNumeric = class {
|
|
|
2430
2428
|
if (typeof valid !== 'boolean') {
|
|
2431
2429
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean');
|
|
2432
2430
|
}
|
|
2433
|
-
else if (!
|
|
2431
|
+
else if (!Ze(errorMessage)) {
|
|
2434
2432
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string');
|
|
2435
2433
|
}
|
|
2436
2434
|
else {
|
|
@@ -2623,7 +2621,7 @@ const MgInputPassword = class {
|
|
|
2623
2621
|
this.helpText = undefined;
|
|
2624
2622
|
this.valid = undefined;
|
|
2625
2623
|
this.invalid = undefined;
|
|
2626
|
-
this.classCollection = new
|
|
2624
|
+
this.classCollection = new Ie(['mg-c-input--password']);
|
|
2627
2625
|
this.errorMessage = undefined;
|
|
2628
2626
|
this.displayPassword = false;
|
|
2629
2627
|
}
|
|
@@ -2681,7 +2679,7 @@ const MgInputPassword = class {
|
|
|
2681
2679
|
if (typeof valid !== 'boolean') {
|
|
2682
2680
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean');
|
|
2683
2681
|
}
|
|
2684
|
-
else if (!
|
|
2682
|
+
else if (!Ze(errorMessage)) {
|
|
2685
2683
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string');
|
|
2686
2684
|
}
|
|
2687
2685
|
else {
|
|
@@ -2828,11 +2826,22 @@ const MgInputRadio = class {
|
|
|
2828
2826
|
this.helpText = undefined;
|
|
2829
2827
|
this.valid = undefined;
|
|
2830
2828
|
this.invalid = undefined;
|
|
2831
|
-
this.classCollection = new
|
|
2829
|
+
this.classCollection = new Ie(['mg-c-input--radio', classFieldset]);
|
|
2832
2830
|
this.errorMessage = undefined;
|
|
2833
2831
|
this.options = undefined;
|
|
2832
|
+
this.readonlyValue = undefined;
|
|
2834
2833
|
}
|
|
2835
|
-
|
|
2834
|
+
watchValue(newValue) {
|
|
2835
|
+
var _a;
|
|
2836
|
+
if (Ge(this.items) && typeof newValue === 'string') {
|
|
2837
|
+
this.readonlyValue = newValue;
|
|
2838
|
+
}
|
|
2839
|
+
else if (this.items.every(isOption$2)) {
|
|
2840
|
+
this.readonlyValue = (_a = this.items.find(item => item.value === newValue)) === null || _a === void 0 ? void 0 : _a.title;
|
|
2841
|
+
}
|
|
2842
|
+
else {
|
|
2843
|
+
this.readonlyValue = null;
|
|
2844
|
+
}
|
|
2836
2845
|
this.valueChange.emit(newValue);
|
|
2837
2846
|
}
|
|
2838
2847
|
validateItems(newValue) {
|
|
@@ -2841,7 +2850,7 @@ const MgInputRadio = class {
|
|
|
2841
2850
|
throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
|
|
2842
2851
|
}
|
|
2843
2852
|
// String array
|
|
2844
|
-
else if (
|
|
2853
|
+
else if (Ge(newValue)) {
|
|
2845
2854
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
2846
2855
|
}
|
|
2847
2856
|
// Object array
|
|
@@ -2900,7 +2909,7 @@ const MgInputRadio = class {
|
|
|
2900
2909
|
if (typeof valid !== 'boolean') {
|
|
2901
2910
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean');
|
|
2902
2911
|
}
|
|
2903
|
-
else if (!
|
|
2912
|
+
else if (!Ze(errorMessage)) {
|
|
2904
2913
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string');
|
|
2905
2914
|
}
|
|
2906
2915
|
else {
|
|
@@ -2936,6 +2945,7 @@ const MgInputRadio = class {
|
|
|
2936
2945
|
this.watchInputVerticalList(this.inputVerticalList);
|
|
2937
2946
|
this.watchReadonly(this.readonly);
|
|
2938
2947
|
this.watchDisabled(this.disabled);
|
|
2948
|
+
this.watchValue(this.value);
|
|
2939
2949
|
// Check validity when component is ready
|
|
2940
2950
|
// return a promise to process action only in the FIRST render().
|
|
2941
2951
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
@@ -2948,15 +2958,14 @@ const MgInputRadio = class {
|
|
|
2948
2958
|
* @returns HTML Element
|
|
2949
2959
|
*/
|
|
2950
2960
|
render() {
|
|
2951
|
-
|
|
2952
|
-
return (h("mg-input", { key: 'a987bc86a4bf97aead796cd7c91110cc0e3c90df', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString(), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("ul", { key: 'e5e249a744ecb1f09cdbe7f9ec9d8f44b8b20ece', 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) => {
|
|
2961
|
+
return (h("mg-input", { key: '5c091907a3ac41d272fe2486de715f3a0bd59565', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: this.readonlyValue, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("ul", { key: 'bae1b7f3b6310dcd22448928117e77763c158070', 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) => {
|
|
2953
2962
|
if (el !== null)
|
|
2954
2963
|
this.inputs[index] = el;
|
|
2955
2964
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
|
|
2956
2965
|
}
|
|
2957
2966
|
get element() { return getElement(this); }
|
|
2958
2967
|
static get watchers() { return {
|
|
2959
|
-
"value": ["
|
|
2968
|
+
"value": ["watchValue"],
|
|
2960
2969
|
"items": ["validateItems"],
|
|
2961
2970
|
"inputVerticalList": ["watchInputVerticalList"],
|
|
2962
2971
|
"readonly": ["watchReadonly", "handleValidityChange"],
|
|
@@ -3047,7 +3056,7 @@ const MgInputSelect = class {
|
|
|
3047
3056
|
if (this.input.value === '') {
|
|
3048
3057
|
this.setValue(null);
|
|
3049
3058
|
}
|
|
3050
|
-
else if (
|
|
3059
|
+
else if (Ge(this.items) && this.items.includes(this.input.value)) {
|
|
3051
3060
|
this.setValue(this.input.value);
|
|
3052
3061
|
}
|
|
3053
3062
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3121,7 +3130,7 @@ const MgInputSelect = class {
|
|
|
3121
3130
|
this.helpText = undefined;
|
|
3122
3131
|
this.valid = undefined;
|
|
3123
3132
|
this.invalid = undefined;
|
|
3124
|
-
this.classCollection = new
|
|
3133
|
+
this.classCollection = new Ie(['mg-c-input--select']);
|
|
3125
3134
|
this.errorMessage = undefined;
|
|
3126
3135
|
this.options = undefined;
|
|
3127
3136
|
this.valueExist = undefined;
|
|
@@ -3129,7 +3138,7 @@ const MgInputSelect = class {
|
|
|
3129
3138
|
}
|
|
3130
3139
|
validateValue(newValue) {
|
|
3131
3140
|
var _a, _b;
|
|
3132
|
-
if (
|
|
3141
|
+
if (Ge(this.items) && typeof newValue === 'string') {
|
|
3133
3142
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
|
|
3134
3143
|
}
|
|
3135
3144
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3146,7 +3155,7 @@ const MgInputSelect = class {
|
|
|
3146
3155
|
this.options = [];
|
|
3147
3156
|
}
|
|
3148
3157
|
// String array
|
|
3149
|
-
else if (
|
|
3158
|
+
else if (Ge(newValue)) {
|
|
3150
3159
|
if (typeof this.value === 'string')
|
|
3151
3160
|
this.valueExist = newValue.includes(this.value);
|
|
3152
3161
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3218,7 +3227,7 @@ const MgInputSelect = class {
|
|
|
3218
3227
|
if (typeof valid !== 'boolean') {
|
|
3219
3228
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean');
|
|
3220
3229
|
}
|
|
3221
|
-
else if (!
|
|
3230
|
+
else if (!Ze(errorMessage)) {
|
|
3222
3231
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string');
|
|
3223
3232
|
}
|
|
3224
3233
|
else {
|
|
@@ -3271,11 +3280,11 @@ const MgInputSelect = class {
|
|
|
3271
3280
|
* @returns HTML Element
|
|
3272
3281
|
*/
|
|
3273
3282
|
render() {
|
|
3274
|
-
return (h("mg-input", { key: '
|
|
3283
|
+
return (h("mg-input", { key: 'a5826f3afc824d081a9bef4237a1d0dbd440a2f3', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonlyValue: this.readonlyValue, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, h("select", { key: '709c0a75f1a644b306dcc37207369d0e3a9463e4', 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) => {
|
|
3275
3284
|
if (el !== null)
|
|
3276
3285
|
this.input = el;
|
|
3277
3286
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
3278
|
-
h("option", { key: '
|
|
3287
|
+
h("option", { key: '9e5f8961c712a4bee4ffd1656ae89a78ced5181b', value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => isOptGroup(option) ? (h("optgroup", { label: option.group, key: option.group }, option.options.map(this.renderOption))) : (isOption$1(option) && this.renderOption(option))))));
|
|
3279
3288
|
}
|
|
3280
3289
|
get element() { return getElement(this); }
|
|
3281
3290
|
static get watchers() { return {
|
|
@@ -3330,7 +3339,7 @@ const MgInputText = class {
|
|
|
3330
3339
|
*/
|
|
3331
3340
|
this.handleFocus = () => {
|
|
3332
3341
|
this.classCollection.add(this.classFocus);
|
|
3333
|
-
this.classCollection = new
|
|
3342
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
3334
3343
|
};
|
|
3335
3344
|
/**
|
|
3336
3345
|
* Handle blur event
|
|
@@ -3338,7 +3347,7 @@ const MgInputText = class {
|
|
|
3338
3347
|
this.handleBlur = () => {
|
|
3339
3348
|
// Manage focus
|
|
3340
3349
|
this.classCollection.delete(this.classFocus);
|
|
3341
|
-
this.classCollection = new
|
|
3350
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
3342
3351
|
// Display Error
|
|
3343
3352
|
this.handlerInProgress = Handler.BLUR;
|
|
3344
3353
|
this.displayError().finally(() => {
|
|
@@ -3413,7 +3422,7 @@ const MgInputText = class {
|
|
|
3413
3422
|
this.helpText = undefined;
|
|
3414
3423
|
this.valid = undefined;
|
|
3415
3424
|
this.invalid = undefined;
|
|
3416
|
-
this.classCollection = new
|
|
3425
|
+
this.classCollection = new Ie(['mg-c-input--text']);
|
|
3417
3426
|
this.errorMessage = undefined;
|
|
3418
3427
|
}
|
|
3419
3428
|
handleValue(newValue) {
|
|
@@ -3464,7 +3473,7 @@ const MgInputText = class {
|
|
|
3464
3473
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3465
3474
|
}
|
|
3466
3475
|
validatePattern(newValue) {
|
|
3467
|
-
if (newValue !== undefined && !(
|
|
3476
|
+
if (newValue !== undefined && !(Ze(this.pattern) && Ze(this.patternErrorMessage))) {
|
|
3468
3477
|
throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3469
3478
|
}
|
|
3470
3479
|
}
|
|
@@ -3494,7 +3503,7 @@ const MgInputText = class {
|
|
|
3494
3503
|
if (typeof valid !== 'boolean') {
|
|
3495
3504
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
|
|
3496
3505
|
}
|
|
3497
|
-
else if (!
|
|
3506
|
+
else if (!Ze(errorMessage)) {
|
|
3498
3507
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
|
|
3499
3508
|
}
|
|
3500
3509
|
else {
|
|
@@ -3603,7 +3612,7 @@ const MgInputTextarea = class {
|
|
|
3603
3612
|
*/
|
|
3604
3613
|
this.handleFocus = () => {
|
|
3605
3614
|
this.classCollection.add(this.classFocus);
|
|
3606
|
-
this.classCollection = new
|
|
3615
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
3607
3616
|
};
|
|
3608
3617
|
/**
|
|
3609
3618
|
* Handle blur event
|
|
@@ -3611,7 +3620,7 @@ const MgInputTextarea = class {
|
|
|
3611
3620
|
this.handleBlur = () => {
|
|
3612
3621
|
// Manage focus
|
|
3613
3622
|
this.classCollection.delete(this.classFocus);
|
|
3614
|
-
this.classCollection = new
|
|
3623
|
+
this.classCollection = new Ie(this.classCollection.classes);
|
|
3615
3624
|
// Display Error
|
|
3616
3625
|
this.handlerInProgress = Handler.BLUR;
|
|
3617
3626
|
this.displayError().finally(() => {
|
|
@@ -3674,7 +3683,7 @@ const MgInputTextarea = class {
|
|
|
3674
3683
|
this.valid = undefined;
|
|
3675
3684
|
this.invalid = undefined;
|
|
3676
3685
|
this.resizable = 'none';
|
|
3677
|
-
this.classCollection = new
|
|
3686
|
+
this.classCollection = new Ie(['mg-c-input--textarea']);
|
|
3678
3687
|
this.errorMessage = undefined;
|
|
3679
3688
|
}
|
|
3680
3689
|
handleValue(newValue) {
|
|
@@ -3713,7 +3722,7 @@ const MgInputTextarea = class {
|
|
|
3713
3722
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3714
3723
|
}
|
|
3715
3724
|
validatePattern(newValue) {
|
|
3716
|
-
if (newValue !== undefined && !(
|
|
3725
|
+
if (newValue !== undefined && !(Ze(this.pattern) && Ze(this.patternErrorMessage))) {
|
|
3717
3726
|
throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3718
3727
|
}
|
|
3719
3728
|
}
|
|
@@ -3745,7 +3754,7 @@ const MgInputTextarea = class {
|
|
|
3745
3754
|
if (typeof valid !== 'boolean') {
|
|
3746
3755
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
|
|
3747
3756
|
}
|
|
3748
|
-
else if (!
|
|
3757
|
+
else if (!Ze(errorMessage)) {
|
|
3749
3758
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
|
|
3750
3759
|
}
|
|
3751
3760
|
else {
|
|
@@ -3834,7 +3843,7 @@ const MgInputTitle = class {
|
|
|
3834
3843
|
this.tagName = 'label';
|
|
3835
3844
|
}
|
|
3836
3845
|
validateIdentifier(newValue) {
|
|
3837
|
-
if (!
|
|
3846
|
+
if (!Ze(newValue)) {
|
|
3838
3847
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
3839
3848
|
}
|
|
3840
3849
|
}
|
|
@@ -3948,7 +3957,7 @@ const MgInputToggle = class {
|
|
|
3948
3957
|
this.tooltip = undefined;
|
|
3949
3958
|
this.tooltipPosition = 'input';
|
|
3950
3959
|
this.helpText = undefined;
|
|
3951
|
-
this.classCollection = new
|
|
3960
|
+
this.classCollection = new Ie(['mg-c-input--toggle']);
|
|
3952
3961
|
this.options = undefined;
|
|
3953
3962
|
this.errorMessage = undefined;
|
|
3954
3963
|
this.valid = undefined;
|
|
@@ -3965,7 +3974,7 @@ const MgInputToggle = class {
|
|
|
3965
3974
|
throw new Error('<mg-input-toggle> prop "items" require 2 items.');
|
|
3966
3975
|
}
|
|
3967
3976
|
// String array
|
|
3968
|
-
else if (
|
|
3977
|
+
else if (Ge(newValue)) {
|
|
3969
3978
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
3970
3979
|
}
|
|
3971
3980
|
// Object array
|
|
@@ -4021,7 +4030,7 @@ const MgInputToggle = class {
|
|
|
4021
4030
|
if (typeof valid !== 'boolean') {
|
|
4022
4031
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean');
|
|
4023
4032
|
}
|
|
4024
|
-
else if (!
|
|
4033
|
+
else if (!Ze(errorMessage)) {
|
|
4025
4034
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string');
|
|
4026
4035
|
}
|
|
4027
4036
|
else {
|
|
@@ -4252,7 +4261,7 @@ const MgItemMore = class {
|
|
|
4252
4261
|
if (!proxy)
|
|
4253
4262
|
return;
|
|
4254
4263
|
// remove proxy id to prevent duplicate key. default html id is: '';
|
|
4255
|
-
if (
|
|
4264
|
+
if (Ze(proxy.id))
|
|
4256
4265
|
proxy.id = '';
|
|
4257
4266
|
const proxyClickHandler = () => {
|
|
4258
4267
|
this.parentMenu
|
|
@@ -4296,7 +4305,7 @@ const MgItemMore = class {
|
|
|
4296
4305
|
// create item-more menu items element from main menu-items clones
|
|
4297
4306
|
this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
|
|
4298
4307
|
// we need to get all `mg-menu-item` linked to the cloned one to set mirror process
|
|
4299
|
-
|
|
4308
|
+
Ye(() => {
|
|
4300
4309
|
if (child.querySelector('mg-menu')) {
|
|
4301
4310
|
child.querySelectorAll('mg-menu-item').forEach(this.setProxyElement);
|
|
4302
4311
|
}
|
|
@@ -4622,7 +4631,7 @@ const MgMenuItem = class {
|
|
|
4622
4631
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
4623
4632
|
['label', 'metadata'].forEach(slot => {
|
|
4624
4633
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
4625
|
-
if (!
|
|
4634
|
+
if (!Ze(element.textContent))
|
|
4626
4635
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
4627
4636
|
if ((guard && element.getAttribute('title') === null) || !guard)
|
|
4628
4637
|
element.setAttribute('title', element.textContent);
|
|
@@ -4691,13 +4700,13 @@ const MgMenuItem = class {
|
|
|
4691
4700
|
* @returns HTML Element
|
|
4692
4701
|
*/
|
|
4693
4702
|
this.renderSlot = () => h("slot", null);
|
|
4694
|
-
this.identifier =
|
|
4703
|
+
this.identifier = ze('mg-menu-item');
|
|
4695
4704
|
this.href = undefined;
|
|
4696
4705
|
this.target = undefined;
|
|
4697
4706
|
this.status = Status$1.VISIBLE;
|
|
4698
4707
|
this.expanded = false;
|
|
4699
4708
|
this.size = 'regular';
|
|
4700
|
-
this.navigationButtonClassList = new
|
|
4709
|
+
this.navigationButtonClassList = new Ie([this.navigationButton]);
|
|
4701
4710
|
this.direction = undefined;
|
|
4702
4711
|
this.isInMainMenu = undefined;
|
|
4703
4712
|
this.isItemMore = undefined;
|
|
@@ -4844,7 +4853,7 @@ const MgMenuItem = class {
|
|
|
4844
4853
|
* Emit event when component is updated
|
|
4845
4854
|
*/
|
|
4846
4855
|
componentShouldUpdate() {
|
|
4847
|
-
return
|
|
4856
|
+
return Ye(() => {
|
|
4848
4857
|
this.itemUpdated.emit();
|
|
4849
4858
|
});
|
|
4850
4859
|
}
|
|
@@ -4951,13 +4960,13 @@ const MgMessage = class {
|
|
|
4951
4960
|
return 'exclamation-circle';
|
|
4952
4961
|
}
|
|
4953
4962
|
};
|
|
4954
|
-
this.identifier =
|
|
4963
|
+
this.identifier = ze('mg-message');
|
|
4955
4964
|
this.delay = undefined;
|
|
4956
4965
|
this.variant = variants$1[0];
|
|
4957
4966
|
this.closeButton = false;
|
|
4958
4967
|
this.hide = false;
|
|
4959
4968
|
this.noAriaRole = undefined;
|
|
4960
|
-
this.classCollection = new
|
|
4969
|
+
this.classCollection = new Ie(['mg-c-message']);
|
|
4961
4970
|
this.hasActions = false;
|
|
4962
4971
|
}
|
|
4963
4972
|
validateDelay(newValue) {
|
|
@@ -5100,12 +5109,12 @@ const MgModal = class {
|
|
|
5100
5109
|
*/
|
|
5101
5110
|
this.setFocus = () => {
|
|
5102
5111
|
// Get all focusable elements
|
|
5103
|
-
const slottedFocusableElements = Array.from(this.element.querySelectorAll(
|
|
5112
|
+
const slottedFocusableElements = Array.from(this.element.querySelectorAll(Ke));
|
|
5104
5113
|
// If close button is enabled or at least one of the slotted element is focusable
|
|
5105
5114
|
if (this.closeButton || slottedFocusableElements.length > 0) {
|
|
5106
5115
|
// Check if slotted focusable elements have shadowDom with focusable elements
|
|
5107
5116
|
this.modalFocusableElements = slottedFocusableElements.reduce((acc, focusableElement) => {
|
|
5108
|
-
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(
|
|
5117
|
+
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(Ke) || focusableElement : focusableElement);
|
|
5109
5118
|
return acc;
|
|
5110
5119
|
}, []);
|
|
5111
5120
|
// When close button is enabled it's the first focusable element.
|
|
@@ -5127,21 +5136,21 @@ const MgModal = class {
|
|
|
5127
5136
|
this.handleClose = () => {
|
|
5128
5137
|
this.hide = true;
|
|
5129
5138
|
};
|
|
5130
|
-
this.identifier =
|
|
5139
|
+
this.identifier = ze('mg-modal');
|
|
5131
5140
|
this.dialogRole = dialogRoles[0];
|
|
5132
5141
|
this.modalTitle = undefined;
|
|
5133
5142
|
this.closeButton = false;
|
|
5134
5143
|
this.hide = undefined;
|
|
5135
5144
|
this.hasActions = false;
|
|
5136
5145
|
this.hasContent = false;
|
|
5137
|
-
this.classCollection = new
|
|
5146
|
+
this.classCollection = new Ie(['mg-c-modal']);
|
|
5138
5147
|
}
|
|
5139
5148
|
validateDialogRole(newValue) {
|
|
5140
5149
|
if (!dialogRoles.includes(newValue))
|
|
5141
5150
|
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}.`);
|
|
5142
5151
|
}
|
|
5143
5152
|
validateModalTitle(newValue) {
|
|
5144
|
-
if (!
|
|
5153
|
+
if (!Ze(newValue)) {
|
|
5145
5154
|
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
5146
5155
|
}
|
|
5147
5156
|
}
|
|
@@ -5288,7 +5297,7 @@ const MgPagination = class {
|
|
|
5288
5297
|
this.handleGoToPage = (action, disabled) => {
|
|
5289
5298
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
5290
5299
|
};
|
|
5291
|
-
this.identifier =
|
|
5300
|
+
this.identifier = ze('mg-pagination');
|
|
5292
5301
|
this.label = undefined;
|
|
5293
5302
|
this.hideNavigationLabels = undefined;
|
|
5294
5303
|
this.hidePageCount = undefined;
|
|
@@ -5453,7 +5462,7 @@ const MgPanel = class {
|
|
|
5453
5462
|
];
|
|
5454
5463
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5455
5464
|
};
|
|
5456
|
-
this.identifier =
|
|
5465
|
+
this.identifier = ze('mg-panel');
|
|
5457
5466
|
this.panelTitle = undefined;
|
|
5458
5467
|
this.titlePattern = undefined;
|
|
5459
5468
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -5462,12 +5471,12 @@ const MgPanel = class {
|
|
|
5462
5471
|
this.expanded = false;
|
|
5463
5472
|
this.expandToggleDisplay = expandToggleDisplays[0];
|
|
5464
5473
|
this.expandToggleDisabled = undefined;
|
|
5465
|
-
this.classCollection = new
|
|
5474
|
+
this.classCollection = new Ie(['mg-c-panel']);
|
|
5466
5475
|
this.isEditing = false;
|
|
5467
5476
|
this.updatedPanelTitle = undefined;
|
|
5468
5477
|
}
|
|
5469
5478
|
validatePanelTitle(newValue) {
|
|
5470
|
-
if (!
|
|
5479
|
+
if (!Ze(newValue))
|
|
5471
5480
|
throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
5472
5481
|
this.titleChange.emit(newValue);
|
|
5473
5482
|
}
|
|
@@ -7418,7 +7427,7 @@ const MgPopover = class {
|
|
|
7418
7427
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7419
7428
|
}
|
|
7420
7429
|
};
|
|
7421
|
-
this.identifier =
|
|
7430
|
+
this.identifier = ze('mg-popover');
|
|
7422
7431
|
this.placement = 'bottom';
|
|
7423
7432
|
this.arrowHide = false;
|
|
7424
7433
|
this.closeButton = false;
|
|
@@ -7461,7 +7470,7 @@ const MgPopover = class {
|
|
|
7461
7470
|
*/
|
|
7462
7471
|
componentWillLoad() {
|
|
7463
7472
|
// Get windows to attach events
|
|
7464
|
-
this.windows =
|
|
7473
|
+
this.windows = Qe(window);
|
|
7465
7474
|
// render mg-popover-content slot
|
|
7466
7475
|
this.renderPopoverContent();
|
|
7467
7476
|
this.validateCloseButton(this.closeButton);
|
|
@@ -7553,7 +7562,7 @@ const MgPopoverContent = class {
|
|
|
7553
7562
|
this.hideContent.emit();
|
|
7554
7563
|
};
|
|
7555
7564
|
this.closeButton = false;
|
|
7556
|
-
this.classCollection = new
|
|
7565
|
+
this.classCollection = new Ie(['mg-c-popover-content']);
|
|
7557
7566
|
}
|
|
7558
7567
|
/*************
|
|
7559
7568
|
* Lifecycle *
|
|
@@ -7571,7 +7580,7 @@ const MgPopoverContent = class {
|
|
|
7571
7580
|
componentDidLoad() {
|
|
7572
7581
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7573
7582
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
7574
|
-
if (slottedTitleElement && !
|
|
7583
|
+
if (slottedTitleElement && !Xe(slottedTitleElement, headingTags)) {
|
|
7575
7584
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
7576
7585
|
}
|
|
7577
7586
|
}
|
|
@@ -7607,7 +7616,7 @@ const MgSkipLinks = class {
|
|
|
7607
7616
|
this.links = undefined;
|
|
7608
7617
|
}
|
|
7609
7618
|
validateLinks(links) {
|
|
7610
|
-
if (links === undefined || links.length === 0 || links.some(link => !
|
|
7619
|
+
if (links === undefined || links.length === 0 || links.some(link => !Ze(link.href) || !link.href.startsWith('#') || !Ze(link.label))) {
|
|
7611
7620
|
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.`);
|
|
7612
7621
|
}
|
|
7613
7622
|
}
|
|
@@ -7626,7 +7635,7 @@ const MgSkipLinks = class {
|
|
|
7626
7635
|
* @returns HTML Element
|
|
7627
7636
|
*/
|
|
7628
7637
|
render() {
|
|
7629
|
-
return (h("nav", { key: '
|
|
7638
|
+
return (h("nav", { key: 'e5a7020edfe2e491af48785f3d9fa9bede770ae5', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: 'da692631900bb61269803e93718d0dacdb6a5e8a', 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)))))));
|
|
7630
7639
|
}
|
|
7631
7640
|
get element() { return getElement(this); }
|
|
7632
7641
|
static get watchers() { return {
|
|
@@ -7759,7 +7768,7 @@ const MgTabs = class {
|
|
|
7759
7768
|
*/
|
|
7760
7769
|
this.resetFocus = () => {
|
|
7761
7770
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7762
|
-
|
|
7771
|
+
Ye(() => {
|
|
7763
7772
|
this.tabFocus = undefined;
|
|
7764
7773
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7765
7774
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7774,16 +7783,16 @@ const MgTabs = class {
|
|
|
7774
7783
|
if (slots.length !== this.tabs.length)
|
|
7775
7784
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7776
7785
|
};
|
|
7777
|
-
this.identifier =
|
|
7786
|
+
this.identifier = ze('mg-tabs');
|
|
7778
7787
|
this.label = undefined;
|
|
7779
7788
|
this.size = 'regular';
|
|
7780
7789
|
this.items = undefined;
|
|
7781
7790
|
this.activeTab = undefined;
|
|
7782
7791
|
this.tabs = [];
|
|
7783
|
-
this.classCollection = new
|
|
7792
|
+
this.classCollection = new Ie(['mg-c-tabs']);
|
|
7784
7793
|
}
|
|
7785
7794
|
validateLabel(newValue) {
|
|
7786
|
-
if (!
|
|
7795
|
+
if (!Ze(newValue)) {
|
|
7787
7796
|
throw new Error('<mg-tabs> prop "label" is required.');
|
|
7788
7797
|
}
|
|
7789
7798
|
}
|
|
@@ -7795,7 +7804,7 @@ const MgTabs = class {
|
|
|
7795
7804
|
}
|
|
7796
7805
|
validateItems(newValue) {
|
|
7797
7806
|
// String array
|
|
7798
|
-
if (
|
|
7807
|
+
if (Ge(newValue))
|
|
7799
7808
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
7800
7809
|
// Object array
|
|
7801
7810
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
@@ -7895,7 +7904,7 @@ const MgTag = class {
|
|
|
7895
7904
|
this.variant = variants[0];
|
|
7896
7905
|
this.outline = undefined;
|
|
7897
7906
|
this.soft = undefined;
|
|
7898
|
-
this.classCollection = new
|
|
7907
|
+
this.classCollection = new Ie(['mg-c-tag']);
|
|
7899
7908
|
}
|
|
7900
7909
|
validateVariant(newValue, oldValue) {
|
|
7901
7910
|
if (!variants.includes(newValue)) {
|
|
@@ -7932,7 +7941,7 @@ const MgTag = class {
|
|
|
7932
7941
|
* @param textContent - html element textContent property
|
|
7933
7942
|
*/
|
|
7934
7943
|
validateTextContent(textContent) {
|
|
7935
|
-
if (!
|
|
7944
|
+
if (!Ze(textContent))
|
|
7936
7945
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
7937
7946
|
}
|
|
7938
7947
|
/*************
|
|
@@ -7992,7 +8001,7 @@ const MgTooltip = class {
|
|
|
7992
8001
|
// Enable the event listeners
|
|
7993
8002
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7994
8003
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7995
|
-
|
|
8004
|
+
Ye(() => {
|
|
7996
8005
|
this.windows.forEach((localWindow) => {
|
|
7997
8006
|
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
7998
8007
|
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
@@ -8182,7 +8191,7 @@ const MgTooltip = class {
|
|
|
8182
8191
|
element.setAttribute('aria-describedby', `${[...new Set([...ariaDescribedby.split(' '), this.identifier])].join(' ')}`);
|
|
8183
8192
|
}
|
|
8184
8193
|
};
|
|
8185
|
-
this.identifier =
|
|
8194
|
+
this.identifier = ze('mg-tooltip');
|
|
8186
8195
|
this.message = undefined;
|
|
8187
8196
|
this.placement = 'bottom';
|
|
8188
8197
|
this.display = false;
|
|
@@ -8193,7 +8202,7 @@ const MgTooltip = class {
|
|
|
8193
8202
|
this.renderTooltipContent();
|
|
8194
8203
|
}
|
|
8195
8204
|
watchMessage(newValue) {
|
|
8196
|
-
if (!
|
|
8205
|
+
if (!Ze(newValue)) {
|
|
8197
8206
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
8198
8207
|
}
|
|
8199
8208
|
this.mgTooltipContent.message = newValue;
|
|
@@ -8248,7 +8257,7 @@ const MgTooltip = class {
|
|
|
8248
8257
|
*/
|
|
8249
8258
|
componentWillLoad() {
|
|
8250
8259
|
// Get windows to attach events
|
|
8251
|
-
this.windows =
|
|
8260
|
+
this.windows = Qe(window);
|
|
8252
8261
|
// Get tooltip element
|
|
8253
8262
|
this.renderTooltipContent();
|
|
8254
8263
|
//validate properties
|
|
@@ -8266,7 +8275,7 @@ const MgTooltip = class {
|
|
|
8266
8275
|
// get slotted element wich is not the tooltip
|
|
8267
8276
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
8268
8277
|
// Get interactive element
|
|
8269
|
-
const interactiveElement = slotElement.matches(
|
|
8278
|
+
const interactiveElement = slotElement.matches(Ke) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(Ke);
|
|
8270
8279
|
this.setTooltipedElement(interactiveElement || slotElement);
|
|
8271
8280
|
// Check if slotted element is a disabled mg-button
|
|
8272
8281
|
// In this case we wrap the mg-button into a div to enable the tooltip
|