@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
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { O as OverflowBehaviorElements, D as Direction, i as isMoreItem, s as sizes, a as OverflowBehavior, d as defineCustomElement$2 } from './mg-menu-item2.js';
|
|
3
|
+
import { i as initLocales } from './index2.js';
|
|
4
|
+
import { d as defineCustomElement$6 } from './mg-badge2.js';
|
|
5
|
+
import { d as defineCustomElement$5 } from './mg-button2.js';
|
|
6
|
+
import { d as defineCustomElement$4 } from './mg-card2.js';
|
|
7
|
+
import { d as defineCustomElement$3 } from './mg-icon2.js';
|
|
8
|
+
import { d as defineCustomElement$1 } from './mg-popover2.js';
|
|
9
|
+
|
|
10
|
+
const mgMenuCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{display:flex;background-color:hsl(var(--mg-menu-background-color-hsl, var(--color-light)))}:host([direction=vertical]){flex-direction:column;height:100%;overflow-y:auto}";
|
|
11
|
+
|
|
12
|
+
const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
this.__attachShadow();
|
|
17
|
+
/************
|
|
18
|
+
* Internal *
|
|
19
|
+
************/
|
|
20
|
+
this.name = 'mg-menu';
|
|
21
|
+
this.menuItems = [];
|
|
22
|
+
this.focusedMenuItem = 0;
|
|
23
|
+
/**
|
|
24
|
+
* Close matching menu-item
|
|
25
|
+
*
|
|
26
|
+
* @param {HTMLElement} item menu-item to close
|
|
27
|
+
* @param {boolean} condition addionnal condition
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
this.closeMenuItem = (item, condition) => {
|
|
31
|
+
if (!this.isChildMenu && condition) {
|
|
32
|
+
item.expanded = false;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/*************
|
|
36
|
+
* Methods *
|
|
37
|
+
*************/
|
|
38
|
+
/**
|
|
39
|
+
* Store menu-items on component init and add listeners
|
|
40
|
+
*
|
|
41
|
+
* @returns {void}
|
|
42
|
+
*/
|
|
43
|
+
this.initMenuItemsListeners = () => {
|
|
44
|
+
// add listeners on menu item and edit index
|
|
45
|
+
this.menuItems.forEach((item, menuItemIndex) => {
|
|
46
|
+
['click', 'focus'].forEach(trigger => {
|
|
47
|
+
(item.shadowRoot.querySelector('button') || item.shadowRoot.querySelector('a')).addEventListener(trigger, () => {
|
|
48
|
+
this.focusedMenuItem = menuItemIndex;
|
|
49
|
+
// reset expanded on previous active menu item
|
|
50
|
+
this.menuItems.forEach((item, index) => {
|
|
51
|
+
this.closeMenuItem(item, index !== this.focusedMenuItem);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* render mg-menu-more
|
|
59
|
+
*
|
|
60
|
+
* @returns {HTMLElement} formated mg-menu-item element
|
|
61
|
+
*/
|
|
62
|
+
this.renderMgMenuMore = () => {
|
|
63
|
+
const moreElement = this.element.shadowRoot.querySelector(`[${OverflowBehaviorElements.MORE}]`);
|
|
64
|
+
this.menuItems.forEach((child) => {
|
|
65
|
+
const proxy = child.cloneNode(true);
|
|
66
|
+
moreElement.querySelector('mg-menu').appendChild(proxy);
|
|
67
|
+
});
|
|
68
|
+
const allMenuItem = Array.from(this.element.querySelectorAll('mg-menu-item:not([data-overflow-more])'));
|
|
69
|
+
Array.from(moreElement.querySelectorAll('mg-menu-item:not([data-overflow-more])')).forEach((proxy, index) => {
|
|
70
|
+
// manage click on proxy to mirror it on initial element
|
|
71
|
+
proxy.addEventListener('click', () => {
|
|
72
|
+
(allMenuItem[index].shadowRoot.querySelector('a') || allMenuItem[index].shadowRoot.querySelector('button')).dispatchEvent(new MouseEvent('click', { bubbles: true }));
|
|
73
|
+
});
|
|
74
|
+
// manage status change miror in proxy
|
|
75
|
+
allMenuItem[index].addEventListener('status-change', (event) => {
|
|
76
|
+
proxy.setAttribute('status', event.detail);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
this.element.appendChild(moreElement);
|
|
80
|
+
return this.element.querySelector(`[${OverflowBehaviorElements.MORE}]`);
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Render mg-menu-item more element for overflow behavior
|
|
84
|
+
*
|
|
85
|
+
* @returns {HTMLElement} rendered mg-menu-item more element
|
|
86
|
+
*/
|
|
87
|
+
this.renderMgMenuItemMore = () => {
|
|
88
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
89
|
+
return (h("mg-menu-item", { "data-overflow-more": true }, h("mg-icon", { icon: ((_b = (_a = this.moreitem) === null || _a === void 0 ? void 0 : _a.mgIcon) === null || _b === void 0 ? void 0 : _b.icon) || 'ellipsis-vertical', slot: "image" }), h("span", { class: { 'sr-only': !((_d = (_c = this.moreitem) === null || _c === void 0 ? void 0 : _c.slotLabel) === null || _d === void 0 ? void 0 : _d.display) }, slot: "label" }, ((_f = (_e = this.moreitem) === null || _e === void 0 ? void 0 : _e.slotLabel) === null || _f === void 0 ? void 0 : _f.label) || this.messages.moreLabel), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: (_g = this.moreitem) === null || _g === void 0 ? void 0 : _g.size })));
|
|
90
|
+
};
|
|
91
|
+
this.label = undefined;
|
|
92
|
+
this.direction = Direction.HORIZONTAL;
|
|
93
|
+
this.moreitem = undefined;
|
|
94
|
+
this.size = 'regular';
|
|
95
|
+
this.isChildMenu = undefined;
|
|
96
|
+
this.hasOverflow = false;
|
|
97
|
+
}
|
|
98
|
+
validateLabel(newValue) {
|
|
99
|
+
if (newValue === undefined) {
|
|
100
|
+
throw new Error(`<${this.name}> prop "label" is required.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
validateDirection(newValue) {
|
|
104
|
+
if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {
|
|
105
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}.`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
validateMoreItem(newValue) {
|
|
109
|
+
if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {
|
|
110
|
+
throw new Error(`<${this.name}> prop "moreitem" must be paired with direction ${Direction.HORIZONTAL}.`);
|
|
111
|
+
}
|
|
112
|
+
else if (newValue !== undefined && !isMoreItem(newValue)) {
|
|
113
|
+
throw new Error(`<${this.name}> prop "moreitem" must match MoreItemType.`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
validateSize(newValue) {
|
|
117
|
+
if (!sizes.includes(newValue)) {
|
|
118
|
+
throw new Error(`<${this.name}> prop "size" must be one of: ${sizes.join(', ')}.`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/*************
|
|
122
|
+
* Lifecycle *
|
|
123
|
+
*************/
|
|
124
|
+
/**
|
|
125
|
+
* Validate props
|
|
126
|
+
*
|
|
127
|
+
* @returns {void}
|
|
128
|
+
*/
|
|
129
|
+
componentWillLoad() {
|
|
130
|
+
this.messages = initLocales(this.element).messages.plusMenu;
|
|
131
|
+
// validation
|
|
132
|
+
this.validateDirection(this.direction);
|
|
133
|
+
this.validateLabel(this.label);
|
|
134
|
+
this.validateMoreItem(this.moreitem);
|
|
135
|
+
this.validateSize(this.size);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if component slots configuration
|
|
139
|
+
*
|
|
140
|
+
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
141
|
+
*/
|
|
142
|
+
componentDidLoad() {
|
|
143
|
+
// update props and states after componentDidLoad hook
|
|
144
|
+
// return a promise to process action only in the FIRST render().
|
|
145
|
+
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
146
|
+
return setTimeout(() => {
|
|
147
|
+
// store all menu-items
|
|
148
|
+
this.menuItems = Array.from(this.element.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
149
|
+
this.isChildMenu = this.element.closest('mg-menu-item') !== null;
|
|
150
|
+
this.hasOverflow = this.direction === Direction.HORIZONTAL && !this.isChildMenu;
|
|
151
|
+
if (this.hasOverflow && isMoreItem(this.moreitem))
|
|
152
|
+
this.overflowBehavior = new OverflowBehavior(this.element, this.renderMgMenuMore);
|
|
153
|
+
}, 0);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Check add listeners to childs
|
|
157
|
+
*
|
|
158
|
+
* @returns {void}
|
|
159
|
+
*/
|
|
160
|
+
componentDidRender() {
|
|
161
|
+
// add menu items listeners
|
|
162
|
+
this.initMenuItemsListeners();
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Disconnect overflow ResizeObserver
|
|
166
|
+
*
|
|
167
|
+
* @returns {void} run overflow resize obeserver disconnexion
|
|
168
|
+
*/
|
|
169
|
+
disconnectedCallback() {
|
|
170
|
+
if (this.hasOverflow)
|
|
171
|
+
this.overflowBehavior.disconnect();
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Render
|
|
175
|
+
*
|
|
176
|
+
* @returns {HTMLElement} HTML Element
|
|
177
|
+
*/
|
|
178
|
+
render() {
|
|
179
|
+
return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null), this.hasOverflow && isMoreItem(this.moreitem) && this.renderMgMenuItemMore()));
|
|
180
|
+
}
|
|
181
|
+
get element() { return this; }
|
|
182
|
+
static get watchers() { return {
|
|
183
|
+
"label": ["validateLabel"],
|
|
184
|
+
"direction": ["validateDirection"],
|
|
185
|
+
"moreitem": ["validateMoreItem"],
|
|
186
|
+
"size": ["validateSize"]
|
|
187
|
+
}; }
|
|
188
|
+
static get style() { return mgMenuCss; }
|
|
189
|
+
}, [1, "mg-menu", {
|
|
190
|
+
"label": [1],
|
|
191
|
+
"direction": [513],
|
|
192
|
+
"moreitem": [16],
|
|
193
|
+
"size": [1],
|
|
194
|
+
"isChildMenu": [32],
|
|
195
|
+
"hasOverflow": [32]
|
|
196
|
+
}]);
|
|
197
|
+
function defineCustomElement() {
|
|
198
|
+
if (typeof customElements === "undefined") {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
const components = ["mg-menu", "mg-badge", "mg-button", "mg-card", "mg-icon", "mg-menu", "mg-menu-item", "mg-popover"];
|
|
202
|
+
components.forEach(tagName => { switch (tagName) {
|
|
203
|
+
case "mg-menu":
|
|
204
|
+
if (!customElements.get(tagName)) {
|
|
205
|
+
customElements.define(tagName, MgMenu);
|
|
206
|
+
}
|
|
207
|
+
break;
|
|
208
|
+
case "mg-badge":
|
|
209
|
+
if (!customElements.get(tagName)) {
|
|
210
|
+
defineCustomElement$6();
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
case "mg-button":
|
|
214
|
+
if (!customElements.get(tagName)) {
|
|
215
|
+
defineCustomElement$5();
|
|
216
|
+
}
|
|
217
|
+
break;
|
|
218
|
+
case "mg-card":
|
|
219
|
+
if (!customElements.get(tagName)) {
|
|
220
|
+
defineCustomElement$4();
|
|
221
|
+
}
|
|
222
|
+
break;
|
|
223
|
+
case "mg-icon":
|
|
224
|
+
if (!customElements.get(tagName)) {
|
|
225
|
+
defineCustomElement$3();
|
|
226
|
+
}
|
|
227
|
+
break;
|
|
228
|
+
case "mg-menu":
|
|
229
|
+
if (!customElements.get(tagName)) {
|
|
230
|
+
defineCustomElement();
|
|
231
|
+
}
|
|
232
|
+
break;
|
|
233
|
+
case "mg-menu-item":
|
|
234
|
+
if (!customElements.get(tagName)) {
|
|
235
|
+
defineCustomElement$2();
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
case "mg-popover":
|
|
239
|
+
if (!customElements.get(tagName)) {
|
|
240
|
+
defineCustomElement$1();
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
} });
|
|
244
|
+
}
|
|
245
|
+
defineCustomElement();
|
|
246
|
+
|
|
247
|
+
export { MgMenu as M, defineCustomElement as d };
|
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
|
10
10
|
*/
|
|
11
11
|
const variants = ['info', 'warning', 'success', 'danger'];
|
|
12
12
|
|
|
13
|
-
const mgMessageCss = ":host{--mg-card-padding:0;--mg-card-border-radius:var(--mg-message-border-radius);--mg-card-border:none;--mg-card-overflow:hidden}.mg-message{display:inline-block;min-height:var(--default-size)}.mg-message__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info .mg-message__bar{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning .mg-message__bar{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success .mg-message__bar{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger .mg-message__bar{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{--mg-card-padding:0 3.4rem 0 0}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message,mg-message{max-width:100%}";
|
|
13
|
+
const mgMessageCss = ":host{--mg-card-padding:0;--mg-card-border-radius:var(--mg-message-border-radius);--mg-card-border:none;--mg-card-overflow:hidden}.mg-message{display:inline-block;min-height:var(--default-size)}.mg-message__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}.mg-message.mg-message--info .mg-message__bar{background-color:hsl(var(--color-info))}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning .mg-message__bar{background-color:hsl(var(--color-warning))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success .mg-message__bar{background-color:hsl(var(--color-success))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger .mg-message__bar{background-color:hsl(var(--color-danger))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{--mg-card-padding:0 3.4rem 0 0}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}.mg-message,mg-message{max-width:100%}";
|
|
14
14
|
|
|
15
15
|
const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
16
16
|
constructor() {
|
|
@@ -28,22 +28,49 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
28
28
|
this.closeButtonId = '';
|
|
29
29
|
// Stored timer setted when hide action is run from setTimeOut
|
|
30
30
|
this.storedTimer = null;
|
|
31
|
+
// Manage hover
|
|
32
|
+
this.isFocused = false;
|
|
33
|
+
this.isHovered = false;
|
|
31
34
|
/**
|
|
32
|
-
*
|
|
35
|
+
* Set timer
|
|
36
|
+
*
|
|
37
|
+
* @returns {void}
|
|
33
38
|
*/
|
|
34
|
-
this.
|
|
35
|
-
this.hide = true;
|
|
39
|
+
this.setTimer = () => {
|
|
40
|
+
this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
|
|
36
41
|
};
|
|
37
42
|
/**
|
|
38
|
-
*
|
|
43
|
+
* Clear timer
|
|
44
|
+
*
|
|
45
|
+
* @returns {void}
|
|
39
46
|
*/
|
|
40
|
-
this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
this.clearTimer = () => {
|
|
48
|
+
clearTimeout(this.storedTimer);
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Event to add on element
|
|
52
|
+
*
|
|
53
|
+
* @param {MouseEvent | FocusEvent} event event
|
|
54
|
+
* @returns {void}
|
|
55
|
+
*/
|
|
56
|
+
this.timerEvents = (event) => {
|
|
57
|
+
this.clearTimer();
|
|
58
|
+
const isMouseEvent = event.type === 'mouseenter';
|
|
59
|
+
// Needed to ensure we don't start the timer
|
|
60
|
+
this[isMouseEvent ? 'isHovered' : 'isFocused'] = true;
|
|
61
|
+
// Restart timer when loose focus AND mouse leave
|
|
62
|
+
this.element.addEventListener(isMouseEvent ? 'mouseleave' : 'focusout', eventOut => {
|
|
63
|
+
this[eventOut.type === 'mouseleave' ? 'isHovered' : 'isFocused'] = false;
|
|
64
|
+
// Start timer if needed
|
|
65
|
+
if (!this.isFocused && !this.isHovered)
|
|
66
|
+
this.setTimer();
|
|
67
|
+
}, { once: true });
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Handle close button
|
|
71
|
+
*/
|
|
72
|
+
this.handleClose = () => {
|
|
73
|
+
this.hide = true;
|
|
47
74
|
};
|
|
48
75
|
/**
|
|
49
76
|
* Get icon corresponding to variant
|
|
@@ -77,7 +104,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
77
104
|
}
|
|
78
105
|
validateVariant(newValue, oldValue) {
|
|
79
106
|
if (!variants.includes(newValue)) {
|
|
80
|
-
throw new Error(`<mg-message> prop "variant" must be one of
|
|
107
|
+
throw new Error(`<mg-message> prop "variant" must be one of: ${variants.join(', ')}`);
|
|
81
108
|
}
|
|
82
109
|
else {
|
|
83
110
|
if (oldValue !== undefined) {
|
|
@@ -96,12 +123,26 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
96
123
|
if (newValue) {
|
|
97
124
|
this.componentHide.emit();
|
|
98
125
|
this.classList.add(this.classHide);
|
|
126
|
+
// Remove event Listener
|
|
127
|
+
['focusin', 'mouseenter'].forEach(event => {
|
|
128
|
+
this.element.removeEventListener(event, this.timerEvents);
|
|
129
|
+
});
|
|
130
|
+
// Clear Timer
|
|
131
|
+
this.clearTimer();
|
|
99
132
|
}
|
|
100
133
|
else {
|
|
101
134
|
this.componentShow.emit();
|
|
102
135
|
this.classList.delete(this.classHide);
|
|
136
|
+
// If delay is set
|
|
137
|
+
if (this.delay > 1) {
|
|
138
|
+
// Start timer
|
|
139
|
+
this.setTimer();
|
|
140
|
+
// Stop timer when get focus or mouse enter
|
|
141
|
+
['focusin', 'mouseenter'].forEach(event => {
|
|
142
|
+
this.element.addEventListener(event, this.timerEvents);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
103
145
|
}
|
|
104
|
-
this.hideWithDelay();
|
|
105
146
|
}
|
|
106
147
|
/*************
|
|
107
148
|
* Lifecycle *
|
|
@@ -5,7 +5,7 @@ import { d as defineCustomElement$4 } from './mg-button2.js';
|
|
|
5
5
|
import { d as defineCustomElement$3 } from './mg-card2.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
7
7
|
|
|
8
|
-
const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:
|
|
8
|
+
const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsl(var(--color-light), 0.85)}.mg-modal mg-card{display:flex;width:60rem;max-width:100%;max-height:100%}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;height:fit-content;max-height:100%}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}.mg-modal ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
|
|
9
9
|
|
|
10
10
|
const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
@@ -76,6 +76,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
76
76
|
};
|
|
77
77
|
this.identifier = createID('mg-pagination');
|
|
78
78
|
this.label = undefined;
|
|
79
|
+
this.hideNavigationLabels = undefined;
|
|
79
80
|
this.totalPages = 1;
|
|
80
81
|
this.currentPage = 1;
|
|
81
82
|
}
|
|
@@ -120,7 +121,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
120
121
|
render() {
|
|
121
122
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
122
123
|
// eslint-disable-next-line react/jsx-no-bind
|
|
123
|
-
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" })));
|
|
124
|
+
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" })));
|
|
124
125
|
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)));
|
|
125
126
|
}
|
|
126
127
|
get element() { return this; }
|
|
@@ -132,6 +133,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
132
133
|
}, [1, "mg-pagination", {
|
|
133
134
|
"identifier": [1],
|
|
134
135
|
"label": [1025],
|
|
136
|
+
"hideNavigationLabels": [4, "hide-navigation-labels"],
|
|
135
137
|
"totalPages": [2, "total-pages"],
|
|
136
138
|
"currentPage": [1538, "current-page"]
|
|
137
139
|
}]);
|
|
@@ -9,7 +9,7 @@ import { d as defineCustomElement$4 } from './mg-input-text2.js';
|
|
|
9
9
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
10
10
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
11
11
|
|
|
12
|
-
const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}";
|
|
12
|
+
const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}.mg-panel ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default)}";
|
|
13
13
|
|
|
14
14
|
const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
@@ -91,13 +91,13 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
91
91
|
if (this.titleEditable && !this.isEditing) {
|
|
92
92
|
return [
|
|
93
93
|
collapseButton(),
|
|
94
|
-
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" })),
|
|
94
|
+
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" })),
|
|
95
95
|
];
|
|
96
96
|
}
|
|
97
97
|
if (this.titleEditable && this.isEditing) {
|
|
98
98
|
return [
|
|
99
99
|
collapseButton(),
|
|
100
|
-
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" }))),
|
|
100
|
+
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" }))),
|
|
101
101
|
];
|
|
102
102
|
}
|
|
103
103
|
return collapseButton();
|
|
@@ -1,193 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { c as createID, i as isTagName } from './components.utils.js';
|
|
3
|
-
import { i as initLocales } from './index2.js';
|
|
4
|
-
import { d as defineCustomElement$4 } from './mg-button2.js';
|
|
5
|
-
import { d as defineCustomElement$3 } from './mg-card2.js';
|
|
6
|
-
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
7
|
-
import { c as createPopper } from './popper.js';
|
|
8
|
-
|
|
9
|
-
const mgPopoverCss = ":host{--mg-card-padding:1.5rem;--mg-card-border:none;--mg-card-border-radius:0.5rem;--mg-card-background:hsl(var(--mg-popover-background-color));position:relative;display:contents}:host::slotted(*){display:inline-block}.mg-popover{display:none;z-index:2000;color:hsl(var(--mg-popover-font-color))}.mg-popover mg-card{z-index:-1}.mg-popover[data-show]{display:block}.mg-popover mg-button{float:right;margin-right:calc(0rem - (var(--default-size) - var(--mg-icon-regular-size)) / 2);margin-top:calc(0rem - (var(--default-size) - var(--mg-popover-title-font-size) * var(--line-height)) / 2);margin-left:3rem}.mg-popover__arrow,.mg-popover__arrow::before{position:absolute;width:2rem;height:2rem;z-index:2000;background:hsl(var(--mg-popover-background-color))}.mg-popover__arrow{visibility:hidden}.mg-popover__arrow::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top]>.mg-popover__arrow{bottom:-6px}.mg-popover[data-popper-placement^=bottom]>.mg-popover__arrow{top:-6px}.mg-popover[data-popper-placement^=left]>.mg-popover__arrow{right:-6px}.mg-popover[data-popper-placement^=right]>.mg-popover__arrow{left:-6px}.mg-popover__title ::slotted([slot=title]){margin:0 0 1rem !important;font-size:var(--mg-popover-title-font-size) !important;font-weight:600}";
|
|
10
|
-
|
|
11
|
-
const MgPopover$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
this.__registerHost();
|
|
15
|
-
this.__attachShadow();
|
|
16
|
-
this.displayChange = createEvent(this, "display-change", 7);
|
|
17
|
-
this.closeButtonId = '';
|
|
18
|
-
/**
|
|
19
|
-
* Check if clicked outside of component
|
|
20
|
-
*
|
|
21
|
-
* @param {MouseEvent} event mouse event
|
|
22
|
-
* @returns {void}
|
|
23
|
-
*/
|
|
24
|
-
this.clickOutside = (event) => {
|
|
25
|
-
if (!this.disabled && event.target.closest(`mg-popover`) !== this.element) {
|
|
26
|
-
this.display = false;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Show popover
|
|
31
|
-
*
|
|
32
|
-
* @returns {void}
|
|
33
|
-
*/
|
|
34
|
-
this.show = () => {
|
|
35
|
-
// Make the popover visible
|
|
36
|
-
this.popover.setAttribute('data-show', '');
|
|
37
|
-
// Enable the event listeners
|
|
38
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
39
|
-
// Update its position
|
|
40
|
-
this.popper.update();
|
|
41
|
-
// hide when click outside
|
|
42
|
-
// setTimeout is used to prevent event to trigger after creation
|
|
43
|
-
setTimeout(() => {
|
|
44
|
-
document.addEventListener('click', this.clickOutside, false);
|
|
45
|
-
}, 0);
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* Hide popover
|
|
49
|
-
*
|
|
50
|
-
* @returns {void}
|
|
51
|
-
*/
|
|
52
|
-
this.hide = () => {
|
|
53
|
-
// Hide the popover
|
|
54
|
-
this.popover.removeAttribute('data-show');
|
|
55
|
-
// Disable the event listeners
|
|
56
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
57
|
-
// Remove event listener
|
|
58
|
-
document.removeEventListener('click', this.clickOutside, false);
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Handle action for close button
|
|
62
|
-
*
|
|
63
|
-
* @returns {void}
|
|
64
|
-
*/
|
|
65
|
-
this.handleCloseButton = () => {
|
|
66
|
-
this.display = false;
|
|
67
|
-
};
|
|
68
|
-
this.identifier = createID('mg-popover');
|
|
69
|
-
this.placement = 'bottom';
|
|
70
|
-
this.closeButton = false;
|
|
71
|
-
this.display = false;
|
|
72
|
-
this.disabled = false;
|
|
73
|
-
}
|
|
74
|
-
handleDisplay(newValue) {
|
|
75
|
-
if (newValue) {
|
|
76
|
-
this.show();
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.hide();
|
|
80
|
-
}
|
|
81
|
-
this.displayChange.emit(newValue);
|
|
82
|
-
}
|
|
83
|
-
/*************
|
|
84
|
-
* Lifecycle *
|
|
85
|
-
*************/
|
|
86
|
-
/**
|
|
87
|
-
* Check if component props are well configured on init
|
|
88
|
-
*
|
|
89
|
-
* @returns {void} timeout
|
|
90
|
-
*/
|
|
91
|
-
componentWillLoad() {
|
|
92
|
-
// Get locales
|
|
93
|
-
this.messages = initLocales(this.element).messages;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Check if component props are well configured on init
|
|
97
|
-
*
|
|
98
|
-
* @returns {void}
|
|
99
|
-
*/
|
|
100
|
-
componentDidLoad() {
|
|
101
|
-
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
102
|
-
const slottedTitleElement = this.element.querySelector('[slot="title"]');
|
|
103
|
-
if (slottedTitleElement && !isTagName(slottedTitleElement, headingTags)) {
|
|
104
|
-
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingTags.join(', ')}`);
|
|
105
|
-
}
|
|
106
|
-
// Set close button id
|
|
107
|
-
if (this.closeButton) {
|
|
108
|
-
this.closeButtonId = `${this.identifier}-close-button`;
|
|
109
|
-
}
|
|
110
|
-
// Get popover content
|
|
111
|
-
this.popover = this.element.shadowRoot.getElementById(this.identifier);
|
|
112
|
-
//Get interactive element (first element without slot attribute)
|
|
113
|
-
const interactiveElement = this.element.querySelector(':not([slot])');
|
|
114
|
-
// Add aria attributes
|
|
115
|
-
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
116
|
-
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
117
|
-
// Create popperjs popover
|
|
118
|
-
this.popper = createPopper(interactiveElement, this.popover, {
|
|
119
|
-
placement: this.placement,
|
|
120
|
-
strategy: 'fixed',
|
|
121
|
-
modifiers: [
|
|
122
|
-
{
|
|
123
|
-
name: 'offset',
|
|
124
|
-
options: {
|
|
125
|
-
offset: [0, 10],
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
],
|
|
129
|
-
});
|
|
130
|
-
// Add events to toggle display
|
|
131
|
-
interactiveElement.addEventListener('click', () => {
|
|
132
|
-
if (!this.disabled)
|
|
133
|
-
this.display = !this.display;
|
|
134
|
-
});
|
|
135
|
-
// Add events to hide popover
|
|
136
|
-
this.element.addEventListener('keydown', e => {
|
|
137
|
-
if (!this.disabled && e.code === 'Escape')
|
|
138
|
-
this.display = false;
|
|
139
|
-
});
|
|
140
|
-
this.handleDisplay(this.display);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Render
|
|
144
|
-
*
|
|
145
|
-
* @returns {HTMLElement} HTML Element
|
|
146
|
-
*/
|
|
147
|
-
render() {
|
|
148
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, h("mg-card", null, !this.disabled && 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" })), h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
149
|
-
}
|
|
150
|
-
get element() { return this; }
|
|
151
|
-
static get watchers() { return {
|
|
152
|
-
"display": ["handleDisplay"]
|
|
153
|
-
}; }
|
|
154
|
-
static get style() { return mgPopoverCss; }
|
|
155
|
-
}, [1, "mg-popover", {
|
|
156
|
-
"identifier": [1],
|
|
157
|
-
"placement": [1],
|
|
158
|
-
"closeButton": [4, "close-button"],
|
|
159
|
-
"display": [1028],
|
|
160
|
-
"disabled": [1028]
|
|
161
|
-
}]);
|
|
162
|
-
function defineCustomElement$1() {
|
|
163
|
-
if (typeof customElements === "undefined") {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
const components = ["mg-popover", "mg-button", "mg-card", "mg-icon"];
|
|
167
|
-
components.forEach(tagName => { switch (tagName) {
|
|
168
|
-
case "mg-popover":
|
|
169
|
-
if (!customElements.get(tagName)) {
|
|
170
|
-
customElements.define(tagName, MgPopover$1);
|
|
171
|
-
}
|
|
172
|
-
break;
|
|
173
|
-
case "mg-button":
|
|
174
|
-
if (!customElements.get(tagName)) {
|
|
175
|
-
defineCustomElement$4();
|
|
176
|
-
}
|
|
177
|
-
break;
|
|
178
|
-
case "mg-card":
|
|
179
|
-
if (!customElements.get(tagName)) {
|
|
180
|
-
defineCustomElement$3();
|
|
181
|
-
}
|
|
182
|
-
break;
|
|
183
|
-
case "mg-icon":
|
|
184
|
-
if (!customElements.get(tagName)) {
|
|
185
|
-
defineCustomElement$2();
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
} });
|
|
189
|
-
}
|
|
190
|
-
defineCustomElement$1();
|
|
1
|
+
import { M as MgPopover$1, d as defineCustomElement$1 } from './mg-popover2.js';
|
|
191
2
|
|
|
192
3
|
const MgPopover = MgPopover$1;
|
|
193
4
|
const defineCustomElement = defineCustomElement$1;
|