@mgdis/mg-components 5.5.0 → 5.7.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-c3450336.js → index-5e7ede97.js} +120 -4
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/{mg-badge_30.cjs.entry.js → mg-action-more_31.cjs.entry.js} +1223 -547
- package/dist/cjs/mg-components.cjs.js +7 -3
- package/dist/collection/collection-manifest.json +6 -5
- 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 +4 -4
- package/dist/collection/components/atoms/mg-button/mg-button.css +9 -22
- package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
- package/dist/collection/components/atoms/mg-card/mg-card.css +13 -6
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +38 -28
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +3 -3
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +6 -6
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +4 -4
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +2 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +14 -17
- package/dist/collection/components/molecules/inputs/MgInput.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +3 -2
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +5 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +2 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +8 -4
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +7 -3
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -4
- 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 +141 -19
- 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 +48 -21
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +139 -71
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +38 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +252 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +4 -3
- package/dist/collection/components/molecules/mg-message/mg-message.css +7 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +54 -13
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +8 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +7 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +72 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +64 -7
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +33 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +12 -7
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +105 -57
- package/dist/collection/locales/en/messages.json +10 -1
- package/dist/collection/locales/fr/messages.json +10 -1
- package/dist/collection/locales/index.js +3 -26
- 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/mg-icon-animation.scss +6 -0
- package/dist/collection/styles/navigation-button.scss +77 -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 +151 -0
- package/dist/collection/utils/components.utils.js +52 -0
- package/dist/collection/utils/locale.utils.js +28 -6
- package/dist/collection/utils/unit.test.utils.js +65 -32
- package/dist/collection/variables.css +11 -10
- package/dist/components/MgInput.js +6 -1
- package/dist/components/components.utils.js +53 -1
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +2 -1
- package/dist/components/index2.js +79 -20
- package/dist/components/mg-action-more.d.ts +11 -0
- package/dist/components/mg-action-more.js +215 -0
- package/dist/components/mg-badge2.js +5 -5
- package/dist/components/mg-button2.js +2 -2
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-form.js +2 -2
- package/dist/components/mg-icon2.js +41 -31
- package/dist/components/mg-illustrated-message.js +4 -3
- package/dist/components/mg-input-checkbox.js +3 -3
- package/dist/components/mg-input-date.js +7 -5
- package/dist/components/mg-input-numeric.js +3 -4
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +2 -2
- package/dist/components/mg-input-select2.js +9 -5
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +2 -2
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-menu-item.js +1 -253
- package/dist/components/mg-menu-item2.js +520 -0
- package/dist/components/mg-menu.js +1 -129
- package/dist/components/mg-menu2.js +247 -0
- package/dist/components/mg-message.js +55 -14
- package/dist/components/mg-modal.js +1 -1
- package/dist/components/mg-pagination.js +3 -1
- package/dist/components/mg-panel.js +3 -3
- package/dist/components/mg-popover.js +1 -190
- package/dist/components/mg-popover2.js +226 -0
- package/dist/components/mg-skip-links.js +16 -2
- package/dist/components/mg-tabs.js +104 -55
- package/dist/components/mg-tag.js +5 -5
- package/dist/components/mg-tooltip2.js +15 -18
- package/dist/esm/{index-78edde1d.js → index-03cceb11.js} +120 -5
- package/dist/esm/loader.js +4 -3
- package/dist/esm/{mg-badge_30.entry.js → mg-action-more_31.entry.js} +1223 -548
- package/dist/esm/mg-components.js +4 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/mg-components/locales/en/messages.json +10 -1
- package/dist/mg-components/locales/fr/messages.json +10 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-4cfd5423.entry.js +1 -0
- package/dist/mg-components/p-e126dd84.js +2 -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/mg-icon-animation.scss +6 -0
- package/dist/mg-components/styles/navigation-button.scss +77 -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 +11 -10
- package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +1 -1
- 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-textarea/mg-input-textarea.d.ts +1 -1
- 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/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/mg-menu-item.conf.d.ts +0 -8
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +61 -15
- package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +42 -0
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +81 -0
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +21 -4
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +13 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +1 -1
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +15 -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 +22 -12
- package/dist/types/components.d.ts +98 -12
- package/dist/types/locales/index.d.ts +21 -10
- package/dist/types/stencil-public-runtime.d.ts +48 -3
- package/dist/types/utils/behaviors.utils.d.ts +77 -0
- package/dist/types/utils/components.utils.d.ts +14 -0
- package/dist/types/utils/locale.utils.d.ts +16 -3
- package/dist/types/utils/unit.test.utils.d.ts +68 -14
- package/loader/index.d.ts +9 -0
- package/package.json +28 -27
- package/readme.md +22 -31
- package/dist/.storybook/utils.js +0 -24
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -27
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -38
- package/dist/collection/components/atoms/mg-card/doc/mg-card.stories.js +0 -18
- package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +0 -20
- package/dist/collection/components/atoms/mg-divider/doc/mg-divider.stories.js +0 -18
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +0 -41
- package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +0 -21
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +0 -22
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +0 -50
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +0 -50
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +0 -43
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +0 -68
- package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +0 -46
- package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +0 -59
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +0 -77
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +0 -110
- package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +0 -54
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +0 -51
- package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +0 -87
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +0 -39
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +0 -24
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +0 -47
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +0 -19
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +0 -39
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +0 -39
- package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +0 -20
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +0 -22
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +0 -34
- package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +0 -24
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +0 -51
- package/dist/collection/stories/grids.stories.js +0 -7
- package/dist/collection/stories/helpers.stories.js +0 -23
- package/dist/collection/stories/icons.stories.js +0 -25
- package/dist/collection/stories/typography.stories.js +0 -24
- package/dist/components/locale.utils.js +0 -40
- package/dist/components/mg-menu.conf.js +0 -10
- package/dist/mg-components/p-125c54ca.js +0 -2
- package/dist/mg-components/p-4961c96c.entry.js +0 -1
- package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -13
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -16
- package/dist/types/components/atoms/mg-card/doc/mg-card.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-divider/doc/mg-divider.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-icon/doc/mg-icon.stories.d.ts +0 -26
- package/dist/types/components/atoms/mg-input-title/doc/mg-input-title.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -6
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.d.ts +0 -11
- package/dist/types/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.d.ts +0 -12
- package/dist/types/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.d.ts +0 -32
- package/dist/types/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.d.ts +0 -22
- package/dist/types/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.d.ts +0 -20
- package/dist/types/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.d.ts +0 -34
- package/dist/types/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.d.ts +0 -39
- package/dist/types/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.d.ts +0 -19
- package/dist/types/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.d.ts +0 -12
- package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +0 -17
- package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +0 -12
- package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-form/doc/mg-form.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +0 -6
- package/dist/types/components/molecules/mg-message/doc/mg-message.stories.d.ts +0 -26
- package/dist/types/components/molecules/mg-modal/doc/mg-modal.stories.d.ts +0 -13
- package/dist/types/components/molecules/mg-pagination/doc/mg-pagination.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-panel/doc/mg-panel.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +0 -22
- package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +0 -11
- package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +0 -20
- package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +0 -1
- package/dist/types/stories/grids.stories.d.ts +0 -5
- package/dist/types/stories/helpers.stories.d.ts +0 -13
- package/dist/types/stories/icons.stories.d.ts +0 -13
- package/dist/types/stories/typography.stories.d.ts +0 -5
|
@@ -7,8 +7,8 @@ export class MgTag {
|
|
|
7
7
|
* Internal *
|
|
8
8
|
************/
|
|
9
9
|
// Classes
|
|
10
|
-
this.classOutline =
|
|
11
|
-
this.classSoft =
|
|
10
|
+
this.classOutline = 'mg-tag--outline';
|
|
11
|
+
this.classSoft = 'mg-tag--soft';
|
|
12
12
|
this.variant = variants[0];
|
|
13
13
|
this.outline = undefined;
|
|
14
14
|
this.soft = undefined;
|
|
@@ -16,7 +16,7 @@ export class MgTag {
|
|
|
16
16
|
}
|
|
17
17
|
validateVariant(newValue, oldValue) {
|
|
18
18
|
if (!variants.includes(newValue)) {
|
|
19
|
-
throw new Error(`<mg-tag> prop "variant" must be one of
|
|
19
|
+
throw new Error(`<mg-tag> prop "variant" must be one of: ${variants.join(', ')}.`);
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
22
|
if (oldValue !== undefined) {
|
|
@@ -51,7 +51,7 @@ export class MgTag {
|
|
|
51
51
|
* @returns {void}
|
|
52
52
|
*/
|
|
53
53
|
validateTextContent(textContent) {
|
|
54
|
-
if (
|
|
54
|
+
if (typeof textContent !== 'string' || textContent.trim() === '')
|
|
55
55
|
throw new Error('<mg-tag> slot must contain a text content.');
|
|
56
56
|
}
|
|
57
57
|
/*************
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
|
2
|
-
import { createID } from '../../../utils/components.utils';
|
|
2
|
+
import { createID, focusableElements } from '../../../utils/components.utils';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
4
|
import { Guard } from './mg-tooltip.conf';
|
|
5
5
|
export class MgTooltip {
|
|
@@ -11,7 +11,7 @@ export class MgTooltip {
|
|
|
11
11
|
*/
|
|
12
12
|
this.show = () => {
|
|
13
13
|
// Make the tooltip visible
|
|
14
|
-
this.tooltip.
|
|
14
|
+
this.tooltip.dataset.show = '';
|
|
15
15
|
// Enable the event listeners
|
|
16
16
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
17
17
|
// Update its position
|
|
@@ -57,7 +57,7 @@ export class MgTooltip {
|
|
|
57
57
|
this.resetGuard();
|
|
58
58
|
}, 100);
|
|
59
59
|
}
|
|
60
|
-
else if (
|
|
60
|
+
else if (this.guard === Guard.HOVER_TOOLTIPED_ELEMENT) {
|
|
61
61
|
this.setDisplay(isMouseenter);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -126,24 +126,22 @@ export class MgTooltip {
|
|
|
126
126
|
this.guard = Guard.FOCUS;
|
|
127
127
|
this.setDisplay(true);
|
|
128
128
|
});
|
|
129
|
-
|
|
130
|
-
this.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.resetGuard();
|
|
129
|
+
this.tooltipedElement.addEventListener('blur', () => {
|
|
130
|
+
this.resetGuard();
|
|
131
|
+
this.setDisplay(false);
|
|
132
|
+
});
|
|
133
|
+
document.addEventListener('keydown', (event) => {
|
|
134
|
+
if (event.code === 'Escape')
|
|
136
135
|
this.setDisplay(false);
|
|
137
|
-
});
|
|
138
136
|
});
|
|
139
137
|
// manage tooltipElement & tooltipedElement mouseenter/mouseleave events
|
|
140
|
-
['mouseenter', 'mouseleave'].forEach(
|
|
141
|
-
const isMouseenter =
|
|
138
|
+
['mouseenter', 'mouseleave'].forEach(eventType => {
|
|
139
|
+
const isMouseenter = eventType === 'mouseenter';
|
|
142
140
|
[
|
|
143
141
|
{ element: this.tooltip, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIP_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIPED_ELEMENT) },
|
|
144
142
|
{ element: this.tooltipedElement, action: () => this.tooltipMouseListenerAction(Guard.HOVER_TOOLTIPED_ELEMENT, isMouseenter, Guard.HOVER_TOOLTIP_ELEMENT) },
|
|
145
143
|
].forEach(({ element, action }) => {
|
|
146
|
-
element.addEventListener(
|
|
144
|
+
element.addEventListener(eventType, () => {
|
|
147
145
|
action();
|
|
148
146
|
});
|
|
149
147
|
});
|
|
@@ -185,8 +183,7 @@ export class MgTooltip {
|
|
|
185
183
|
// get slotted element
|
|
186
184
|
const slotElement = this.element.firstElementChild;
|
|
187
185
|
// Get interactive element
|
|
188
|
-
const
|
|
189
|
-
const interactiveElement = this.element.shadowRoot.querySelector(interactiveElements.join(',')) || ((_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(interactiveElements.join(',')));
|
|
186
|
+
const interactiveElement = slotElement.matches(focusableElements) ? slotElement : (_a = slotElement.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(focusableElements);
|
|
190
187
|
// define selected element to become tooltip selector
|
|
191
188
|
this.tooltipedElement = interactiveElement || slotElement;
|
|
192
189
|
// Check if slotted element is a disabled mg-button
|
|
@@ -211,7 +208,7 @@ export class MgTooltip {
|
|
|
211
208
|
* @returns {HTMLElement} HTML Element
|
|
212
209
|
*/
|
|
213
210
|
render() {
|
|
214
|
-
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 }))));
|
|
211
|
+
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 }))));
|
|
215
212
|
}
|
|
216
213
|
static get is() { return "mg-tooltip"; }
|
|
217
214
|
static get encapsulation() { return "shadow"; }
|
|
@@ -58,6 +58,11 @@ export const MgInput = (props, children, utils) => {
|
|
|
58
58
|
if (props.labelOnTop && props.labelHide) {
|
|
59
59
|
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Set readonly value
|
|
63
|
+
*/
|
|
64
|
+
if (props.readonlyValue === undefined)
|
|
65
|
+
props.readonlyValue = props.value;
|
|
61
66
|
/**
|
|
62
67
|
* Component classes
|
|
63
68
|
*/
|
|
@@ -105,5 +110,5 @@ export const MgInput = (props, children, utils) => {
|
|
|
105
110
|
* @returns {VNode[]} mg-input-title
|
|
106
111
|
*/
|
|
107
112
|
const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
|
|
108
|
-
return (h(TagName, { class: props.classList.join() }, props.labelOnTop ? (h("div", { class: "mg-input__title" }, getInputTitle(), !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()), props.readonly ? (h("div", { class: "mg-input__input-container" }, h("strong", null, props.readonlyValue
|
|
113
|
+
return (h(TagName, { class: props.classList.join() }, props.labelOnTop ? (h("div", { class: "mg-input__title" }, getInputTitle(), !props.readonly && props.tooltip && getTooltip())) : (getInputTitle()), props.readonly ? (h("div", { class: "mg-input__input-container" }, h("strong", null, props.readonlyValue), children.filter(child => child.$name$ === 'append-input'))) : (h("div", { class: "mg-input__input-container" }, h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } }, applyAriadescribedBy(children, ariaDescribedbyIDs, utils), !props.labelOnTop && props.tooltip && getTooltip()), props.helpText && h("div", { id: helpTextId, class: "mg-input__help-text", innerHTML: props.helpText }), props.errorMessage && !props.readonly && !props.disabled && (h("div", { id: helpTextErrorId, class: "mg-input__error", innerHTML: props.errorMessage, "aria-live": "assertive" }))))));
|
|
109
114
|
};
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -145,9 +149,6 @@ fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container {
|
|
|
145
149
|
display: flex;
|
|
146
150
|
align-items: top;
|
|
147
151
|
}
|
|
148
|
-
.mg-input__input-group.mg-input__input-group--disabled label {
|
|
149
|
-
opacity: 0.3;
|
|
150
|
-
}
|
|
151
152
|
|
|
152
153
|
/**
|
|
153
154
|
* A11Y
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
1
2
|
import { h } from '@stencil/core';
|
|
2
3
|
import { MgInput } from '../MgInput';
|
|
3
4
|
import { ClassList } from '../../../../utils/components.utils';
|
|
@@ -145,11 +146,11 @@ export class MgInputCheckbox {
|
|
|
145
146
|
* @returns {HTMLElement} HTML Element
|
|
146
147
|
*/
|
|
147
148
|
render() {
|
|
148
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList } }, this.checkboxItems
|
|
149
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, readonly: undefined, mgWidth: undefined, disabled: this.disabled, value: this.value && this.value.toString(), readonlyValue: undefined, tooltip: !this.readonly ? this.tooltip : undefined, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined, isFieldset: true }, h("ul", { class: { 'mg-input__input-group-container': true, 'mg-input__input-group-container--vertical': this.inputVerticalList }, role: "list" }, this.checkboxItems
|
|
149
150
|
.filter(item => {
|
|
150
151
|
return !this.readonly || item.value;
|
|
151
152
|
})
|
|
152
|
-
.map((input, index) => (h("li", { class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
153
|
+
.map((input, index) => (h("li", { key: input.id, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: this.identifier, value: input.value && input.value.toString(), checked: Boolean(input.value), disabled: this.readonly || this.disabled || input.disabled, required: this.required, indeterminate: input.value === null, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
153
154
|
if (el !== null)
|
|
154
155
|
this.inputs[index] = el;
|
|
155
156
|
} }), h("label", { htmlFor: input.id }, input.title)))))));
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
font-style: italic;
|
|
125
129
|
}
|
|
126
130
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
131
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
132
|
}
|
|
129
133
|
.mg-input__box:disabled {
|
|
130
134
|
opacity: 0.3;
|
|
@@ -145,8 +149,8 @@
|
|
|
145
149
|
}
|
|
146
150
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
151
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
152
|
+
border-top-right-radius: 0;
|
|
153
|
+
border-bottom-right-radius: 0;
|
|
150
154
|
}
|
|
151
155
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
156
|
outline-style: solid;
|
|
@@ -105,11 +105,14 @@ export class MgInputDate {
|
|
|
105
105
|
this.errorMessage = undefined;
|
|
106
106
|
}
|
|
107
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;
|
|
108
111
|
if (newValue !== undefined && newValue !== null && (typeof newValue !== 'string' || !dateRegExp.test(newValue))) {
|
|
109
112
|
throw new Error("<mg-input-date> props 'value' doesn't match pattern: yyyy-mm-dd");
|
|
110
113
|
}
|
|
111
114
|
else {
|
|
112
|
-
this.valueChange.emit(
|
|
115
|
+
this.valueChange.emit(newValue);
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -167,7 +170,7 @@ export class MgInputDate {
|
|
|
167
170
|
* @returns {HTMLElement} HTML Element
|
|
168
171
|
*/
|
|
169
172
|
render() {
|
|
170
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur,
|
|
173
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, ariaDescribedbyIDs: [], label: this.label, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, readonly: this.readonly, mgWidth: undefined, disabled: this.disabled, value: this.value, readonlyValue: localeDate(this.value, this.locale), tooltip: this.tooltip, helpText: this.helpText, errorMessage: this.errorMessage, isFieldset: false }, h("input", { type: "date", class: "mg-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, onInput: this.handleInput, onBlur: this.handleBlur, ref: el => {
|
|
171
174
|
if (el !== null)
|
|
172
175
|
this.input = el;
|
|
173
176
|
} })));
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
font-style: italic;
|
|
125
129
|
}
|
|
126
130
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
131
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
132
|
}
|
|
129
133
|
.mg-input__box:disabled {
|
|
130
134
|
opacity: 0.3;
|
|
@@ -145,8 +149,8 @@
|
|
|
145
149
|
}
|
|
146
150
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
151
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
152
|
+
border-top-right-radius: 0;
|
|
153
|
+
border-bottom-right-radius: 0;
|
|
150
154
|
}
|
|
151
155
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
156
|
outline-style: solid;
|
|
@@ -178,7 +178,7 @@ export class MgInputNumeric {
|
|
|
178
178
|
}
|
|
179
179
|
validateType(newValue) {
|
|
180
180
|
if (!types.includes(newValue)) {
|
|
181
|
-
throw new Error(`<mg-input-numeric> prop "type" must be one of
|
|
181
|
+
throw new Error(`<mg-input-numeric> prop "type" must be one of: ${types.join(', ')}`);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
validateIntegerLength(newValue) {
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
font-style: italic;
|
|
125
129
|
}
|
|
126
130
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
131
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
132
|
}
|
|
129
133
|
.mg-input__box:disabled {
|
|
130
134
|
opacity: 0.3;
|
|
@@ -145,8 +149,8 @@
|
|
|
145
149
|
}
|
|
146
150
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
151
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
152
|
+
border-top-right-radius: 0;
|
|
153
|
+
border-bottom-right-radius: 0;
|
|
150
154
|
}
|
|
151
155
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
156
|
outline-style: solid;
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -145,9 +149,6 @@ fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container {
|
|
|
145
149
|
display: flex;
|
|
146
150
|
align-items: top;
|
|
147
151
|
}
|
|
148
|
-
.mg-input__input-group.mg-input__input-group--disabled label {
|
|
149
|
-
opacity: 0.3;
|
|
150
|
-
}
|
|
151
152
|
|
|
152
153
|
/**
|
|
153
154
|
* A11Y
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
1
2
|
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
2
3
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
4
|
import { h } from '@stencil/core';
|
|
@@ -154,7 +155,7 @@ export class MgInputRadio {
|
|
|
154
155
|
* @returns {HTMLElement} HTML Element
|
|
155
156
|
*/
|
|
156
157
|
render() {
|
|
157
|
-
return (h(MgInput, { identifier: this.identifier, classList: this.classList, 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 } }, this.options.map((input, index) => (h("li", { 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 => {
|
|
158
|
+
return (h(MgInput, { identifier: this.identifier, classList: this.classList, 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 => {
|
|
158
159
|
if (el !== null)
|
|
159
160
|
this.inputs[index] = el;
|
|
160
161
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title)))))));
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
font-style: italic;
|
|
125
129
|
}
|
|
126
130
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
131
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
132
|
}
|
|
129
133
|
.mg-input__box:disabled {
|
|
130
134
|
opacity: 0.3;
|
|
@@ -145,8 +149,8 @@
|
|
|
145
149
|
}
|
|
146
150
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
151
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
152
|
+
border-top-right-radius: 0;
|
|
153
|
+
border-bottom-right-radius: 0;
|
|
150
154
|
}
|
|
151
155
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
156
|
outline-style: solid;
|
|
@@ -119,13 +119,17 @@ export class MgInputSelect {
|
|
|
119
119
|
this.valueChange.emit(newValue);
|
|
120
120
|
}
|
|
121
121
|
validateItems(newValue) {
|
|
122
|
+
// Empty options
|
|
123
|
+
if (newValue.length === 0) {
|
|
124
|
+
this.options = [];
|
|
125
|
+
}
|
|
122
126
|
// String array
|
|
123
|
-
if (allItemsAreString(newValue)) {
|
|
127
|
+
else if (allItemsAreString(newValue)) {
|
|
124
128
|
this.valueExist = newValue.includes(this.value);
|
|
125
129
|
this.options = newValue.map((item) => ({ title: item, value: item }));
|
|
126
130
|
}
|
|
127
131
|
// Object array
|
|
128
|
-
else if (newValue
|
|
132
|
+
else if (newValue.every(item => isOption(item))) {
|
|
129
133
|
this.valueExist = newValue.map(item => item.value).includes(this.value);
|
|
130
134
|
// Grouped object options
|
|
131
135
|
if (newValue.some(item => item.group !== undefined)) {
|
|
@@ -137,7 +141,7 @@ export class MgInputSelect {
|
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
else {
|
|
140
|
-
throw new Error('<mg-input-select> prop "items" is required
|
|
144
|
+
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.');
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
@@ -194,7 +198,7 @@ export class MgInputSelect {
|
|
|
194
198
|
if (el !== null)
|
|
195
199
|
this.input = el;
|
|
196
200
|
} }, (!this.placeholderHide || !this.valueExist) && ( // In case passed value does not match any option we display the placeholder
|
|
197
|
-
h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
|
|
201
|
+
h("option", { value: "", disabled: this.placeholderDisabled && this.valueExist }, this.placeholder)), this.options.map(option => option.group !== undefined ? (h("optgroup", { label: option.group }, option.options.map(optgroup => (h("option", { key: optgroup.title, value: optgroup.title, selected: JSON.stringify(this.value) === JSON.stringify(optgroup.value), disabled: optgroup.disabled }, optgroup.title))))) : (h("option", { value: option.title, selected: JSON.stringify(this.value) === JSON.stringify(option.value), disabled: option.disabled }, option.title))))));
|
|
198
202
|
}
|
|
199
203
|
static get is() { return "mg-input-select"; }
|
|
200
204
|
static get encapsulation() { return "shadow"; }
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
font-style: italic;
|
|
125
129
|
}
|
|
126
130
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
131
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
132
|
}
|
|
129
133
|
.mg-input__box:disabled {
|
|
130
134
|
opacity: 0.3;
|
|
@@ -145,8 +149,8 @@
|
|
|
145
149
|
}
|
|
146
150
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
151
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
152
|
+
border-top-right-radius: 0;
|
|
153
|
+
border-bottom-right-radius: 0;
|
|
150
154
|
}
|
|
151
155
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
156
|
outline-style: solid;
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -124,7 +128,7 @@
|
|
|
124
128
|
font-style: italic;
|
|
125
129
|
}
|
|
126
130
|
.mg-input__box:focus {
|
|
127
|
-
box-shadow: 0 0 0.6rem
|
|
131
|
+
box-shadow: 0 0 0.6rem hsl(var(--mg-inputs-color-shadow-focus-hsl), 0.5);
|
|
128
132
|
}
|
|
129
133
|
.mg-input__box:disabled {
|
|
130
134
|
opacity: 0.3;
|
|
@@ -145,8 +149,8 @@
|
|
|
145
149
|
}
|
|
146
150
|
.mg-input.mg-input--is-input-group-append .mg-input__box {
|
|
147
151
|
margin-right: -0.1rem;
|
|
148
|
-
border-top-right-radius: 0
|
|
149
|
-
border-bottom-right-radius: 0
|
|
152
|
+
border-top-right-radius: 0;
|
|
153
|
+
border-bottom-right-radius: 0;
|
|
150
154
|
}
|
|
151
155
|
.mg-input.mg-input--is-input-group-append .mg-input__box:focus-visible {
|
|
152
156
|
outline-style: solid;
|
|
@@ -41,7 +41,7 @@ export class MgInputTextarea {
|
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
43
|
* Get pattern validity
|
|
44
|
-
* Pattern is not defined on textarea field
|
|
44
|
+
* Pattern is not defined on textarea field: https://developer.mozilla.org/fr/docs/Web/HTML/Element/Textarea
|
|
45
45
|
*
|
|
46
46
|
* @returns {boolean} is pattern valid
|
|
47
47
|
*/
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
.mg-input__input {
|
|
74
74
|
display: flex;
|
|
75
75
|
/* Manage space between input and first message */
|
|
76
|
+
/* Set custom opacity on disabled input */
|
|
76
77
|
}
|
|
77
78
|
.mg-input__input mg-tooltip {
|
|
78
79
|
margin-top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
@@ -83,6 +84,9 @@
|
|
|
83
84
|
.mg-input__input + .mg-input__help-text, .mg-input__input + .mg-input__error {
|
|
84
85
|
margin-top: 0.5rem;
|
|
85
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 {
|
|
88
|
+
opacity: var(--mg-disabled-opacity);
|
|
89
|
+
}
|
|
86
90
|
|
|
87
91
|
.mg-input__error {
|
|
88
92
|
display: inline-block;
|
|
@@ -226,8 +230,4 @@
|
|
|
226
230
|
}
|
|
227
231
|
.mg-input.mg-input--toggle-readonly.mg-input--toggle-is-active .mg-input__toggle-item-container:last-of-type {
|
|
228
232
|
display: flex;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.mg-input.mg-input--toggle-disabled .mg-input__button-toggle {
|
|
232
|
-
opacity: 0.3;
|
|
233
233
|
}
|
|
@@ -6,3 +6,20 @@ export var Direction;
|
|
|
6
6
|
Direction["VERTICAL"] = "vertical";
|
|
7
7
|
Direction["HORIZONTAL"] = "horizontal";
|
|
8
8
|
})(Direction || (Direction = {}));
|
|
9
|
+
/**
|
|
10
|
+
* More item type guard
|
|
11
|
+
*
|
|
12
|
+
* @param {unknown} element element to control
|
|
13
|
+
* @returns {boolean} truthy if element is more-item
|
|
14
|
+
*/
|
|
15
|
+
export const isMoreItem = (element) => {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
const item = element;
|
|
18
|
+
return (item === undefined ||
|
|
19
|
+
(typeof item === 'object' &&
|
|
20
|
+
(typeof item.size === 'string' || typeof ((_a = item.mgIcon) === null || _a === void 0 ? void 0 : _a.icon) === 'string' || typeof ((_b = item.slotLabel) === null || _b === void 0 ? void 0 : _b.label) === 'string' || typeof ((_c = item.slotLabel) === null || _c === void 0 ? void 0 : _c.display) === 'boolean')));
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* List of all possibles sizes
|
|
24
|
+
*/
|
|
25
|
+
export const sizes = ['regular', 'medium', 'large'];
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A11Y
|
|
3
|
+
*/
|
|
4
|
+
.sr-only {
|
|
5
|
+
border: 0 !important;
|
|
6
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
7
|
+
-webkit-clip-path: inset(50%) !important;
|
|
8
|
+
clip-path: inset(50%) !important;
|
|
9
|
+
height: 1px !important;
|
|
10
|
+
margin: -1px !important;
|
|
11
|
+
overflow: hidden !important;
|
|
12
|
+
padding: 0 !important;
|
|
13
|
+
position: absolute !important;
|
|
14
|
+
width: 1px !important;
|
|
15
|
+
white-space: nowrap !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
*:focus:not(:focus-visible) {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (prefers-reduced-motion) {
|
|
23
|
+
.mg-a11y-animation {
|
|
24
|
+
animation: none !important;
|
|
25
|
+
transition: none !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
1
28
|
:host {
|
|
2
29
|
display: flex;
|
|
3
30
|
background-color: hsl(var(--mg-menu-background-color-hsl, var(--color-light)));
|