@mgdis/mg-components 5.4.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-94497267.js → index-c3450336.js} +0 -0
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{mg-badge_29.cjs.entry.js → mg-badge_30.cjs.entry.js} +380 -625
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +0 -7
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +4 -7
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +0 -7
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.css +13 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js +12 -29
- package/dist/collection/components/atoms/mg-card/mg-card.css +6 -1
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +2 -3
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -6
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +5 -12
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +4 -8
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +1 -9
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +58 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +60 -15
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -19
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +17 -33
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +17 -25
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +24 -47
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +17 -29
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +18 -33
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +23 -33
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +23 -41
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +23 -45
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -33
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +4 -7
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +8 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +4 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +13 -24
- package/dist/collection/components/molecules/mg-details/mg-details.js +4 -8
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -22
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +2 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +0 -6
- package/dist/collection/components/molecules/mg-message/mg-message.css +13 -19
- package/dist/collection/components/molecules/mg-message/mg-message.js +8 -27
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +12 -7
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -26
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +4 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +10 -5
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -22
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +13 -9
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -23
- package/dist/collection/components/molecules/mg-skip-links/doc/mg-skip-links.stories.js +24 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.conf.js +1 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.css +28 -0
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +77 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +10 -23
- package/dist/collection/locales/en/messages.json +3 -0
- package/dist/collection/locales/fr/messages.json +3 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +8 -0
- package/dist/components/mg-badge2.js +4 -7
- package/dist/components/mg-button2.js +13 -30
- package/dist/components/mg-card.js +1 -37
- package/dist/components/mg-card2.js +39 -0
- package/dist/components/mg-character-left2.js +2 -3
- package/dist/components/mg-details.js +4 -8
- package/dist/components/mg-divider.js +0 -6
- package/dist/components/mg-form.js +8 -22
- package/dist/components/mg-icon2.js +5 -12
- package/dist/components/mg-illustrated-message.js +1 -7
- package/dist/components/mg-input-checkbox.js +17 -33
- package/dist/components/mg-input-date.js +17 -25
- package/dist/components/mg-input-numeric.js +24 -47
- package/dist/components/mg-input-password.js +17 -29
- package/dist/components/mg-input-radio.js +18 -33
- package/dist/components/mg-input-select2.js +24 -34
- package/dist/components/mg-input-text2.js +23 -41
- package/dist/components/mg-input-textarea.js +23 -45
- package/dist/components/mg-input-title2.js +4 -8
- package/dist/components/mg-input-toggle.js +16 -33
- package/dist/components/mg-menu-item.js +14 -25
- package/dist/components/mg-menu.js +4 -7
- package/dist/components/mg-message.js +17 -30
- package/dist/components/mg-modal.js +18 -30
- package/dist/components/mg-pagination.js +4 -13
- package/dist/components/mg-panel.js +20 -25
- package/dist/components/mg-popover.js +16 -26
- package/dist/components/mg-skip-links.d.ts +11 -0
- package/dist/components/mg-skip-links.js +66 -0
- package/dist/components/mg-tabs.js +10 -23
- package/dist/components/mg-tag.js +34 -12
- package/dist/components/mg-tooltip2.js +6 -19
- package/dist/esm/{index-aad0184c.js → index-78edde1d.js} +0 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{mg-badge_29.entry.js → mg-badge_30.entry.js} +380 -626
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/mg-components/locales/en/messages.json +3 -0
- package/dist/mg-components/locales/fr/messages.json +3 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-3899d5d2.js → p-125c54ca.js} +0 -0
- package/dist/mg-components/p-4961c96c.entry.js +1 -0
- package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +0 -11
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +1 -1
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +0 -11
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +2 -2
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +6 -6
- package/dist/types/components/atoms/mg-tag/doc/mg-tag.stories.d.ts +0 -13
- package/dist/types/components/atoms/mg-tag/mg-tag.conf.d.ts +5 -1
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +27 -6
- package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +1 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +1 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +1 -1
- package/dist/types/components/molecules/mg-skip-links/doc/mg-skip-links.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.conf.d.ts +7 -0
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +34 -0
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +2 -2
- package/dist/types/components.d.ts +37 -6
- package/dist/types/locales/index.d.ts +6 -0
- package/dist/types/stencil-public-runtime.d.ts +5 -0
- package/dist/types/utils/unit.test.utils.d.ts +42 -0
- package/package.json +36 -31
- package/readme.md +3 -1
- package/dist/mg-components/p-059a9a59.entry.js +0 -1
|
@@ -9,29 +9,6 @@ export class MgMenuItem {
|
|
|
9
9
|
************/
|
|
10
10
|
this.name = 'mg-menu-item';
|
|
11
11
|
this.navigationButton = `${this.name}__navigation-button`;
|
|
12
|
-
/**
|
|
13
|
-
* Define menu-item status. Default: "visible"
|
|
14
|
-
*/
|
|
15
|
-
this.status = Status.VISIBLE;
|
|
16
|
-
/**
|
|
17
|
-
* Define menu-item size. Default: "large".
|
|
18
|
-
*/
|
|
19
|
-
this.size = 'large';
|
|
20
|
-
/**
|
|
21
|
-
* Define menu-item content expanded. Default: false.
|
|
22
|
-
*/
|
|
23
|
-
this.expanded = false;
|
|
24
|
-
/************
|
|
25
|
-
* States *
|
|
26
|
-
************/
|
|
27
|
-
/**
|
|
28
|
-
* Component button classes
|
|
29
|
-
*/
|
|
30
|
-
this.navigationButtonClassList = new ClassList([this.navigationButton]);
|
|
31
|
-
/**
|
|
32
|
-
* Does component have children. Default: false.
|
|
33
|
-
*/
|
|
34
|
-
this.hasChildren = false;
|
|
35
12
|
/************
|
|
36
13
|
* Methods *
|
|
37
14
|
************/
|
|
@@ -68,10 +45,22 @@ export class MgMenuItem {
|
|
|
68
45
|
* @returns {void}
|
|
69
46
|
*/
|
|
70
47
|
this.handleElementCLick = (event) => {
|
|
71
|
-
|
|
48
|
+
if (this.hasChildren || this.status === Status.DISABLED) {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
event.stopPropagation();
|
|
51
|
+
}
|
|
52
|
+
// toggle expanded when mg-menu-item has child items
|
|
72
53
|
if (this.hasChildren)
|
|
73
54
|
this.toggleExpanded();
|
|
74
55
|
};
|
|
56
|
+
this.href = undefined;
|
|
57
|
+
this.status = Status.VISIBLE;
|
|
58
|
+
this.size = 'large';
|
|
59
|
+
this.expanded = false;
|
|
60
|
+
this.navigationButtonClassList = new ClassList([this.navigationButton]);
|
|
61
|
+
this.direction = undefined;
|
|
62
|
+
this.isInMainMenu = undefined;
|
|
63
|
+
this.hasChildren = false;
|
|
75
64
|
}
|
|
76
65
|
validateStatus(newValue, oldValue) {
|
|
77
66
|
if (oldValue !== undefined) {
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
export class MgDetails {
|
|
3
3
|
constructor() {
|
|
4
|
-
/**
|
|
5
|
-
* Hide summary element
|
|
6
|
-
*/
|
|
7
|
-
this.hideSummary = false;
|
|
8
|
-
/**
|
|
9
|
-
* Define if details are diplayed
|
|
10
|
-
*/
|
|
11
|
-
this.expanded = false;
|
|
12
4
|
/**
|
|
13
5
|
* Handle details toggle
|
|
14
6
|
*
|
|
@@ -17,6 +9,10 @@ export class MgDetails {
|
|
|
17
9
|
this.handleToggle = () => {
|
|
18
10
|
this.expanded = this.details.open;
|
|
19
11
|
};
|
|
12
|
+
this.toggleClosed = undefined;
|
|
13
|
+
this.toggleOpened = undefined;
|
|
14
|
+
this.hideSummary = false;
|
|
15
|
+
this.expanded = false;
|
|
20
16
|
}
|
|
21
17
|
validateTitles(newValue) {
|
|
22
18
|
if (newValue === undefined || newValue.trim() === '') {
|
|
@@ -5,28 +5,6 @@ export class MgForm {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
// Classes
|
|
7
7
|
this.classAllRequired = 'mg-form--all-required';
|
|
8
|
-
/**
|
|
9
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
10
|
-
* If not set, it will be created.
|
|
11
|
-
*/
|
|
12
|
-
this.identifier = createID('mg-form');
|
|
13
|
-
/**
|
|
14
|
-
* Input name
|
|
15
|
-
* If not set the value equals the identifier
|
|
16
|
-
*/
|
|
17
|
-
this.name = this.identifier;
|
|
18
|
-
/**
|
|
19
|
-
* Define if form is readonly
|
|
20
|
-
*/
|
|
21
|
-
this.readonly = false;
|
|
22
|
-
/**
|
|
23
|
-
* Define if form is disabled
|
|
24
|
-
*/
|
|
25
|
-
this.disabled = false;
|
|
26
|
-
/**
|
|
27
|
-
* Component classes
|
|
28
|
-
*/
|
|
29
|
-
this.classList = new ClassList(['mg-form']);
|
|
30
8
|
/**
|
|
31
9
|
* Define required message based on mg-inputs required elements
|
|
32
10
|
* Also
|
|
@@ -96,6 +74,14 @@ export class MgForm {
|
|
|
96
74
|
input.addEventListener('input-valid', this.checkValidity);
|
|
97
75
|
});
|
|
98
76
|
};
|
|
77
|
+
this.identifier = createID('mg-form');
|
|
78
|
+
this.name = this.identifier;
|
|
79
|
+
this.readonly = false;
|
|
80
|
+
this.disabled = false;
|
|
81
|
+
this.valid = undefined;
|
|
82
|
+
this.invalid = undefined;
|
|
83
|
+
this.classList = new ClassList(['mg-form']);
|
|
84
|
+
this.requiredMessage = undefined;
|
|
99
85
|
}
|
|
100
86
|
handleAttributeChange() {
|
|
101
87
|
this.setMgInputs();
|
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css
CHANGED
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
max-width: 47.5rem;
|
|
21
21
|
}
|
|
22
22
|
.mg-illustrated-message__illustration {
|
|
23
|
-
max-height:
|
|
23
|
+
max-height: 18.4rem;
|
|
24
24
|
}
|
|
25
25
|
.mg-illustrated-message__illustration ::slotted([slot=illustration]) {
|
|
26
26
|
width: auto;
|
|
27
27
|
height: auto;
|
|
28
28
|
max-width: 100%;
|
|
29
|
-
max-height:
|
|
29
|
+
max-height: 18.4rem;
|
|
30
30
|
}
|
|
31
31
|
.mg-illustrated-message__illustration.mg-illustrated-message__illustration--small {
|
|
32
32
|
max-height: 6rem;
|
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js
CHANGED
|
@@ -2,13 +2,7 @@ import { h } from '@stencil/core';
|
|
|
2
2
|
import { isTagName } from '../../../utils/components.utils';
|
|
3
3
|
export class MgIllustratedMessage {
|
|
4
4
|
constructor() {
|
|
5
|
-
/**
|
|
6
|
-
* Define illustration size
|
|
7
|
-
*/
|
|
8
5
|
this.size = 'regular';
|
|
9
|
-
/**
|
|
10
|
-
* Define component orientation
|
|
11
|
-
*/
|
|
12
6
|
this.direction = 'vertical';
|
|
13
7
|
}
|
|
14
8
|
/*************
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--mg-card-padding: 0;
|
|
3
|
+
--mg-card-border-radius: var(--mg-message-border-radius);
|
|
4
|
+
--mg-card-border: none;
|
|
5
|
+
--mg-card-overflow: hidden;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
.mg-message {
|
|
2
9
|
display: inline-block;
|
|
3
|
-
position: relative;
|
|
4
|
-
box-sizing: border-box;
|
|
5
10
|
min-height: var(--default-size);
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
background-color: white;
|
|
8
|
-
border-radius: var(--mg-message-border-radius);
|
|
9
|
-
box-shadow: var(--box-shadow);
|
|
10
11
|
}
|
|
11
|
-
.mg-
|
|
12
|
-
content: "";
|
|
12
|
+
.mg-message__bar {
|
|
13
13
|
position: absolute;
|
|
14
14
|
top: 0;
|
|
15
15
|
left: 0;
|
|
16
16
|
width: 0.3rem;
|
|
17
17
|
height: 100%;
|
|
18
18
|
}
|
|
19
|
-
.mg-message.mg-message--info
|
|
19
|
+
.mg-message.mg-message--info .mg-message__bar {
|
|
20
20
|
background-color: hsl(var(--color-info));
|
|
21
21
|
}
|
|
22
22
|
.mg-message.mg-message--info .mg-message__icon {
|
|
23
23
|
color: hsl(var(--color-info));
|
|
24
24
|
}
|
|
25
|
-
.mg-message.mg-message--warning
|
|
25
|
+
.mg-message.mg-message--warning .mg-message__bar {
|
|
26
26
|
background-color: hsl(var(--color-warning));
|
|
27
27
|
}
|
|
28
28
|
.mg-message.mg-message--warning .mg-message__icon {
|
|
29
29
|
color: hsl(var(--color-warning));
|
|
30
30
|
}
|
|
31
|
-
.mg-message.mg-message--success
|
|
31
|
+
.mg-message.mg-message--success .mg-message__bar {
|
|
32
32
|
background-color: hsl(var(--color-success));
|
|
33
33
|
}
|
|
34
34
|
.mg-message.mg-message--success .mg-message__icon {
|
|
35
35
|
color: hsl(var(--color-success));
|
|
36
36
|
}
|
|
37
|
-
.mg-message.mg-message--danger
|
|
37
|
+
.mg-message.mg-message--danger .mg-message__bar {
|
|
38
38
|
background-color: hsl(var(--color-danger));
|
|
39
39
|
}
|
|
40
40
|
.mg-message.mg-message--danger .mg-message__icon {
|
|
41
41
|
color: hsl(var(--color-danger));
|
|
42
42
|
}
|
|
43
43
|
.mg-message.mg-message--close-button {
|
|
44
|
-
padding
|
|
44
|
+
--mg-card-padding: 0 3.4rem 0 0;
|
|
45
45
|
}
|
|
46
46
|
.mg-message.mg-message--hide {
|
|
47
47
|
display: none;
|
|
@@ -50,14 +50,12 @@
|
|
|
50
50
|
margin: 0;
|
|
51
51
|
padding: 0;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
53
|
.mg-message__icon {
|
|
55
54
|
position: absolute;
|
|
56
55
|
top: calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);
|
|
57
56
|
left: 1.3rem;
|
|
58
57
|
line-height: 1;
|
|
59
58
|
}
|
|
60
|
-
|
|
61
59
|
.mg-message__content {
|
|
62
60
|
display: flex;
|
|
63
61
|
flex-wrap: wrap;
|
|
@@ -65,23 +63,19 @@
|
|
|
65
63
|
align-content: stretch;
|
|
66
64
|
padding: 0 1rem 0 3.8rem;
|
|
67
65
|
}
|
|
68
|
-
|
|
69
66
|
.mg-message__content-slot {
|
|
70
67
|
flex-grow: 1;
|
|
71
68
|
margin: 0.84rem 0;
|
|
72
69
|
}
|
|
73
|
-
|
|
74
70
|
.mg-message__content-separator {
|
|
75
71
|
display: inline-block;
|
|
76
72
|
width: 4.5rem;
|
|
77
73
|
height: 0;
|
|
78
74
|
}
|
|
79
|
-
|
|
80
75
|
.mg-message__content-actions-slot {
|
|
81
76
|
padding: 1rem 0;
|
|
82
77
|
text-align: right;
|
|
83
78
|
}
|
|
84
|
-
|
|
85
79
|
.mg-message__close-button {
|
|
86
80
|
position: absolute;
|
|
87
81
|
top: 0;
|
|
@@ -13,32 +13,6 @@ export class MgMessage {
|
|
|
13
13
|
this.closeButtonId = '';
|
|
14
14
|
// Stored timer setted when hide action is run from setTimeOut
|
|
15
15
|
this.storedTimer = null;
|
|
16
|
-
/**
|
|
17
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
18
|
-
* If not set, it will be created.
|
|
19
|
-
*/
|
|
20
|
-
this.identifier = createID('mg-message');
|
|
21
|
-
/**
|
|
22
|
-
* Message variant
|
|
23
|
-
*/
|
|
24
|
-
this.variant = variants[0]; // info
|
|
25
|
-
/**
|
|
26
|
-
* Define if message has a cross button
|
|
27
|
-
* RG 01: https://jira.mgdis.fr/browse/PDA9-140
|
|
28
|
-
*/
|
|
29
|
-
this.closeButton = false;
|
|
30
|
-
/**
|
|
31
|
-
* Define if message is hidden
|
|
32
|
-
*/
|
|
33
|
-
this.hide = false;
|
|
34
|
-
/**
|
|
35
|
-
* Component classes
|
|
36
|
-
*/
|
|
37
|
-
this.classList = new ClassList(['mg-message']);
|
|
38
|
-
/**
|
|
39
|
-
* Define if component is using actions slot
|
|
40
|
-
*/
|
|
41
|
-
this.hasActions = false;
|
|
42
16
|
/**
|
|
43
17
|
* Handle close button
|
|
44
18
|
*/
|
|
@@ -75,6 +49,13 @@ export class MgMessage {
|
|
|
75
49
|
break;
|
|
76
50
|
}
|
|
77
51
|
};
|
|
52
|
+
this.identifier = createID('mg-message');
|
|
53
|
+
this.delay = undefined;
|
|
54
|
+
this.variant = variants[0];
|
|
55
|
+
this.closeButton = false;
|
|
56
|
+
this.hide = false;
|
|
57
|
+
this.classList = new ClassList(['mg-message']);
|
|
58
|
+
this.hasActions = false;
|
|
78
59
|
}
|
|
79
60
|
validateDelay(newValue) {
|
|
80
61
|
if (newValue && newValue < 2) {
|
|
@@ -136,7 +117,7 @@ export class MgMessage {
|
|
|
136
117
|
* @returns {HTMLElement} HTML Element
|
|
137
118
|
*/
|
|
138
119
|
render() {
|
|
139
|
-
return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
|
|
120
|
+
return (h("div", { id: this.identifier, class: this.classList.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card", null, h("span", { class: "mg-message__bar" }), h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))))));
|
|
140
121
|
}
|
|
141
122
|
static get is() { return "mg-message"; }
|
|
142
123
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--mg-card-border-radius: var(--mg-modal-border-radius);
|
|
3
|
+
--mg-card-padding: 1.5rem 2.5rem;
|
|
4
|
+
--mg-card-border: none;
|
|
5
|
+
}
|
|
6
|
+
|
|
1
7
|
.mg-modal {
|
|
2
8
|
display: flex;
|
|
3
9
|
justify-content: center;
|
|
@@ -11,21 +17,20 @@
|
|
|
11
17
|
padding: 2rem 0;
|
|
12
18
|
background-color: hsla(var(--color-light), 85%);
|
|
13
19
|
}
|
|
20
|
+
.mg-modal mg-card {
|
|
21
|
+
display: flex;
|
|
22
|
+
width: 60rem;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
max-height: 100%;
|
|
25
|
+
}
|
|
14
26
|
.mg-modal__dialog {
|
|
15
27
|
display: flex;
|
|
16
28
|
position: relative;
|
|
17
29
|
flex-direction: column;
|
|
18
30
|
align-self: center;
|
|
19
31
|
row-gap: 3rem;
|
|
20
|
-
padding: 1.5rem 2.5rem;
|
|
21
|
-
width: 60rem;
|
|
22
32
|
height: fit-content;
|
|
23
|
-
max-width: 100%;
|
|
24
33
|
max-height: 100%;
|
|
25
|
-
box-sizing: border-box;
|
|
26
|
-
background-color: hsl(var(--color-light));
|
|
27
|
-
box-shadow: var(--box-shadow);
|
|
28
|
-
border-radius: var(--mg-modal-border-radius);
|
|
29
34
|
}
|
|
30
35
|
.mg-modal__header {
|
|
31
36
|
margin-bottom: 0.5rem;
|
|
@@ -8,31 +8,6 @@ export class MgModal {
|
|
|
8
8
|
// IDs
|
|
9
9
|
this.closeButtonId = '';
|
|
10
10
|
this.titleId = '';
|
|
11
|
-
/**
|
|
12
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
13
|
-
* If not set, it will be created.
|
|
14
|
-
*/
|
|
15
|
-
this.identifier = createID('mg-modal');
|
|
16
|
-
/**
|
|
17
|
-
* Define if modal has a cross button
|
|
18
|
-
*/
|
|
19
|
-
this.closeButton = false;
|
|
20
|
-
/**
|
|
21
|
-
* Define if modal is hidden
|
|
22
|
-
*/
|
|
23
|
-
this.hide = false;
|
|
24
|
-
/**
|
|
25
|
-
* Define if component is using actions slot
|
|
26
|
-
*/
|
|
27
|
-
this.hasActions = false;
|
|
28
|
-
/**
|
|
29
|
-
* Define if component is using content slot
|
|
30
|
-
*/
|
|
31
|
-
this.hasContent = false;
|
|
32
|
-
/**
|
|
33
|
-
* Component classes
|
|
34
|
-
*/
|
|
35
|
-
this.classList = new ClassList(['mg-modal']);
|
|
36
11
|
this.setFocus = () => {
|
|
37
12
|
// Get all focusable elements
|
|
38
13
|
this.modalFocusableElements = Array.from(this.element.querySelectorAll(focusableElements)).reduce((acc, focusableElement) => {
|
|
@@ -75,6 +50,13 @@ export class MgModal {
|
|
|
75
50
|
this.handleClose = () => {
|
|
76
51
|
this.hide = true;
|
|
77
52
|
};
|
|
53
|
+
this.identifier = createID('mg-modal');
|
|
54
|
+
this.modalTitle = undefined;
|
|
55
|
+
this.closeButton = false;
|
|
56
|
+
this.hide = false;
|
|
57
|
+
this.hasActions = false;
|
|
58
|
+
this.hasContent = false;
|
|
59
|
+
this.classList = new ClassList(['mg-modal']);
|
|
78
60
|
}
|
|
79
61
|
validateModalTitle(newValue) {
|
|
80
62
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -150,7 +132,7 @@ export class MgModal {
|
|
|
150
132
|
* @returns {HTMLElement} HTML Element
|
|
151
133
|
*/
|
|
152
134
|
render() {
|
|
153
|
-
return (h("
|
|
135
|
+
return (h("div", { role: "alertdialog", id: this.identifier, class: this.classList.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" })))))));
|
|
154
136
|
}
|
|
155
137
|
static get is() { return "mg-modal"; }
|
|
156
138
|
static get encapsulation() { return "shadow"; }
|
|
@@ -25,19 +25,6 @@ import { initLocales } from './../../../locales';
|
|
|
25
25
|
const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
|
|
26
26
|
export class MgPagination {
|
|
27
27
|
constructor() {
|
|
28
|
-
/**
|
|
29
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
30
|
-
* If not set, it will be created.
|
|
31
|
-
*/
|
|
32
|
-
this.identifier = createID('mg-pagination');
|
|
33
|
-
/**
|
|
34
|
-
* Component total pages
|
|
35
|
-
*/
|
|
36
|
-
this.totalPages = 1;
|
|
37
|
-
/**
|
|
38
|
-
* Component current page
|
|
39
|
-
*/
|
|
40
|
-
this.currentPage = 1;
|
|
41
28
|
/**
|
|
42
29
|
* Change current page from target
|
|
43
30
|
*
|
|
@@ -70,6 +57,10 @@ export class MgPagination {
|
|
|
70
57
|
this.handleGoToPage = (action, disabled) => {
|
|
71
58
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
72
59
|
};
|
|
60
|
+
this.identifier = createID('mg-pagination');
|
|
61
|
+
this.label = undefined;
|
|
62
|
+
this.totalPages = 1;
|
|
63
|
+
this.currentPage = 1;
|
|
73
64
|
}
|
|
74
65
|
validateTotalPages(newValue) {
|
|
75
66
|
if (newValue < 1) {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
:host {
|
|
2
|
+
--mg-card-border: none;
|
|
3
|
+
--mg-card-padding: 0;
|
|
4
|
+
--mg-card-border-radius: var(--mg-panel-border-radius);
|
|
5
|
+
--mg-card-background: hsl(var(--mg-panel-background));
|
|
6
|
+
--mg-card-box-shadow: var(--mg-panel-box-shadow);
|
|
7
|
+
}
|
|
8
|
+
|
|
6
9
|
.mg-panel__header {
|
|
7
10
|
display: flex;
|
|
8
11
|
flex-wrap: wrap;
|
|
@@ -17,6 +20,8 @@
|
|
|
17
20
|
.mg-panel__header-right {
|
|
18
21
|
padding-left: 0.3rem;
|
|
19
22
|
flex: 1 auto;
|
|
23
|
+
min-height: var(--default-size);
|
|
24
|
+
align-items: center;
|
|
20
25
|
}
|
|
21
26
|
.mg-panel__header-left mg-input-text {
|
|
22
27
|
flex-grow: 1;
|
|
@@ -3,27 +3,6 @@ import { createID, ClassList } from '../../../utils/components.utils';
|
|
|
3
3
|
import { initLocales } from '../../../locales';
|
|
4
4
|
export class MgPanel {
|
|
5
5
|
constructor() {
|
|
6
|
-
/**
|
|
7
|
-
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
8
|
-
* If not set, it will be created.
|
|
9
|
-
*/
|
|
10
|
-
this.identifier = createID('mg-panel');
|
|
11
|
-
/**
|
|
12
|
-
* Panel is opened
|
|
13
|
-
*/
|
|
14
|
-
this.expanded = false;
|
|
15
|
-
/**
|
|
16
|
-
* Panel title is editabled
|
|
17
|
-
*/
|
|
18
|
-
this.titleEditable = false;
|
|
19
|
-
/**
|
|
20
|
-
* Component classes
|
|
21
|
-
*/
|
|
22
|
-
this.classList = new ClassList(['mg-panel']);
|
|
23
|
-
/**
|
|
24
|
-
* Title is in edition mode
|
|
25
|
-
*/
|
|
26
|
-
this.isEditing = false;
|
|
27
6
|
/************
|
|
28
7
|
* Methods *
|
|
29
8
|
************/
|
|
@@ -108,6 +87,16 @@ export class MgPanel {
|
|
|
108
87
|
}
|
|
109
88
|
return collapseButton();
|
|
110
89
|
};
|
|
90
|
+
this.identifier = createID('mg-panel');
|
|
91
|
+
this.panelTitle = undefined;
|
|
92
|
+
this.titlePattern = undefined;
|
|
93
|
+
this.titlePatternErrorMessage = undefined;
|
|
94
|
+
this.expanded = false;
|
|
95
|
+
this.expandToggleDisabled = undefined;
|
|
96
|
+
this.titleEditable = false;
|
|
97
|
+
this.classList = new ClassList(['mg-panel']);
|
|
98
|
+
this.isEditing = false;
|
|
99
|
+
this.updatedPanelTitle = undefined;
|
|
111
100
|
}
|
|
112
101
|
validatePanelTitle(newValue) {
|
|
113
102
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -158,7 +147,7 @@ export class MgPanel {
|
|
|
158
147
|
* @returns {HTMLElement} html element
|
|
159
148
|
*/
|
|
160
149
|
render() {
|
|
161
|
-
return (h("section", { class: this.classList.join(), id: this.identifier }, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null))));
|
|
150
|
+
return (h("section", { class: this.classList.join(), id: this.identifier }, h("mg-card", null, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null)))));
|
|
162
151
|
}
|
|
163
152
|
static get is() { return "mg-panel"; }
|
|
164
153
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
:host {
|
|
2
|
+
--mg-card-padding: 1.5rem;
|
|
3
|
+
--mg-card-border: none;
|
|
4
|
+
--mg-card-border-radius: 0.5rem;
|
|
5
|
+
--mg-card-background: hsl(var(--mg-popover-background-color));
|
|
6
|
+
position: relative;
|
|
2
7
|
display: contents;
|
|
3
8
|
}
|
|
4
|
-
|
|
9
|
+
:host::slotted(*) {
|
|
5
10
|
display: inline-block;
|
|
6
11
|
}
|
|
7
12
|
|
|
8
13
|
.mg-popover {
|
|
9
14
|
display: none;
|
|
10
|
-
|
|
11
|
-
z-index: 1000;
|
|
12
|
-
border-radius: 0.5rem;
|
|
13
|
-
background-color: hsl(var(--mg-popover-background-color));
|
|
14
|
-
box-shadow: var(--box-shadow);
|
|
15
|
+
z-index: 2000;
|
|
15
16
|
color: hsl(var(--mg-popover-font-color));
|
|
16
17
|
}
|
|
18
|
+
.mg-popover mg-card {
|
|
19
|
+
z-index: -1;
|
|
20
|
+
}
|
|
17
21
|
.mg-popover[data-show] {
|
|
18
22
|
display: block;
|
|
19
23
|
}
|
|
@@ -27,8 +31,8 @@ mg-popover::slotted(*) {
|
|
|
27
31
|
position: absolute;
|
|
28
32
|
width: 2rem;
|
|
29
33
|
height: 2rem;
|
|
30
|
-
z-index:
|
|
31
|
-
background:
|
|
34
|
+
z-index: 2000;
|
|
35
|
+
background: hsl(var(--mg-popover-background-color));
|
|
32
36
|
}
|
|
33
37
|
.mg-popover__arrow {
|
|
34
38
|
visibility: hidden;
|
|
@@ -5,27 +5,6 @@ import { initLocales } from '../../../locales';
|
|
|
5
5
|
export class MgPopover {
|
|
6
6
|
constructor() {
|
|
7
7
|
this.closeButtonId = '';
|
|
8
|
-
/**
|
|
9
|
-
* Sets an `id` attribute.
|
|
10
|
-
* Needed by the input for accessibility `aria-decribedby`.
|
|
11
|
-
*/
|
|
12
|
-
this.identifier = createID('mg-popover');
|
|
13
|
-
/**
|
|
14
|
-
* Popover placement
|
|
15
|
-
*/
|
|
16
|
-
this.placement = 'bottom';
|
|
17
|
-
/**
|
|
18
|
-
* Define if popover has a cross button
|
|
19
|
-
*/
|
|
20
|
-
this.closeButton = false;
|
|
21
|
-
/**
|
|
22
|
-
* Display popover
|
|
23
|
-
*/
|
|
24
|
-
this.display = false;
|
|
25
|
-
/**
|
|
26
|
-
* Disable popover
|
|
27
|
-
*/
|
|
28
|
-
this.disabled = false;
|
|
29
8
|
/**
|
|
30
9
|
* Check if clicked outside of component
|
|
31
10
|
*
|
|
@@ -76,6 +55,11 @@ export class MgPopover {
|
|
|
76
55
|
this.handleCloseButton = () => {
|
|
77
56
|
this.display = false;
|
|
78
57
|
};
|
|
58
|
+
this.identifier = createID('mg-popover');
|
|
59
|
+
this.placement = 'bottom';
|
|
60
|
+
this.closeButton = false;
|
|
61
|
+
this.display = false;
|
|
62
|
+
this.disabled = false;
|
|
79
63
|
}
|
|
80
64
|
handleDisplay(newValue) {
|
|
81
65
|
if (newValue) {
|
|
@@ -114,7 +98,7 @@ export class MgPopover {
|
|
|
114
98
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
115
99
|
}
|
|
116
100
|
// Get popover content
|
|
117
|
-
this.popover = this.element.shadowRoot.
|
|
101
|
+
this.popover = this.element.shadowRoot.getElementById(this.identifier);
|
|
118
102
|
//Get interactive element (first element without slot attribute)
|
|
119
103
|
const interactiveElement = this.element.querySelector(':not([slot])');
|
|
120
104
|
// Add aria attributes
|
|
@@ -151,7 +135,7 @@ export class MgPopover {
|
|
|
151
135
|
* @returns {HTMLElement} HTML Element
|
|
152
136
|
*/
|
|
153
137
|
render() {
|
|
154
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: "mg-popover" }, 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 }))));
|
|
138
|
+
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 }))));
|
|
155
139
|
}
|
|
156
140
|
static get is() { return "mg-popover"; }
|
|
157
141
|
static get encapsulation() { return "shadow"; }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { filterArgs } from '../../../../../.storybook/utils';
|
|
3
|
+
export default {
|
|
4
|
+
component: 'mg-skip-links',
|
|
5
|
+
title: 'Molecules/mg-skip-links',
|
|
6
|
+
parameters: { actions: { handles: ['expanded-change'] } },
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Template
|
|
10
|
+
*
|
|
11
|
+
* @param {any} args component arguments
|
|
12
|
+
* @returns {HTMLElement} HTMLElement
|
|
13
|
+
*/
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
const Template = (args) => h("mg-skip-links", Object.assign({}, filterArgs(args)));
|
|
16
|
+
export const MgSkipLinks = Template.bind({});
|
|
17
|
+
MgSkipLinks.args = {
|
|
18
|
+
links: [
|
|
19
|
+
{ href: '#content', label: 'Content' },
|
|
20
|
+
{ href: '#menu', label: 'Menu' },
|
|
21
|
+
{ href: '#search', label: 'Search' },
|
|
22
|
+
{ href: '#footer', label: 'Footer' },
|
|
23
|
+
],
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.mg-skip-links {
|
|
2
|
+
position: absolute;
|
|
3
|
+
transform: translateY(-100%);
|
|
4
|
+
opacity: 0;
|
|
5
|
+
background: hsl(var(--color-light));
|
|
6
|
+
}
|
|
7
|
+
.mg-skip-links:focus-within {
|
|
8
|
+
position: relative;
|
|
9
|
+
transform: translateY(0);
|
|
10
|
+
opacity: 1;
|
|
11
|
+
}
|
|
12
|
+
.mg-skip-links__list {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-wrap: wrap;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 0.6rem;
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0.64rem 1.8rem;
|
|
19
|
+
list-style: none;
|
|
20
|
+
}
|
|
21
|
+
.mg-skip-links__link {
|
|
22
|
+
display: inline-block;
|
|
23
|
+
padding: 1.2rem;
|
|
24
|
+
color: hsl(var(--color-dark));
|
|
25
|
+
}
|
|
26
|
+
.mg-skip-links__link:hover {
|
|
27
|
+
background: hsl(var(--color-dark), 0.1);
|
|
28
|
+
}
|