@mgdis/mg-components 5.23.2 → 5.24.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/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/{index-775fad7b.js → index-3d4f1cfd.js} +29 -22
- package/dist/cjs/index-3d4f1cfd.js.map +1 -0
- package/dist/cjs/{mg-menu.conf-0229bb75.js → index-f699ee11.js} +14 -20
- package/dist/cjs/index-f699ee11.js.map +1 -0
- package/dist/cjs/loader.cjs.js +5 -3
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/mg-action-more_34.cjs.entry.js +260 -201
- package/dist/cjs/mg-action-more_34.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +6 -4
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +5 -4
- package/dist/cjs/mg-item-more.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +49 -0
- package/dist/cjs/mg-loader.cjs.entry.js.map +1 -0
- package/dist/cjs/mg-menu.conf-c291eee6.js +18 -0
- package/dist/cjs/mg-menu.conf-c291eee6.js.map +1 -0
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +1 -0
- package/dist/collection/components/molecules/inputs/MgInput.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +34 -27
- package/dist/collection/components/molecules/inputs/MgInput.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +4 -6
- 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-paginated/mg-input-checkbox-paginated.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +42 -5
- 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 +27 -5
- 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 -0
- 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 +86 -9
- 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 +26 -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 +26 -1
- 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 +26 -1
- 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 -4
- 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 +27 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +28 -13
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +45 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +90 -0
- package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/locales/en/messages.json +5 -2
- package/dist/collection/locales/fr/messages.json +4 -1
- package/dist/collection/styles/global.css +1 -1
- package/dist/components/MgInput.js +39 -30
- package/dist/components/MgInput.js.map +1 -1
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +13 -5
- package/dist/components/index2.js.map +1 -1
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-character-left2.js +1 -1
- package/dist/components/mg-divider.js +1 -1
- package/dist/components/mg-form.js +29 -7
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +5 -7
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +20 -6
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +5 -6
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +30 -5
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +4 -2
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +4 -2
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +4 -2
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +6 -4
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +4 -2
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-title2.js +2 -2
- package/dist/components/mg-input-title2.js.map +1 -1
- package/dist/components/mg-input-toggle.js +6 -13
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-loader.d.ts +11 -0
- package/dist/components/mg-loader.js +76 -0
- package/dist/components/mg-loader.js.map +1 -0
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-modal.js +2 -2
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +1 -1
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs.js +1 -1
- package/dist/components/mg-tooltip2.js +1 -1
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/app-globals-0f993ce5.js +5 -0
- package/dist/esm/app-globals-0f993ce5.js.map +1 -0
- package/dist/esm/{index-9aa447a7.js → index-bcefebe3.js} +29 -22
- package/dist/esm/index-bcefebe3.js.map +1 -0
- package/dist/esm/{mg-menu.conf-4b2d2eab.js → index-d2fc6ec0.js} +15 -20
- package/dist/esm/index-d2fc6ec0.js.map +1 -0
- package/dist/esm/loader.js +6 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/mg-action-more_34.entry.js +161 -102
- package/dist/esm/mg-action-more_34.entry.js.map +1 -1
- package/dist/esm/mg-components.js +7 -5
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-item-more.entry.js +3 -2
- package/dist/esm/mg-item-more.entry.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +45 -0
- package/dist/esm/mg-loader.entry.js.map +1 -0
- package/dist/esm/mg-menu.conf-9609bcb2.js +16 -0
- package/dist/esm/mg-menu.conf-9609bcb2.js.map +1 -0
- package/dist/mg-components/locales/en/messages.json +5 -2
- package/dist/mg-components/locales/fr/messages.json +4 -1
- 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-20a56a75.entry.js +2 -0
- package/dist/mg-components/{p-06715c36.entry.js.map → p-20a56a75.entry.js.map} +1 -1
- package/dist/mg-components/p-29b5a514.js +2 -0
- package/dist/mg-components/p-29b5a514.js.map +1 -0
- package/dist/mg-components/{p-4e7a7f68.js → p-878f8f0a.js} +2 -2
- package/dist/mg-components/p-878f8f0a.js.map +1 -0
- package/dist/mg-components/p-b3f35142.entry.js +2 -0
- package/dist/mg-components/p-b3f35142.entry.js.map +1 -0
- package/dist/mg-components/p-e1255160.js +2 -0
- package/dist/mg-components/p-e1255160.js.map +1 -0
- package/dist/mg-components/p-f85b5d14.entry.js +2 -0
- package/dist/mg-components/p-f85b5d14.entry.js.map +1 -0
- package/dist/mg-components/p-fe935e54.js +2 -0
- package/dist/mg-components/p-fe935e54.js.map +1 -0
- package/dist/mg-components/styles/global.css +1 -1
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +26 -0
- package/dist/types/components/molecules/inputs/MgInput.d.ts +1 -22
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +10 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +4 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +14 -2
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +5 -1
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +5 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +6 -1
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +6 -1
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +10 -7
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +6 -0
- package/dist/types/components/molecules/mg-loader/mg-loader.d.ts +34 -0
- package/dist/types/components.d.ts +127 -8
- package/package.json +23 -23
- package/dist/cjs/index-775fad7b.js.map +0 -1
- package/dist/cjs/mg-menu.conf-0229bb75.js.map +0 -1
- package/dist/collection/locales/index.spec.js +0 -27
- package/dist/collection/locales/index.spec.js.map +0 -1
- package/dist/collection/stories/icon-gallery.js +0 -10
- package/dist/collection/stories/icon-gallery.js.map +0 -1
- package/dist/collection/utils/behaviors.utils.spec.js +0 -61
- package/dist/collection/utils/behaviors.utils.spec.js.map +0 -1
- package/dist/esm/index-9aa447a7.js.map +0 -1
- package/dist/esm/mg-menu.conf-4b2d2eab.js.map +0 -1
- package/dist/mg-components/p-06715c36.entry.js +0 -2
- package/dist/mg-components/p-1564df7a.js +0 -2
- package/dist/mg-components/p-1564df7a.js.map +0 -1
- package/dist/mg-components/p-4e7a7f68.js.map +0 -1
- package/dist/mg-components/p-fee35953.entry.js +0 -2
- package/dist/mg-components/p-fee35953.entry.js.map +0 -1
- package/dist/types/stories/icon-gallery.d.ts +0 -6
|
@@ -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-3d4f1cfd.js');
|
|
6
|
+
const index$1 = require('./index-f699ee11.js');
|
|
7
|
+
const mgMenu_conf = require('./mg-menu.conf-c291eee6.js');
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Available menu-item positions
|
|
@@ -62,7 +63,7 @@ const MgActionMore = class {
|
|
|
62
63
|
************/
|
|
63
64
|
this.name = 'mg-action-more';
|
|
64
65
|
this.classBase = 'mg-c-action-more';
|
|
65
|
-
this.mgPopoverIdentifier =
|
|
66
|
+
this.mgPopoverIdentifier = index$1.je(this.name);
|
|
66
67
|
/************
|
|
67
68
|
* Methods *
|
|
68
69
|
***********/
|
|
@@ -130,7 +131,7 @@ const MgActionMore = class {
|
|
|
130
131
|
* Validate props
|
|
131
132
|
*/
|
|
132
133
|
componentWillLoad() {
|
|
133
|
-
this.messages =
|
|
134
|
+
this.messages = index$1.initLocales(this.element).messages.actionMore;
|
|
134
135
|
this.validateItems(this.items);
|
|
135
136
|
this.validateButton(this.button);
|
|
136
137
|
this.validateIcon(this.icon);
|
|
@@ -186,7 +187,7 @@ const MgBadge = class {
|
|
|
186
187
|
this.label = undefined;
|
|
187
188
|
this.variant = variants$5[0];
|
|
188
189
|
this.outline = undefined;
|
|
189
|
-
this.classCollection = new
|
|
190
|
+
this.classCollection = new index$1.Fe(['mg-c-badge']);
|
|
190
191
|
}
|
|
191
192
|
validateValue(newValue) {
|
|
192
193
|
if (/^(\d+\+*|[?*!a-z])$/i.exec(`${newValue}`) === null) {
|
|
@@ -194,7 +195,7 @@ const MgBadge = class {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
validateLabel(newValue) {
|
|
197
|
-
if (!
|
|
198
|
+
if (!index$1.He(newValue)) {
|
|
198
199
|
throw new Error('<mg-badge> prop "label" is required.');
|
|
199
200
|
}
|
|
200
201
|
}
|
|
@@ -305,7 +306,7 @@ const MgButton = class {
|
|
|
305
306
|
this.isIcon = false;
|
|
306
307
|
this.disableOnClick = false;
|
|
307
308
|
this.loading = false;
|
|
308
|
-
this.classCollection = new
|
|
309
|
+
this.classCollection = new index$1.Fe(['mg-c-button']);
|
|
309
310
|
}
|
|
310
311
|
validateVariant(newValue, oldValue) {
|
|
311
312
|
if (!variants$4.includes(newValue)) {
|
|
@@ -364,7 +365,7 @@ const MgButton = class {
|
|
|
364
365
|
this.validateFullWidth(this.fullWidth);
|
|
365
366
|
if (this.isIcon) {
|
|
366
367
|
this.classCollection.add(`mg-c-button--icon`);
|
|
367
|
-
if (!
|
|
368
|
+
if (!index$1.He(this.label)) {
|
|
368
369
|
throw new Error(`<mg-button> prop "label" is mandatory when prop "isIcon" is set to true.`);
|
|
369
370
|
}
|
|
370
371
|
}
|
|
@@ -376,7 +377,7 @@ const MgButton = class {
|
|
|
376
377
|
* Add listners
|
|
377
378
|
*/
|
|
378
379
|
componentDidLoad() {
|
|
379
|
-
|
|
380
|
+
index$1.Pe(() => {
|
|
380
381
|
var _a;
|
|
381
382
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
382
383
|
// submit buttons should trigger form submition;
|
|
@@ -435,7 +436,7 @@ const MgCard = class {
|
|
|
435
436
|
};
|
|
436
437
|
this.variant = undefined;
|
|
437
438
|
this.variantStyle = undefined;
|
|
438
|
-
this.classCollection = new
|
|
439
|
+
this.classCollection = new index$1.Fe([this.classBase]);
|
|
439
440
|
}
|
|
440
441
|
validateVariant(newValue, oldValue) {
|
|
441
442
|
if (newValue && !variants$3.includes(newValue))
|
|
@@ -473,7 +474,7 @@ const MgCard = class {
|
|
|
473
474
|
*/
|
|
474
475
|
render() {
|
|
475
476
|
var _a;
|
|
476
|
-
return (index.h("div", { key: '
|
|
477
|
+
return (index.h("div", { key: '8eb3843ddbe71df4ae6a6f56896c1c68b5d8c17f', class: this.classCollection.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && index.h("span", { class: "mg-c-card__bar" }), index.h("slot", { key: '77d242d0d83844071e1ee8b62d1816cd732e13c1' })));
|
|
477
478
|
}
|
|
478
479
|
static get watchers() { return {
|
|
479
480
|
"variant": ["validateVariant"],
|
|
@@ -505,14 +506,14 @@ const MgCharacterLeft = class {
|
|
|
505
506
|
*/
|
|
506
507
|
componentWillLoad() {
|
|
507
508
|
this.validateMaxlength(this.maxlength);
|
|
508
|
-
this.messages =
|
|
509
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
509
510
|
}
|
|
510
511
|
/**
|
|
511
512
|
* Render component
|
|
512
513
|
* @returns HTML Element
|
|
513
514
|
*/
|
|
514
515
|
render() {
|
|
515
|
-
return (index.h("span", { key: '
|
|
516
|
+
return (index.h("span", { key: 'c18bde23c2d962cd943540eb182381de1c6dd791', id: this.identifier, "aria-live": "polite" }, index.h("span", { key: 'bf678c1d055607bbdc32a34fbf247fdd189f2d99', "aria-hidden": "true" }, this.maxlength - this.characters.length, "/", this.maxlength), index.h("span", { key: 'd18fc90eae95b1c807f6024a9681269b6552a1cf', class: "mg-u-visually-hidden" }, this.messages.nbCharLeft.replace('{counter}', this.maxlength - this.characters.length))));
|
|
516
517
|
}
|
|
517
518
|
get element() { return index.getElement(this); }
|
|
518
519
|
static get watchers() { return {
|
|
@@ -540,7 +541,7 @@ const MgDetails = class {
|
|
|
540
541
|
this.expanded = false;
|
|
541
542
|
}
|
|
542
543
|
validateTitles(newValue) {
|
|
543
|
-
if (!
|
|
544
|
+
if (!index$1.He(newValue)) {
|
|
544
545
|
throw new Error('<mg-details> prop "toggleClosed" and "toggleOpened" must be defined.');
|
|
545
546
|
}
|
|
546
547
|
}
|
|
@@ -585,7 +586,7 @@ const MgDivider = class {
|
|
|
585
586
|
* @returns HTML Element
|
|
586
587
|
*/
|
|
587
588
|
render() {
|
|
588
|
-
return (index.h("div", { key: '
|
|
589
|
+
return (index.h("div", { key: 'fd34b566182d17e5cadbb19a923ce07b53cd749d', class: {
|
|
589
590
|
'mg-c-divider': true,
|
|
590
591
|
'mg-c-divider--full': this.size === 'full',
|
|
591
592
|
} }));
|
|
@@ -602,7 +603,7 @@ const roles = ['form', 'search', 'none', 'presentation'];
|
|
|
602
603
|
*/
|
|
603
604
|
const requiredMessageStatus = ['default', 'hide'];
|
|
604
605
|
|
|
605
|
-
const mgFormCss = ".mg-u-is-asterisk{color:hsl(var(--color-danger))}.mg-c-form{--mg-inputs-title-width:var(--mg-form-inputs-title-width,
|
|
606
|
+
const mgFormCss = ".mg-u-form-legacy{--mg-form-inputs-title-width:calc(100% / 3 - 20px)}.mg-u-is-asterisk{color:hsl(var(--color-danger))}.mg-c-form{--mg-inputs-title-width:var(--mg-form-inputs-title-width, 23rem);--mg-inputs-margin-bottom:1.5rem;--mg-inputs-title-horizontal-space:3rem}.mg-c-form.mg-c-form--all-required{--mg-input-title-display:none}.mg-c-form.mg-c-form--label-on-top{--mg-inputs-margin-bottom:2.5rem}.mg-c-form>p{font-size:1.2rem}";
|
|
606
607
|
const MgFormStyle0 = mgFormCss;
|
|
607
608
|
|
|
608
609
|
const MgForm = class {
|
|
@@ -612,6 +613,7 @@ const MgForm = class {
|
|
|
612
613
|
this.formSubmit = index.createEvent(this, "form-submit", 7);
|
|
613
614
|
// Classes
|
|
614
615
|
this.classAllRequired = 'mg-c-form--all-required';
|
|
616
|
+
this.classLabelOnTop = 'mg-c-form--label-on-top';
|
|
615
617
|
/**
|
|
616
618
|
* Define required message based on mg-inputs required elements
|
|
617
619
|
*/
|
|
@@ -683,32 +685,49 @@ const MgForm = class {
|
|
|
683
685
|
// Set inputs readonly or disabled based on form configuration
|
|
684
686
|
// Othewise listen to events
|
|
685
687
|
this.mgInputs.forEach(input => {
|
|
686
|
-
if (this.
|
|
688
|
+
if (this.labelOnTop) {
|
|
689
|
+
input.labelOnTop = true;
|
|
690
|
+
}
|
|
691
|
+
if (this.readonly) {
|
|
687
692
|
input.readonly = true;
|
|
688
|
-
|
|
693
|
+
}
|
|
694
|
+
else if (this.disabled) {
|
|
689
695
|
input.disabled = true;
|
|
690
|
-
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
691
698
|
input.addEventListener('input-valid', this.checkValidity);
|
|
699
|
+
}
|
|
692
700
|
});
|
|
693
701
|
};
|
|
694
|
-
this.identifier =
|
|
702
|
+
this.identifier = index$1.je('mg-form');
|
|
695
703
|
this.name = this.identifier;
|
|
696
704
|
this.readonly = false;
|
|
697
705
|
this.requiredMessage = undefined;
|
|
698
706
|
this.ariaRole = undefined;
|
|
707
|
+
this.labelOnTop = undefined;
|
|
699
708
|
this.disabled = false;
|
|
700
709
|
this.valid = undefined;
|
|
701
710
|
this.invalid = undefined;
|
|
702
|
-
this.classCollection = new
|
|
711
|
+
this.classCollection = new index$1.Fe(['mg-c-form']);
|
|
703
712
|
this.requiredMessageText = undefined;
|
|
704
713
|
}
|
|
705
714
|
validateRequiredMessage(newValue) {
|
|
706
|
-
if (newValue && !requiredMessageStatus.includes(newValue))
|
|
715
|
+
if (newValue && !requiredMessageStatus.includes(newValue)) {
|
|
707
716
|
throw new Error(`<mg-form> prop "requiredMessage" must be one of: ${requiredMessageStatus.join(', ')}.`);
|
|
717
|
+
}
|
|
708
718
|
}
|
|
709
719
|
validateAriaRole(newValue) {
|
|
710
|
-
if (newValue && !roles.includes(newValue))
|
|
720
|
+
if (newValue && !roles.includes(newValue)) {
|
|
711
721
|
throw new Error(`<mg-form> prop "ariaRole" must be one of: ${roles.join(', ')}.`);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
handlelabelOnTop(newValue) {
|
|
725
|
+
if (newValue) {
|
|
726
|
+
this.classCollection.add(this.classLabelOnTop);
|
|
727
|
+
}
|
|
728
|
+
else {
|
|
729
|
+
this.classCollection.delete(this.classLabelOnTop);
|
|
730
|
+
}
|
|
712
731
|
}
|
|
713
732
|
handleAttributeChange() {
|
|
714
733
|
this.setMgInputs();
|
|
@@ -734,9 +753,10 @@ const MgForm = class {
|
|
|
734
753
|
*/
|
|
735
754
|
componentWillLoad() {
|
|
736
755
|
// Get locales
|
|
737
|
-
this.messages =
|
|
756
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
738
757
|
this.validateAriaRole(this.ariaRole);
|
|
739
758
|
this.validateRequiredMessage(this.requiredMessage);
|
|
759
|
+
this.handlelabelOnTop(this.labelOnTop);
|
|
740
760
|
// Get slotted mgButtons
|
|
741
761
|
this.mgButtons = Array.from(this.element.querySelectorAll('mg-button'));
|
|
742
762
|
// Set button form identifier
|
|
@@ -770,12 +790,13 @@ const MgForm = class {
|
|
|
770
790
|
* @returns HTML Element
|
|
771
791
|
*/
|
|
772
792
|
render() {
|
|
773
|
-
return (index.h("form", { key: '
|
|
793
|
+
return (index.h("form", { key: 'd47d8321976d3daabbb72eacc0f951899b571ce0', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && index.h("p", { innerHTML: this.requiredMessageText }), index.h("slot", { key: '7f95819efbe74deb72e74fff313b4f6e0a8ae3a6' }), !this.readonly && !this.disabled && index.h("slot", { name: "actions" })));
|
|
774
794
|
}
|
|
775
795
|
get element() { return index.getElement(this); }
|
|
776
796
|
static get watchers() { return {
|
|
777
797
|
"requiredMessage": ["validateRequiredMessage", "handleAttributeChange"],
|
|
778
798
|
"ariaRole": ["validateAriaRole"],
|
|
799
|
+
"labelOnTop": ["handlelabelOnTop"],
|
|
779
800
|
"readonly": ["handleAttributeChange"],
|
|
780
801
|
"disabled": ["handleAttributeChange"]
|
|
781
802
|
}; }
|
|
@@ -1216,7 +1237,7 @@ const MgIcon = class {
|
|
|
1216
1237
|
this.variant = undefined;
|
|
1217
1238
|
this.variantStyle = undefined;
|
|
1218
1239
|
this.spin = false;
|
|
1219
|
-
this.classCollection = new
|
|
1240
|
+
this.classCollection = new index$1.Fe(['mg-c-icon']);
|
|
1220
1241
|
}
|
|
1221
1242
|
validateIcon(newValue, oldValue) {
|
|
1222
1243
|
if (!iconList.includes(newValue))
|
|
@@ -1315,7 +1336,7 @@ const MgIllustratedMessage = class {
|
|
|
1315
1336
|
componentDidLoad() {
|
|
1316
1337
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
1317
1338
|
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
1318
|
-
if (!
|
|
1339
|
+
if (!index$1._e(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
1319
1340
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
1320
1341
|
}
|
|
1321
1342
|
else if (slottedIllustrations.length !== 1) {
|
|
@@ -1352,6 +1373,7 @@ var Handler;
|
|
|
1352
1373
|
Handler["BLUR"] = "blur";
|
|
1353
1374
|
Handler["FOCUS"] = "focus";
|
|
1354
1375
|
})(Handler || (Handler = {}));
|
|
1376
|
+
const tooltipPositions = ['input', 'label'];
|
|
1355
1377
|
|
|
1356
1378
|
/**
|
|
1357
1379
|
* Apply in all input child node the aria-describedby attribute
|
|
@@ -1389,12 +1411,33 @@ const manageClasses = (props) => {
|
|
|
1389
1411
|
if (props.mgWidth !== undefined)
|
|
1390
1412
|
props.classCollection.add(`mg-c-input--width-${props.mgWidth}`);
|
|
1391
1413
|
};
|
|
1414
|
+
/**
|
|
1415
|
+
* Check props configuration
|
|
1416
|
+
* @param props - MgInput Interface Props
|
|
1417
|
+
*/
|
|
1418
|
+
const checkPropsConfig = (props) => {
|
|
1419
|
+
if (!index$1.He(props.identifier)) {
|
|
1420
|
+
throw new Error('<mg-input> prop "identifier" is required.');
|
|
1421
|
+
}
|
|
1422
|
+
if (!index$1.He(props.label)) {
|
|
1423
|
+
throw new Error('<mg-input> prop "label" is required.');
|
|
1424
|
+
}
|
|
1425
|
+
if (props.labelOnTop && props.labelHide) {
|
|
1426
|
+
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
1427
|
+
}
|
|
1428
|
+
if (!tooltipPositions.includes(props.tooltipPosition)) {
|
|
1429
|
+
throw new Error(`<mg-input> prop "tooltipPosition" must be one of: ${tooltipPositions.join(', ')}`);
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1392
1432
|
/**
|
|
1393
1433
|
* Get tagname
|
|
1394
1434
|
* @param isFieldset - is fieldset
|
|
1395
1435
|
* @returns tag name
|
|
1396
1436
|
*/
|
|
1397
1437
|
const getTagName = (isFieldset, readOnly) => (!isFieldset || readOnly ? 'div' : 'fieldset');
|
|
1438
|
+
/**
|
|
1439
|
+
* MgInput Interface
|
|
1440
|
+
*/
|
|
1398
1441
|
/**
|
|
1399
1442
|
* Get input template
|
|
1400
1443
|
* @param props - MgInput Interface Props
|
|
@@ -1404,17 +1447,9 @@ const getTagName = (isFieldset, readOnly) => (!isFieldset || readOnly ? 'div' :
|
|
|
1404
1447
|
*/
|
|
1405
1448
|
const MgInput = (props, children, utils) => {
|
|
1406
1449
|
/**
|
|
1407
|
-
* Check
|
|
1450
|
+
* Check props config
|
|
1408
1451
|
*/
|
|
1409
|
-
|
|
1410
|
-
throw new Error('<mg-input> prop "identifier" is required.');
|
|
1411
|
-
}
|
|
1412
|
-
if (!mgMenu_conf.He(props.label)) {
|
|
1413
|
-
throw new Error('<mg-input> prop "label" is required.');
|
|
1414
|
-
}
|
|
1415
|
-
if (props.labelOnTop && props.labelHide) {
|
|
1416
|
-
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
1417
|
-
}
|
|
1452
|
+
checkPropsConfig(props);
|
|
1418
1453
|
/**
|
|
1419
1454
|
* Set readonly value
|
|
1420
1455
|
*/
|
|
@@ -1441,15 +1476,15 @@ const MgInput = (props, children, utils) => {
|
|
|
1441
1476
|
/**
|
|
1442
1477
|
* Return template
|
|
1443
1478
|
*
|
|
1444
|
-
*
|
|
1445
|
-
* | label | input | tooltip |
|
|
1446
|
-
*
|
|
1447
|
-
* |
|
|
1448
|
-
* |
|
|
1449
|
-
* |
|
|
1450
|
-
* |
|
|
1451
|
-
* |
|
|
1452
|
-
*
|
|
1479
|
+
* +--------+---------+--------------+---------+
|
|
1480
|
+
* | label | tooltip | input | tooltip |
|
|
1481
|
+
* |--------+---------+--------------+---------+
|
|
1482
|
+
* | | nb Char Left |
|
|
1483
|
+
* | +------------------------+
|
|
1484
|
+
* | | Help Text |
|
|
1485
|
+
* | +------------------------+
|
|
1486
|
+
* | | Error |
|
|
1487
|
+
* +------------------+------------------------+
|
|
1453
1488
|
*
|
|
1454
1489
|
* Error message is based on this aria method: https://www.w3.org/WAI/tutorials/forms/notifications/#on-focus-change
|
|
1455
1490
|
*/
|
|
@@ -1460,22 +1495,17 @@ const MgInput = (props, children, utils) => {
|
|
|
1460
1495
|
*/
|
|
1461
1496
|
const getTooltip = () => (index.h("mg-tooltip", { identifier: `${props.identifier}-tooltip`, message: props.tooltip },
|
|
1462
1497
|
index.h("mg-icon", { icon: "info-circle" })));
|
|
1463
|
-
/**
|
|
1464
|
-
* Get input title (label) node
|
|
1465
|
-
* Display asterisk only if not disabled and not readonly
|
|
1466
|
-
* @returns mg-input-title
|
|
1467
|
-
*/
|
|
1468
|
-
const getInputTitle = () => (index.h("mg-input-title", { identifier: props.identifier, readonly: props.readonly, class: props.labelHide ? 'mg-u-visually-hidden' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
|
|
1469
1498
|
return (index.h(TagName, { class: props.classCollection.join() },
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
!props.readonly && props.
|
|
1499
|
+
index.h("div", { class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': props.labelHide } },
|
|
1500
|
+
index.h("mg-input-title", { identifier: props.identifier, readonly: props.readonly, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label),
|
|
1501
|
+
props.tooltip && !props.readonly && (props.tooltipPosition === 'label' || props.labelOnTop) && !props.labelHide && getTooltip()),
|
|
1473
1502
|
props.readonly ? (index.h("div", { class: "mg-c-input__input-container" },
|
|
1474
|
-
index.h("
|
|
1503
|
+
Array.isArray(props.readonlyValue) ? (index.h("ul", null, props.readonlyValue.map(value => (index.h("li", { key: value },
|
|
1504
|
+
index.h("strong", null, value)))))) : (index.h("strong", null, props.readonlyValue)),
|
|
1475
1505
|
children.filter(child => Object.values(child).includes('append-input')))) : (index.h("div", { class: "mg-c-input__input-container" },
|
|
1476
1506
|
index.h("div", { class: { 'mg-c-input__input': true, 'mg-c-input__input--has-error': props.errorMessage !== undefined } },
|
|
1477
1507
|
applyAriadescribedBy(children, ariaDescribedbyIDs, utils),
|
|
1478
|
-
!props.labelOnTop && props.
|
|
1508
|
+
props.tooltip && !props.readonly && !props.labelOnTop && (props.tooltipPosition === 'input' || props.labelHide) && getTooltip()),
|
|
1479
1509
|
props.helpText && index.h("div", { id: helpTextId, class: "mg-c-input__help-text", innerHTML: props.helpText }),
|
|
1480
1510
|
props.errorMessage && !props.readonly && !props.disabled && (index.h("div", { id: helpTextErrorId, class: "mg-c-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
|
|
1481
1511
|
};
|
|
@@ -1519,18 +1549,16 @@ const MgInputCheckboxList = (props) => (
|
|
|
1519
1549
|
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
1520
1550
|
index.h("ul", { class: {
|
|
1521
1551
|
'mg-c-input__input-group-container': true,
|
|
1522
|
-
'mg-c-input__input-group-container--vertical': props.inputVerticalList ||
|
|
1523
|
-
'mg-c-input__input-checkbox-multi-inputs': props.type === 'multi'
|
|
1524
|
-
}, role: "list", "aria-describedby": props.displaySearchInput ? 'search-results' : undefined, "aria-label": props.displaySearchInput ? props.messages.searchResults : undefined, "aria-live": props.displaySearchInput ? 'polite' : undefined, id: props.id }, props.checkboxes
|
|
1525
|
-
.filter(item => !props.readonly || item.value)
|
|
1526
|
-
.map(input => {
|
|
1552
|
+
'mg-c-input__input-group-container--vertical': props.inputVerticalList || props.type === 'multi',
|
|
1553
|
+
'mg-c-input__input-checkbox-multi-inputs': props.type === 'multi',
|
|
1554
|
+
}, role: "list", "aria-describedby": props.displaySearchInput ? 'search-results' : undefined, "aria-label": props.displaySearchInput ? props.messages.searchResults : undefined, "aria-live": props.displaySearchInput ? 'polite' : undefined, id: props.id }, props.checkboxes.map(input => {
|
|
1527
1555
|
var _a, _b;
|
|
1528
1556
|
return (index.h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
|
|
1529
|
-
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.
|
|
1557
|
+
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 }),
|
|
1530
1558
|
index.h("label", { htmlFor: input._id }, input.title)));
|
|
1531
1559
|
})));
|
|
1532
1560
|
|
|
1533
|
-
const mgInputCheckboxCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
1561
|
+
const mgInputCheckboxCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);gap:1rem 2.3rem;list-style:none}.mg-c-input__input-group-container--vertical{flex-direction:column}fieldset.mg-c-input{padding:0;border:0;margin-right:0;margin-left:0}fieldset.mg-c-input input[type=radio],fieldset.mg-c-input input[type=checkbox]{width:var(--mg-input-check-size);height:var(--mg-input-check-size);flex-shrink:0;margin:calc((var(--font-size)*var(--line-height) - var(--mg-input-check-size))/2) .6rem 0 0}fieldset.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:.7rem}.mg-c-input__input-container mg-tooltip{margin-left:3rem}.mg-c-input__input-group{display:flex;align-items:start}.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-checkbox-multi{display:flex;flex-wrap:wrap;column-gap:calc(var(--mg-inputs-spacer)*1.2)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi--with-values.mg-c-input__input-checkbox-multi{gap:.4rem}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi .mg-c-input__input-checkbox-multi-content{display:flex;flex-flow:column nowrap;gap:calc(0.4rem*2)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi .mg-c-input__input-checkbox-multi-content .mg-c-input__input-group{margin-left:calc(0.4rem*2)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi--search-mode.mg-c-input__input-checkbox-multi .mg-c-input__input-checkbox-multi-content{width:37rem;height:40rem}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-values-container{display:flex;flex-flow:row wrap;gap:calc(0.4rem*1);padding:0;margin:0;list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-value{display:inline-flex;min-width:var(--default-size);min-height:var(--default-size);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--default-size) - .2rem - var(--font-size)*var(--line-height))/2) 1.1rem;border-radius:.3rem;background-color:hsl(var(--mg-color-dark-5-hsl));font-size:var(--font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-no-result{text-align:center}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-text,.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-title{display:inline;margin:0;color:hsl(var(--mg-color-dark-40-hsl))}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-title{margin:0 1.1rem}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-sections{display:flex;flex-flow:column wrap;gap:calc(0.4rem*1)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-sections-container{display:flex;flex-flow:column nowrap;gap:calc(0.4rem*0);max-height:80vh;padding-right:1rem;overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-section-header{display:flex;flex-flow:row wrap;gap:calc(0.4rem*2);min-height:var(--default-size);flex-wrap:nowrap;align-items:center;text-wrap:nowrap}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-section-header-tootlip{display:inline-block;width:auto;height:auto;margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-section-header-label{font-size:var(--font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-checkbox-multi-inputs{padding:.4rem calc(0.4rem*2) .4rem calc(0.4rem/2);margin:0}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__input-checkbox-multi-section-header-tootlip){margin-left:var(--mg-inputs-spacer)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-popover-min-width:7rem;--mg-card-padding:calc(0.4rem * 2)}.mg-c-input.mg-c-input--checkbox-multi mg-input-text{--mg-inputs-margin-bottom:0}";
|
|
1534
1562
|
const MgInputCheckboxStyle0 = mgInputCheckboxCss;
|
|
1535
1563
|
|
|
1536
1564
|
/**
|
|
@@ -1649,6 +1677,16 @@ const MgInputCheckbox = class {
|
|
|
1649
1677
|
return o;
|
|
1650
1678
|
});
|
|
1651
1679
|
};
|
|
1680
|
+
/**
|
|
1681
|
+
* Get readonly values
|
|
1682
|
+
* @returns formated readonly value
|
|
1683
|
+
*/
|
|
1684
|
+
this.getReadonlyValues = () => this.inputVerticalList
|
|
1685
|
+
? this.value.filter(({ value }) => value).map(({ title }) => title)
|
|
1686
|
+
: this.value
|
|
1687
|
+
.filter(({ value }) => value)
|
|
1688
|
+
.map(({ title }) => title)
|
|
1689
|
+
.join(', ');
|
|
1652
1690
|
/**
|
|
1653
1691
|
* has invalid input
|
|
1654
1692
|
* @returns true if at least one input is invalid
|
|
@@ -1658,7 +1696,7 @@ const MgInputCheckbox = class {
|
|
|
1658
1696
|
* Method to update searchResults
|
|
1659
1697
|
*/
|
|
1660
1698
|
this.updateSearchResults = () => {
|
|
1661
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
1699
|
+
this.searchResults = this.checkboxItems.filter(item => index$1.Ce(item.title).includes(index$1.Ce(this.searchValue)));
|
|
1662
1700
|
};
|
|
1663
1701
|
/**
|
|
1664
1702
|
* Methode to validate if one of inputs value is checked id required
|
|
@@ -1728,10 +1766,11 @@ const MgInputCheckbox = class {
|
|
|
1728
1766
|
this.displaySelectedValues = undefined;
|
|
1729
1767
|
this.disabled = false;
|
|
1730
1768
|
this.tooltip = undefined;
|
|
1769
|
+
this.tooltipPosition = 'input';
|
|
1731
1770
|
this.helpText = undefined;
|
|
1732
1771
|
this.valid = undefined;
|
|
1733
1772
|
this.invalid = undefined;
|
|
1734
|
-
this.classCollection = new
|
|
1773
|
+
this.classCollection = new index$1.Fe([this.baseClassName]);
|
|
1735
1774
|
this.errorMessage = undefined;
|
|
1736
1775
|
this.checkboxItems = [];
|
|
1737
1776
|
this.displaySearchInput = undefined;
|
|
@@ -1818,7 +1857,7 @@ const MgInputCheckbox = class {
|
|
|
1818
1857
|
if (typeof valid !== 'boolean') {
|
|
1819
1858
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean');
|
|
1820
1859
|
}
|
|
1821
|
-
else if (!
|
|
1860
|
+
else if (!index$1.He(errorMessage)) {
|
|
1822
1861
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string');
|
|
1823
1862
|
}
|
|
1824
1863
|
else {
|
|
@@ -1861,7 +1900,7 @@ const MgInputCheckbox = class {
|
|
|
1861
1900
|
*/
|
|
1862
1901
|
componentWillLoad() {
|
|
1863
1902
|
// Get locales
|
|
1864
|
-
this.messages =
|
|
1903
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
1865
1904
|
// Validate
|
|
1866
1905
|
// `validateType` must be done before `validateValue` because we need to set mode['auto'|'custom'] from type
|
|
1867
1906
|
// and `validateValue` updates `this.checkboxItems` watcher which requires a defined `this.type`.
|
|
@@ -1881,9 +1920,11 @@ const MgInputCheckbox = class {
|
|
|
1881
1920
|
*/
|
|
1882
1921
|
componentDidLoad() {
|
|
1883
1922
|
var _a, _b;
|
|
1884
|
-
this.
|
|
1885
|
-
|
|
1886
|
-
|
|
1923
|
+
if (!this.readonly) {
|
|
1924
|
+
this.element.shadowRoot.querySelector('legend').setAttribute('id', this.legendId);
|
|
1925
|
+
this.searchInput = (_a = this.element.shadowRoot.querySelector('mg-input-text')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('input');
|
|
1926
|
+
(_b = this.searchInput) === null || _b === void 0 ? void 0 : _b.addEventListener('keydown', this.handleKeydown);
|
|
1927
|
+
}
|
|
1887
1928
|
}
|
|
1888
1929
|
/**
|
|
1889
1930
|
* Render checkboxes by section
|
|
@@ -1925,7 +1966,7 @@ const MgInputCheckbox = class {
|
|
|
1925
1966
|
index.h("mg-input-text", { key: "input-search", identifier: `${this.identifier}-input-search`, icon: "magnifying-glass", type: "search", placeholder: this.messages.input.checkbox.label, label: this.messages.input.checkbox.label, mgWidth: "full", value: this.searchValue, labelHide: true, displayCharacterLeft: false, name: "q", "onValue-change": this.handleSearchChange, "aria-controls": "search-results items-list" }),
|
|
1926
1967
|
index.h("p", { key: "search-results", role: "status", class: "mg-u-visually-hidden", id: "search-results" }, `${checkboxes.length} ${this.messages.input.checkbox[checkboxes.length > 0 ? 'results' : 'result']}`),
|
|
1927
1968
|
index.h("div", { key: "sections-container", class: "mg-c-input__input-checkbox-multi-sections-container" }, this.renderCheckboxBySection(checkboxes)),
|
|
1928
|
-
]) : (index.h(MgInputCheckboxList, { checkboxes: checkboxes, inputVerticalList: true, type: this.type,
|
|
1969
|
+
]) : (index.h(MgInputCheckboxList, { checkboxes: checkboxes, inputVerticalList: true, type: this.type, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name, invalid: this.invalid })), this.displaySearchInput && checkboxes.length === 0 && index.h("p", { class: "mg-c-input__input-checkbox-multi-no-result" }, this.messages.input.checkbox.noResult))), this.displaySelectedValues ? (selectedValuesNb > 0 && (index.h("ul", { role: "list", class: "mg-c-input__input-checkbox-multi-values-container" }, this.getSelectedItems().map(({ title }) => (index.h("li", { class: "mg-c-input__input-checkbox-multi-value", key: title }, title)))))) : (index.h("strong", null, this.messages.input.checkbox[selectedValuesNb > 1 ? 'selectedValues' : 'selectedValue'].replace('{nb}', selectedValuesNb)))));
|
|
1929
1970
|
}
|
|
1930
1971
|
/**
|
|
1931
1972
|
* Render
|
|
@@ -1933,7 +1974,7 @@ const MgInputCheckbox = class {
|
|
|
1933
1974
|
*/
|
|
1934
1975
|
render() {
|
|
1935
1976
|
var _a;
|
|
1936
|
-
return (index.h(MgInput, { key: '
|
|
1977
|
+
return (index.h(MgInput, { key: 'a36e398ac67e25249ea078b9ad70af146f045fde', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString(), readonlyValue: this.getReadonlyValues(), tooltip: !this.readonly ? this.tooltip : undefined, tooltipPosition: this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, this.type === 'checkbox' ? (index.h(MgInputCheckboxList, { checkboxes: this.checkboxItems, inputVerticalList: this.inputVerticalList, type: this.type, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name, invalid: this.invalid })) : (this.renderCheckboxMulti())));
|
|
1937
1978
|
}
|
|
1938
1979
|
get element() { return index.getElement(this); }
|
|
1939
1980
|
static get watchers() { return {
|
|
@@ -2048,7 +2089,7 @@ const MgInputCheckboxPaginated = class {
|
|
|
2048
2089
|
const getText = (checkboxes) => (index.h("em", { key: '28eedd949445bc6c7a5a750359af7159055657d8', class: "mg-c-input__input-checkbox-multi-section-header-label" }, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`));
|
|
2049
2090
|
const [from, to] = this.getFromToIndexes();
|
|
2050
2091
|
const itemsContainerId = `items-${this.sectionKind}-container`;
|
|
2051
|
-
return (index.h(index.Host, { key: 'a7ade87a72bb1cba4d0c20dde425cefc5c7fbff4', hidden: this.checkboxes.length < 1 }, index.h("div", { key: '38711edade3945e940ba29b44492424c3e5b7063', class: "mg-c-input__input-checkbox-multi-section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (index.h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, index.h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), index.h("span", { class: "mg-c-input__input-checkbox-multi-text" }, getText(this.checkboxes)))) : (index.h("p", { class: "mg-c-input__input-checkbox-multi-title" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (index.h("mg-tooltip", { class: "mg-c-input__input-checkbox-multi-section-header-tootlip", message: this.messages.tooltip, "data-popper-strategy": "absolute" }, index.h("mg-button", { variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (index.h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), index.h("div", { key: '3a514d5711da9ebb57d21e70609b7f6f2d1e621e', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__input-checkbox-multi-section-content" }, index.h(MgInputCheckboxList, { key: '
|
|
2092
|
+
return (index.h(index.Host, { key: 'a7ade87a72bb1cba4d0c20dde425cefc5c7fbff4', hidden: this.checkboxes.length < 1 }, index.h("div", { key: '38711edade3945e940ba29b44492424c3e5b7063', class: "mg-c-input__input-checkbox-multi-section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (index.h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, index.h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), index.h("span", { class: "mg-c-input__input-checkbox-multi-text" }, getText(this.checkboxes)))) : (index.h("p", { class: "mg-c-input__input-checkbox-multi-title" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (index.h("mg-tooltip", { class: "mg-c-input__input-checkbox-multi-section-header-tootlip", message: this.messages.tooltip, "data-popper-strategy": "absolute" }, index.h("mg-button", { variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (index.h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), index.h("div", { key: '3a514d5711da9ebb57d21e70609b7f6f2d1e621e', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__input-checkbox-multi-section-content" }, index.h(MgInputCheckboxList, { key: '84223d73e67e355ce01a4f70ef75a42a18fd96b4', checkboxes: this.getArrayRange(this.checkboxes, from, to), inputVerticalList: true, type: 'multi', displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, disabled: this.disabled, name: this.name, invalid: this.invalid }))));
|
|
2052
2093
|
}
|
|
2053
2094
|
static get watchers() { return {
|
|
2054
2095
|
"checkboxes": ["validateCheckboxes"],
|
|
@@ -2064,7 +2105,7 @@ var InputError$1;
|
|
|
2064
2105
|
InputError["REQUIRED"] = "required";
|
|
2065
2106
|
})(InputError$1 || (InputError$1 = {}));
|
|
2066
2107
|
|
|
2067
|
-
const mgInputDateCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
2108
|
+
const mgInputDateCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--label-on-top .mg-c-input__box{width:auto;max-width:100%}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--is-input-group-append.mg-c-input--readonly slot[name=append-input]{display:none}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}";
|
|
2068
2109
|
const MgInputDateStyle0 = mgInputDateCss;
|
|
2069
2110
|
|
|
2070
2111
|
const MgInputDate = class {
|
|
@@ -2081,10 +2122,10 @@ const MgInputDate = class {
|
|
|
2081
2122
|
*/
|
|
2082
2123
|
this.formatHelpText = (helpText) => {
|
|
2083
2124
|
const defaultHelpTextVariable = '{defaultHelpText}';
|
|
2084
|
-
let text =
|
|
2125
|
+
let text = index$1.He(helpText) ? helpText : this.messages.input.date.helpText;
|
|
2085
2126
|
if (text.includes(defaultHelpTextVariable))
|
|
2086
2127
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
2087
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}',
|
|
2128
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', index$1.be(index$1.Ae(new Date('2023-12-24')), this.systemLocale));
|
|
2088
2129
|
};
|
|
2089
2130
|
/**
|
|
2090
2131
|
* Handle input event
|
|
@@ -2143,7 +2184,6 @@ const MgInputDate = class {
|
|
|
2143
2184
|
* @param errorMessage - errorMessage override
|
|
2144
2185
|
*/
|
|
2145
2186
|
this.setErrorMessage = (errorMessage) => {
|
|
2146
|
-
var _a;
|
|
2147
2187
|
// Set error message
|
|
2148
2188
|
this.errorMessage = undefined;
|
|
2149
2189
|
if (!this.valid) {
|
|
@@ -2158,15 +2198,13 @@ const MgInputDate = class {
|
|
|
2158
2198
|
// min, max & minMax
|
|
2159
2199
|
else if ([InputError$1.MIN, InputError$1.MAX, InputError$1.MINMAX].includes(inputError)) {
|
|
2160
2200
|
this.errorMessage = this.messages.errors.date[inputError]
|
|
2161
|
-
.replace('{min}',
|
|
2162
|
-
.replace('{max}',
|
|
2201
|
+
.replace('{min}', index$1.be(this.min, this.systemLocale))
|
|
2202
|
+
.replace('{max}', index$1.be(this.max, this.systemLocale));
|
|
2163
2203
|
}
|
|
2164
2204
|
// wrong date format
|
|
2165
2205
|
// element.validity.badInput is default error message
|
|
2166
2206
|
else {
|
|
2167
|
-
this.errorMessage = this.messages.errors.date.badInput
|
|
2168
|
-
.replace('{min}', ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 ? mgMenu_conf.be(this.min, this.systemLocale) : mgMenu_conf.be('1900-01-01', this.systemLocale))
|
|
2169
|
-
.replace('{pattern}', this.renderPattern());
|
|
2207
|
+
this.errorMessage = this.messages.errors.date.badInput.replace('{pattern}', this.renderPattern());
|
|
2170
2208
|
}
|
|
2171
2209
|
}
|
|
2172
2210
|
};
|
|
@@ -2175,7 +2213,7 @@ const MgInputDate = class {
|
|
|
2175
2213
|
* @returns translated html pattern
|
|
2176
2214
|
*/
|
|
2177
2215
|
this.renderPattern = () => {
|
|
2178
|
-
let patternLocal =
|
|
2216
|
+
let patternLocal = index$1.Ee(this.systemLocale);
|
|
2179
2217
|
for (const key in this.messages.input.date.pattern) {
|
|
2180
2218
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
2181
2219
|
}
|
|
@@ -2193,17 +2231,18 @@ const MgInputDate = class {
|
|
|
2193
2231
|
this.max = undefined;
|
|
2194
2232
|
this.disabled = false;
|
|
2195
2233
|
this.tooltip = undefined;
|
|
2234
|
+
this.tooltipPosition = 'input';
|
|
2196
2235
|
this.helpText = undefined;
|
|
2197
2236
|
this.valid = undefined;
|
|
2198
2237
|
this.invalid = undefined;
|
|
2199
|
-
this.classCollection = new
|
|
2238
|
+
this.classCollection = new index$1.Fe(['mg-c-input--date']);
|
|
2200
2239
|
this.errorMessage = undefined;
|
|
2201
2240
|
}
|
|
2202
2241
|
validateValue(newValue) {
|
|
2203
2242
|
// When the input is not fully completed or has been cleared, the value becomes an empty string.
|
|
2204
2243
|
if (newValue === '')
|
|
2205
2244
|
newValue = null;
|
|
2206
|
-
if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !
|
|
2245
|
+
if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !index$1.Se.test(newValue))) {
|
|
2207
2246
|
throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
2208
2247
|
}
|
|
2209
2248
|
else {
|
|
@@ -2211,7 +2250,7 @@ const MgInputDate = class {
|
|
|
2211
2250
|
}
|
|
2212
2251
|
}
|
|
2213
2252
|
validateMinMax(newValue) {
|
|
2214
|
-
if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === 0 || ((newValue === null || newValue === void 0 ? void 0 : newValue.length) > 0 && !(typeof newValue === 'string' &&
|
|
2253
|
+
if ((newValue === null || newValue === void 0 ? void 0 : newValue.length) === 0 || ((newValue === null || newValue === void 0 ? void 0 : newValue.length) > 0 && !(typeof newValue === 'string' && index$1.Se.test(newValue)))) {
|
|
2215
2254
|
throw new Error("<mg-input-date> props 'min/max' doesn't match pattern: yyyy-mm-dd");
|
|
2216
2255
|
}
|
|
2217
2256
|
}
|
|
@@ -2245,7 +2284,7 @@ const MgInputDate = class {
|
|
|
2245
2284
|
if (typeof valid !== 'boolean') {
|
|
2246
2285
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean');
|
|
2247
2286
|
}
|
|
2248
|
-
else if (!
|
|
2287
|
+
else if (!index$1.He(errorMessage)) {
|
|
2249
2288
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string');
|
|
2250
2289
|
}
|
|
2251
2290
|
else {
|
|
@@ -2275,7 +2314,7 @@ const MgInputDate = class {
|
|
|
2275
2314
|
*/
|
|
2276
2315
|
componentWillLoad() {
|
|
2277
2316
|
// Get locales
|
|
2278
|
-
const locales =
|
|
2317
|
+
const locales = index$1.initLocales(this.element);
|
|
2279
2318
|
this.locale = locales.locale;
|
|
2280
2319
|
this.messages = locales.messages;
|
|
2281
2320
|
// as a native input use the OS locale to define the date pattern
|
|
@@ -2297,7 +2336,7 @@ const MgInputDate = class {
|
|
|
2297
2336
|
* @returns HTML Element
|
|
2298
2337
|
*/
|
|
2299
2338
|
render() {
|
|
2300
|
-
return (index.h(MgInput, { key: '
|
|
2339
|
+
return (index.h(MgInput, { key: 'd6e63d2f60d8c1b977181b35ad1c5393ebbf9f2d', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: index$1.be(this.value, this.locale), tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage, isFieldset: false }, index.h("input", { key: 'd94cfb21684af81db4dc3fc3ba1cc1fdfdaa2793', 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, ref: (el) => {
|
|
2301
2340
|
if (el !== null)
|
|
2302
2341
|
this.input = el;
|
|
2303
2342
|
} })));
|
|
@@ -2318,6 +2357,7 @@ MgInputDate.style = MgInputDateStyle0;
|
|
|
2318
2357
|
* List of all possibles types
|
|
2319
2358
|
*/
|
|
2320
2359
|
const types = ['decimal', 'integer', 'currency'];
|
|
2360
|
+
const formats = ['none', 'number', 'currency'];
|
|
2321
2361
|
var InputError;
|
|
2322
2362
|
(function (InputError) {
|
|
2323
2363
|
InputError["MIN"] = "min";
|
|
@@ -2326,7 +2366,7 @@ var InputError;
|
|
|
2326
2366
|
InputError["REQUIRED"] = "required";
|
|
2327
2367
|
})(InputError || (InputError = {}));
|
|
2328
2368
|
|
|
2329
|
-
const mgInputNumericCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
2369
|
+
const mgInputNumericCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--label-on-top .mg-c-input__box{width:auto;max-width:100%}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--is-input-group-append.mg-c-input--readonly slot[name=append-input]{display:none}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input:not(.mg-c-input--label-on-top) .mg-c-input__box{width:100%;min-width:5rem;max-width:calc(17.7rem + var(--mg-inputs-spacer)*2)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:space-between}.mg-c-input.mg-c-input--width-full.mg-c-input--label-on-top .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container{width:100%;flex:auto}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container .mg-c-input__box{max-width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__input{width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__with-character-left{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__box{min-width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-4 .mg-c-input__input-container .mg-c-input__box{max-width:7rem}.mg-c-input.mg-c-input--width-2 .mg-c-input__input-container .mg-c-input__box{max-width:5rem}.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{text-align:var(--mg-inputs-text-align, right)}";
|
|
2330
2370
|
const MgInputNumericStyle0 = mgInputNumericCss;
|
|
2331
2371
|
|
|
2332
2372
|
const MgInputNumeric = class {
|
|
@@ -2426,7 +2466,16 @@ const MgInputNumeric = class {
|
|
|
2426
2466
|
* @param value - value to format
|
|
2427
2467
|
* @returns formated local value
|
|
2428
2468
|
*/
|
|
2429
|
-
this.formatValue = (value) =>
|
|
2469
|
+
this.formatValue = (value) => {
|
|
2470
|
+
switch (this.format) {
|
|
2471
|
+
case 'number':
|
|
2472
|
+
return index$1.Me(value, this.locale);
|
|
2473
|
+
case 'currency':
|
|
2474
|
+
return index$1.Re(value, this.locale, this.currency);
|
|
2475
|
+
case 'none':
|
|
2476
|
+
return value.toString();
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2430
2479
|
/**
|
|
2431
2480
|
* Validate append slot
|
|
2432
2481
|
*/
|
|
@@ -2450,14 +2499,16 @@ const MgInputNumeric = class {
|
|
|
2450
2499
|
this.disabled = false;
|
|
2451
2500
|
this.mgWidth = undefined;
|
|
2452
2501
|
this.tooltip = undefined;
|
|
2502
|
+
this.tooltipPosition = 'input';
|
|
2453
2503
|
this.helpText = undefined;
|
|
2454
|
-
this.type =
|
|
2504
|
+
this.type = 'decimal';
|
|
2505
|
+
this.format = 'number';
|
|
2455
2506
|
this.currency = 'USD';
|
|
2456
2507
|
this.integerLength = 13;
|
|
2457
2508
|
this.decimalLength = 2;
|
|
2458
2509
|
this.valid = undefined;
|
|
2459
2510
|
this.invalid = undefined;
|
|
2460
|
-
this.classCollection = new
|
|
2511
|
+
this.classCollection = new index$1.Fe(['mg-c-input--numeric']);
|
|
2461
2512
|
this.errorMessage = undefined;
|
|
2462
2513
|
this.hasFocus = undefined;
|
|
2463
2514
|
}
|
|
@@ -2493,6 +2544,14 @@ const MgInputNumeric = class {
|
|
|
2493
2544
|
if (!types.includes(newValue)) {
|
|
2494
2545
|
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}`);
|
|
2495
2546
|
}
|
|
2547
|
+
else if (newValue === 'currency') {
|
|
2548
|
+
this.format = 'currency';
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
watchFormat(newValue) {
|
|
2552
|
+
if (!formats.includes(newValue)) {
|
|
2553
|
+
throw new Error(`<mg-input-numeric> prop "format" must be one of: ${formats.join(', ')}`);
|
|
2554
|
+
}
|
|
2496
2555
|
}
|
|
2497
2556
|
validateIntegerLength(newValue) {
|
|
2498
2557
|
if (newValue < 1) {
|
|
@@ -2524,7 +2583,7 @@ const MgInputNumeric = class {
|
|
|
2524
2583
|
if (typeof valid !== 'boolean') {
|
|
2525
2584
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean');
|
|
2526
2585
|
}
|
|
2527
|
-
else if (!
|
|
2586
|
+
else if (!index$1.He(errorMessage)) {
|
|
2528
2587
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string');
|
|
2529
2588
|
}
|
|
2530
2589
|
else {
|
|
@@ -2593,10 +2652,11 @@ const MgInputNumeric = class {
|
|
|
2593
2652
|
*/
|
|
2594
2653
|
componentWillLoad() {
|
|
2595
2654
|
// Get locales
|
|
2596
|
-
const locales =
|
|
2655
|
+
const locales = index$1.initLocales(this.element);
|
|
2597
2656
|
this.locale = locales.locale;
|
|
2598
2657
|
this.messages = locales.messages;
|
|
2599
2658
|
// Validate component config
|
|
2659
|
+
this.watchFormat(this.format);
|
|
2600
2660
|
this.validateType(this.type);
|
|
2601
2661
|
this.validateIntegerLength(this.integerLength);
|
|
2602
2662
|
this.validateDecimalLength(this.decimalLength);
|
|
@@ -2615,10 +2675,10 @@ const MgInputNumeric = class {
|
|
|
2615
2675
|
* @returns HTML Element
|
|
2616
2676
|
*/
|
|
2617
2677
|
render() {
|
|
2618
|
-
return (index.h(MgInput, { key: '
|
|
2678
|
+
return (index.h(MgInput, { key: 'f4b30471e47f934e0fa1b132f6fc3605ba0ce8f0', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.readonlyValue, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("input", { key: '39a6e888cfc819c4685c93731e05da29249fb408', type: "text", class: "mg-c-input__box", 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) => {
|
|
2619
2679
|
if (el !== null)
|
|
2620
2680
|
this.input = el;
|
|
2621
|
-
} }), index.h("slot", { key: '
|
|
2681
|
+
} }), index.h("slot", { key: '6db575640ca6f6e7074517547d26cc096912e2a4', name: "append-input" })));
|
|
2622
2682
|
}
|
|
2623
2683
|
get element() { return index.getElement(this); }
|
|
2624
2684
|
static get watchers() { return {
|
|
@@ -2629,13 +2689,14 @@ const MgInputNumeric = class {
|
|
|
2629
2689
|
"min": ["handleValidityChange"],
|
|
2630
2690
|
"max": ["handleValidityChange"],
|
|
2631
2691
|
"type": ["validateType"],
|
|
2692
|
+
"format": ["watchFormat"],
|
|
2632
2693
|
"integerLength": ["validateIntegerLength"],
|
|
2633
2694
|
"decimalLength": ["validateDecimalLength"]
|
|
2634
2695
|
}; }
|
|
2635
2696
|
};
|
|
2636
2697
|
MgInputNumeric.style = MgInputNumericStyle0;
|
|
2637
2698
|
|
|
2638
|
-
const mgInputPasswordCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
2699
|
+
const mgInputPasswordCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--label-on-top .mg-c-input__box{width:auto;max-width:100%}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--is-input-group-append.mg-c-input--readonly slot[name=append-input]{display:none}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input:not(.mg-c-input--label-on-top) .mg-c-input__box{width:100%;min-width:5rem;max-width:calc(17.7rem + var(--mg-inputs-spacer)*2)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:space-between}.mg-c-input.mg-c-input--width-full.mg-c-input--label-on-top .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container{width:100%;flex:auto}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container .mg-c-input__box{max-width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__input{width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__with-character-left{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__box{min-width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-4 .mg-c-input__input-container .mg-c-input__box{max-width:7rem}.mg-c-input.mg-c-input--width-2 .mg-c-input__input-container .mg-c-input__box{max-width:5rem}.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}}";
|
|
2639
2700
|
const MgInputPasswordStyle0 = mgInputPasswordCss;
|
|
2640
2701
|
|
|
2641
2702
|
const MgInputPassword = class {
|
|
@@ -2701,10 +2762,11 @@ const MgInputPassword = class {
|
|
|
2701
2762
|
this.disabled = false;
|
|
2702
2763
|
this.mgWidth = 'full';
|
|
2703
2764
|
this.tooltip = undefined;
|
|
2765
|
+
this.tooltipPosition = 'input';
|
|
2704
2766
|
this.helpText = undefined;
|
|
2705
2767
|
this.valid = undefined;
|
|
2706
2768
|
this.invalid = undefined;
|
|
2707
|
-
this.classCollection = new
|
|
2769
|
+
this.classCollection = new index$1.Fe(['mg-c-input--password']);
|
|
2708
2770
|
this.errorMessage = undefined;
|
|
2709
2771
|
}
|
|
2710
2772
|
handleValue(newValue) {
|
|
@@ -2740,7 +2802,7 @@ const MgInputPassword = class {
|
|
|
2740
2802
|
if (typeof valid !== 'boolean') {
|
|
2741
2803
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean');
|
|
2742
2804
|
}
|
|
2743
|
-
else if (!
|
|
2805
|
+
else if (!index$1.He(errorMessage)) {
|
|
2744
2806
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string');
|
|
2745
2807
|
}
|
|
2746
2808
|
else {
|
|
@@ -2770,7 +2832,7 @@ const MgInputPassword = class {
|
|
|
2770
2832
|
*/
|
|
2771
2833
|
componentWillLoad() {
|
|
2772
2834
|
// Get locales
|
|
2773
|
-
this.messages =
|
|
2835
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
2774
2836
|
// Check validity when component is ready
|
|
2775
2837
|
// return a promise to process action only in the FIRST render().
|
|
2776
2838
|
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
@@ -2783,7 +2845,7 @@ const MgInputPassword = class {
|
|
|
2783
2845
|
* @returns HTML Element
|
|
2784
2846
|
*/
|
|
2785
2847
|
render() {
|
|
2786
|
-
return (index.h(MgInput, { key: '
|
|
2848
|
+
return (index.h(MgInput, { key: 'c450a9e75c592dab0f28fcd01d380cdc3d3eec92', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: this.value !== undefined ? '•'.repeat(this.value.length) : undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("input", { key: '30c51bb8881526c2a4037236dbba0bd5668ae8cf', type: "password", class: "mg-c-input__box", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
2787
2849
|
if (el !== null)
|
|
2788
2850
|
this.input = el;
|
|
2789
2851
|
} })));
|
|
@@ -2798,7 +2860,7 @@ const MgInputPassword = class {
|
|
|
2798
2860
|
};
|
|
2799
2861
|
MgInputPassword.style = MgInputPasswordStyle0;
|
|
2800
2862
|
|
|
2801
|
-
const mgInputRadioCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
2863
|
+
const mgInputRadioCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);gap:1rem 2.3rem;list-style:none}.mg-c-input__input-group-container--vertical{flex-direction:column}fieldset.mg-c-input{padding:0;border:0;margin-right:0;margin-left:0}fieldset.mg-c-input input[type=radio],fieldset.mg-c-input input[type=checkbox]{width:var(--mg-input-check-size);height:var(--mg-input-check-size);flex-shrink:0;margin:calc((var(--font-size)*var(--line-height) - var(--mg-input-check-size))/2) .6rem 0 0}fieldset.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:.7rem}.mg-c-input__input-container mg-tooltip{margin-left:3rem}.mg-c-input__input-group{display:flex;align-items:start}.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}}";
|
|
2802
2864
|
const MgInputRadioStyle0 = mgInputRadioCss;
|
|
2803
2865
|
|
|
2804
2866
|
/**
|
|
@@ -2877,10 +2939,11 @@ const MgInputRadio = class {
|
|
|
2877
2939
|
this.readonly = false;
|
|
2878
2940
|
this.disabled = false;
|
|
2879
2941
|
this.tooltip = undefined;
|
|
2942
|
+
this.tooltipPosition = 'input';
|
|
2880
2943
|
this.helpText = undefined;
|
|
2881
2944
|
this.valid = undefined;
|
|
2882
2945
|
this.invalid = undefined;
|
|
2883
|
-
this.classCollection = new
|
|
2946
|
+
this.classCollection = new index$1.Fe(['mg-c-input--radio']);
|
|
2884
2947
|
this.errorMessage = undefined;
|
|
2885
2948
|
this.options = undefined;
|
|
2886
2949
|
}
|
|
@@ -2893,7 +2956,7 @@ const MgInputRadio = class {
|
|
|
2893
2956
|
throw new Error('<mg-input-radio> prop "items" require at least 2 items.');
|
|
2894
2957
|
}
|
|
2895
2958
|
// String array
|
|
2896
|
-
else if (
|
|
2959
|
+
else if (index$1.De(newValue)) {
|
|
2897
2960
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
2898
2961
|
}
|
|
2899
2962
|
// Object array
|
|
@@ -2934,7 +2997,7 @@ const MgInputRadio = class {
|
|
|
2934
2997
|
if (typeof valid !== 'boolean') {
|
|
2935
2998
|
throw new Error('<mg-input-radio> method "setError()" param "valid" must be a boolean');
|
|
2936
2999
|
}
|
|
2937
|
-
else if (!
|
|
3000
|
+
else if (!index$1.He(errorMessage)) {
|
|
2938
3001
|
throw new Error('<mg-input-radio> method "setError()" param "errorMessage" must be a string');
|
|
2939
3002
|
}
|
|
2940
3003
|
else {
|
|
@@ -2964,7 +3027,7 @@ const MgInputRadio = class {
|
|
|
2964
3027
|
*/
|
|
2965
3028
|
componentWillLoad() {
|
|
2966
3029
|
// Get locales
|
|
2967
|
-
this.messages =
|
|
3030
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
2968
3031
|
// Validate
|
|
2969
3032
|
this.validateItems(this.items);
|
|
2970
3033
|
// Check validity when component is ready
|
|
@@ -2979,7 +3042,7 @@ const MgInputRadio = class {
|
|
|
2979
3042
|
* @returns HTML Element
|
|
2980
3043
|
*/
|
|
2981
3044
|
render() {
|
|
2982
|
-
return (index.h(MgInput, { key: '
|
|
3045
|
+
return (index.h(MgInput, { key: 'f726d14cdde45bbeb1aea5dee0bc220d68bf1726', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, index.h("ul", { key: '7909a5bf6872c20c28f0f30aa1afa53a959c4298', class: { 'mg-c-input__input-group-container': true, 'mg-c-input__input-group-container--vertical': this.inputVerticalList }, 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) => {
|
|
2983
3046
|
if (el !== null)
|
|
2984
3047
|
this.inputs[index$1] = el;
|
|
2985
3048
|
} }), index.h("label", { htmlFor: this.identifier + '_' + index$1 }, input.title)))))));
|
|
@@ -2995,7 +3058,7 @@ const MgInputRadio = class {
|
|
|
2995
3058
|
};
|
|
2996
3059
|
MgInputRadio.style = MgInputRadioStyle0;
|
|
2997
3060
|
|
|
2998
|
-
const mgInputSelectCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
3061
|
+
const mgInputSelectCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--label-on-top .mg-c-input__box{width:auto;max-width:100%}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--is-input-group-append.mg-c-input--readonly slot[name=append-input]{display:none}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input:not(.mg-c-input--label-on-top) .mg-c-input__box{width:100%;min-width:5rem;max-width:calc(17.7rem + var(--mg-inputs-spacer)*2)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:space-between}.mg-c-input.mg-c-input--width-full.mg-c-input--label-on-top .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container{width:100%;flex:auto}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container .mg-c-input__box{max-width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__input{width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__with-character-left{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__box{min-width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-4 .mg-c-input__input-container .mg-c-input__box{max-width:7rem}.mg-c-input.mg-c-input--width-2 .mg-c-input__input-container .mg-c-input__box{max-width:5rem}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__box{width:100%;padding-top:0;padding-right:1rem;padding-bottom:0}:host(:not([mg-width])) .mg-c-input--select:not(.mg-c-input--label-on-top) .mg-c-input__box{max-width:unset}";
|
|
2999
3062
|
const MgInputSelectStyle0 = mgInputSelectCss;
|
|
3000
3063
|
|
|
3001
3064
|
/**
|
|
@@ -3076,7 +3139,7 @@ const MgInputSelect = class {
|
|
|
3076
3139
|
if (this.input.value === '') {
|
|
3077
3140
|
this.setValue(null);
|
|
3078
3141
|
}
|
|
3079
|
-
else if (
|
|
3142
|
+
else if (index$1.De(this.items) && this.items.includes(this.input.value)) {
|
|
3080
3143
|
this.setValue(this.input.value);
|
|
3081
3144
|
}
|
|
3082
3145
|
else if (allItemsAreOptions(this.items) && typeof this.input.value === 'string' && this.items.some(this.isInputValue)) {
|
|
@@ -3147,10 +3210,11 @@ const MgInputSelect = class {
|
|
|
3147
3210
|
this.disabled = false;
|
|
3148
3211
|
this.mgWidth = undefined;
|
|
3149
3212
|
this.tooltip = undefined;
|
|
3213
|
+
this.tooltipPosition = 'input';
|
|
3150
3214
|
this.helpText = undefined;
|
|
3151
3215
|
this.valid = undefined;
|
|
3152
3216
|
this.invalid = undefined;
|
|
3153
|
-
this.classCollection = new
|
|
3217
|
+
this.classCollection = new index$1.Fe(['mg-c-input--select']);
|
|
3154
3218
|
this.errorMessage = undefined;
|
|
3155
3219
|
this.options = undefined;
|
|
3156
3220
|
this.valueExist = undefined;
|
|
@@ -3158,7 +3222,7 @@ const MgInputSelect = class {
|
|
|
3158
3222
|
}
|
|
3159
3223
|
validateValue(newValue) {
|
|
3160
3224
|
var _a, _b;
|
|
3161
|
-
if (
|
|
3225
|
+
if (index$1.De(this.items) && typeof newValue === 'string') {
|
|
3162
3226
|
this.readonlyValue = ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value) ? this.input.value : newValue;
|
|
3163
3227
|
}
|
|
3164
3228
|
else if (allItemsAreOptions(this.items)) {
|
|
@@ -3175,7 +3239,7 @@ const MgInputSelect = class {
|
|
|
3175
3239
|
this.options = [];
|
|
3176
3240
|
}
|
|
3177
3241
|
// String array
|
|
3178
|
-
else if (
|
|
3242
|
+
else if (index$1.De(newValue)) {
|
|
3179
3243
|
if (typeof this.value === 'string')
|
|
3180
3244
|
this.valueExist = newValue.includes(this.value);
|
|
3181
3245
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
@@ -3226,7 +3290,7 @@ const MgInputSelect = class {
|
|
|
3226
3290
|
if (typeof valid !== 'boolean') {
|
|
3227
3291
|
throw new Error('<mg-input-select> method "setError()" param "valid" must be a boolean');
|
|
3228
3292
|
}
|
|
3229
|
-
else if (!
|
|
3293
|
+
else if (!index$1.He(errorMessage)) {
|
|
3230
3294
|
throw new Error('<mg-input-select> method "setError()" param "errorMessage" must be a string');
|
|
3231
3295
|
}
|
|
3232
3296
|
else {
|
|
@@ -3256,7 +3320,7 @@ const MgInputSelect = class {
|
|
|
3256
3320
|
*/
|
|
3257
3321
|
componentWillLoad() {
|
|
3258
3322
|
// Get locales
|
|
3259
|
-
this.messages =
|
|
3323
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
3260
3324
|
// Validate
|
|
3261
3325
|
this.validateItems(this.items);
|
|
3262
3326
|
this.validateValue(this.value);
|
|
@@ -3276,7 +3340,7 @@ const MgInputSelect = class {
|
|
|
3276
3340
|
* @returns HTML Element
|
|
3277
3341
|
*/
|
|
3278
3342
|
render() {
|
|
3279
|
-
return (index.h(MgInput, { key: '
|
|
3343
|
+
return (index.h(MgInput, { key: 'd87b66d5c851e222a80331812969c08601f3d84b', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: undefined, readonlyValue: this.readonlyValue, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("select", { key: 'c7804f7d8c652e566d2d4cbf015c70517cf5537c', 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) => {
|
|
3280
3344
|
if (el !== null)
|
|
3281
3345
|
this.input = el;
|
|
3282
3346
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -3293,7 +3357,7 @@ const MgInputSelect = class {
|
|
|
3293
3357
|
};
|
|
3294
3358
|
MgInputSelect.style = MgInputSelectStyle0;
|
|
3295
3359
|
|
|
3296
|
-
const mgInputTextCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
3360
|
+
const mgInputTextCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--label-on-top .mg-c-input__box{width:auto;max-width:100%}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--is-input-group-append.mg-c-input--readonly slot[name=append-input]{display:none}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input:not(.mg-c-input--label-on-top) .mg-c-input__box{width:100%;min-width:5rem;max-width:calc(17.7rem + var(--mg-inputs-spacer)*2)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:space-between}.mg-c-input.mg-c-input--width-full.mg-c-input--label-on-top .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container{width:100%;flex:auto}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container .mg-c-input__box{max-width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__input{width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__with-character-left{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__box{min-width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-4 .mg-c-input__input-container .mg-c-input__box{max-width:7rem}.mg-c-input.mg-c-input--width-2 .mg-c-input__input-container .mg-c-input__box{max-width:5rem}.mg-c-input mg-character-left{font-size:1.1rem;opacity:.6}.mg-c-input.mg-c-input--has-display-character-left .mg-c-input__input+.mg-c-input__help-text,.mg-c-input.mg-c-input--has-display-character-left .mg-c-input__input+.mg-c-input__error{margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__with-character-left{position:relative;display:inline-flex}.mg-c-input--width-full .mg-c-input__with-character-left{width:100%}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left .mg-c-input__box{padding-right:calc(var(--mg-character-left-message-length)*1ch + .8rem)}.mg-c-input__with-character-left mg-character-left{position:absolute;top:50%;right:1rem;display:none;font-size:1.1rem;opacity:.6;transform:translateY(-50%)}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{display:block}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon{position:absolute;top:50%;left:var(--mg-inputs-spacer);color:var(--mg-inputs-color);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box{padding-left:calc(var(--mg-icon-regular-size) + var(--mg-inputs-spacer)*2)}";
|
|
3297
3361
|
const MgInputTextStyle0 = mgInputTextCss;
|
|
3298
3362
|
|
|
3299
3363
|
const isDatalistOption = (options) => Array.isArray(options) && options.every(option => typeof option === 'string');
|
|
@@ -3326,7 +3390,7 @@ const MgInputText = class {
|
|
|
3326
3390
|
*/
|
|
3327
3391
|
this.handleFocus = () => {
|
|
3328
3392
|
this.classCollection.add(this.classFocus);
|
|
3329
|
-
this.classCollection = new
|
|
3393
|
+
this.classCollection = new index$1.Fe(this.classCollection.classes);
|
|
3330
3394
|
};
|
|
3331
3395
|
/**
|
|
3332
3396
|
* Handle blur event
|
|
@@ -3334,7 +3398,7 @@ const MgInputText = class {
|
|
|
3334
3398
|
this.handleBlur = () => {
|
|
3335
3399
|
// Manage focus
|
|
3336
3400
|
this.classCollection.delete(this.classFocus);
|
|
3337
|
-
this.classCollection = new
|
|
3401
|
+
this.classCollection = new index$1.Fe(this.classCollection.classes);
|
|
3338
3402
|
// Display Error
|
|
3339
3403
|
this.handlerInProgress = Handler.BLUR;
|
|
3340
3404
|
this.displayError().finally(() => {
|
|
@@ -3405,11 +3469,12 @@ const MgInputText = class {
|
|
|
3405
3469
|
this.pattern = undefined;
|
|
3406
3470
|
this.patternErrorMessage = undefined;
|
|
3407
3471
|
this.tooltip = undefined;
|
|
3472
|
+
this.tooltipPosition = 'input';
|
|
3408
3473
|
this.displayCharacterLeft = true;
|
|
3409
3474
|
this.helpText = undefined;
|
|
3410
3475
|
this.valid = undefined;
|
|
3411
3476
|
this.invalid = undefined;
|
|
3412
|
-
this.classCollection = new
|
|
3477
|
+
this.classCollection = new index$1.Fe(['mg-c-input--text']);
|
|
3413
3478
|
this.errorMessage = undefined;
|
|
3414
3479
|
}
|
|
3415
3480
|
handleValue(newValue) {
|
|
@@ -3439,7 +3504,7 @@ const MgInputText = class {
|
|
|
3439
3504
|
}
|
|
3440
3505
|
}
|
|
3441
3506
|
validatePattern(newValue) {
|
|
3442
|
-
if (newValue !== undefined && !(
|
|
3507
|
+
if (newValue !== undefined && !(index$1.He(this.pattern) && index$1.He(this.patternErrorMessage))) {
|
|
3443
3508
|
throw new Error('<mg-input-text> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3444
3509
|
}
|
|
3445
3510
|
}
|
|
@@ -3469,7 +3534,7 @@ const MgInputText = class {
|
|
|
3469
3534
|
if (typeof valid !== 'boolean') {
|
|
3470
3535
|
throw new Error('<mg-input-text> method "setError()" param "valid" must be a boolean');
|
|
3471
3536
|
}
|
|
3472
|
-
else if (!
|
|
3537
|
+
else if (!index$1.He(errorMessage)) {
|
|
3473
3538
|
throw new Error('<mg-input-text> method "setError()" param "errorMessage" must be a string');
|
|
3474
3539
|
}
|
|
3475
3540
|
else {
|
|
@@ -3499,7 +3564,7 @@ const MgInputText = class {
|
|
|
3499
3564
|
*/
|
|
3500
3565
|
componentWillLoad() {
|
|
3501
3566
|
// Get locales
|
|
3502
|
-
this.messages =
|
|
3567
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
3503
3568
|
this.characterLeftId = `${this.identifier}-character-left`;
|
|
3504
3569
|
this.datalistId = `${this.identifier}-datalist`;
|
|
3505
3570
|
// Validate
|
|
@@ -3520,14 +3585,14 @@ const MgInputText = class {
|
|
|
3520
3585
|
* @returns HTML Element
|
|
3521
3586
|
*/
|
|
3522
3587
|
render() {
|
|
3523
|
-
return (index.h(MgInput, { key: '
|
|
3588
|
+
return (index.h(MgInput, { key: '588874f4ce3dfe230190636fdb985f1c7cd667f6', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("div", { key: '0c543cdc61727ffac94b2b550257e69e12c6c2bf', class: "mg-c-input__with-character-left", style: {
|
|
3524
3589
|
'--mg-character-left-message-length': (this.displayCharacterLeft
|
|
3525
3590
|
? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
|
|
3526
3591
|
: 0).toString(),
|
|
3527
|
-
} }, this.icon !== undefined && index.h("mg-icon", { icon: this.icon }), index.h("input", { key: '
|
|
3592
|
+
} }, this.icon !== undefined && index.h("mg-icon", { icon: this.icon }), index.h("input", { key: '7ec8b525e055f345e21af55bc7d68c92241c3cd8', type: this.type, class: "mg-c-input__box", value: this.value, id: this.identifier, list: this.hasDatalist() ? this.datalistId : undefined, autocomplete: this.hasDatalist() ? 'off' : undefined, name: this.name, placeholder: this.placeholder, title: this.placeholder, maxlength: this.maxlength, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), pattern: this.pattern, onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
3528
3593
|
if (el !== null)
|
|
3529
3594
|
this.input = el;
|
|
3530
|
-
} }), this.hasDatalist() && (index.h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (index.h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (index.h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), index.h("slot", { key: '
|
|
3595
|
+
} }), this.hasDatalist() && (index.h("datalist", { id: this.datalistId }, this.datalistoptions.map(option => (index.h("option", { value: option, key: option }))))), this.displayCharacterLeft && this.maxlength > 0 && (index.h("mg-character-left", { identifier: this.characterLeftId, characters: this.value, maxlength: this.maxlength }))), index.h("slot", { key: 'b68af1be76d8513119dd9b3c50f1feedd0a011f5', name: "append-input" })));
|
|
3531
3596
|
}
|
|
3532
3597
|
get element() { return index.getElement(this); }
|
|
3533
3598
|
static get watchers() { return {
|
|
@@ -3543,7 +3608,7 @@ const MgInputText = class {
|
|
|
3543
3608
|
};
|
|
3544
3609
|
MgInputText.style = MgInputTextStyle0;
|
|
3545
3610
|
|
|
3546
|
-
const mgInputTextareaCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
3611
|
+
const mgInputTextareaCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{width:100%}}.mg-c-input__box{height:var(--default-size);box-sizing:border-box;padding:calc((var(--default-size) - var(--font-size)*var(--line-height))/2) var(--mg-inputs-spacer);border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:var(--mg-inputs-border-radius);background-color:hsl(var(--color-light));color:hsl(var(--color-dark));font-family:inherit;font-size:var(--font-size);text-align:var(--mg-inputs-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-inputs-color);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 .6rem hsl(var(--mg-inputs-color-shadow-focus-hsl)/50%)}.mg-c-input__box:disabled{opacity:.3}.mg-c-input.mg-c-input--label-on-top .mg-c-input__box{width:auto;max-width:100%}.mg-c-input.mg-c-input--is-input-group-append{--mg-button-border-radius-top-left:0;--mg-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:-0.1rem;border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--is-input-group-append.mg-c-input--readonly slot[name=append-input]{display:none}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-button-border-radius-top-right:0;--mg-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-button-border-radius-top-right:var(--mg-inputs-border-radius);--mg-button-border-radius-bottom-right:var(--mg-inputs-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){padding-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input:not(.mg-c-input--label-on-top) .mg-c-input__box{width:100%;min-width:5rem;max-width:calc(17.7rem + var(--mg-inputs-spacer)*2)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:space-between}.mg-c-input.mg-c-input--width-full.mg-c-input--label-on-top .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container{width:100%;flex:auto}.mg-c-input.mg-c-input--width-full .mg-c-input__input-container .mg-c-input__box{max-width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__input{width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__with-character-left{width:100%}.mg-c-input.mg-c-input--width-16 .mg-c-input__input-container .mg-c-input__box{min-width:100%;max-width:21rem}.mg-c-input.mg-c-input--width-4 .mg-c-input__input-container .mg-c-input__box{max-width:7rem}.mg-c-input.mg-c-input--width-2 .mg-c-input__input-container .mg-c-input__box{max-width:5rem}.mg-c-input mg-character-left{font-size:1.1rem;opacity:.6}.mg-c-input.mg-c-input--has-display-character-left .mg-c-input__input+.mg-c-input__help-text,.mg-c-input.mg-c-input--has-display-character-left .mg-c-input__input+.mg-c-input__error{margin-top:0}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input__box{display:block;height:auto;resize:none}.mg-c-input__box.mg-c-input__box--resizable{resize:both}.mg-c-input__box.mg-c-input__box--resizable-horizontal{resize:horizontal}.mg-c-input__box.mg-c-input__box--resizable-vertical{resize:vertical}.mg-c-input__with-character-left{width:100%}.mg-c-input__with-character-left mg-character-left{display:block;margin-top:.2rem;text-align:end;visibility:hidden}.mg-c-input.mg-u-is-focused .mg-c-input__with-character-left mg-character-left{visibility:visible}@-moz-document url-prefix(){.mg-c-input__box{overflow-x:hidden}}";
|
|
3547
3612
|
const MgInputTextareaStyle0 = mgInputTextareaCss;
|
|
3548
3613
|
|
|
3549
3614
|
const MgInputTextarea = class {
|
|
@@ -3574,7 +3639,7 @@ const MgInputTextarea = class {
|
|
|
3574
3639
|
*/
|
|
3575
3640
|
this.handleFocus = () => {
|
|
3576
3641
|
this.classCollection.add(this.classFocus);
|
|
3577
|
-
this.classCollection = new
|
|
3642
|
+
this.classCollection = new index$1.Fe(this.classCollection.classes);
|
|
3578
3643
|
};
|
|
3579
3644
|
/**
|
|
3580
3645
|
* Handle blur event
|
|
@@ -3582,7 +3647,7 @@ const MgInputTextarea = class {
|
|
|
3582
3647
|
this.handleBlur = () => {
|
|
3583
3648
|
// Manage focus
|
|
3584
3649
|
this.classCollection.delete(this.classFocus);
|
|
3585
|
-
this.classCollection = new
|
|
3650
|
+
this.classCollection = new index$1.Fe(this.classCollection.classes);
|
|
3586
3651
|
// Display Error
|
|
3587
3652
|
this.handlerInProgress = Handler.BLUR;
|
|
3588
3653
|
this.displayError().finally(() => {
|
|
@@ -3640,12 +3705,13 @@ const MgInputTextarea = class {
|
|
|
3640
3705
|
this.patternErrorMessage = undefined;
|
|
3641
3706
|
this.rows = 3;
|
|
3642
3707
|
this.tooltip = undefined;
|
|
3708
|
+
this.tooltipPosition = 'input';
|
|
3643
3709
|
this.displayCharacterLeft = true;
|
|
3644
3710
|
this.helpText = undefined;
|
|
3645
3711
|
this.valid = undefined;
|
|
3646
3712
|
this.invalid = undefined;
|
|
3647
3713
|
this.resizable = 'none';
|
|
3648
|
-
this.classCollection = new
|
|
3714
|
+
this.classCollection = new index$1.Fe(['mg-c-input--textarea']);
|
|
3649
3715
|
this.errorMessage = undefined;
|
|
3650
3716
|
}
|
|
3651
3717
|
handleValue(newValue) {
|
|
@@ -3663,7 +3729,7 @@ const MgInputTextarea = class {
|
|
|
3663
3729
|
}
|
|
3664
3730
|
}
|
|
3665
3731
|
validatePattern(newValue) {
|
|
3666
|
-
if (newValue !== undefined && !(
|
|
3732
|
+
if (newValue !== undefined && !(index$1.He(this.pattern) && index$1.He(this.patternErrorMessage))) {
|
|
3667
3733
|
throw new Error('<mg-input-textarea> props "pattern" and "patternErrorMessage" must be non-empty string and paired.');
|
|
3668
3734
|
}
|
|
3669
3735
|
}
|
|
@@ -3695,7 +3761,7 @@ const MgInputTextarea = class {
|
|
|
3695
3761
|
if (typeof valid !== 'boolean') {
|
|
3696
3762
|
throw new Error('<mg-input-textarea> method "setError()" param "valid" must be a boolean');
|
|
3697
3763
|
}
|
|
3698
|
-
else if (!
|
|
3764
|
+
else if (!index$1.He(errorMessage)) {
|
|
3699
3765
|
throw new Error('<mg-input-textarea> method "setError()" param "errorMessage" must be a string');
|
|
3700
3766
|
}
|
|
3701
3767
|
else {
|
|
@@ -3725,7 +3791,7 @@ const MgInputTextarea = class {
|
|
|
3725
3791
|
*/
|
|
3726
3792
|
componentWillLoad() {
|
|
3727
3793
|
// Get locales
|
|
3728
|
-
this.messages =
|
|
3794
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
3729
3795
|
this.characterLeftId = `${this.identifier}-character-left`;
|
|
3730
3796
|
// Validate
|
|
3731
3797
|
this.validateDisplayCharacterLeft(this.displayCharacterLeft);
|
|
@@ -3743,7 +3809,7 @@ const MgInputTextarea = class {
|
|
|
3743
3809
|
* @returns HTML Element
|
|
3744
3810
|
*/
|
|
3745
3811
|
render() {
|
|
3746
|
-
return (index.h(MgInput, { key: '
|
|
3812
|
+
return (index.h(MgInput, { key: '787cd8f44ee98c6f337c3718450f87bf95ecfa90', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("div", { key: '4d9efd68e2f172b3e44198c82e66866d7975a1b0', class: "mg-c-input__with-character-left" }, index.h("textarea", { key: '1e4b6e771fe376eb3214fbedf0af09887e887e1f', class: {
|
|
3747
3813
|
'mg-c-input__box': true,
|
|
3748
3814
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
3749
3815
|
'mg-c-input__box--resizable-horizontal': this.resizable === 'horizontal',
|
|
@@ -3766,7 +3832,7 @@ const MgInputTextarea = class {
|
|
|
3766
3832
|
};
|
|
3767
3833
|
MgInputTextarea.style = MgInputTextareaStyle0;
|
|
3768
3834
|
|
|
3769
|
-
const mgInputTitleCss = ".mg-u-is-asterisk.sc-mg-input-title{color:hsl(var(--color-danger))}legend.mg-c-input-title.sc-mg-input-title{padding-right:0;padding-left:0}.mg-c-input-title__required.sc-mg-input-title{display:var(--mg-input-title-display, unset)}";
|
|
3835
|
+
const mgInputTitleCss = ".mg-u-form-legacy.sc-mg-input-title{--mg-form-inputs-title-width:calc(100% / 3 - 20px)}.mg-u-is-asterisk.sc-mg-input-title{color:hsl(var(--color-danger))}legend.mg-c-input-title.sc-mg-input-title{padding-right:0;padding-left:0}.mg-c-input-title__required.sc-mg-input-title{display:var(--mg-input-title-display, unset)}";
|
|
3770
3836
|
const MgInputTitleStyle0 = mgInputTitleCss;
|
|
3771
3837
|
|
|
3772
3838
|
const MgInputTitle = class {
|
|
@@ -3779,7 +3845,7 @@ const MgInputTitle = class {
|
|
|
3779
3845
|
this.tagName = 'label';
|
|
3780
3846
|
}
|
|
3781
3847
|
validateIdentifier(newValue) {
|
|
3782
|
-
if (!
|
|
3848
|
+
if (!index$1.He(newValue)) {
|
|
3783
3849
|
throw new Error('<mg-input-title> prop "identifier" is required.');
|
|
3784
3850
|
}
|
|
3785
3851
|
}
|
|
@@ -3803,7 +3869,7 @@ const MgInputTitle = class {
|
|
|
3803
3869
|
render() {
|
|
3804
3870
|
const TagName = this.readonly ? 'span' : this.tagName;
|
|
3805
3871
|
// \u00A0 represent a
|
|
3806
|
-
return (index.h(TagName, { key: '
|
|
3872
|
+
return (index.h(TagName, { key: '0fbbce483f0d178036c4bf8ada139ddba9c16694', class: "mg-c-input-title", htmlFor: this.isLegend ? undefined : this.identifier }, index.h("slot", { key: '1db71caf002de0874f566d55b4bd0031ddf10650' }), this.required && (index.h("span", { class: "mg-c-input-title__required" }, "\u00A0", index.h("span", { class: "mg-u-is-asterisk" }, "*")))));
|
|
3807
3873
|
}
|
|
3808
3874
|
static get watchers() { return {
|
|
3809
3875
|
"identifier": ["validateIdentifier"],
|
|
@@ -3812,7 +3878,7 @@ const MgInputTitle = class {
|
|
|
3812
3878
|
};
|
|
3813
3879
|
MgInputTitle.style = MgInputTitleStyle0;
|
|
3814
3880
|
|
|
3815
|
-
const mgInputToggleCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-
|
|
3881
|
+
const mgInputToggleCss = ":host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;max-width:100%;min-height:var(--default-size);align-items:flex-start;margin-bottom:var(--mg-inputs-margin-bottom, 0)}.mg-c-input__error{display:inline-block;padding:.3rem .8rem;border-radius:.3rem;margin-top:.2rem;background:hsl(var(--mg-inputs-error-bg-color));color:hsl(var(--color-danger))}.mg-c-input__input-container{min-height:var(--default-size)}.mg-c-input__input-container>ul{display:flex;flex-flow:column wrap;padding:0;margin:0;list-style:none;row-gap:.8rem}.mg-c-input__input-container>strong{display:inline-block}.mg-c-input__input-container>strong,.mg-c-input__input-container>ul{min-height:var(--font-size);margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-icon-regular-size);height:var(--mg-icon-regular-size);margin-left:var(--mg-inputs-spacer)}.mg-c-input__input-container .mg-c-input__help-text,.mg-c-input__input-container .mg-c-input__error{font-size:1.2rem;text-align:start}.mg-c-input__input{display:flex}.mg-c-input__input mg-tooltip{margin-top:calc((var(--default-size) - var(--mg-icon-regular-size))/2)}.mg-c-input__input.mg-c-input__input--has-error .mg-c-input__box{border-color:hsl(var(--color-danger))}.mg-c-input__input+.mg-c-input__help-text,.mg-c-input__input+.mg-c-input__error{margin-top:.5rem}.mg-c-input__input .mg-c-input__box:disabled,.mg-c-input__input-group--disabled label,.mg-c-input.mg-c-input--toggle-disabled .mg-c-input__input .mg-c-input__button-toggle,.mg-c-input.mg-c-input--checkbox-multi-disabled .mg-c-input__input strong{opacity:var(--mg-disabled-opacity)}.mg-c-input__title{display:flex;width:var(--mg-inputs-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--default-size) - var(--font-size)*var(--line-height))/2);margin-right:var(--mg-inputs-title-horizontal-space, var(--mg-inputs-spacer));text-align:right}.mg-c-input__title mg-input-title+mg-tooltip{margin-left:.4rem}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input.mg-c-input--label-on-top{flex-direction:column}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input.mg-c-input--label-on-top .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input.mg-c-input--label-on-top .mg-c-input__input-container{width:100%}@media screen and (max-width: 767px){.mg-c-input{flex-direction:column}.mg-c-input .mg-c-input__title{width:auto;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:.3rem;text-align:left}.mg-c-input .mg-c-input__title mg-input-title{width:100%;flex-shrink:1}.mg-c-input .mg-c-input__input-container{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__toggle-item-container{overflow:hidden;box-sizing:border-box;padding:.5rem .9rem;border:0;border-radius:calc((var(--font-size)*var(--line-height) + 1rem)/var(--mg-input-toggle-border-radius-ratio));background-color:unset;color:hsl(var(--color-dark));font-weight:unset;text-overflow:ellipsis;white-space:nowrap}.mg-c-input__toggle-item-container:first-of-type{background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%));color:hsl(var(--color-info));font-weight:600}.mg-c-input__button-toggle{display:flex;min-width:0;padding:.2rem;border-width:var(--mg-inputs-border-width);border-style:solid;border-color:var(--mg-inputs-color);border-radius:calc((var(--font-size)*var(--line-height) + 2*(.7rem + var(--mg-inputs-border-width)))/var(--mg-input-toggle-border-radius-ratio));background-color:hsl(var(--color-light));cursor:pointer;font-family:var(--font-family);font-size:inherit;line-height:inherit}.mg-c-input__button-toggle:disabled{cursor:default}.mg-c-input.mg-c-input--toggle .mg-c-input__input-container{min-width:0;flex:auto}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:hsl(var(--color-dark));font-weight:unset}.mg-c-input.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{background-color:hsl(var(--color-info-h), calc(var(--color-info-s) - 64%), calc(var(--color-info-l) + 55%));color:hsl(var(--color-info));font-weight:600}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container{display:flex;width:calc(var(--font-size)*var(--line-height) + 1rem);height:calc(var(--font-size)*var(--line-height) + 1rem);align-items:center;justify-content:center;padding:0;visibility:hidden}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container:first-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-icon .mg-c-input__toggle-item-container ::slotted(mg-icon){display:flex}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{visibility:hidden}.mg-c-input.mg-c-input--toggle-icon.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:last-of-type{visibility:visible}.mg-c-input.mg-c-input--toggle-on-off .mg-c-input__toggle-item-container:first-of-type{background-color:hsl(var(--color-dark-h), calc(var(--color-dark-s) - 30%), calc(var(--color-dark-l) + 75%));color:hsl(var(--color-dark));font-weight:600}.mg-c-input.mg-c-input--toggle-on-off.mg-c-input--toggle-is-active .mg-c-input__toggle-item-container:first-of-type{background-color:unset;color:hsl(var(--color-dark));font-weight:unset}";
|
|
3816
3882
|
const MgInputToggleStyle0 = mgInputToggleCss;
|
|
3817
3883
|
|
|
3818
3884
|
/**
|
|
@@ -3830,7 +3896,6 @@ const MgInputToggle = class {
|
|
|
3830
3896
|
* Internal *
|
|
3831
3897
|
************/
|
|
3832
3898
|
// Classes
|
|
3833
|
-
this.classReadonly = 'mg-c-input--toggle-readonly';
|
|
3834
3899
|
this.classDisabled = 'mg-c-input--toggle-disabled';
|
|
3835
3900
|
this.classIsActive = 'mg-c-input--toggle-is-active';
|
|
3836
3901
|
this.classOnOff = 'mg-c-input--toggle-on-off';
|
|
@@ -3879,8 +3944,9 @@ const MgInputToggle = class {
|
|
|
3879
3944
|
this.readonly = false;
|
|
3880
3945
|
this.disabled = false;
|
|
3881
3946
|
this.tooltip = undefined;
|
|
3947
|
+
this.tooltipPosition = 'input';
|
|
3882
3948
|
this.helpText = undefined;
|
|
3883
|
-
this.classCollection = new
|
|
3949
|
+
this.classCollection = new index$1.Fe(['mg-c-input--toggle']);
|
|
3884
3950
|
this.options = undefined;
|
|
3885
3951
|
this.errorMessage = undefined;
|
|
3886
3952
|
this.valid = undefined;
|
|
@@ -3897,11 +3963,11 @@ const MgInputToggle = class {
|
|
|
3897
3963
|
throw new Error('<mg-input-toggle> prop "items" require 2 items.');
|
|
3898
3964
|
}
|
|
3899
3965
|
// String array
|
|
3900
|
-
else if (
|
|
3966
|
+
else if (index$1.De(newValue)) {
|
|
3901
3967
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
3902
3968
|
}
|
|
3903
3969
|
// Object array
|
|
3904
|
-
else if (newValue
|
|
3970
|
+
else if (newValue === null || newValue === void 0 ? void 0 : newValue.every(item => isOption(item))) {
|
|
3905
3971
|
this.options = newValue;
|
|
3906
3972
|
}
|
|
3907
3973
|
else {
|
|
@@ -3920,12 +3986,6 @@ const MgInputToggle = class {
|
|
|
3920
3986
|
else
|
|
3921
3987
|
this.classCollection.delete(this.classIcon);
|
|
3922
3988
|
}
|
|
3923
|
-
handleReadonly(newValue) {
|
|
3924
|
-
if (newValue)
|
|
3925
|
-
this.classCollection.add(this.classReadonly);
|
|
3926
|
-
else
|
|
3927
|
-
this.classCollection.delete(this.classReadonly);
|
|
3928
|
-
}
|
|
3929
3989
|
handleDisabled(newValue) {
|
|
3930
3990
|
if (newValue)
|
|
3931
3991
|
this.classCollection.add(this.classDisabled);
|
|
@@ -3953,7 +4013,7 @@ const MgInputToggle = class {
|
|
|
3953
4013
|
if (typeof valid !== 'boolean') {
|
|
3954
4014
|
throw new Error('<mg-input-toggle> method "setError()" param "valid" must be a boolean');
|
|
3955
4015
|
}
|
|
3956
|
-
else if (!
|
|
4016
|
+
else if (!index$1.He(errorMessage)) {
|
|
3957
4017
|
throw new Error('<mg-input-toggle> method "setError()" param "errorMessage" must be a string');
|
|
3958
4018
|
}
|
|
3959
4019
|
else {
|
|
@@ -4000,7 +4060,6 @@ const MgInputToggle = class {
|
|
|
4000
4060
|
// apply handler
|
|
4001
4061
|
this.handleIsOnOff(this.isOnOff);
|
|
4002
4062
|
this.handleIsIcon(this.isIcon);
|
|
4003
|
-
this.handleReadonly(this.readonly);
|
|
4004
4063
|
this.handleDisabled(this.disabled);
|
|
4005
4064
|
}
|
|
4006
4065
|
/**
|
|
@@ -4008,7 +4067,8 @@ const MgInputToggle = class {
|
|
|
4008
4067
|
* @returns HTML Element
|
|
4009
4068
|
*/
|
|
4010
4069
|
render() {
|
|
4011
|
-
|
|
4070
|
+
var _a;
|
|
4071
|
+
return (index.h(MgInput, { key: '003966a67f60157bcabfd072fca622446859a57d', identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: (_a = this.value) === null || _a === void 0 ? void 0 : _a.toString(), readonlyValue: this.options[this.checked ? 1 : 0].title, tooltip: !this.readonly && this.tooltip, tooltipPosition: this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, index.h("button", { key: '938f53b06216e53cb8fc7deef890cd3934fa3d4c', type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, index.h("span", { key: '5a78ecc67f07570eef67095b7ab135619eadabb9', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { key: 'e941286364df7540ab97b64995346650ca45038a', name: "item-1" })), index.h("span", { key: '55d499a0fdfcc57b389fbaa45f9ce492375a30dc', "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, index.h("slot", { key: '2e10b8a60de54fa9826e69f95191773e7de878ec', name: "item-2" })))));
|
|
4012
4072
|
}
|
|
4013
4073
|
get element() { return index.getElement(this); }
|
|
4014
4074
|
static get watchers() { return {
|
|
@@ -4016,7 +4076,6 @@ const MgInputToggle = class {
|
|
|
4016
4076
|
"items": ["validateItems"],
|
|
4017
4077
|
"isOnOff": ["handleIsOnOff"],
|
|
4018
4078
|
"isIcon": ["handleIsIcon"],
|
|
4019
|
-
"readonly": ["handleReadonly"],
|
|
4020
4079
|
"disabled": ["handleDisabled"],
|
|
4021
4080
|
"checked": ["handleChecked"]
|
|
4022
4081
|
}; }
|
|
@@ -4257,7 +4316,7 @@ const MgMenuItem = class {
|
|
|
4257
4316
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
4258
4317
|
['label', 'metadata'].forEach(slot => {
|
|
4259
4318
|
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
4260
|
-
if (!
|
|
4319
|
+
if (!index$1.He(element.textContent))
|
|
4261
4320
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
4262
4321
|
if ((guard && element.getAttribute('title') === null) || !guard)
|
|
4263
4322
|
element.setAttribute('title', element.textContent);
|
|
@@ -4326,12 +4385,12 @@ const MgMenuItem = class {
|
|
|
4326
4385
|
* @returns HTML Element
|
|
4327
4386
|
*/
|
|
4328
4387
|
this.renderSlot = () => index.h("slot", null);
|
|
4329
|
-
this.identifier =
|
|
4388
|
+
this.identifier = index$1.je('mg-menu-item');
|
|
4330
4389
|
this.href = undefined;
|
|
4331
4390
|
this.status = Status$1.VISIBLE;
|
|
4332
4391
|
this.expanded = false;
|
|
4333
4392
|
this.size = 'regular';
|
|
4334
|
-
this.navigationButtonClassList = new
|
|
4393
|
+
this.navigationButtonClassList = new index$1.Fe([this.navigationButton]);
|
|
4335
4394
|
this.direction = undefined;
|
|
4336
4395
|
this.isInMainMenu = undefined;
|
|
4337
4396
|
this.isItemMore = undefined;
|
|
@@ -4406,7 +4465,7 @@ const MgMenuItem = class {
|
|
|
4406
4465
|
// has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
|
|
4407
4466
|
// we store only matching elements
|
|
4408
4467
|
this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
|
|
4409
|
-
this.badgeLabel =
|
|
4468
|
+
this.badgeLabel = index$1.initLocales(this.element).messages.plusMenu.badgeLabel;
|
|
4410
4469
|
this.isItemMore = this.element.dataset.overflowMore !== undefined;
|
|
4411
4470
|
// Validate props
|
|
4412
4471
|
this.validateStatus(this.status);
|
|
@@ -4565,13 +4624,13 @@ const MgMessage = class {
|
|
|
4565
4624
|
return 'exclamation-circle';
|
|
4566
4625
|
}
|
|
4567
4626
|
};
|
|
4568
|
-
this.identifier =
|
|
4627
|
+
this.identifier = index$1.je('mg-message');
|
|
4569
4628
|
this.delay = undefined;
|
|
4570
4629
|
this.variant = variants$1[0];
|
|
4571
4630
|
this.closeButton = false;
|
|
4572
4631
|
this.hide = false;
|
|
4573
4632
|
this.noAriaRole = undefined;
|
|
4574
|
-
this.classCollection = new
|
|
4633
|
+
this.classCollection = new index$1.Fe(['mg-c-message']);
|
|
4575
4634
|
this.hasActions = false;
|
|
4576
4635
|
}
|
|
4577
4636
|
validateDelay(newValue) {
|
|
@@ -4629,7 +4688,7 @@ const MgMessage = class {
|
|
|
4629
4688
|
*/
|
|
4630
4689
|
componentWillLoad() {
|
|
4631
4690
|
// Get locales
|
|
4632
|
-
this.messages =
|
|
4691
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
4633
4692
|
// Validate
|
|
4634
4693
|
this.validateVariant(this.variant);
|
|
4635
4694
|
// Check if close button is an can be activated
|
|
@@ -4650,7 +4709,7 @@ const MgMessage = class {
|
|
|
4650
4709
|
let role;
|
|
4651
4710
|
if (!this.noAriaRole)
|
|
4652
4711
|
role = this.variant === 'info' ? 'status' : 'alert';
|
|
4653
|
-
return (index.h("div", { key: '
|
|
4712
|
+
return (index.h("div", { key: 'fb10ca559b2039f9d7842e4b2ce88e25a1999c96', id: this.identifier, class: this.classCollection.join(), role: role }, index.h("mg-card", { key: 'c0afc8ad8c56f9e5fb5041aaa201de208f3fc6fd', variant: this.variant, "variant-style": "bar-left" }, index.h("span", { key: '949f48302c8feb721f1b9acb663bf21acfc166e1', class: "mg-c-message__icon" }, index.h("mg-icon", { key: 'a3daa1da6d312c6b6b921cc01edae9763a81225f', icon: this.getIcon() })), index.h("div", { key: 'c53239107f094fe341f6abb1441096767b648796', class: "mg-c-message__content" }, index.h("span", { key: 'fb4da55da5853179204771cf9f5d01a02ed8a9ce', class: "mg-c-message__content-slot" }, index.h("slot", { key: 'e7339501b750d02a3e433e40903d460588dd4b33' })), this.hasActions && index.h("span", { class: "mg-c-message__content-separator" }), this.hasActions && (index.h("span", { class: "mg-c-message__content-actions-slot" }, index.h("slot", { name: "actions" })))), this.closeButton && (index.h("span", { class: "mg-c-message__close-button" }, index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, index.h("mg-icon", { icon: "cross" })))))));
|
|
4654
4713
|
}
|
|
4655
4714
|
get element() { return index.getElement(this); }
|
|
4656
4715
|
static get watchers() { return {
|
|
@@ -4714,12 +4773,12 @@ const MgModal = class {
|
|
|
4714
4773
|
*/
|
|
4715
4774
|
this.setFocus = () => {
|
|
4716
4775
|
// Get all focusable elements
|
|
4717
|
-
const slottedFocusableElements = Array.from(this.element.querySelectorAll(
|
|
4776
|
+
const slottedFocusableElements = Array.from(this.element.querySelectorAll(index$1.Be));
|
|
4718
4777
|
// If close button is enabled or at least one of the slotted element is focusable
|
|
4719
4778
|
if (this.closeButton || slottedFocusableElements.length > 0) {
|
|
4720
4779
|
// Check if slotted focusable elements have shadowDom with focusable elements
|
|
4721
4780
|
this.modalFocusableElements = slottedFocusableElements.reduce((acc, focusableElement) => {
|
|
4722
|
-
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(
|
|
4781
|
+
acc.push(focusableElement.shadowRoot !== null ? focusableElement.shadowRoot.querySelector(index$1.Be) || focusableElement : focusableElement);
|
|
4723
4782
|
return acc;
|
|
4724
4783
|
}, []);
|
|
4725
4784
|
// When close button is enabled it's the first focusable element.
|
|
@@ -4741,21 +4800,21 @@ const MgModal = class {
|
|
|
4741
4800
|
this.handleClose = () => {
|
|
4742
4801
|
this.hide = true;
|
|
4743
4802
|
};
|
|
4744
|
-
this.identifier =
|
|
4803
|
+
this.identifier = index$1.je('mg-modal');
|
|
4745
4804
|
this.dialogRole = dialogRoles[0];
|
|
4746
4805
|
this.modalTitle = undefined;
|
|
4747
4806
|
this.closeButton = false;
|
|
4748
4807
|
this.hide = undefined;
|
|
4749
4808
|
this.hasActions = false;
|
|
4750
4809
|
this.hasContent = false;
|
|
4751
|
-
this.classCollection = new
|
|
4810
|
+
this.classCollection = new index$1.Fe(['mg-c-modal']);
|
|
4752
4811
|
}
|
|
4753
4812
|
validateDialogRole(newValue) {
|
|
4754
4813
|
if (!dialogRoles.includes(newValue))
|
|
4755
4814
|
throw new Error(`<mg-modal> prop "dialogRole" must be one of: ${dialogRoles.join(', ')}.`);
|
|
4756
4815
|
}
|
|
4757
4816
|
validateModalTitle(newValue) {
|
|
4758
|
-
if (!
|
|
4817
|
+
if (!index$1.He(newValue)) {
|
|
4759
4818
|
throw new Error('<mg-modal> prop "modalTitle" is required.');
|
|
4760
4819
|
}
|
|
4761
4820
|
}
|
|
@@ -4797,7 +4856,7 @@ const MgModal = class {
|
|
|
4797
4856
|
// Store body overflow
|
|
4798
4857
|
this.bodyOverflow = document.body.style.overflow;
|
|
4799
4858
|
// Get locales
|
|
4800
|
-
this.messages =
|
|
4859
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
4801
4860
|
// Validate
|
|
4802
4861
|
this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
|
|
4803
4862
|
this.hasContent = this.element.querySelector('[slot="content"]') !== null;
|
|
@@ -4823,14 +4882,14 @@ const MgModal = class {
|
|
|
4823
4882
|
* @returns HTML Element
|
|
4824
4883
|
*/
|
|
4825
4884
|
render() {
|
|
4826
|
-
return (index.h("div", { key: '
|
|
4885
|
+
return (index.h("div", { key: '5cf37ab3cd51af984852f3ef6dfeb9e9adf851aa', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, index.h("mg-card", { key: 'e9246015018d985cb28396f1f3ab01466e763f0c' }, index.h("div", { key: '3b94fd3d16a8f54e63fd75ef7fb13c7c17ff16b6', class: "mg-c-modal__dialog" }, index.h("header", { key: '5f6cd3f002c135c62e0b4851f483a5581bcf50d2', class: "mg-c-modal__header" }, this.closeButton && (index.h("span", { class: "mg-c-modal__close-button" }, index.h("mg-button", { identifier: `${this.identifier}-close-button`, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose, ref: (el) => {
|
|
4827
4886
|
if (el !== null) {
|
|
4828
4887
|
// store closeButton Element
|
|
4829
4888
|
this.closeButtonElement = el;
|
|
4830
4889
|
// add close button element to modalFocusableElements when it is render
|
|
4831
4890
|
this.modalFocusableElements.unshift(this.closeButtonElement);
|
|
4832
4891
|
}
|
|
4833
|
-
} }, index.h("mg-icon", { icon: "cross" })))), index.h("h1", { key: '
|
|
4892
|
+
} }, index.h("mg-icon", { icon: "cross" })))), index.h("h1", { key: '2bbb2a19e3936bc5487bfdb90d8d952ba49844be', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (index.h("article", { class: "mg-c-modal__content" }, index.h("slot", { name: "content" }))), this.hasActions && (index.h("footer", { class: "mg-c-modal__footer" }, index.h("slot", { name: "actions" })))))));
|
|
4834
4893
|
}
|
|
4835
4894
|
get element() { return index.getElement(this); }
|
|
4836
4895
|
static get watchers() { return {
|
|
@@ -4902,7 +4961,7 @@ const MgPagination = class {
|
|
|
4902
4961
|
this.handleGoToPage = (action, disabled) => {
|
|
4903
4962
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
4904
4963
|
};
|
|
4905
|
-
this.identifier =
|
|
4964
|
+
this.identifier = index$1.je('mg-pagination');
|
|
4906
4965
|
this.label = undefined;
|
|
4907
4966
|
this.hideNavigationLabels = undefined;
|
|
4908
4967
|
this.hidePageCount = undefined;
|
|
@@ -4931,7 +4990,7 @@ const MgPagination = class {
|
|
|
4931
4990
|
*/
|
|
4932
4991
|
componentWillLoad() {
|
|
4933
4992
|
// Get locales
|
|
4934
|
-
this.messages =
|
|
4993
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
4935
4994
|
// Validate
|
|
4936
4995
|
this.validateTotalPages(this.totalPages);
|
|
4937
4996
|
this.validateCurrentPage(this.currentPage);
|
|
@@ -4945,10 +5004,10 @@ const MgPagination = class {
|
|
|
4945
5004
|
* @returns HTML Element
|
|
4946
5005
|
*/
|
|
4947
5006
|
render() {
|
|
4948
|
-
const navigationActionButton = (disabled, action) => (index.h("mg-button", { key: '
|
|
5007
|
+
const navigationActionButton = (disabled, action) => (index.h("mg-button", { key: '117897c3594d7b6322e85c659020083a78710979', identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
4949
5008
|
// eslint-disable-next-line react/jsx-no-bind
|
|
4950
5009
|
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && index.h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && index.h("mg-icon", { icon: "chevron-right" })));
|
|
4951
|
-
return (index.h(index.Host, { key: '
|
|
5010
|
+
return (index.h(index.Host, { key: '83d52cfe35e330057417a26bdb7ae528255e3e5e', hidden: this.totalPages < 2 }, index.h("nav", { key: 'cdd2ab05092bfea927719b354c12629f90e44472', role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (index.h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true })), index.h("span", { key: '501099379d9ca210abed5bb10726c56383b15c6f', class: "mg-u-visually-hidden" }, this.messages.pagination.page, " ", this.currentPage), index.h("span", { key: 'e3ce99fb7aaf68322176c6135d70e90f910f6bdd', class: { 'mg-u-visually-hidden': this.hidePageCount } }, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
|
|
4952
5011
|
}
|
|
4953
5012
|
get element() { return index.getElement(this); }
|
|
4954
5013
|
static get watchers() { return {
|
|
@@ -5067,7 +5126,7 @@ const MgPanel = class {
|
|
|
5067
5126
|
];
|
|
5068
5127
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5069
5128
|
};
|
|
5070
|
-
this.identifier =
|
|
5129
|
+
this.identifier = index$1.je('mg-panel');
|
|
5071
5130
|
this.panelTitle = undefined;
|
|
5072
5131
|
this.titlePattern = undefined;
|
|
5073
5132
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -5076,12 +5135,12 @@ const MgPanel = class {
|
|
|
5076
5135
|
this.expanded = false;
|
|
5077
5136
|
this.expandToggleDisplay = expandToggleDisplays[0];
|
|
5078
5137
|
this.expandToggleDisabled = undefined;
|
|
5079
|
-
this.classCollection = new
|
|
5138
|
+
this.classCollection = new index$1.Fe(['mg-c-panel']);
|
|
5080
5139
|
this.isEditing = false;
|
|
5081
5140
|
this.updatedPanelTitle = undefined;
|
|
5082
5141
|
}
|
|
5083
5142
|
validatePanelTitle(newValue) {
|
|
5084
|
-
if (!
|
|
5143
|
+
if (!index$1.He(newValue))
|
|
5085
5144
|
throw new Error('<mg-panel> prop "panelTitle" is required.');
|
|
5086
5145
|
this.titleChange.emit(newValue);
|
|
5087
5146
|
}
|
|
@@ -5110,7 +5169,7 @@ const MgPanel = class {
|
|
|
5110
5169
|
*/
|
|
5111
5170
|
componentWillLoad() {
|
|
5112
5171
|
// Get locales
|
|
5113
|
-
this.messages =
|
|
5172
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
5114
5173
|
// Validate
|
|
5115
5174
|
this.validateTitlePattern(this.titlePattern);
|
|
5116
5175
|
this.validateTitlePattern(this.titlePatternErrorMessage);
|
|
@@ -5132,7 +5191,7 @@ const MgPanel = class {
|
|
|
5132
5191
|
*/
|
|
5133
5192
|
render() {
|
|
5134
5193
|
const headerId = `${this.identifier}-header`;
|
|
5135
|
-
return (index.h("section", { key: '
|
|
5194
|
+
return (index.h("section", { key: '75410a66bcf5910175605ee2e4c7a56efb2d5d21', class: this.classCollection.join(), id: this.identifier }, index.h("mg-card", { key: '208cdc102ba7874b90f2eecd91026b5ed0c609af' }, index.h("header", { key: '2beb22b8e9e8e985db5a169207b13e10ed63fa8e', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), index.h("article", { key: '06cf2f69238065eb7388c9dc4c836eb033336a31', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, index.h("slot", { key: '0b64911842875cb212136ffde476136d925dde01' })))));
|
|
5136
5195
|
}
|
|
5137
5196
|
get element() { return index.getElement(this); }
|
|
5138
5197
|
static get watchers() { return {
|
|
@@ -7032,7 +7091,7 @@ const MgPopover = class {
|
|
|
7032
7091
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7033
7092
|
}
|
|
7034
7093
|
};
|
|
7035
|
-
this.identifier =
|
|
7094
|
+
this.identifier = index$1.je('mg-popover');
|
|
7036
7095
|
this.placement = 'bottom';
|
|
7037
7096
|
this.arrowHide = false;
|
|
7038
7097
|
this.closeButton = false;
|
|
@@ -7075,7 +7134,7 @@ const MgPopover = class {
|
|
|
7075
7134
|
*/
|
|
7076
7135
|
componentWillLoad() {
|
|
7077
7136
|
// Get windows to attach events
|
|
7078
|
-
this.windows =
|
|
7137
|
+
this.windows = index$1.Ne(window);
|
|
7079
7138
|
// render mg-popover-content slot
|
|
7080
7139
|
this.renderPopoverContent();
|
|
7081
7140
|
this.validateCloseButton(this.closeButton);
|
|
@@ -7163,7 +7222,7 @@ const MgPopoverContent = class {
|
|
|
7163
7222
|
this.hideContent.emit();
|
|
7164
7223
|
};
|
|
7165
7224
|
this.closeButton = false;
|
|
7166
|
-
this.classCollection = new
|
|
7225
|
+
this.classCollection = new index$1.Fe(['mg-c-popover-content']);
|
|
7167
7226
|
}
|
|
7168
7227
|
/*************
|
|
7169
7228
|
* Lifecycle *
|
|
@@ -7173,7 +7232,7 @@ const MgPopoverContent = class {
|
|
|
7173
7232
|
*/
|
|
7174
7233
|
componentWillLoad() {
|
|
7175
7234
|
// Get locales
|
|
7176
|
-
this.messages =
|
|
7235
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
7177
7236
|
}
|
|
7178
7237
|
/**
|
|
7179
7238
|
* Check if component slots are valide
|
|
@@ -7181,7 +7240,7 @@ const MgPopoverContent = class {
|
|
|
7181
7240
|
componentDidLoad() {
|
|
7182
7241
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7183
7242
|
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
7184
|
-
if (slottedTitleElement && !
|
|
7243
|
+
if (slottedTitleElement && !index$1._e(slottedTitleElement, headingTags)) {
|
|
7185
7244
|
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
7186
7245
|
}
|
|
7187
7246
|
}
|
|
@@ -7190,7 +7249,7 @@ const MgPopoverContent = class {
|
|
|
7190
7249
|
* @returns HTML Element
|
|
7191
7250
|
*/
|
|
7192
7251
|
render() {
|
|
7193
|
-
return (index.h(index.Host, { key: '
|
|
7252
|
+
return (index.h(index.Host, { key: '571f8154dbfa075c6fedcff3e2b8f5e9daf374fe' }, index.h("mg-card", { key: '4c173845a5baa5afd18464789c281e6d2663a754', class: this.classCollection.join() }, this.closeButton && (index.h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { icon: "cross" }))), index.h("div", { key: '89d60fc8aecfe7b743331354f13b4c0222046f84', class: "mg-c-popover-content__title" }, index.h("slot", { key: '0547a80a3b8dfd76eaafbc252b2473de1c997c02', name: "title" })), index.h("slot", { key: '3c0a7a30ea07b17d33dc54f91b9eb53079f8f720', name: "content" })), index.h("slot", { key: 'b75f725bcc46602e0159f1bc2c699f253ad36be9', name: "arrow" })));
|
|
7194
7253
|
}
|
|
7195
7254
|
get element() { return index.getElement(this); }
|
|
7196
7255
|
};
|
|
@@ -7217,7 +7276,7 @@ const MgSkipLinks = class {
|
|
|
7217
7276
|
this.links = undefined;
|
|
7218
7277
|
}
|
|
7219
7278
|
validateLinks(links) {
|
|
7220
|
-
if (links === undefined || links.length === 0 || links.some(link => !
|
|
7279
|
+
if (links === undefined || links.length === 0 || links.some(link => !index$1.He(link.href) || !link.href.startsWith('#') || !index$1.He(link.label))) {
|
|
7221
7280
|
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.`);
|
|
7222
7281
|
}
|
|
7223
7282
|
}
|
|
@@ -7229,14 +7288,14 @@ const MgSkipLinks = class {
|
|
|
7229
7288
|
*/
|
|
7230
7289
|
componentWillLoad() {
|
|
7231
7290
|
this.validateLinks(this.links);
|
|
7232
|
-
this.messages =
|
|
7291
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
7233
7292
|
}
|
|
7234
7293
|
/**
|
|
7235
7294
|
* Render
|
|
7236
7295
|
* @returns HTML Element
|
|
7237
7296
|
*/
|
|
7238
7297
|
render() {
|
|
7239
|
-
return (index.h("nav", { key: '
|
|
7298
|
+
return (index.h("nav", { key: '8fcbba136f23c73d6bc500eae107ac7d72caf9e3', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, index.h("ul", { key: '003daec99013a9274ed48f11d0afbeb6cd3a5dc0', 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)))))));
|
|
7240
7299
|
}
|
|
7241
7300
|
get element() { return index.getElement(this); }
|
|
7242
7301
|
static get watchers() { return {
|
|
@@ -7369,7 +7428,7 @@ const MgTabs = class {
|
|
|
7369
7428
|
*/
|
|
7370
7429
|
this.resetFocus = () => {
|
|
7371
7430
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7372
|
-
|
|
7431
|
+
index$1.Pe(() => {
|
|
7373
7432
|
this.tabFocus = undefined;
|
|
7374
7433
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7375
7434
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7384,16 +7443,16 @@ const MgTabs = class {
|
|
|
7384
7443
|
if (slots.length !== this.tabs.length)
|
|
7385
7444
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7386
7445
|
};
|
|
7387
|
-
this.identifier =
|
|
7446
|
+
this.identifier = index$1.je('mg-tabs');
|
|
7388
7447
|
this.label = undefined;
|
|
7389
7448
|
this.size = 'regular';
|
|
7390
7449
|
this.items = undefined;
|
|
7391
7450
|
this.activeTab = undefined;
|
|
7392
7451
|
this.tabs = [];
|
|
7393
|
-
this.classCollection = new
|
|
7452
|
+
this.classCollection = new index$1.Fe(['mg-c-tabs']);
|
|
7394
7453
|
}
|
|
7395
7454
|
validateLabel(newValue) {
|
|
7396
|
-
if (!
|
|
7455
|
+
if (!index$1.He(newValue)) {
|
|
7397
7456
|
throw new Error('<mg-tabs> prop "label" is required.');
|
|
7398
7457
|
}
|
|
7399
7458
|
}
|
|
@@ -7405,7 +7464,7 @@ const MgTabs = class {
|
|
|
7405
7464
|
}
|
|
7406
7465
|
validateItems(newValue) {
|
|
7407
7466
|
// String array
|
|
7408
|
-
if (
|
|
7467
|
+
if (index$1.De(newValue))
|
|
7409
7468
|
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
7410
7469
|
// Object array
|
|
7411
7470
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
@@ -7467,7 +7526,7 @@ const MgTabs = class {
|
|
|
7467
7526
|
* @returns HTML Element
|
|
7468
7527
|
*/
|
|
7469
7528
|
render() {
|
|
7470
|
-
return (index.h("div", { key: '
|
|
7529
|
+
return (index.h("div", { key: '20e5f42bd37175f245a7169f58f1eabc37c13e01', class: this.classCollection.join() }, index.h("header", { key: 'f4bbc2c7818e1eb3f5e1878f392e7ad683a7e2f1', 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: {
|
|
7471
7530
|
[`${this.buttonTabBaseClass}`]: true,
|
|
7472
7531
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
7473
7532
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -7505,7 +7564,7 @@ const MgTag = class {
|
|
|
7505
7564
|
this.variant = variants[0];
|
|
7506
7565
|
this.outline = undefined;
|
|
7507
7566
|
this.soft = undefined;
|
|
7508
|
-
this.classCollection = new
|
|
7567
|
+
this.classCollection = new index$1.Fe(['mg-c-tag']);
|
|
7509
7568
|
}
|
|
7510
7569
|
validateVariant(newValue, oldValue) {
|
|
7511
7570
|
if (!variants.includes(newValue)) {
|
|
@@ -7542,7 +7601,7 @@ const MgTag = class {
|
|
|
7542
7601
|
* @param textContent - html element textContent property
|
|
7543
7602
|
*/
|
|
7544
7603
|
validateTextContent(textContent) {
|
|
7545
|
-
if (!
|
|
7604
|
+
if (!index$1.He(textContent))
|
|
7546
7605
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
7547
7606
|
}
|
|
7548
7607
|
/*************
|
|
@@ -7580,7 +7639,7 @@ var Guard;
|
|
|
7580
7639
|
Guard["HOVER_TOOLTIPED_ELEMENT"] = "hoverTooltipedGuard";
|
|
7581
7640
|
})(Guard || (Guard = {}));
|
|
7582
7641
|
|
|
7583
|
-
const mgTooltipCss = ":host{display:inline-block}";
|
|
7642
|
+
const mgTooltipCss = ":host{display:inline-block}mg-tooltip-content{font-family:var(--font-family);font-size:var(--font-size);font-weight:200}";
|
|
7584
7643
|
const MgTooltipStyle0 = mgTooltipCss;
|
|
7585
7644
|
|
|
7586
7645
|
/**
|
|
@@ -7601,7 +7660,7 @@ const MgTooltip = class {
|
|
|
7601
7660
|
// Enable the event listeners
|
|
7602
7661
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7603
7662
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7604
|
-
|
|
7663
|
+
index$1.Pe(() => {
|
|
7605
7664
|
this.windows.forEach((localWindow) => {
|
|
7606
7665
|
localWindow.addEventListener('click', this.clickOutside, false);
|
|
7607
7666
|
localWindow.addEventListener('keydown', this.pressEscape, false);
|
|
@@ -7766,7 +7825,7 @@ const MgTooltip = class {
|
|
|
7766
7825
|
});
|
|
7767
7826
|
});
|
|
7768
7827
|
};
|
|
7769
|
-
this.identifier =
|
|
7828
|
+
this.identifier = index$1.je('mg-tooltip');
|
|
7770
7829
|
this.message = undefined;
|
|
7771
7830
|
this.placement = 'bottom';
|
|
7772
7831
|
this.display = false;
|
|
@@ -7777,7 +7836,7 @@ const MgTooltip = class {
|
|
|
7777
7836
|
this.renderTooltipContent();
|
|
7778
7837
|
}
|
|
7779
7838
|
validateMessage(newValue) {
|
|
7780
|
-
if (!
|
|
7839
|
+
if (!index$1.He(newValue)) {
|
|
7781
7840
|
throw new Error('<mg-tooltip> prop "message" is required.');
|
|
7782
7841
|
}
|
|
7783
7842
|
this.mgTooltipContent.message = newValue;
|
|
@@ -7826,7 +7885,7 @@ const MgTooltip = class {
|
|
|
7826
7885
|
*/
|
|
7827
7886
|
componentWillLoad() {
|
|
7828
7887
|
// Get windows to attach events
|
|
7829
|
-
this.windows =
|
|
7888
|
+
this.windows = index$1.Ne(window);
|
|
7830
7889
|
// Get tooltip element
|
|
7831
7890
|
this.renderTooltipContent();
|
|
7832
7891
|
this.mgTooltipContent = this.element.querySelector(`#${this.identifier}`);
|
|
@@ -7845,7 +7904,7 @@ const MgTooltip = class {
|
|
|
7845
7904
|
// get slotted element wich is not the tooltip
|
|
7846
7905
|
const slotElement = this.element.querySelector(`*:not(#${this.identifier})`);
|
|
7847
7906
|
// Get interactive element
|
|
7848
|
-
const interactiveElement = slotElement.matches(
|
|
7907
|
+
const interactiveElement = slotElement.matches(index$1.Be) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(index$1.Be);
|
|
7849
7908
|
// define selected element to become tooltip selector
|
|
7850
7909
|
this.tooltipedElement = interactiveElement || slotElement;
|
|
7851
7910
|
// Check if slotted element is a disabled mg-button
|