@mgdis/mg-components 6.1.0 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-e4a8bf81.js → index-52d5f3d4.js} +16 -6
- package/dist/cjs/index-52d5f3d4.js.map +1 -0
- package/dist/{esm/index-d8f69946.js → cjs/index-cc11af95.js} +6 -116
- package/dist/cjs/index-cc11af95.js.map +1 -0
- package/dist/cjs/index.es-ac7c22e3.js +152 -0
- package/dist/cjs/index.es-ac7c22e3.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +324 -216
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +7 -6
- package/dist/cjs/mg-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-loader.cjs.entry.js +5 -4
- package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-progress.cjs.entry.js +82 -0
- package/dist/cjs/mg-progress.cjs.entry.js.map +1 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +8 -2
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +33 -26
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +30 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +85 -4
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +29 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +30 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +29 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +29 -2
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +29 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +30 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +3 -4
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +32 -2
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.conf.js +5 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.conf.js.map +1 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +187 -0
- package/dist/collection/components/molecules/mg-progress/mg-progress.js.map +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/types/index.js.map +1 -1
- package/dist/components/index.es.js +26 -13
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +2 -2
- package/dist/components/mg-button2.js +10 -4
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-form.js +19 -5
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +20 -29
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +18 -5
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +29 -7
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +14 -2
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +15 -2
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-select2.js +14 -2
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +14 -2
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +14 -2
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-toggle.js +15 -2
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-input2.js.map +1 -1
- package/dist/components/mg-item-more2.js +5 -6
- package/dist/components/mg-item-more2.js.map +1 -1
- package/dist/components/mg-menu-item2.js +3 -3
- package/dist/components/mg-modal.js +2 -2
- package/dist/components/mg-pagination2.js +2 -2
- package/dist/components/mg-panel.js +2 -2
- package/dist/components/mg-popover2.js +2 -2
- package/dist/components/mg-progress.d.ts +11 -0
- package/dist/components/mg-progress.js +109 -0
- package/dist/components/mg-progress.js.map +1 -0
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs.js +4 -4
- package/dist/components/mg-tooltip2.js +3 -3
- package/dist/esm/{index-e26aede5.js → index-81752ffe.js} +16 -6
- package/dist/esm/index-81752ffe.js.map +1 -0
- package/dist/{cjs/index-0fe2670c.js → esm/index-f3d3fb70.js} +4 -135
- package/dist/esm/index-f3d3fb70.js.map +1 -0
- package/dist/esm/index.es-940821a9.js +130 -0
- package/dist/esm/index.es-940821a9.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +175 -67
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +3 -2
- package/dist/esm/mg-alert.entry.js.map +1 -1
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-loader.entry.js +3 -2
- package/dist/esm/mg-loader.entry.js.map +1 -1
- package/dist/esm/mg-progress.entry.js +78 -0
- package/dist/esm/mg-progress.entry.js.map +1 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/p-2298352f.js +3 -0
- package/dist/mg-components/p-2298352f.js.map +1 -0
- package/dist/mg-components/p-31e6c1a7.entry.js +2 -0
- package/dist/mg-components/{p-9beb09e5.entry.js.map → p-31e6c1a7.entry.js.map} +1 -1
- package/dist/mg-components/p-67c9be27.entry.js +2 -0
- package/dist/mg-components/p-67c9be27.entry.js.map +1 -0
- package/dist/mg-components/p-95895169.entry.js +2 -0
- package/dist/mg-components/{p-5c77f5dd.entry.js.map → p-95895169.entry.js.map} +1 -1
- package/dist/mg-components/p-a49e2b74.js +2 -0
- package/dist/mg-components/p-a49e2b74.js.map +1 -0
- package/dist/mg-components/p-abddacc2.entry.js +2 -0
- package/dist/mg-components/p-abddacc2.entry.js.map +1 -0
- package/dist/mg-components/p-ee51ec5e.js +2 -0
- package/dist/mg-components/p-ee51ec5e.js.map +1 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +13 -11
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +0 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -9
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +12 -0
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -0
- package/dist/types/components/molecules/mg-form/mg-form.conf.d.ts +2 -1
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +4 -0
- package/dist/types/components/molecules/mg-progress/mg-progress.conf.d.ts +9 -0
- package/dist/types/components/molecules/mg-progress/mg-progress.d.ts +47 -0
- package/dist/types/components.d.ts +111 -0
- package/dist/types/stencil-public-runtime.d.ts +2 -0
- package/dist/types/types/index.d.ts +4 -0
- package/ide/intellij/web-types.json +183 -15
- package/ide/vscode/css-custom-data.json +16 -0
- package/ide/vscode/html-custom-data.json +150 -11
- package/package.json +25 -25
- package/dist/cjs/index-0fe2670c.js.map +0 -1
- package/dist/cjs/index-e4a8bf81.js.map +0 -1
- package/dist/esm/index-d8f69946.js.map +0 -1
- package/dist/esm/index-e26aede5.js.map +0 -1
- package/dist/mg-components/p-1fbb6ee7.js +0 -3
- package/dist/mg-components/p-1fbb6ee7.js.map +0 -1
- package/dist/mg-components/p-5c77f5dd.entry.js +0 -2
- package/dist/mg-components/p-9beb09e5.entry.js +0 -2
- package/dist/mg-components/p-c9934e81.js +0 -2
- package/dist/mg-components/p-c9934e81.js.map +0 -1
- package/dist/mg-components/p-d7dde2ac.entry.js +0 -2
- package/dist/mg-components/p-d7dde2ac.entry.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-
|
|
2
|
-
import {
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-81752ffe.js';
|
|
2
|
+
import { q as qe, Y as Ye, X as Xe, m as me, t as tt, G as Ge, K as Ke, e as et, H as He, z as ze, f as ft, c as ct, p as pt, d as dt, u as ut, $ as $t, J as Je, Z as Ze, Q as Qe } from './index.es-940821a9.js';
|
|
3
|
+
import { i as initLocales } from './index-f3d3fb70.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Available menu item status values
|
|
@@ -72,7 +73,7 @@ const MgActionMore = class {
|
|
|
72
73
|
************/
|
|
73
74
|
this.name = 'mg-action-more';
|
|
74
75
|
this.classBase = 'mg-c-action-more';
|
|
75
|
-
this.mgPopoverIdentifier =
|
|
76
|
+
this.mgPopoverIdentifier = qe(this.name);
|
|
76
77
|
/************
|
|
77
78
|
* Methods *
|
|
78
79
|
***********/
|
|
@@ -320,7 +321,13 @@ const MgButton = class {
|
|
|
320
321
|
this.classCollection = new Xe(['mg-c-button']);
|
|
321
322
|
}
|
|
322
323
|
validateVariant(newValue, oldValue) {
|
|
324
|
+
// validate new value
|
|
323
325
|
if (!variants$3.includes(newValue)) {
|
|
326
|
+
if (newValue === '') {
|
|
327
|
+
// Reactive framework like VUE render with `""` when prop is update to undefined
|
|
328
|
+
this.variant = variants$3[0];
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
324
331
|
throw new Error(`<mg-button> prop "variant" must be one of: ${variants$3.join(', ')}. Passed value: ${Ye(newValue)}.`);
|
|
325
332
|
}
|
|
326
333
|
else {
|
|
@@ -388,7 +395,7 @@ const MgButton = class {
|
|
|
388
395
|
* Add listners
|
|
389
396
|
*/
|
|
390
397
|
componentDidLoad() {
|
|
391
|
-
|
|
398
|
+
tt(() => {
|
|
392
399
|
var _a;
|
|
393
400
|
const closestForm = this.element.closest('form') || ((_a = this.element.closest('mg-form')) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector('form'));
|
|
394
401
|
// submit buttons should trigger form submition;
|
|
@@ -405,7 +412,7 @@ const MgButton = class {
|
|
|
405
412
|
*/
|
|
406
413
|
render() {
|
|
407
414
|
var _a;
|
|
408
|
-
return (h(Host, { key: '
|
|
415
|
+
return (h(Host, { key: '0e3996123ef570a493d645b7a24d4271f13ae7c4', role: "button", tabIndex: 0, type: this.type, form: this.form, "full-width": this.fullWidth, "aria-label": this.label, "aria-disabled": (_a = this.disabled) === null || _a === void 0 ? void 0 : _a.toString(), onClick: this.handleClick, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown }, h("div", { key: 'bef43bda72867ea981814bdeda110d2dec4306f9', class: this.classCollection.join() }, this.loading && h("mg-icon", { key: 'e5754f3ca96f24da369e0961ced9f119b22b8878', icon: "loader", spin: true }), h("div", { key: '20afb713a15e3a003dc4fd0a5470aa764246858e', class: "mg-c-button__content" }, h("slot", { key: 'd0468692516ebc044a14dedbba96d74791552bd1' })))));
|
|
409
416
|
}
|
|
410
417
|
get element() { return getElement(this); }
|
|
411
418
|
static get watchers() { return {
|
|
@@ -642,7 +649,7 @@ const MgForm = class {
|
|
|
642
649
|
*/
|
|
643
650
|
this.setMgInputs = () => {
|
|
644
651
|
// Get slotted mgInputs
|
|
645
|
-
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT
|
|
652
|
+
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT'));
|
|
646
653
|
// Set inputs readonly or disabled based on form configuration
|
|
647
654
|
// Othewise listen to events
|
|
648
655
|
this.mgInputs.forEach(input => {
|
|
@@ -660,7 +667,7 @@ const MgForm = class {
|
|
|
660
667
|
}
|
|
661
668
|
});
|
|
662
669
|
};
|
|
663
|
-
this.identifier =
|
|
670
|
+
this.identifier = qe('mg-form');
|
|
664
671
|
this.name = this.identifier;
|
|
665
672
|
this.readonly = false;
|
|
666
673
|
this.requiredMessage = undefined;
|
|
@@ -711,6 +718,18 @@ const MgForm = class {
|
|
|
711
718
|
this.checkValidity();
|
|
712
719
|
}
|
|
713
720
|
}
|
|
721
|
+
/**
|
|
722
|
+
* Reset form inputs values, validity and error state
|
|
723
|
+
*/
|
|
724
|
+
async reset() {
|
|
725
|
+
if (!this.readonly) {
|
|
726
|
+
await Promise.all(this.mgInputs.map(async (input) => {
|
|
727
|
+
if (input.reset !== undefined) {
|
|
728
|
+
await input.reset();
|
|
729
|
+
}
|
|
730
|
+
}));
|
|
731
|
+
}
|
|
732
|
+
}
|
|
714
733
|
/*************
|
|
715
734
|
* Lifecycle *
|
|
716
735
|
*************/
|
|
@@ -750,6 +769,7 @@ const MgForm = class {
|
|
|
750
769
|
// Update mgInputs when mgForm content change
|
|
751
770
|
new MutationObserver(() => {
|
|
752
771
|
this.setMgInputs();
|
|
772
|
+
this.checkValidity();
|
|
753
773
|
}).observe(this.element, { childList: true });
|
|
754
774
|
}
|
|
755
775
|
/**
|
|
@@ -757,7 +777,7 @@ const MgForm = class {
|
|
|
757
777
|
* @returns HTML Element
|
|
758
778
|
*/
|
|
759
779
|
render() {
|
|
760
|
-
return (h("form", { key: '
|
|
780
|
+
return (h("form", { key: 'ecfaff2bb897ce2c48ed352167bb418703a56c98', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: '4d4fa2ff3cf4f25ebe0b009ae1995734bfcafd3b', innerHTML: this.requiredMessageText }), h("slot", { key: 'dc0c7acadf6b744335852f847a8336b018e28cb5' }), !this.readonly && !this.disabled && h("slot", { key: 'ede3ace32f6a88067845013fa65e5414cae5fcea', name: "actions" })));
|
|
761
781
|
}
|
|
762
782
|
get element() { return getElement(this); }
|
|
763
783
|
static get watchers() { return {
|
|
@@ -1212,7 +1232,7 @@ const MgInputCheckboxList = (props) => (h("ul", { class: "mg-c-input__input-grou
|
|
|
1212
1232
|
var _a, _b;
|
|
1213
1233
|
return (h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } },
|
|
1214
1234
|
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 }),
|
|
1215
|
-
h("label", { htmlFor: input._id
|
|
1235
|
+
h("label", { htmlFor: input._id }, input.title)));
|
|
1216
1236
|
})));
|
|
1217
1237
|
|
|
1218
1238
|
const mgInputCheckboxCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-group-container{padding:var(--mg-b-size-4) var(--mg-b-size-8);margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container{display:flex;width:unset;flex:unset;flex-wrap:wrap;column-gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container-list{display:flex;flex-flow:row wrap;padding:0;margin:0;gap:var(--mg-b-size-4);list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__sections{max-height:80vh;padding-right:var(--mg-b-size-8);overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header{display:flex;min-height:var(--mg-b-size-min-height);flex-wrap:wrap;flex-wrap:nowrap;align-items:center;gap:var(--mg-b-size-8);text-wrap:nowrap}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-tootlip{display:inline-block;width:auto;height:auto;margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title{display:inline;margin:0;color:var(--mg-b-color-neutral-80)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title-label{font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__section-header-title--static.mg-c-input__section-header-title{margin:0 var(--mg-b-size-12)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-value{display:inline-flex;min-width:var(--mg-b-size-min-height);min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-radius:var(--mg-b-size-4);background-color:var(--mg-b-color-neutral-20);font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-no-result{text-align:center}.mg-c-input.mg-c-input--checkbox-multi b{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--disabled .mg-c-input__input-container b{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--with-values .mg-c-input__input-container{gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content{display:flex;width:calc(var(--mg-b-size-floating-element-max-width) - var(--mg-b-size-16));height:calc(50*var(--mg-b-size-8));flex-direction:column;gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__section-header-tootlip){margin-left:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-c-card-spacing:var(--mg-b-size-8)}.mg-c-input.mg-c-input--readonly ul{display:flex;min-height:var(--mg-b-font-size);flex-flow:column wrap;padding:0;margin:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) 0 0;list-style:none;row-gap:var(--mg-b-size-8)}";
|
|
@@ -1251,6 +1271,7 @@ const MgInputCheckbox = class {
|
|
|
1251
1271
|
this.updateCheckboxItems('value', Boolean(event.target.checked), item => item._id === event.target.id);
|
|
1252
1272
|
this.updateValues();
|
|
1253
1273
|
this.checkValidity();
|
|
1274
|
+
this.setErrorMessage();
|
|
1254
1275
|
};
|
|
1255
1276
|
/**
|
|
1256
1277
|
* Keyboard handler
|
|
@@ -1277,18 +1298,10 @@ const MgInputCheckbox = class {
|
|
|
1277
1298
|
/**
|
|
1278
1299
|
* Handle blur event
|
|
1279
1300
|
*/
|
|
1280
|
-
this.handleBlur = (
|
|
1281
|
-
if (this.handlerInProgress === 'mouseenter') {
|
|
1282
|
-
event.preventDefault();
|
|
1283
|
-
return;
|
|
1284
|
-
}
|
|
1285
|
-
// set guard
|
|
1286
|
-
this.handlerInProgress = 'blur';
|
|
1301
|
+
this.handleBlur = () => {
|
|
1287
1302
|
// Check validity
|
|
1288
1303
|
this.checkValidity();
|
|
1289
1304
|
this.setErrorMessage();
|
|
1290
|
-
// reset guard
|
|
1291
|
-
this.handlerInProgress = undefined;
|
|
1292
1305
|
};
|
|
1293
1306
|
/**
|
|
1294
1307
|
* Handle input search value-change event
|
|
@@ -1330,18 +1343,6 @@ const MgInputCheckbox = class {
|
|
|
1330
1343
|
});
|
|
1331
1344
|
this.updateValues();
|
|
1332
1345
|
};
|
|
1333
|
-
/**
|
|
1334
|
-
* Handle input label mouseenter event
|
|
1335
|
-
*/
|
|
1336
|
-
this.handleMouseEnter = () => {
|
|
1337
|
-
this.handlerInProgress = 'mouseenter';
|
|
1338
|
-
};
|
|
1339
|
-
/**
|
|
1340
|
-
* Handle input label leave event
|
|
1341
|
-
*/
|
|
1342
|
-
this.handleMouseLeave = () => {
|
|
1343
|
-
this.handlerInProgress = undefined;
|
|
1344
|
-
};
|
|
1345
1346
|
/**
|
|
1346
1347
|
* Update values
|
|
1347
1348
|
*/
|
|
@@ -1350,8 +1351,6 @@ const MgInputCheckbox = class {
|
|
|
1350
1351
|
delete o._handleBlur;
|
|
1351
1352
|
delete o._handleInput;
|
|
1352
1353
|
delete o._handleKeydown;
|
|
1353
|
-
delete o._handleMouseEnter;
|
|
1354
|
-
delete o._handleMouseLeave;
|
|
1355
1354
|
delete o._id;
|
|
1356
1355
|
return o;
|
|
1357
1356
|
});
|
|
@@ -1365,7 +1364,7 @@ const MgInputCheckbox = class {
|
|
|
1365
1364
|
* Method to update searchResults
|
|
1366
1365
|
*/
|
|
1367
1366
|
this.updateSearchResults = () => {
|
|
1368
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
1367
|
+
this.searchResults = this.checkboxItems.filter(item => et(item.title).includes(et(this.searchValue)));
|
|
1369
1368
|
};
|
|
1370
1369
|
/**
|
|
1371
1370
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -1482,7 +1481,7 @@ const MgInputCheckbox = class {
|
|
|
1482
1481
|
}
|
|
1483
1482
|
validateValue(newValue) {
|
|
1484
1483
|
if (isCheckboxItems(newValue)) {
|
|
1485
|
-
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this)
|
|
1484
|
+
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this) })));
|
|
1486
1485
|
this.valueChange.emit(newValue);
|
|
1487
1486
|
}
|
|
1488
1487
|
else {
|
|
@@ -1589,6 +1588,17 @@ const MgInputCheckbox = class {
|
|
|
1589
1588
|
this.hasDisplayedError = this.invalid;
|
|
1590
1589
|
}
|
|
1591
1590
|
}
|
|
1591
|
+
/**
|
|
1592
|
+
* Reset value, validity and error state
|
|
1593
|
+
*/
|
|
1594
|
+
async reset() {
|
|
1595
|
+
if (!this.readonly) {
|
|
1596
|
+
this.value = this.value.map(item => (Object.assign(Object.assign({}, item), { value: false })));
|
|
1597
|
+
this.checkValidity();
|
|
1598
|
+
this.errorMessage = undefined;
|
|
1599
|
+
this.hasDisplayedError = false;
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1592
1602
|
/**
|
|
1593
1603
|
* Method to set validity values
|
|
1594
1604
|
* @param newValue - valid new value
|
|
@@ -1598,7 +1608,7 @@ const MgInputCheckbox = class {
|
|
|
1598
1608
|
this.valid = newValue;
|
|
1599
1609
|
this.invalid = !this.valid;
|
|
1600
1610
|
// We need to send valid event even if it is the same value
|
|
1601
|
-
if (this.
|
|
1611
|
+
if (this.valid !== oldValidValue)
|
|
1602
1612
|
this.inputValid.emit(this.valid);
|
|
1603
1613
|
}
|
|
1604
1614
|
/**
|
|
@@ -1706,7 +1716,7 @@ const MgInputCheckbox = class {
|
|
|
1706
1716
|
else {
|
|
1707
1717
|
inputContent = this.renderCheckboxMulti();
|
|
1708
1718
|
}
|
|
1709
|
-
return (h("mg-input", { key: '
|
|
1719
|
+
return (h("mg-input", { key: '5a6c84d1f533159645c5aec09bb6e82a7cd30cc7', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
|
|
1710
1720
|
}
|
|
1711
1721
|
get element() { return getElement(this); }
|
|
1712
1722
|
static get watchers() { return {
|
|
@@ -1850,7 +1860,7 @@ const MgInputDate = class {
|
|
|
1850
1860
|
let text = me(helpText) ? helpText : this.messages.input.date.helpText;
|
|
1851
1861
|
if (text.includes(defaultHelpTextVariable))
|
|
1852
1862
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText));
|
|
1853
|
-
return text.replace('{pattern}', this.renderPattern()).replace('{date}', ze(
|
|
1863
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', ze(ft(new Date('2023-12-24')), this.systemLocale));
|
|
1854
1864
|
};
|
|
1855
1865
|
/**
|
|
1856
1866
|
* Handle input event
|
|
@@ -1957,7 +1967,7 @@ const MgInputDate = class {
|
|
|
1957
1967
|
* @returns translated html pattern
|
|
1958
1968
|
*/
|
|
1959
1969
|
this.renderPattern = () => {
|
|
1960
|
-
let patternLocal =
|
|
1970
|
+
let patternLocal = ct(this.systemLocale);
|
|
1961
1971
|
for (const key in this.messages.input.date.pattern) {
|
|
1962
1972
|
patternLocal = patternLocal.replace(key, this.messages.input.date.pattern[key]);
|
|
1963
1973
|
}
|
|
@@ -2053,6 +2063,18 @@ const MgInputDate = class {
|
|
|
2053
2063
|
this.hasDisplayedError = this.invalid;
|
|
2054
2064
|
}
|
|
2055
2065
|
}
|
|
2066
|
+
/**
|
|
2067
|
+
* Reset value, validity and error state
|
|
2068
|
+
*/
|
|
2069
|
+
async reset() {
|
|
2070
|
+
if (!this.readonly) {
|
|
2071
|
+
this.value = '';
|
|
2072
|
+
this.checkValidity();
|
|
2073
|
+
this.invalid = false;
|
|
2074
|
+
this.errorMessage = undefined;
|
|
2075
|
+
this.hasDisplayedError = false;
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2056
2078
|
/**
|
|
2057
2079
|
* Method to set validity values
|
|
2058
2080
|
* @param newValue - valid new value
|
|
@@ -2098,7 +2120,7 @@ const MgInputDate = class {
|
|
|
2098
2120
|
* @returns HTML Element
|
|
2099
2121
|
*/
|
|
2100
2122
|
render() {
|
|
2101
|
-
return (h("mg-input", { key: '
|
|
2123
|
+
return (h("mg-input", { key: '33ffeaf0b7b07cc65081891709a73a44c9454092', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && ['', undefined].includes(this.value) ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, ze(this.value, this.locale))) : (h("input", { type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
2102
2124
|
if (el !== null)
|
|
2103
2125
|
this.input = el;
|
|
2104
2126
|
} }))));
|
|
@@ -2119,7 +2141,7 @@ MgInputDate.style = MgInputDateStyle0;
|
|
|
2119
2141
|
* List of all possibles types
|
|
2120
2142
|
*/
|
|
2121
2143
|
const types = ['decimal', 'integer'];
|
|
2122
|
-
const formats = ['none', 'number', 'currency'];
|
|
2144
|
+
const formats = ['none', 'number', 'currency', 'percent', 'unit'];
|
|
2123
2145
|
|
|
2124
2146
|
const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*.6ch)}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
|
|
2125
2147
|
const MgInputNumericStyle0 = mgInputNumericCss;
|
|
@@ -2184,7 +2206,9 @@ const MgInputNumeric = class {
|
|
|
2184
2206
|
this.errorMessage = this.messages.errors[inputError];
|
|
2185
2207
|
}
|
|
2186
2208
|
else {
|
|
2187
|
-
|
|
2209
|
+
const formattedMin = this.formatValue(this.min);
|
|
2210
|
+
const formattedMax = this.formatValue(this.max);
|
|
2211
|
+
this.errorMessage = this.messages.errors.numeric[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
|
|
2188
2212
|
}
|
|
2189
2213
|
}
|
|
2190
2214
|
};
|
|
@@ -2222,9 +2246,13 @@ const MgInputNumeric = class {
|
|
|
2222
2246
|
this.formatValue = (value) => {
|
|
2223
2247
|
switch (this.format) {
|
|
2224
2248
|
case 'number':
|
|
2225
|
-
return
|
|
2249
|
+
return $t(value, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2226
2250
|
case 'currency':
|
|
2227
|
-
return
|
|
2251
|
+
return ut(value, this.locale, this.currency);
|
|
2252
|
+
case 'percent':
|
|
2253
|
+
return dt(value / 100, this.locale, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2254
|
+
case 'unit':
|
|
2255
|
+
return pt(value, this.locale, this.unit, this.unitDisplay, this.type === 'decimal' ? this.decimalLength : undefined);
|
|
2228
2256
|
case 'none':
|
|
2229
2257
|
return value.toString();
|
|
2230
2258
|
}
|
|
@@ -2270,6 +2298,8 @@ const MgInputNumeric = class {
|
|
|
2270
2298
|
this.type = 'decimal';
|
|
2271
2299
|
this.format = 'number';
|
|
2272
2300
|
this.currency = 'EUR';
|
|
2301
|
+
this.unit = undefined;
|
|
2302
|
+
this.unitDisplay = 'short';
|
|
2273
2303
|
this.integerLength = 13;
|
|
2274
2304
|
this.decimalLength = 2;
|
|
2275
2305
|
this.valid = undefined;
|
|
@@ -2376,6 +2406,17 @@ const MgInputNumeric = class {
|
|
|
2376
2406
|
this.hasDisplayedError = this.invalid;
|
|
2377
2407
|
}
|
|
2378
2408
|
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Reset value, validity and error state
|
|
2411
|
+
*/
|
|
2412
|
+
async reset() {
|
|
2413
|
+
if (!this.readonly) {
|
|
2414
|
+
this.value = '';
|
|
2415
|
+
this.checkValidity();
|
|
2416
|
+
this.errorMessage = undefined;
|
|
2417
|
+
this.hasDisplayedError = false;
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2379
2420
|
/**
|
|
2380
2421
|
* Method to set validity values
|
|
2381
2422
|
* @param newValue - valid new value
|
|
@@ -2462,7 +2503,7 @@ const MgInputNumeric = class {
|
|
|
2462
2503
|
* @returns HTML Element
|
|
2463
2504
|
*/
|
|
2464
2505
|
render() {
|
|
2465
|
-
return (h("mg-input", { key: '
|
|
2506
|
+
return (h("mg-input", { key: '6d34c2b7e9762cdefc5de3814ff4afd95fa4a6a6', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
|
|
2466
2507
|
? this.readonlyValue && this.renderReadonly()
|
|
2467
2508
|
: [
|
|
2468
2509
|
h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
@@ -2632,6 +2673,17 @@ const MgInputPassword = class {
|
|
|
2632
2673
|
this.hasDisplayedError = this.invalid;
|
|
2633
2674
|
}
|
|
2634
2675
|
}
|
|
2676
|
+
/**
|
|
2677
|
+
* Reset value, validity and error state
|
|
2678
|
+
*/
|
|
2679
|
+
async reset() {
|
|
2680
|
+
if (!this.readonly) {
|
|
2681
|
+
this.value = '';
|
|
2682
|
+
this.checkValidity();
|
|
2683
|
+
this.errorMessage = undefined;
|
|
2684
|
+
this.hasDisplayedError = false;
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2635
2687
|
/**
|
|
2636
2688
|
* Method to set validity values
|
|
2637
2689
|
* @param newValue - valid new value
|
|
@@ -2669,7 +2721,7 @@ const MgInputPassword = class {
|
|
|
2669
2721
|
* @returns HTML Element
|
|
2670
2722
|
*/
|
|
2671
2723
|
render() {
|
|
2672
|
-
return (h("mg-input", { key: '
|
|
2724
|
+
return (h("mg-input", { key: 'af313cb20a94a9c8dcf2b944c31b7ea36b2d3feb', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
2673
2725
|
if (el !== null)
|
|
2674
2726
|
this.input = el;
|
|
2675
2727
|
} }), h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
|
|
@@ -2775,6 +2827,7 @@ const MgInputRadio = class {
|
|
|
2775
2827
|
this.options = undefined;
|
|
2776
2828
|
this.readonlyValue = undefined;
|
|
2777
2829
|
}
|
|
2830
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2778
2831
|
watchValue(newValue) {
|
|
2779
2832
|
var _a;
|
|
2780
2833
|
if (Je(this.items) && typeof newValue === 'string') {
|
|
@@ -2862,6 +2915,17 @@ const MgInputRadio = class {
|
|
|
2862
2915
|
this.hasDisplayedError = this.invalid;
|
|
2863
2916
|
}
|
|
2864
2917
|
}
|
|
2918
|
+
/**
|
|
2919
|
+
* Reset value, validity and error state
|
|
2920
|
+
*/
|
|
2921
|
+
async reset() {
|
|
2922
|
+
if (!this.readonly) {
|
|
2923
|
+
this.value = undefined;
|
|
2924
|
+
this.checkValidity();
|
|
2925
|
+
this.errorMessage = undefined;
|
|
2926
|
+
this.hasDisplayedError = false;
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2865
2929
|
/**
|
|
2866
2930
|
* Method to set validity values
|
|
2867
2931
|
* @param newValue - valid new value
|
|
@@ -2902,7 +2966,7 @@ const MgInputRadio = class {
|
|
|
2902
2966
|
* @returns HTML Element
|
|
2903
2967
|
*/
|
|
2904
2968
|
render() {
|
|
2905
|
-
return (h("mg-input", { key: '
|
|
2969
|
+
return (h("mg-input", { key: '1f27ea2672375c28b2b7afca66ebd09f8dfc2354', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
2906
2970
|
if (el !== null)
|
|
2907
2971
|
this.inputs[index] = el;
|
|
2908
2972
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
|
|
@@ -3180,6 +3244,17 @@ const MgInputSelect = class {
|
|
|
3180
3244
|
this.hasDisplayedError = this.invalid;
|
|
3181
3245
|
}
|
|
3182
3246
|
}
|
|
3247
|
+
/**
|
|
3248
|
+
* Reset value, validity and error state
|
|
3249
|
+
*/
|
|
3250
|
+
async reset() {
|
|
3251
|
+
if (!this.readonly) {
|
|
3252
|
+
this.value = null;
|
|
3253
|
+
this.checkValidity();
|
|
3254
|
+
this.errorMessage = undefined;
|
|
3255
|
+
this.hasDisplayedError = false;
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3183
3258
|
/**
|
|
3184
3259
|
* Method to set validity values
|
|
3185
3260
|
* @param newValue - valid new value
|
|
@@ -3224,7 +3299,7 @@ const MgInputSelect = class {
|
|
|
3224
3299
|
* @returns HTML Element
|
|
3225
3300
|
*/
|
|
3226
3301
|
render() {
|
|
3227
|
-
return (h("mg-input", { key: '
|
|
3302
|
+
return (h("mg-input", { key: '23ce3f91b4a5abdbd9b9731a895ca38d37b8c0a5', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("select", { class: "mg-c-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
3228
3303
|
if (el !== null)
|
|
3229
3304
|
this.input = el;
|
|
3230
3305
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -3480,6 +3555,17 @@ const MgInputText = class {
|
|
|
3480
3555
|
this.hasDisplayedError = this.invalid;
|
|
3481
3556
|
}
|
|
3482
3557
|
}
|
|
3558
|
+
/**
|
|
3559
|
+
* Reset value, validity and error state
|
|
3560
|
+
*/
|
|
3561
|
+
async reset() {
|
|
3562
|
+
if (!this.readonly) {
|
|
3563
|
+
this.value = '';
|
|
3564
|
+
this.checkValidity();
|
|
3565
|
+
this.errorMessage = undefined;
|
|
3566
|
+
this.hasDisplayedError = false;
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3483
3569
|
/**
|
|
3484
3570
|
* Method to set validity values
|
|
3485
3571
|
* @param newValue - valid new value
|
|
@@ -3525,7 +3611,7 @@ const MgInputText = class {
|
|
|
3525
3611
|
* @returns HTML Element
|
|
3526
3612
|
*/
|
|
3527
3613
|
render() {
|
|
3528
|
-
return (h("mg-input", { key: '
|
|
3614
|
+
return (h("mg-input", { key: '6ed4f9339354571851d415755b989824f623d62d', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly
|
|
3529
3615
|
? this.value && this.renderReadonly()
|
|
3530
3616
|
: [
|
|
3531
3617
|
h("div", { key: "input", class: "mg-c-input__with-character-left", style: {
|
|
@@ -3736,6 +3822,17 @@ const MgInputTextarea = class {
|
|
|
3736
3822
|
this.hasDisplayedError = this.invalid;
|
|
3737
3823
|
}
|
|
3738
3824
|
}
|
|
3825
|
+
/**
|
|
3826
|
+
* Reset value, validity and error state
|
|
3827
|
+
*/
|
|
3828
|
+
async reset() {
|
|
3829
|
+
if (!this.readonly) {
|
|
3830
|
+
this.value = '';
|
|
3831
|
+
this.checkValidity();
|
|
3832
|
+
this.errorMessage = undefined;
|
|
3833
|
+
this.hasDisplayedError = false;
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3739
3836
|
/**
|
|
3740
3837
|
* Method to set validity values
|
|
3741
3838
|
* @param newValue - valid new value
|
|
@@ -3778,7 +3875,7 @@ const MgInputTextarea = class {
|
|
|
3778
3875
|
* @returns HTML Element
|
|
3779
3876
|
*/
|
|
3780
3877
|
render() {
|
|
3781
|
-
return (h("mg-input", { key: '
|
|
3878
|
+
return (h("mg-input", { key: '311c9e0b36a6373aff8e3ca666dd4af93c2c1137', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [this.characterLeftId], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__with-character-left" }, h("textarea", { class: {
|
|
3782
3879
|
'mg-c-input__box': true,
|
|
3783
3880
|
'mg-c-input__box--width': true,
|
|
3784
3881
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
@@ -3939,6 +4036,7 @@ const MgInputToggle = class {
|
|
|
3939
4036
|
this.valid = undefined;
|
|
3940
4037
|
this.checked = false;
|
|
3941
4038
|
}
|
|
4039
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3942
4040
|
handleValue(newValue) {
|
|
3943
4041
|
// Swich to the right option
|
|
3944
4042
|
this.setChecked();
|
|
@@ -4015,6 +4113,17 @@ const MgInputToggle = class {
|
|
|
4015
4113
|
this.setErrorMessage(valid ? undefined : errorMessage);
|
|
4016
4114
|
}
|
|
4017
4115
|
}
|
|
4116
|
+
/**
|
|
4117
|
+
* Reset value, validity, error and visual state
|
|
4118
|
+
*/
|
|
4119
|
+
async reset() {
|
|
4120
|
+
if (!this.readonly) {
|
|
4121
|
+
this.value = this.options[0].value;
|
|
4122
|
+
this.errorMessage = undefined;
|
|
4123
|
+
this.valid = undefined;
|
|
4124
|
+
this.setChecked();
|
|
4125
|
+
}
|
|
4126
|
+
}
|
|
4018
4127
|
/**
|
|
4019
4128
|
* set checked state
|
|
4020
4129
|
*/
|
|
@@ -4062,7 +4171,7 @@ const MgInputToggle = class {
|
|
|
4062
4171
|
*/
|
|
4063
4172
|
render() {
|
|
4064
4173
|
const checkedItem = this.getCheckedItem(this.checked);
|
|
4065
|
-
return (h("mg-input", { key: '
|
|
4174
|
+
return (h("mg-input", { key: 'b47ba6e093e47f8405e12744576f2098943e5fbe', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
|
|
4066
4175
|
}
|
|
4067
4176
|
get element() { return getElement(this); }
|
|
4068
4177
|
static get watchers() { return {
|
|
@@ -4233,8 +4342,7 @@ const MgItemMore = class {
|
|
|
4233
4342
|
*/
|
|
4234
4343
|
this.setProxyElement = (proxified) => {
|
|
4235
4344
|
const proxy = this.moreElementMenuItem.querySelector(`[identifier="${proxified.identifier}"]`);
|
|
4236
|
-
|
|
4237
|
-
if (!proxy) {
|
|
4345
|
+
if (proxy === null) {
|
|
4238
4346
|
return;
|
|
4239
4347
|
}
|
|
4240
4348
|
// remove proxy id to prevent duplicate key. default html id is: '';
|
|
@@ -4282,7 +4390,7 @@ const MgItemMore = class {
|
|
|
4282
4390
|
// create item-more menu items element from main menu-items clones
|
|
4283
4391
|
this.moreElementMenuItem.querySelector('mg-menu').appendChild(child.cloneNode(true));
|
|
4284
4392
|
// we need to get all `mg-menu-item` linked to the cloned one to set mirror process
|
|
4285
|
-
|
|
4393
|
+
tt(() => {
|
|
4286
4394
|
this.setProxyElement(child);
|
|
4287
4395
|
if (child.querySelector('mg-menu') !== null) {
|
|
4288
4396
|
child.querySelectorAll('mg-menu-item').forEach(this.setProxyElement);
|
|
@@ -4355,11 +4463,11 @@ const MgItemMore = class {
|
|
|
4355
4463
|
* @returns HTML Element
|
|
4356
4464
|
*/
|
|
4357
4465
|
render() {
|
|
4358
|
-
return (h(Host, { key: '
|
|
4466
|
+
return (h(Host, { key: '11c43154129c5756e80db0af3434c88cab2191f3', role: "listitem" }, this.parentMenu && (h("mg-menu-item", { key: '38fc92410328c317fb046f4e1ec4f94175d484fb', "data-overflow-more": true, "data-size": this.parentMenu.size, identifier: "mg-item-more", ref: el => {
|
|
4359
4467
|
if (el !== null) {
|
|
4360
4468
|
this.moreElementMenuItem = el;
|
|
4361
4469
|
}
|
|
4362
|
-
} }, h("mg-icon", { key: '
|
|
4470
|
+
} }, h("mg-icon", { key: '90e21f30004e38a1a0938359276dccd7458e5e86', icon: this.icon.icon, size: this.size, slot: "image" }), h("span", { key: '20f846c5718a19d39ad94abf59bab54658e1ff9c', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { key: 'b52f97129e736be9164ae18b717057d1bfc0cd0a', direction: Direction.VERTICAL, label: this.messages.menuLabel, size: this.size })))));
|
|
4363
4471
|
}
|
|
4364
4472
|
get element() { return getElement(this); }
|
|
4365
4473
|
static get watchers() { return {
|
|
@@ -4679,7 +4787,7 @@ const MgMenuItem = class {
|
|
|
4679
4787
|
* @returns HTML Element
|
|
4680
4788
|
*/
|
|
4681
4789
|
this.renderSlot = () => h("slot", null);
|
|
4682
|
-
this.identifier =
|
|
4790
|
+
this.identifier = qe('mg-menu-item');
|
|
4683
4791
|
this.href = undefined;
|
|
4684
4792
|
this.target = undefined;
|
|
4685
4793
|
this.status = Status$1.VISIBLE;
|
|
@@ -4839,7 +4947,7 @@ const MgMenuItem = class {
|
|
|
4839
4947
|
* @returns promise process wich emit the 'item-updated' event
|
|
4840
4948
|
*/
|
|
4841
4949
|
componentShouldUpdate() {
|
|
4842
|
-
return
|
|
4950
|
+
return tt(() => {
|
|
4843
4951
|
this.itemUpdated.emit();
|
|
4844
4952
|
});
|
|
4845
4953
|
}
|
|
@@ -4988,7 +5096,7 @@ const MgModal = class {
|
|
|
4988
5096
|
this.handleClose = () => {
|
|
4989
5097
|
this.open = false;
|
|
4990
5098
|
};
|
|
4991
|
-
this.identifier =
|
|
5099
|
+
this.identifier = qe('mg-modal');
|
|
4992
5100
|
this.dialogRole = dialogRoles[0];
|
|
4993
5101
|
this.modalTitle = undefined;
|
|
4994
5102
|
this.closeButton = false;
|
|
@@ -5133,7 +5241,7 @@ const MgPagination = class {
|
|
|
5133
5241
|
this.handleGoToPage = (action, disabled) => {
|
|
5134
5242
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
5135
5243
|
};
|
|
5136
|
-
this.identifier =
|
|
5244
|
+
this.identifier = qe('mg-pagination');
|
|
5137
5245
|
this.label = undefined;
|
|
5138
5246
|
this.hideNavigationLabels = undefined;
|
|
5139
5247
|
this.hidePageCount = undefined;
|
|
@@ -5305,7 +5413,7 @@ const MgPanel = class {
|
|
|
5305
5413
|
];
|
|
5306
5414
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
5307
5415
|
};
|
|
5308
|
-
this.identifier =
|
|
5416
|
+
this.identifier = qe('mg-panel');
|
|
5309
5417
|
this.panelTitle = undefined;
|
|
5310
5418
|
this.titlePattern = undefined;
|
|
5311
5419
|
this.titlePatternErrorMessage = undefined;
|
|
@@ -7280,7 +7388,7 @@ const MgPopover = class {
|
|
|
7280
7388
|
mgPopoverContent.setAttribute('id', this.identifier);
|
|
7281
7389
|
}
|
|
7282
7390
|
};
|
|
7283
|
-
this.identifier =
|
|
7391
|
+
this.identifier = qe('mg-popover');
|
|
7284
7392
|
this.placement = 'bottom';
|
|
7285
7393
|
this.arrowHide = false;
|
|
7286
7394
|
this.closeButton = false;
|
|
@@ -7491,7 +7599,7 @@ const MgSkipLinks = class {
|
|
|
7491
7599
|
* @returns HTML Element
|
|
7492
7600
|
*/
|
|
7493
7601
|
render() {
|
|
7494
|
-
return (h("nav", { key: '
|
|
7602
|
+
return (h("nav", { key: '0b4e4d6b9481a88faae78602b07c4f5e851da517', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: 'aaa15193eb2c9e1d9ee3b2e2a7d8d0fd37836ed7', class: "mg-c-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
7495
7603
|
}
|
|
7496
7604
|
get element() { return getElement(this); }
|
|
7497
7605
|
static get watchers() { return {
|
|
@@ -7631,7 +7739,7 @@ const MgTabs = class {
|
|
|
7631
7739
|
*/
|
|
7632
7740
|
this.resetFocus = () => {
|
|
7633
7741
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
7634
|
-
|
|
7742
|
+
tt(() => {
|
|
7635
7743
|
this.tabFocus = undefined;
|
|
7636
7744
|
Array.from(this.element.shadowRoot.querySelectorAll('[data-index]')).forEach((tab, index) => {
|
|
7637
7745
|
tab.setAttribute('tabindex', this.activeTab - this.startIndex !== index ? '-1' : '0');
|
|
@@ -7646,7 +7754,7 @@ const MgTabs = class {
|
|
|
7646
7754
|
if (slots.length !== this.tabs.length)
|
|
7647
7755
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
7648
7756
|
};
|
|
7649
|
-
this.identifier =
|
|
7757
|
+
this.identifier = qe('mg-tabs');
|
|
7650
7758
|
this.label = undefined;
|
|
7651
7759
|
this.size = 'medium';
|
|
7652
7760
|
this.items = undefined;
|
|
@@ -7738,7 +7846,7 @@ const MgTabs = class {
|
|
|
7738
7846
|
* @returns HTML Element
|
|
7739
7847
|
*/
|
|
7740
7848
|
render() {
|
|
7741
|
-
return (h("div", { key: '
|
|
7849
|
+
return (h("div", { key: '54bad50e0a610aaae267fb34384384a2aa3a2295', class: this.classCollection.join() }, h("header", { key: '8bc4f73112f9de115b8558a7d322398b62983fb7', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
7742
7850
|
[`${this.buttonTabBaseClass}`]: true,
|
|
7743
7851
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
7744
7852
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -7873,7 +7981,7 @@ const MgTooltip = class {
|
|
|
7873
7981
|
// Enable the event listeners
|
|
7874
7982
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
7875
7983
|
// hide when click outside on nextTick to prevent event to trigger after creation
|
|
7876
|
-
|
|
7984
|
+
tt(() => {
|
|
7877
7985
|
this.windows.forEach((localWindow) => {
|
|
7878
7986
|
localWindow.addEventListener('click', this.handleClickOutside, false);
|
|
7879
7987
|
localWindow.addEventListener('keydown', this.handlePressEscape, false);
|
|
@@ -8069,7 +8177,7 @@ const MgTooltip = class {
|
|
|
8069
8177
|
element.setAttribute('aria-describedby', `${[...new Set([...element.getAttribute('aria-describedby').split(' '), this.identifier])].join(' ')}`);
|
|
8070
8178
|
}
|
|
8071
8179
|
};
|
|
8072
|
-
this.identifier =
|
|
8180
|
+
this.identifier = qe('mg-tooltip');
|
|
8073
8181
|
this.message = undefined;
|
|
8074
8182
|
this.placement = 'bottom';
|
|
8075
8183
|
this.display = false;
|