@mgdis/mg-components 5.1.0 → 5.3.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/loader.cjs.js +1 -1
- package/dist/cjs/{mg-badge_27.cjs.entry.js → mg-badge_29.cjs.entry.js} +730 -242
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +14 -19
- package/dist/collection/components/atoms/mg-button/mg-button.js +3 -3
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -7
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +3 -11
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +41 -20
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +50 -39
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +25 -6
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +42 -33
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +25 -6
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +36 -17
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +35 -14
- package/dist/collection/components/molecules/inputs/mg-input-select/doc/mg-input-select.stories.js +2 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +28 -6
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +36 -17
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +25 -6
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +38 -19
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +25 -6
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +37 -18
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/doc/mg-menu.stories.js +87 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +8 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.css +10 -0
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +185 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.js +32 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js +22 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +316 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +324 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +73 -27
- package/dist/collection/components/molecules/mg-illustrated-message/doc/mg-illustrated-message.stories.js +6 -6
- package/dist/collection/components/molecules/mg-message/mg-message.js +1 -1
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +0 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.conf.js +3 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +67 -17
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +10 -4
- package/dist/collection/locales/index.js +3 -1
- package/dist/collection/utils/unit.test.utils.js +51 -0
- package/dist/collection/variables.css +29 -7
- package/dist/components/MgInput.js +4 -12
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index2.js +3 -1
- package/dist/components/mg-badge2.js +1 -1
- package/dist/components/mg-button2.js +3 -3
- package/dist/components/mg-form.js +67 -26
- package/dist/components/mg-input-checkbox.js +36 -21
- package/dist/components/mg-input-date.js +44 -39
- package/dist/components/mg-input-numeric.js +37 -34
- package/dist/components/mg-input-password.js +32 -19
- package/dist/components/mg-input-radio.js +30 -15
- package/dist/components/mg-input-select2.js +32 -19
- package/dist/components/mg-input-text2.js +34 -21
- package/dist/components/mg-input-textarea.js +32 -19
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-menu-item.d.ts +11 -0
- package/dist/components/mg-menu-item.js +273 -0
- package/dist/components/mg-menu.conf.js +10 -0
- package/dist/components/mg-menu.d.ts +11 -0
- package/dist/components/mg-menu.js +149 -0
- package/dist/components/mg-message.js +1 -1
- package/dist/components/mg-modal.js +0 -4
- package/dist/components/mg-tabs.js +6 -2
- package/dist/components/mg-tag.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mg-badge_27.entry.js → mg-badge_29.entry.js} +729 -243
- package/dist/esm/mg-components.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-204af46f.entry.js +1 -0
- package/dist/mg-components/variables.css +29 -7
- package/dist/types/components/atoms/mg-badge/doc/mg-badge.stories.d.ts +2 -2
- package/dist/types/components/atoms/mg-badge/mg-badge.conf.d.ts +5 -5
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +8 -8
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +2 -2
- package/dist/types/components/atoms/mg-icon/doc/mg-icon.stories.d.ts +2 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +10 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +7 -6
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +10 -8
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +3 -8
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +3 -8
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +5 -4
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -3
- package/dist/types/components/molecules/menu/mg-menu/doc/mg-menu.stories.d.ts +17 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +7 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +69 -0
- package/dist/types/components/molecules/menu/mg-menu-item/doc/mg-menu-item.stories.d.ts +11 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +24 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +119 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +21 -1
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +3 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -0
- package/dist/types/components/molecules/mg-tabs/doc/mg-tabs.stories.d.ts +1 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.conf.d.ts +12 -4
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +6 -6
- package/dist/types/components.d.ts +91 -14
- package/dist/types/locales/index.d.ts +7 -1
- package/dist/types/stories/icons.stories.d.ts +1 -1
- package/package.json +7 -8
- package/dist/collection/utils/test.utils.js +0 -38
- package/dist/mg-components/p-e131701a.entry.js +0 -1
- package/dist/types/utils/test.utils.d.ts +0 -17
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { ClassList } from '../../../../utils/components.utils';
|
|
2
|
+
import { MgMenu } from '../mg-menu/mg-menu';
|
|
3
|
+
import { MenuItemSizeType, Status } from './mg-menu-item.conf';
|
|
4
|
+
export declare class MgMenuItem {
|
|
5
|
+
/************
|
|
6
|
+
* Internal *
|
|
7
|
+
************/
|
|
8
|
+
private readonly name;
|
|
9
|
+
private readonly navigationButton;
|
|
10
|
+
/**************
|
|
11
|
+
* Decorators *
|
|
12
|
+
**************/
|
|
13
|
+
/**
|
|
14
|
+
* Get component DOM element
|
|
15
|
+
*/
|
|
16
|
+
element: HTMLMgMenuItemElement;
|
|
17
|
+
/************
|
|
18
|
+
* Props *
|
|
19
|
+
************/
|
|
20
|
+
/**
|
|
21
|
+
* Define menu-item badge
|
|
22
|
+
* when defined menu-item contain an anchor instead of button
|
|
23
|
+
*/
|
|
24
|
+
href: string;
|
|
25
|
+
/**
|
|
26
|
+
* Define menu-item status. Default: "visible"
|
|
27
|
+
*/
|
|
28
|
+
status: Status;
|
|
29
|
+
validateStatus(newValue: MgMenuItem['status'], oldValue?: MgMenuItem['status']): void;
|
|
30
|
+
/**
|
|
31
|
+
* Define menu-item size. Default: "large".
|
|
32
|
+
*/
|
|
33
|
+
size: MenuItemSizeType;
|
|
34
|
+
validateSize(newValue: MgMenuItem['size'], oldValue?: MgMenuItem['size']): void;
|
|
35
|
+
/**
|
|
36
|
+
* Define menu-item content expanded. Default: false.
|
|
37
|
+
*/
|
|
38
|
+
expanded: boolean;
|
|
39
|
+
validateExpanded(newValue: MgMenuItem['expanded']): void;
|
|
40
|
+
/************
|
|
41
|
+
* States *
|
|
42
|
+
************/
|
|
43
|
+
/**
|
|
44
|
+
* Component classes
|
|
45
|
+
*/
|
|
46
|
+
classList: ClassList;
|
|
47
|
+
/**
|
|
48
|
+
* Component button classes
|
|
49
|
+
*/
|
|
50
|
+
navigationButtonClassList: ClassList;
|
|
51
|
+
/**
|
|
52
|
+
* Parent menu direction
|
|
53
|
+
*/
|
|
54
|
+
direction: MgMenu['direction'];
|
|
55
|
+
/**
|
|
56
|
+
* Does component is in main menu
|
|
57
|
+
*/
|
|
58
|
+
isInMainMenu: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Does component have children. Default: false.
|
|
61
|
+
*/
|
|
62
|
+
hasChildren: boolean;
|
|
63
|
+
validateHasChildren(newValue: boolean): void;
|
|
64
|
+
/************
|
|
65
|
+
* Methods *
|
|
66
|
+
************/
|
|
67
|
+
/**
|
|
68
|
+
* Toggle expanded prop value
|
|
69
|
+
*
|
|
70
|
+
* @returns {void}
|
|
71
|
+
*/
|
|
72
|
+
private toggleExpanded;
|
|
73
|
+
/**
|
|
74
|
+
* Does an HTMLElement contain child with given Status
|
|
75
|
+
*
|
|
76
|
+
* @param {HTMLElement} element to parse
|
|
77
|
+
* @param {MgMenuItem['status']} status to check
|
|
78
|
+
* @returns {boolean} true if element with status is found
|
|
79
|
+
*/
|
|
80
|
+
private hasChildElementStatus;
|
|
81
|
+
/**
|
|
82
|
+
* Is component contextual direction match the given direction
|
|
83
|
+
*
|
|
84
|
+
* @param {MgMenuItem['direction']} direction in parent menu
|
|
85
|
+
* @returns {boolean} true is direction match the direction propertie
|
|
86
|
+
*/
|
|
87
|
+
private isdirection;
|
|
88
|
+
/************
|
|
89
|
+
* Handlers *
|
|
90
|
+
************/
|
|
91
|
+
/**
|
|
92
|
+
* Handle interacrtive element click
|
|
93
|
+
*
|
|
94
|
+
* @param {MouseEvent} event click on element
|
|
95
|
+
* @returns {void}
|
|
96
|
+
*/
|
|
97
|
+
private handleElementCLick;
|
|
98
|
+
/*************
|
|
99
|
+
* Lifecycle *
|
|
100
|
+
*************/
|
|
101
|
+
/**
|
|
102
|
+
* Validate props
|
|
103
|
+
*
|
|
104
|
+
* @returns {void}
|
|
105
|
+
*/
|
|
106
|
+
componentWillLoad(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Check if component slots configuration
|
|
109
|
+
*
|
|
110
|
+
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
111
|
+
*/
|
|
112
|
+
componentDidLoad(): ReturnType<typeof setTimeout>;
|
|
113
|
+
/**
|
|
114
|
+
* Render
|
|
115
|
+
*
|
|
116
|
+
* @returns {HTMLElement} HTML Element
|
|
117
|
+
*/
|
|
118
|
+
render(): HTMLElement;
|
|
119
|
+
}
|
|
@@ -6,12 +6,15 @@ export declare class MgForm {
|
|
|
6
6
|
************/
|
|
7
7
|
private mgInputs;
|
|
8
8
|
private mgButtons;
|
|
9
|
-
private
|
|
9
|
+
private classAllRequired;
|
|
10
10
|
private form;
|
|
11
11
|
private messages;
|
|
12
12
|
/**************
|
|
13
13
|
* Decorators *
|
|
14
14
|
**************/
|
|
15
|
+
/**
|
|
16
|
+
* Get component DOM element
|
|
17
|
+
*/
|
|
15
18
|
element: HTMLMgFormElement;
|
|
16
19
|
/**
|
|
17
20
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
@@ -31,6 +34,7 @@ export declare class MgForm {
|
|
|
31
34
|
* Define if form is disabled
|
|
32
35
|
*/
|
|
33
36
|
disabled: boolean;
|
|
37
|
+
handleAttributeChange(): void;
|
|
34
38
|
/**
|
|
35
39
|
* Define form valid state
|
|
36
40
|
*/
|
|
@@ -43,6 +47,10 @@ export declare class MgForm {
|
|
|
43
47
|
* Component classes
|
|
44
48
|
*/
|
|
45
49
|
classList: ClassList;
|
|
50
|
+
/**
|
|
51
|
+
* Required message
|
|
52
|
+
*/
|
|
53
|
+
requiredMessage: string;
|
|
46
54
|
/**
|
|
47
55
|
* Emitted event on form validity check
|
|
48
56
|
* Tells if form is valid or not
|
|
@@ -71,7 +79,19 @@ export declare class MgForm {
|
|
|
71
79
|
* @returns {void}
|
|
72
80
|
*/
|
|
73
81
|
private checkValidity;
|
|
82
|
+
/**
|
|
83
|
+
* Handle Form Submit
|
|
84
|
+
*
|
|
85
|
+
* @param {SubmitEvent} event submit event
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
74
88
|
private handleFormSubmit;
|
|
89
|
+
/**
|
|
90
|
+
* Set mgInputs
|
|
91
|
+
*
|
|
92
|
+
* @returns {void}
|
|
93
|
+
*/
|
|
94
|
+
private setMgInputs;
|
|
75
95
|
/*************
|
|
76
96
|
* Lifecycle *
|
|
77
97
|
*************/
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MgBadge } from '../../atoms/mg-badge/mg-badge';
|
|
2
|
+
import { MgIcon } from '../../atoms/mg-icon/mg-icon';
|
|
3
|
+
/**
|
|
4
|
+
* Available tabs items status
|
|
5
|
+
*/
|
|
2
6
|
export declare enum Status {
|
|
3
7
|
VISIBLE = "visible",
|
|
4
8
|
HIDDEN = "hidden",
|
|
@@ -11,11 +15,15 @@ export declare enum Status {
|
|
|
11
15
|
*/
|
|
12
16
|
export declare type TabItem = {
|
|
13
17
|
label: string;
|
|
14
|
-
icon?:
|
|
15
|
-
badge?:
|
|
18
|
+
icon?: MgIcon['icon'];
|
|
19
|
+
badge?: Pick<MgBadge, 'value' | 'variant' | 'label'>;
|
|
16
20
|
status: Status;
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
23
|
* List of all possibles sizes
|
|
20
24
|
*/
|
|
21
|
-
export declare const sizes:
|
|
25
|
+
export declare const sizes: readonly ["regular", "large"];
|
|
26
|
+
/**
|
|
27
|
+
* Variant type from variants
|
|
28
|
+
*/
|
|
29
|
+
export declare type SizeType = typeof sizes[number];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
2
|
import { ClassList } from '../../../utils/components.utils';
|
|
3
|
-
import { TabItem } from './mg-tabs.conf';
|
|
3
|
+
import { TabItem, SizeType } from './mg-tabs.conf';
|
|
4
4
|
export declare class MgTabs {
|
|
5
5
|
/************
|
|
6
6
|
* Internal *
|
|
@@ -25,24 +25,24 @@ export declare class MgTabs {
|
|
|
25
25
|
* Required for accessibility
|
|
26
26
|
*/
|
|
27
27
|
label: string;
|
|
28
|
-
validateLabel(newValue:
|
|
28
|
+
validateLabel(newValue: MgTabs['label']): void;
|
|
29
29
|
/**
|
|
30
30
|
* Define tabs size
|
|
31
31
|
*/
|
|
32
|
-
size:
|
|
33
|
-
validateSize(newValue:
|
|
32
|
+
size: SizeType;
|
|
33
|
+
validateSize(newValue: MgTabs['size']): void;
|
|
34
34
|
/**
|
|
35
35
|
* Tabs items
|
|
36
36
|
* Required
|
|
37
37
|
*/
|
|
38
38
|
items: string[] | TabItem[];
|
|
39
|
-
validateItems(newValue:
|
|
39
|
+
validateItems(newValue: MgTabs['items']): void;
|
|
40
40
|
/**
|
|
41
41
|
* Active tab number
|
|
42
42
|
* default: first is 1
|
|
43
43
|
*/
|
|
44
44
|
activeTab: number;
|
|
45
|
-
validateActiveTab(newValue:
|
|
45
|
+
validateActiveTab(newValue: MgTabs['activeTab']): void;
|
|
46
46
|
/**
|
|
47
47
|
* Component tabs
|
|
48
48
|
*/
|
|
@@ -5,21 +5,24 @@
|
|
|
5
5
|
* It contains typing information for all components that exist in this project.
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
-
import {
|
|
8
|
+
import { BadgeVariantType } from "./components/atoms/mg-badge/mg-badge.conf";
|
|
9
9
|
import { ButtonType, VariantType } from "./components/atoms/mg-button/mg-button.conf";
|
|
10
|
+
import { IconSizeType, IconVariantType } from "./components/atoms/mg-icon/mg-icon.conf";
|
|
10
11
|
import { CheckboxValue } from "./components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf";
|
|
11
12
|
import { Width } from "./components/molecules/inputs/MgInput.conf";
|
|
12
13
|
import { RadioOption } from "./components/molecules/inputs/mg-input-radio/mg-input-radio.conf";
|
|
13
14
|
import { SelectOption } from "./components/molecules/inputs/mg-input-select/mg-input-select.conf";
|
|
14
15
|
import { ToggleValue } from "./components/molecules/inputs/mg-input-toggle/mg-input-toggle.conf";
|
|
16
|
+
import { Direction } from "./components/molecules/menu/mg-menu/mg-menu.conf";
|
|
17
|
+
import { MenuItemSizeType, Status } from "./components/molecules/menu/mg-menu-item/mg-menu-item.conf";
|
|
15
18
|
import { Placement } from "@popperjs/core";
|
|
16
|
-
import { TabItem } from "./components/molecules/mg-tabs/mg-tabs.conf";
|
|
19
|
+
import { SizeType, TabItem } from "./components/molecules/mg-tabs/mg-tabs.conf";
|
|
17
20
|
export namespace Components {
|
|
18
21
|
interface MgBadge {
|
|
19
22
|
/**
|
|
20
23
|
* Badge label. Include short description. Required for accessibility
|
|
21
24
|
*/
|
|
22
|
-
"label":
|
|
25
|
+
"label": string;
|
|
23
26
|
/**
|
|
24
27
|
* Define if button is using outline style
|
|
25
28
|
*/
|
|
@@ -27,11 +30,11 @@ export namespace Components {
|
|
|
27
30
|
/**
|
|
28
31
|
* Badge value
|
|
29
32
|
*/
|
|
30
|
-
"value":
|
|
33
|
+
"value": string | number;
|
|
31
34
|
/**
|
|
32
35
|
* Define button variant
|
|
33
36
|
*/
|
|
34
|
-
"variant"
|
|
37
|
+
"variant"?: BadgeVariantType;
|
|
35
38
|
}
|
|
36
39
|
interface MgButton {
|
|
37
40
|
/**
|
|
@@ -150,7 +153,7 @@ export namespace Components {
|
|
|
150
153
|
/**
|
|
151
154
|
* Define icon size
|
|
152
155
|
*/
|
|
153
|
-
"size":
|
|
156
|
+
"size": IconSizeType;
|
|
154
157
|
/**
|
|
155
158
|
* Make the icon spin
|
|
156
159
|
*/
|
|
@@ -158,7 +161,7 @@ export namespace Components {
|
|
|
158
161
|
/**
|
|
159
162
|
* Define icon variant Add a background to the icon based on variant color
|
|
160
163
|
*/
|
|
161
|
-
"variant"
|
|
164
|
+
"variant"?: IconVariantType;
|
|
162
165
|
}
|
|
163
166
|
interface MgIllustratedMessage {
|
|
164
167
|
/**
|
|
@@ -860,6 +863,34 @@ export namespace Components {
|
|
|
860
863
|
*/
|
|
861
864
|
"value": any;
|
|
862
865
|
}
|
|
866
|
+
interface MgMenu {
|
|
867
|
+
/**
|
|
868
|
+
* Component display direction. Default: "horizontal"
|
|
869
|
+
*/
|
|
870
|
+
"direction": Direction;
|
|
871
|
+
/**
|
|
872
|
+
* Menu label. Include short menu description. Required for accessibility
|
|
873
|
+
*/
|
|
874
|
+
"label": string;
|
|
875
|
+
}
|
|
876
|
+
interface MgMenuItem {
|
|
877
|
+
/**
|
|
878
|
+
* Define menu-item content expanded. Default: false.
|
|
879
|
+
*/
|
|
880
|
+
"expanded": boolean;
|
|
881
|
+
/**
|
|
882
|
+
* Define menu-item badge when defined menu-item contain an anchor instead of button
|
|
883
|
+
*/
|
|
884
|
+
"href": string;
|
|
885
|
+
/**
|
|
886
|
+
* Define menu-item size. Default: "large".
|
|
887
|
+
*/
|
|
888
|
+
"size": MenuItemSizeType;
|
|
889
|
+
/**
|
|
890
|
+
* Define menu-item status. Default: "visible"
|
|
891
|
+
*/
|
|
892
|
+
"status": Status;
|
|
893
|
+
}
|
|
863
894
|
interface MgMessage {
|
|
864
895
|
/**
|
|
865
896
|
* Define if message has a cross button RG 01: https://jira.mgdis.fr/browse/PDA9-140
|
|
@@ -990,7 +1021,7 @@ export namespace Components {
|
|
|
990
1021
|
/**
|
|
991
1022
|
* Define tabs size
|
|
992
1023
|
*/
|
|
993
|
-
"size":
|
|
1024
|
+
"size": SizeType;
|
|
994
1025
|
}
|
|
995
1026
|
interface MgTag {
|
|
996
1027
|
/**
|
|
@@ -1208,6 +1239,18 @@ declare global {
|
|
|
1208
1239
|
prototype: HTMLMgInputToggleElement;
|
|
1209
1240
|
new (): HTMLMgInputToggleElement;
|
|
1210
1241
|
};
|
|
1242
|
+
interface HTMLMgMenuElement extends Components.MgMenu, HTMLStencilElement {
|
|
1243
|
+
}
|
|
1244
|
+
var HTMLMgMenuElement: {
|
|
1245
|
+
prototype: HTMLMgMenuElement;
|
|
1246
|
+
new (): HTMLMgMenuElement;
|
|
1247
|
+
};
|
|
1248
|
+
interface HTMLMgMenuItemElement extends Components.MgMenuItem, HTMLStencilElement {
|
|
1249
|
+
}
|
|
1250
|
+
var HTMLMgMenuItemElement: {
|
|
1251
|
+
prototype: HTMLMgMenuItemElement;
|
|
1252
|
+
new (): HTMLMgMenuItemElement;
|
|
1253
|
+
};
|
|
1211
1254
|
interface HTMLMgMessageElement extends Components.MgMessage, HTMLStencilElement {
|
|
1212
1255
|
}
|
|
1213
1256
|
var HTMLMgMessageElement: {
|
|
@@ -1276,6 +1319,8 @@ declare global {
|
|
|
1276
1319
|
"mg-input-textarea": HTMLMgInputTextareaElement;
|
|
1277
1320
|
"mg-input-title": HTMLMgInputTitleElement;
|
|
1278
1321
|
"mg-input-toggle": HTMLMgInputToggleElement;
|
|
1322
|
+
"mg-menu": HTMLMgMenuElement;
|
|
1323
|
+
"mg-menu-item": HTMLMgMenuItemElement;
|
|
1279
1324
|
"mg-message": HTMLMgMessageElement;
|
|
1280
1325
|
"mg-modal": HTMLMgModalElement;
|
|
1281
1326
|
"mg-pagination": HTMLMgPaginationElement;
|
|
@@ -1291,7 +1336,7 @@ declare namespace LocalJSX {
|
|
|
1291
1336
|
/**
|
|
1292
1337
|
* Badge label. Include short description. Required for accessibility
|
|
1293
1338
|
*/
|
|
1294
|
-
"label":
|
|
1339
|
+
"label": string;
|
|
1295
1340
|
/**
|
|
1296
1341
|
* Define if button is using outline style
|
|
1297
1342
|
*/
|
|
@@ -1299,11 +1344,11 @@ declare namespace LocalJSX {
|
|
|
1299
1344
|
/**
|
|
1300
1345
|
* Badge value
|
|
1301
1346
|
*/
|
|
1302
|
-
"value":
|
|
1347
|
+
"value": string | number;
|
|
1303
1348
|
/**
|
|
1304
1349
|
* Define button variant
|
|
1305
1350
|
*/
|
|
1306
|
-
"variant"?:
|
|
1351
|
+
"variant"?: BadgeVariantType;
|
|
1307
1352
|
}
|
|
1308
1353
|
interface MgButton {
|
|
1309
1354
|
/**
|
|
@@ -1429,7 +1474,7 @@ declare namespace LocalJSX {
|
|
|
1429
1474
|
/**
|
|
1430
1475
|
* Define icon size
|
|
1431
1476
|
*/
|
|
1432
|
-
"size"?:
|
|
1477
|
+
"size"?: IconSizeType;
|
|
1433
1478
|
/**
|
|
1434
1479
|
* Make the icon spin
|
|
1435
1480
|
*/
|
|
@@ -1437,7 +1482,7 @@ declare namespace LocalJSX {
|
|
|
1437
1482
|
/**
|
|
1438
1483
|
* Define icon variant Add a background to the icon based on variant color
|
|
1439
1484
|
*/
|
|
1440
|
-
"variant"?:
|
|
1485
|
+
"variant"?: IconVariantType;
|
|
1441
1486
|
}
|
|
1442
1487
|
interface MgIllustratedMessage {
|
|
1443
1488
|
/**
|
|
@@ -2166,6 +2211,34 @@ declare namespace LocalJSX {
|
|
|
2166
2211
|
*/
|
|
2167
2212
|
"value"?: any;
|
|
2168
2213
|
}
|
|
2214
|
+
interface MgMenu {
|
|
2215
|
+
/**
|
|
2216
|
+
* Component display direction. Default: "horizontal"
|
|
2217
|
+
*/
|
|
2218
|
+
"direction"?: Direction;
|
|
2219
|
+
/**
|
|
2220
|
+
* Menu label. Include short menu description. Required for accessibility
|
|
2221
|
+
*/
|
|
2222
|
+
"label": string;
|
|
2223
|
+
}
|
|
2224
|
+
interface MgMenuItem {
|
|
2225
|
+
/**
|
|
2226
|
+
* Define menu-item content expanded. Default: false.
|
|
2227
|
+
*/
|
|
2228
|
+
"expanded"?: boolean;
|
|
2229
|
+
/**
|
|
2230
|
+
* Define menu-item badge when defined menu-item contain an anchor instead of button
|
|
2231
|
+
*/
|
|
2232
|
+
"href"?: string;
|
|
2233
|
+
/**
|
|
2234
|
+
* Define menu-item size. Default: "large".
|
|
2235
|
+
*/
|
|
2236
|
+
"size"?: MenuItemSizeType;
|
|
2237
|
+
/**
|
|
2238
|
+
* Define menu-item status. Default: "visible"
|
|
2239
|
+
*/
|
|
2240
|
+
"status"?: Status;
|
|
2241
|
+
}
|
|
2169
2242
|
interface MgMessage {
|
|
2170
2243
|
/**
|
|
2171
2244
|
* Define if message has a cross button RG 01: https://jira.mgdis.fr/browse/PDA9-140
|
|
@@ -2332,7 +2405,7 @@ declare namespace LocalJSX {
|
|
|
2332
2405
|
/**
|
|
2333
2406
|
* Define tabs size
|
|
2334
2407
|
*/
|
|
2335
|
-
"size"?:
|
|
2408
|
+
"size"?: SizeType;
|
|
2336
2409
|
}
|
|
2337
2410
|
interface MgTag {
|
|
2338
2411
|
/**
|
|
@@ -2386,6 +2459,8 @@ declare namespace LocalJSX {
|
|
|
2386
2459
|
"mg-input-textarea": MgInputTextarea;
|
|
2387
2460
|
"mg-input-title": MgInputTitle;
|
|
2388
2461
|
"mg-input-toggle": MgInputToggle;
|
|
2462
|
+
"mg-menu": MgMenu;
|
|
2463
|
+
"mg-menu-item": MgMenuItem;
|
|
2389
2464
|
"mg-message": MgMessage;
|
|
2390
2465
|
"mg-modal": MgModal;
|
|
2391
2466
|
"mg-pagination": MgPagination;
|
|
@@ -2419,6 +2494,8 @@ declare module "@stencil/core" {
|
|
|
2419
2494
|
"mg-input-textarea": LocalJSX.MgInputTextarea & JSXBase.HTMLAttributes<HTMLMgInputTextareaElement>;
|
|
2420
2495
|
"mg-input-title": LocalJSX.MgInputTitle & JSXBase.HTMLAttributes<HTMLMgInputTitleElement>;
|
|
2421
2496
|
"mg-input-toggle": LocalJSX.MgInputToggle & JSXBase.HTMLAttributes<HTMLMgInputToggleElement>;
|
|
2497
|
+
"mg-menu": LocalJSX.MgMenu & JSXBase.HTMLAttributes<HTMLMgMenuElement>;
|
|
2498
|
+
"mg-menu-item": LocalJSX.MgMenuItem & JSXBase.HTMLAttributes<HTMLMgMenuItemElement>;
|
|
2422
2499
|
"mg-message": LocalJSX.MgMessage & JSXBase.HTMLAttributes<HTMLMgMessageElement>;
|
|
2423
2500
|
"mg-modal": LocalJSX.MgModal & JSXBase.HTMLAttributes<HTMLMgModalElement>;
|
|
2424
2501
|
"mg-pagination": LocalJSX.MgPagination & JSXBase.HTMLAttributes<HTMLMgPaginationElement>;
|
|
@@ -59,7 +59,13 @@ declare const messages: {
|
|
|
59
59
|
minMax: string;
|
|
60
60
|
};
|
|
61
61
|
numeric: {
|
|
62
|
-
min: string;
|
|
62
|
+
min: string; /**
|
|
63
|
+
* Get Intl object
|
|
64
|
+
* We load the defined locale but for now we only support the first subtag for messages
|
|
65
|
+
*
|
|
66
|
+
* @param {HTMLElement} element element we need to get the language
|
|
67
|
+
* @returns {{ locale: string; messages: unknown }} messages object
|
|
68
|
+
*/
|
|
63
69
|
max: string;
|
|
64
70
|
minMax: string;
|
|
65
71
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgdis/mg-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "MG Components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -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.13",
|
|
55
|
+
"@storybook/addon-actions": "^6.5.13",
|
|
56
|
+
"@storybook/addon-docs": "^6.5.13",
|
|
57
|
+
"@storybook/addon-essentials": "^6.5.13",
|
|
58
|
+
"@storybook/addon-links": "^6.5.13",
|
|
59
|
+
"@storybook/html": "^6.5.13",
|
|
60
60
|
"@storybook/preset-scss": "^1.0.3",
|
|
61
61
|
"@types/jest": "^26.0.24",
|
|
62
62
|
"@types/jest-image-snapshot": "^4.3.1",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"jest-image-snapshot": "^4.5.1",
|
|
78
78
|
"jest-junit": "^13.0.0",
|
|
79
79
|
"jsx-dom": "^8.0.1-beta.1",
|
|
80
|
-
"mutation-observer": "^1.0.3",
|
|
81
80
|
"npm-run-all": "^4.1.5",
|
|
82
81
|
"prettier": "^2.5.1",
|
|
83
82
|
"puppeteer": "^13.3.2",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { newE2EPage } from '@stencil/core/testing';
|
|
2
|
-
/**
|
|
3
|
-
* Create E2E page
|
|
4
|
-
*
|
|
5
|
-
* @param {string} htmlString html to render
|
|
6
|
-
* @returns {Promise<DesignSystemE2EPage>} page
|
|
7
|
-
*/
|
|
8
|
-
export async function createPage(htmlString) {
|
|
9
|
-
const defaultSize = 600;
|
|
10
|
-
const page = (await newE2EPage());
|
|
11
|
-
await page.setViewport({ width: defaultSize, height: defaultSize });
|
|
12
|
-
await page.setContent(`<link rel="stylesheet" href="http://localhost:3333/build/variables.css" /><meta charset="UTF-8">${htmlString}`, { waitUntil: 'networkidle0' });
|
|
13
|
-
await page.evaluateHandle('document.fonts.ready');
|
|
14
|
-
// monkey patch screenshot function to add some extra features
|
|
15
|
-
const screenshot = page.screenshot;
|
|
16
|
-
page.screenshot = async () => {
|
|
17
|
-
let width = page.viewport().width;
|
|
18
|
-
let height = page.viewport().height;
|
|
19
|
-
// if viewport has not been redefined
|
|
20
|
-
if (page.viewport().width === defaultSize && page.viewport().height === defaultSize) {
|
|
21
|
-
const htmlElement = await page.$('html');
|
|
22
|
-
const boundingBox = await htmlElement.boundingBox();
|
|
23
|
-
width = Math.round(boundingBox.width);
|
|
24
|
-
height = Math.round(boundingBox.height);
|
|
25
|
-
}
|
|
26
|
-
return screenshot.call(page, {
|
|
27
|
-
clip: { x: 0, y: 0, width, height },
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
return page;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Clone Deep function
|
|
34
|
-
*
|
|
35
|
-
* @param {unknown} obj object to clone
|
|
36
|
-
* @returns {unknown} cloned json
|
|
37
|
-
*/
|
|
38
|
-
export const cloneDeep = (obj) => JSON.parse(JSON.stringify(obj));
|