@mgdis/mg-components 5.10.0 → 5.11.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-9e1091ab.js → index-03d2557d.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_31.cjs.entry.js +444 -455
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-item-more.cjs.entry.js +20 -29
- package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-05ec32a3.js} +30 -16
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
- package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
- package/dist/collection/components/atoms/mg-card/mg-card.css +2 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +20 -25
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +18 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +126 -19
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +16 -16
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
- package/dist/collection/locales/en/messages.json +7 -0
- package/dist/collection/locales/fr/messages.json +7 -0
- package/dist/collection/locales/index.js +2 -2
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/collection/utils/behaviors.utils.js +16 -22
- package/dist/collection/utils/components.utils.js +21 -23
- package/dist/collection/utils/locale.utils.js +14 -14
- package/dist/collection/utils/unit.test.utils.js +7 -10
- package/dist/components/MgInput.js +30 -18
- package/dist/components/components.utils.js +21 -23
- package/dist/components/index2.js +30 -16
- package/dist/components/mg-action-more.js +9 -13
- package/dist/components/mg-badge2.js +8 -9
- package/dist/components/mg-button2.js +16 -20
- package/dist/components/mg-card2.js +9 -11
- package/dist/components/mg-character-left2.js +1 -2
- package/dist/components/mg-details.js +1 -3
- package/dist/components/mg-divider.js +1 -1
- package/dist/components/mg-form.js +7 -15
- package/dist/components/mg-icon2.js +17 -19
- package/dist/components/mg-illustrated-message.js +1 -2
- package/dist/components/mg-input-checkbox.js +126 -21
- package/dist/components/mg-input-date.js +7 -9
- package/dist/components/mg-input-numeric.js +14 -19
- package/dist/components/mg-input-password.js +6 -7
- package/dist/components/mg-input-radio.js +10 -15
- package/dist/components/mg-input-select2.js +21 -29
- package/dist/components/mg-input-text2.js +15 -24
- package/dist/components/mg-input-textarea.js +13 -14
- package/dist/components/mg-input-title2.js +1 -2
- package/dist/components/mg-input-toggle.js +17 -20
- package/dist/components/mg-item-more.js +18 -27
- package/dist/components/mg-menu-item2.js +17 -26
- package/dist/components/mg-menu2.js +9 -16
- package/dist/components/mg-message.js +12 -15
- package/dist/components/mg-modal.js +8 -12
- package/dist/components/mg-pagination.js +11 -13
- package/dist/components/mg-panel.js +7 -16
- package/dist/components/mg-popover2.js +17 -17
- package/dist/components/mg-skip-links.js +2 -4
- package/dist/components/mg-tabs.js +20 -24
- package/dist/components/mg-tag.js +11 -13
- package/dist/components/mg-tooltip2.js +20 -25
- package/dist/esm/{index-3249671d.js → index-407d5211.js} +3 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_31.entry.js +444 -455
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-item-more.entry.js +20 -29
- package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-c8aa56ce.js} +30 -16
- package/dist/mg-components/locales/en/messages.json +7 -0
- package/dist/mg-components/locales/fr/messages.json +7 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-3bf533f7.js +2 -0
- package/dist/mg-components/p-51c2def3.entry.js +1 -0
- package/dist/mg-components/p-b14be68b.js +1 -0
- package/dist/mg-components/{p-a56a3157.entry.js → p-d3ed97d3.entry.js} +1 -1
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -3
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +15 -21
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +40 -7
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -13
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +7 -9
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
- package/dist/types/components.d.ts +31 -35
- package/dist/types/locales/index.d.ts +16 -2
- package/dist/types/utils/behaviors.utils.d.ts +14 -20
- package/dist/types/utils/components.utils.d.ts +18 -20
- package/dist/types/utils/locale.utils.d.ts +14 -14
- package/dist/types/utils/unit.test.utils.d.ts +11 -17
- package/package.json +4 -4
- package/dist/mg-components/p-73156ac9.js +0 -1
- package/dist/mg-components/p-8fbc0d87.js +0 -2
- package/dist/mg-components/p-eb32bb18.entry.js +0 -1
|
@@ -7,8 +7,8 @@ import { ClassList, allItemsAreString } from '../../../../utils/components.utils
|
|
|
7
7
|
import { initLocales } from '../../../../locales';
|
|
8
8
|
/**
|
|
9
9
|
* type Option validation function
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
10
|
+
* @param option - radio option
|
|
11
|
+
* @returns radio option type is valid
|
|
12
12
|
*/
|
|
13
13
|
const isOption = (option) => typeof option === 'object' && typeof option.title === 'string' && option.value !== undefined;
|
|
14
14
|
export class MgInputRadio {
|
|
@@ -22,8 +22,7 @@ export class MgInputRadio {
|
|
|
22
22
|
this.hasDisplayedError = false;
|
|
23
23
|
/**
|
|
24
24
|
* Handle input event
|
|
25
|
-
* @param
|
|
26
|
-
* @returns {void}
|
|
25
|
+
* @param event - input event
|
|
27
26
|
*/
|
|
28
27
|
this.handleInput = (event) => {
|
|
29
28
|
this.checkValidity();
|
|
@@ -31,7 +30,6 @@ export class MgInputRadio {
|
|
|
31
30
|
};
|
|
32
31
|
/**
|
|
33
32
|
* Handle blur event
|
|
34
|
-
* @returns {void}
|
|
35
33
|
*/
|
|
36
34
|
this.handleBlur = () => {
|
|
37
35
|
this.checkValidity();
|
|
@@ -39,7 +37,6 @@ export class MgInputRadio {
|
|
|
39
37
|
};
|
|
40
38
|
/**
|
|
41
39
|
* Check if input is valid
|
|
42
|
-
* @returns {void}
|
|
43
40
|
*/
|
|
44
41
|
this.checkValidity = () => {
|
|
45
42
|
this.valid = this.readonly || this.disabled || this.getInvalidElement() === undefined;
|
|
@@ -49,7 +46,6 @@ export class MgInputRadio {
|
|
|
49
46
|
};
|
|
50
47
|
/**
|
|
51
48
|
* Set input error message
|
|
52
|
-
* @returns {void}
|
|
53
49
|
*/
|
|
54
50
|
this.setErrorMessage = () => {
|
|
55
51
|
const invalidElement = this.getInvalidElement();
|
|
@@ -61,7 +57,7 @@ export class MgInputRadio {
|
|
|
61
57
|
};
|
|
62
58
|
/**
|
|
63
59
|
* get invalid element
|
|
64
|
-
* @returns
|
|
60
|
+
* @returns element
|
|
65
61
|
*/
|
|
66
62
|
this.getInvalidElement = () => this.inputs.find((input) => !input.disabled && !input.readOnly && !input.checkValidity());
|
|
67
63
|
this.value = undefined;
|
|
@@ -79,7 +75,7 @@ export class MgInputRadio {
|
|
|
79
75
|
this.helpText = undefined;
|
|
80
76
|
this.valid = undefined;
|
|
81
77
|
this.invalid = undefined;
|
|
82
|
-
this.
|
|
78
|
+
this.classCollection = new ClassList(['mg-input--radio']);
|
|
83
79
|
this.errorMessage = undefined;
|
|
84
80
|
this.options = undefined;
|
|
85
81
|
}
|
|
@@ -115,7 +111,6 @@ export class MgInputRadio {
|
|
|
115
111
|
}
|
|
116
112
|
/**
|
|
117
113
|
* Public method to display errors
|
|
118
|
-
* @returns {Promise<void>}
|
|
119
114
|
*/
|
|
120
115
|
async displayError() {
|
|
121
116
|
this.checkValidity();
|
|
@@ -127,7 +122,7 @@ export class MgInputRadio {
|
|
|
127
122
|
*************/
|
|
128
123
|
/**
|
|
129
124
|
* Check if component props are well configured on init
|
|
130
|
-
* @returns
|
|
125
|
+
* @returns timeout
|
|
131
126
|
*/
|
|
132
127
|
componentWillLoad() {
|
|
133
128
|
// Get locales
|
|
@@ -143,10 +138,10 @@ export class MgInputRadio {
|
|
|
143
138
|
}
|
|
144
139
|
/**
|
|
145
140
|
* Render
|
|
146
|
-
* @returns
|
|
141
|
+
* @returns HTML Element
|
|
147
142
|
*/
|
|
148
143
|
render() {
|
|
149
|
-
return (h(MgInput, { identifier: this.identifier,
|
|
144
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, disabled: this.disabled, readonly: this.readonly, mgWidth: undefined, value: this.value, readonlyValue: this.value, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-input__input-group': true, 'mg-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 => {
|
|
150
145
|
if (el !== null)
|
|
151
146
|
this.inputs[index] = el;
|
|
152
147
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
|
|
@@ -434,7 +429,7 @@ export class MgInputRadio {
|
|
|
434
429
|
}
|
|
435
430
|
static get states() {
|
|
436
431
|
return {
|
|
437
|
-
"
|
|
432
|
+
"classCollection": {},
|
|
438
433
|
"errorMessage": {},
|
|
439
434
|
"options": {}
|
|
440
435
|
};
|
|
@@ -487,10 +482,7 @@ export class MgInputRadio {
|
|
|
487
482
|
},
|
|
488
483
|
"docs": {
|
|
489
484
|
"text": "Public method to display errors",
|
|
490
|
-
"tags": [
|
|
491
|
-
"name": "returns",
|
|
492
|
-
"text": undefined
|
|
493
|
-
}]
|
|
485
|
+
"tags": []
|
|
494
486
|
}
|
|
495
487
|
}
|
|
496
488
|
};
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
85
85
|
margin-top: 0.5rem;
|
|
86
86
|
}
|
|
87
|
-
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle, .mg-input.mg-input--checkbox-multi-disabled .mg-input__input strong {
|
|
88
88
|
opacity: var(--mg-disabled-opacity);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -6,31 +6,27 @@ import { ClassList, allItemsAreString } from '../../../../utils/components.utils
|
|
|
6
6
|
import { initLocales } from '../../../../locales';
|
|
7
7
|
/**
|
|
8
8
|
* Check if item is a well configured option
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
9
|
+
* @param option - select option
|
|
10
|
+
* @returns select option type is valid
|
|
11
11
|
*/
|
|
12
12
|
const isOption = (option) => typeof option === 'object' && typeof option.title === 'string';
|
|
13
13
|
/**
|
|
14
14
|
* Check if items[] is SelectOption
|
|
15
|
-
* @param
|
|
16
|
-
* @returns
|
|
15
|
+
* @param items - select option
|
|
16
|
+
* @returns select option array type is valid
|
|
17
17
|
*/
|
|
18
18
|
const allItemsAreOptions = (items) => Array.isArray(items) && items.every(item => isOption(item));
|
|
19
19
|
/**
|
|
20
20
|
* Check if item is a well configured optgroup
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
21
|
+
* @param optgroup - select option
|
|
22
|
+
* @returns select optgroup type is valid
|
|
23
23
|
*/
|
|
24
24
|
const isOptGroup = (optgroup) => typeof optgroup === 'object' && typeof optgroup.group === 'string' && allItemsAreOptions(optgroup.options);
|
|
25
25
|
/**
|
|
26
26
|
* Group options
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @
|
|
30
|
-
* @param {string} item.title item title
|
|
31
|
-
* @param {unknown} item.value item value
|
|
32
|
-
* @param {boolean} item.disabled is item disabled
|
|
33
|
-
* @returns {(SelectOption | OptGroup)[]} grouped options
|
|
27
|
+
* @param acc - reduce accumulator
|
|
28
|
+
* @param item - item to add
|
|
29
|
+
* @returns grouped options
|
|
34
30
|
*/
|
|
35
31
|
const groupOptions = (acc, { group, title, value, disabled }) => {
|
|
36
32
|
if (group !== undefined) {
|
|
@@ -56,7 +52,6 @@ export class MgInputSelect {
|
|
|
56
52
|
this.hasDisplayedError = false;
|
|
57
53
|
/**
|
|
58
54
|
* Handle input event
|
|
59
|
-
* @returns {void}
|
|
60
55
|
*/
|
|
61
56
|
this.handleInput = () => {
|
|
62
57
|
this.updateValue();
|
|
@@ -65,14 +60,13 @@ export class MgInputSelect {
|
|
|
65
60
|
};
|
|
66
61
|
/**
|
|
67
62
|
* Method to compare item.title with input.value
|
|
68
|
-
* @param
|
|
69
|
-
* @returns
|
|
63
|
+
* @param item - item to compare with
|
|
64
|
+
* @returns truthy if input.value is an item
|
|
70
65
|
*/
|
|
71
66
|
this.isInputValue = (item) => { var _a; return item.title === ((_a = this.input) === null || _a === void 0 ? void 0 : _a.value); };
|
|
72
67
|
/**
|
|
73
68
|
* value props setter
|
|
74
|
-
* @param
|
|
75
|
-
* @returns {void}
|
|
69
|
+
* @param newValue - value to update with
|
|
76
70
|
*/
|
|
77
71
|
this.setValue = (newValue) => {
|
|
78
72
|
this.checkValidity();
|
|
@@ -80,7 +74,6 @@ export class MgInputSelect {
|
|
|
80
74
|
};
|
|
81
75
|
/**
|
|
82
76
|
* Update value from input.value
|
|
83
|
-
* @returns {void}
|
|
84
77
|
*/
|
|
85
78
|
this.updateValue = () => {
|
|
86
79
|
if (this.input.value === '') {
|
|
@@ -106,7 +99,7 @@ export class MgInputSelect {
|
|
|
106
99
|
};
|
|
107
100
|
/**
|
|
108
101
|
* Input value is disabled
|
|
109
|
-
* @returns
|
|
102
|
+
* @returns truthy if input value is disabled
|
|
110
103
|
*/
|
|
111
104
|
this.isDisabledValue = () => { var _a; return allItemsAreOptions(this.options) && ((_a = this.options.find(this.isInputValue)) === null || _a === void 0 ? void 0 : _a.disabled) === true; };
|
|
112
105
|
/**
|
|
@@ -131,8 +124,8 @@ export class MgInputSelect {
|
|
|
131
124
|
};
|
|
132
125
|
/**
|
|
133
126
|
* Render option
|
|
134
|
-
* @param
|
|
135
|
-
* @returns
|
|
127
|
+
* @param option - to render
|
|
128
|
+
* @returns render option
|
|
136
129
|
*/
|
|
137
130
|
this.renderOption = (option) => (h("option", { key: option.title, value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title));
|
|
138
131
|
this.value = undefined;
|
|
@@ -153,7 +146,7 @@ export class MgInputSelect {
|
|
|
153
146
|
this.helpText = undefined;
|
|
154
147
|
this.valid = undefined;
|
|
155
148
|
this.invalid = undefined;
|
|
156
|
-
this.
|
|
149
|
+
this.classCollection = new ClassList(['mg-input--select']);
|
|
157
150
|
this.errorMessage = undefined;
|
|
158
151
|
this.options = undefined;
|
|
159
152
|
this.valueExist = undefined;
|
|
@@ -211,7 +204,6 @@ export class MgInputSelect {
|
|
|
211
204
|
}
|
|
212
205
|
/**
|
|
213
206
|
* Public method to display errors
|
|
214
|
-
* @returns {Promise<void>}
|
|
215
207
|
*/
|
|
216
208
|
async displayError() {
|
|
217
209
|
this.checkValidity();
|
|
@@ -223,7 +215,7 @@ export class MgInputSelect {
|
|
|
223
215
|
*************/
|
|
224
216
|
/**
|
|
225
217
|
* Check if component props are well configured on init
|
|
226
|
-
* @returns
|
|
218
|
+
* @returns timeout
|
|
227
219
|
*/
|
|
228
220
|
componentWillLoad() {
|
|
229
221
|
// Get locales
|
|
@@ -244,10 +236,10 @@ export class MgInputSelect {
|
|
|
244
236
|
}
|
|
245
237
|
/**
|
|
246
238
|
* Render
|
|
247
|
-
* @returns
|
|
239
|
+
* @returns HTML Element
|
|
248
240
|
*/
|
|
249
241
|
render() {
|
|
250
|
-
return (h(MgInput, { identifier: this.identifier,
|
|
242
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: undefined, readonlyValue: this.readonlyValue, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("select", { class: "mg-input__box", id: this.identifier, name: this.name, title: this.placeholder, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
251
243
|
if (el !== null)
|
|
252
244
|
this.input = el;
|
|
253
245
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
@@ -592,7 +584,7 @@ export class MgInputSelect {
|
|
|
592
584
|
}
|
|
593
585
|
static get states() {
|
|
594
586
|
return {
|
|
595
|
-
"
|
|
587
|
+
"classCollection": {},
|
|
596
588
|
"errorMessage": {},
|
|
597
589
|
"options": {},
|
|
598
590
|
"valueExist": {},
|
|
@@ -651,10 +643,7 @@ export class MgInputSelect {
|
|
|
651
643
|
},
|
|
652
644
|
"docs": {
|
|
653
645
|
"text": "Public method to display errors",
|
|
654
|
-
"tags": [
|
|
655
|
-
"name": "returns",
|
|
656
|
-
"text": undefined
|
|
657
|
-
}]
|
|
646
|
+
"tags": []
|
|
658
647
|
}
|
|
659
648
|
}
|
|
660
649
|
};
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
85
85
|
margin-top: 0.5rem;
|
|
86
86
|
}
|
|
87
|
-
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle, .mg-input.mg-input--checkbox-multi-disabled .mg-input__input strong {
|
|
88
88
|
opacity: var(--mg-disabled-opacity);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -15,7 +15,6 @@ export class MgInputText {
|
|
|
15
15
|
this.hasDisplayedError = false;
|
|
16
16
|
/**
|
|
17
17
|
* Handle input event
|
|
18
|
-
* @returns {void}
|
|
19
18
|
*/
|
|
20
19
|
this.handleInput = () => {
|
|
21
20
|
this.checkValidity();
|
|
@@ -26,26 +25,23 @@ export class MgInputText {
|
|
|
26
25
|
};
|
|
27
26
|
/**
|
|
28
27
|
* Handle focus event
|
|
29
|
-
* @returns {void}
|
|
30
28
|
*/
|
|
31
29
|
this.handleFocus = () => {
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
30
|
+
this.classCollection.add(this.classFocus);
|
|
31
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
34
32
|
};
|
|
35
33
|
/**
|
|
36
34
|
* Handle blur event
|
|
37
|
-
* @returns {void}
|
|
38
35
|
*/
|
|
39
36
|
this.handleBlur = () => {
|
|
40
37
|
// Manage focus
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
38
|
+
this.classCollection.delete(this.classFocus);
|
|
39
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
43
40
|
// Display Error
|
|
44
41
|
this.displayError();
|
|
45
42
|
};
|
|
46
43
|
/**
|
|
47
44
|
* Check if input is valid
|
|
48
|
-
* @returns {void}
|
|
49
45
|
*/
|
|
50
46
|
this.checkValidity = () => {
|
|
51
47
|
var _a;
|
|
@@ -56,7 +52,6 @@ export class MgInputText {
|
|
|
56
52
|
};
|
|
57
53
|
/**
|
|
58
54
|
* Set input error message
|
|
59
|
-
* @returns {void}
|
|
60
55
|
*/
|
|
61
56
|
this.setErrorMessage = () => {
|
|
62
57
|
// Set error message
|
|
@@ -72,7 +67,6 @@ export class MgInputText {
|
|
|
72
67
|
};
|
|
73
68
|
/**
|
|
74
69
|
* Validate pattern configuration
|
|
75
|
-
* @returns {void}
|
|
76
70
|
*/
|
|
77
71
|
this.validatePattern = () => {
|
|
78
72
|
if (this.pattern !== undefined &&
|
|
@@ -84,16 +78,15 @@ export class MgInputText {
|
|
|
84
78
|
};
|
|
85
79
|
/**
|
|
86
80
|
* Validate append slot
|
|
87
|
-
* @returns {void}
|
|
88
81
|
*/
|
|
89
82
|
this.validateAppendSlot = () => {
|
|
90
83
|
const slotAppendInput = Array.from(this.element.querySelectorAll('[slot="append-input"]'));
|
|
91
84
|
if (slotAppendInput.length === 1) {
|
|
92
|
-
this.
|
|
85
|
+
this.classCollection.add(slotAppendInput[0].nodeName === 'MG-BUTTON' ? this.classIsInputGroupAppend : 'mg-input--is-append-input-slot-content');
|
|
93
86
|
}
|
|
94
87
|
else if (slotAppendInput.filter(slot => slot.nodeName === 'MG-BUTTON').length > 1) {
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
88
|
+
this.classCollection.add(this.classIsInputGroupAppend);
|
|
89
|
+
this.classCollection.add('mg-input--has-buttons-group-append');
|
|
97
90
|
}
|
|
98
91
|
};
|
|
99
92
|
this.value = undefined;
|
|
@@ -117,7 +110,7 @@ export class MgInputText {
|
|
|
117
110
|
this.helpText = undefined;
|
|
118
111
|
this.valid = undefined;
|
|
119
112
|
this.invalid = undefined;
|
|
120
|
-
this.
|
|
113
|
+
this.classCollection = new ClassList(['mg-input--text']);
|
|
121
114
|
this.errorMessage = undefined;
|
|
122
115
|
}
|
|
123
116
|
handleValue(newValue) {
|
|
@@ -125,10 +118,10 @@ export class MgInputText {
|
|
|
125
118
|
}
|
|
126
119
|
validateIcon(newValue) {
|
|
127
120
|
if (newValue !== undefined) {
|
|
128
|
-
this.
|
|
121
|
+
this.classCollection.add(this.classHasIcon);
|
|
129
122
|
}
|
|
130
123
|
else {
|
|
131
|
-
this.
|
|
124
|
+
this.classCollection.delete(this.classHasIcon);
|
|
132
125
|
}
|
|
133
126
|
}
|
|
134
127
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -143,14 +136,12 @@ export class MgInputText {
|
|
|
143
136
|
}
|
|
144
137
|
/**
|
|
145
138
|
* Public method to play input focus
|
|
146
|
-
* @returns {Promise<void>}
|
|
147
139
|
*/
|
|
148
140
|
async setFocus() {
|
|
149
141
|
this.input.focus();
|
|
150
142
|
}
|
|
151
143
|
/**
|
|
152
144
|
* Public method to display errors
|
|
153
|
-
* @returns {Promise<void>}
|
|
154
145
|
*/
|
|
155
146
|
async displayError() {
|
|
156
147
|
this.checkValidity();
|
|
@@ -162,7 +153,7 @@ export class MgInputText {
|
|
|
162
153
|
*************/
|
|
163
154
|
/**
|
|
164
155
|
* Check if component props are well configured on init
|
|
165
|
-
* @returns
|
|
156
|
+
* @returns timeout
|
|
166
157
|
*/
|
|
167
158
|
componentWillLoad() {
|
|
168
159
|
// Get locales
|
|
@@ -181,10 +172,10 @@ export class MgInputText {
|
|
|
181
172
|
}
|
|
182
173
|
/**
|
|
183
174
|
* Render
|
|
184
|
-
* @returns
|
|
175
|
+
* @returns HTML Element
|
|
185
176
|
*/
|
|
186
177
|
render() {
|
|
187
|
-
return (h(MgInput, { identifier: this.identifier,
|
|
178
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left", style: {
|
|
188
179
|
'--mg-character-left-message-length': (this.displayCharacterLeft
|
|
189
180
|
? (this.maxlength - (this.value || '').length).toString().length + this.maxlength.toString().length + 1
|
|
190
181
|
: 0).toString(),
|
|
@@ -582,7 +573,7 @@ export class MgInputText {
|
|
|
582
573
|
}
|
|
583
574
|
static get states() {
|
|
584
575
|
return {
|
|
585
|
-
"
|
|
576
|
+
"classCollection": {},
|
|
586
577
|
"errorMessage": {}
|
|
587
578
|
};
|
|
588
579
|
}
|
|
@@ -634,10 +625,7 @@ export class MgInputText {
|
|
|
634
625
|
},
|
|
635
626
|
"docs": {
|
|
636
627
|
"text": "Public method to play input focus",
|
|
637
|
-
"tags": [
|
|
638
|
-
"name": "returns",
|
|
639
|
-
"text": undefined
|
|
640
|
-
}]
|
|
628
|
+
"tags": []
|
|
641
629
|
}
|
|
642
630
|
},
|
|
643
631
|
"displayError": {
|
|
@@ -653,10 +641,7 @@ export class MgInputText {
|
|
|
653
641
|
},
|
|
654
642
|
"docs": {
|
|
655
643
|
"text": "Public method to display errors",
|
|
656
|
-
"tags": [
|
|
657
|
-
"name": "returns",
|
|
658
|
-
"text": undefined
|
|
659
|
-
}]
|
|
644
|
+
"tags": []
|
|
660
645
|
}
|
|
661
646
|
}
|
|
662
647
|
};
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
85
85
|
margin-top: 0.5rem;
|
|
86
86
|
}
|
|
87
|
-
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle, .mg-input.mg-input--checkbox-multi-disabled .mg-input__input strong {
|
|
88
88
|
opacity: var(--mg-disabled-opacity);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -26,23 +26,23 @@ export class MgInputTextarea {
|
|
|
26
26
|
* Handle focus event
|
|
27
27
|
*/
|
|
28
28
|
this.handleFocus = () => {
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
29
|
+
this.classCollection.add(this.classFocus);
|
|
30
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* Handle blur event
|
|
34
34
|
*/
|
|
35
35
|
this.handleBlur = () => {
|
|
36
36
|
// Manage focus
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
37
|
+
this.classCollection.delete(this.classFocus);
|
|
38
|
+
this.classCollection = new ClassList(this.classCollection.classes);
|
|
39
39
|
// Display Error
|
|
40
40
|
this.displayError();
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* Get pattern validity
|
|
44
44
|
* Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
|
|
45
|
-
* @returns
|
|
45
|
+
* @returns is pattern valid
|
|
46
46
|
*/
|
|
47
47
|
this.getPatternValidity = () => this.pattern === undefined || new RegExp(`^${this.pattern}$`, 'u').test(this.value);
|
|
48
48
|
/**
|
|
@@ -102,7 +102,7 @@ export class MgInputTextarea {
|
|
|
102
102
|
this.valid = undefined;
|
|
103
103
|
this.invalid = undefined;
|
|
104
104
|
this.resizable = 'none';
|
|
105
|
-
this.
|
|
105
|
+
this.classCollection = new ClassList(['mg-input--textarea']);
|
|
106
106
|
this.errorMessage = undefined;
|
|
107
107
|
}
|
|
108
108
|
handleValue(newValue) {
|
|
@@ -121,15 +121,14 @@ export class MgInputTextarea {
|
|
|
121
121
|
}
|
|
122
122
|
validateDisplayCharacterLeft(newValue) {
|
|
123
123
|
if (newValue) {
|
|
124
|
-
this.
|
|
124
|
+
this.classCollection.add(this.classHasDisplayCharacterLeft);
|
|
125
125
|
}
|
|
126
126
|
else {
|
|
127
|
-
this.
|
|
127
|
+
this.classCollection.delete(this.classHasDisplayCharacterLeft);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
131
|
* Public method to display errors
|
|
132
|
-
* @returns {Promise<void>}
|
|
133
132
|
*/
|
|
134
133
|
async displayError() {
|
|
135
134
|
this.checkValidity();
|
|
@@ -141,7 +140,7 @@ export class MgInputTextarea {
|
|
|
141
140
|
*************/
|
|
142
141
|
/**
|
|
143
142
|
* Check if component props are well configured on init
|
|
144
|
-
* @returns
|
|
143
|
+
* @returns timeout
|
|
145
144
|
*/
|
|
146
145
|
componentWillLoad() {
|
|
147
146
|
// Get locales
|
|
@@ -159,10 +158,10 @@ export class MgInputTextarea {
|
|
|
159
158
|
}
|
|
160
159
|
/**
|
|
161
160
|
* Render
|
|
162
|
-
* @returns
|
|
161
|
+
* @returns HTML Element
|
|
163
162
|
*/
|
|
164
163
|
render() {
|
|
165
|
-
return (h(MgInput, { identifier: this.identifier,
|
|
164
|
+
return (h(MgInput, { identifier: this.identifier, classCollection: this.classCollection, ariaDescribedbyIDs: [this.characterLeftId], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: this.mgWidth, disabled: this.disabled, value: this.value, readonlyValue: undefined, tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("div", { class: "mg-input__with-character-left" }, h("textarea", { class: {
|
|
166
165
|
'mg-input__box': true,
|
|
167
166
|
'mg-input__box--resizable': this.resizable === 'both',
|
|
168
167
|
'mg-input__box--resizable-horizontal': this.resizable === 'horizontal',
|
|
@@ -562,7 +561,7 @@ export class MgInputTextarea {
|
|
|
562
561
|
}
|
|
563
562
|
static get states() {
|
|
564
563
|
return {
|
|
565
|
-
"
|
|
564
|
+
"classCollection": {},
|
|
566
565
|
"errorMessage": {}
|
|
567
566
|
};
|
|
568
567
|
}
|
|
@@ -614,10 +613,7 @@ export class MgInputTextarea {
|
|
|
614
613
|
},
|
|
615
614
|
"docs": {
|
|
616
615
|
"text": "Public method to display errors",
|
|
617
|
-
"tags": [
|
|
618
|
-
"name": "returns",
|
|
619
|
-
"text": undefined
|
|
620
|
-
}]
|
|
616
|
+
"tags": []
|
|
621
617
|
}
|
|
622
618
|
}
|
|
623
619
|
};
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
85
85
|
margin-top: 0.5rem;
|
|
86
86
|
}
|
|
87
|
-
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle {
|
|
87
|
+
.mg-input__input .mg-input__box:disabled, .mg-input__input-group--disabled label, .mg-input.mg-input--toggle-disabled .mg-input__input .mg-input__button-toggle, .mg-input.mg-input--checkbox-multi-disabled .mg-input__input strong {
|
|
88
88
|
opacity: var(--mg-disabled-opacity);
|
|
89
89
|
}
|
|
90
90
|
|