@mgdis/mg-components 5.8.2 → 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 +216 -277
- 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.conf.js +8 -0
- package/dist/collection/components/atoms/mg-card/mg-card.css +54 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +113 -2
- 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.conf.js +38 -7
- package/dist/collection/components/atoms/mg-icon/mg-icon.css +70 -11
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +65 -24
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +0 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.css +12 -12
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +0 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +42 -15
- 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 +12 -21
- 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 +1 -12
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +1 -0
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -19
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.css +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +0 -8
- package/dist/collection/components/molecules/mg-details/mg-details.css +0 -3
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -4
- 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.css +1 -19
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -11
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
- 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.css +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +5 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
- 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/styles/reset-mg-card-slotted-variables.scss +1 -0
- 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/collection/variables.css +7 -1
- 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 +1 -9
- package/dist/components/mg-badge2.js +1 -3
- package/dist/components/mg-button2.js +2 -7
- package/dist/components/mg-card2.js +67 -4
- package/dist/components/mg-character-left2.js +0 -2
- package/dist/components/mg-details.js +2 -5
- package/dist/components/mg-divider.js +0 -1
- package/dist/components/mg-form.js +0 -8
- package/dist/components/mg-icon2.js +74 -25
- 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 +12 -21
- 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 +2 -20
- package/dist/components/mg-menu2.js +0 -11
- package/dist/components/mg-message.js +4 -9
- package/dist/components/mg-modal.js +2 -7
- package/dist/components/mg-pagination.js +0 -6
- package/dist/components/mg-panel.js +6 -16
- package/dist/components/mg-popover2.js +2 -9
- package/dist/components/mg-skip-links.js +1 -4
- package/dist/components/mg-tabs.js +0 -12
- package/dist/components/mg-tag.js +1 -4
- package/dist/components/mg-tooltip2.js +42 -15
- package/dist/components/popper.js +3 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +216 -277
- 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.css +1 -1
- 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-eb32bb18.entry.js +1 -0
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/mg-components/variables.css +7 -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.conf.d.ts +16 -0
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +37 -1
- 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.conf.d.ts +10 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +19 -8
- 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 +18 -9
- 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 +5 -17
- 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.conf.d.ts +5 -1
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +7 -11
- 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/components.d.ts +35 -9
- 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 +15 -16
- package/dist/mg-components/p-0b68c4b4.entry.js +0 -1
- /package/dist/mg-components/{p-367f92d2.js → p-73156ac9.js} +0 -0
|
@@ -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
|
*/
|
|
@@ -10,11 +10,10 @@ import { d as defineCustomElement$5 } from './mg-icon2.js';
|
|
|
10
10
|
import { d as defineCustomElement$4 } from './mg-menu2.js';
|
|
11
11
|
import { d as defineCustomElement$2 } from './mg-popover2.js';
|
|
12
12
|
|
|
13
|
-
const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{--mg-popover-padding-vertical:1rem;--mg-popover-padding-horizontal:0}.mg-action-more__chevron{transition:200ms}.mg-action-more__chevron--rotate.mg-action-more__chevron{transform:rotate(180deg)}";
|
|
13
|
+
const mgActionMoreCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{--mg-popover-padding-vertical:1rem;--mg-popover-padding-horizontal:0;--mg-popover-max-width:unset}.mg-action-more__chevron{transition:200ms}.mg-action-more__chevron--rotate.mg-action-more__chevron{transform:rotate(180deg)}";
|
|
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"],
|
|
@@ -1,26 +1,89 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { C as ClassList } from './components.utils.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* List available variants
|
|
6
|
+
*/
|
|
7
|
+
const variants = ['info', 'warning', 'success', 'danger', 'app'];
|
|
8
|
+
/**
|
|
9
|
+
* List available variant styles
|
|
10
|
+
*/
|
|
11
|
+
const variantStyles = ['bar-left', 'fill'];
|
|
12
|
+
|
|
13
|
+
const mgCardCss = ".mg-card{position:relative;width:100%;max-width:var(--mg-card-max-width);padding:var(--mg-card-padding, var(--mg-card-padding-default));overflow:var(--mg-card-overflow, var(--mg-card-overflow-default));box-sizing:border-box;z-index:inherit;background:var(--mg-card-background, var(--mg-card-background-default));border:var(--mg-card-border, var(--mg-card-border-default));border-radius:var(--mg-card-border-radius, var(--mg-card-border-radius-default));box-shadow:var(--mg-card-box-shadow, var(--mg-card-box-shadow-default))}.mg-card ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset}.mg-card.mg-card--info{overflow:hidden}.mg-card.mg-card--info.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--color-info-l))}.mg-card.mg-card--info.mg-card--fill{background-color:hsl(var(--color-info-h), var(--color-info-s), var(--mg-color-soft-l))}.mg-card.mg-card--warning{overflow:hidden}.mg-card.mg-card--warning.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--color-warning-l))}.mg-card.mg-card--warning.mg-card--fill{background-color:hsl(var(--color-warning-h), var(--color-warning-s), var(--mg-color-soft-l))}.mg-card.mg-card--success{overflow:hidden}.mg-card.mg-card--success.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--color-success-l))}.mg-card.mg-card--success.mg-card--fill{background-color:hsl(var(--color-success-h), var(--color-success-s), var(--mg-color-soft-l))}.mg-card.mg-card--danger{overflow:hidden}.mg-card.mg-card--danger.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--color-danger-l))}.mg-card.mg-card--danger.mg-card--fill{background-color:hsl(var(--color-danger-h), var(--color-danger-s), var(--mg-color-soft-l))}.mg-card.mg-card--app{overflow:hidden}.mg-card.mg-card--app.mg-card--bar-left .mg-card__bar{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-app-l))}.mg-card.mg-card--app.mg-card--fill{background-color:hsl(var(--mg-color-app-h), var(--mg-color-app-s), var(--mg-color-soft-l))}.mg-card__bar{position:absolute;top:0;left:0;width:0.3rem;height:100%}";
|
|
4
14
|
|
|
5
15
|
const MgCard = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
16
|
constructor() {
|
|
7
17
|
super();
|
|
8
18
|
this.__registerHost();
|
|
9
19
|
this.__attachShadow();
|
|
20
|
+
/*************
|
|
21
|
+
* Private *
|
|
22
|
+
*************/
|
|
23
|
+
this.name = 'mg-card';
|
|
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
|
+
};
|
|
34
|
+
this.variant = undefined;
|
|
35
|
+
this.variantStyle = undefined;
|
|
36
|
+
this.classList = new ClassList([this.baseClass]);
|
|
37
|
+
}
|
|
38
|
+
validateVariant(newValue, oldValue) {
|
|
39
|
+
if (newValue && !variants.includes(newValue))
|
|
40
|
+
throw new Error(`<${this.name}> prop "variant" must match VariantType type.`);
|
|
41
|
+
if (Boolean(newValue)) {
|
|
42
|
+
this.setDefaultVariantStyle();
|
|
43
|
+
this.classList.add(`${this.baseClass}--${newValue}`);
|
|
44
|
+
}
|
|
45
|
+
if (Boolean(oldValue))
|
|
46
|
+
this.classList.delete(`${this.baseClass}--${oldValue}`);
|
|
47
|
+
}
|
|
48
|
+
validateVariantStyle(newValue, oldValue) {
|
|
49
|
+
if (newValue && !variantStyles.includes(newValue))
|
|
50
|
+
throw new Error(`<${this.name}> prop "variantStyle" must match VariantStyleType type.`);
|
|
51
|
+
else if (Boolean(newValue) && !variants.includes(this.variant))
|
|
52
|
+
throw new Error(`<${this.name}> prop "variantStyle" must be paired with ${JSON.stringify(variants)} "variant" prop.`);
|
|
53
|
+
if (Boolean(newValue))
|
|
54
|
+
this.classList.add(`${this.baseClass}--${newValue}`);
|
|
55
|
+
if (Boolean(oldValue))
|
|
56
|
+
this.classList.delete(`${this.baseClass}--${oldValue}`);
|
|
10
57
|
}
|
|
11
58
|
/*************
|
|
12
59
|
* Lifecycle *
|
|
13
60
|
*************/
|
|
61
|
+
/**
|
|
62
|
+
* Check if props are well configured on init
|
|
63
|
+
* @returns {void}
|
|
64
|
+
*/
|
|
65
|
+
componentWillLoad() {
|
|
66
|
+
this.validateVariant(this.variant);
|
|
67
|
+
this.validateVariantStyle(this.variantStyle);
|
|
68
|
+
}
|
|
14
69
|
/**
|
|
15
70
|
* Render
|
|
16
|
-
*
|
|
17
71
|
* @returns {HTMLElement} HTML Element
|
|
18
72
|
*/
|
|
19
73
|
render() {
|
|
20
|
-
|
|
74
|
+
var _a;
|
|
75
|
+
return (h("div", { class: this.classList.join() }, ((_a = this.variantStyle) === null || _a === void 0 ? void 0 : _a.startsWith('bar-')) && h("span", { class: "mg-card__bar" }), h("slot", null)));
|
|
21
76
|
}
|
|
77
|
+
static get watchers() { return {
|
|
78
|
+
"variant": ["validateVariant"],
|
|
79
|
+
"variantStyle": ["validateVariantStyle"]
|
|
80
|
+
}; }
|
|
22
81
|
static get style() { return mgCardCss; }
|
|
23
|
-
}, [1, "mg-card"
|
|
82
|
+
}, [1, "mg-card", {
|
|
83
|
+
"variant": [1],
|
|
84
|
+
"variantStyle": [1025, "variant-style"],
|
|
85
|
+
"classList": [32]
|
|
86
|
+
}]);
|
|
24
87
|
function defineCustomElement() {
|
|
25
88
|
if (typeof customElements === "undefined") {
|
|
26
89
|
return;
|
|
@@ -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() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
3
3
|
|
|
4
|
-
const mgDetailsCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-details summary{display:flex;align-items:baseline;cursor:pointer}.mg-details__toggle{margin-left:1.5rem;flex-shrink:0;display:flex;align-items:center;align-self:flex-start;gap:0.6rem;min-height:calc(var(--font-size) * var(--line-height))}.mg-
|
|
4
|
+
const mgDetailsCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}.mg-details summary{display:flex;align-items:baseline;cursor:pointer}.mg-details__toggle{margin-left:1.5rem;flex-shrink:0;display:flex;align-items:center;align-self:flex-start;gap:0.6rem;min-height:calc(var(--font-size) * var(--line-height))}.mg-details__details{margin-top:1.5rem}";
|
|
5
5
|
|
|
6
6
|
const MgDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -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,11 +42,10 @@ 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() {
|
|
51
|
-
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
48
|
+
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
52
49
|
}
|
|
53
50
|
static get watchers() { return {
|
|
54
51
|
"toggleClosed": ["validateTitles"],
|
|
@@ -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() {
|