@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
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js
CHANGED
|
@@ -15,13 +15,14 @@ export class MgIllustratedMessage {
|
|
|
15
15
|
*/
|
|
16
16
|
componentDidLoad() {
|
|
17
17
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
18
|
-
const
|
|
18
|
+
const slottedIllustrations = this.element.querySelectorAll('[slot="illustration"]');
|
|
19
19
|
if (!isTagName(this.element.querySelector('[slot="title"]'), headingTags)) {
|
|
20
20
|
throw new Error(`<mg-illustrated-message> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
21
21
|
}
|
|
22
|
-
else if (
|
|
23
|
-
throw new Error(
|
|
22
|
+
else if (slottedIllustrations.length !== 1) {
|
|
23
|
+
throw new Error('<mg-illustrated-message> Slotted illustration must be present and unique.');
|
|
24
24
|
}
|
|
25
|
+
slottedIllustrations[0].setAttribute('aria-hidden', 'true');
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Render
|
|
@@ -81,6 +81,13 @@
|
|
|
81
81
|
top: 0;
|
|
82
82
|
right: 0;
|
|
83
83
|
}
|
|
84
|
+
.mg-message ::slotted(*) {
|
|
85
|
+
--mg-card-border: var(--mg-card-border-default);
|
|
86
|
+
--mg-card-padding: var(--mg-card-padding-default);
|
|
87
|
+
--mg-card-border-radius: var(--mg-card-border-radius-default);
|
|
88
|
+
--mg-card-background: var(--mg-card-background-default);
|
|
89
|
+
--mg-card-box-shadow: var(--mg-card-box-shadow-default);
|
|
90
|
+
}
|
|
84
91
|
|
|
85
92
|
.mg-message,
|
|
86
93
|
mg-message {
|
|
@@ -13,22 +13,49 @@ export class MgMessage {
|
|
|
13
13
|
this.closeButtonId = '';
|
|
14
14
|
// Stored timer setted when hide action is run from setTimeOut
|
|
15
15
|
this.storedTimer = null;
|
|
16
|
+
// Manage hover
|
|
17
|
+
this.isFocused = false;
|
|
18
|
+
this.isHovered = false;
|
|
16
19
|
/**
|
|
17
|
-
*
|
|
20
|
+
* Set timer
|
|
21
|
+
*
|
|
22
|
+
* @returns {void}
|
|
18
23
|
*/
|
|
19
|
-
this.
|
|
20
|
-
this.hide = true;
|
|
24
|
+
this.setTimer = () => {
|
|
25
|
+
this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
|
|
21
26
|
};
|
|
22
27
|
/**
|
|
23
|
-
*
|
|
28
|
+
* Clear timer
|
|
29
|
+
*
|
|
30
|
+
* @returns {void}
|
|
24
31
|
*/
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
this.clearTimer = () => {
|
|
33
|
+
clearTimeout(this.storedTimer);
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Event to add on element
|
|
37
|
+
*
|
|
38
|
+
* @param {MouseEvent | FocusEvent} event event
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/
|
|
41
|
+
this.timerEvents = (event) => {
|
|
42
|
+
this.clearTimer();
|
|
43
|
+
const isMouseEvent = event.type === 'mouseenter';
|
|
44
|
+
// Needed to ensure we don't start the timer
|
|
45
|
+
this[isMouseEvent ? 'isHovered' : 'isFocused'] = true;
|
|
46
|
+
// Restart timer when loose focus AND mouse leave
|
|
47
|
+
this.element.addEventListener(isMouseEvent ? 'mouseleave' : 'focusout', eventOut => {
|
|
48
|
+
this[eventOut.type === 'mouseleave' ? 'isHovered' : 'isFocused'] = false;
|
|
49
|
+
// Start timer if needed
|
|
50
|
+
if (!this.isFocused && !this.isHovered)
|
|
51
|
+
this.setTimer();
|
|
52
|
+
}, { once: true });
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Handle close button
|
|
56
|
+
*/
|
|
57
|
+
this.handleClose = () => {
|
|
58
|
+
this.hide = true;
|
|
32
59
|
};
|
|
33
60
|
/**
|
|
34
61
|
* Get icon corresponding to variant
|
|
@@ -64,7 +91,7 @@ export class MgMessage {
|
|
|
64
91
|
}
|
|
65
92
|
validateVariant(newValue, oldValue) {
|
|
66
93
|
if (!variants.includes(newValue)) {
|
|
67
|
-
throw new Error(`<mg-message> prop "variant" must be one of
|
|
94
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants.join(', ')}`);
|
|
68
95
|
}
|
|
69
96
|
else {
|
|
70
97
|
if (oldValue !== undefined) {
|
|
@@ -83,12 +110,26 @@ export class MgMessage {
|
|
|
83
110
|
if (newValue) {
|
|
84
111
|
this.componentHide.emit();
|
|
85
112
|
this.classList.add(this.classHide);
|
|
113
|
+
// Remove event Listener
|
|
114
|
+
['focusin', 'mouseenter'].forEach(event => {
|
|
115
|
+
this.element.removeEventListener(event, this.timerEvents);
|
|
116
|
+
});
|
|
117
|
+
// Clear Timer
|
|
118
|
+
this.clearTimer();
|
|
86
119
|
}
|
|
87
120
|
else {
|
|
88
121
|
this.componentShow.emit();
|
|
89
122
|
this.classList.delete(this.classHide);
|
|
123
|
+
// If delay is set
|
|
124
|
+
if (this.delay > 1) {
|
|
125
|
+
// Start timer
|
|
126
|
+
this.setTimer();
|
|
127
|
+
// Stop timer when get focus or mouse enter
|
|
128
|
+
['focusin', 'mouseenter'].forEach(event => {
|
|
129
|
+
this.element.addEventListener(event, this.timerEvents);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
90
132
|
}
|
|
91
|
-
this.hideWithDelay();
|
|
92
133
|
}
|
|
93
134
|
/*************
|
|
94
135
|
* Lifecycle *
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
left: 0;
|
|
16
16
|
z-index: 2000;
|
|
17
17
|
padding: 2rem 0;
|
|
18
|
-
background-color:
|
|
18
|
+
background-color: hsl(var(--color-light), 0.85);
|
|
19
19
|
}
|
|
20
20
|
.mg-modal mg-card {
|
|
21
21
|
display: flex;
|
|
@@ -55,4 +55,11 @@
|
|
|
55
55
|
}
|
|
56
56
|
.mg-modal.mg-modal--hide {
|
|
57
57
|
display: none;
|
|
58
|
+
}
|
|
59
|
+
.mg-modal ::slotted(*) {
|
|
60
|
+
--mg-card-border: var(--mg-card-border-default);
|
|
61
|
+
--mg-card-padding: var(--mg-card-padding-default);
|
|
62
|
+
--mg-card-border-radius: var(--mg-card-border-radius-default);
|
|
63
|
+
--mg-card-background: var(--mg-card-background-default);
|
|
64
|
+
--mg-card-box-shadow: var(--mg-card-box-shadow-default);
|
|
58
65
|
}
|
|
@@ -59,6 +59,7 @@ export class MgPagination {
|
|
|
59
59
|
};
|
|
60
60
|
this.identifier = createID('mg-pagination');
|
|
61
61
|
this.label = undefined;
|
|
62
|
+
this.hideNavigationLabels = undefined;
|
|
62
63
|
this.totalPages = 1;
|
|
63
64
|
this.currentPage = 1;
|
|
64
65
|
}
|
|
@@ -103,7 +104,7 @@ export class MgPagination {
|
|
|
103
104
|
render() {
|
|
104
105
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
105
106
|
// eslint-disable-next-line react/jsx-no-bind
|
|
106
|
-
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat" }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
107
|
+
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && this.messages.general[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
107
108
|
return (h("nav", { "aria-label": this.label, id: this.identifier, class: "mg-pagination" }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.messages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "sr-only" }, this.messages.pagination.page, " ", this.currentPage), h("span", null, "/ ", this.totalPages, " ", this.totalPages > 1 ? this.messages.pagination.pages : this.messages.pagination.page), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT)));
|
|
108
109
|
}
|
|
109
110
|
static get is() { return "mg-pagination"; }
|
|
@@ -155,6 +156,23 @@ export class MgPagination {
|
|
|
155
156
|
"attribute": "label",
|
|
156
157
|
"reflect": false
|
|
157
158
|
},
|
|
159
|
+
"hideNavigationLabels": {
|
|
160
|
+
"type": "boolean",
|
|
161
|
+
"mutable": false,
|
|
162
|
+
"complexType": {
|
|
163
|
+
"original": "boolean",
|
|
164
|
+
"resolved": "boolean",
|
|
165
|
+
"references": {}
|
|
166
|
+
},
|
|
167
|
+
"required": false,
|
|
168
|
+
"optional": false,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": "Hide navigation label"
|
|
172
|
+
},
|
|
173
|
+
"attribute": "hide-navigation-labels",
|
|
174
|
+
"reflect": false
|
|
175
|
+
},
|
|
158
176
|
"totalPages": {
|
|
159
177
|
"type": "number",
|
|
160
178
|
"mutable": false,
|
|
@@ -45,4 +45,11 @@
|
|
|
45
45
|
flex-wrap: wrap;
|
|
46
46
|
gap: 1rem;
|
|
47
47
|
margin-left: auto;
|
|
48
|
+
}
|
|
49
|
+
.mg-panel ::slotted(*) {
|
|
50
|
+
--mg-card-border: var(--mg-card-border-default);
|
|
51
|
+
--mg-card-padding: var(--mg-card-padding-default);
|
|
52
|
+
--mg-card-border-radius: var(--mg-card-border-radius-default);
|
|
53
|
+
--mg-card-background: var(--mg-card-background-default);
|
|
54
|
+
--mg-card-box-shadow: var(--mg-card-box-shadow-default);
|
|
48
55
|
}
|
|
@@ -76,13 +76,13 @@ export class MgPanel {
|
|
|
76
76
|
if (this.titleEditable && !this.isEditing) {
|
|
77
77
|
return [
|
|
78
78
|
collapseButton(),
|
|
79
|
-
h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
79
|
+
h("mg-button", { key: "edit-button", "is-icon": true, variant: "flat", label: this.messages.panel.editLabel, onClick: this.handleEditButton, identifier: `${this.identifier}-edit-button` }, h("mg-icon", { icon: "pen" })),
|
|
80
80
|
];
|
|
81
81
|
}
|
|
82
82
|
if (this.titleEditable && this.isEditing) {
|
|
83
83
|
return [
|
|
84
84
|
collapseButton(),
|
|
85
|
-
h("mg-input-text", { label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` }, h("mg-icon", { icon: "check" }))),
|
|
85
|
+
h("mg-input-text", { key: "edition-input", label: this.messages.panel.editLabel, "label-hide": true, value: this.panelTitle, "onValue-change": this.handleUpdateTitle, displayCharacterLeft: false, pattern: this.titlePattern, "pattern-error-message": this.titlePatternErrorMessage, identifier: `${this.identifier}-edition-input`, ref: el => (this.editInputElement = el) }, h("mg-button", { slot: "append-input", label: this.messages.general.cancel, "is-icon": true, variant: "secondary", onClick: this.handleCancelEditButton, identifier: `${this.identifier}-edition-button-cancel` }, h("mg-icon", { icon: "cross" })), h("mg-button", { slot: "append-input", label: this.messages.general.confirm, "is-icon": true, variant: "secondary", onClick: this.handleValidateEditButton, identifier: `${this.identifier}-edition-button-validate` }, h("mg-icon", { icon: "check" }))),
|
|
86
86
|
];
|
|
87
87
|
}
|
|
88
88
|
return collapseButton();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
:host {
|
|
2
|
-
--mg-card-padding: 1.5rem;
|
|
2
|
+
--mg-card-padding: var(--mg-popover-padding-vertical, 1.5rem) var(--mg-popover-padding-horizontal, var(--mg-popover-padding-vertical, 1.5rem));
|
|
3
3
|
--mg-card-border: none;
|
|
4
4
|
--mg-card-border-radius: 0.5rem;
|
|
5
5
|
--mg-card-background: hsl(var(--mg-popover-background-color));
|
|
@@ -12,11 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
.mg-popover {
|
|
14
14
|
display: none;
|
|
15
|
+
padding: 1rem;
|
|
15
16
|
z-index: 2000;
|
|
16
17
|
color: hsl(var(--mg-popover-font-color));
|
|
17
18
|
}
|
|
18
19
|
.mg-popover mg-card {
|
|
19
|
-
|
|
20
|
+
position: relative;
|
|
20
21
|
}
|
|
21
22
|
.mg-popover[data-show] {
|
|
22
23
|
display: block;
|
|
@@ -27,35 +28,91 @@
|
|
|
27
28
|
margin-top: calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);
|
|
28
29
|
margin-left: 3rem;
|
|
29
30
|
}
|
|
30
|
-
.mg-popover__arrow, .mg-popover__arrow::before {
|
|
31
|
-
position: absolute;
|
|
32
|
-
width: 2rem;
|
|
33
|
-
height: 2rem;
|
|
34
|
-
z-index: 2000;
|
|
35
|
-
background: hsl(var(--mg-popover-background-color));
|
|
36
|
-
}
|
|
37
31
|
.mg-popover__arrow {
|
|
32
|
+
position: absolute;
|
|
38
33
|
visibility: hidden;
|
|
34
|
+
width: calc(3rem + 2 * var(--mg-card-border-radius) + 2rem);
|
|
35
|
+
height: calc(3rem + 2 * var(--mg-card-border-radius) + 2rem);
|
|
39
36
|
}
|
|
40
|
-
.mg-popover__arrow
|
|
37
|
+
.mg-popover__arrow:before {
|
|
41
38
|
visibility: visible;
|
|
42
39
|
content: "";
|
|
43
|
-
|
|
40
|
+
position: absolute;
|
|
41
|
+
}
|
|
42
|
+
.mg-popover[data-popper-placement^=top] > .mg-popover__arrow, .mg-popover[data-popper-placement^=bottom] > .mg-popover__arrow {
|
|
43
|
+
height: 1rem;
|
|
44
|
+
}
|
|
45
|
+
.mg-popover[data-popper-placement^=top] > .mg-popover__arrow:before, .mg-popover[data-popper-placement^=bottom] > .mg-popover__arrow:before {
|
|
46
|
+
left: calc(var(--mg-card-border-radius) + 1rem);
|
|
47
|
+
border-right: calc(3rem / 2) solid transparent;
|
|
48
|
+
border-left: calc(3rem / 2) solid transparent;
|
|
44
49
|
}
|
|
45
50
|
.mg-popover[data-popper-placement^=top] > .mg-popover__arrow {
|
|
46
|
-
bottom:
|
|
51
|
+
bottom: 0.1rem;
|
|
52
|
+
filter: drop-shadow(0 0.5rem 0.25rem hsl(var(--color-dark), 0.15));
|
|
53
|
+
}
|
|
54
|
+
.mg-popover[data-popper-placement^=top] > .mg-popover__arrow:before {
|
|
55
|
+
border-top: 1rem solid hsl(var(--mg-popover-background-color));
|
|
47
56
|
}
|
|
48
57
|
.mg-popover[data-popper-placement^=bottom] > .mg-popover__arrow {
|
|
49
|
-
top:
|
|
58
|
+
top: 0.1rem;
|
|
59
|
+
filter: drop-shadow(0 -0.5rem 0.25rem hsl(var(--color-dark), 0.15));
|
|
60
|
+
}
|
|
61
|
+
.mg-popover[data-popper-placement^=bottom] > .mg-popover__arrow:before {
|
|
62
|
+
border-bottom: 1rem solid hsl(var(--mg-popover-background-color));
|
|
63
|
+
}
|
|
64
|
+
.mg-popover[data-popper-placement^=left] > .mg-popover__arrow, .mg-popover[data-popper-placement^=right] > .mg-popover__arrow {
|
|
65
|
+
width: 1rem;
|
|
66
|
+
}
|
|
67
|
+
.mg-popover[data-popper-placement^=left] > .mg-popover__arrow:before, .mg-popover[data-popper-placement^=right] > .mg-popover__arrow:before {
|
|
68
|
+
top: calc(var(--mg-card-border-radius) + 1rem);
|
|
69
|
+
border-top: calc(3rem / 2) solid transparent;
|
|
70
|
+
border-bottom: calc(3rem / 2) solid transparent;
|
|
50
71
|
}
|
|
51
72
|
.mg-popover[data-popper-placement^=left] > .mg-popover__arrow {
|
|
52
|
-
right:
|
|
73
|
+
right: 0.1rem;
|
|
74
|
+
filter: drop-shadow(0.5rem 0 0.25rem hsl(var(--color-dark), 0.15));
|
|
75
|
+
}
|
|
76
|
+
.mg-popover[data-popper-placement^=left] > .mg-popover__arrow:before {
|
|
77
|
+
border-left: 1rem solid hsl(var(--mg-popover-background-color));
|
|
53
78
|
}
|
|
54
79
|
.mg-popover[data-popper-placement^=right] > .mg-popover__arrow {
|
|
55
|
-
left:
|
|
80
|
+
left: 0.1rem;
|
|
81
|
+
filter: drop-shadow(-0.5rem 0 0.25rem hsl(var(--color-dark), 0.15));
|
|
82
|
+
}
|
|
83
|
+
.mg-popover[data-popper-placement^=right] > .mg-popover__arrow:before {
|
|
84
|
+
border-right: 1rem solid hsl(var(--mg-popover-background-color));
|
|
85
|
+
}
|
|
86
|
+
.mg-popover[data-popper-placement^=left-start], .mg-popover[data-popper-placement^=left-end], .mg-popover[data-popper-placement^=right-start], .mg-popover[data-popper-placement^=right-end] {
|
|
87
|
+
padding: 0 1rem;
|
|
88
|
+
}
|
|
89
|
+
.mg-popover[data-popper-placement^=left-start] > .mg-popover__arrow, .mg-popover[data-popper-placement^=left-end] > .mg-popover__arrow, .mg-popover[data-popper-placement^=right-start] > .mg-popover__arrow, .mg-popover[data-popper-placement^=right-end] > .mg-popover__arrow {
|
|
90
|
+
height: calc(3rem + 2 * var(--mg-card-border-radius));
|
|
91
|
+
}
|
|
92
|
+
.mg-popover[data-popper-placement^=left-start] > .mg-popover__arrow:before, .mg-popover[data-popper-placement^=left-end] > .mg-popover__arrow:before, .mg-popover[data-popper-placement^=right-start] > .mg-popover__arrow:before, .mg-popover[data-popper-placement^=right-end] > .mg-popover__arrow:before {
|
|
93
|
+
top: var(--mg-card-border-radius);
|
|
56
94
|
}
|
|
57
95
|
.mg-popover__title ::slotted([slot=title]) {
|
|
58
96
|
margin: 0 0 1rem !important;
|
|
59
97
|
font-size: var(--mg-popover-title-font-size) !important;
|
|
60
98
|
font-weight: 600;
|
|
99
|
+
}
|
|
100
|
+
.mg-popover--arrow-hide.mg-popover[data-popper-placement^=top] {
|
|
101
|
+
padding-bottom: 0;
|
|
102
|
+
}
|
|
103
|
+
.mg-popover--arrow-hide.mg-popover[data-popper-placement^=bottom] {
|
|
104
|
+
padding-top: 0;
|
|
105
|
+
}
|
|
106
|
+
.mg-popover--arrow-hide.mg-popover[data-popper-placement$=end], .mg-popover--arrow-hide.mg-popover[data-popper-placement^=left] {
|
|
107
|
+
padding-right: 0;
|
|
108
|
+
}
|
|
109
|
+
.mg-popover--arrow-hide.mg-popover[data-popper-placement$=start], .mg-popover--arrow-hide.mg-popover[data-popper-placement^=right] {
|
|
110
|
+
padding-left: 0;
|
|
111
|
+
}
|
|
112
|
+
.mg-popover ::slotted(*) {
|
|
113
|
+
--mg-card-border: var(--mg-card-border-default);
|
|
114
|
+
--mg-card-padding: var(--mg-card-padding-default);
|
|
115
|
+
--mg-card-border-radius: var(--mg-card-border-radius-default);
|
|
116
|
+
--mg-card-background: var(--mg-card-background-default);
|
|
117
|
+
--mg-card-box-shadow: var(--mg-card-box-shadow-default);
|
|
61
118
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Host, h } from '@stencil/core';
|
|
2
|
-
import { createID, isTagName } from '../../../utils/components.utils';
|
|
2
|
+
import { createID, isTagName, getWindows, ClassList } from '../../../utils/components.utils';
|
|
3
3
|
import { createPopper } from '@popperjs/core';
|
|
4
4
|
import { initLocales } from '../../../locales';
|
|
5
5
|
export class MgPopover {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.closeButtonId = '';
|
|
8
|
+
// Classes
|
|
9
|
+
this.classArrowHide = `mg-popover--arrow-hide`;
|
|
8
10
|
/**
|
|
9
11
|
* Check if clicked outside of component
|
|
10
12
|
*
|
|
@@ -12,7 +14,10 @@ export class MgPopover {
|
|
|
12
14
|
* @returns {void}
|
|
13
15
|
*/
|
|
14
16
|
this.clickOutside = (event) => {
|
|
15
|
-
|
|
17
|
+
var _a;
|
|
18
|
+
if (!this.disabled &&
|
|
19
|
+
event.target.closest('mg-popover') !== this.element &&
|
|
20
|
+
!(((_a = event.target.closest(`[data-mg-popover-guard]`)) === null || _a === void 0 ? void 0 : _a.dataset.mgPopoverGuard) === this.identifier)) {
|
|
16
21
|
this.display = false;
|
|
17
22
|
}
|
|
18
23
|
};
|
|
@@ -23,7 +28,7 @@ export class MgPopover {
|
|
|
23
28
|
*/
|
|
24
29
|
this.show = () => {
|
|
25
30
|
// Make the popover visible
|
|
26
|
-
this.popover.
|
|
31
|
+
this.popover.dataset.show = '';
|
|
27
32
|
// Enable the event listeners
|
|
28
33
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
29
34
|
// Update its position
|
|
@@ -31,7 +36,9 @@ export class MgPopover {
|
|
|
31
36
|
// hide when click outside
|
|
32
37
|
// setTimeout is used to prevent event to trigger after creation
|
|
33
38
|
setTimeout(() => {
|
|
34
|
-
|
|
39
|
+
this.windows.forEach((localWindow) => {
|
|
40
|
+
localWindow.addEventListener('click', this.clickOutside, false);
|
|
41
|
+
});
|
|
35
42
|
}, 0);
|
|
36
43
|
};
|
|
37
44
|
/**
|
|
@@ -45,7 +52,9 @@ export class MgPopover {
|
|
|
45
52
|
// Disable the event listeners
|
|
46
53
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
47
54
|
// Remove event listener
|
|
48
|
-
|
|
55
|
+
this.windows.forEach((localWindow) => {
|
|
56
|
+
localWindow.removeEventListener('click', this.clickOutside, false);
|
|
57
|
+
});
|
|
49
58
|
};
|
|
50
59
|
/**
|
|
51
60
|
* Handle action for close button
|
|
@@ -57,9 +66,17 @@ export class MgPopover {
|
|
|
57
66
|
};
|
|
58
67
|
this.identifier = createID('mg-popover');
|
|
59
68
|
this.placement = 'bottom';
|
|
69
|
+
this.arrowHide = false;
|
|
60
70
|
this.closeButton = false;
|
|
61
71
|
this.display = false;
|
|
62
72
|
this.disabled = false;
|
|
73
|
+
this.classList = new ClassList(['mg-popover']);
|
|
74
|
+
}
|
|
75
|
+
validateArrowHide(newValue) {
|
|
76
|
+
if (newValue)
|
|
77
|
+
this.classList.add(this.classArrowHide);
|
|
78
|
+
else
|
|
79
|
+
this.classList.delete(this.classArrowHide);
|
|
63
80
|
}
|
|
64
81
|
handleDisplay(newValue) {
|
|
65
82
|
if (newValue) {
|
|
@@ -79,8 +96,11 @@ export class MgPopover {
|
|
|
79
96
|
* @returns {void} timeout
|
|
80
97
|
*/
|
|
81
98
|
componentWillLoad() {
|
|
99
|
+
// Get windows to attach events
|
|
100
|
+
this.windows = getWindows(window);
|
|
82
101
|
// Get locales
|
|
83
102
|
this.messages = initLocales(this.element).messages;
|
|
103
|
+
this.validateArrowHide(this.arrowHide);
|
|
84
104
|
}
|
|
85
105
|
/**
|
|
86
106
|
* Check if component props are well configured on init
|
|
@@ -112,11 +132,22 @@ export class MgPopover {
|
|
|
112
132
|
{
|
|
113
133
|
name: 'offset',
|
|
114
134
|
options: {
|
|
115
|
-
offset: [0,
|
|
135
|
+
offset: [0, 0],
|
|
116
136
|
},
|
|
117
137
|
},
|
|
118
138
|
],
|
|
119
139
|
});
|
|
140
|
+
if (this.resizeObserver === undefined) {
|
|
141
|
+
// add resize observer
|
|
142
|
+
this.resizeObserver = new ResizeObserver(entries => {
|
|
143
|
+
if (entries.some(entrie => entrie.target.getAttribute('slot') !== null)) {
|
|
144
|
+
this.popper.update();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
Array.from(this.element.querySelectorAll('[slot]')).forEach(element => {
|
|
148
|
+
this.resizeObserver.observe(element);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
120
151
|
// Add events to toggle display
|
|
121
152
|
interactiveElement.addEventListener('click', () => {
|
|
122
153
|
if (!this.disabled)
|
|
@@ -135,7 +166,7 @@ export class MgPopover {
|
|
|
135
166
|
* @returns {HTMLElement} HTML Element
|
|
136
167
|
*/
|
|
137
168
|
render() {
|
|
138
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class:
|
|
169
|
+
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: this.classList.join() }, h("mg-card", null, this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), !this.arrowHide && h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
139
170
|
}
|
|
140
171
|
static get is() { return "mg-popover"; }
|
|
141
172
|
static get encapsulation() { return "shadow"; }
|
|
@@ -192,6 +223,24 @@ export class MgPopover {
|
|
|
192
223
|
"reflect": false,
|
|
193
224
|
"defaultValue": "'bottom'"
|
|
194
225
|
},
|
|
226
|
+
"arrowHide": {
|
|
227
|
+
"type": "boolean",
|
|
228
|
+
"mutable": false,
|
|
229
|
+
"complexType": {
|
|
230
|
+
"original": "boolean",
|
|
231
|
+
"resolved": "boolean",
|
|
232
|
+
"references": {}
|
|
233
|
+
},
|
|
234
|
+
"required": false,
|
|
235
|
+
"optional": false,
|
|
236
|
+
"docs": {
|
|
237
|
+
"tags": [],
|
|
238
|
+
"text": "Hide popover arrow"
|
|
239
|
+
},
|
|
240
|
+
"attribute": "arrow-hide",
|
|
241
|
+
"reflect": false,
|
|
242
|
+
"defaultValue": "false"
|
|
243
|
+
},
|
|
195
244
|
"closeButton": {
|
|
196
245
|
"type": "boolean",
|
|
197
246
|
"mutable": false,
|
|
@@ -248,6 +297,11 @@ export class MgPopover {
|
|
|
248
297
|
}
|
|
249
298
|
};
|
|
250
299
|
}
|
|
300
|
+
static get states() {
|
|
301
|
+
return {
|
|
302
|
+
"classList": {}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
251
305
|
static get events() {
|
|
252
306
|
return [{
|
|
253
307
|
"method": "displayChange",
|
|
@@ -269,6 +323,9 @@ export class MgPopover {
|
|
|
269
323
|
static get elementRef() { return "element"; }
|
|
270
324
|
static get watchers() {
|
|
271
325
|
return [{
|
|
326
|
+
"propName": "arrowHide",
|
|
327
|
+
"methodName": "validateArrowHide"
|
|
328
|
+
}, {
|
|
272
329
|
"propName": "display",
|
|
273
330
|
"methodName": "handleDisplay"
|
|
274
331
|
}];
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
1
2
|
import { h } from '@stencil/core';
|
|
2
3
|
import { initLocales } from '../../../locales';
|
|
3
4
|
export class MgSkipLinks {
|
|
4
5
|
constructor() {
|
|
6
|
+
/***********
|
|
7
|
+
* Methods *
|
|
8
|
+
**********/
|
|
9
|
+
/**
|
|
10
|
+
* Handle link click and emit go-to-anchor event
|
|
11
|
+
*
|
|
12
|
+
* @param {MouseEvent} event mouse event
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
this.handleLinkCLick = (event) => {
|
|
16
|
+
event.currentTarget.blur();
|
|
17
|
+
this.goToAnchor.emit(event.currentTarget.getAttribute('href'));
|
|
18
|
+
};
|
|
5
19
|
this.links = undefined;
|
|
6
20
|
}
|
|
7
21
|
validateLinks(links) {
|
|
@@ -29,7 +43,7 @@ export class MgSkipLinks {
|
|
|
29
43
|
* @returns {HTMLElement} HTML Element
|
|
30
44
|
*/
|
|
31
45
|
render() {
|
|
32
|
-
return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list" }, this.links.map(link => (h("li",
|
|
46
|
+
return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
33
47
|
}
|
|
34
48
|
static get is() { return "mg-skip-links"; }
|
|
35
49
|
static get encapsulation() { return "shadow"; }
|
|
@@ -67,6 +81,24 @@ export class MgSkipLinks {
|
|
|
67
81
|
}
|
|
68
82
|
};
|
|
69
83
|
}
|
|
84
|
+
static get events() {
|
|
85
|
+
return [{
|
|
86
|
+
"method": "goToAnchor",
|
|
87
|
+
"name": "go-to-anchor",
|
|
88
|
+
"bubbles": true,
|
|
89
|
+
"cancelable": true,
|
|
90
|
+
"composed": true,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": "Emited event when link is clicked"
|
|
94
|
+
},
|
|
95
|
+
"complexType": {
|
|
96
|
+
"original": "string",
|
|
97
|
+
"resolved": "string",
|
|
98
|
+
"references": {}
|
|
99
|
+
}
|
|
100
|
+
}];
|
|
101
|
+
}
|
|
70
102
|
static get elementRef() { return "element"; }
|
|
71
103
|
static get watchers() {
|
|
72
104
|
return [{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,
|
|
2
2
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular {
|
|
3
3
|
padding: 1rem 2rem;
|
|
4
|
+
height: calc();
|
|
4
5
|
}
|
|
5
6
|
.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,
|
|
6
7
|
.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button ::slotted([slot=label]),
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular,
|
|
9
10
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=label]),
|
|
10
11
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular ::slotted([slot=metadata]) {
|
|
11
|
-
font-size:
|
|
12
|
+
font-size: var(--font-size);
|
|
12
13
|
}
|
|
13
14
|
.mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal,
|
|
14
15
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-regular.mg-tabs__navigation-button--horizontal {
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,
|
|
23
24
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large {
|
|
24
25
|
padding: 1.5rem 3rem;
|
|
26
|
+
height: calc();
|
|
25
27
|
}
|
|
26
28
|
.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button,
|
|
27
29
|
.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button ::slotted([slot=label]),
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large,
|
|
30
32
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large ::slotted([slot=label]),
|
|
31
33
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large ::slotted([slot=metadata]) {
|
|
32
|
-
font-size:
|
|
34
|
+
font-size: calc(var(--font-size) + 0.2rem);
|
|
33
35
|
}
|
|
34
36
|
.mg-tabs.mg-tabs--size-large .mg-tabs__navigation-button.mg-tabs__navigation-button--horizontal,
|
|
35
37
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--size-large.mg-tabs__navigation-button--horizontal {
|
|
@@ -43,28 +45,31 @@
|
|
|
43
45
|
.mg-tabs__navigation-button {
|
|
44
46
|
display: flex;
|
|
45
47
|
align-items: center;
|
|
46
|
-
column-gap: 1rem;
|
|
48
|
+
column-gap: var(--mg-tabs-navigation-button-column-gap, 1rem);
|
|
47
49
|
background-color: unset;
|
|
48
50
|
border: none;
|
|
49
51
|
font-family: var(--font-family);
|
|
52
|
+
font-weight: 400;
|
|
50
53
|
color: hsl(var(--mg-tabs-color-hsl, var(--color-dark)));
|
|
51
54
|
line-height: var(--line-height);
|
|
52
55
|
text-decoration: none;
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
box-sizing: border-box;
|
|
53
58
|
cursor: pointer;
|
|
54
59
|
}
|
|
55
60
|
.mg-tabs__navigation-button:disabled, .mg-tabs__navigation-button--disabled {
|
|
56
61
|
cursor: default;
|
|
57
|
-
opacity:
|
|
62
|
+
opacity: var(--mg-disabled-opacity);
|
|
58
63
|
}
|
|
59
64
|
.mg-tabs__navigation-button:focus-visible {
|
|
60
65
|
z-index: 10;
|
|
61
66
|
}
|
|
62
|
-
.mg-tabs__navigation-button:hover:not(.mg-tabs__navigation-button--disabled), .mg-tabs__navigation-button:focus:not(.mg-tabs__navigation-button--disabled) {
|
|
63
|
-
background-color:
|
|
67
|
+
.mg-tabs__navigation-button:hover:not(.mg-tabs__navigation-button--disabled), .mg-tabs__navigation-button:focus-visible:not(.mg-tabs__navigation-button--disabled) {
|
|
68
|
+
background-color: hsl(var(--mg-tabs-focused-background-color-hsl), 0.1);
|
|
64
69
|
}
|
|
65
70
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--active {
|
|
66
71
|
color: hsl(var(--mg-tabs-color-active-hsl));
|
|
67
|
-
font-weight:
|
|
72
|
+
font-weight: 600;
|
|
68
73
|
}
|
|
69
74
|
.mg-tabs__navigation-button.mg-tabs__navigation-button--active.mg-tabs__navigation-button--horizontal {
|
|
70
75
|
border-bottom-color: hsl(var(--mg-tabs-border-color-active-hsl));
|