@mgdis/mg-components 5.4.0 → 5.6.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-94497267.js → index-4dcc1812.js} +11 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{mg-badge_29.cjs.entry.js → mg-badge_30.cjs.entry.js} +1112 -859
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +5 -4
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -7
- package/dist/collection/components/atoms/mg-badge/mg-badge.conf.js +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.css +13 -0
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +7 -10
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -7
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.css +15 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +12 -29
- package/dist/collection/components/atoms/mg-card/mg-card.css +17 -5
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +2 -3
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -6
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +13 -3
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +5 -12
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +4 -8
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +1 -9
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +58 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +61 -16
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +2 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -22
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +17 -33
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +21 -26
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +24 -47
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -29
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +18 -33
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +30 -36
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +23 -41
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +3 -3
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +23 -45
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -33
- package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +43 -11
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +17 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +27 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +145 -25
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +7 -5
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +0 -4
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +51 -21
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +129 -92
- package/dist/collection/components/molecules/mg-details/mg-details.js +4 -8
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -22
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +2 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +4 -9
- package/dist/collection/components/molecules/mg-message/mg-message.css +20 -19
- package/dist/collection/components/molecules/mg-message/mg-message.js +55 -33
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +20 -8
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -26
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +17 -5
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -22
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +82 -20
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +54 -26
- package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +24 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +28 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +108 -0
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +5 -3
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +11 -7
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +109 -75
- 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 -25
- package/dist/collection/styles/a11y.scss +32 -0
- package/dist/collection/styles/components.scss +3 -0
- package/dist/collection/styles/fonts.scss +21 -0
- package/dist/collection/styles/form.scss +3 -0
- package/dist/collection/styles/global.scss +87 -0
- package/dist/collection/styles/layout.scss +29 -0
- package/dist/collection/styles/main.scss +23 -0
- package/dist/collection/styles/navigation-button.scss +76 -0
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +9 -0
- package/dist/collection/styles/typography.scss +75 -0
- package/dist/collection/styles/utilities.scss +21 -0
- package/dist/collection/utils/behaviors.utils.js +169 -0
- package/dist/collection/utils/components.utils.js +50 -0
- package/dist/collection/utils/locale.utils.js +22 -0
- package/dist/collection/utils/unit.test.utils.js +37 -32
- package/dist/collection/variables.css +9 -9
- package/dist/components/components.utils.js +51 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +73 -18
- package/dist/components/mg-badge2.js +8 -11
- package/dist/components/mg-button2.js +13 -30
- package/dist/components/mg-card.js +1 -37
- package/dist/components/mg-card2.js +39 -0
- package/dist/components/mg-character-left2.js +2 -3
- package/dist/components/mg-details.js +4 -8
- package/dist/components/mg-divider.js +0 -6
- package/dist/components/mg-form.js +8 -22
- package/dist/components/mg-icon2.js +18 -15
- package/dist/components/mg-illustrated-message.js +5 -10
- package/dist/components/mg-input-checkbox.js +17 -33
- package/dist/components/mg-input-date.js +23 -29
- package/dist/components/mg-input-numeric.js +26 -50
- package/dist/components/mg-input-password.js +18 -30
- package/dist/components/mg-input-radio.js +18 -33
- package/dist/components/mg-input-select2.js +32 -38
- package/dist/components/mg-input-text2.js +24 -42
- package/dist/components/mg-input-textarea.js +24 -46
- package/dist/components/mg-input-title2.js +4 -8
- package/dist/components/mg-input-toggle.js +16 -33
- package/dist/components/mg-menu-item.js +1 -264
- package/dist/components/mg-menu-item2.js +517 -0
- package/dist/components/mg-menu.js +142 -28
- package/dist/components/mg-message.js +64 -36
- package/dist/components/mg-modal.js +18 -30
- package/dist/components/mg-pagination.js +4 -13
- package/dist/components/mg-panel.js +20 -25
- package/dist/components/mg-popover.js +1 -200
- package/dist/components/mg-popover2.js +212 -0
- package/dist/components/mg-skip-links.d.ts +11 -0
- package/dist/components/mg-skip-links.js +80 -0
- package/dist/components/mg-tabs.js +108 -73
- package/dist/components/mg-tag.js +35 -13
- package/dist/components/mg-tooltip2.js +10 -23
- package/dist/esm/{index-aad0184c.js → index-dc9a2348.js} +11 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-badge_29.entry.js → mg-badge_30.entry.js} +1112 -860
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- 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-3899d5d2.js → p-182bd802.js} +2 -2
- package/dist/mg-components/p-f7da9dd2.entry.js +1 -0
- package/dist/mg-components/styles/a11y.scss +32 -0
- package/dist/mg-components/styles/components.scss +3 -0
- package/dist/mg-components/styles/fonts.scss +21 -0
- package/dist/mg-components/styles/form.scss +3 -0
- package/dist/mg-components/styles/global.scss +87 -0
- package/dist/mg-components/styles/layout.scss +29 -0
- package/dist/mg-components/styles/main.scss +23 -0
- package/dist/mg-components/styles/navigation-button.scss +76 -0
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +9 -0
- package/dist/mg-components/styles/typography.scss +75 -0
- package/dist/mg-components/styles/utilities.scss +21 -0
- package/dist/mg-components/variables.css +9 -9
- package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -11
- package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -1
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -11
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +4 -4
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +6 -6
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -13
- package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +5 -1
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +27 -6
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.conf.d.ts +1 -1
- 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-toggle/mg-input-toggle.conf.d.ts +1 -1
- package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +5 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +37 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +51 -3
- package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +1 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +0 -8
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +55 -15
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +22 -5
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +12 -0
- package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +7 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +49 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +5 -3
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +24 -14
- package/dist/types/components.d.ts +81 -18
- package/dist/types/locales/index.d.ts +16 -9
- package/dist/types/stencil-public-runtime.d.ts +44 -3
- package/dist/types/utils/behaviors.utils.d.ts +83 -0
- package/dist/types/utils/components.utils.d.ts +14 -0
- package/dist/types/utils/locale.utils.d.ts +13 -0
- package/dist/types/utils/unit.test.utils.d.ts +78 -0
- package/package.json +51 -46
- package/readme.md +25 -14
- package/dist/components/locale.utils.js +0 -40
- package/dist/components/mg-menu.conf.js +0 -10
- package/dist/mg-components/p-059a9a59.entry.js +0 -1
|
@@ -7,17 +7,11 @@ export class MgTag {
|
|
|
7
7
|
* Internal *
|
|
8
8
|
************/
|
|
9
9
|
// Classes
|
|
10
|
-
this.classOutline =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* Define button variant
|
|
16
|
-
*/
|
|
17
|
-
this.variant = variants[0]; // primary
|
|
18
|
-
/**
|
|
19
|
-
* Component classes
|
|
20
|
-
*/
|
|
10
|
+
this.classOutline = 'mg-tag--outline';
|
|
11
|
+
this.classSoft = 'mg-tag--soft';
|
|
12
|
+
this.variant = variants[0];
|
|
13
|
+
this.outline = undefined;
|
|
14
|
+
this.soft = undefined;
|
|
21
15
|
this.classList = new ClassList(['mg-tag']);
|
|
22
16
|
}
|
|
23
17
|
validateVariant(newValue, oldValue) {
|
|
@@ -37,6 +31,29 @@ export class MgTag {
|
|
|
37
31
|
else
|
|
38
32
|
this.classList.delete(this.classOutline);
|
|
39
33
|
}
|
|
34
|
+
validateSoft(newValue) {
|
|
35
|
+
// usage validation
|
|
36
|
+
if (newValue && this.outline)
|
|
37
|
+
throw new Error('<mg-tag> prop "soft" can NOT be used with prop "outline".');
|
|
38
|
+
// apply class
|
|
39
|
+
if (newValue)
|
|
40
|
+
this.classList.add(this.classSoft);
|
|
41
|
+
else
|
|
42
|
+
this.classList.delete(this.classSoft);
|
|
43
|
+
}
|
|
44
|
+
/*************
|
|
45
|
+
* Methods *
|
|
46
|
+
*************/
|
|
47
|
+
/**
|
|
48
|
+
* Validate the given textContent
|
|
49
|
+
*
|
|
50
|
+
* @param {string} textContent html element textContent property
|
|
51
|
+
* @returns {void}
|
|
52
|
+
*/
|
|
53
|
+
validateTextContent(textContent) {
|
|
54
|
+
if (typeof textContent !== 'string' || textContent.trim() === '')
|
|
55
|
+
throw new Error('<mg-tag> slot must contain a text content.');
|
|
56
|
+
}
|
|
40
57
|
/*************
|
|
41
58
|
* Lifecycle *
|
|
42
59
|
*************/
|
|
@@ -48,6 +65,8 @@ export class MgTag {
|
|
|
48
65
|
componentWillLoad() {
|
|
49
66
|
this.validateVariant(this.variant);
|
|
50
67
|
this.validateOutline(this.outline);
|
|
68
|
+
this.validateSoft(this.soft);
|
|
69
|
+
this.validateTextContent(this.element.textContent);
|
|
51
70
|
}
|
|
52
71
|
/**
|
|
53
72
|
* Render
|
|
@@ -75,15 +94,20 @@ export class MgTag {
|
|
|
75
94
|
"type": "string",
|
|
76
95
|
"mutable": false,
|
|
77
96
|
"complexType": {
|
|
78
|
-
"original": "
|
|
79
|
-
"resolved": "
|
|
80
|
-
"references": {
|
|
97
|
+
"original": "TagVariantType",
|
|
98
|
+
"resolved": "\"danger\" | \"info\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"",
|
|
99
|
+
"references": {
|
|
100
|
+
"TagVariantType": {
|
|
101
|
+
"location": "import",
|
|
102
|
+
"path": "./mg-tag.conf"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
81
105
|
},
|
|
82
106
|
"required": false,
|
|
83
107
|
"optional": false,
|
|
84
108
|
"docs": {
|
|
85
109
|
"tags": [],
|
|
86
|
-
"text": "Define
|
|
110
|
+
"text": "Define tag variant"
|
|
87
111
|
},
|
|
88
112
|
"attribute": "variant",
|
|
89
113
|
"reflect": false,
|
|
@@ -101,10 +125,27 @@ export class MgTag {
|
|
|
101
125
|
"optional": false,
|
|
102
126
|
"docs": {
|
|
103
127
|
"tags": [],
|
|
104
|
-
"text": "Define if
|
|
128
|
+
"text": "Define if tag is using outline style"
|
|
105
129
|
},
|
|
106
130
|
"attribute": "outline",
|
|
107
131
|
"reflect": false
|
|
132
|
+
},
|
|
133
|
+
"soft": {
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "boolean",
|
|
138
|
+
"resolved": "boolean",
|
|
139
|
+
"references": {}
|
|
140
|
+
},
|
|
141
|
+
"required": false,
|
|
142
|
+
"optional": false,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": "Define if tag is using soft style"
|
|
146
|
+
},
|
|
147
|
+
"attribute": "soft",
|
|
148
|
+
"reflect": false
|
|
108
149
|
}
|
|
109
150
|
};
|
|
110
151
|
}
|
|
@@ -113,6 +154,7 @@ export class MgTag {
|
|
|
113
154
|
"classList": {}
|
|
114
155
|
};
|
|
115
156
|
}
|
|
157
|
+
static get elementRef() { return "element"; }
|
|
116
158
|
static get watchers() {
|
|
117
159
|
return [{
|
|
118
160
|
"propName": "variant",
|
|
@@ -120,6 +162,9 @@ export class MgTag {
|
|
|
120
162
|
}, {
|
|
121
163
|
"propName": "outline",
|
|
122
164
|
"methodName": "validateOutline"
|
|
165
|
+
}, {
|
|
166
|
+
"propName": "soft",
|
|
167
|
+
"methodName": "validateSoft"
|
|
123
168
|
}];
|
|
124
169
|
}
|
|
125
170
|
}
|
|
@@ -4,23 +4,6 @@ import { createPopper } from '@popperjs/core';
|
|
|
4
4
|
import { Guard } from './mg-tooltip.conf';
|
|
5
5
|
export class MgTooltip {
|
|
6
6
|
constructor() {
|
|
7
|
-
/**
|
|
8
|
-
* Sets an `id` attribute.
|
|
9
|
-
* Needed by the input for accessibility `aria-decribedby`.
|
|
10
|
-
*/
|
|
11
|
-
this.identifier = createID('mg-tooltip');
|
|
12
|
-
/**
|
|
13
|
-
* Tooltip placement
|
|
14
|
-
*/
|
|
15
|
-
this.placement = 'bottom';
|
|
16
|
-
/**
|
|
17
|
-
* Display tooltip
|
|
18
|
-
*/
|
|
19
|
-
this.display = false;
|
|
20
|
-
/**
|
|
21
|
-
* Disable tooltip
|
|
22
|
-
*/
|
|
23
|
-
this.disabled = false;
|
|
24
7
|
/**
|
|
25
8
|
* Show tooltip
|
|
26
9
|
*
|
|
@@ -74,7 +57,7 @@ export class MgTooltip {
|
|
|
74
57
|
this.resetGuard();
|
|
75
58
|
}, 100);
|
|
76
59
|
}
|
|
77
|
-
else if (
|
|
60
|
+
else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {
|
|
78
61
|
this.setDisplay(isMouseenter);
|
|
79
62
|
}
|
|
80
63
|
}
|
|
@@ -144,7 +127,7 @@ export class MgTooltip {
|
|
|
144
127
|
this.setDisplay(true);
|
|
145
128
|
});
|
|
146
129
|
['blur', 'keydown'].forEach(event => {
|
|
147
|
-
|
|
130
|
+
document.addEventListener(event, (e) => {
|
|
148
131
|
// we continue to process ONLY for KeyboardEvents 'Escape'
|
|
149
132
|
if (e.type === 'keydown' && e.code !== 'Escape') {
|
|
150
133
|
return;
|
|
@@ -166,6 +149,11 @@ export class MgTooltip {
|
|
|
166
149
|
});
|
|
167
150
|
});
|
|
168
151
|
};
|
|
152
|
+
this.identifier = createID('mg-tooltip');
|
|
153
|
+
this.message = undefined;
|
|
154
|
+
this.placement = 'bottom';
|
|
155
|
+
this.display = false;
|
|
156
|
+
this.disabled = false;
|
|
169
157
|
}
|
|
170
158
|
validateMessage(newValue) {
|
|
171
159
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -198,8 +186,7 @@ export class MgTooltip {
|
|
|
198
186
|
const slotElement = this.element.firstElementChild;
|
|
199
187
|
// Get interactive element
|
|
200
188
|
const interactiveElements = ['a', 'button', 'input', 'textarea', 'select']; //! Might needs updates
|
|
201
|
-
const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) ||
|
|
202
|
-
((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
|
|
189
|
+
const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
|
|
203
190
|
// define selected element to become tooltip selector
|
|
204
191
|
this.tooltipedElement = interactiveElement || slotElement;
|
|
205
192
|
// Check if slotted element is a disabled mg-button
|
|
@@ -224,7 +211,7 @@ export class MgTooltip {
|
|
|
224
211
|
* @returns {HTMLElement} HTML Element
|
|
225
212
|
*/
|
|
226
213
|
render() {
|
|
227
|
-
return (h(Host, null, h("slot", null), h("div", { role: "tooltip", id: this.identifier, class: "mg-tooltip", innerHTML: this.message }, h("div", { class: "mg-tooltip__arrow", "data-popper-arrow": true }))));
|
|
214
|
+
return (h(Host, null, h("slot", null), h("div", { role: "tooltip", id: this.identifier, class: "mg-tooltip" }, h("span", { innerHTML: this.message }), h("div", { class: "mg-tooltip__arrow", "data-popper-arrow": true }))));
|
|
228
215
|
}
|
|
229
216
|
static get is() { return "mg-tooltip"; }
|
|
230
217
|
static get encapsulation() { return "shadow"; }
|
|
@@ -18,39 +18,6 @@ export class MgInputCheckbox {
|
|
|
18
18
|
this.inputs = [];
|
|
19
19
|
// hasDisplayedError (triggered by blur event)
|
|
20
20
|
this.hasDisplayedError = false;
|
|
21
|
-
/**
|
|
22
|
-
* Input name
|
|
23
|
-
* If not set the value equals the identifier
|
|
24
|
-
*/
|
|
25
|
-
this.name = this.identifier;
|
|
26
|
-
/**
|
|
27
|
-
* Define if label is visible
|
|
28
|
-
*/
|
|
29
|
-
this.labelHide = false;
|
|
30
|
-
/**
|
|
31
|
-
* Define if inputs are display verticaly
|
|
32
|
-
*/
|
|
33
|
-
this.inputVerticalList = false;
|
|
34
|
-
/**
|
|
35
|
-
* Define if input is required
|
|
36
|
-
*/
|
|
37
|
-
this.required = false;
|
|
38
|
-
/**
|
|
39
|
-
* Define if input is readonly
|
|
40
|
-
*/
|
|
41
|
-
this.readonly = false;
|
|
42
|
-
/**
|
|
43
|
-
* Define if input is disabled
|
|
44
|
-
*/
|
|
45
|
-
this.disabled = false;
|
|
46
|
-
/**
|
|
47
|
-
* Component classes
|
|
48
|
-
*/
|
|
49
|
-
this.classList = new ClassList(['mg-input--checkbox']);
|
|
50
|
-
/**
|
|
51
|
-
* Formated value for display
|
|
52
|
-
*/
|
|
53
|
-
this.checkboxItems = [];
|
|
54
21
|
/**
|
|
55
22
|
* Handle input event
|
|
56
23
|
*
|
|
@@ -100,6 +67,23 @@ export class MgInputCheckbox {
|
|
|
100
67
|
this.errorMessage = this.messages.errors.required;
|
|
101
68
|
}
|
|
102
69
|
};
|
|
70
|
+
this.value = undefined;
|
|
71
|
+
this.identifier = undefined;
|
|
72
|
+
this.name = this.identifier;
|
|
73
|
+
this.label = undefined;
|
|
74
|
+
this.labelOnTop = undefined;
|
|
75
|
+
this.labelHide = false;
|
|
76
|
+
this.inputVerticalList = false;
|
|
77
|
+
this.required = false;
|
|
78
|
+
this.readonly = false;
|
|
79
|
+
this.disabled = false;
|
|
80
|
+
this.tooltip = undefined;
|
|
81
|
+
this.helpText = undefined;
|
|
82
|
+
this.valid = undefined;
|
|
83
|
+
this.invalid = undefined;
|
|
84
|
+
this.classList = new ClassList(['mg-input--checkbox']);
|
|
85
|
+
this.errorMessage = undefined;
|
|
86
|
+
this.checkboxItems = [];
|
|
103
87
|
}
|
|
104
88
|
validateValue(newValue) {
|
|
105
89
|
if (newValue && newValue.every(item => isCheckboxItem(item))) {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
font-style: italic;
|
|
125
125
|
}
|
|
126
126
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
127
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
128
|
}
|
|
129
129
|
.mg-input__box:disabled {
|
|
130
130
|
opacity: 0.3;
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
147
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
148
|
+
border-top-right-radius: 0;
|
|
149
|
+
border-bottom-right-radius: 0;
|
|
150
150
|
}
|
|
151
151
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
152
|
outline-style: solid;
|
|
@@ -8,31 +8,6 @@ export class MgInputDate {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
// hasDisplayedError (triggered by blur event)
|
|
10
10
|
this.hasDisplayedError = false;
|
|
11
|
-
/**
|
|
12
|
-
* Input name
|
|
13
|
-
* If not set the value equals the identifier
|
|
14
|
-
*/
|
|
15
|
-
this.name = this.identifier;
|
|
16
|
-
/**
|
|
17
|
-
* Define if label is visible
|
|
18
|
-
*/
|
|
19
|
-
this.labelHide = false;
|
|
20
|
-
/**
|
|
21
|
-
* Define if input is required
|
|
22
|
-
*/
|
|
23
|
-
this.required = false;
|
|
24
|
-
/**
|
|
25
|
-
* Define if input is readonly
|
|
26
|
-
*/
|
|
27
|
-
this.readonly = false;
|
|
28
|
-
/**
|
|
29
|
-
* Define if input is disabled
|
|
30
|
-
*/
|
|
31
|
-
this.disabled = false;
|
|
32
|
-
/**
|
|
33
|
-
* Component classes
|
|
34
|
-
*/
|
|
35
|
-
this.classList = new ClassList(['mg-input--date']);
|
|
36
11
|
/**
|
|
37
12
|
* Handle input event
|
|
38
13
|
*/
|
|
@@ -111,13 +86,33 @@ export class MgInputDate {
|
|
|
111
86
|
}
|
|
112
87
|
}
|
|
113
88
|
};
|
|
89
|
+
this.value = undefined;
|
|
90
|
+
this.identifier = undefined;
|
|
91
|
+
this.name = this.identifier;
|
|
92
|
+
this.label = undefined;
|
|
93
|
+
this.labelOnTop = undefined;
|
|
94
|
+
this.labelHide = false;
|
|
95
|
+
this.required = false;
|
|
96
|
+
this.readonly = false;
|
|
97
|
+
this.disabled = false;
|
|
98
|
+
this.tooltip = undefined;
|
|
99
|
+
this.helpText = undefined;
|
|
100
|
+
this.valid = undefined;
|
|
101
|
+
this.invalid = undefined;
|
|
102
|
+
this.min = undefined;
|
|
103
|
+
this.max = undefined;
|
|
104
|
+
this.classList = new ClassList(['mg-input--date']);
|
|
105
|
+
this.errorMessage = undefined;
|
|
114
106
|
}
|
|
115
107
|
validateValue(newValue) {
|
|
108
|
+
// When the input is not fully completed or has been cleared, the value becomes an empty string.
|
|
109
|
+
if (newValue === '')
|
|
110
|
+
newValue = null;
|
|
116
111
|
if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !dateRegExp.test(newValue))) {
|
|
117
112
|
throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
118
113
|
}
|
|
119
114
|
else {
|
|
120
|
-
this.valueChange.emit(
|
|
115
|
+
this.valueChange.emit(newValue);
|
|
121
116
|
}
|
|
122
117
|
}
|
|
123
118
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
font-style: italic;
|
|
125
125
|
}
|
|
126
126
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
127
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
128
|
}
|
|
129
129
|
.mg-input__box:disabled {
|
|
130
130
|
opacity: 0.3;
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
147
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
148
|
+
border-top-right-radius: 0;
|
|
149
|
+
border-bottom-right-radius: 0;
|
|
150
150
|
}
|
|
151
151
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
152
|
outline-style: solid;
|
|
@@ -8,53 +8,6 @@ export class MgInputNumeric {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
// hasDisplayedError (triggered by blur event)
|
|
10
10
|
this.hasDisplayedError = false;
|
|
11
|
-
/**
|
|
12
|
-
* Input name
|
|
13
|
-
* If not set the value equals the identifier
|
|
14
|
-
*/
|
|
15
|
-
this.name = this.identifier;
|
|
16
|
-
/**
|
|
17
|
-
* Define if label is visible
|
|
18
|
-
*/
|
|
19
|
-
this.labelHide = false;
|
|
20
|
-
/**
|
|
21
|
-
* Define if input is required
|
|
22
|
-
*/
|
|
23
|
-
this.required = false;
|
|
24
|
-
/**
|
|
25
|
-
* Define if input is readonly
|
|
26
|
-
*/
|
|
27
|
-
this.readonly = false;
|
|
28
|
-
/**
|
|
29
|
-
* Define if input is disabled
|
|
30
|
-
*/
|
|
31
|
-
this.disabled = false;
|
|
32
|
-
/**
|
|
33
|
-
* Define numeric type
|
|
34
|
-
*/
|
|
35
|
-
this.type = types[0];
|
|
36
|
-
/**
|
|
37
|
-
* Define currency
|
|
38
|
-
*/
|
|
39
|
-
this.currency = 'USD';
|
|
40
|
-
/**
|
|
41
|
-
* Override integer length
|
|
42
|
-
* integer is the number before the decimal point
|
|
43
|
-
*/
|
|
44
|
-
this.integerLength = 13;
|
|
45
|
-
/**
|
|
46
|
-
* Override decimal length
|
|
47
|
-
* decimal is the number after the decimal point
|
|
48
|
-
*/
|
|
49
|
-
this.decimalLength = 2;
|
|
50
|
-
/**
|
|
51
|
-
* Component classes
|
|
52
|
-
*/
|
|
53
|
-
this.classList = new ClassList(['mg-input--numeric']);
|
|
54
|
-
/**
|
|
55
|
-
* Define if input has focus
|
|
56
|
-
*/
|
|
57
|
-
this.hasFocus = false;
|
|
58
11
|
/**
|
|
59
12
|
* Handle input event
|
|
60
13
|
*
|
|
@@ -161,6 +114,30 @@ export class MgInputNumeric {
|
|
|
161
114
|
this.classList.add(slotAppendInput.nodeName === 'MG-BUTTON' ? 'mg-input--is-input-group-append' : 'mg-input--is-append-input-slot-content');
|
|
162
115
|
}
|
|
163
116
|
};
|
|
117
|
+
this.value = undefined;
|
|
118
|
+
this.identifier = undefined;
|
|
119
|
+
this.name = this.identifier;
|
|
120
|
+
this.label = undefined;
|
|
121
|
+
this.labelOnTop = undefined;
|
|
122
|
+
this.labelHide = false;
|
|
123
|
+
this.placeholder = undefined;
|
|
124
|
+
this.required = false;
|
|
125
|
+
this.readonly = false;
|
|
126
|
+
this.disabled = false;
|
|
127
|
+
this.mgWidth = undefined;
|
|
128
|
+
this.tooltip = undefined;
|
|
129
|
+
this.helpText = undefined;
|
|
130
|
+
this.type = types[0];
|
|
131
|
+
this.currency = 'USD';
|
|
132
|
+
this.max = undefined;
|
|
133
|
+
this.min = undefined;
|
|
134
|
+
this.integerLength = 13;
|
|
135
|
+
this.decimalLength = 2;
|
|
136
|
+
this.valid = undefined;
|
|
137
|
+
this.invalid = undefined;
|
|
138
|
+
this.classList = new ClassList(['mg-input--numeric']);
|
|
139
|
+
this.errorMessage = undefined;
|
|
140
|
+
this.hasFocus = false;
|
|
164
141
|
}
|
|
165
142
|
validateValue(newValue) {
|
|
166
143
|
if (newValue !== undefined && newValue !== null) {
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
font-style: italic;
|
|
125
125
|
}
|
|
126
126
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
127
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
128
|
}
|
|
129
129
|
.mg-input__box:disabled {
|
|
130
130
|
opacity: 0.3;
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
147
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
148
|
+
border-top-right-radius: 0;
|
|
149
|
+
border-bottom-right-radius: 0;
|
|
150
150
|
}
|
|
151
151
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
152
|
outline-style: solid;
|
|
@@ -6,35 +6,6 @@ export class MgInputPassword {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
// hasDisplayedError (triggered by blur event)
|
|
8
8
|
this.hasDisplayedError = false;
|
|
9
|
-
/**
|
|
10
|
-
* Input name
|
|
11
|
-
* If not set the value equals the identifier
|
|
12
|
-
*/
|
|
13
|
-
this.name = this.identifier;
|
|
14
|
-
/**
|
|
15
|
-
* Define if label is visible
|
|
16
|
-
*/
|
|
17
|
-
this.labelHide = false;
|
|
18
|
-
/**
|
|
19
|
-
* Define if input is required
|
|
20
|
-
*/
|
|
21
|
-
this.required = false;
|
|
22
|
-
/**
|
|
23
|
-
* Define if input is readonly
|
|
24
|
-
*/
|
|
25
|
-
this.readonly = false;
|
|
26
|
-
/**
|
|
27
|
-
* Define if input is disabled
|
|
28
|
-
*/
|
|
29
|
-
this.disabled = false;
|
|
30
|
-
/**
|
|
31
|
-
* Define input width
|
|
32
|
-
*/
|
|
33
|
-
this.mgWidth = 'full';
|
|
34
|
-
/**
|
|
35
|
-
* Component classes
|
|
36
|
-
*/
|
|
37
|
-
this.classList = new ClassList(['mg-input--password']);
|
|
38
9
|
/**
|
|
39
10
|
* Handle input event
|
|
40
11
|
*/
|
|
@@ -72,6 +43,23 @@ export class MgInputPassword {
|
|
|
72
43
|
this.errorMessage = this.messages.errors.required;
|
|
73
44
|
}
|
|
74
45
|
};
|
|
46
|
+
this.value = undefined;
|
|
47
|
+
this.identifier = undefined;
|
|
48
|
+
this.name = this.identifier;
|
|
49
|
+
this.label = undefined;
|
|
50
|
+
this.labelOnTop = undefined;
|
|
51
|
+
this.labelHide = false;
|
|
52
|
+
this.placeholder = undefined;
|
|
53
|
+
this.required = false;
|
|
54
|
+
this.readonly = false;
|
|
55
|
+
this.disabled = false;
|
|
56
|
+
this.mgWidth = 'full';
|
|
57
|
+
this.tooltip = undefined;
|
|
58
|
+
this.helpText = undefined;
|
|
59
|
+
this.valid = undefined;
|
|
60
|
+
this.invalid = undefined;
|
|
61
|
+
this.classList = new ClassList(['mg-input--password']);
|
|
62
|
+
this.errorMessage = undefined;
|
|
75
63
|
}
|
|
76
64
|
handleValue(newValue) {
|
|
77
65
|
this.valueChange.emit(newValue);
|
|
@@ -20,39 +20,6 @@ export class MgInputRadio {
|
|
|
20
20
|
this.inputs = [];
|
|
21
21
|
// hasDisplayedError (triggered by blur event)
|
|
22
22
|
this.hasDisplayedError = false;
|
|
23
|
-
/**
|
|
24
|
-
* Input name
|
|
25
|
-
* If not set the value equals the identifier
|
|
26
|
-
*/
|
|
27
|
-
this.name = this.identifier;
|
|
28
|
-
/**
|
|
29
|
-
* Define if label is displayed on top
|
|
30
|
-
*/
|
|
31
|
-
this.labelOnTop = false;
|
|
32
|
-
/**
|
|
33
|
-
* Define if label is visible
|
|
34
|
-
*/
|
|
35
|
-
this.labelHide = false;
|
|
36
|
-
/**
|
|
37
|
-
* Define if inputs are display verticaly
|
|
38
|
-
*/
|
|
39
|
-
this.inputVerticalList = false;
|
|
40
|
-
/**
|
|
41
|
-
* Define if input is required
|
|
42
|
-
*/
|
|
43
|
-
this.required = false;
|
|
44
|
-
/**
|
|
45
|
-
* Define if input is readonly
|
|
46
|
-
*/
|
|
47
|
-
this.readonly = false;
|
|
48
|
-
/**
|
|
49
|
-
* Define if input is disabled
|
|
50
|
-
*/
|
|
51
|
-
this.disabled = false;
|
|
52
|
-
/**
|
|
53
|
-
* Component classes
|
|
54
|
-
*/
|
|
55
|
-
this.classList = new ClassList(['mg-input--radio']);
|
|
56
23
|
/**
|
|
57
24
|
* Handle input event
|
|
58
25
|
*
|
|
@@ -102,6 +69,24 @@ export class MgInputRadio {
|
|
|
102
69
|
* @returns {HTMLInputElement} element
|
|
103
70
|
*/
|
|
104
71
|
this.getInvalidElement = () => this.inputs.find((input) => !input.disabled && !input.readOnly && !input.checkValidity());
|
|
72
|
+
this.value = undefined;
|
|
73
|
+
this.items = undefined;
|
|
74
|
+
this.identifier = undefined;
|
|
75
|
+
this.name = this.identifier;
|
|
76
|
+
this.label = undefined;
|
|
77
|
+
this.labelOnTop = false;
|
|
78
|
+
this.labelHide = false;
|
|
79
|
+
this.inputVerticalList = false;
|
|
80
|
+
this.required = false;
|
|
81
|
+
this.readonly = false;
|
|
82
|
+
this.disabled = false;
|
|
83
|
+
this.tooltip = undefined;
|
|
84
|
+
this.helpText = undefined;
|
|
85
|
+
this.valid = undefined;
|
|
86
|
+
this.invalid = undefined;
|
|
87
|
+
this.classList = new ClassList(['mg-input--radio']);
|
|
88
|
+
this.errorMessage = undefined;
|
|
89
|
+
this.options = undefined;
|
|
105
90
|
}
|
|
106
91
|
handleValue(newValue) {
|
|
107
92
|
this.valueChange.emit(newValue);
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
font-style: italic;
|
|
125
125
|
}
|
|
126
126
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
127
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
128
|
}
|
|
129
129
|
.mg-input__box:disabled {
|
|
130
130
|
opacity: 0.3;
|
|
@@ -145,8 +145,8 @@
|
|
|
145
145
|
}
|
|
146
146
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
147
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
148
|
+
border-top-right-radius: 0;
|
|
149
|
+
border-bottom-right-radius: 0;
|
|
150
150
|
}
|
|
151
151
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
152
|
outline-style: solid;
|