@mgdis/mg-components 4.0.1 → 4.1.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/.storybook/utils.js +24 -0
- package/dist/cjs/{index-a39c5567.js → index-179621c8.js} +11 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{mg-badge_21.cjs.entry.js → mg-badge_24.cjs.entry.js} +2362 -213
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-modal.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/atoms/mg-badge/doc/mg-badge.stories.js +9 -5
- package/dist/collection/components/atoms/mg-button/doc/mg-button.stories.js +15 -12
- package/dist/collection/components/atoms/mg-button/mg-button.conf.js +4 -0
- package/dist/collection/components/atoms/mg-button/mg-button.js +46 -20
- package/dist/collection/components/atoms/mg-character-left/doc/mg-character-left.stories.js +9 -12
- package/dist/collection/components/atoms/mg-icon/doc/mg-icon.stories.js +11 -3
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +13 -0
- package/dist/collection/components/atoms/mg-input-title/doc/mg-input-title.stories.js +9 -9
- package/dist/collection/components/atoms/mg-tag/doc/mg-tag.stories.js +9 -7
- package/dist/collection/components/atoms/mg-tooltip/doc/mg-tooltip.stories.js +27 -8
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +6 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +64 -11
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/doc/mg-input-checkbox.stories.js +3 -15
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-date/doc/mg-input-date.stories.js +3 -12
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-numeric/doc/mg-input-numeric.stories.js +3 -14
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-password/doc/mg-input-password.stories.js +3 -14
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/doc/mg-input-radio.stories.js +3 -14
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +3 -16
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-text/doc/mg-input-text.stories.js +11 -22
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-textarea/doc/mg-input-textarea.stories.js +4 -13
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/doc/mg-input-toggle.stories.js +17 -38
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +4 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +16 -7
- package/dist/collection/components/molecules/mg-details/doc/mg-details.stories.js +25 -0
- package/dist/collection/components/molecules/mg-details/mg-details.css +14 -0
- package/dist/collection/components/molecules/mg-details/mg-details.js +141 -0
- package/dist/collection/components/molecules/mg-form/doc/mg-form.stories.js +9 -6
- package/dist/collection/components/molecules/mg-form/mg-form.css +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +48 -4
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +22 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.css +37 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -0
- package/dist/collection/components/molecules/mg-message/doc/mg-message.stories.js +9 -15
- package/dist/collection/components/molecules/mg-modal/doc/mg-modal.stories.js +23 -31
- package/dist/collection/components/molecules/mg-pagination/doc/mg-pagination.stories.js +7 -11
- package/dist/collection/components/molecules/mg-panel/doc/mg-panel.stories.js +16 -26
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -6
- package/dist/collection/components/molecules/mg-popover/doc/mg-popover.stories.js +13 -17
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +24 -8
- package/dist/collection/components/molecules/mg-tabs/doc/mg-tabs.stories.js +11 -12
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +14 -14
- package/dist/collection/stories/helpers.stories.js +11 -3
- package/dist/collection/stories/icons.stories.js +10 -2
- package/dist/collection/stories/typography.stories.js +8 -1
- package/dist/collection/utils/components.utils.js +10 -0
- package/dist/components/components.utils.js +11 -1
- package/dist/components/index.d.ts +25 -23
- package/dist/components/index.js +2 -0
- package/dist/components/mg-button2.js +6 -14
- package/dist/components/mg-details.d.ts +11 -0
- package/dist/components/mg-details.js +87 -0
- package/dist/components/mg-form.js +35 -5
- package/dist/components/mg-icon2.js +13 -0
- package/dist/components/mg-illustrated-message.d.ts +11 -0
- package/dist/components/mg-illustrated-message.js +68 -0
- package/dist/components/mg-input-checkbox.js +1 -1
- package/dist/components/mg-input-date.js +1 -1
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +1 -1
- package/dist/components/mg-input-select2.js +1 -1
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +1 -1
- package/dist/components/mg-input-toggle.js +17 -8
- package/dist/components/mg-panel.js +0 -4
- package/dist/components/mg-popover.js +10 -9
- package/dist/components/mg-tabs.js +5 -4
- package/dist/components/mg-tooltip2.js +73 -11
- package/dist/esm/{index-e51ae032.js → index-7efedd97.js} +11 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{mg-badge_21.entry.js → mg-badge_24.entry.js} +2359 -213
- package/dist/esm/mg-components.js +2 -2
- package/dist/esm/mg-modal.entry.js +1 -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-5f89600c.js +1 -0
- package/dist/mg-components/{p-462d648a.entry.js → p-a2883dc7.entry.js} +1 -1
- package/dist/mg-components/p-cffe0519.entry.js +1 -0
- package/dist/types/components/atoms/mg-button/doc/mg-button.stories.d.ts +6 -0
- package/dist/types/components/atoms/mg-button/mg-button.conf.d.ts +8 -0
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +11 -0
- package/dist/types/components/atoms/mg-character-left/doc/mg-character-left.stories.d.ts +0 -10
- package/dist/types/components/atoms/mg-tooltip/doc/mg-tooltip.stories.d.ts +1 -6
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +5 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +25 -1
- package/dist/types/components/molecules/mg-details/doc/mg-details.stories.d.ts +11 -0
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +49 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +13 -0
- package/dist/types/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.d.ts +6 -0
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +28 -0
- package/dist/types/components/molecules/mg-popover/doc/mg-popover.stories.d.ts +4 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +6 -1
- package/dist/types/components.d.ts +95 -0
- package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts +1 -0
- package/dist/types/utils/components.utils.d.ts +8 -0
- package/package.json +11 -11
- package/dist/cjs/mg-popover.cjs.entry.js +0 -170
- package/dist/cjs/popper-71bf3058.js +0 -1790
- package/dist/esm/mg-popover.entry.js +0 -166
- package/dist/esm/popper-93ecb064.js +0 -1788
- package/dist/mg-components/p-4c66f794.js +0 -1
- package/dist/mg-components/p-5126ab10.entry.js +0 -1
- package/dist/mg-components/p-766c918b.entry.js +0 -1
- package/dist/mg-components/p-780bd52d.js +0 -1
|
@@ -5,6 +5,7 @@ export declare class MgTooltip {
|
|
|
5
5
|
************/
|
|
6
6
|
private popper;
|
|
7
7
|
private tooltip;
|
|
8
|
+
private guard;
|
|
8
9
|
/**************
|
|
9
10
|
* Decorators *
|
|
10
11
|
**************/
|
|
@@ -29,7 +30,7 @@ export declare class MgTooltip {
|
|
|
29
30
|
* Display tooltip
|
|
30
31
|
*/
|
|
31
32
|
display: boolean;
|
|
32
|
-
handleDisplay(
|
|
33
|
+
handleDisplay(newValue: boolean): void;
|
|
33
34
|
/**
|
|
34
35
|
* Disable tooltip
|
|
35
36
|
*/
|
|
@@ -46,6 +47,29 @@ export declare class MgTooltip {
|
|
|
46
47
|
* @returns {void}
|
|
47
48
|
*/
|
|
48
49
|
private hide;
|
|
50
|
+
/**
|
|
51
|
+
* Method to set display prop
|
|
52
|
+
*
|
|
53
|
+
* @param {boolean} newValue display prop new value
|
|
54
|
+
* @param {boolean} condition additionnal condition to apply display prop newValue
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
private setDisplay;
|
|
58
|
+
/**
|
|
59
|
+
* Action for tooltip element and tooltiped element mouse listener
|
|
60
|
+
*
|
|
61
|
+
* @param {Guard} elementGuard tooltip element guard
|
|
62
|
+
* @param {boolean} isMouseenter mouseenter validation
|
|
63
|
+
* @param {Guard} conditionalGuard guard condition
|
|
64
|
+
* @returns {void}
|
|
65
|
+
*/
|
|
66
|
+
private tooltipMouseListenerAction;
|
|
67
|
+
/**
|
|
68
|
+
* Method to reset guard value
|
|
69
|
+
*
|
|
70
|
+
* @returns {void}
|
|
71
|
+
*/
|
|
72
|
+
private resetGuard;
|
|
49
73
|
/*************
|
|
50
74
|
* Lifecycle *
|
|
51
75
|
*************/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
+
export declare class MgDetails {
|
|
3
|
+
/************
|
|
4
|
+
* Internal *
|
|
5
|
+
************/
|
|
6
|
+
private details;
|
|
7
|
+
/**************
|
|
8
|
+
* Decorators *
|
|
9
|
+
**************/
|
|
10
|
+
/**
|
|
11
|
+
* Displayed title when details are closed
|
|
12
|
+
*/
|
|
13
|
+
toggleClosed: string;
|
|
14
|
+
/**
|
|
15
|
+
* Displayed title when details are opened
|
|
16
|
+
*/
|
|
17
|
+
toggleOpened: string;
|
|
18
|
+
validateTitles(newValue: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Define if details are diplayed
|
|
21
|
+
*/
|
|
22
|
+
expanded: boolean;
|
|
23
|
+
handleExpanded(newValue: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* Emmited event when expanded change
|
|
26
|
+
*/
|
|
27
|
+
expandedChange: EventEmitter<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Handle details toggle
|
|
30
|
+
*
|
|
31
|
+
* @returns {void}
|
|
32
|
+
*/
|
|
33
|
+
private handleToggle;
|
|
34
|
+
/*************
|
|
35
|
+
* Lifecycle *
|
|
36
|
+
*************/
|
|
37
|
+
/**
|
|
38
|
+
* Check if component props are well configured on init
|
|
39
|
+
*
|
|
40
|
+
* @returns {void}
|
|
41
|
+
*/
|
|
42
|
+
componentWillLoad(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Render
|
|
45
|
+
*
|
|
46
|
+
* @returns {HTMLElement} HTML Element
|
|
47
|
+
*/
|
|
48
|
+
render(): HTMLElement;
|
|
49
|
+
}
|
|
@@ -5,7 +5,9 @@ export declare class MgForm {
|
|
|
5
5
|
* Internal *
|
|
6
6
|
************/
|
|
7
7
|
private mgInputs;
|
|
8
|
+
private mgButtons;
|
|
8
9
|
private requiredMessage;
|
|
10
|
+
private form;
|
|
9
11
|
private messages;
|
|
10
12
|
/**************
|
|
11
13
|
* Decorators *
|
|
@@ -46,6 +48,10 @@ export declare class MgForm {
|
|
|
46
48
|
* Tells if form is valid or not
|
|
47
49
|
*/
|
|
48
50
|
formValid: EventEmitter<boolean>;
|
|
51
|
+
/**
|
|
52
|
+
* Emitted event on form submit
|
|
53
|
+
*/
|
|
54
|
+
formSubmit: EventEmitter<boolean>;
|
|
49
55
|
/**
|
|
50
56
|
* Public method to display errors
|
|
51
57
|
*
|
|
@@ -65,6 +71,7 @@ export declare class MgForm {
|
|
|
65
71
|
* @returns {void}
|
|
66
72
|
*/
|
|
67
73
|
private checkValidity;
|
|
74
|
+
private handleFormSubmit;
|
|
68
75
|
/*************
|
|
69
76
|
* Lifecycle *
|
|
70
77
|
*************/
|
|
@@ -74,6 +81,12 @@ export declare class MgForm {
|
|
|
74
81
|
* @returns {void}
|
|
75
82
|
*/
|
|
76
83
|
componentWillLoad(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Add slot listeners
|
|
86
|
+
*
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
componentDidLoad(): void;
|
|
77
90
|
/**
|
|
78
91
|
* Render
|
|
79
92
|
*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare class MgIllustratedMessage {
|
|
2
|
+
/**************
|
|
3
|
+
* Decorators *
|
|
4
|
+
**************/
|
|
5
|
+
/**
|
|
6
|
+
* Get component DOM element
|
|
7
|
+
*/
|
|
8
|
+
element: HTMLMgIllustratedMessageElement;
|
|
9
|
+
/**
|
|
10
|
+
* Define illustration size
|
|
11
|
+
*/
|
|
12
|
+
size: 'regular' | 'small';
|
|
13
|
+
/*************
|
|
14
|
+
* Lifecycle *
|
|
15
|
+
*************/
|
|
16
|
+
/**
|
|
17
|
+
* Check if component props are well configured on init
|
|
18
|
+
*
|
|
19
|
+
* @returns {void}
|
|
20
|
+
*/
|
|
21
|
+
componentDidLoad(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Render
|
|
24
|
+
*
|
|
25
|
+
* @returns {HTMLElement} HTML Element
|
|
26
|
+
*/
|
|
27
|
+
render(): HTMLElement;
|
|
28
|
+
}
|
|
@@ -6,6 +6,9 @@ declare const _default: {
|
|
|
6
6
|
docs: {
|
|
7
7
|
iframeHeight: number;
|
|
8
8
|
};
|
|
9
|
+
actions: {
|
|
10
|
+
handles: string[];
|
|
11
|
+
};
|
|
9
12
|
};
|
|
10
13
|
argTypes: {
|
|
11
14
|
placement: {
|
|
@@ -15,7 +18,7 @@ declare const _default: {
|
|
|
15
18
|
};
|
|
16
19
|
table: {
|
|
17
20
|
defaultValue: {
|
|
18
|
-
summary:
|
|
21
|
+
summary: string;
|
|
19
22
|
};
|
|
20
23
|
};
|
|
21
24
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
1
2
|
import { Placement } from './mg-popover.conf';
|
|
2
3
|
export declare class MgPopover {
|
|
3
4
|
/************
|
|
@@ -31,11 +32,15 @@ export declare class MgPopover {
|
|
|
31
32
|
* Display popover
|
|
32
33
|
*/
|
|
33
34
|
display: boolean;
|
|
34
|
-
handleDisplay(
|
|
35
|
+
handleDisplay(newValue: boolean): void;
|
|
35
36
|
/**
|
|
36
37
|
* Disable popover
|
|
37
38
|
*/
|
|
38
39
|
disabled: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Emited event when display value change
|
|
42
|
+
*/
|
|
43
|
+
displayChange: EventEmitter<boolean>;
|
|
39
44
|
/**
|
|
40
45
|
* Check if clicked outside of component
|
|
41
46
|
*
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
import { BadgeType } from "./components/atoms/mg-badge/mg-badge.conf";
|
|
9
|
+
import { ButtonType } from "./components/atoms/mg-button/mg-button.conf";
|
|
9
10
|
import { CheckboxValue } from "./components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf";
|
|
10
11
|
import { Width } from "./components/molecules/inputs/MgInput.conf";
|
|
11
12
|
import { RadioOption } from "./components/molecules/inputs/mg-input-radio/mg-input-radio.conf";
|
|
@@ -50,6 +51,10 @@ export namespace Components {
|
|
|
50
51
|
* Prop to set aria-expanded on button element
|
|
51
52
|
*/
|
|
52
53
|
"expanded": boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Define form id to attach button with. If this attribute is not set, the <button> is associated with its ancestor <form> element.
|
|
56
|
+
*/
|
|
57
|
+
"form": string;
|
|
53
58
|
/**
|
|
54
59
|
* Option to set aria-haspopup The aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity.
|
|
55
60
|
*/
|
|
@@ -66,6 +71,10 @@ export namespace Components {
|
|
|
66
71
|
* aria-label In case button text is not explicit enough
|
|
67
72
|
*/
|
|
68
73
|
"label": string;
|
|
74
|
+
/**
|
|
75
|
+
* Define button type Default: 'submit', as HTMLButtonElement type is submit by default
|
|
76
|
+
*/
|
|
77
|
+
"type": ButtonType;
|
|
69
78
|
/**
|
|
70
79
|
* Define button variant
|
|
71
80
|
*/
|
|
@@ -85,6 +94,20 @@ export namespace Components {
|
|
|
85
94
|
*/
|
|
86
95
|
"maxlength": number;
|
|
87
96
|
}
|
|
97
|
+
interface MgDetails {
|
|
98
|
+
/**
|
|
99
|
+
* Define if details are diplayed
|
|
100
|
+
*/
|
|
101
|
+
"expanded": boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Displayed title when details are closed
|
|
104
|
+
*/
|
|
105
|
+
"toggleClosed": string;
|
|
106
|
+
/**
|
|
107
|
+
* Displayed title when details are opened
|
|
108
|
+
*/
|
|
109
|
+
"toggleOpened": string;
|
|
110
|
+
}
|
|
88
111
|
interface MgForm {
|
|
89
112
|
/**
|
|
90
113
|
* Define if form is disabled
|
|
@@ -134,6 +157,12 @@ export namespace Components {
|
|
|
134
157
|
*/
|
|
135
158
|
"variant": string;
|
|
136
159
|
}
|
|
160
|
+
interface MgIllustratedMessage {
|
|
161
|
+
/**
|
|
162
|
+
* Define illustration size
|
|
163
|
+
*/
|
|
164
|
+
"size": 'regular' | 'small';
|
|
165
|
+
}
|
|
137
166
|
interface MgInputCheckbox {
|
|
138
167
|
/**
|
|
139
168
|
* Define if input is disabled
|
|
@@ -989,6 +1018,10 @@ export namespace Components {
|
|
|
989
1018
|
"placement": Placement1;
|
|
990
1019
|
}
|
|
991
1020
|
}
|
|
1021
|
+
export interface MgDetailsCustomEvent<T> extends CustomEvent<T> {
|
|
1022
|
+
detail: T;
|
|
1023
|
+
target: HTMLMgDetailsElement;
|
|
1024
|
+
}
|
|
992
1025
|
export interface MgFormCustomEvent<T> extends CustomEvent<T> {
|
|
993
1026
|
detail: T;
|
|
994
1027
|
target: HTMLMgFormElement;
|
|
@@ -1045,6 +1078,10 @@ export interface MgPanelCustomEvent<T> extends CustomEvent<T> {
|
|
|
1045
1078
|
detail: T;
|
|
1046
1079
|
target: HTMLMgPanelElement;
|
|
1047
1080
|
}
|
|
1081
|
+
export interface MgPopoverCustomEvent<T> extends CustomEvent<T> {
|
|
1082
|
+
detail: T;
|
|
1083
|
+
target: HTMLMgPopoverElement;
|
|
1084
|
+
}
|
|
1048
1085
|
export interface MgTabsCustomEvent<T> extends CustomEvent<T> {
|
|
1049
1086
|
detail: T;
|
|
1050
1087
|
target: HTMLMgTabsElement;
|
|
@@ -1068,6 +1105,12 @@ declare global {
|
|
|
1068
1105
|
prototype: HTMLMgCharacterLeftElement;
|
|
1069
1106
|
new (): HTMLMgCharacterLeftElement;
|
|
1070
1107
|
};
|
|
1108
|
+
interface HTMLMgDetailsElement extends Components.MgDetails, HTMLStencilElement {
|
|
1109
|
+
}
|
|
1110
|
+
var HTMLMgDetailsElement: {
|
|
1111
|
+
prototype: HTMLMgDetailsElement;
|
|
1112
|
+
new (): HTMLMgDetailsElement;
|
|
1113
|
+
};
|
|
1071
1114
|
interface HTMLMgFormElement extends Components.MgForm, HTMLStencilElement {
|
|
1072
1115
|
}
|
|
1073
1116
|
var HTMLMgFormElement: {
|
|
@@ -1080,6 +1123,12 @@ declare global {
|
|
|
1080
1123
|
prototype: HTMLMgIconElement;
|
|
1081
1124
|
new (): HTMLMgIconElement;
|
|
1082
1125
|
};
|
|
1126
|
+
interface HTMLMgIllustratedMessageElement extends Components.MgIllustratedMessage, HTMLStencilElement {
|
|
1127
|
+
}
|
|
1128
|
+
var HTMLMgIllustratedMessageElement: {
|
|
1129
|
+
prototype: HTMLMgIllustratedMessageElement;
|
|
1130
|
+
new (): HTMLMgIllustratedMessageElement;
|
|
1131
|
+
};
|
|
1083
1132
|
interface HTMLMgInputCheckboxElement extends Components.MgInputCheckbox, HTMLStencilElement {
|
|
1084
1133
|
}
|
|
1085
1134
|
var HTMLMgInputCheckboxElement: {
|
|
@@ -1192,8 +1241,10 @@ declare global {
|
|
|
1192
1241
|
"mg-badge": HTMLMgBadgeElement;
|
|
1193
1242
|
"mg-button": HTMLMgButtonElement;
|
|
1194
1243
|
"mg-character-left": HTMLMgCharacterLeftElement;
|
|
1244
|
+
"mg-details": HTMLMgDetailsElement;
|
|
1195
1245
|
"mg-form": HTMLMgFormElement;
|
|
1196
1246
|
"mg-icon": HTMLMgIconElement;
|
|
1247
|
+
"mg-illustrated-message": HTMLMgIllustratedMessageElement;
|
|
1197
1248
|
"mg-input-checkbox": HTMLMgInputCheckboxElement;
|
|
1198
1249
|
"mg-input-date": HTMLMgInputDateElement;
|
|
1199
1250
|
"mg-input-numeric": HTMLMgInputNumericElement;
|
|
@@ -1250,6 +1301,10 @@ declare namespace LocalJSX {
|
|
|
1250
1301
|
* Prop to set aria-expanded on button element
|
|
1251
1302
|
*/
|
|
1252
1303
|
"expanded"?: boolean;
|
|
1304
|
+
/**
|
|
1305
|
+
* Define form id to attach button with. If this attribute is not set, the <button> is associated with its ancestor <form> element.
|
|
1306
|
+
*/
|
|
1307
|
+
"form"?: string;
|
|
1253
1308
|
/**
|
|
1254
1309
|
* Option to set aria-haspopup The aria-haspopup state informs assistive technology users that there is a popup and the type of popup it is, but provides no interactivity.
|
|
1255
1310
|
*/
|
|
@@ -1266,6 +1321,10 @@ declare namespace LocalJSX {
|
|
|
1266
1321
|
* aria-label In case button text is not explicit enough
|
|
1267
1322
|
*/
|
|
1268
1323
|
"label"?: string;
|
|
1324
|
+
/**
|
|
1325
|
+
* Define button type Default: 'submit', as HTMLButtonElement type is submit by default
|
|
1326
|
+
*/
|
|
1327
|
+
"type"?: ButtonType;
|
|
1269
1328
|
/**
|
|
1270
1329
|
* Define button variant
|
|
1271
1330
|
*/
|
|
@@ -1285,6 +1344,24 @@ declare namespace LocalJSX {
|
|
|
1285
1344
|
*/
|
|
1286
1345
|
"maxlength": number;
|
|
1287
1346
|
}
|
|
1347
|
+
interface MgDetails {
|
|
1348
|
+
/**
|
|
1349
|
+
* Define if details are diplayed
|
|
1350
|
+
*/
|
|
1351
|
+
"expanded"?: boolean;
|
|
1352
|
+
/**
|
|
1353
|
+
* Emmited event when expanded change
|
|
1354
|
+
*/
|
|
1355
|
+
"onExpanded-change"?: (event: MgDetailsCustomEvent<boolean>) => void;
|
|
1356
|
+
/**
|
|
1357
|
+
* Displayed title when details are closed
|
|
1358
|
+
*/
|
|
1359
|
+
"toggleClosed"?: string;
|
|
1360
|
+
/**
|
|
1361
|
+
* Displayed title when details are opened
|
|
1362
|
+
*/
|
|
1363
|
+
"toggleOpened"?: string;
|
|
1364
|
+
}
|
|
1288
1365
|
interface MgForm {
|
|
1289
1366
|
/**
|
|
1290
1367
|
* Define if form is disabled
|
|
@@ -1302,6 +1379,10 @@ declare namespace LocalJSX {
|
|
|
1302
1379
|
* Input name If not set the value equals the identifier
|
|
1303
1380
|
*/
|
|
1304
1381
|
"name"?: string;
|
|
1382
|
+
/**
|
|
1383
|
+
* Emitted event on form submit
|
|
1384
|
+
*/
|
|
1385
|
+
"onForm-submit"?: (event: MgFormCustomEvent<boolean>) => void;
|
|
1305
1386
|
/**
|
|
1306
1387
|
* Emitted event on form validity check Tells if form is valid or not
|
|
1307
1388
|
*/
|
|
@@ -1333,6 +1414,12 @@ declare namespace LocalJSX {
|
|
|
1333
1414
|
*/
|
|
1334
1415
|
"variant"?: string;
|
|
1335
1416
|
}
|
|
1417
|
+
interface MgIllustratedMessage {
|
|
1418
|
+
/**
|
|
1419
|
+
* Define illustration size
|
|
1420
|
+
*/
|
|
1421
|
+
"size"?: 'regular' | 'small';
|
|
1422
|
+
}
|
|
1336
1423
|
interface MgInputCheckbox {
|
|
1337
1424
|
/**
|
|
1338
1425
|
* Define if input is disabled
|
|
@@ -2183,6 +2270,10 @@ declare namespace LocalJSX {
|
|
|
2183
2270
|
* Sets an `id` attribute. Needed by the input for accessibility `aria-decribedby`.
|
|
2184
2271
|
*/
|
|
2185
2272
|
"identifier"?: string;
|
|
2273
|
+
/**
|
|
2274
|
+
* Emited event when display value change
|
|
2275
|
+
*/
|
|
2276
|
+
"onDisplay-change"?: (event: MgPopoverCustomEvent<boolean>) => void;
|
|
2186
2277
|
/**
|
|
2187
2278
|
* Popover placement
|
|
2188
2279
|
*/
|
|
@@ -2250,8 +2341,10 @@ declare namespace LocalJSX {
|
|
|
2250
2341
|
"mg-badge": MgBadge;
|
|
2251
2342
|
"mg-button": MgButton;
|
|
2252
2343
|
"mg-character-left": MgCharacterLeft;
|
|
2344
|
+
"mg-details": MgDetails;
|
|
2253
2345
|
"mg-form": MgForm;
|
|
2254
2346
|
"mg-icon": MgIcon;
|
|
2347
|
+
"mg-illustrated-message": MgIllustratedMessage;
|
|
2255
2348
|
"mg-input-checkbox": MgInputCheckbox;
|
|
2256
2349
|
"mg-input-date": MgInputDate;
|
|
2257
2350
|
"mg-input-numeric": MgInputNumeric;
|
|
@@ -2279,8 +2372,10 @@ declare module "@stencil/core" {
|
|
|
2279
2372
|
"mg-badge": LocalJSX.MgBadge & JSXBase.HTMLAttributes<HTMLMgBadgeElement>;
|
|
2280
2373
|
"mg-button": LocalJSX.MgButton & JSXBase.HTMLAttributes<HTMLMgButtonElement>;
|
|
2281
2374
|
"mg-character-left": LocalJSX.MgCharacterLeft & JSXBase.HTMLAttributes<HTMLMgCharacterLeftElement>;
|
|
2375
|
+
"mg-details": LocalJSX.MgDetails & JSXBase.HTMLAttributes<HTMLMgDetailsElement>;
|
|
2282
2376
|
"mg-form": LocalJSX.MgForm & JSXBase.HTMLAttributes<HTMLMgFormElement>;
|
|
2283
2377
|
"mg-icon": LocalJSX.MgIcon & JSXBase.HTMLAttributes<HTMLMgIconElement>;
|
|
2378
|
+
"mg-illustrated-message": LocalJSX.MgIllustratedMessage & JSXBase.HTMLAttributes<HTMLMgIllustratedMessageElement>;
|
|
2284
2379
|
"mg-input-checkbox": LocalJSX.MgInputCheckbox & JSXBase.HTMLAttributes<HTMLMgInputCheckboxElement>;
|
|
2285
2380
|
"mg-input-date": LocalJSX.MgInputDate & JSXBase.HTMLAttributes<HTMLMgInputDateElement>;
|
|
2286
2381
|
"mg-input-numeric": LocalJSX.MgInputNumeric & JSXBase.HTMLAttributes<HTMLMgInputNumericElement>;
|
package/dist/types/home/runner/work/mg-components/mg-components/.stencil/.storybook/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const filterArgs: (args: any, defaultValues?: any) => any;
|
|
@@ -48,3 +48,11 @@ export declare class ClassList {
|
|
|
48
48
|
* @returns {boolean} all items are string
|
|
49
49
|
*/
|
|
50
50
|
export declare function allItemsAreString(items: string[]): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Check if element is a heading
|
|
53
|
+
*
|
|
54
|
+
* @param {Element} element slotted element
|
|
55
|
+
* @param {string[]} tagNames allowed tag names list
|
|
56
|
+
* @returns {boolean} element is a heading
|
|
57
|
+
*/
|
|
58
|
+
export declare function isTagName(element: Element, tagNames: string[]): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgdis/mg-components",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "MG Components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@popperjs/core": "^2.11.2",
|
|
45
|
-
"@stencil/core": "^2.17.
|
|
45
|
+
"@stencil/core": "^2.17.4",
|
|
46
46
|
"normalize.css": "^8.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
|
|
52
52
|
"@stencil/eslint-plugin": "^0.4.0",
|
|
53
53
|
"@stencil/sass": "^1.5.2",
|
|
54
|
-
"@storybook/addon-a11y": "^6.5.
|
|
55
|
-
"@storybook/addon-actions": "^6.5.
|
|
56
|
-
"@storybook/addon-docs": "^6.5.
|
|
57
|
-
"@storybook/addon-essentials": "^6.5.
|
|
58
|
-
"@storybook/addon-links": "^6.5.
|
|
59
|
-
"@storybook/html": "^6.5.
|
|
54
|
+
"@storybook/addon-a11y": "^6.5.10",
|
|
55
|
+
"@storybook/addon-actions": "^6.5.10",
|
|
56
|
+
"@storybook/addon-docs": "^6.5.10",
|
|
57
|
+
"@storybook/addon-essentials": "^6.5.10",
|
|
58
|
+
"@storybook/addon-links": "^6.5.10",
|
|
59
|
+
"@storybook/html": "^6.5.10",
|
|
60
60
|
"@storybook/preset-scss": "^1.0.3",
|
|
61
61
|
"@types/jest": "^26.0.24",
|
|
62
62
|
"@types/jest-image-snapshot": "^4.3.1",
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
"@typescript-eslint/parser": "^4.33.0",
|
|
65
65
|
"babel-loader": "^8.2.2",
|
|
66
66
|
"babel-plugin-jsx-pragmatic": "^1.0.2",
|
|
67
|
-
"chromatic": "^6.
|
|
67
|
+
"chromatic": "^6.7.1",
|
|
68
68
|
"css-loader": "^5.2.7",
|
|
69
69
|
"eslint": "^7.32.0",
|
|
70
70
|
"eslint-plugin-jsdoc": "^38.0.6",
|
|
71
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
71
|
+
"eslint-plugin-jsx-a11y": "^6.6.1",
|
|
72
72
|
"eslint-plugin-react": "^7.26.1",
|
|
73
|
-
"eslint-plugin-storybook": "^0.
|
|
73
|
+
"eslint-plugin-storybook": "^0.6.4",
|
|
74
74
|
"husky": "^7.0.4",
|
|
75
75
|
"jest": "^26.6.3",
|
|
76
76
|
"jest-cli": "^26.6.3",
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-88560a66.js');
|
|
6
|
-
const index$1 = require('./index-a39c5567.js');
|
|
7
|
-
const popper = require('./popper-71bf3058.js');
|
|
8
|
-
|
|
9
|
-
const mgPopoverCss = "mg-popover.sc-mg-popover{display:contents}mg-popover.sc-mg-popover-s>*{display:inline-block}.mg-popover.sc-mg-popover{display:none;padding:1.5rem;z-index:9999;border-radius:0.5rem;background-color:hsl(var(--mg-popover-background-color));box-shadow:var(--box-shadow);color:hsl(var(--mg-popover-font-color))}.mg-popover[data-show].sc-mg-popover{display:block}.mg-popover.sc-mg-popover mg-button.sc-mg-popover{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.sc-mg-popover .mg-popover__arrow.sc-mg-popover,.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover::before{position:absolute;width:2rem;height:2rem;z-index:-1;background:inherit}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover{visibility:hidden}.mg-popover.sc-mg-popover .mg-popover__arrow.sc-mg-popover::before{visibility:visible;content:\"\";transform:rotate(45deg)}.mg-popover[data-popper-placement^=top].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{bottom:-6px}.mg-popover[data-popper-placement^=bottom].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{top:-6px}.mg-popover[data-popper-placement^=left].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{right:-6px}.mg-popover[data-popper-placement^=right].sc-mg-popover>.mg-popover__arrow.sc-mg-popover{left:-6px}.mg-popover__title.sc-mg-popover-s>*,.mg-popover__title .sc-mg-popover-s>*{margin:0 0 1rem;font-size:var(--mg-popover-title-font-size);font-weight:600}";
|
|
10
|
-
|
|
11
|
-
const MgPopover = class {
|
|
12
|
-
constructor(hostRef) {
|
|
13
|
-
index.registerInstance(this, hostRef);
|
|
14
|
-
this.closeButtonId = '';
|
|
15
|
-
/**
|
|
16
|
-
* Sets an `id` attribute.
|
|
17
|
-
* Needed by the input for accessibility `aria-decribedby`.
|
|
18
|
-
*/
|
|
19
|
-
this.identifier = index$1.createID('mg-popover');
|
|
20
|
-
/**
|
|
21
|
-
* Popover placement
|
|
22
|
-
*/
|
|
23
|
-
this.placement = 'bottom';
|
|
24
|
-
/**
|
|
25
|
-
* Define if popover has a cross button
|
|
26
|
-
*/
|
|
27
|
-
this.closeButton = false;
|
|
28
|
-
/**
|
|
29
|
-
* Display popover
|
|
30
|
-
*/
|
|
31
|
-
this.display = false;
|
|
32
|
-
/**
|
|
33
|
-
* Disable popover
|
|
34
|
-
*/
|
|
35
|
-
this.disabled = false;
|
|
36
|
-
/**
|
|
37
|
-
* Check if clicked outside of component
|
|
38
|
-
*
|
|
39
|
-
* @param {MouseEvent} event mouse event
|
|
40
|
-
* @returns {void}
|
|
41
|
-
*/
|
|
42
|
-
this.clickOutside = (event) => {
|
|
43
|
-
var _a;
|
|
44
|
-
if (!this.disabled && ((_a = event.target.closest(`#${this.identifier}`)) === null || _a === void 0 ? void 0 : _a.parentElement.nodeName) !== 'MG-POPOVER') {
|
|
45
|
-
this.display = false;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Show popover
|
|
50
|
-
*
|
|
51
|
-
* @returns {void}
|
|
52
|
-
*/
|
|
53
|
-
this.show = () => {
|
|
54
|
-
// Make the popover visible
|
|
55
|
-
this.popover.setAttribute('data-show', '');
|
|
56
|
-
// Enable the event listeners
|
|
57
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: true }] })));
|
|
58
|
-
// Update its position
|
|
59
|
-
this.popper.update();
|
|
60
|
-
// hide when click outside
|
|
61
|
-
// setTimeout is used to prevent event to trigger after creation
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
document.addEventListener('click', this.clickOutside, false);
|
|
64
|
-
}, 0);
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Hide popover
|
|
68
|
-
*
|
|
69
|
-
* @returns {void}
|
|
70
|
-
*/
|
|
71
|
-
this.hide = () => {
|
|
72
|
-
// Hide the popover
|
|
73
|
-
this.popover.removeAttribute('data-show');
|
|
74
|
-
// Disable the event listeners
|
|
75
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: false }] })));
|
|
76
|
-
// Remove event listener
|
|
77
|
-
document.removeEventListener('click', this.clickOutside, false);
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Handle action for close button
|
|
81
|
-
*
|
|
82
|
-
* @returns {void}
|
|
83
|
-
*/
|
|
84
|
-
this.handleCloseButton = () => {
|
|
85
|
-
this.display = false;
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
handleDisplay(newVal) {
|
|
89
|
-
if (newVal) {
|
|
90
|
-
this.show();
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
this.hide();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/*************
|
|
97
|
-
* Lifecycle *
|
|
98
|
-
*************/
|
|
99
|
-
/**
|
|
100
|
-
* Check if component props are well configured on init
|
|
101
|
-
*
|
|
102
|
-
* @returns {void} timeout
|
|
103
|
-
*/
|
|
104
|
-
componentWillLoad() {
|
|
105
|
-
// Get locales
|
|
106
|
-
this.messages = index$1.initLocales(this.element).messages;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Check if component props are well configured on init
|
|
110
|
-
*
|
|
111
|
-
* @returns {void}
|
|
112
|
-
*/
|
|
113
|
-
componentDidLoad() {
|
|
114
|
-
//Check if slotted title is a heading
|
|
115
|
-
const headingElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
116
|
-
const slotedTitleElement = this.element.querySelector('[slot="title"]');
|
|
117
|
-
if (slotedTitleElement !== null && !headingElements.includes(slotedTitleElement.tagName.toLowerCase())) {
|
|
118
|
-
throw new Error(`<mg-popover> Slotted title must be a heading: ${headingElements.join(', ')}.`);
|
|
119
|
-
}
|
|
120
|
-
// Set close button id
|
|
121
|
-
if (this.closeButton) {
|
|
122
|
-
this.closeButtonId = `${this.identifier}-close-button`;
|
|
123
|
-
}
|
|
124
|
-
// Get popover content
|
|
125
|
-
this.popover = this.element.querySelector(`#${this.identifier}`);
|
|
126
|
-
//Get interactive element
|
|
127
|
-
const interactiveElement = this.element.firstElementChild;
|
|
128
|
-
// Add aria attributes
|
|
129
|
-
interactiveElement.setAttribute('aria-controls', this.identifier);
|
|
130
|
-
interactiveElement.setAttribute('aria-expanded', `${this.display}`);
|
|
131
|
-
// Create popperjs popover
|
|
132
|
-
this.popper = popper.createPopper(interactiveElement, this.popover, {
|
|
133
|
-
placement: this.placement,
|
|
134
|
-
modifiers: [
|
|
135
|
-
{
|
|
136
|
-
name: 'offset',
|
|
137
|
-
options: {
|
|
138
|
-
offset: [0, 10],
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
});
|
|
143
|
-
// Add events to toggle display
|
|
144
|
-
interactiveElement.addEventListener('click', () => {
|
|
145
|
-
if (!this.disabled)
|
|
146
|
-
this.display = !this.display;
|
|
147
|
-
});
|
|
148
|
-
// Add events to hide popover
|
|
149
|
-
this.element.addEventListener('keydown', e => {
|
|
150
|
-
if (!this.disabled && e.code === 'Escape')
|
|
151
|
-
this.display = false;
|
|
152
|
-
});
|
|
153
|
-
this.handleDisplay(this.display);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Render
|
|
157
|
-
*
|
|
158
|
-
* @returns {HTMLElement} HTML Element
|
|
159
|
-
*/
|
|
160
|
-
render() {
|
|
161
|
-
return (index.h(index.Host, null, index.h("slot", null), index.h("div", { id: this.identifier, class: "mg-popover" }, !this.disabled && this.closeButton && (index.h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, index.h("mg-icon", { icon: "cross" }))), index.h("div", { class: "mg-popover__title" }, index.h("slot", { name: "title" })), index.h("slot", { name: "content" }), index.h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
162
|
-
}
|
|
163
|
-
get element() { return index.getElement(this); }
|
|
164
|
-
static get watchers() { return {
|
|
165
|
-
"display": ["handleDisplay"]
|
|
166
|
-
}; }
|
|
167
|
-
};
|
|
168
|
-
MgPopover.style = mgPopoverCss;
|
|
169
|
-
|
|
170
|
-
exports.mg_popover = MgPopover;
|