@mgdis/mg-components 5.9.1 → 5.10.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-action-more_31.cjs.entry.js +31 -225
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +1 -16
- package/dist/cjs/{mg-menu.conf-9afe6571.js → mg-menu.conf-1942ac70.js} +0 -5
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -3
- package/dist/collection/components/atoms/mg-button/mg-button.js +2 -7
- package/dist/collection/components/atoms/mg-card/mg-card.js +13 -4
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +0 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +0 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +10 -5
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +0 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +0 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +1 -13
- package/dist/collection/components/molecules/inputs/MgInput.js +0 -6
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +0 -6
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +0 -5
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +0 -12
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +0 -3
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +0 -9
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +0 -13
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -12
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -5
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +0 -5
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +0 -11
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +0 -18
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +0 -8
- package/dist/collection/components/molecules/mg-details/mg-details.js +0 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +0 -8
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +0 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +0 -5
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -7
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -6
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +0 -6
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +5 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -8
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +0 -12
- package/dist/collection/locales/index.js +0 -1
- package/dist/collection/utils/behaviors.utils.js +0 -10
- package/dist/collection/utils/components.utils.js +1 -10
- package/dist/collection/utils/locale.utils.js +0 -4
- package/dist/collection/utils/unit.test.utils.js +0 -5
- package/dist/components/MgInput.js +0 -6
- package/dist/components/components.utils.js +1 -10
- package/dist/components/index2.js +0 -5
- package/dist/components/mg-action-more.js +0 -8
- package/dist/components/mg-badge2.js +1 -3
- package/dist/components/mg-button2.js +2 -7
- package/dist/components/mg-card2.js +13 -4
- package/dist/components/mg-character-left2.js +0 -2
- package/dist/components/mg-details.js +0 -3
- package/dist/components/mg-divider.js +0 -1
- package/dist/components/mg-form.js +0 -8
- package/dist/components/mg-icon2.js +10 -5
- package/dist/components/mg-illustrated-message.js +0 -2
- package/dist/components/mg-input-checkbox.js +0 -6
- package/dist/components/mg-input-date.js +0 -5
- package/dist/components/mg-input-numeric.js +0 -12
- package/dist/components/mg-input-password.js +0 -3
- package/dist/components/mg-input-radio.js +0 -9
- package/dist/components/mg-input-select2.js +0 -13
- package/dist/components/mg-input-text2.js +1 -12
- package/dist/components/mg-input-textarea.js +1 -5
- package/dist/components/mg-input-title2.js +0 -2
- package/dist/components/mg-input-toggle.js +0 -5
- package/dist/components/mg-item-more.js +0 -15
- package/dist/components/mg-menu-item2.js +0 -18
- package/dist/components/mg-menu2.js +0 -11
- package/dist/components/mg-message.js +2 -7
- package/dist/components/mg-modal.js +1 -6
- package/dist/components/mg-pagination.js +0 -6
- package/dist/components/mg-panel.js +5 -15
- package/dist/components/mg-popover2.js +1 -8
- package/dist/components/mg-skip-links.js +1 -4
- package/dist/components/mg-tabs.js +0 -12
- package/dist/components/mg-tag.js +0 -3
- package/dist/components/mg-tooltip2.js +1 -13
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +31 -225
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +1 -16
- package/dist/esm/{mg-menu.conf-881fbd82.js → mg-menu.conf-2cc1bb67.js} +0 -5
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-67ce7cb8.entry.js → p-a56a3157.entry.js} +1 -1
- package/dist/mg-components/{p-9a93b7af.entry.js → p-eb32bb18.entry.js} +1 -1
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +0 -2
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +0 -5
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +10 -3
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +0 -2
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +0 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +6 -3
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +0 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +0 -3
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +0 -12
- package/dist/types/components/molecules/inputs/MgInput.d.ts +0 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +0 -5
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +0 -5
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +0 -12
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +0 -3
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -8
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -9
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +0 -11
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +0 -4
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +0 -5
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +0 -11
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +0 -18
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +0 -5
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +0 -3
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +0 -8
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +0 -2
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +0 -5
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +1 -6
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +0 -5
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +0 -5
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +0 -10
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +0 -7
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +0 -3
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +0 -11
- package/dist/types/locales/index.d.ts +0 -1
- package/dist/types/utils/behaviors.utils.d.ts +0 -9
- package/dist/types/utils/components.utils.d.ts +1 -9
- package/dist/types/utils/locale.utils.d.ts +0 -4
- package/dist/types/utils/unit.test.utils.d.ts +0 -7
- package/package.json +11 -12
- /package/dist/mg-components/{p-367f92d2.js → p-73156ac9.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* MgItemMore type guard
|
|
3
|
-
*
|
|
4
3
|
* @param {HTMLElement} element element to control type
|
|
5
4
|
* @returns {boolean} truthy if element is mg-item-more
|
|
6
5
|
*/
|
|
@@ -19,7 +18,6 @@ export class OverflowBehavior {
|
|
|
19
18
|
**********/
|
|
20
19
|
/**
|
|
21
20
|
* Disconnect ResizeObserver
|
|
22
|
-
*
|
|
23
21
|
* @returns {void}
|
|
24
22
|
*/
|
|
25
23
|
this.disconnect = () => {
|
|
@@ -30,7 +28,6 @@ export class OverflowBehavior {
|
|
|
30
28
|
************/
|
|
31
29
|
/**
|
|
32
30
|
* run overflow behavior
|
|
33
|
-
*
|
|
34
31
|
* @param {number} width width of the container. Optional.
|
|
35
32
|
* @returns {void}
|
|
36
33
|
*/
|
|
@@ -55,14 +52,12 @@ export class OverflowBehavior {
|
|
|
55
52
|
};
|
|
56
53
|
/**
|
|
57
54
|
* Get interactive children filtred by authorized nodeName ['MG-MENU-ITEM', 'MG-BUTTON']
|
|
58
|
-
*
|
|
59
55
|
* @param {Element} element element to parse
|
|
60
56
|
* @returns {Element[]} children
|
|
61
57
|
*/
|
|
62
58
|
this.getInteractiveItems = (element) => { var _a; return (((_a = element.children) === null || _a === void 0 ? void 0 : _a.length) > 0 ? Array.from(element.children) : []).filter(element => ['MG-MENU-ITEM', 'MG-BUTTON'].includes(element.nodeName)); };
|
|
63
59
|
/**
|
|
64
60
|
* Update displayed items in container from a given available space
|
|
65
|
-
*
|
|
66
61
|
* @param {number} availableWidth available width in container to display child items
|
|
67
62
|
* @returns {void}
|
|
68
63
|
*/
|
|
@@ -83,7 +78,6 @@ export class OverflowBehavior {
|
|
|
83
78
|
};
|
|
84
79
|
/**
|
|
85
80
|
* Utility method to know if item overflow partialy or totaly in the container
|
|
86
|
-
*
|
|
87
81
|
* @param {number} cumulateWidth previous sibling elements cumulate width + item width
|
|
88
82
|
* @param {HTMLElement} item item HTML element
|
|
89
83
|
* @param {number} availableWidth container available width
|
|
@@ -99,14 +93,12 @@ export class OverflowBehavior {
|
|
|
99
93
|
};
|
|
100
94
|
/**
|
|
101
95
|
* Utility method to know if a given element is the 'MORE' element
|
|
102
|
-
*
|
|
103
96
|
* @param {Element} element element to match with 'MORE' element
|
|
104
97
|
* @returns {boolean} truthy if element is the 'MORE' element
|
|
105
98
|
*/
|
|
106
99
|
this.isMoreElement = (element) => element.nodeName === 'MG-ITEM-MORE';
|
|
107
100
|
/**
|
|
108
101
|
* Toggle display item element
|
|
109
|
-
*
|
|
110
102
|
* @param {HTMLElement} item item to control
|
|
111
103
|
* @param {boolean} isHidden is item hidden
|
|
112
104
|
* @returns {void}
|
|
@@ -122,7 +114,6 @@ export class OverflowBehavior {
|
|
|
122
114
|
};
|
|
123
115
|
/**
|
|
124
116
|
* Toggle element's hidde attribute
|
|
125
|
-
*
|
|
126
117
|
* @param {Element} element element to toggle
|
|
127
118
|
* @param {boolean} isHidden element is hidden
|
|
128
119
|
* @returns {void}
|
|
@@ -135,7 +126,6 @@ export class OverflowBehavior {
|
|
|
135
126
|
};
|
|
136
127
|
/**
|
|
137
128
|
* Remove hidden attributes on all items
|
|
138
|
-
*
|
|
139
129
|
* @returns {void}
|
|
140
130
|
*/
|
|
141
131
|
this.restoreItems = () => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create random ID
|
|
3
|
-
*
|
|
4
3
|
* @param {string} prefix add prefix to created ID
|
|
5
4
|
* @param {number} length ID length
|
|
6
5
|
* @returns {string} ID
|
|
@@ -22,7 +21,6 @@ export class ClassList {
|
|
|
22
21
|
constructor(classlist = []) {
|
|
23
22
|
/**
|
|
24
23
|
* Add class
|
|
25
|
-
*
|
|
26
24
|
* @param {string} className class name to add
|
|
27
25
|
* @returns {void}
|
|
28
26
|
*/
|
|
@@ -33,7 +31,6 @@ export class ClassList {
|
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* Delete class
|
|
36
|
-
*
|
|
37
34
|
* @param {string} className class name to delete
|
|
38
35
|
* @returns {void}
|
|
39
36
|
*/
|
|
@@ -45,7 +42,6 @@ export class ClassList {
|
|
|
45
42
|
};
|
|
46
43
|
/**
|
|
47
44
|
* Check if class exist in list
|
|
48
|
-
*
|
|
49
45
|
* @param {string} className class name to check
|
|
50
46
|
* @returns {boolean} class name is in the list
|
|
51
47
|
*/
|
|
@@ -54,7 +50,6 @@ export class ClassList {
|
|
|
54
50
|
};
|
|
55
51
|
/**
|
|
56
52
|
* Join classes seperated by spaces
|
|
57
|
-
*
|
|
58
53
|
* @returns {string} joined values
|
|
59
54
|
*/
|
|
60
55
|
this.join = () => {
|
|
@@ -65,14 +60,12 @@ export class ClassList {
|
|
|
65
60
|
}
|
|
66
61
|
/**
|
|
67
62
|
* Check if all items are string
|
|
68
|
-
*
|
|
69
63
|
* @param {unknown} items items to check
|
|
70
64
|
* @returns {boolean} all items are string
|
|
71
65
|
*/
|
|
72
66
|
export const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
|
|
73
67
|
/**
|
|
74
68
|
* Check if element is a heading
|
|
75
|
-
*
|
|
76
69
|
* @param {Element} element slotted element
|
|
77
70
|
* @param {string[]} tagNames allowed tag names list
|
|
78
71
|
* @returns {boolean} element is a heading
|
|
@@ -85,7 +78,7 @@ export const isTagName = (element, tagNames) => {
|
|
|
85
78
|
*/
|
|
86
79
|
export const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
87
80
|
/**
|
|
88
|
-
*
|
|
81
|
+
* Get windows
|
|
89
82
|
* @param {Window} localWindow the window we are lookink for other windows
|
|
90
83
|
* @returns {Window[]} The list of windows found
|
|
91
84
|
*/
|
|
@@ -96,7 +89,6 @@ export const getWindows = (localWindow) => {
|
|
|
96
89
|
};
|
|
97
90
|
/**
|
|
98
91
|
* Get parent windows
|
|
99
|
-
*
|
|
100
92
|
* @param {Window} localWindow the window we are lookink for parents
|
|
101
93
|
* @param {Window[]} windows The list of allready found windows
|
|
102
94
|
* @returns {Window[]} The list of windows found
|
|
@@ -119,7 +111,6 @@ export const getParentWindows = (localWindow, windows = []) => {
|
|
|
119
111
|
};
|
|
120
112
|
/**
|
|
121
113
|
* Get child windows
|
|
122
|
-
*
|
|
123
114
|
* @param {Window} localWindow the window we are lookink for children
|
|
124
115
|
* @param {Window[]} windows The list of allready found windows
|
|
125
116
|
* @returns {Window[]} The list of windows found
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Format number to the locale currency
|
|
3
|
-
*
|
|
4
3
|
* @param {number} number number to format
|
|
5
4
|
* @param {string} locale locale to apply
|
|
6
5
|
* @param {string} currency currency to apply
|
|
@@ -11,7 +10,6 @@ export const localeCurrency = (number, locale, currency) => {
|
|
|
11
10
|
};
|
|
12
11
|
/**
|
|
13
12
|
* Format number to locale
|
|
14
|
-
*
|
|
15
13
|
* @param {number} number number to format
|
|
16
14
|
* @param {string} locale locale to apply
|
|
17
15
|
* @returns {string} formatted number
|
|
@@ -25,7 +23,6 @@ export const localeNumber = (number, locale) => {
|
|
|
25
23
|
export const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
26
24
|
/**
|
|
27
25
|
* Locale date format
|
|
28
|
-
*
|
|
29
26
|
* @param {string} date date to format
|
|
30
27
|
* @param {string} locale locale to apply
|
|
31
28
|
* @returns {string} formatted date
|
|
@@ -39,7 +36,6 @@ export const localeDate = (date, locale) => {
|
|
|
39
36
|
/**
|
|
40
37
|
* Get locale and messages
|
|
41
38
|
* We load the defined locale but for now we only support the first subtag for messages
|
|
42
|
-
*
|
|
43
39
|
* @param {HTMLElement} element element we need to get the language
|
|
44
40
|
* @param {unknown} messages messages to use
|
|
45
41
|
* @param {string} defaultLocale default messages locale
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { MockCustomEvent } from '@stencil/core/mock-doc';
|
|
2
2
|
/**
|
|
3
3
|
* Clone Deep function
|
|
4
|
-
*
|
|
5
4
|
* @param {unknown} obj object to clone
|
|
6
5
|
* @returns {unknown} cloned json
|
|
7
6
|
*/
|
|
@@ -43,7 +42,6 @@ export const setupResizeObserverMock = ({ disconnect, observe }) => {
|
|
|
43
42
|
};
|
|
44
43
|
/**
|
|
45
44
|
* Utility function that mocks the `SubmitEvent` API. Recommended to execute inside `beforeEach`.
|
|
46
|
-
*
|
|
47
45
|
* @returns {void}
|
|
48
46
|
* @example
|
|
49
47
|
* ```
|
|
@@ -67,7 +65,6 @@ export const setupSubmitEventMock = () => {
|
|
|
67
65
|
};
|
|
68
66
|
/**
|
|
69
67
|
* force popover id when component use randomed identifier
|
|
70
|
-
*
|
|
71
68
|
* @param {Element} component element wich include mg-popover
|
|
72
69
|
* @param {string} id new fixed id
|
|
73
70
|
* @param {string} interactiveElement element where attribute 'aria-controls' is set
|
|
@@ -86,7 +83,6 @@ export const forcePopoverId = (component, id, interactiveElement = 'button') =>
|
|
|
86
83
|
* this is due to internal function isHTMLElement(), so we can not mock it directly.
|
|
87
84
|
* this function check if test DOM element mockHTMLElement instance is 'instanceof HTMLElement'
|
|
88
85
|
* so we only override the console.error side effect for this error
|
|
89
|
-
*
|
|
90
86
|
* @returns {void}
|
|
91
87
|
*/
|
|
92
88
|
export const mockConsoleError = () => {
|
|
@@ -99,7 +95,6 @@ export const mockConsoleError = () => {
|
|
|
99
95
|
/**
|
|
100
96
|
* Add missing window.frames property to test context
|
|
101
97
|
* usefull for component with iframe listeners, ex: mg-popover
|
|
102
|
-
*
|
|
103
98
|
* @returns {void}
|
|
104
99
|
*/
|
|
105
100
|
export const mockWindowFrames = () => {
|
|
@@ -2,7 +2,6 @@ import { h } from '@stencil/core/internal/client';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Apply in all input child node the aria-describedby attribute
|
|
5
|
-
*
|
|
6
5
|
* @param {VNode[]} children Represent scoped elements
|
|
7
6
|
* @param {Set<string>} ariaDescribedbyIDs List of IDs
|
|
8
7
|
* @param {FunctionalUtilities} utils Stencil.js utils
|
|
@@ -19,7 +18,6 @@ const applyAriadescribedBy = (children, ariaDescribedbyIDs, utils) => utils.map(
|
|
|
19
18
|
});
|
|
20
19
|
/**
|
|
21
20
|
* Add classes based on props
|
|
22
|
-
*
|
|
23
21
|
* @param {MgInputProps} props MgInput Interface Props
|
|
24
22
|
*/
|
|
25
23
|
const manageClasses = (props) => {
|
|
@@ -33,14 +31,12 @@ const manageClasses = (props) => {
|
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* Get tagname
|
|
36
|
-
*
|
|
37
34
|
* @param {boolean} isFieldset is fieldset
|
|
38
35
|
* @returns {string} tag name
|
|
39
36
|
*/
|
|
40
37
|
const getTagName = (isFieldset) => (isFieldset ? 'fieldset' : 'div');
|
|
41
38
|
/**
|
|
42
39
|
* Get input template
|
|
43
|
-
*
|
|
44
40
|
* @param {MgInputProps} props MgInput Interface Props
|
|
45
41
|
* @param {VNode[]} children Represent scoped elements
|
|
46
42
|
* @param {FunctionalUtilities} utils Stencil.js utils
|
|
@@ -100,7 +96,6 @@ const MgInput = (props, children, utils) => {
|
|
|
100
96
|
const TagName = getTagName(props.isFieldset);
|
|
101
97
|
/**
|
|
102
98
|
* Get tooltip node
|
|
103
|
-
*
|
|
104
99
|
* @returns {VNode[]} mg-tooltip
|
|
105
100
|
*/
|
|
106
101
|
const getTooltip = () => (h("mg-tooltip", { identifier: `${props.identifier}-tooltip`, message: props.tooltip },
|
|
@@ -108,7 +103,6 @@ const MgInput = (props, children, utils) => {
|
|
|
108
103
|
/**
|
|
109
104
|
* Get input title (label) node
|
|
110
105
|
* Display asterisk only if not disabled and not readonly
|
|
111
|
-
*
|
|
112
106
|
* @returns {VNode[]} mg-input-title
|
|
113
107
|
*/
|
|
114
108
|
const getInputTitle = () => (h("mg-input-title", { identifier: props.identifier, class: props.labelHide ? 'sr-only' : undefined, required: props.required && !props.disabled && !props.readonly, "is-legend": props.isFieldset }, props.label));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Create random ID
|
|
3
|
-
*
|
|
4
3
|
* @param {string} prefix add prefix to created ID
|
|
5
4
|
* @param {number} length ID length
|
|
6
5
|
* @returns {string} ID
|
|
@@ -22,7 +21,6 @@ class ClassList {
|
|
|
22
21
|
constructor(classlist = []) {
|
|
23
22
|
/**
|
|
24
23
|
* Add class
|
|
25
|
-
*
|
|
26
24
|
* @param {string} className class name to add
|
|
27
25
|
* @returns {void}
|
|
28
26
|
*/
|
|
@@ -33,7 +31,6 @@ class ClassList {
|
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* Delete class
|
|
36
|
-
*
|
|
37
34
|
* @param {string} className class name to delete
|
|
38
35
|
* @returns {void}
|
|
39
36
|
*/
|
|
@@ -45,7 +42,6 @@ class ClassList {
|
|
|
45
42
|
};
|
|
46
43
|
/**
|
|
47
44
|
* Check if class exist in list
|
|
48
|
-
*
|
|
49
45
|
* @param {string} className class name to check
|
|
50
46
|
* @returns {boolean} class name is in the list
|
|
51
47
|
*/
|
|
@@ -54,7 +50,6 @@ class ClassList {
|
|
|
54
50
|
};
|
|
55
51
|
/**
|
|
56
52
|
* Join classes seperated by spaces
|
|
57
|
-
*
|
|
58
53
|
* @returns {string} joined values
|
|
59
54
|
*/
|
|
60
55
|
this.join = () => {
|
|
@@ -65,14 +60,12 @@ class ClassList {
|
|
|
65
60
|
}
|
|
66
61
|
/**
|
|
67
62
|
* Check if all items are string
|
|
68
|
-
*
|
|
69
63
|
* @param {unknown} items items to check
|
|
70
64
|
* @returns {boolean} all items are string
|
|
71
65
|
*/
|
|
72
66
|
const allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');
|
|
73
67
|
/**
|
|
74
68
|
* Check if element is a heading
|
|
75
|
-
*
|
|
76
69
|
* @param {Element} element slotted element
|
|
77
70
|
* @param {string[]} tagNames allowed tag names list
|
|
78
71
|
* @returns {boolean} element is a heading
|
|
@@ -85,7 +78,7 @@ const isTagName = (element, tagNames) => {
|
|
|
85
78
|
*/
|
|
86
79
|
const focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), [identifier]';
|
|
87
80
|
/**
|
|
88
|
-
*
|
|
81
|
+
* Get windows
|
|
89
82
|
* @param {Window} localWindow the window we are lookink for other windows
|
|
90
83
|
* @returns {Window[]} The list of windows found
|
|
91
84
|
*/
|
|
@@ -96,7 +89,6 @@ const getWindows = (localWindow) => {
|
|
|
96
89
|
};
|
|
97
90
|
/**
|
|
98
91
|
* Get parent windows
|
|
99
|
-
*
|
|
100
92
|
* @param {Window} localWindow the window we are lookink for parents
|
|
101
93
|
* @param {Window[]} windows The list of allready found windows
|
|
102
94
|
* @returns {Window[]} The list of windows found
|
|
@@ -119,7 +111,6 @@ const getParentWindows = (localWindow, windows = []) => {
|
|
|
119
111
|
};
|
|
120
112
|
/**
|
|
121
113
|
* Get child windows
|
|
122
|
-
*
|
|
123
114
|
* @param {Window} localWindow the window we are lookink for children
|
|
124
115
|
* @param {Window[]} windows The list of allready found windows
|
|
125
116
|
* @returns {Window[]} The list of windows found
|
|
@@ -150,7 +150,6 @@ const fr = {
|
|
|
150
150
|
|
|
151
151
|
/**
|
|
152
152
|
* Format number to the locale currency
|
|
153
|
-
*
|
|
154
153
|
* @param {number} number number to format
|
|
155
154
|
* @param {string} locale locale to apply
|
|
156
155
|
* @param {string} currency currency to apply
|
|
@@ -161,7 +160,6 @@ const localeCurrency = (number, locale, currency) => {
|
|
|
161
160
|
};
|
|
162
161
|
/**
|
|
163
162
|
* Format number to locale
|
|
164
|
-
*
|
|
165
163
|
* @param {number} number number to format
|
|
166
164
|
* @param {string} locale locale to apply
|
|
167
165
|
* @returns {string} formatted number
|
|
@@ -175,7 +173,6 @@ const localeNumber = (number, locale) => {
|
|
|
175
173
|
const dateRegExp = /^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
176
174
|
/**
|
|
177
175
|
* Locale date format
|
|
178
|
-
*
|
|
179
176
|
* @param {string} date date to format
|
|
180
177
|
* @param {string} locale locale to apply
|
|
181
178
|
* @returns {string} formatted date
|
|
@@ -189,7 +186,6 @@ const localeDate = (date, locale) => {
|
|
|
189
186
|
/**
|
|
190
187
|
* Get locale and messages
|
|
191
188
|
* We load the defined locale but for now we only support the first subtag for messages
|
|
192
|
-
*
|
|
193
189
|
* @param {HTMLElement} element element we need to get the language
|
|
194
190
|
* @param {unknown} messages messages to use
|
|
195
191
|
* @param {string} defaultLocale default messages locale
|
|
@@ -213,7 +209,6 @@ const defaultLocale = 'en';
|
|
|
213
209
|
const messages = { en, fr };
|
|
214
210
|
/**
|
|
215
211
|
* Get Intl object
|
|
216
|
-
*
|
|
217
212
|
* @param {HTMLElement} element element we need to get the language
|
|
218
213
|
* @returns {{ locale: string; messages: Record<string, unknown> }} messages object
|
|
219
214
|
*/
|
|
@@ -14,7 +14,6 @@ const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* MgActionMore['items'] type guard
|
|
17
|
-
*
|
|
18
17
|
* @param {unknown} prop commponent items prop
|
|
19
18
|
* @returns {boolean} return true if type is valid
|
|
20
19
|
*/
|
|
@@ -24,7 +23,6 @@ const isMgActionMoreItems = (prop) => {
|
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
26
25
|
* MgActionMore['button'] type guard
|
|
27
|
-
*
|
|
28
26
|
* @param {unknown} prop commponent button prop
|
|
29
27
|
* @returns {boolean} return true if type is valid
|
|
30
28
|
*/
|
|
@@ -34,7 +32,6 @@ const isMgActionMoreButton = (prop) => {
|
|
|
34
32
|
};
|
|
35
33
|
/**
|
|
36
34
|
* MgActionMore['icon'] type guard
|
|
37
|
-
*
|
|
38
35
|
* @param {unknown} prop commponent icon prop
|
|
39
36
|
* @returns {boolean} return true if type is valid
|
|
40
37
|
*/
|
|
@@ -57,7 +54,6 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
57
54
|
***********/
|
|
58
55
|
/**
|
|
59
56
|
* Toogle expanded props
|
|
60
|
-
*
|
|
61
57
|
* @returns {void}
|
|
62
58
|
*/
|
|
63
59
|
this.toggleExpanded = () => {
|
|
@@ -65,7 +61,6 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
65
61
|
};
|
|
66
62
|
/**
|
|
67
63
|
* Button click handler
|
|
68
|
-
*
|
|
69
64
|
* @returns {void}
|
|
70
65
|
*/
|
|
71
66
|
this.handleButton = () => {
|
|
@@ -73,7 +68,6 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
73
68
|
};
|
|
74
69
|
/**
|
|
75
70
|
* Item click handler
|
|
76
|
-
*
|
|
77
71
|
* @param {MouseEvent} event click event
|
|
78
72
|
* @param {MgActionMoreItemType['mouseEventHandler']} customHandler item['mouseEventHandler']
|
|
79
73
|
* @returns {void}
|
|
@@ -113,7 +107,6 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
113
107
|
*************/
|
|
114
108
|
/**
|
|
115
109
|
* Validate props
|
|
116
|
-
*
|
|
117
110
|
* @returns {void}
|
|
118
111
|
*/
|
|
119
112
|
componentWillLoad() {
|
|
@@ -125,7 +118,6 @@ const MgActionMore$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
125
118
|
}
|
|
126
119
|
/**
|
|
127
120
|
* Render
|
|
128
|
-
*
|
|
129
121
|
* @returns {HTMLElement} HTML Element
|
|
130
122
|
*/
|
|
131
123
|
render() {
|
|
@@ -53,7 +53,6 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Check if props are well configured on init
|
|
56
|
-
*
|
|
57
56
|
* @returns {void}
|
|
58
57
|
*/
|
|
59
58
|
componentWillLoad() {
|
|
@@ -64,7 +63,6 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
65
|
* Render
|
|
67
|
-
*
|
|
68
66
|
* @returns {HTMLElement} HTML Element
|
|
69
67
|
*/
|
|
70
68
|
render() {
|
|
@@ -78,7 +76,7 @@ const MgBadge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
78
76
|
}; }
|
|
79
77
|
static get style() { return mgBadgeCss; }
|
|
80
78
|
}, [1, "mg-badge", {
|
|
81
|
-
"value": [
|
|
79
|
+
"value": [8],
|
|
82
80
|
"label": [1],
|
|
83
81
|
"variant": [1],
|
|
84
82
|
"outline": [4],
|
|
@@ -24,7 +24,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
24
24
|
this.classFullWidth = 'mg-button--full-width';
|
|
25
25
|
/**
|
|
26
26
|
* Trigger actions onClick event
|
|
27
|
-
*
|
|
28
27
|
* @param {MouseEvent} event click event
|
|
29
28
|
* @returns {void}
|
|
30
29
|
*/
|
|
@@ -39,7 +38,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
39
38
|
};
|
|
40
39
|
/**
|
|
41
40
|
* Handle onKeydown event
|
|
42
|
-
*
|
|
43
41
|
* @param {KeyboardEvent} event keyboard event
|
|
44
42
|
* @returns {void}
|
|
45
43
|
*/
|
|
@@ -54,7 +52,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
54
52
|
};
|
|
55
53
|
/**
|
|
56
54
|
* Handle onKeyup event
|
|
57
|
-
*
|
|
58
55
|
* @param {KeyboardEvent} event keyboard event
|
|
59
56
|
* @returns {void}
|
|
60
57
|
*/
|
|
@@ -127,7 +124,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
127
124
|
}
|
|
128
125
|
/**
|
|
129
126
|
* Check if props are well configured on init
|
|
130
|
-
*
|
|
131
127
|
* @returns {void}
|
|
132
128
|
*/
|
|
133
129
|
componentWillLoad() {
|
|
@@ -145,7 +141,6 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
145
141
|
}
|
|
146
142
|
/**
|
|
147
143
|
* Render component
|
|
148
|
-
*
|
|
149
144
|
* @returns {HTMLElement} html element
|
|
150
145
|
*/
|
|
151
146
|
render() {
|
|
@@ -164,8 +159,8 @@ const MgButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
164
159
|
"identifier": [1],
|
|
165
160
|
"label": [1],
|
|
166
161
|
"type": [1],
|
|
167
|
-
"fullWidth": [
|
|
168
|
-
"form": [
|
|
162
|
+
"fullWidth": [4, "full-width"],
|
|
163
|
+
"form": [1],
|
|
169
164
|
"disabled": [1028],
|
|
170
165
|
"isIcon": [4, "is-icon"],
|
|
171
166
|
"disableOnClick": [4, "disable-on-click"],
|
|
@@ -22,6 +22,15 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
22
22
|
*************/
|
|
23
23
|
this.name = 'mg-card';
|
|
24
24
|
this.baseClass = this.name;
|
|
25
|
+
/**
|
|
26
|
+
* Methode to set default varianStyle props
|
|
27
|
+
* needeed has stencil doesn't know that props is mutated when updated in prop watcher
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
this.setDefaultVariantStyle = () => {
|
|
31
|
+
if (this.variantStyle === undefined)
|
|
32
|
+
this.variantStyle = 'bar-left';
|
|
33
|
+
};
|
|
25
34
|
this.variant = undefined;
|
|
26
35
|
this.variantStyle = undefined;
|
|
27
36
|
this.classList = new ClassList([this.baseClass]);
|
|
@@ -30,8 +39,7 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
30
39
|
if (newValue && !variants.includes(newValue))
|
|
31
40
|
throw new Error(`<${this.name}> prop "variant" must match VariantType type.`);
|
|
32
41
|
if (Boolean(newValue)) {
|
|
33
|
-
|
|
34
|
-
this.variantStyle = 'bar-left';
|
|
42
|
+
this.setDefaultVariantStyle();
|
|
35
43
|
this.classList.add(`${this.baseClass}--${newValue}`);
|
|
36
44
|
}
|
|
37
45
|
if (Boolean(oldValue))
|
|
@@ -47,9 +55,11 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
47
55
|
if (Boolean(oldValue))
|
|
48
56
|
this.classList.delete(`${this.baseClass}--${oldValue}`);
|
|
49
57
|
}
|
|
58
|
+
/*************
|
|
59
|
+
* Lifecycle *
|
|
60
|
+
*************/
|
|
50
61
|
/**
|
|
51
62
|
* Check if props are well configured on init
|
|
52
|
-
*
|
|
53
63
|
* @returns {void}
|
|
54
64
|
*/
|
|
55
65
|
componentWillLoad() {
|
|
@@ -58,7 +68,6 @@ const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
58
68
|
}
|
|
59
69
|
/**
|
|
60
70
|
* Render
|
|
61
|
-
*
|
|
62
71
|
* @returns {HTMLElement} HTML Element
|
|
63
72
|
*/
|
|
64
73
|
render() {
|
|
@@ -21,7 +21,6 @@ const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
21
21
|
*************/
|
|
22
22
|
/**
|
|
23
23
|
* Check if props are well configured on init
|
|
24
|
-
*
|
|
25
24
|
* @returns {void}
|
|
26
25
|
*/
|
|
27
26
|
componentWillLoad() {
|
|
@@ -30,7 +29,6 @@ const MgCharacterLeft = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
30
29
|
}
|
|
31
30
|
/**
|
|
32
31
|
* Render component
|
|
33
|
-
*
|
|
34
32
|
* @returns {HTMLElement} HTML Element
|
|
35
33
|
*/
|
|
36
34
|
render() {
|
|
@@ -11,7 +11,6 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
11
11
|
this.expandedChange = createEvent(this, "expanded-change", 7);
|
|
12
12
|
/**
|
|
13
13
|
* Handle details toggle
|
|
14
|
-
*
|
|
15
14
|
* @returns {void}
|
|
16
15
|
*/
|
|
17
16
|
this.handleToggle = () => {
|
|
@@ -35,7 +34,6 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
35
34
|
*************/
|
|
36
35
|
/**
|
|
37
36
|
* Check if component props are well configured on init
|
|
38
|
-
*
|
|
39
37
|
* @returns {void}
|
|
40
38
|
*/
|
|
41
39
|
componentWillLoad() {
|
|
@@ -44,7 +42,6 @@ const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
44
42
|
}
|
|
45
43
|
/**
|
|
46
44
|
* Render
|
|
47
|
-
*
|
|
48
45
|
* @returns {HTMLElement} HTML Element
|
|
49
46
|
*/
|
|
50
47
|
render() {
|
|
@@ -16,7 +16,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
16
16
|
/**
|
|
17
17
|
* Define required message based on mg-inputs required elements
|
|
18
18
|
* Also
|
|
19
|
-
*
|
|
20
19
|
* @returns {void}
|
|
21
20
|
*/
|
|
22
21
|
this.setRequiredMessage = () => {
|
|
@@ -42,7 +41,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
42
41
|
};
|
|
43
42
|
/**
|
|
44
43
|
* Check if form is valid
|
|
45
|
-
*
|
|
46
44
|
* @returns {void}
|
|
47
45
|
*/
|
|
48
46
|
this.checkValidity = () => {
|
|
@@ -55,7 +53,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
55
53
|
};
|
|
56
54
|
/**
|
|
57
55
|
* Handle Form Submit
|
|
58
|
-
*
|
|
59
56
|
* @param {SubmitEvent} event submit event
|
|
60
57
|
* @returns {void}
|
|
61
58
|
*/
|
|
@@ -65,7 +62,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
65
62
|
};
|
|
66
63
|
/**
|
|
67
64
|
* Set mgInputs
|
|
68
|
-
*
|
|
69
65
|
* @returns {void}
|
|
70
66
|
*/
|
|
71
67
|
this.setMgInputs = () => {
|
|
@@ -97,7 +93,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
97
93
|
}
|
|
98
94
|
/**
|
|
99
95
|
* Public method to display errors
|
|
100
|
-
*
|
|
101
96
|
* @returns {Promise<void>}
|
|
102
97
|
*/
|
|
103
98
|
async displayError() {
|
|
@@ -113,7 +108,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
113
108
|
*************/
|
|
114
109
|
/**
|
|
115
110
|
* Check if component props are well configured on init
|
|
116
|
-
*
|
|
117
111
|
* @returns {void}
|
|
118
112
|
*/
|
|
119
113
|
componentWillLoad() {
|
|
@@ -141,7 +135,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
141
135
|
}
|
|
142
136
|
/**
|
|
143
137
|
* Add slot listeners
|
|
144
|
-
*
|
|
145
138
|
* @returns {void}
|
|
146
139
|
*/
|
|
147
140
|
componentDidLoad() {
|
|
@@ -160,7 +153,6 @@ const MgForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
160
153
|
}
|
|
161
154
|
/**
|
|
162
155
|
* Render
|
|
163
|
-
*
|
|
164
156
|
* @returns {HTMLElement} HTML Element
|
|
165
157
|
*/
|
|
166
158
|
render() {
|