@mgdis/mg-components 6.1.0 → 6.2.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-e4a8bf81.js → index-52d5f3d4.js} +16 -6
- package/dist/cjs/index-52d5f3d4.js.map +1 -0
- package/dist/{esm/index-d8f69946.js → cjs/index-cc11af95.js} +6 -116
- package/dist/cjs/index-cc11af95.js.map +1 -0
- package/dist/cjs/index.es-ac7c22e3.js +152 -0
- package/dist/cjs/index.es-ac7c22e3.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +324 -216
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +7 -6
- package/dist/cjs/mg-alert.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 +5 -4
- package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-progress.cjs.entry.js +82 -0
- package/dist/cjs/mg-progress.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +8 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -1
- 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.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +33 -26
- 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 +30 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +85 -4
- 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 +29 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +30 -3
- 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 +29 -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 +29 -2
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +29 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +30 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -4
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +32 -2
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.conf.js +5 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +187 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.js.map +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/types/index.js.map +1 -1
- package/dist/components/index.es.js +26 -13
- 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-button2.js +10 -4
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-form.js +19 -5
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +20 -29
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +18 -5
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +29 -7
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +14 -2
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +15 -2
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +14 -2
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +14 -2
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +14 -2
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-toggle.js +15 -2
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-input2.js.map +1 -1
- package/dist/components/mg-item-more2.js +5 -6
- package/dist/components/mg-item-more2.js.map +1 -1
- package/dist/components/mg-menu-item2.js +3 -3
- package/dist/components/mg-modal.js +2 -2
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +2 -2
- package/dist/components/mg-popover2.js +2 -2
- package/dist/components/mg-progress.d.ts +11 -0
- package/dist/components/mg-progress.js +109 -0
- package/dist/components/mg-progress.js.map +1 -0
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs.js +4 -4
- package/dist/components/mg-tooltip2.js +3 -3
- package/dist/esm/{index-e26aede5.js → index-81752ffe.js} +16 -6
- package/dist/esm/index-81752ffe.js.map +1 -0
- package/dist/{cjs/index-0fe2670c.js → esm/index-f3d3fb70.js} +4 -135
- package/dist/esm/index-f3d3fb70.js.map +1 -0
- package/dist/esm/index.es-940821a9.js +130 -0
- package/dist/esm/index.es-940821a9.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +175 -67
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +3 -2
- package/dist/esm/mg-alert.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 -2
- package/dist/esm/mg-loader.entry.js.map +1 -1
- package/dist/esm/mg-progress.entry.js +78 -0
- package/dist/esm/mg-progress.entry.js.map +1 -0
- package/dist/mg-components/mg-components.css +1 -1
- 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-2298352f.js +3 -0
- package/dist/mg-components/p-2298352f.js.map +1 -0
- package/dist/mg-components/p-31e6c1a7.entry.js +2 -0
- package/dist/mg-components/{p-9beb09e5.entry.js.map → p-31e6c1a7.entry.js.map} +1 -1
- package/dist/mg-components/p-67c9be27.entry.js +2 -0
- package/dist/mg-components/p-67c9be27.entry.js.map +1 -0
- package/dist/mg-components/p-95895169.entry.js +2 -0
- package/dist/mg-components/{p-5c77f5dd.entry.js.map → p-95895169.entry.js.map} +1 -1
- package/dist/mg-components/p-a49e2b74.js +2 -0
- package/dist/mg-components/p-a49e2b74.js.map +1 -0
- package/dist/mg-components/p-abddacc2.entry.js +2 -0
- package/dist/mg-components/p-abddacc2.entry.js.map +1 -0
- package/dist/mg-components/p-ee51ec5e.js +2 -0
- package/dist/mg-components/p-ee51ec5e.js.map +1 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +13 -11
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +0 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -9
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +12 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -0
- package/dist/types/components/molecules/mg-form/mg-form.conf.d.ts +2 -1
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +4 -0
- package/dist/types/components/molecules/mg-progress/mg-progress.conf.d.ts +9 -0
- package/dist/types/components/molecules/mg-progress/mg-progress.d.ts +47 -0
- package/dist/types/components.d.ts +111 -0
- package/dist/types/stencil-public-runtime.d.ts +2 -0
- package/dist/types/types/index.d.ts +4 -0
- package/ide/intellij/web-types.json +183 -15
- package/ide/vscode/css-custom-data.json +16 -0
- package/ide/vscode/html-custom-data.json +150 -11
- package/package.json +25 -25
- package/dist/cjs/index-0fe2670c.js.map +0 -1
- package/dist/cjs/index-e4a8bf81.js.map +0 -1
- package/dist/esm/index-d8f69946.js.map +0 -1
- package/dist/esm/index-e26aede5.js.map +0 -1
- package/dist/mg-components/p-1fbb6ee7.js +0 -3
- package/dist/mg-components/p-1fbb6ee7.js.map +0 -1
- package/dist/mg-components/p-5c77f5dd.entry.js +0 -2
- package/dist/mg-components/p-9beb09e5.entry.js +0 -2
- package/dist/mg-components/p-c9934e81.js +0 -2
- package/dist/mg-components/p-c9934e81.js.map +0 -1
- package/dist/mg-components/p-d7dde2ac.entry.js +0 -2
- package/dist/mg-components/p-d7dde2ac.entry.js.map +0 -1
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const
|
|
5
|
+
const index = require('./index-52d5f3d4.js');
|
|
6
|
+
const index_es = require('./index.es-ac7c22e3.js');
|
|
7
|
+
const index$1 = require('./index-cc11af95.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Available menu item status values
|
|
@@ -76,7 +77,7 @@ const MgActionMore = class {
|
|
|
76
77
|
************/
|
|
77
78
|
this.name = 'mg-action-more';
|
|
78
79
|
this.classBase = 'mg-c-action-more';
|
|
79
|
-
this.mgPopoverIdentifier =
|
|
80
|
+
this.mgPopoverIdentifier = index_es.qe(this.name);
|
|
80
81
|
/************
|
|
81
82
|
* Methods *
|
|
82
83
|
***********/
|
|
@@ -116,15 +117,15 @@ const MgActionMore = class {
|
|
|
116
117
|
}
|
|
117
118
|
validateItems(newValue) {
|
|
118
119
|
if (!isMgActionMoreItems(newValue)) {
|
|
119
|
-
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${
|
|
120
|
+
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
120
121
|
}
|
|
121
122
|
else if (isMgActionMoreItems(newValue) && newValue.length > 0 && (isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {
|
|
122
|
-
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${
|
|
123
|
+
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${index_es.Ye(newValue)}.`);
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
validateIcon(newValue) {
|
|
126
127
|
if (newValue && !isMgActionMoreIcon(newValue)) {
|
|
127
|
-
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${
|
|
128
|
+
throw new Error(`<${this.name}> prop "icon" must match MgActionMoreIconType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
128
129
|
}
|
|
129
130
|
else if ((newValue === null || newValue === void 0 ? void 0 : newValue.icon) === undefined && Boolean(this.button.isIcon)) {
|
|
130
131
|
this.icon = { icon: 'ellipsis' };
|
|
@@ -132,7 +133,7 @@ const MgActionMore = class {
|
|
|
132
133
|
}
|
|
133
134
|
validateButton(newValue) {
|
|
134
135
|
if (newValue && !isMgActionMoreButton(newValue)) {
|
|
135
|
-
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${
|
|
136
|
+
throw new Error(`<${this.name}> prop "button" must match MgActionMoreButtonType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
validateDisplayChevron(newValue) {
|
|
@@ -203,21 +204,21 @@ const MgBadge = class {
|
|
|
203
204
|
this.label = undefined;
|
|
204
205
|
this.variant = variants$4[0];
|
|
205
206
|
this.outline = undefined;
|
|
206
|
-
this.classCollection = new
|
|
207
|
+
this.classCollection = new index_es.Xe(['mg-c-badge']);
|
|
207
208
|
}
|
|
208
209
|
validateValue(newValue) {
|
|
209
210
|
if (/^[^A-Z]+$/i.exec(`${newValue}`) === null) {
|
|
210
|
-
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${
|
|
211
|
+
throw new Error(`<mg-badge> prop "value" is required and must be integer and/or special character. Passed value: ${index_es.Ye(newValue)}.`);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
validateLabel(newValue) {
|
|
214
|
-
if (!
|
|
215
|
-
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${
|
|
215
|
+
if (!index_es.me(newValue)) {
|
|
216
|
+
throw new Error(`<mg-badge> prop "label" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
validateVariant(newValue, oldValue) {
|
|
219
220
|
if (!variants$4.includes(newValue)) {
|
|
220
|
-
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${
|
|
221
|
+
throw new Error(`<mg-badge> prop "variant" must be one of: ${variants$4.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
221
222
|
}
|
|
222
223
|
else {
|
|
223
224
|
if (oldValue !== undefined) {
|
|
@@ -321,11 +322,17 @@ const MgButton = class {
|
|
|
321
322
|
this.isIcon = false;
|
|
322
323
|
this.disableOnClick = false;
|
|
323
324
|
this.loading = false;
|
|
324
|
-
this.classCollection = new
|
|
325
|
+
this.classCollection = new index_es.Xe(['mg-c-button']);
|
|
325
326
|
}
|
|
326
327
|
validateVariant(newValue, oldValue) {
|
|
328
|
+
// validate new value
|
|
327
329
|
if (!variants$3.includes(newValue)) {
|
|
328
|
-
|
|
330
|
+
if (newValue === '') {
|
|
331
|
+
// Reactive framework like VUE render with `""` when prop is update to undefined
|
|
332
|
+
this.variant = variants$3[0];
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
329
336
|
}
|
|
330
337
|
else {
|
|
331
338
|
if (oldValue !== undefined) {
|
|
@@ -380,7 +387,7 @@ const MgButton = class {
|
|
|
380
387
|
this.validateFullWidth(this.fullWidth);
|
|
381
388
|
if (this.isIcon) {
|
|
382
389
|
this.classCollection.add(`mg-c-button--icon`);
|
|
383
|
-
if (!
|
|
390
|
+
if (!index_es.me(this.label)) {
|
|
384
391
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
385
392
|
}
|
|
386
393
|
}
|
|
@@ -392,7 +399,7 @@ const MgButton = class {
|
|
|
392
399
|
* Add listners
|
|
393
400
|
*/
|
|
394
401
|
componentDidLoad() {
|
|
395
|
-
|
|
402
|
+
index_es.tt(() => {
|
|
396
403
|
var _a;
|
|
397
404
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
398
405
|
// submit buttons should trigger form submition;
|
|
@@ -409,7 +416,7 @@ const MgButton = class {
|
|
|
409
416
|
*/
|
|
410
417
|
render() {
|
|
411
418
|
var _a;
|
|
412
|
-
return (index.h(index.Host, { key: '
|
|
419
|
+
return (index.h(index.Host, { key: '0e3996123ef570a493d645b7a24d4271f13ae7c4', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, index.h("div", { key: 'bef43bda72867ea981814bdeda110d2dec4306f9', class: this.classCollection.join() }, this.loading && index.h("mg-icon", { key: 'e5754f3ca96f24da369e0961ced9f119b22b8878', icon: "loader", spin: true }), index.h("div", { key: '20afb713a15e3a003dc4fd0a5470aa764246858e', class: "mg-c-button__content" }, index.h("slot", { key: 'd0468692516ebc044a14dedbba96d74791552bd1' })))));
|
|
413
420
|
}
|
|
414
421
|
get element() { return index.getElement(this); }
|
|
415
422
|
static get watchers() { return {
|
|
@@ -452,13 +459,13 @@ const MgCharacterLeft = class {
|
|
|
452
459
|
this.maxlength = undefined;
|
|
453
460
|
}
|
|
454
461
|
watchIdentifier(newValue) {
|
|
455
|
-
if (newValue !== undefined && !
|
|
456
|
-
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${
|
|
462
|
+
if (newValue !== undefined && !index_es.Ge(newValue)) {
|
|
463
|
+
console.error(`<mg-character-left> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
457
464
|
}
|
|
458
465
|
}
|
|
459
466
|
validateMaxlength(newValue) {
|
|
460
467
|
if (typeof newValue !== 'number') {
|
|
461
|
-
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${
|
|
468
|
+
throw new Error(`<mg-character-left> prop "maxlength" is required and must be a number. Passed value: ${index_es.Ye(newValue)}.`);
|
|
462
469
|
}
|
|
463
470
|
}
|
|
464
471
|
/*************
|
|
@@ -506,7 +513,7 @@ const MgDetails = class {
|
|
|
506
513
|
this.expanded = false;
|
|
507
514
|
}
|
|
508
515
|
validateTitles(newValue) {
|
|
509
|
-
if (!
|
|
516
|
+
if (!index_es.me(newValue)) {
|
|
510
517
|
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}'".`);
|
|
511
518
|
}
|
|
512
519
|
}
|
|
@@ -646,7 +653,7 @@ const MgForm = class {
|
|
|
646
653
|
*/
|
|
647
654
|
this.setMgInputs = () => {
|
|
648
655
|
// Get slotted mgInputs
|
|
649
|
-
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT
|
|
656
|
+
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT'));
|
|
650
657
|
// Set inputs readonly or disabled based on form configuration
|
|
651
658
|
// Othewise listen to events
|
|
652
659
|
this.mgInputs.forEach(input => {
|
|
@@ -664,7 +671,7 @@ const MgForm = class {
|
|
|
664
671
|
}
|
|
665
672
|
});
|
|
666
673
|
};
|
|
667
|
-
this.identifier =
|
|
674
|
+
this.identifier = index_es.qe('mg-form');
|
|
668
675
|
this.name = this.identifier;
|
|
669
676
|
this.readonly = false;
|
|
670
677
|
this.requiredMessage = undefined;
|
|
@@ -673,22 +680,22 @@ const MgForm = class {
|
|
|
673
680
|
this.disabled = false;
|
|
674
681
|
this.valid = undefined;
|
|
675
682
|
this.invalid = undefined;
|
|
676
|
-
this.classCollection = new
|
|
683
|
+
this.classCollection = new index_es.Xe(['mg-c-form']);
|
|
677
684
|
this.requiredMessageText = undefined;
|
|
678
685
|
}
|
|
679
686
|
watchIdentifier(newValue) {
|
|
680
|
-
if (!
|
|
681
|
-
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${
|
|
687
|
+
if (!index_es.Ge(newValue)) {
|
|
688
|
+
console.error(`<mg-form> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
682
689
|
}
|
|
683
690
|
}
|
|
684
691
|
validateRequiredMessage(newValue) {
|
|
685
692
|
if (newValue && !requiredMessageStatus.includes(newValue)) {
|
|
686
|
-
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${
|
|
693
|
+
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
687
694
|
}
|
|
688
695
|
}
|
|
689
696
|
validateAriaRole(newValue) {
|
|
690
697
|
if (newValue && !roles.includes(newValue)) {
|
|
691
|
-
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${
|
|
698
|
+
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
692
699
|
}
|
|
693
700
|
}
|
|
694
701
|
handlelabelOnTop(newValue) {
|
|
@@ -715,6 +722,18 @@ const MgForm = class {
|
|
|
715
722
|
this.checkValidity();
|
|
716
723
|
}
|
|
717
724
|
}
|
|
725
|
+
/**
|
|
726
|
+
* Reset form inputs values, validity and error state
|
|
727
|
+
*/
|
|
728
|
+
async reset() {
|
|
729
|
+
if (!this.readonly) {
|
|
730
|
+
await Promise.all(this.mgInputs.map(async (input) => {
|
|
731
|
+
if (input.reset !== undefined) {
|
|
732
|
+
await input.reset();
|
|
733
|
+
}
|
|
734
|
+
}));
|
|
735
|
+
}
|
|
736
|
+
}
|
|
718
737
|
/*************
|
|
719
738
|
* Lifecycle *
|
|
720
739
|
*************/
|
|
@@ -754,6 +773,7 @@ const MgForm = class {
|
|
|
754
773
|
// Update mgInputs when mgForm content change
|
|
755
774
|
new MutationObserver(() => {
|
|
756
775
|
this.setMgInputs();
|
|
776
|
+
this.checkValidity();
|
|
757
777
|
}).observe(this.element, { childList: true });
|
|
758
778
|
}
|
|
759
779
|
/**
|
|
@@ -761,7 +781,7 @@ const MgForm = class {
|
|
|
761
781
|
* @returns HTML Element
|
|
762
782
|
*/
|
|
763
783
|
render() {
|
|
764
|
-
return (index.h("form", { key: '
|
|
784
|
+
return (index.h("form", { key: 'ecfaff2bb897ce2c48ed352167bb418703a56c98', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && index.h("p", { key: '4d4fa2ff3cf4f25ebe0b009ae1995734bfcafd3b', innerHTML: this.requiredMessageText }), index.h("slot", { key: 'dc0c7acadf6b744335852f847a8336b018e28cb5' }), !this.readonly && !this.disabled && index.h("slot", { key: 'ede3ace32f6a88067845013fa65e5414cae5fcea', name: "actions" })));
|
|
765
785
|
}
|
|
766
786
|
get element() { return index.getElement(this); }
|
|
767
787
|
static get watchers() { return {
|
|
@@ -821,11 +841,11 @@ const MgIcon = class {
|
|
|
821
841
|
this.variant = undefined;
|
|
822
842
|
this.variantStyle = undefined;
|
|
823
843
|
this.spin = false;
|
|
824
|
-
this.classCollection = new
|
|
844
|
+
this.classCollection = new index_es.Xe(['mg-c-icon']);
|
|
825
845
|
}
|
|
826
846
|
validateIcon(newValue, oldValue) {
|
|
827
847
|
if (!Object.keys(icons).includes(newValue))
|
|
828
|
-
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${
|
|
848
|
+
throw new Error(`<mg-icon> prop "icon" must be one of: ${Object.keys(icons).join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
829
849
|
else {
|
|
830
850
|
if (oldValue !== undefined)
|
|
831
851
|
this.classCollection.delete(`mg-c-icon--${oldValue}`);
|
|
@@ -835,7 +855,7 @@ const MgIcon = class {
|
|
|
835
855
|
}
|
|
836
856
|
validateSize(newValue, oldValue) {
|
|
837
857
|
if (!sizes$1.includes(newValue))
|
|
838
|
-
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${
|
|
858
|
+
throw new Error(`<mg-icon> prop "size" must be one of: ${sizes$1.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
839
859
|
else {
|
|
840
860
|
if (oldValue !== undefined)
|
|
841
861
|
this.classCollection.delete(`mg-c-icon--size-${oldValue}`);
|
|
@@ -845,7 +865,7 @@ const MgIcon = class {
|
|
|
845
865
|
validateVariant(newValue, oldValue) {
|
|
846
866
|
if (newValue !== undefined) {
|
|
847
867
|
if (!variants$2.includes(newValue))
|
|
848
|
-
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${
|
|
868
|
+
throw new Error(`<mg-icon> prop "variant" must be one of: ${variants$2.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
849
869
|
else {
|
|
850
870
|
this.setDefaultVariantStyle();
|
|
851
871
|
if (oldValue !== undefined)
|
|
@@ -857,7 +877,7 @@ const MgIcon = class {
|
|
|
857
877
|
validateVariantStyle(newValue, oldValue) {
|
|
858
878
|
if (newValue !== undefined) {
|
|
859
879
|
if (!variantStyles$1.includes(newValue))
|
|
860
|
-
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${
|
|
880
|
+
throw new Error(`<mg-icon> prop "variantStyle" must be one of: ${variantStyles$1.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
861
881
|
else {
|
|
862
882
|
if (oldValue !== undefined)
|
|
863
883
|
this.classCollection.delete(`mg-c-icon--variant-style-${oldValue}`);
|
|
@@ -920,7 +940,7 @@ const MgIllustratedMessage = class {
|
|
|
920
940
|
componentDidLoad() {
|
|
921
941
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
922
942
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
923
|
-
if (!
|
|
943
|
+
if (!index_es.Ke(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
924
944
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
925
945
|
}
|
|
926
946
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -992,11 +1012,11 @@ const MgInput = class {
|
|
|
992
1012
|
this.isVerticalList = false;
|
|
993
1013
|
}
|
|
994
1014
|
watchIdentifier(newValue) {
|
|
995
|
-
if (!
|
|
996
|
-
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${
|
|
1015
|
+
if (!index_es.me(newValue)) {
|
|
1016
|
+
throw new Error(`<mg-input> prop "identifier" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
997
1017
|
}
|
|
998
|
-
else if (!
|
|
999
|
-
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${
|
|
1018
|
+
else if (!index_es.Ge(newValue)) {
|
|
1019
|
+
console.error(`<mg-input> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1000
1020
|
}
|
|
1001
1021
|
else {
|
|
1002
1022
|
this.helpTextId = `${this.identifier}-help-text`;
|
|
@@ -1018,7 +1038,7 @@ const MgInput = class {
|
|
|
1018
1038
|
}
|
|
1019
1039
|
watchTooltipPosition(newValue) {
|
|
1020
1040
|
if (!tooltipPositions.includes(newValue)) {
|
|
1021
|
-
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${
|
|
1041
|
+
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1022
1042
|
}
|
|
1023
1043
|
}
|
|
1024
1044
|
watchErrorMessage(newValue) {
|
|
@@ -1082,8 +1102,8 @@ const MgInput = class {
|
|
|
1082
1102
|
*/
|
|
1083
1103
|
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
1084
1104
|
watchLabel() {
|
|
1085
|
-
if (!
|
|
1086
|
-
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${
|
|
1105
|
+
if (!index_es.me(this.label)) {
|
|
1106
|
+
throw new Error(`<mg-input> prop "label" is required and must be a string. Passed value: ${index_es.Ye(this.label)}.`);
|
|
1087
1107
|
}
|
|
1088
1108
|
else {
|
|
1089
1109
|
this.watchAriaDescribedbyIDs();
|
|
@@ -1216,7 +1236,7 @@ const MgInputCheckboxList = (props) => (index.h("ul", { class: "mg-c-input__inpu
|
|
|
1216
1236
|
var _a, _b;
|
|
1217
1237
|
return (index.h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
|
|
1218
1238
|
index.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 }),
|
|
1219
|
-
index.h("label", { htmlFor: input._id
|
|
1239
|
+
index.h("label", { htmlFor: input._id }, input.title)));
|
|
1220
1240
|
})));
|
|
1221
1241
|
|
|
1222
1242
|
const mgInputCheckboxCss = ".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--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.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--checkbox-multi .mg-c-input__input-group-container{padding:var(--mg-b-size-4) var(--mg-b-size-8);margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container{display:flex;width:unset;flex:unset;flex-wrap:wrap;column-gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container-list{display:flex;flex-flow:row wrap;padding:0;margin:0;gap:var(--mg-b-size-4);list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__sections{max-height:80vh;padding-right:var(--mg-b-size-8);overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header{display:flex;min-height:var(--mg-b-size-min-height);flex-wrap:wrap;flex-wrap:nowrap;align-items:center;gap:var(--mg-b-size-8);text-wrap:nowrap}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-tootlip{display:inline-block;width:auto;height:auto;margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title{display:inline;margin:0;color:var(--mg-b-color-neutral-80)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title-label{font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title--static.mg-c-input__section-header-title{margin:0 var(--mg-b-size-12)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-value{display:inline-flex;min-width:var(--mg-b-size-min-height);min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-radius:var(--mg-b-size-4);background-color:var(--mg-b-color-neutral-20);font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-no-result{text-align:center}.mg-c-input.mg-c-input--checkbox-multi b{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--disabled .mg-c-input__input-container b{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--with-values .mg-c-input__input-container{gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content{display:flex;width:calc(var(--mg-b-size-floating-element-max-width) - var(--mg-b-size-16));height:calc(50*var(--mg-b-size-8));flex-direction:column;gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__section-header-tootlip){margin-left:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-c-card-spacing:var(--mg-b-size-8)}.mg-c-input.mg-c-input--readonly ul{display:flex;min-height:var(--mg-b-font-size);flex-flow:column wrap;padding:0;margin:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) 0 0;list-style:none;row-gap:var(--mg-b-size-8)}";
|
|
@@ -1255,6 +1275,7 @@ const MgInputCheckbox = class {
|
|
|
1255
1275
|
this.updateCheckboxItems('value', Boolean(event.target.checked), item => item._id === event.target.id);
|
|
1256
1276
|
this.updateValues();
|
|
1257
1277
|
this.checkValidity();
|
|
1278
|
+
this.setErrorMessage();
|
|
1258
1279
|
};
|
|
1259
1280
|
/**
|
|
1260
1281
|
* Keyboard handler
|
|
@@ -1281,18 +1302,10 @@ const MgInputCheckbox = class {
|
|
|
1281
1302
|
/**
|
|
1282
1303
|
* Handle blur event
|
|
1283
1304
|
*/
|
|
1284
|
-
this.handleBlur = (
|
|
1285
|
-
if (this.handlerInProgress === 'mouseenter') {
|
|
1286
|
-
event.preventDefault();
|
|
1287
|
-
return;
|
|
1288
|
-
}
|
|
1289
|
-
// set guard
|
|
1290
|
-
this.handlerInProgress = 'blur';
|
|
1305
|
+
this.handleBlur = () => {
|
|
1291
1306
|
// Check validity
|
|
1292
1307
|
this.checkValidity();
|
|
1293
1308
|
this.setErrorMessage();
|
|
1294
|
-
// reset guard
|
|
1295
|
-
this.handlerInProgress = undefined;
|
|
1296
1309
|
};
|
|
1297
1310
|
/**
|
|
1298
1311
|
* Handle input search value-change event
|
|
@@ -1334,18 +1347,6 @@ const MgInputCheckbox = class {
|
|
|
1334
1347
|
});
|
|
1335
1348
|
this.updateValues();
|
|
1336
1349
|
};
|
|
1337
|
-
/**
|
|
1338
|
-
* Handle input label mouseenter event
|
|
1339
|
-
*/
|
|
1340
|
-
this.handleMouseEnter = () => {
|
|
1341
|
-
this.handlerInProgress = 'mouseenter';
|
|
1342
|
-
};
|
|
1343
|
-
/**
|
|
1344
|
-
* Handle input label leave event
|
|
1345
|
-
*/
|
|
1346
|
-
this.handleMouseLeave = () => {
|
|
1347
|
-
this.handlerInProgress = undefined;
|
|
1348
|
-
};
|
|
1349
1350
|
/**
|
|
1350
1351
|
* Update values
|
|
1351
1352
|
*/
|
|
@@ -1354,8 +1355,6 @@ const MgInputCheckbox = class {
|
|
|
1354
1355
|
delete o._handleBlur;
|
|
1355
1356
|
delete o._handleInput;
|
|
1356
1357
|
delete o._handleKeydown;
|
|
1357
|
-
delete o._handleMouseEnter;
|
|
1358
|
-
delete o._handleMouseLeave;
|
|
1359
1358
|
delete o._id;
|
|
1360
1359
|
return o;
|
|
1361
1360
|
});
|
|
@@ -1369,7 +1368,7 @@ const MgInputCheckbox = class {
|
|
|
1369
1368
|
* Method to update searchResults
|
|
1370
1369
|
*/
|
|
1371
1370
|
this.updateSearchResults = () => {
|
|
1372
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
1371
|
+
this.searchResults = this.checkboxItems.filter(item => index_es.et(item.title).includes(index_es.et(this.searchValue)));
|
|
1373
1372
|
};
|
|
1374
1373
|
/**
|
|
1375
1374
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1401,13 +1400,13 @@ const MgInputCheckbox = class {
|
|
|
1401
1400
|
* @returns message to display
|
|
1402
1401
|
*/
|
|
1403
1402
|
this.getSelectValuesButtonMessage = () => {
|
|
1404
|
-
if (this.selectValuesButtonKey === 'editButton' &&
|
|
1403
|
+
if (this.selectValuesButtonKey === 'editButton' && index_es.me(this.editButtonMessage)) {
|
|
1405
1404
|
return this.editButtonMessage;
|
|
1406
1405
|
}
|
|
1407
|
-
else if (this.selectValuesButtonKey === 'showButton' &&
|
|
1406
|
+
else if (this.selectValuesButtonKey === 'showButton' && index_es.me(this.showButtonMessage)) {
|
|
1408
1407
|
return this.showButtonMessage;
|
|
1409
1408
|
}
|
|
1410
|
-
else if (this.selectValuesButtonKey === 'selectButton' &&
|
|
1409
|
+
else if (this.selectValuesButtonKey === 'selectButton' && index_es.me(this.selectButtonMessage)) {
|
|
1411
1410
|
return this.selectButtonMessage;
|
|
1412
1411
|
}
|
|
1413
1412
|
else {
|
|
@@ -1476,7 +1475,7 @@ const MgInputCheckbox = class {
|
|
|
1476
1475
|
this.editButtonMessage = undefined;
|
|
1477
1476
|
this.showButtonMessage = undefined;
|
|
1478
1477
|
this.selectButtonMessage = undefined;
|
|
1479
|
-
this.classCollection = new
|
|
1478
|
+
this.classCollection = new index_es.Xe([this.baseClassName, classFieldset]);
|
|
1480
1479
|
this.errorMessage = undefined;
|
|
1481
1480
|
this.checkboxItems = [];
|
|
1482
1481
|
this.displaySearchInput = undefined;
|
|
@@ -1486,16 +1485,16 @@ const MgInputCheckbox = class {
|
|
|
1486
1485
|
}
|
|
1487
1486
|
validateValue(newValue) {
|
|
1488
1487
|
if (isCheckboxItems(newValue)) {
|
|
1489
|
-
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this)
|
|
1488
|
+
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this) })));
|
|
1490
1489
|
this.valueChange.emit(newValue);
|
|
1491
1490
|
}
|
|
1492
1491
|
else {
|
|
1493
|
-
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${
|
|
1492
|
+
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1494
1493
|
}
|
|
1495
1494
|
}
|
|
1496
1495
|
validateType(newValue) {
|
|
1497
1496
|
if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
|
|
1498
|
-
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${
|
|
1497
|
+
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1499
1498
|
}
|
|
1500
1499
|
else if (newValue === undefined) {
|
|
1501
1500
|
this.mode = 'auto';
|
|
@@ -1584,7 +1583,7 @@ const MgInputCheckbox = class {
|
|
|
1584
1583
|
if (typeof valid !== 'boolean') {
|
|
1585
1584
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
|
|
1586
1585
|
}
|
|
1587
|
-
else if (!
|
|
1586
|
+
else if (!index_es.me(errorMessage)) {
|
|
1588
1587
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
|
|
1589
1588
|
}
|
|
1590
1589
|
else {
|
|
@@ -1593,6 +1592,17 @@ const MgInputCheckbox = class {
|
|
|
1593
1592
|
this.hasDisplayedError = this.invalid;
|
|
1594
1593
|
}
|
|
1595
1594
|
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Reset value, validity and error state
|
|
1597
|
+
*/
|
|
1598
|
+
async reset() {
|
|
1599
|
+
if (!this.readonly) {
|
|
1600
|
+
this.value = this.value.map(item => (Object.assign(Object.assign({}, item), { value: false })));
|
|
1601
|
+
this.checkValidity();
|
|
1602
|
+
this.errorMessage = undefined;
|
|
1603
|
+
this.hasDisplayedError = false;
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1596
1606
|
/**
|
|
1597
1607
|
* Method to set validity values
|
|
1598
1608
|
* @param newValue - valid new value
|
|
@@ -1602,7 +1612,7 @@ const MgInputCheckbox = class {
|
|
|
1602
1612
|
this.valid = newValue;
|
|
1603
1613
|
this.invalid = !this.valid;
|
|
1604
1614
|
// We need to send valid event even if it is the same value
|
|
1605
|
-
if (this.
|
|
1615
|
+
if (this.valid !== oldValidValue)
|
|
1606
1616
|
this.inputValid.emit(this.valid);
|
|
1607
1617
|
}
|
|
1608
1618
|
/**
|
|
@@ -1710,7 +1720,7 @@ const MgInputCheckbox = class {
|
|
|
1710
1720
|
else {
|
|
1711
1721
|
inputContent = this.renderCheckboxMulti();
|
|
1712
1722
|
}
|
|
1713
|
-
return (index.h("mg-input", { key: '
|
|
1723
|
+
return (index.h("mg-input", { key: '5a6c84d1f533159645c5aec09bb6e82a7cd30cc7', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
|
|
1714
1724
|
}
|
|
1715
1725
|
get element() { return index.getElement(this); }
|
|
1716
1726
|
static get watchers() { return {
|
|
@@ -1843,7 +1853,7 @@ const MgInputDate = class {
|
|
|
1843
1853
|
* @param value - value to test
|
|
1844
1854
|
* @returns truthy when value match the pattern
|
|
1845
1855
|
*/
|
|
1846
|
-
this.isValidPattern = (value) =>
|
|
1856
|
+
this.isValidPattern = (value) => index_es.me(value) && index_es.He.test(value);
|
|
1847
1857
|
/**
|
|
1848
1858
|
* Format help text to display
|
|
1849
1859
|
* @param helpText - help text format
|
|
@@ -1851,10 +1861,10 @@ const MgInputDate = class {
|
|
|
1851
1861
|
*/
|
|
1852
1862
|
this.formatHelpText = (helpText) => {
|
|
1853
1863
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
1854
|
-
let text =
|
|
1864
|
+
let text = index_es.me(helpText) ? helpText : this.messages.input.date.helpText;
|
|
1855
1865
|
if (text.includes(defaultHelpTextVariable))
|
|
1856
1866
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
1857
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}',
|
|
1867
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', index_es.ze(index_es.ft(new Date('2023-12-24')), this.systemLocale));
|
|
1858
1868
|
};
|
|
1859
1869
|
/**
|
|
1860
1870
|
* Handle input event
|
|
@@ -1946,8 +1956,8 @@ const MgInputDate = class {
|
|
|
1946
1956
|
// min, max & minMax
|
|
1947
1957
|
else if (['min', 'max', 'minMax'].includes(inputError)) {
|
|
1948
1958
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
1949
|
-
.replace('{min}',
|
|
1950
|
-
.replace('{max}',
|
|
1959
|
+
.replace('{min}', index_es.ze(this.min, this.systemLocale))
|
|
1960
|
+
.replace('{max}', index_es.ze(this.max, this.systemLocale));
|
|
1951
1961
|
}
|
|
1952
1962
|
// wrong date format
|
|
1953
1963
|
// element.validity.badInput is default error message
|
|
@@ -1961,7 +1971,7 @@ const MgInputDate = class {
|
|
|
1961
1971
|
* @returns translated html pattern
|
|
1962
1972
|
*/
|
|
1963
1973
|
this.renderPattern = () => {
|
|
1964
|
-
let patternLocal =
|
|
1974
|
+
let patternLocal = index_es.ct(this.systemLocale);
|
|
1965
1975
|
for (const key in this.messages.input.date.pattern) {
|
|
1966
1976
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
1967
1977
|
}
|
|
@@ -1983,7 +1993,7 @@ const MgInputDate = class {
|
|
|
1983
1993
|
this.helpText = undefined;
|
|
1984
1994
|
this.valid = undefined;
|
|
1985
1995
|
this.invalid = undefined;
|
|
1986
|
-
this.classCollection = new
|
|
1996
|
+
this.classCollection = new index_es.Xe(['mg-c-input--date']);
|
|
1987
1997
|
this.errorMessage = undefined;
|
|
1988
1998
|
}
|
|
1989
1999
|
validateValue(newValue) {
|
|
@@ -1991,8 +2001,8 @@ const MgInputDate = class {
|
|
|
1991
2001
|
if (newValue === '')
|
|
1992
2002
|
newValue = null;
|
|
1993
2003
|
// check value validity
|
|
1994
|
-
if (newValue && !
|
|
1995
|
-
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${
|
|
2004
|
+
if (newValue && !index_es.me(newValue)) {
|
|
2005
|
+
throw new Error(`<mg-input-date> props 'value' must be a valid string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
1996
2006
|
}
|
|
1997
2007
|
else if ([null, undefined].includes(newValue) || this.isValidPattern(newValue)) {
|
|
1998
2008
|
this.valueChange.emit(newValue);
|
|
@@ -2009,7 +2019,7 @@ const MgInputDate = class {
|
|
|
2009
2019
|
}
|
|
2010
2020
|
validateMinMax(newValue) {
|
|
2011
2021
|
if (newValue && !this.isValidPattern(newValue)) {
|
|
2012
|
-
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${
|
|
2022
|
+
throw new Error(`<mg-input-date> props 'min/max' doesn't match pattern: 'yyyy-mm-dd'. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2013
2023
|
}
|
|
2014
2024
|
}
|
|
2015
2025
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -2048,7 +2058,7 @@ const MgInputDate = class {
|
|
|
2048
2058
|
if (typeof valid !== 'boolean') {
|
|
2049
2059
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean.');
|
|
2050
2060
|
}
|
|
2051
|
-
else if (!
|
|
2061
|
+
else if (!index_es.me(errorMessage)) {
|
|
2052
2062
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string.');
|
|
2053
2063
|
}
|
|
2054
2064
|
else {
|
|
@@ -2057,6 +2067,18 @@ const MgInputDate = class {
|
|
|
2057
2067
|
this.hasDisplayedError = this.invalid;
|
|
2058
2068
|
}
|
|
2059
2069
|
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Reset value, validity and error state
|
|
2072
|
+
*/
|
|
2073
|
+
async reset() {
|
|
2074
|
+
if (!this.readonly) {
|
|
2075
|
+
this.value = '';
|
|
2076
|
+
this.checkValidity();
|
|
2077
|
+
this.invalid = false;
|
|
2078
|
+
this.errorMessage = undefined;
|
|
2079
|
+
this.hasDisplayedError = false;
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2060
2082
|
/**
|
|
2061
2083
|
* Method to set validity values
|
|
2062
2084
|
* @param newValue - valid new value
|
|
@@ -2102,7 +2124,7 @@ const MgInputDate = class {
|
|
|
2102
2124
|
* @returns HTML Element
|
|
2103
2125
|
*/
|
|
2104
2126
|
render() {
|
|
2105
|
-
return (index.h("mg-input", { key: '
|
|
2127
|
+
return (index.h("mg-input", { key: '33ffeaf0b7b07cc65081891709a73a44c9454092', 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 && ['', undefined].includes(this.value) ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly ? (this.value && index.h("b", { class: "mg-c-input__readonly-value" }, index_es.ze(this.value, this.locale))) : (index.h("input", { type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
2106
2128
|
if (el !== null)
|
|
2107
2129
|
this.input = el;
|
|
2108
2130
|
} }))));
|
|
@@ -2123,7 +2145,7 @@ MgInputDate.style = MgInputDateStyle0;
|
|
|
2123
2145
|
* List of all possibles types
|
|
2124
2146
|
*/
|
|
2125
2147
|
const types = ['decimal', 'integer'];
|
|
2126
|
-
const formats = ['none', 'number', 'currency'];
|
|
2148
|
+
const formats = ['none', 'number', 'currency', 'percent', 'unit'];
|
|
2127
2149
|
|
|
2128
2150
|
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)*.6ch)}.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)*.6ch)}.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)*.6ch)}.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)}";
|
|
2129
2151
|
const MgInputNumericStyle0 = mgInputNumericCss;
|
|
@@ -2188,7 +2210,9 @@ const MgInputNumeric = class {
|
|
|
2188
2210
|
this.errorMessage = this.messages.errors[inputError];
|
|
2189
2211
|
}
|
|
2190
2212
|
else {
|
|
2191
|
-
|
|
2213
|
+
const formattedMin = this.formatValue(this.min);
|
|
2214
|
+
const formattedMax = this.formatValue(this.max);
|
|
2215
|
+
this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
|
|
2192
2216
|
}
|
|
2193
2217
|
}
|
|
2194
2218
|
};
|
|
@@ -2226,9 +2250,13 @@ const MgInputNumeric = class {
|
|
|
2226
2250
|
this.formatValue = (value) => {
|
|
2227
2251
|
switch (this.format) {
|
|
2228
2252
|
case 'number':
|
|
2229
|
-
return
|
|
2253
|
+
return index_es.$t(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2230
2254
|
case 'currency':
|
|
2231
|
-
return
|
|
2255
|
+
return index_es.ut(value, this.locale, this.currency);
|
|
2256
|
+
case 'percent':
|
|
2257
|
+
return index_es.dt(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2258
|
+
case 'unit':
|
|
2259
|
+
return index_es.pt(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2232
2260
|
case 'none':
|
|
2233
2261
|
return value.toString();
|
|
2234
2262
|
}
|
|
@@ -2274,11 +2302,13 @@ const MgInputNumeric = class {
|
|
|
2274
2302
|
this.type = 'decimal';
|
|
2275
2303
|
this.format = 'number';
|
|
2276
2304
|
this.currency = 'EUR';
|
|
2305
|
+
this.unit = undefined;
|
|
2306
|
+
this.unitDisplay = 'short';
|
|
2277
2307
|
this.integerLength = 13;
|
|
2278
2308
|
this.decimalLength = 2;
|
|
2279
2309
|
this.valid = undefined;
|
|
2280
2310
|
this.invalid = undefined;
|
|
2281
|
-
this.classCollection = new
|
|
2311
|
+
this.classCollection = new index_es.Xe(['mg-c-input--numeric']);
|
|
2282
2312
|
this.errorMessage = undefined;
|
|
2283
2313
|
this.hasFocus = undefined;
|
|
2284
2314
|
}
|
|
@@ -2333,22 +2363,22 @@ const MgInputNumeric = class {
|
|
|
2333
2363
|
}
|
|
2334
2364
|
validateType(newValue) {
|
|
2335
2365
|
if (!types.includes(newValue)) {
|
|
2336
|
-
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${
|
|
2366
|
+
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2337
2367
|
}
|
|
2338
2368
|
}
|
|
2339
2369
|
watchFormat(newValue) {
|
|
2340
2370
|
if (!formats.includes(newValue)) {
|
|
2341
|
-
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${
|
|
2371
|
+
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2342
2372
|
}
|
|
2343
2373
|
}
|
|
2344
2374
|
validateIntegerLength(newValue) {
|
|
2345
2375
|
if (newValue < 1) {
|
|
2346
|
-
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${
|
|
2376
|
+
throw new Error(`<mg-input-numeric> prop "integer-length" must be a positive number. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2347
2377
|
}
|
|
2348
2378
|
}
|
|
2349
2379
|
validateDecimalLength(newValue) {
|
|
2350
2380
|
if (newValue < 1) {
|
|
2351
|
-
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${
|
|
2381
|
+
throw new Error(`<mg-input-numeric> prop "decimal-length" must be a positive number, consider using prop "type" to "integer" instead. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2352
2382
|
}
|
|
2353
2383
|
}
|
|
2354
2384
|
/**
|
|
@@ -2371,7 +2401,7 @@ const MgInputNumeric = class {
|
|
|
2371
2401
|
if (typeof valid !== 'boolean') {
|
|
2372
2402
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
|
|
2373
2403
|
}
|
|
2374
|
-
else if (!
|
|
2404
|
+
else if (!index_es.me(errorMessage)) {
|
|
2375
2405
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
|
|
2376
2406
|
}
|
|
2377
2407
|
else {
|
|
@@ -2380,6 +2410,17 @@ const MgInputNumeric = class {
|
|
|
2380
2410
|
this.hasDisplayedError = this.invalid;
|
|
2381
2411
|
}
|
|
2382
2412
|
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Reset value, validity and error state
|
|
2415
|
+
*/
|
|
2416
|
+
async reset() {
|
|
2417
|
+
if (!this.readonly) {
|
|
2418
|
+
this.value = '';
|
|
2419
|
+
this.checkValidity();
|
|
2420
|
+
this.errorMessage = undefined;
|
|
2421
|
+
this.hasDisplayedError = false;
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2383
2424
|
/**
|
|
2384
2425
|
* Method to set validity values
|
|
2385
2426
|
* @param newValue - valid new value
|
|
@@ -2466,7 +2507,7 @@ const MgInputNumeric = class {
|
|
|
2466
2507
|
* @returns HTML Element
|
|
2467
2508
|
*/
|
|
2468
2509
|
render() {
|
|
2469
|
-
return (index.h("mg-input", { key: '
|
|
2510
|
+
return (index.h("mg-input", { key: '6d34c2b7e9762cdefc5de3814ff4afd95fa4a6a6', 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
|
|
2470
2511
|
? this.readonlyValue && this.renderReadonly()
|
|
2471
2512
|
: [
|
|
2472
2513
|
index.h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
@@ -2569,7 +2610,7 @@ const MgInputPassword = class {
|
|
|
2569
2610
|
this.helpText = undefined;
|
|
2570
2611
|
this.valid = undefined;
|
|
2571
2612
|
this.invalid = undefined;
|
|
2572
|
-
this.classCollection = new
|
|
2613
|
+
this.classCollection = new index_es.Xe(['mg-c-input--password']);
|
|
2573
2614
|
this.errorMessage = undefined;
|
|
2574
2615
|
this.displayPassword = false;
|
|
2575
2616
|
}
|
|
@@ -2627,7 +2668,7 @@ const MgInputPassword = class {
|
|
|
2627
2668
|
if (typeof valid !== 'boolean') {
|
|
2628
2669
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
|
|
2629
2670
|
}
|
|
2630
|
-
else if (!
|
|
2671
|
+
else if (!index_es.me(errorMessage)) {
|
|
2631
2672
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
|
|
2632
2673
|
}
|
|
2633
2674
|
else {
|
|
@@ -2636,6 +2677,17 @@ const MgInputPassword = class {
|
|
|
2636
2677
|
this.hasDisplayedError = this.invalid;
|
|
2637
2678
|
}
|
|
2638
2679
|
}
|
|
2680
|
+
/**
|
|
2681
|
+
* Reset value, validity and error state
|
|
2682
|
+
*/
|
|
2683
|
+
async reset() {
|
|
2684
|
+
if (!this.readonly) {
|
|
2685
|
+
this.value = '';
|
|
2686
|
+
this.checkValidity();
|
|
2687
|
+
this.errorMessage = undefined;
|
|
2688
|
+
this.hasDisplayedError = false;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2639
2691
|
/**
|
|
2640
2692
|
* Method to set validity values
|
|
2641
2693
|
* @param newValue - valid new value
|
|
@@ -2673,7 +2725,7 @@ const MgInputPassword = class {
|
|
|
2673
2725
|
* @returns HTML Element
|
|
2674
2726
|
*/
|
|
2675
2727
|
render() {
|
|
2676
|
-
return (index.h("mg-input", { key: '
|
|
2728
|
+
return (index.h("mg-input", { key: 'af313cb20a94a9c8dcf2b944c31b7ea36b2d3feb', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && index.h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (index.h("span", { class: "mg-c-input__input-group" }, index.h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
2677
2729
|
if (el !== null)
|
|
2678
2730
|
this.input = el;
|
|
2679
2731
|
} }), index.h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, index.h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
|
|
@@ -2774,14 +2826,15 @@ const MgInputRadio = class {
|
|
|
2774
2826
|
this.helpText = undefined;
|
|
2775
2827
|
this.valid = undefined;
|
|
2776
2828
|
this.invalid = undefined;
|
|
2777
|
-
this.classCollection = new
|
|
2829
|
+
this.classCollection = new index_es.Xe(['mg-c-input--radio', classFieldset]);
|
|
2778
2830
|
this.errorMessage = undefined;
|
|
2779
2831
|
this.options = undefined;
|
|
2780
2832
|
this.readonlyValue = undefined;
|
|
2781
2833
|
}
|
|
2834
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2782
2835
|
watchValue(newValue) {
|
|
2783
2836
|
var _a;
|
|
2784
|
-
if (
|
|
2837
|
+
if (index_es.Je(this.items) && typeof newValue === 'string') {
|
|
2785
2838
|
this.readonlyValue = newValue;
|
|
2786
2839
|
}
|
|
2787
2840
|
else if (Array.isArray(this.items) && this.items.every(isOption$3)) {
|
|
@@ -2795,10 +2848,10 @@ const MgInputRadio = class {
|
|
|
2795
2848
|
validateItems(newValue) {
|
|
2796
2849
|
// Validate if items have required min length
|
|
2797
2850
|
if (typeof newValue === 'object' && newValue.length < 2) {
|
|
2798
|
-
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${
|
|
2851
|
+
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2799
2852
|
}
|
|
2800
2853
|
// String array
|
|
2801
|
-
else if (
|
|
2854
|
+
else if (index_es.Je(newValue)) {
|
|
2802
2855
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
2803
2856
|
}
|
|
2804
2857
|
// Object array
|
|
@@ -2806,7 +2859,7 @@ const MgInputRadio = class {
|
|
|
2806
2859
|
this.options = newValue;
|
|
2807
2860
|
}
|
|
2808
2861
|
else {
|
|
2809
|
-
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${
|
|
2862
|
+
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${index_es.Ye(newValue)}.`);
|
|
2810
2863
|
}
|
|
2811
2864
|
}
|
|
2812
2865
|
watchInputVerticalList(newValue) {
|
|
@@ -2857,7 +2910,7 @@ const MgInputRadio = class {
|
|
|
2857
2910
|
if (typeof valid !== 'boolean') {
|
|
2858
2911
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean.');
|
|
2859
2912
|
}
|
|
2860
|
-
else if (!
|
|
2913
|
+
else if (!index_es.me(errorMessage)) {
|
|
2861
2914
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string.');
|
|
2862
2915
|
}
|
|
2863
2916
|
else {
|
|
@@ -2866,6 +2919,17 @@ const MgInputRadio = class {
|
|
|
2866
2919
|
this.hasDisplayedError = this.invalid;
|
|
2867
2920
|
}
|
|
2868
2921
|
}
|
|
2922
|
+
/**
|
|
2923
|
+
* Reset value, validity and error state
|
|
2924
|
+
*/
|
|
2925
|
+
async reset() {
|
|
2926
|
+
if (!this.readonly) {
|
|
2927
|
+
this.value = undefined;
|
|
2928
|
+
this.checkValidity();
|
|
2929
|
+
this.errorMessage = undefined;
|
|
2930
|
+
this.hasDisplayedError = false;
|
|
2931
|
+
}
|
|
2932
|
+
}
|
|
2869
2933
|
/**
|
|
2870
2934
|
* Method to set validity values
|
|
2871
2935
|
* @param newValue - valid new value
|
|
@@ -2906,7 +2970,7 @@ const MgInputRadio = class {
|
|
|
2906
2970
|
* @returns HTML Element
|
|
2907
2971
|
*/
|
|
2908
2972
|
render() {
|
|
2909
|
-
return (index.h("mg-input", { key: '
|
|
2973
|
+
return (index.h("mg-input", { key: '1f27ea2672375c28b2b7afca66ebd09f8dfc2354', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && index.h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (index.h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index$1) => (index.h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, index.h("input", { type: "radio", id: this.identifier + '_' + index$1, name: this.identifier, value: index$1, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index$1].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
2910
2974
|
if (el !== null)
|
|
2911
2975
|
this.inputs[index$1] = el;
|
|
2912
2976
|
} }), index.h("label", { htmlFor: this.identifier + '_' + index$1 }, input.title))))))));
|
|
@@ -3004,7 +3068,7 @@ const MgInputSelect = class {
|
|
|
3004
3068
|
if (this.input.value === '') {
|
|
3005
3069
|
this.setValue(null);
|
|
3006
3070
|
}
|
|
3007
|
-
else if (
|
|
3071
|
+
else if (index_es.Je(this.items) && this.items.includes(this.input.value)) {
|
|
3008
3072
|
this.setValue(this.input.value);
|
|
3009
3073
|
}
|
|
3010
3074
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3078,7 +3142,7 @@ const MgInputSelect = class {
|
|
|
3078
3142
|
this.helpText = undefined;
|
|
3079
3143
|
this.valid = undefined;
|
|
3080
3144
|
this.invalid = undefined;
|
|
3081
|
-
this.classCollection = new
|
|
3145
|
+
this.classCollection = new index_es.Xe(['mg-c-input--select']);
|
|
3082
3146
|
this.errorMessage = undefined;
|
|
3083
3147
|
this.options = undefined;
|
|
3084
3148
|
this.valueExist = undefined;
|
|
@@ -3086,7 +3150,7 @@ const MgInputSelect = class {
|
|
|
3086
3150
|
}
|
|
3087
3151
|
validateValue(newValue) {
|
|
3088
3152
|
var _a, _b;
|
|
3089
|
-
if (
|
|
3153
|
+
if (index_es.Je(this.items) && typeof newValue === 'string') {
|
|
3090
3154
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) !== undefined ? this.input.value : newValue;
|
|
3091
3155
|
}
|
|
3092
3156
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3103,7 +3167,7 @@ const MgInputSelect = class {
|
|
|
3103
3167
|
this.options = [];
|
|
3104
3168
|
}
|
|
3105
3169
|
// String array
|
|
3106
|
-
else if (
|
|
3170
|
+
else if (index_es.Je(newValue)) {
|
|
3107
3171
|
if (typeof this.value === 'string')
|
|
3108
3172
|
this.valueExist = newValue.includes(this.value);
|
|
3109
3173
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3121,7 +3185,7 @@ const MgInputSelect = class {
|
|
|
3121
3185
|
}
|
|
3122
3186
|
}
|
|
3123
3187
|
else {
|
|
3124
|
-
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: ${
|
|
3188
|
+
throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3125
3189
|
}
|
|
3126
3190
|
}
|
|
3127
3191
|
watchReadonly(newValue) {
|
|
@@ -3175,7 +3239,7 @@ const MgInputSelect = class {
|
|
|
3175
3239
|
if (typeof valid !== 'boolean') {
|
|
3176
3240
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean.');
|
|
3177
3241
|
}
|
|
3178
|
-
else if (!
|
|
3242
|
+
else if (!index_es.me(errorMessage)) {
|
|
3179
3243
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string.');
|
|
3180
3244
|
}
|
|
3181
3245
|
else {
|
|
@@ -3184,6 +3248,17 @@ const MgInputSelect = class {
|
|
|
3184
3248
|
this.hasDisplayedError = this.invalid;
|
|
3185
3249
|
}
|
|
3186
3250
|
}
|
|
3251
|
+
/**
|
|
3252
|
+
* Reset value, validity and error state
|
|
3253
|
+
*/
|
|
3254
|
+
async reset() {
|
|
3255
|
+
if (!this.readonly) {
|
|
3256
|
+
this.value = null;
|
|
3257
|
+
this.checkValidity();
|
|
3258
|
+
this.errorMessage = undefined;
|
|
3259
|
+
this.hasDisplayedError = false;
|
|
3260
|
+
}
|
|
3261
|
+
}
|
|
3187
3262
|
/**
|
|
3188
3263
|
* Method to set validity values
|
|
3189
3264
|
* @param newValue - valid new value
|
|
@@ -3228,7 +3303,7 @@ const MgInputSelect = class {
|
|
|
3228
3303
|
* @returns HTML Element
|
|
3229
3304
|
*/
|
|
3230
3305
|
render() {
|
|
3231
|
-
return (index.h("mg-input", { key: '
|
|
3306
|
+
return (index.h("mg-input", { key: '23ce3f91b4a5abdbd9b9731a895ca38d37b8c0a5', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && index.h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (index.h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
3232
3307
|
if (el !== null)
|
|
3233
3308
|
this.input = el;
|
|
3234
3309
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -3260,7 +3335,7 @@ const isOption$1 = (option) => typeof option === 'object' && typeof option.title
|
|
|
3260
3335
|
* @param options - Datalist options to check.
|
|
3261
3336
|
* @returns True if datalist is well structured.
|
|
3262
3337
|
*/
|
|
3263
|
-
const isDatalistOptions = (options) =>
|
|
3338
|
+
const isDatalistOptions = (options) => index_es.Je(options) || (Array.isArray(options) && options.every(isOption$1));
|
|
3264
3339
|
const MgInputText = class {
|
|
3265
3340
|
constructor(hostRef) {
|
|
3266
3341
|
index.registerInstance(this, hostRef);
|
|
@@ -3292,7 +3367,7 @@ const MgInputText = class {
|
|
|
3292
3367
|
*/
|
|
3293
3368
|
this.handleFocus = () => {
|
|
3294
3369
|
this.classCollection.add(this.classFocus);
|
|
3295
|
-
this.classCollection = new
|
|
3370
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3296
3371
|
};
|
|
3297
3372
|
/**
|
|
3298
3373
|
* Handle blur event
|
|
@@ -3300,7 +3375,7 @@ const MgInputText = class {
|
|
|
3300
3375
|
this.handleBlur = () => {
|
|
3301
3376
|
// Manage focus
|
|
3302
3377
|
this.classCollection.delete(this.classFocus);
|
|
3303
|
-
this.classCollection = new
|
|
3378
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3304
3379
|
// Display Error
|
|
3305
3380
|
this.handlerInProgress = 'blur';
|
|
3306
3381
|
this.displayError().finally(() => {
|
|
@@ -3388,7 +3463,7 @@ const MgInputText = class {
|
|
|
3388
3463
|
this.helpText = undefined;
|
|
3389
3464
|
this.valid = undefined;
|
|
3390
3465
|
this.invalid = undefined;
|
|
3391
|
-
this.classCollection = new
|
|
3466
|
+
this.classCollection = new index_es.Xe(['mg-c-input--text']);
|
|
3392
3467
|
this.errorMessage = undefined;
|
|
3393
3468
|
}
|
|
3394
3469
|
handleValue(newValue) {
|
|
@@ -3410,7 +3485,7 @@ const MgInputText = class {
|
|
|
3410
3485
|
}
|
|
3411
3486
|
validateDatalistoptions(newValue) {
|
|
3412
3487
|
if (Boolean(newValue) && !isDatalistOptions(newValue)) {
|
|
3413
|
-
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${
|
|
3488
|
+
throw new Error(`<mg-input-text> prop "datalistoptions" values must be the same type, string or OptionType. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3414
3489
|
}
|
|
3415
3490
|
}
|
|
3416
3491
|
watchReadonly(newValue) {
|
|
@@ -3445,8 +3520,8 @@ const MgInputText = class {
|
|
|
3445
3520
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3446
3521
|
}
|
|
3447
3522
|
validatePattern(newValue) {
|
|
3448
|
-
if (newValue !== undefined && !(
|
|
3449
|
-
throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${
|
|
3523
|
+
if (newValue !== undefined && !(index_es.me(this.pattern) && index_es.me(this.patternErrorMessage))) {
|
|
3524
|
+
throw new Error(`<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.Ye(this.pattern)}'" and "patternErrorMessage='${index_es.Ye(this.patternErrorMessage)}'".`);
|
|
3450
3525
|
}
|
|
3451
3526
|
}
|
|
3452
3527
|
/**
|
|
@@ -3475,7 +3550,7 @@ const MgInputText = class {
|
|
|
3475
3550
|
if (typeof valid !== 'boolean') {
|
|
3476
3551
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean.');
|
|
3477
3552
|
}
|
|
3478
|
-
else if (!
|
|
3553
|
+
else if (!index_es.me(errorMessage)) {
|
|
3479
3554
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string.');
|
|
3480
3555
|
}
|
|
3481
3556
|
else {
|
|
@@ -3484,6 +3559,17 @@ const MgInputText = class {
|
|
|
3484
3559
|
this.hasDisplayedError = this.invalid;
|
|
3485
3560
|
}
|
|
3486
3561
|
}
|
|
3562
|
+
/**
|
|
3563
|
+
* Reset value, validity and error state
|
|
3564
|
+
*/
|
|
3565
|
+
async reset() {
|
|
3566
|
+
if (!this.readonly) {
|
|
3567
|
+
this.value = '';
|
|
3568
|
+
this.checkValidity();
|
|
3569
|
+
this.errorMessage = undefined;
|
|
3570
|
+
this.hasDisplayedError = false;
|
|
3571
|
+
}
|
|
3572
|
+
}
|
|
3487
3573
|
/**
|
|
3488
3574
|
* Method to set validity values
|
|
3489
3575
|
* @param newValue - valid new value
|
|
@@ -3529,7 +3615,7 @@ const MgInputText = class {
|
|
|
3529
3615
|
* @returns HTML Element
|
|
3530
3616
|
*/
|
|
3531
3617
|
render() {
|
|
3532
|
-
return (index.h("mg-input", { key: '
|
|
3618
|
+
return (index.h("mg-input", { key: '6ed4f9339354571851d415755b989824f623d62d', 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
|
|
3533
3619
|
? this.value && this.renderReadonly()
|
|
3534
3620
|
: [
|
|
3535
3621
|
index.h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
|
|
@@ -3589,7 +3675,7 @@ const MgInputTextarea = class {
|
|
|
3589
3675
|
*/
|
|
3590
3676
|
this.handleFocus = () => {
|
|
3591
3677
|
this.classCollection.add(this.classFocus);
|
|
3592
|
-
this.classCollection = new
|
|
3678
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3593
3679
|
};
|
|
3594
3680
|
/**
|
|
3595
3681
|
* Handle blur event
|
|
@@ -3597,7 +3683,7 @@ const MgInputTextarea = class {
|
|
|
3597
3683
|
this.handleBlur = () => {
|
|
3598
3684
|
// Manage focus
|
|
3599
3685
|
this.classCollection.delete(this.classFocus);
|
|
3600
|
-
this.classCollection = new
|
|
3686
|
+
this.classCollection = new index_es.Xe(this.classCollection.classes);
|
|
3601
3687
|
// Display Error
|
|
3602
3688
|
this.handlerInProgress = 'blur';
|
|
3603
3689
|
this.displayError().finally(() => {
|
|
@@ -3660,7 +3746,7 @@ const MgInputTextarea = class {
|
|
|
3660
3746
|
this.valid = undefined;
|
|
3661
3747
|
this.invalid = undefined;
|
|
3662
3748
|
this.resizable = 'none';
|
|
3663
|
-
this.classCollection = new
|
|
3749
|
+
this.classCollection = new index_es.Xe(['mg-c-input--textarea']);
|
|
3664
3750
|
this.errorMessage = undefined;
|
|
3665
3751
|
}
|
|
3666
3752
|
handleValue(newValue) {
|
|
@@ -3699,8 +3785,8 @@ const MgInputTextarea = class {
|
|
|
3699
3785
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
3700
3786
|
}
|
|
3701
3787
|
validatePattern(newValue) {
|
|
3702
|
-
if (newValue !== undefined && !(
|
|
3703
|
-
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${
|
|
3788
|
+
if (newValue !== undefined && !(index_es.me(this.pattern) && index_es.me(this.patternErrorMessage))) {
|
|
3789
|
+
throw new Error(`<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired. Passed value: "pattern='${index_es.Ye(this.pattern)}'" and "patternErrorMessage='${index_es.Ye(this.patternErrorMessage)}'".`);
|
|
3704
3790
|
}
|
|
3705
3791
|
}
|
|
3706
3792
|
validatecharacterLeftHide(newValue) {
|
|
@@ -3731,7 +3817,7 @@ const MgInputTextarea = class {
|
|
|
3731
3817
|
if (typeof valid !== 'boolean') {
|
|
3732
3818
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean.');
|
|
3733
3819
|
}
|
|
3734
|
-
else if (!
|
|
3820
|
+
else if (!index_es.me(errorMessage)) {
|
|
3735
3821
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string.');
|
|
3736
3822
|
}
|
|
3737
3823
|
else {
|
|
@@ -3740,6 +3826,17 @@ const MgInputTextarea = class {
|
|
|
3740
3826
|
this.hasDisplayedError = this.invalid;
|
|
3741
3827
|
}
|
|
3742
3828
|
}
|
|
3829
|
+
/**
|
|
3830
|
+
* Reset value, validity and error state
|
|
3831
|
+
*/
|
|
3832
|
+
async reset() {
|
|
3833
|
+
if (!this.readonly) {
|
|
3834
|
+
this.value = '';
|
|
3835
|
+
this.checkValidity();
|
|
3836
|
+
this.errorMessage = undefined;
|
|
3837
|
+
this.hasDisplayedError = false;
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3743
3840
|
/**
|
|
3744
3841
|
* Method to set validity values
|
|
3745
3842
|
* @param newValue - valid new value
|
|
@@ -3782,7 +3879,7 @@ const MgInputTextarea = class {
|
|
|
3782
3879
|
* @returns HTML Element
|
|
3783
3880
|
*/
|
|
3784
3881
|
render() {
|
|
3785
|
-
return (index.h("mg-input", { key: '
|
|
3882
|
+
return (index.h("mg-input", { key: '311c9e0b36a6373aff8e3ca666dd4af93c2c1137', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && index.h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (index.h("div", { class: "mg-c-input__with-character-left" }, index.h("textarea", { class: {
|
|
3786
3883
|
'mg-c-input__box': true,
|
|
3787
3884
|
'mg-c-input__box--width': true,
|
|
3788
3885
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
@@ -3820,11 +3917,11 @@ const MgInputTitle = class {
|
|
|
3820
3917
|
this.tagName = 'label';
|
|
3821
3918
|
}
|
|
3822
3919
|
validateIdentifier(newValue) {
|
|
3823
|
-
if (!
|
|
3920
|
+
if (!index_es.me(newValue)) {
|
|
3824
3921
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
3825
3922
|
}
|
|
3826
|
-
else if (!
|
|
3827
|
-
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${
|
|
3923
|
+
else if (!index_es.Ge(newValue)) {
|
|
3924
|
+
console.error(`<mg-input-title> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3828
3925
|
}
|
|
3829
3926
|
}
|
|
3830
3927
|
validateIsLegend(newValue) {
|
|
@@ -3937,12 +4034,13 @@ const MgInputToggle = class {
|
|
|
3937
4034
|
this.tooltip = undefined;
|
|
3938
4035
|
this.tooltipPosition = 'input';
|
|
3939
4036
|
this.helpText = undefined;
|
|
3940
|
-
this.classCollection = new
|
|
4037
|
+
this.classCollection = new index_es.Xe(['mg-c-input--toggle']);
|
|
3941
4038
|
this.options = undefined;
|
|
3942
4039
|
this.errorMessage = undefined;
|
|
3943
4040
|
this.valid = undefined;
|
|
3944
4041
|
this.checked = false;
|
|
3945
4042
|
}
|
|
4043
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3946
4044
|
handleValue(newValue) {
|
|
3947
4045
|
// Swich to the right option
|
|
3948
4046
|
this.setChecked();
|
|
@@ -3951,10 +4049,10 @@ const MgInputToggle = class {
|
|
|
3951
4049
|
}
|
|
3952
4050
|
validateItems(newValue) {
|
|
3953
4051
|
if (typeof newValue === 'object' && this.items.length !== 2) {
|
|
3954
|
-
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${
|
|
4052
|
+
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3955
4053
|
}
|
|
3956
4054
|
// String array
|
|
3957
|
-
else if (
|
|
4055
|
+
else if (index_es.Je(newValue)) {
|
|
3958
4056
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
3959
4057
|
}
|
|
3960
4058
|
// Object array
|
|
@@ -3962,7 +4060,7 @@ const MgInputToggle = class {
|
|
|
3962
4060
|
this.options = newValue;
|
|
3963
4061
|
}
|
|
3964
4062
|
else {
|
|
3965
|
-
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${
|
|
4063
|
+
throw new Error(`<mg-input-toggle> prop "items" is required and all items must be the same type: ToggleValue. Passed value: ${index_es.Ye(newValue)}.`);
|
|
3966
4064
|
}
|
|
3967
4065
|
}
|
|
3968
4066
|
watchIsOnOff(newValue) {
|
|
@@ -4010,7 +4108,7 @@ const MgInputToggle = class {
|
|
|
4010
4108
|
if (typeof valid !== 'boolean') {
|
|
4011
4109
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean.');
|
|
4012
4110
|
}
|
|
4013
|
-
else if (!
|
|
4111
|
+
else if (!index_es.me(errorMessage)) {
|
|
4014
4112
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string.');
|
|
4015
4113
|
}
|
|
4016
4114
|
else {
|
|
@@ -4019,6 +4117,17 @@ const MgInputToggle = class {
|
|
|
4019
4117
|
this.setErrorMessage(valid ? undefined : errorMessage);
|
|
4020
4118
|
}
|
|
4021
4119
|
}
|
|
4120
|
+
/**
|
|
4121
|
+
* Reset value, validity, error and visual state
|
|
4122
|
+
*/
|
|
4123
|
+
async reset() {
|
|
4124
|
+
if (!this.readonly) {
|
|
4125
|
+
this.value = this.options[0].value;
|
|
4126
|
+
this.errorMessage = undefined;
|
|
4127
|
+
this.valid = undefined;
|
|
4128
|
+
this.setChecked();
|
|
4129
|
+
}
|
|
4130
|
+
}
|
|
4022
4131
|
/**
|
|
4023
4132
|
* set checked state
|
|
4024
4133
|
*/
|
|
@@ -4066,7 +4175,7 @@ const MgInputToggle = class {
|
|
|
4066
4175
|
*/
|
|
4067
4176
|
render() {
|
|
4068
4177
|
const checkedItem = this.getCheckedItem(this.checked);
|
|
4069
|
-
return (index.h("mg-input", { key: '
|
|
4178
|
+
return (index.h("mg-input", { key: 'b47ba6e093e47f8405e12744576f2098943e5fbe', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && index.h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (index.h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, index.h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { name: "item-1" })), index.h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { name: "item-2" }))))));
|
|
4070
4179
|
}
|
|
4071
4180
|
get element() { return index.getElement(this); }
|
|
4072
4181
|
static get watchers() { return {
|
|
@@ -4237,12 +4346,11 @@ const MgItemMore = class {
|
|
|
4237
4346
|
*/
|
|
4238
4347
|
this.setProxyElement = (proxified) => {
|
|
4239
4348
|
const proxy = this.moreElementMenuItem.querySelector(`[identifier="${proxified.identifier}"]`);
|
|
4240
|
-
|
|
4241
|
-
if (!proxy) {
|
|
4349
|
+
if (proxy === null) {
|
|
4242
4350
|
return;
|
|
4243
4351
|
}
|
|
4244
4352
|
// remove proxy id to prevent duplicate key. default html id is: '';
|
|
4245
|
-
if (
|
|
4353
|
+
if (index_es.me(proxy.id))
|
|
4246
4354
|
proxy.id = '';
|
|
4247
4355
|
const proxyClickHandler = () => {
|
|
4248
4356
|
this.parentMenu
|
|
@@ -4286,7 +4394,7 @@ const MgItemMore = class {
|
|
|
4286
4394
|
// create item-more menu items element from main menu-items clones
|
|
4287
4395
|
this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
|
|
4288
4396
|
// we need to get all `mg-menu-item` linked to the cloned one to set mirror process
|
|
4289
|
-
|
|
4397
|
+
index_es.tt(() => {
|
|
4290
4398
|
this.setProxyElement(child);
|
|
4291
4399
|
if (child.querySelector('mg-menu') !== null) {
|
|
4292
4400
|
child.querySelectorAll('mg-menu-item').forEach(this.setProxyElement);
|
|
@@ -4302,17 +4410,17 @@ const MgItemMore = class {
|
|
|
4302
4410
|
}
|
|
4303
4411
|
validateIcon(newValue) {
|
|
4304
4412
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))
|
|
4305
|
-
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${
|
|
4413
|
+
throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4306
4414
|
}
|
|
4307
4415
|
validateSlotLabel(newValue) {
|
|
4308
4416
|
if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))
|
|
4309
|
-
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${
|
|
4417
|
+
throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4310
4418
|
else if (typeof newValue.label !== 'string')
|
|
4311
4419
|
this.slotlabel.label = this.messages.menuLabel;
|
|
4312
4420
|
}
|
|
4313
4421
|
validateSize(newValue) {
|
|
4314
4422
|
if (newValue && !sizes$2.includes(newValue))
|
|
4315
|
-
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${
|
|
4423
|
+
throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4316
4424
|
}
|
|
4317
4425
|
/*************
|
|
4318
4426
|
* Lifecycle *
|
|
@@ -4359,11 +4467,11 @@ const MgItemMore = class {
|
|
|
4359
4467
|
* @returns HTML Element
|
|
4360
4468
|
*/
|
|
4361
4469
|
render() {
|
|
4362
|
-
return (index.h(index.Host, { key: '
|
|
4470
|
+
return (index.h(index.Host, { key: '11c43154129c5756e80db0af3434c88cab2191f3', role: "listitem" }, this.parentMenu && (index.h("mg-menu-item", { key: '38fc92410328c317fb046f4e1ec4f94175d484fb', "data-overflow-more": true, "data-size": this.parentMenu.size, identifier: "mg-item-more", ref: el => {
|
|
4363
4471
|
if (el !== null) {
|
|
4364
4472
|
this.moreElementMenuItem = el;
|
|
4365
4473
|
}
|
|
4366
|
-
} }, index.h("mg-icon", { key: '
|
|
4474
|
+
} }, index.h("mg-icon", { key: '90e21f30004e38a1a0938359276dccd7458e5e86', icon: this.icon.icon, size: this.size, slot: "image" }), index.h("span", { key: '20f846c5718a19d39ad94abf59bab54658e1ff9c', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), index.h("mg-menu", { key: 'b52f97129e736be9164ae18b717057d1bfc0cd0a', direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size })))));
|
|
4367
4475
|
}
|
|
4368
4476
|
get element() { return index.getElement(this); }
|
|
4369
4477
|
static get watchers() { return {
|
|
@@ -4472,12 +4580,12 @@ const MgMenu = class {
|
|
|
4472
4580
|
}
|
|
4473
4581
|
validateLabel(newValue) {
|
|
4474
4582
|
if (newValue === undefined && !this.element.hasAttribute('aria-label')) {
|
|
4475
|
-
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${
|
|
4583
|
+
throw new Error(`<${this.name}> prop "label" is required. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4476
4584
|
}
|
|
4477
4585
|
}
|
|
4478
4586
|
validateDirection(newValue) {
|
|
4479
4587
|
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
4480
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${
|
|
4588
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4481
4589
|
}
|
|
4482
4590
|
}
|
|
4483
4591
|
validateItemMore(newValue) {
|
|
@@ -4490,7 +4598,7 @@ const MgMenu = class {
|
|
|
4490
4598
|
}
|
|
4491
4599
|
validateSize(newValue) {
|
|
4492
4600
|
if (!sizes$2.includes(newValue)) {
|
|
4493
|
-
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${
|
|
4601
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes$2.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4494
4602
|
}
|
|
4495
4603
|
}
|
|
4496
4604
|
/*************
|
|
@@ -4614,7 +4722,7 @@ const MgMenuItem = class {
|
|
|
4614
4722
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
4615
4723
|
['label', 'metadata'].forEach(slot => {
|
|
4616
4724
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
4617
|
-
if (!
|
|
4725
|
+
if (!index_es.me(element.textContent))
|
|
4618
4726
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
4619
4727
|
if ((guard && !element.hasAttribute('title')) || !guard)
|
|
4620
4728
|
element.setAttribute('title', element.textContent);
|
|
@@ -4683,13 +4791,13 @@ const MgMenuItem = class {
|
|
|
4683
4791
|
* @returns HTML Element
|
|
4684
4792
|
*/
|
|
4685
4793
|
this.renderSlot = () => index.h("slot", null);
|
|
4686
|
-
this.identifier =
|
|
4794
|
+
this.identifier = index_es.qe('mg-menu-item');
|
|
4687
4795
|
this.href = undefined;
|
|
4688
4796
|
this.target = undefined;
|
|
4689
4797
|
this.status = Status$1.VISIBLE;
|
|
4690
4798
|
this.expanded = false;
|
|
4691
4799
|
this.size = 'medium';
|
|
4692
|
-
this.navigationButtonClassList = new
|
|
4800
|
+
this.navigationButtonClassList = new index_es.Xe([this.navigationButton]);
|
|
4693
4801
|
this.direction = undefined;
|
|
4694
4802
|
this.isInMainMenu = undefined;
|
|
4695
4803
|
this.isItemMore = undefined;
|
|
@@ -4697,13 +4805,13 @@ const MgMenuItem = class {
|
|
|
4697
4805
|
this.displayNotificationBadge = undefined;
|
|
4698
4806
|
}
|
|
4699
4807
|
watchIdentifier(newValue) {
|
|
4700
|
-
if (!
|
|
4701
|
-
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${
|
|
4808
|
+
if (!index_es.Ge(newValue)) {
|
|
4809
|
+
console.error(`<mg-menu-item> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4702
4810
|
}
|
|
4703
4811
|
}
|
|
4704
4812
|
watchTarget(newValue) {
|
|
4705
4813
|
if (newValue && !targets.includes(newValue)) {
|
|
4706
|
-
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${
|
|
4814
|
+
throw new Error(`<mg-link> prop "target" must be one of: ${targets.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4707
4815
|
}
|
|
4708
4816
|
}
|
|
4709
4817
|
validateStatus(newValue, oldValue) {
|
|
@@ -4715,7 +4823,7 @@ const MgMenuItem = class {
|
|
|
4715
4823
|
}
|
|
4716
4824
|
validateExpanded(newValue) {
|
|
4717
4825
|
if (typeof newValue !== 'boolean')
|
|
4718
|
-
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${
|
|
4826
|
+
throw new Error(`<${this.name}> prop "expanded" must be a boolean. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4719
4827
|
// if menu-item has sub-menu we have to apply some updates:
|
|
4720
4828
|
if (this.hasChildren) {
|
|
4721
4829
|
const subItems = Array.from(this.element.querySelectorAll(this.name));
|
|
@@ -4843,7 +4951,7 @@ const MgMenuItem = class {
|
|
|
4843
4951
|
* @returns promise process wich emit the 'item-updated' event
|
|
4844
4952
|
*/
|
|
4845
4953
|
componentShouldUpdate() {
|
|
4846
|
-
return
|
|
4954
|
+
return index_es.tt(() => {
|
|
4847
4955
|
this.itemUpdated.emit();
|
|
4848
4956
|
});
|
|
4849
4957
|
}
|
|
@@ -4912,12 +5020,12 @@ const MgMessage = class {
|
|
|
4912
5020
|
};
|
|
4913
5021
|
this.variant = 'info';
|
|
4914
5022
|
this.variantStyle = 'bar-left';
|
|
4915
|
-
this.classCollection = new
|
|
5023
|
+
this.classCollection = new index_es.Xe(['mg-c-message']);
|
|
4916
5024
|
this.hasActions = false;
|
|
4917
5025
|
}
|
|
4918
5026
|
watchVariant(newValue, oldValue) {
|
|
4919
5027
|
if (!variants$1.includes(newValue)) {
|
|
4920
|
-
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${
|
|
5028
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants$1.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4921
5029
|
}
|
|
4922
5030
|
else {
|
|
4923
5031
|
if (newValue !== undefined)
|
|
@@ -4928,7 +5036,7 @@ const MgMessage = class {
|
|
|
4928
5036
|
}
|
|
4929
5037
|
watchVariantStyle(newValue, oldValue) {
|
|
4930
5038
|
if (!variantStyles.includes(newValue)) {
|
|
4931
|
-
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${
|
|
5039
|
+
throw new Error(`<mg-message> prop "variantStyle" must be one of: ${variantStyles.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
4932
5040
|
}
|
|
4933
5041
|
else {
|
|
4934
5042
|
if (newValue !== undefined)
|
|
@@ -4992,26 +5100,26 @@ const MgModal = class {
|
|
|
4992
5100
|
this.handleClose = () => {
|
|
4993
5101
|
this.open = false;
|
|
4994
5102
|
};
|
|
4995
|
-
this.identifier =
|
|
5103
|
+
this.identifier = index_es.qe('mg-modal');
|
|
4996
5104
|
this.dialogRole = dialogRoles[0];
|
|
4997
5105
|
this.modalTitle = undefined;
|
|
4998
5106
|
this.closeButton = false;
|
|
4999
5107
|
this.open = false;
|
|
5000
5108
|
this.hasActions = false;
|
|
5001
|
-
this.classCollection = new
|
|
5109
|
+
this.classCollection = new index_es.Xe(['mg-c-modal']);
|
|
5002
5110
|
}
|
|
5003
5111
|
watchIdentifier(newValue) {
|
|
5004
|
-
if (!
|
|
5005
|
-
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${
|
|
5112
|
+
if (!index_es.Ge(newValue)) {
|
|
5113
|
+
throw new Error(`<mg-modal> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5006
5114
|
}
|
|
5007
5115
|
}
|
|
5008
5116
|
validateDialogRole(newValue) {
|
|
5009
5117
|
if (!dialogRoles.includes(newValue))
|
|
5010
|
-
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${
|
|
5118
|
+
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5011
5119
|
}
|
|
5012
5120
|
validateModalTitle(newValue) {
|
|
5013
|
-
if (!
|
|
5014
|
-
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${
|
|
5121
|
+
if (!index_es.me(newValue)) {
|
|
5122
|
+
throw new Error(`<mg-modal> prop "modalTitle" is required. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5015
5123
|
}
|
|
5016
5124
|
}
|
|
5017
5125
|
watchOpen(newValue) {
|
|
@@ -5137,7 +5245,7 @@ const MgPagination = class {
|
|
|
5137
5245
|
this.handleGoToPage = (action, disabled) => {
|
|
5138
5246
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
5139
5247
|
};
|
|
5140
|
-
this.identifier =
|
|
5248
|
+
this.identifier = index_es.qe('mg-pagination');
|
|
5141
5249
|
this.label = undefined;
|
|
5142
5250
|
this.hideNavigationLabels = undefined;
|
|
5143
5251
|
this.hidePageCount = undefined;
|
|
@@ -5145,18 +5253,18 @@ const MgPagination = class {
|
|
|
5145
5253
|
this.currentPage = 1;
|
|
5146
5254
|
}
|
|
5147
5255
|
watchIdentifier(newValue) {
|
|
5148
|
-
if (!
|
|
5149
|
-
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${
|
|
5256
|
+
if (!index_es.Ge(newValue)) {
|
|
5257
|
+
console.error(`<mg-pagination> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5150
5258
|
}
|
|
5151
5259
|
}
|
|
5152
5260
|
validateTotalPages(newValue) {
|
|
5153
5261
|
if (newValue < 1) {
|
|
5154
|
-
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${
|
|
5262
|
+
throw new Error(`<mg-pagination> prop "totalPages" must be greater than 0. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5155
5263
|
}
|
|
5156
5264
|
}
|
|
5157
5265
|
validateCurrentPage(newValue) {
|
|
5158
5266
|
if (newValue < 1) {
|
|
5159
|
-
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${
|
|
5267
|
+
throw new Error(`<mg-pagination> prop "currentPage" must be greater than 0. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5160
5268
|
}
|
|
5161
5269
|
else if (newValue > this.totalPages) {
|
|
5162
5270
|
throw new Error('<mg-pagination> prop "currentPage" can not be greater than total page.');
|
|
@@ -5309,7 +5417,7 @@ const MgPanel = class {
|
|
|
5309
5417
|
];
|
|
5310
5418
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5311
5419
|
};
|
|
5312
|
-
this.identifier =
|
|
5420
|
+
this.identifier = index_es.qe('mg-panel');
|
|
5313
5421
|
this.panelTitle = undefined;
|
|
5314
5422
|
this.titlePattern = undefined;
|
|
5315
5423
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -5318,18 +5426,18 @@ const MgPanel = class {
|
|
|
5318
5426
|
this.expanded = false;
|
|
5319
5427
|
this.expandToggleDisplay = expandToggleDisplays[0];
|
|
5320
5428
|
this.expandToggleDisabled = undefined;
|
|
5321
|
-
this.classCollection = new
|
|
5429
|
+
this.classCollection = new index_es.Xe(['mg-c-panel']);
|
|
5322
5430
|
this.isEditing = false;
|
|
5323
5431
|
this.updatedPanelTitle = undefined;
|
|
5324
5432
|
}
|
|
5325
5433
|
watchIdentifier(newValue) {
|
|
5326
|
-
if (!
|
|
5327
|
-
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${
|
|
5434
|
+
if (!index_es.Ge(newValue)) {
|
|
5435
|
+
console.error(`<mg-panel> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5328
5436
|
}
|
|
5329
5437
|
}
|
|
5330
5438
|
validatePanelTitle(newValue) {
|
|
5331
|
-
if (!
|
|
5332
|
-
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${
|
|
5439
|
+
if (!index_es.me(newValue))
|
|
5440
|
+
throw new Error(`<mg-panel> prop "panelTitle" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5333
5441
|
this.titleChange.emit(newValue);
|
|
5334
5442
|
}
|
|
5335
5443
|
validateTitlePattern(newValue) {
|
|
@@ -5338,14 +5446,14 @@ const MgPanel = class {
|
|
|
5338
5446
|
}
|
|
5339
5447
|
validateTitlePosition(newValue) {
|
|
5340
5448
|
if (!titlePositions.includes(newValue))
|
|
5341
|
-
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${
|
|
5449
|
+
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5342
5450
|
}
|
|
5343
5451
|
handleExpanded(newValue) {
|
|
5344
5452
|
this.expandedChange.emit(newValue);
|
|
5345
5453
|
}
|
|
5346
5454
|
validateExpandToggleDisplay(newValue) {
|
|
5347
5455
|
if (!expandToggleDisplays.includes(newValue))
|
|
5348
|
-
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${
|
|
5456
|
+
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
5349
5457
|
if (newValue === 'icon' && this.titleEditable)
|
|
5350
5458
|
this.titleEditable = false;
|
|
5351
5459
|
}
|
|
@@ -7284,7 +7392,7 @@ const MgPopover = class {
|
|
|
7284
7392
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7285
7393
|
}
|
|
7286
7394
|
};
|
|
7287
|
-
this.identifier =
|
|
7395
|
+
this.identifier = index_es.qe('mg-popover');
|
|
7288
7396
|
this.placement = 'bottom';
|
|
7289
7397
|
this.arrowHide = false;
|
|
7290
7398
|
this.closeButton = false;
|
|
@@ -7292,8 +7400,8 @@ const MgPopover = class {
|
|
|
7292
7400
|
this.disabled = false;
|
|
7293
7401
|
}
|
|
7294
7402
|
validateIdentifier(newValue) {
|
|
7295
|
-
if (!
|
|
7296
|
-
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${
|
|
7403
|
+
if (!index_es.Ge(newValue)) {
|
|
7404
|
+
throw new Error(`<mg-popover> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7297
7405
|
}
|
|
7298
7406
|
// use renderPopoverContent to update popover-content id
|
|
7299
7407
|
this.renderPopoverContent();
|
|
@@ -7330,7 +7438,7 @@ const MgPopover = class {
|
|
|
7330
7438
|
*/
|
|
7331
7439
|
componentWillLoad() {
|
|
7332
7440
|
// Get windows to attach events
|
|
7333
|
-
this.windows =
|
|
7441
|
+
this.windows = index_es.Ze(window);
|
|
7334
7442
|
// render mg-popover-content slot
|
|
7335
7443
|
this.renderPopoverContent();
|
|
7336
7444
|
this.validateCloseButton(this.closeButton);
|
|
@@ -7422,7 +7530,7 @@ const MgPopoverContent = class {
|
|
|
7422
7530
|
this.hideContent.emit();
|
|
7423
7531
|
};
|
|
7424
7532
|
this.closeButton = false;
|
|
7425
|
-
this.classCollection = new
|
|
7533
|
+
this.classCollection = new index_es.Xe(['mg-c-popover-content']);
|
|
7426
7534
|
}
|
|
7427
7535
|
/*************
|
|
7428
7536
|
* Lifecycle *
|
|
@@ -7440,7 +7548,7 @@ const MgPopoverContent = class {
|
|
|
7440
7548
|
componentDidLoad() {
|
|
7441
7549
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7442
7550
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
7443
|
-
if (slottedTitleElement && !
|
|
7551
|
+
if (slottedTitleElement && !index_es.Ke(slottedTitleElement, headingTags)) {
|
|
7444
7552
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}.`);
|
|
7445
7553
|
}
|
|
7446
7554
|
}
|
|
@@ -7476,7 +7584,7 @@ const MgSkipLinks = class {
|
|
|
7476
7584
|
this.links = undefined;
|
|
7477
7585
|
}
|
|
7478
7586
|
validateLinks(links) {
|
|
7479
|
-
if (links === undefined || links.length === 0 || links.some(link => !
|
|
7587
|
+
if (links === undefined || links.length === 0 || links.some(link => !index_es.me(link.href) || !link.href.startsWith('#') || !index_es.me(link.label))) {
|
|
7480
7588
|
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.`);
|
|
7481
7589
|
}
|
|
7482
7590
|
}
|
|
@@ -7495,7 +7603,7 @@ const MgSkipLinks = class {
|
|
|
7495
7603
|
* @returns HTML Element
|
|
7496
7604
|
*/
|
|
7497
7605
|
render() {
|
|
7498
|
-
return (index.h("nav", { key: '
|
|
7606
|
+
return (index.h("nav", { key: '0b4e4d6b9481a88faae78602b07c4f5e851da517', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, index.h("ul", { key: 'aaa15193eb2c9e1d9ee3b2e2a7d8d0fd37836ed7', class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (index.h("li", { key: link.href }, index.h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
7499
7607
|
}
|
|
7500
7608
|
get element() { return index.getElement(this); }
|
|
7501
7609
|
static get watchers() { return {
|
|
@@ -7635,7 +7743,7 @@ const MgTabs = class {
|
|
|
7635
7743
|
*/
|
|
7636
7744
|
this.resetFocus = () => {
|
|
7637
7745
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7638
|
-
|
|
7746
|
+
index_es.tt(() => {
|
|
7639
7747
|
this.tabFocus = undefined;
|
|
7640
7748
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7641
7749
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7650,39 +7758,39 @@ const MgTabs = class {
|
|
|
7650
7758
|
if (slots.length !== this.tabs.length)
|
|
7651
7759
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7652
7760
|
};
|
|
7653
|
-
this.identifier =
|
|
7761
|
+
this.identifier = index_es.qe('mg-tabs');
|
|
7654
7762
|
this.label = undefined;
|
|
7655
7763
|
this.size = 'medium';
|
|
7656
7764
|
this.items = undefined;
|
|
7657
7765
|
this.activeTab = undefined;
|
|
7658
7766
|
this.tabs = [];
|
|
7659
|
-
this.classCollection = new
|
|
7767
|
+
this.classCollection = new index_es.Xe(['mg-c-tabs']);
|
|
7660
7768
|
}
|
|
7661
7769
|
watchIdentifier(newValue) {
|
|
7662
|
-
if (!
|
|
7663
|
-
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${
|
|
7770
|
+
if (!index_es.Ge(newValue)) {
|
|
7771
|
+
console.error(`<mg-tabs> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7664
7772
|
}
|
|
7665
7773
|
}
|
|
7666
7774
|
validateLabel(newValue) {
|
|
7667
|
-
if (!
|
|
7668
|
-
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${
|
|
7775
|
+
if (!index_es.me(newValue)) {
|
|
7776
|
+
throw new Error(`<mg-tabs> prop "label" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7669
7777
|
}
|
|
7670
7778
|
}
|
|
7671
7779
|
validateSize(newValue) {
|
|
7672
7780
|
if (!sizes.includes(newValue)) {
|
|
7673
|
-
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${
|
|
7781
|
+
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7674
7782
|
}
|
|
7675
7783
|
this.classCollection.add(`mg-c-tabs--size-${this.size}`);
|
|
7676
7784
|
}
|
|
7677
7785
|
validateItems(newValue) {
|
|
7678
7786
|
// String array
|
|
7679
|
-
if (
|
|
7787
|
+
if (index_es.Je(newValue))
|
|
7680
7788
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
7681
7789
|
// Object array
|
|
7682
7790
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
7683
7791
|
this.tabs = newValue;
|
|
7684
7792
|
else
|
|
7685
|
-
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${
|
|
7793
|
+
throw new Error(`<mg-tabs> prop "items" is required and all items must be the same type: TabItem. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7686
7794
|
}
|
|
7687
7795
|
validateActiveTab(newValue) {
|
|
7688
7796
|
// when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
|
|
@@ -7707,7 +7815,7 @@ const MgTabs = class {
|
|
|
7707
7815
|
this.activeTabChange.emit(newValue);
|
|
7708
7816
|
}
|
|
7709
7817
|
else {
|
|
7710
|
-
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: ${
|
|
7818
|
+
throw new Error(`<mg-tabs> prop "activeTab" must be a number between ${this.startIndex} and ${this.tabs.length} and new value must be "activable". Passed value: ${index_es.Ye(newValue)}.`);
|
|
7711
7819
|
}
|
|
7712
7820
|
}
|
|
7713
7821
|
/*************
|
|
@@ -7742,7 +7850,7 @@ const MgTabs = class {
|
|
|
7742
7850
|
* @returns HTML Element
|
|
7743
7851
|
*/
|
|
7744
7852
|
render() {
|
|
7745
|
-
return (index.h("div", { key: '
|
|
7853
|
+
return (index.h("div", { key: '54bad50e0a610aaae267fb34384384a2aa3a2295', class: this.classCollection.join() }, index.h("header", { key: '8bc4f73112f9de115b8558a7d322398b62983fb7', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index$1) => (index.h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index$1), class: {
|
|
7746
7854
|
[`${this.buttonTabBaseClass}`]: true,
|
|
7747
7855
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
7748
7856
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -7781,11 +7889,11 @@ const MgTag = class {
|
|
|
7781
7889
|
this.variant = variants[0];
|
|
7782
7890
|
this.outline = undefined;
|
|
7783
7891
|
this.soft = undefined;
|
|
7784
|
-
this.classCollection = new
|
|
7892
|
+
this.classCollection = new index_es.Xe(['mg-c-tag']);
|
|
7785
7893
|
}
|
|
7786
7894
|
validateVariant(newValue, oldValue) {
|
|
7787
7895
|
if (!variants.includes(newValue)) {
|
|
7788
|
-
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${
|
|
7896
|
+
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}. Passed value: ${index_es.Ye(newValue)}.`);
|
|
7789
7897
|
}
|
|
7790
7898
|
else {
|
|
7791
7899
|
if (oldValue !== undefined) {
|
|
@@ -7818,7 +7926,7 @@ const MgTag = class {
|
|
|
7818
7926
|
* @param textContent - html element textContent property
|
|
7819
7927
|
*/
|
|
7820
7928
|
validateTextContent(textContent) {
|
|
7821
|
-
if (!
|
|
7929
|
+
if (!index_es.me(textContent))
|
|
7822
7930
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
7823
7931
|
}
|
|
7824
7932
|
/*************
|
|
@@ -7877,7 +7985,7 @@ const MgTooltip = class {
|
|
|
7877
7985
|
// Enable the event listeners
|
|
7878
7986
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7879
7987
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7880
|
-
|
|
7988
|
+
index_es.tt(() => {
|
|
7881
7989
|
this.windows.forEach((localWindow) => {
|
|
7882
7990
|
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
7883
7991
|
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
@@ -8073,22 +8181,22 @@ const MgTooltip = class {
|
|
|
8073
8181
|
element.setAttribute('aria-describedby', `${[...new Set([...element.getAttribute('aria-describedby').split(' '), this.identifier])].join(' ')}`);
|
|
8074
8182
|
}
|
|
8075
8183
|
};
|
|
8076
|
-
this.identifier =
|
|
8184
|
+
this.identifier = index_es.qe('mg-tooltip');
|
|
8077
8185
|
this.message = undefined;
|
|
8078
8186
|
this.placement = 'bottom';
|
|
8079
8187
|
this.display = false;
|
|
8080
8188
|
this.disabled = false;
|
|
8081
8189
|
}
|
|
8082
8190
|
watchIdentifier(newValue) {
|
|
8083
|
-
if (!
|
|
8084
|
-
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${
|
|
8191
|
+
if (!index_es.Ge(newValue)) {
|
|
8192
|
+
throw new Error(`<mg-tooltip> prop "identifier" value is invalid. Passed value: ${index_es.Ye(newValue)}.`);
|
|
8085
8193
|
}
|
|
8086
8194
|
// use renderTooltipContent to update tooltip-content id
|
|
8087
8195
|
this.renderTooltipContent();
|
|
8088
8196
|
}
|
|
8089
8197
|
watchMessage(newValue) {
|
|
8090
|
-
if (!
|
|
8091
|
-
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${
|
|
8198
|
+
if (!index_es.me(newValue)) {
|
|
8199
|
+
throw new Error(`<mg-tooltip> prop "message" is required and must be a string. Passed value: ${index_es.Ye(newValue)}.`);
|
|
8092
8200
|
}
|
|
8093
8201
|
if (this.mgTooltipContent !== undefined)
|
|
8094
8202
|
this.mgTooltipContent.message = newValue;
|
|
@@ -8143,7 +8251,7 @@ const MgTooltip = class {
|
|
|
8143
8251
|
*/
|
|
8144
8252
|
componentWillLoad() {
|
|
8145
8253
|
// Get windows to attach events
|
|
8146
|
-
this.windows =
|
|
8254
|
+
this.windows = index_es.Ze(window);
|
|
8147
8255
|
// Get tooltip element
|
|
8148
8256
|
this.renderTooltipContent();
|
|
8149
8257
|
//validate properties
|
|
@@ -8161,7 +8269,7 @@ const MgTooltip = class {
|
|
|
8161
8269
|
// get slotted element wich is not the tooltip
|
|
8162
8270
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
8163
8271
|
// Get interactive element
|
|
8164
|
-
const interactiveElement = slotElement.matches(
|
|
8272
|
+
const interactiveElement = slotElement.matches(index_es.Qe) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(index_es.Qe);
|
|
8165
8273
|
this.setTooltipedElement(interactiveElement || slotElement);
|
|
8166
8274
|
// Check if slotted element is a disabled mg-button
|
|
8167
8275
|
// In this case we wrap the mg-button into a div to enable the tooltip
|