@mgdis/mg-components 6.15.0 → 6.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/events.utils-D5SAtkpQ.js +25 -0
- package/dist/cjs/{index-BGxkpQwi.js → index-T3-qWqFE.js} +2 -2
- package/dist/cjs/{index-iUZvsp-F.js → index-YM1EJx9X.js} +8 -20
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +68 -305
- package/dist/cjs/mg-alert.cjs.entry.js +2 -2
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-input-combobox.cjs.entry.js +78 -140
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +3 -3
- package/dist/cjs/{mg-input.conf-CwjEAih3.js → mg-input.conf-WTsvDfpC.js} +0 -7
- package/dist/cjs/mg-loader.cjs.entry.js +2 -2
- package/dist/cjs/mg-progress.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +0 -6
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +22 -93
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +13 -69
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +54 -136
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -63
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +6 -54
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -142
- package/dist/collection/locales/en/messages.json +3 -8
- package/dist/collection/locales/fr/messages.json +3 -8
- package/dist/components/index2.js +1 -1
- package/dist/components/index3.js +8 -20
- package/dist/components/mg-details.js +97 -1
- package/dist/components/mg-input-checkbox-paginated2.js +1 -2
- package/dist/components/mg-input-checkbox.js +19 -63
- package/dist/components/mg-input-combobox.js +60 -130
- package/dist/components/mg-input-date.js +1 -7
- package/dist/components/mg-input-numeric.js +1 -7
- package/dist/components/mg-input-password.js +2 -8
- package/dist/components/mg-input-radio.js +12 -53
- package/dist/components/mg-input-rich-text-editor.js +1 -7
- package/dist/components/mg-input-select2.js +8 -44
- package/dist/components/mg-input-text2.js +2 -8
- package/dist/components/mg-input-textarea.js +2 -8
- package/dist/components/mg-input-toggle.js +11 -96
- package/dist/components/mg-input2.js +22 -99
- package/dist/components/mg-pagination.js +2 -8
- package/dist/components/mg-panel.js +7 -13
- package/dist/esm/events.utils-yMGqY8YG.js +23 -0
- package/dist/esm/{index-CKB-AnCZ.js → index-Bab8_u8S.js} +8 -20
- package/dist/esm/{index-DhAOnZJn.js → index-JHj_9FSs.js} +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +64 -301
- package/dist/esm/mg-alert.entry.js +2 -2
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-input-combobox.entry.js +59 -121
- package/dist/esm/mg-input-rich-text-editor.entry.js +3 -3
- package/dist/esm/{mg-input.conf-BAUTlb6r.js → mg-input.conf-CNgv8hc5.js} +1 -7
- package/dist/esm/mg-loader.entry.js +2 -2
- package/dist/esm/mg-progress.entry.js +1 -1
- package/dist/mg-components/locales/en/messages.json +3 -8
- package/dist/mg-components/locales/fr/messages.json +3 -8
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-420daa1e.entry.js → p-42a90251.entry.js} +1 -1
- package/dist/mg-components/p-54156253.entry.js +1 -0
- package/dist/mg-components/{p-47e19783.entry.js → p-658f828c.entry.js} +1 -1
- package/dist/mg-components/{p-67af6274.entry.js → p-82455ac7.entry.js} +1 -1
- package/dist/mg-components/p-Bab8_u8S.js +1 -0
- package/dist/mg-components/p-CNgv8hc5.js +1 -0
- package/dist/mg-components/{p-DhAOnZJn.js → p-JHj_9FSs.js} +1 -1
- package/dist/mg-components/p-abbd151c.entry.js +1 -0
- package/dist/mg-components/{p-a0fa44cf.entry.js → p-c85b5d10.entry.js} +1 -1
- package/dist/mg-components/p-yMGqY8YG.js +1 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +0 -13
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +4 -15
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +3 -21
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +2 -16
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -40
- package/dist/types/components.d.ts +7 -63
- package/ide/intellij/web-types.json +10 -136
- package/ide/vscode/html-custom-data.json +6 -104
- package/package.json +20 -20
- package/dist/cjs/mg-input.utils-D-ASK4ua.js +0 -49
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.utils.js +0 -21
- package/dist/components/mg-details2.js +0 -99
- package/dist/components/mg-input.utils.js +0 -24
- package/dist/esm/mg-input.utils-BYI03zSi.js +0 -46
- package/dist/mg-components/p-31856cff.entry.js +0 -1
- package/dist/mg-components/p-698dfc6c.entry.js +0 -1
- package/dist/mg-components/p-BAUTlb6r.js +0 -1
- package/dist/mg-components/p-CKB-AnCZ.js +0 -1
- package/dist/mg-components/p-PuX-pdL4.js +0 -1
- package/dist/types/components/molecules/inputs/mg-input/mg-input.utils.d.ts +0 -8
|
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, i as isValidString, o as dateRegExp, p as dateToString, t as toString } from './index2.js';
|
|
3
3
|
import { l as localeDate, a as localeDatePattern, i as initLocales } from './index3.js';
|
|
4
4
|
import { d as defineCustomElement$5, c as classReadonly, a as classDisabled } from './mg-input2.js';
|
|
5
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
6
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
7
6
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
@@ -425,18 +424,13 @@ function defineCustomElement$1() {
|
|
|
425
424
|
if (typeof customElements === "undefined") {
|
|
426
425
|
return;
|
|
427
426
|
}
|
|
428
|
-
const components = ["mg-input-date", "mg-
|
|
427
|
+
const components = ["mg-input-date", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
429
428
|
components.forEach(tagName => { switch (tagName) {
|
|
430
429
|
case "mg-input-date":
|
|
431
430
|
if (!customElements.get(tagName)) {
|
|
432
431
|
customElements.define(tagName, MgInputDate$1);
|
|
433
432
|
}
|
|
434
433
|
break;
|
|
435
|
-
case "mg-details":
|
|
436
|
-
if (!customElements.get(tagName)) {
|
|
437
|
-
defineCustomElement$7();
|
|
438
|
-
}
|
|
439
|
-
break;
|
|
440
434
|
case "mg-icon":
|
|
441
435
|
if (!customElements.get(tagName)) {
|
|
442
436
|
defineCustomElement$6();
|
|
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, i as isValidString, t as toString } from './index2.js';
|
|
3
3
|
import { b as localeNumber, c as localeUnit, d as localePercent, e as localeCurrency, i as initLocales } from './index3.js';
|
|
4
4
|
import { d as defineCustomElement$5, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
5
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
6
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
7
6
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
@@ -551,18 +550,13 @@ function defineCustomElement$1() {
|
|
|
551
550
|
if (typeof customElements === "undefined") {
|
|
552
551
|
return;
|
|
553
552
|
}
|
|
554
|
-
const components = ["mg-input-numeric", "mg-
|
|
553
|
+
const components = ["mg-input-numeric", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
555
554
|
components.forEach(tagName => { switch (tagName) {
|
|
556
555
|
case "mg-input-numeric":
|
|
557
556
|
if (!customElements.get(tagName)) {
|
|
558
557
|
customElements.define(tagName, MgInputNumeric$1);
|
|
559
558
|
}
|
|
560
559
|
break;
|
|
561
|
-
case "mg-details":
|
|
562
|
-
if (!customElements.get(tagName)) {
|
|
563
|
-
defineCustomElement$7();
|
|
564
|
-
}
|
|
565
|
-
break;
|
|
566
560
|
case "mg-icon":
|
|
567
561
|
if (!customElements.get(tagName)) {
|
|
568
562
|
defineCustomElement$6();
|
|
@@ -2,8 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, i as isValidString } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$5, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index3.js';
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
5
|
+
import { d as defineCustomElement$7 } from './mg-button2.js';
|
|
7
6
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
8
7
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
9
8
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
@@ -301,7 +300,7 @@ function defineCustomElement$1() {
|
|
|
301
300
|
if (typeof customElements === "undefined") {
|
|
302
301
|
return;
|
|
303
302
|
}
|
|
304
|
-
const components = ["mg-input-password", "mg-button", "mg-
|
|
303
|
+
const components = ["mg-input-password", "mg-button", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
305
304
|
components.forEach(tagName => { switch (tagName) {
|
|
306
305
|
case "mg-input-password":
|
|
307
306
|
if (!customElements.get(tagName)) {
|
|
@@ -309,11 +308,6 @@ function defineCustomElement$1() {
|
|
|
309
308
|
}
|
|
310
309
|
break;
|
|
311
310
|
case "mg-button":
|
|
312
|
-
if (!customElements.get(tagName)) {
|
|
313
|
-
defineCustomElement$8();
|
|
314
|
-
}
|
|
315
|
-
break;
|
|
316
|
-
case "mg-details":
|
|
317
311
|
if (!customElements.get(tagName)) {
|
|
318
312
|
defineCustomElement$7();
|
|
319
313
|
}
|
|
@@ -2,14 +2,12 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, d as allItemsAreString, t as toString, i as isValidString } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$5, b as classFieldset, c as classReadonly, a as classDisabled } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index3.js';
|
|
5
|
-
import { d as defineErrorMessage } from './mg-input.utils.js';
|
|
6
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
7
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
8
6
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
9
7
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
10
8
|
import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
|
|
11
9
|
|
|
12
|
-
const mgInputRadioCss = ".mg-c-
|
|
10
|
+
const mgInputRadioCss = ".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);overflow-wrap:anywhere}.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}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}";
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* type Option validation function
|
|
@@ -88,21 +86,11 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
88
86
|
// reset guard
|
|
89
87
|
this.handlerInProgress = undefined;
|
|
90
88
|
};
|
|
91
|
-
/**
|
|
92
|
-
* Test if component has items
|
|
93
|
-
* @returns truthy if component has items
|
|
94
|
-
*/
|
|
95
|
-
this.hasInputValue = () => { var _a; return ((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) > 0; };
|
|
96
|
-
/**
|
|
97
|
-
* Test if component has no value error message displayed
|
|
98
|
-
* @returns truthy if compent display no value error message
|
|
99
|
-
*/
|
|
100
|
-
this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
|
|
101
89
|
/**
|
|
102
90
|
* Check if input is valid
|
|
103
91
|
*/
|
|
104
92
|
this.checkValidity = () => {
|
|
105
|
-
this.setValidity(this.readonly || this.disabled ||
|
|
93
|
+
this.setValidity(this.readonly || this.disabled || this.getInvalidElement() === undefined);
|
|
106
94
|
};
|
|
107
95
|
/**
|
|
108
96
|
* Set input error message
|
|
@@ -116,22 +104,11 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
116
104
|
if (errorMessage !== undefined) {
|
|
117
105
|
this.errorMessage = errorMessage;
|
|
118
106
|
}
|
|
119
|
-
else if (!this.hasInputValue()) {
|
|
120
|
-
this.errorMessage = this.messages.errors.noValue;
|
|
121
|
-
}
|
|
122
107
|
else if (invalidElement.validity.valueMissing) {
|
|
123
108
|
this.errorMessage = this.messages.errors.required;
|
|
124
109
|
}
|
|
125
110
|
}
|
|
126
111
|
};
|
|
127
|
-
/**
|
|
128
|
-
* Reset error message
|
|
129
|
-
*/
|
|
130
|
-
this.resetErrorMessage = () => {
|
|
131
|
-
this.checkValidity();
|
|
132
|
-
this.errorMessage = undefined;
|
|
133
|
-
this.hasDisplayedError = false;
|
|
134
|
-
};
|
|
135
112
|
/**
|
|
136
113
|
* get invalid element
|
|
137
114
|
* @returns element
|
|
@@ -153,29 +130,17 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
153
130
|
this.valueChange.emit(newValue);
|
|
154
131
|
}
|
|
155
132
|
validateItems(newValue) {
|
|
156
|
-
if ([undefined, null].includes(newValue) || (Array.isArray(newValue) && newValue.length === 0)) {
|
|
157
|
-
this.options = [];
|
|
158
|
-
this.displayError();
|
|
159
|
-
}
|
|
160
133
|
// Validate if items have required min length
|
|
161
|
-
|
|
134
|
+
if (typeof newValue === 'object' && newValue.length < 2) {
|
|
162
135
|
throw new Error(`<mg-input-radio> prop "items" require at least 2 items. Passed value: ${toString(newValue)}.`);
|
|
163
136
|
}
|
|
164
137
|
// String array
|
|
165
138
|
else if (allItemsAreString(newValue)) {
|
|
166
139
|
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
167
|
-
// force to reset error when noValueError is displaied
|
|
168
|
-
if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
|
|
169
|
-
this.resetErrorMessage();
|
|
170
|
-
}
|
|
171
140
|
}
|
|
172
141
|
// Object array
|
|
173
|
-
else if (
|
|
142
|
+
else if (newValue && newValue.every(item => isOption(item))) {
|
|
174
143
|
this.options = newValue;
|
|
175
|
-
// force to reset error when noValueError is displaied
|
|
176
|
-
if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
|
|
177
|
-
this.resetErrorMessage();
|
|
178
|
-
}
|
|
179
144
|
}
|
|
180
145
|
else {
|
|
181
146
|
throw new Error(`<mg-input-radio> prop "items" is required and all items must be the same type, string or RadioOption. Passed value: ${toString(newValue)}.`);
|
|
@@ -271,7 +236,9 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
271
236
|
// - Keep everything in sync both inside and outside the component
|
|
272
237
|
return new Promise(resolve => {
|
|
273
238
|
requestAnimationFrame(() => {
|
|
274
|
-
this.
|
|
239
|
+
this.checkValidity();
|
|
240
|
+
this.errorMessage = undefined;
|
|
241
|
+
this.hasDisplayedError = false;
|
|
275
242
|
resolve();
|
|
276
243
|
});
|
|
277
244
|
});
|
|
@@ -317,12 +284,10 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
317
284
|
* @returns HTML Element
|
|
318
285
|
*/
|
|
319
286
|
render() {
|
|
320
|
-
return (h("mg-input", { key: '
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
this.inputs[index] = el;
|
|
325
|
-
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
|
|
287
|
+
return (h("mg-input", { key: '048aa732e7f8593701c9397e571b97584bc5e37b', label: this.label, identifier: this.identifier, class: this.classCollection.join(), 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) => {
|
|
288
|
+
if (el !== null)
|
|
289
|
+
this.inputs[index] = el;
|
|
290
|
+
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
|
|
326
291
|
}
|
|
327
292
|
get element() { return this; }
|
|
328
293
|
static get watchers() { return {
|
|
@@ -349,7 +314,6 @@ const MgInputRadio$1 = /*@__PURE__*/ proxyCustomElement(class MgInputRadio exten
|
|
|
349
314
|
"tooltip": [1],
|
|
350
315
|
"tooltipPosition": [1, "tooltip-position"],
|
|
351
316
|
"helpText": [1, "help-text"],
|
|
352
|
-
"noValueErrorDetail": [1, "no-value-error-detail"],
|
|
353
317
|
"valid": [1028],
|
|
354
318
|
"invalid": [1028],
|
|
355
319
|
"classCollection": [32],
|
|
@@ -372,18 +336,13 @@ function defineCustomElement$1() {
|
|
|
372
336
|
if (typeof customElements === "undefined") {
|
|
373
337
|
return;
|
|
374
338
|
}
|
|
375
|
-
const components = ["mg-input-radio", "mg-
|
|
339
|
+
const components = ["mg-input-radio", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
376
340
|
components.forEach(tagName => { switch (tagName) {
|
|
377
341
|
case "mg-input-radio":
|
|
378
342
|
if (!customElements.get(tagName)) {
|
|
379
343
|
customElements.define(tagName, MgInputRadio$1);
|
|
380
344
|
}
|
|
381
345
|
break;
|
|
382
|
-
case "mg-details":
|
|
383
|
-
if (!customElements.get(tagName)) {
|
|
384
|
-
defineCustomElement$7();
|
|
385
|
-
}
|
|
386
|
-
break;
|
|
387
346
|
case "mg-icon":
|
|
388
347
|
if (!customElements.get(tagName)) {
|
|
389
348
|
defineCustomElement$6();
|
|
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement as HTMLElement$1, createEvent, h } from
|
|
|
2
2
|
import { i as isValidString, C as ClassList, t as toString } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$5, c as classReadonly, a as classDisabled } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index3.js';
|
|
5
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
6
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
7
6
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
@@ -16745,18 +16744,13 @@ function defineCustomElement$1() {
|
|
|
16745
16744
|
if (typeof customElements === "undefined") {
|
|
16746
16745
|
return;
|
|
16747
16746
|
}
|
|
16748
|
-
const components = ["mg-input-rich-text-editor", "mg-
|
|
16747
|
+
const components = ["mg-input-rich-text-editor", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
16749
16748
|
components.forEach(tagName => { switch (tagName) {
|
|
16750
16749
|
case "mg-input-rich-text-editor":
|
|
16751
16750
|
if (!customElements.get(tagName)) {
|
|
16752
16751
|
customElements.define(tagName, MgInputRichTextEditor$1);
|
|
16753
16752
|
}
|
|
16754
16753
|
break;
|
|
16755
|
-
case "mg-details":
|
|
16756
|
-
if (!customElements.get(tagName)) {
|
|
16757
|
-
defineCustomElement$7();
|
|
16758
|
-
}
|
|
16759
|
-
break;
|
|
16760
16754
|
case "mg-icon":
|
|
16761
16755
|
if (!customElements.get(tagName)) {
|
|
16762
16756
|
defineCustomElement$6();
|
|
@@ -2,14 +2,12 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, d as allItemsAreString, t as toString, i as isValidString } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$4, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index3.js';
|
|
5
|
-
import { d as defineErrorMessage } from './mg-input.utils.js';
|
|
6
|
-
import { d as defineCustomElement$6 } from './mg-details2.js';
|
|
7
5
|
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
8
6
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
9
7
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
10
8
|
import { d as defineCustomElement$1 } from './mg-tooltip-content2.js';
|
|
11
9
|
|
|
12
|
-
const mgInputSelectCss = ".mg-c-
|
|
10
|
+
const mgInputSelectCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input__box{padding-top:0;padding-right:var(--mg-b-size-8);padding-bottom:0}@media screen and (max-width: 767px){.mg-c-input__box{width:100%}}";
|
|
13
11
|
|
|
14
12
|
/**
|
|
15
13
|
* Check if item is a well configured option
|
|
@@ -147,16 +145,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
147
145
|
* @returns truthy if input.value is an item
|
|
148
146
|
*/
|
|
149
147
|
this.isInputValue = (item) => { var _a; return item.title === ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value); };
|
|
150
|
-
/**
|
|
151
|
-
* Test if component has items
|
|
152
|
-
* @returns truthy if component has items
|
|
153
|
-
*/
|
|
154
|
-
this.hasInputValue = () => { var _a; return ((_a = this.items) === null || _a === void 0 ? void 0 : _a.length) > 0; };
|
|
155
|
-
/**
|
|
156
|
-
* Test if component has no value error message displayed
|
|
157
|
-
* @returns truthy if compent display no value error message
|
|
158
|
-
*/
|
|
159
|
-
this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
|
|
160
148
|
/**
|
|
161
149
|
* Handle blur event
|
|
162
150
|
*/
|
|
@@ -176,7 +164,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
176
164
|
* Check if input is valid
|
|
177
165
|
*/
|
|
178
166
|
this.checkValidity = () => {
|
|
179
|
-
this.setValidity(!this.isDisabledValue() && (this.readonly || this.disabled ||
|
|
167
|
+
this.setValidity(!this.isDisabledValue() && (this.readonly || this.disabled || this.input.checkValidity()));
|
|
180
168
|
};
|
|
181
169
|
/**
|
|
182
170
|
* Set input error message
|
|
@@ -189,22 +177,11 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
189
177
|
if (errorMessage !== undefined) {
|
|
190
178
|
this.errorMessage = errorMessage;
|
|
191
179
|
}
|
|
192
|
-
else if (!this.hasInputValue()) {
|
|
193
|
-
this.errorMessage = this.messages.errors.noValue;
|
|
194
|
-
}
|
|
195
180
|
else if (this.input.validity.valueMissing) {
|
|
196
181
|
this.errorMessage = this.messages.errors.required;
|
|
197
182
|
}
|
|
198
183
|
}
|
|
199
184
|
};
|
|
200
|
-
/**
|
|
201
|
-
* Reset error message
|
|
202
|
-
*/
|
|
203
|
-
this.resetErrorMessage = () => {
|
|
204
|
-
this.checkValidity();
|
|
205
|
-
this.errorMessage = undefined;
|
|
206
|
-
this.hasDisplayedError = false;
|
|
207
|
-
};
|
|
208
185
|
/**
|
|
209
186
|
* Render option
|
|
210
187
|
* @param option - to render
|
|
@@ -222,11 +199,9 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
222
199
|
this.valueChange.emit(newValue);
|
|
223
200
|
}
|
|
224
201
|
validateItems(newValue) {
|
|
225
|
-
let resetMessage = false;
|
|
226
202
|
// Empty options
|
|
227
|
-
if (
|
|
203
|
+
if (newValue.length === 0) {
|
|
228
204
|
this.options = [];
|
|
229
|
-
this.displayError();
|
|
230
205
|
}
|
|
231
206
|
// String array
|
|
232
207
|
else if (allItemsAreString(newValue)) {
|
|
@@ -234,8 +209,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
234
209
|
this.valueExist = newValue.includes(this.value);
|
|
235
210
|
}
|
|
236
211
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
237
|
-
// force to reset error when noValueError is displaied
|
|
238
|
-
resetMessage = this.invalid && this.hasNoValueErrorMessageDisplay();
|
|
239
212
|
}
|
|
240
213
|
// Object array
|
|
241
214
|
else if (allItemsAreOptions(newValue)) {
|
|
@@ -248,15 +221,10 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
248
221
|
else {
|
|
249
222
|
this.options = newValue;
|
|
250
223
|
}
|
|
251
|
-
// force to reset error when noValueError is displaied
|
|
252
|
-
resetMessage = this.invalid && this.hasNoValueErrorMessageDisplay();
|
|
253
224
|
}
|
|
254
225
|
else {
|
|
255
226
|
throw new Error(`<mg-input-select> prop "items" is required, can be an empty Array or all items must be the same type: string or Option. Passed value: ${toString(newValue)}.`);
|
|
256
227
|
}
|
|
257
|
-
if (resetMessage) {
|
|
258
|
-
this.resetErrorMessage();
|
|
259
|
-
}
|
|
260
228
|
}
|
|
261
229
|
watchReadonly(newValue) {
|
|
262
230
|
if (newValue)
|
|
@@ -350,7 +318,9 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
350
318
|
// - Keep everything in sync both inside and outside the component
|
|
351
319
|
return new Promise(resolve => {
|
|
352
320
|
requestAnimationFrame(() => {
|
|
353
|
-
this.
|
|
321
|
+
this.checkValidity();
|
|
322
|
+
this.errorMessage = undefined;
|
|
323
|
+
this.hasDisplayedError = false;
|
|
354
324
|
resolve();
|
|
355
325
|
});
|
|
356
326
|
});
|
|
@@ -402,7 +372,7 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
402
372
|
*/
|
|
403
373
|
render() {
|
|
404
374
|
const readonlyValue = this.getReadonlyValue();
|
|
405
|
-
return (h("mg-input", { key: '
|
|
375
|
+
return (h("mg-input", { key: '1394827503d3f2dd71efc6efa389ac707573d2ec', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue === null ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, 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) => {
|
|
406
376
|
if (el !== null)
|
|
407
377
|
this.input = el;
|
|
408
378
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -436,7 +406,6 @@ const MgInputSelect = /*@__PURE__*/ proxyCustomElement(class MgInputSelect exten
|
|
|
436
406
|
"tooltip": [1],
|
|
437
407
|
"tooltipPosition": [1, "tooltip-position"],
|
|
438
408
|
"helpText": [1, "help-text"],
|
|
439
|
-
"noValueErrorDetail": [1, "no-value-error-detail"],
|
|
440
409
|
"valid": [1028],
|
|
441
410
|
"invalid": [1028],
|
|
442
411
|
"classCollection": [32],
|
|
@@ -459,18 +428,13 @@ function defineCustomElement() {
|
|
|
459
428
|
if (typeof customElements === "undefined") {
|
|
460
429
|
return;
|
|
461
430
|
}
|
|
462
|
-
const components = ["mg-input-select", "mg-
|
|
431
|
+
const components = ["mg-input-select", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
463
432
|
components.forEach(tagName => { switch (tagName) {
|
|
464
433
|
case "mg-input-select":
|
|
465
434
|
if (!customElements.get(tagName)) {
|
|
466
435
|
customElements.define(tagName, MgInputSelect);
|
|
467
436
|
}
|
|
468
437
|
break;
|
|
469
|
-
case "mg-details":
|
|
470
|
-
if (!customElements.get(tagName)) {
|
|
471
|
-
defineCustomElement$6();
|
|
472
|
-
}
|
|
473
|
-
break;
|
|
474
438
|
case "mg-icon":
|
|
475
439
|
if (!customElements.get(tagName)) {
|
|
476
440
|
defineCustomElement$5();
|
|
@@ -2,8 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, i as isValidString, d as allItemsAreString, t as toString } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$4, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index3.js';
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$6 } from './mg-details2.js';
|
|
5
|
+
import { d as defineCustomElement$6 } from './mg-character-left2.js';
|
|
7
6
|
import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
9
8
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
@@ -457,7 +456,7 @@ function defineCustomElement() {
|
|
|
457
456
|
if (typeof customElements === "undefined") {
|
|
458
457
|
return;
|
|
459
458
|
}
|
|
460
|
-
const components = ["mg-input-text", "mg-character-left", "mg-
|
|
459
|
+
const components = ["mg-input-text", "mg-character-left", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
461
460
|
components.forEach(tagName => { switch (tagName) {
|
|
462
461
|
case "mg-input-text":
|
|
463
462
|
if (!customElements.get(tagName)) {
|
|
@@ -465,11 +464,6 @@ function defineCustomElement() {
|
|
|
465
464
|
}
|
|
466
465
|
break;
|
|
467
466
|
case "mg-character-left":
|
|
468
|
-
if (!customElements.get(tagName)) {
|
|
469
|
-
defineCustomElement$7();
|
|
470
|
-
}
|
|
471
|
-
break;
|
|
472
|
-
case "mg-details":
|
|
473
467
|
if (!customElements.get(tagName)) {
|
|
474
468
|
defineCustomElement$6();
|
|
475
469
|
}
|
|
@@ -2,8 +2,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, i as isValidString, t as toString } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$5, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index3.js';
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
5
|
+
import { d as defineCustomElement$7 } from './mg-character-left2.js';
|
|
7
6
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
8
7
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
9
8
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
@@ -369,7 +368,7 @@ function defineCustomElement$1() {
|
|
|
369
368
|
if (typeof customElements === "undefined") {
|
|
370
369
|
return;
|
|
371
370
|
}
|
|
372
|
-
const components = ["mg-input-textarea", "mg-character-left", "mg-
|
|
371
|
+
const components = ["mg-input-textarea", "mg-character-left", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
373
372
|
components.forEach(tagName => { switch (tagName) {
|
|
374
373
|
case "mg-input-textarea":
|
|
375
374
|
if (!customElements.get(tagName)) {
|
|
@@ -377,11 +376,6 @@ function defineCustomElement$1() {
|
|
|
377
376
|
}
|
|
378
377
|
break;
|
|
379
378
|
case "mg-character-left":
|
|
380
|
-
if (!customElements.get(tagName)) {
|
|
381
|
-
defineCustomElement$8();
|
|
382
|
-
}
|
|
383
|
-
break;
|
|
384
|
-
case "mg-details":
|
|
385
379
|
if (!customElements.get(tagName)) {
|
|
386
380
|
defineCustomElement$7();
|
|
387
381
|
}
|