@mgdis/mg-components 5.6.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-4dcc1812.js → index-5e7ede97.js} +109 -3
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/{mg-badge_30.cjs.entry.js → mg-action-more_31.cjs.entry.js} +623 -445
- package/dist/cjs/mg-components.cjs.js +7 -3
- package/dist/collection/collection-manifest.json +5 -4
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.css +7 -21
- package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +27 -27
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +3 -3
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +12 -15
- 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 +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +4 -0
- 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 +4 -0
- 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 +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +4 -0
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +4 -0
- 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.js +2 -3
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +2 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +31 -11
- 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-message/mg-message.js +1 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +17 -4
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +2 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +9 -8
- package/dist/collection/locales/en/messages.json +6 -1
- package/dist/collection/locales/fr/messages.json +6 -1
- package/dist/collection/locales/index.js +1 -1
- package/dist/collection/styles/mg-icon-animation.scss +6 -0
- package/dist/collection/styles/navigation-button.scss +2 -1
- package/dist/collection/utils/behaviors.utils.js +16 -34
- package/dist/collection/utils/components.utils.js +3 -1
- package/dist/collection/utils/locale.utils.js +9 -9
- package/dist/collection/utils/unit.test.utils.js +32 -4
- package/dist/collection/variables.css +2 -1
- package/dist/components/MgInput.js +6 -1
- package/dist/components/components.utils.js +3 -1
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +2 -1
- package/dist/components/index2.js +26 -14
- 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 +1 -1
- package/dist/components/mg-button2.js +2 -2
- package/dist/components/mg-form.js +2 -2
- package/dist/components/mg-icon2.js +30 -30
- package/dist/components/mg-input-checkbox.js +3 -3
- package/dist/components/mg-input-date.js +2 -2
- package/dist/components/mg-input-numeric.js +2 -2
- 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 +2 -2
- 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-item2.js +75 -72
- package/dist/components/mg-menu.js +1 -246
- package/dist/components/mg-menu2.js +247 -0
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-pagination.js +3 -1
- package/dist/components/mg-panel.js +2 -2
- package/dist/components/mg-popover2.js +17 -3
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs.js +10 -9
- package/dist/components/mg-tag.js +1 -1
- package/dist/components/mg-tooltip2.js +12 -15
- package/dist/esm/{index-dc9a2348.js → index-03cceb11.js} +109 -4
- package/dist/esm/loader.js +4 -3
- package/dist/esm/{mg-badge_30.entry.js → mg-action-more_31.entry.js} +623 -446
- package/dist/esm/mg-components.js +4 -3
- package/dist/mg-components/locales/en/messages.json +6 -1
- package/dist/mg-components/locales/fr/messages.json +6 -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/mg-icon-animation.scss +6 -0
- package/dist/mg-components/styles/navigation-button.scss +2 -1
- package/dist/mg-components/variables.css +2 -1
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +1 -1
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +7 -1
- 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-pagination/mg-pagination.d.ts +4 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +2 -1
- package/dist/types/components.d.ts +54 -0
- package/dist/types/locales/index.d.ts +12 -2
- package/dist/types/stencil-public-runtime.d.ts +9 -0
- package/dist/types/utils/behaviors.utils.d.ts +1 -7
- package/dist/types/utils/locale.utils.d.ts +5 -5
- package/dist/types/utils/unit.test.utils.d.ts +20 -2
- package/loader/index.d.ts +9 -0
- package/package.json +17 -16
- package/readme.md +0 -18
- 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 -119
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +0 -34
- 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 -53
- 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/mg-components/p-182bd802.js +0 -2
- package/dist/mg-components/p-f7da9dd2.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 -22
- 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
|
@@ -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,7 +1,6 @@
|
|
|
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
|
-
import { getWindows, ClassList } from '../../../utils/components.utils';
|
|
5
4
|
import { initLocales } from '../../../locales';
|
|
6
5
|
export class MgPopover {
|
|
7
6
|
constructor() {
|
|
@@ -15,7 +14,10 @@ export class MgPopover {
|
|
|
15
14
|
* @returns {void}
|
|
16
15
|
*/
|
|
17
16
|
this.clickOutside = (event) => {
|
|
18
|
-
|
|
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)) {
|
|
19
21
|
this.display = false;
|
|
20
22
|
}
|
|
21
23
|
};
|
|
@@ -26,7 +28,7 @@ export class MgPopover {
|
|
|
26
28
|
*/
|
|
27
29
|
this.show = () => {
|
|
28
30
|
// Make the popover visible
|
|
29
|
-
this.popover.
|
|
31
|
+
this.popover.dataset.show = '';
|
|
30
32
|
// Enable the event listeners
|
|
31
33
|
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
32
34
|
// Update its position
|
|
@@ -135,6 +137,17 @@ export class MgPopover {
|
|
|
135
137
|
},
|
|
136
138
|
],
|
|
137
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
|
+
}
|
|
138
151
|
// Add events to toggle display
|
|
139
152
|
interactiveElement.addEventListener('click', () => {
|
|
140
153
|
if (!this.disabled)
|
|
@@ -1,3 +1,4 @@
|
|
|
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 {
|
|
@@ -42,7 +43,7 @@ export class MgSkipLinks {
|
|
|
42
43
|
* @returns {HTMLElement} HTML Element
|
|
43
44
|
*/
|
|
44
45
|
render() {
|
|
45
|
-
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)))))));
|
|
46
47
|
}
|
|
47
48
|
static get is() { return "mg-skip-links"; }
|
|
48
49
|
static get encapsulation() { return "shadow"; }
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
background-color: unset;
|
|
50
50
|
border: none;
|
|
51
51
|
font-family: var(--font-family);
|
|
52
|
+
font-weight: 400;
|
|
52
53
|
color: hsl(var(--mg-tabs-color-hsl, var(--color-dark)));
|
|
53
54
|
line-height: var(--line-height);
|
|
54
55
|
text-decoration: none;
|
|
@@ -58,7 +59,7 @@
|
|
|
58
59
|
}
|
|
59
60
|
.mg-tabs__navigation-button:disabled, .mg-tabs__navigation-button--disabled {
|
|
60
61
|
cursor: default;
|
|
61
|
-
opacity:
|
|
62
|
+
opacity: var(--mg-disabled-opacity);
|
|
62
63
|
}
|
|
63
64
|
.mg-tabs__navigation-button:focus-visible {
|
|
64
65
|
z-index: 10;
|
|
@@ -52,7 +52,7 @@ export class MgTabs {
|
|
|
52
52
|
* @param {MouseEvent} event mouse event
|
|
53
53
|
*/
|
|
54
54
|
this.handleClick = (event) => {
|
|
55
|
-
const tabId = event.currentTarget.
|
|
55
|
+
const tabId = event.currentTarget.dataset.index;
|
|
56
56
|
const tab = this.tabs[Number(tabId) - this.startIndex];
|
|
57
57
|
if (this.tabHasStatus(tab, Status.HIDDEN) || this.tabHasStatus(tab, Status.DISABLED)) {
|
|
58
58
|
event.preventDefault();
|
|
@@ -78,7 +78,7 @@ export class MgTabs {
|
|
|
78
78
|
this.handleKeydown = (event) => {
|
|
79
79
|
const parent = event.target.parentElement;
|
|
80
80
|
if (['ArrowRight', 'ArrowLeft'].includes(event.key)) {
|
|
81
|
-
this.tabFocus = Number(event.target.
|
|
81
|
+
this.tabFocus = Number(event.target.dataset.index);
|
|
82
82
|
parent.querySelector(`[data-index="${this.tabFocus}"]`).setAttribute('tabindex', '-1');
|
|
83
83
|
// Move right
|
|
84
84
|
if (event.key === 'ArrowRight') {
|
|
@@ -94,14 +94,15 @@ export class MgTabs {
|
|
|
94
94
|
if (this.tabFocus < this.startIndex)
|
|
95
95
|
this.tabFocus = this.tabs.length;
|
|
96
96
|
}
|
|
97
|
+
const parentButtonElement = parent.querySelector(`[data-index="${this.tabFocus}"]`);
|
|
97
98
|
// if focus item is ['hidden'] we recursively repeat action
|
|
98
99
|
if (this.tabHasStatus(this.tabs[this.tabFocus - 1], Status.HIDDEN)) {
|
|
99
|
-
|
|
100
|
+
parentButtonElement.dispatchEvent(new KeyboardEvent('keydown', { key: event.key, bubbles: true }));
|
|
100
101
|
// else run focus methods on tabFocus element
|
|
101
102
|
}
|
|
102
103
|
else {
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
parentButtonElement.setAttribute('tabindex', '0');
|
|
105
|
+
parentButtonElement.focus();
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
else if (event.key === 'Tab') {
|
|
@@ -145,7 +146,7 @@ export class MgTabs {
|
|
|
145
146
|
}
|
|
146
147
|
validateSize(newValue) {
|
|
147
148
|
if (!sizes.includes(newValue)) {
|
|
148
|
-
throw new Error(`<mg-tabs> prop "size" must be one of
|
|
149
|
+
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}`);
|
|
149
150
|
}
|
|
150
151
|
this.classList.add(`mg-tabs--size-${this.size}`);
|
|
151
152
|
}
|
|
@@ -218,13 +219,13 @@ export class MgTabs {
|
|
|
218
219
|
* @returns {HTMLElement} HTML Element
|
|
219
220
|
*/
|
|
220
221
|
render() {
|
|
221
|
-
return (h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
222
|
+
return (h("div", { class: this.classList.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
222
223
|
[`${this.buttonTabBaseClass}`]: true,
|
|
223
224
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
224
225
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
225
226
|
[`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasStatus(tab, Status.DISABLED),
|
|
226
227
|
[`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasStatus(tab, Status.HIDDEN),
|
|
227
|
-
}, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
|
|
228
|
+
}, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
|
|
228
229
|
}
|
|
229
230
|
static get is() { return "mg-tabs"; }
|
|
230
231
|
static get encapsulation() { return "shadow"; }
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"form": {
|
|
23
23
|
"required": "Fields with a <strong class=\"is-asterisk\">*</strong> are required",
|
|
24
|
-
"
|
|
24
|
+
"requiredSingle": "Field with a <strong class=\"is-asterisk\">*</strong> is required",
|
|
25
|
+
"allRequired": "All fields are required",
|
|
26
|
+
"allRequiredSingle": "The field is required"
|
|
25
27
|
},
|
|
26
28
|
"message": {
|
|
27
29
|
"closeButton": "Close message"
|
|
@@ -53,5 +55,8 @@
|
|
|
53
55
|
"plusMenu": {
|
|
54
56
|
"moreLabel": "Additional menu",
|
|
55
57
|
"badgeLabel": "Include notification(s)"
|
|
58
|
+
},
|
|
59
|
+
"actionMore": {
|
|
60
|
+
"label": "Actions"
|
|
56
61
|
}
|
|
57
62
|
}
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
},
|
|
22
22
|
"form": {
|
|
23
23
|
"required": "Les champs marqués d'un <strong class=\"is-asterisk\">*</strong> sont obligatoires",
|
|
24
|
-
"
|
|
24
|
+
"requiredSingle": "Le champ marqué d'un <strong class=\"is-asterisk\">*</strong> est obligatoire",
|
|
25
|
+
"allRequired": "Tous les champs sont obligatoires",
|
|
26
|
+
"allRequiredSingle": "Le champ est obligatoire"
|
|
25
27
|
},
|
|
26
28
|
"message": {
|
|
27
29
|
"closeButton": "Fermer le message"
|
|
@@ -53,5 +55,8 @@
|
|
|
53
55
|
"plusMenu": {
|
|
54
56
|
"moreLabel": "Menu complémentaire",
|
|
55
57
|
"badgeLabel": "Notification(s) incluse(s)"
|
|
58
|
+
},
|
|
59
|
+
"actionMore": {
|
|
60
|
+
"label": "Actions"
|
|
56
61
|
}
|
|
57
62
|
}
|
|
@@ -7,6 +7,6 @@ const messages = { en, fr };
|
|
|
7
7
|
* Get Intl object
|
|
8
8
|
*
|
|
9
9
|
* @param {HTMLElement} element element we need to get the language
|
|
10
|
-
* @returns {{ locale: string; messages: unknown }} messages object
|
|
10
|
+
* @returns {{ locale: string; messages: Record<string, unknown> }} messages object
|
|
11
11
|
*/
|
|
12
12
|
export const initLocales = (element) => getLocaleMessages(element, messages, defaultLocale);
|
|
@@ -35,6 +35,7 @@ $navigation-button-column-gap: 1rem;
|
|
|
35
35
|
background-color: unset;
|
|
36
36
|
border: none;
|
|
37
37
|
font-family: var(--font-family);
|
|
38
|
+
font-weight: 400;
|
|
38
39
|
color: hsl(var(--#{$element}-color-hsl, var(--color-dark)));
|
|
39
40
|
line-height: var(--line-height);
|
|
40
41
|
text-decoration: none;
|
|
@@ -44,7 +45,7 @@ $navigation-button-column-gap: 1rem;
|
|
|
44
45
|
&:disabled,
|
|
45
46
|
&--disabled {
|
|
46
47
|
cursor: default;
|
|
47
|
-
opacity:
|
|
48
|
+
opacity: var(--mg-disabled-opacity);
|
|
48
49
|
}
|
|
49
50
|
&:focus-visible {
|
|
50
51
|
z-index: 10;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Status } from '../components/molecules/menu/mg-menu-item/mg-menu-item.conf';
|
|
2
1
|
/**
|
|
3
2
|
* MgMenuItem type guard
|
|
4
3
|
*
|
|
@@ -27,15 +26,6 @@ export class OverflowBehavior {
|
|
|
27
26
|
this.disconnect = () => {
|
|
28
27
|
this.resizeObserver.disconnect();
|
|
29
28
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Update more element status if active child
|
|
32
|
-
*
|
|
33
|
-
* @returns {void}
|
|
34
|
-
*/
|
|
35
|
-
this.updateActiveStatus = () => {
|
|
36
|
-
const hasActiveChild = Array.from(this.moreELement.querySelector('mg-menu').children).some(element => element.nodeName === 'MG-MENU-ITEM' && element.getAttribute('status') === Status.ACTIVE && element.getAttribute('hidden') === null);
|
|
37
|
-
this.moreELement.setAttribute('status', hasActiveChild ? Status.ACTIVE : Status.VISIBLE);
|
|
38
|
-
};
|
|
39
29
|
/************
|
|
40
30
|
* Internal *
|
|
41
31
|
************/
|
|
@@ -46,28 +36,26 @@ export class OverflowBehavior {
|
|
|
46
36
|
* @returns {void}
|
|
47
37
|
*/
|
|
48
38
|
this.run = (width) => {
|
|
49
|
-
if (this.
|
|
39
|
+
if (this.moreElement === undefined) {
|
|
50
40
|
// set moreElement
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
41
|
+
this.moreElement = this.render();
|
|
42
|
+
this.moreElement.setAttribute(OverflowBehaviorElements.MORE, '');
|
|
53
43
|
// set children
|
|
54
44
|
this.children = Array.from(this.element.children);
|
|
55
|
-
let
|
|
45
|
+
let moreElementChildren;
|
|
56
46
|
const allowedElements = ['MG-MENU-ITEM', 'MG-BUTTON'];
|
|
57
|
-
if (isMgMenuItem(this.
|
|
58
|
-
|
|
47
|
+
if (isMgMenuItem(this.moreElement)) {
|
|
48
|
+
moreElementChildren = Array.from(this.moreElement.querySelector('mg-menu').children).filter(element => allowedElements.includes(element.nodeName));
|
|
59
49
|
}
|
|
60
50
|
this.children.forEach((child, index) => {
|
|
61
51
|
child.setAttribute(OverflowBehaviorElements.BASE_INDEX, `${index}`);
|
|
62
52
|
if (child.getAttribute(OverflowBehaviorElements.MORE) === null) {
|
|
63
53
|
// set moreElement children
|
|
64
|
-
|
|
54
|
+
moreElementChildren[index].setAttribute(OverflowBehaviorElements.PROXY_INDEX, `${index}`);
|
|
65
55
|
}
|
|
66
56
|
});
|
|
67
57
|
}
|
|
68
58
|
this.updateDisplayedItems(width);
|
|
69
|
-
if (isMgMenuItem(this.moreELement))
|
|
70
|
-
this.updateActiveStatus();
|
|
71
59
|
};
|
|
72
60
|
/**
|
|
73
61
|
* Update displayed items in container from a given available space
|
|
@@ -77,24 +65,18 @@ export class OverflowBehavior {
|
|
|
77
65
|
*/
|
|
78
66
|
this.updateDisplayedItems = (availableWidth) => {
|
|
79
67
|
this.restoreItems();
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
const acc = { accWidth: 0, previousItem: null };
|
|
69
|
+
this.children.forEach((child) => {
|
|
70
|
+
acc.accWidth += child.offsetWidth;
|
|
82
71
|
const isPreviousItemHidden = acc.previousItem !== null && acc.previousItem.getAttribute('hidden') !== null;
|
|
83
72
|
// if previous item is hidden AND is NOT more element we hidde current
|
|
84
73
|
// OR if item has an overflow we hidde current
|
|
85
74
|
// OR if current item is more element AND have NOT previous hidden items, current more element item is an hidden item
|
|
86
75
|
// ELSE current is a display item
|
|
87
|
-
|
|
88
|
-
this.isOverflowElement(acc.accWidth, curr, availableWidth) ||
|
|
89
|
-
(this.isMoreElement(curr) && !isPreviousItemHidden)) {
|
|
90
|
-
this.toggleItem(curr, true);
|
|
91
|
-
}
|
|
92
|
-
else
|
|
93
|
-
this.toggleItem(curr, false);
|
|
76
|
+
this.toggleItem(child, (isPreviousItemHidden && !this.isMoreElement(child)) || this.isOverflowElement(acc.accWidth, child, availableWidth) || (this.isMoreElement(child) && !isPreviousItemHidden));
|
|
94
77
|
// update previous item with current item
|
|
95
|
-
acc.previousItem =
|
|
96
|
-
|
|
97
|
-
}, { accWidth: 0, previousItem: null });
|
|
78
|
+
acc.previousItem = child;
|
|
79
|
+
});
|
|
98
80
|
};
|
|
99
81
|
/**
|
|
100
82
|
* Utility method to know if item overflow partialy or totaly in the container
|
|
@@ -108,7 +90,7 @@ export class OverflowBehavior {
|
|
|
108
90
|
if (item.previousElementSibling === null || this.isMoreElement(item))
|
|
109
91
|
return false;
|
|
110
92
|
else if (!this.isMoreElement(item.nextElementSibling))
|
|
111
|
-
return cumulateWidth + this.
|
|
93
|
+
return cumulateWidth + this.moreElement.offsetWidth > availableWidth;
|
|
112
94
|
else
|
|
113
95
|
return cumulateWidth > availableWidth;
|
|
114
96
|
};
|
|
@@ -129,10 +111,10 @@ export class OverflowBehavior {
|
|
|
129
111
|
this.toggleItem = (item, isHidden) => {
|
|
130
112
|
const mgActionMenuindex = Number(item.getAttribute(OverflowBehaviorElements.BASE_INDEX));
|
|
131
113
|
if (this.isMoreElement(item))
|
|
132
|
-
this.toggleElement(this.
|
|
114
|
+
this.toggleElement(this.moreElement, isHidden);
|
|
133
115
|
else if (mgActionMenuindex >= 0) {
|
|
134
116
|
this.toggleElement(item, isHidden);
|
|
135
|
-
this.toggleElement(this.
|
|
117
|
+
this.toggleElement(this.moreElement.querySelector(`[${OverflowBehaviorElements.PROXY_INDEX}="${mgActionMenuindex}"]`), !isHidden);
|
|
136
118
|
}
|
|
137
119
|
};
|
|
138
120
|
/**
|
|
@@ -128,10 +128,12 @@ export const getParentWindows = (localWindow, windows = []) => {
|
|
|
128
128
|
*/
|
|
129
129
|
const getChildWindows = (localWindow, windows = []) => {
|
|
130
130
|
if (localWindow.frames.length > 0) {
|
|
131
|
+
// Window.frames is an array-like object, needs a classic for loop
|
|
132
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/frames
|
|
131
133
|
for (let i = 0; i < localWindow.frames.length; i++) {
|
|
132
134
|
const childWindow = localWindow.frames[i];
|
|
133
135
|
windows.push(childWindow);
|
|
134
|
-
|
|
136
|
+
getChildWindows(childWindow, windows);
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
return windows;
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* @param {string} currency currency to apply
|
|
7
7
|
* @returns {string} formatted currency
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export const localeCurrency = (number, locale, currency) => {
|
|
10
10
|
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
/**
|
|
13
13
|
* Format number to locale
|
|
14
14
|
*
|
|
@@ -16,9 +16,9 @@ export function localeCurrency(number, locale, currency) {
|
|
|
16
16
|
* @param {string} locale locale to apply
|
|
17
17
|
* @returns {string} formatted number
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export const localeNumber = (number, locale) => {
|
|
20
20
|
return new Intl.NumberFormat(locale).format(number);
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
22
|
/**
|
|
23
23
|
* Date RegExp
|
|
24
24
|
*/
|
|
@@ -30,12 +30,12 @@ export const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
|
30
30
|
* @param {string} locale locale to apply
|
|
31
31
|
* @returns {string} formatted date
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export const localeDate = (date, locale) => {
|
|
34
34
|
if (typeof date !== 'string' || date === '' || !dateRegExp.test(date)) {
|
|
35
35
|
return '';
|
|
36
36
|
}
|
|
37
37
|
return new Intl.DateTimeFormat(locale).format(new Date(date));
|
|
38
|
-
}
|
|
38
|
+
};
|
|
39
39
|
/**
|
|
40
40
|
* Get locale and messages
|
|
41
41
|
* We load the defined locale but for now we only support the first subtag for messages
|
|
@@ -43,12 +43,12 @@ export function localeDate(date, locale) {
|
|
|
43
43
|
* @param {HTMLElement} element element we need to get the language
|
|
44
44
|
* @param {unknown} messages messages to use
|
|
45
45
|
* @param {string} defaultLocale default messages locale
|
|
46
|
-
* @returns {{ locale: string; messages: unknown }} messages object
|
|
46
|
+
* @returns {{ locale: string; messages: Record<string, unknown> }} messages object
|
|
47
47
|
*/
|
|
48
48
|
export const getLocaleMessages = (element, messages, defaultLocale) => {
|
|
49
|
-
var _a;
|
|
50
49
|
// Get local
|
|
51
|
-
const
|
|
50
|
+
const closestLangAttribute = element.closest('[lang]');
|
|
51
|
+
const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute === null || closestLangAttribute === void 0 ? void 0 : closestLangAttribute.lang);
|
|
52
52
|
const locale = closestLang.length > 0 ? closestLang[0] : navigator.language || defaultLocale;
|
|
53
53
|
// Only keep first subtag
|
|
54
54
|
const localeSubtag = locale.split('-').shift();
|
|
@@ -43,14 +43,42 @@ export const setupResizeObserverMock = ({ disconnect, observe }) => {
|
|
|
43
43
|
/**
|
|
44
44
|
* force popover id when component use randomed identifier
|
|
45
45
|
*
|
|
46
|
-
* @param {Element}
|
|
46
|
+
* @param {Element} component element wich include mg-popover
|
|
47
47
|
* @param {string} id new fixed id
|
|
48
|
+
* @param {string} interactiveElement element where attribute 'aria-controls' is set
|
|
48
49
|
* @returns {void}
|
|
49
50
|
*/
|
|
50
|
-
export const forcePopoverId = (
|
|
51
|
-
const popover =
|
|
51
|
+
export const forcePopoverId = (component, id, interactiveElement = 'button') => {
|
|
52
|
+
const popover = component.shadowRoot.querySelector('mg-popover');
|
|
52
53
|
if (popover !== null) {
|
|
53
54
|
popover.shadowRoot.querySelector('.mg-popover').setAttribute('id', id);
|
|
54
|
-
|
|
55
|
+
component.shadowRoot.querySelector(interactiveElement).setAttribute('aria-controls', id);
|
|
55
56
|
}
|
|
56
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* fix popper console.error in test
|
|
60
|
+
* it is generated in @popperjs/core/dist/cjs/popper.js l.1859
|
|
61
|
+
* this is due to internal function isHTMLElement(), so we can not mock it directly.
|
|
62
|
+
* this function check if test DOM element mockHTMLElement instance is 'instanceof HTMLElement'
|
|
63
|
+
* so we only override the console.error side effect for this error
|
|
64
|
+
*
|
|
65
|
+
* @returns {void}
|
|
66
|
+
*/
|
|
67
|
+
export const mockConsoleError = () => {
|
|
68
|
+
jest.spyOn(console, 'error').mockImplementation(error => {
|
|
69
|
+
const compareWith = 'Popper: "arrow" element must be an HTMLElement (not an SVGElement). To use an SVG arrow, wrap it in an HTMLElement that will be used as the arrow.';
|
|
70
|
+
if (error !== compareWith)
|
|
71
|
+
console.log(error);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Add missing window.frames property to test context
|
|
76
|
+
* usefull for component with iframe listeners, ex: mg-popover
|
|
77
|
+
*
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
export const mockWindowFrames = () => {
|
|
81
|
+
Object.defineProperty(window, 'frames', {
|
|
82
|
+
value: { length: 0 },
|
|
83
|
+
});
|
|
84
|
+
};
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
Global
|
|
103
103
|
*/
|
|
104
104
|
--default-size: 3.5rem;
|
|
105
|
+
--mg-disabled-opacity: 0.4;
|
|
105
106
|
|
|
106
107
|
/*
|
|
107
108
|
<mg-icon>
|
|
@@ -117,7 +118,7 @@
|
|
|
117
118
|
|
|
118
119
|
--mg-button-border-radius: 0.3rem;
|
|
119
120
|
--mg-button-icon-border-radius: var(--default-size);
|
|
120
|
-
--mg-button-disabled-opacity:
|
|
121
|
+
--mg-button-disabled-opacity: var(--mg-disabled-opacity);
|
|
121
122
|
--mg-button-gradient: 1; /* Can only be 1 or 0 to enable disable gradient */
|
|
122
123
|
--mg-button-border-variation: 1; /* Can only be 1 or 0 to enable disable border variation */
|
|
123
124
|
|
|
@@ -59,6 +59,11 @@ const MgInput = (props, children, utils) => {
|
|
|
59
59
|
if (props.labelOnTop && props.labelHide) {
|
|
60
60
|
throw new Error('<mg-input> prop "labelOnTop" must not be paired with the prop "labelHide".');
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Set readonly value
|
|
64
|
+
*/
|
|
65
|
+
if (props.readonlyValue === undefined)
|
|
66
|
+
props.readonlyValue = props.value;
|
|
62
67
|
/**
|
|
63
68
|
* Component classes
|
|
64
69
|
*/
|
|
@@ -112,7 +117,7 @@ const MgInput = (props, children, utils) => {
|
|
|
112
117
|
getInputTitle(),
|
|
113
118
|
!props.readonly && props.tooltip && getTooltip())) : (getInputTitle()),
|
|
114
119
|
props.readonly ? (h("div", { class: "mg-input__input-container" },
|
|
115
|
-
h("strong", null, props.readonlyValue
|
|
120
|
+
h("strong", null, props.readonlyValue),
|
|
116
121
|
children.filter(child => child.$name$ === 'append-input'))) : (h("div", { class: "mg-input__input-container" },
|
|
117
122
|
h("div", { class: { 'mg-input__input': true, 'mg-input__input--has-error': props.errorMessage !== undefined } },
|
|
118
123
|
applyAriadescribedBy(children, ariaDescribedbyIDs, utils),
|
|
@@ -128,10 +128,12 @@ const getParentWindows = (localWindow, windows = []) => {
|
|
|
128
128
|
*/
|
|
129
129
|
const getChildWindows = (localWindow, windows = []) => {
|
|
130
130
|
if (localWindow.frames.length > 0) {
|
|
131
|
+
// Window.frames is an array-like object, needs a classic for loop
|
|
132
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Window/frames
|
|
131
133
|
for (let i = 0; i < localWindow.frames.length; i++) {
|
|
132
134
|
const childWindow = localWindow.frames[i];
|
|
133
135
|
windows.push(childWindow);
|
|
134
|
-
|
|
136
|
+
getChildWindows(childWindow, windows);
|
|
135
137
|
}
|
|
136
138
|
}
|
|
137
139
|
return windows;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* MgComponents custom elements */
|
|
2
|
+
export { MgActionMore as MgActionMore } from '../types/components/molecules/mg-action-more/mg-action-more';
|
|
2
3
|
export { MgBadge as MgBadge } from '../types/components/atoms/mg-badge/mg-badge';
|
|
3
4
|
export { MgButton as MgButton } from '../types/components/atoms/mg-button/mg-button';
|
|
4
5
|
export { MgCard as MgCard } from '../types/components/atoms/mg-card/mg-card';
|
|
@@ -42,6 +43,15 @@ export { MgTooltip as MgTooltip } from '../types/components/atoms/mg-tooltip/mg-
|
|
|
42
43
|
*/
|
|
43
44
|
export declare const setAssetPath: (path: string) => void;
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
48
|
+
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
49
|
+
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
50
|
+
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
51
|
+
* will result in the same behavior.
|
|
52
|
+
*/
|
|
53
|
+
export declare const setNonce: (nonce: string) => void
|
|
54
|
+
|
|
45
55
|
export interface SetPlatformOptions {
|
|
46
56
|
raf?: (c: FrameRequestCallback) => number;
|
|
47
57
|
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
package/dist/components/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
1
|
+
export { setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
|
+
export { MgActionMore, defineCustomElement as defineCustomElementMgActionMore } from './mg-action-more.js';
|
|
2
3
|
export { MgBadge, defineCustomElement as defineCustomElementMgBadge } from './mg-badge.js';
|
|
3
4
|
export { MgButton, defineCustomElement as defineCustomElementMgButton } from './mg-button.js';
|
|
4
5
|
export { MgCard, defineCustomElement as defineCustomElementMgCard } from './mg-card.js';
|