@mgdis/mg-components 5.9.1 → 5.10.1
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 +345 -648
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +19 -43
- package/dist/cjs/{mg-menu.conf-9afe6571.js → mg-menu.conf-196151fe.js} +16 -21
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -12
- package/dist/collection/components/atoms/mg-button/mg-button.js +18 -27
- package/dist/collection/components/atoms/mg-card/mg-card.js +22 -15
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -4
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +26 -23
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -4
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -16
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +12 -34
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -24
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +10 -20
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -17
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -34
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -13
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -27
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -45
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +17 -43
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -28
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -29
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -47
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -23
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -27
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -4
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -12
- package/dist/collection/components/molecules/mg-message/mg-message.js +12 -20
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -17
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -19
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -30
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +8 -21
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +3 -8
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -36
- package/dist/collection/locales/index.js +2 -3
- package/dist/collection/utils/behaviors.utils.js +16 -32
- package/dist/collection/utils/components.utils.js +22 -33
- package/dist/collection/utils/locale.utils.js +14 -18
- package/dist/collection/utils/unit.test.utils.js +7 -15
- package/dist/components/MgInput.js +30 -24
- package/dist/components/components.utils.js +22 -33
- package/dist/components/index2.js +16 -21
- package/dist/components/mg-action-more.js +9 -21
- package/dist/components/mg-badge2.js +9 -12
- package/dist/components/mg-button2.js +18 -27
- package/dist/components/mg-card2.js +20 -13
- package/dist/components/mg-character-left2.js +1 -4
- package/dist/components/mg-details.js +1 -6
- package/dist/components/mg-divider.js +1 -2
- package/dist/components/mg-form.js +7 -23
- package/dist/components/mg-icon2.js +26 -23
- package/dist/components/mg-illustrated-message.js +1 -4
- package/dist/components/mg-input-checkbox.js +9 -16
- package/dist/components/mg-input-date.js +6 -13
- package/dist/components/mg-input-numeric.js +13 -30
- package/dist/components/mg-input-password.js +5 -9
- package/dist/components/mg-input-radio.js +9 -23
- package/dist/components/mg-input-select2.js +20 -41
- package/dist/components/mg-input-text2.js +15 -35
- package/dist/components/mg-input-textarea.js +13 -18
- package/dist/components/mg-input-title2.js +1 -4
- package/dist/components/mg-input-toggle.js +16 -24
- package/dist/components/mg-item-more.js +18 -42
- package/dist/components/mg-menu-item2.js +17 -44
- package/dist/components/mg-menu2.js +9 -27
- package/dist/components/mg-message.js +12 -20
- package/dist/components/mg-modal.js +8 -17
- package/dist/components/mg-pagination.js +11 -19
- package/dist/components/mg-panel.js +11 -30
- package/dist/components/mg-popover2.js +8 -21
- package/dist/components/mg-skip-links.js +3 -8
- package/dist/components/mg-tabs.js +20 -36
- package/dist/components/mg-tag.js +11 -16
- package/dist/components/mg-tooltip2.js +12 -34
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +345 -648
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +19 -43
- package/dist/esm/{mg-menu.conf-881fbd82.js → mg-menu.conf-9ca023ee.js} +16 -21
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-67ce7cb8.entry.js → p-97aaca3e.entry.js} +1 -1
- package/dist/mg-components/p-d891e707.entry.js +1 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -5
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -14
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -8
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -4
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +8 -7
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -4
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -8
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -33
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -6
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -11
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -11
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -26
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -7
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -18
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -22
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -23
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -9
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -11
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -29
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -49
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -15
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -6
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -19
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -4
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -12
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -12
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -12
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -14
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -23
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -16
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -7
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -30
- package/dist/types/components.d.ts +22 -34
- package/dist/types/locales/index.d.ts +2 -3
- package/dist/types/utils/behaviors.utils.d.ts +14 -29
- package/dist/types/utils/components.utils.d.ts +19 -29
- package/dist/types/utils/locale.utils.d.ts +14 -18
- package/dist/types/utils/unit.test.utils.d.ts +11 -24
- package/package.json +11 -12
- package/dist/mg-components/p-9a93b7af.entry.js +0 -1
- /package/dist/mg-components/{p-367f92d2.js → p-0d3146d9.js} +0 -0
|
@@ -23,8 +23,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
23
23
|
************/
|
|
24
24
|
/**
|
|
25
25
|
* Toggle is editing state
|
|
26
|
-
*
|
|
27
|
-
* @returns {void}
|
|
28
26
|
*/
|
|
29
27
|
this.toggleIsEditing = () => {
|
|
30
28
|
this.isEditing = !this.isEditing;
|
|
@@ -34,8 +32,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
34
32
|
************/
|
|
35
33
|
/**
|
|
36
34
|
* Collapse button click handler
|
|
37
|
-
*
|
|
38
|
-
* @returns {void}
|
|
39
35
|
*/
|
|
40
36
|
this.handleCollapseButton = () => {
|
|
41
37
|
if (!this.expandToggleDisabled) {
|
|
@@ -44,25 +40,19 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
44
40
|
};
|
|
45
41
|
/**
|
|
46
42
|
* Edit button click handler
|
|
47
|
-
*
|
|
48
|
-
* @returns {void}
|
|
49
43
|
*/
|
|
50
44
|
this.handleEditButton = () => {
|
|
51
45
|
this.toggleIsEditing();
|
|
52
46
|
};
|
|
53
47
|
/**
|
|
54
48
|
* Update title handler
|
|
55
|
-
*
|
|
56
|
-
* @param {CustomEvent<string>} event input value change event
|
|
57
|
-
* @returns {void}
|
|
49
|
+
* @param event - input value change event
|
|
58
50
|
*/
|
|
59
51
|
this.handleUpdateTitle = (event) => {
|
|
60
52
|
this.updatedPanelTitle = event.detail;
|
|
61
53
|
};
|
|
62
54
|
/**
|
|
63
55
|
* Cancel edition button handler
|
|
64
|
-
*
|
|
65
|
-
* @returns {void}
|
|
66
56
|
*/
|
|
67
57
|
this.handleCancelEditButton = () => {
|
|
68
58
|
this.updatedPanelTitle = undefined;
|
|
@@ -70,8 +60,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
70
60
|
};
|
|
71
61
|
/**
|
|
72
62
|
* Validate edition button handler
|
|
73
|
-
*
|
|
74
|
-
* @returns {void}
|
|
75
63
|
*/
|
|
76
64
|
this.handleValidateEditButton = () => {
|
|
77
65
|
if (this.editInputElement.valid) {
|
|
@@ -82,9 +70,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
82
70
|
};
|
|
83
71
|
/**
|
|
84
72
|
* Header left conditional render
|
|
85
|
-
*
|
|
86
|
-
* @typedef {HTMLElement} HTMLMgButtonElement
|
|
87
|
-
* @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
|
|
73
|
+
* @returns header left element
|
|
88
74
|
*/
|
|
89
75
|
this.headerLeft = () => {
|
|
90
76
|
const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("span", { class: "mg-panel__collapse-button-content" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle)));
|
|
@@ -109,7 +95,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
109
95
|
this.expanded = false;
|
|
110
96
|
this.expandToggleDisabled = undefined;
|
|
111
97
|
this.titleEditable = false;
|
|
112
|
-
this.
|
|
98
|
+
this.classCollection = new ClassList(['mg-panel']);
|
|
113
99
|
this.isEditing = false;
|
|
114
100
|
this.updatedPanelTitle = undefined;
|
|
115
101
|
}
|
|
@@ -120,10 +106,10 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
120
106
|
this.titleChange.emit(newValue);
|
|
121
107
|
}
|
|
122
108
|
validatetitlePattern(newValue) {
|
|
123
|
-
if (newValue && !this.titleEditable) {
|
|
109
|
+
if (newValue !== undefined && !this.titleEditable) {
|
|
124
110
|
throw new Error('<mg-panel> prop "titleEditable" must be set to `true`.');
|
|
125
111
|
}
|
|
126
|
-
if (newValue && (this.titlePatternErrorMessage === undefined || this.titlePatternErrorMessage.trim() === '')) {
|
|
112
|
+
if (newValue !== undefined && (this.titlePatternErrorMessage === undefined || this.titlePatternErrorMessage.trim() === '')) {
|
|
127
113
|
throw new Error('<mg-panel> prop "titlePattern" must be paired with the prop "titlePatternErrorMessage".');
|
|
128
114
|
}
|
|
129
115
|
}
|
|
@@ -135,8 +121,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
135
121
|
*************/
|
|
136
122
|
/**
|
|
137
123
|
* Check if props are well configured on init
|
|
138
|
-
*
|
|
139
|
-
* @returns {void}
|
|
140
124
|
*/
|
|
141
125
|
componentWillLoad() {
|
|
142
126
|
// Get locales
|
|
@@ -147,8 +131,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
147
131
|
}
|
|
148
132
|
/**
|
|
149
133
|
* Edit DOM after render
|
|
150
|
-
*
|
|
151
|
-
* @returns {void}
|
|
152
134
|
*/
|
|
153
135
|
componentDidRender() {
|
|
154
136
|
// when we are editing we get focus on edition input
|
|
@@ -158,11 +140,10 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
158
140
|
}
|
|
159
141
|
/**
|
|
160
142
|
* Render component
|
|
161
|
-
*
|
|
162
|
-
* @returns {HTMLElement} html element
|
|
143
|
+
* @returns html element
|
|
163
144
|
*/
|
|
164
145
|
render() {
|
|
165
|
-
return (h("section", { class: this.
|
|
146
|
+
return (h("section", { class: this.classCollection.join(), id: this.identifier }, h("mg-card", null, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null)))));
|
|
166
147
|
}
|
|
167
148
|
get element() { return this; }
|
|
168
149
|
static get watchers() { return {
|
|
@@ -174,12 +155,12 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
174
155
|
}, [1, "mg-panel", {
|
|
175
156
|
"identifier": [1],
|
|
176
157
|
"panelTitle": [1025, "panel-title"],
|
|
177
|
-
"titlePattern": [
|
|
178
|
-
"titlePatternErrorMessage": [
|
|
158
|
+
"titlePattern": [1, "title-pattern"],
|
|
159
|
+
"titlePatternErrorMessage": [1, "title-pattern-error-message"],
|
|
179
160
|
"expanded": [1028],
|
|
180
|
-
"expandToggleDisabled": [
|
|
161
|
+
"expandToggleDisabled": [4, "expand-toggle-disabled"],
|
|
181
162
|
"titleEditable": [4, "title-editable"],
|
|
182
|
-
"
|
|
163
|
+
"classCollection": [32],
|
|
183
164
|
"isEditing": [32],
|
|
184
165
|
"updatedPanelTitle": [32]
|
|
185
166
|
}]);
|
|
@@ -19,9 +19,7 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
19
19
|
this.classArrowHide = `mg-popover--arrow-hide`;
|
|
20
20
|
/**
|
|
21
21
|
* Check if clicked outside of component
|
|
22
|
-
*
|
|
23
|
-
* @param {MouseEvent} event mouse event
|
|
24
|
-
* @returns {void}
|
|
22
|
+
* @param event - mouse event
|
|
25
23
|
*/
|
|
26
24
|
this.clickOutside = (event) => {
|
|
27
25
|
var _a;
|
|
@@ -33,8 +31,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
31
|
};
|
|
34
32
|
/**
|
|
35
33
|
* Show popover
|
|
36
|
-
*
|
|
37
|
-
* @returns {void}
|
|
38
34
|
*/
|
|
39
35
|
this.show = () => {
|
|
40
36
|
// Make the popover visible
|
|
@@ -53,8 +49,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
49
|
};
|
|
54
50
|
/**
|
|
55
51
|
* Hide popover
|
|
56
|
-
*
|
|
57
|
-
* @returns {void}
|
|
58
52
|
*/
|
|
59
53
|
this.hide = () => {
|
|
60
54
|
// Hide the popover
|
|
@@ -68,8 +62,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
68
62
|
};
|
|
69
63
|
/**
|
|
70
64
|
* Handle action for close button
|
|
71
|
-
*
|
|
72
|
-
* @returns {void}
|
|
73
65
|
*/
|
|
74
66
|
this.handleCloseButton = () => {
|
|
75
67
|
this.display = false;
|
|
@@ -80,13 +72,13 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
80
72
|
this.closeButton = false;
|
|
81
73
|
this.display = false;
|
|
82
74
|
this.disabled = false;
|
|
83
|
-
this.
|
|
75
|
+
this.classCollection = new ClassList(['mg-popover']);
|
|
84
76
|
}
|
|
85
77
|
validateArrowHide(newValue) {
|
|
86
78
|
if (newValue)
|
|
87
|
-
this.
|
|
79
|
+
this.classCollection.add(this.classArrowHide);
|
|
88
80
|
else
|
|
89
|
-
this.
|
|
81
|
+
this.classCollection.delete(this.classArrowHide);
|
|
90
82
|
}
|
|
91
83
|
handleDisplay(newValue) {
|
|
92
84
|
if (newValue) {
|
|
@@ -102,8 +94,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
102
94
|
*************/
|
|
103
95
|
/**
|
|
104
96
|
* Check if component props are well configured on init
|
|
105
|
-
*
|
|
106
|
-
* @returns {void} timeout
|
|
107
97
|
*/
|
|
108
98
|
componentWillLoad() {
|
|
109
99
|
// Get windows to attach events
|
|
@@ -114,8 +104,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
114
104
|
}
|
|
115
105
|
/**
|
|
116
106
|
* Check if component props are well configured on init
|
|
117
|
-
*
|
|
118
|
-
* @returns {void}
|
|
119
107
|
*/
|
|
120
108
|
componentDidLoad() {
|
|
121
109
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
@@ -172,11 +160,10 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
172
160
|
}
|
|
173
161
|
/**
|
|
174
162
|
* Render
|
|
175
|
-
*
|
|
176
|
-
* @returns {HTMLElement} HTML Element
|
|
163
|
+
* @returns HTML Element
|
|
177
164
|
*/
|
|
178
165
|
render() {
|
|
179
|
-
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: this.
|
|
166
|
+
return (h(Host, null, h("slot", null), h("div", { id: this.identifier, class: this.classCollection.join() }, h("mg-card", null, this.closeButton && (h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { icon: "cross" }))), h("div", { class: "mg-popover__title" }, h("slot", { name: "title" })), h("slot", { name: "content" })), !this.arrowHide && h("div", { class: "mg-popover__arrow", "data-popper-arrow": true }))));
|
|
180
167
|
}
|
|
181
168
|
get element() { return this; }
|
|
182
169
|
static get watchers() { return {
|
|
@@ -190,8 +177,8 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
190
177
|
"arrowHide": [4, "arrow-hide"],
|
|
191
178
|
"closeButton": [4, "close-button"],
|
|
192
179
|
"display": [1028],
|
|
193
|
-
"disabled": [
|
|
194
|
-
"
|
|
180
|
+
"disabled": [4],
|
|
181
|
+
"classCollection": [32]
|
|
195
182
|
}]);
|
|
196
183
|
function defineCustomElement() {
|
|
197
184
|
if (typeof customElements === "undefined") {
|
|
@@ -14,9 +14,7 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
14
14
|
**********/
|
|
15
15
|
/**
|
|
16
16
|
* Handle link click and emit go-to-anchor event
|
|
17
|
-
*
|
|
18
|
-
* @param {MouseEvent} event mouse event
|
|
19
|
-
* @returns {void}
|
|
17
|
+
* @param event - mouse event
|
|
20
18
|
*/
|
|
21
19
|
this.handleLinkCLick = (event) => {
|
|
22
20
|
event.currentTarget.blur();
|
|
@@ -36,8 +34,6 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
36
34
|
*************/
|
|
37
35
|
/**
|
|
38
36
|
* Check if props are well configured on init
|
|
39
|
-
*
|
|
40
|
-
* @returns {void}
|
|
41
37
|
*/
|
|
42
38
|
componentWillLoad() {
|
|
43
39
|
this.validateLinks(this.links);
|
|
@@ -45,8 +41,7 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
45
41
|
}
|
|
46
42
|
/**
|
|
47
43
|
* Render
|
|
48
|
-
*
|
|
49
|
-
* @returns {HTMLElement} HTML Element
|
|
44
|
+
* @returns HTML Element
|
|
50
45
|
*/
|
|
51
46
|
render() {
|
|
52
47
|
return (h("nav", { class: "mg-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { class: "mg-skip-links__list", role: "list" }, this.links.map(link => (h("li", { key: link.href }, h("a", { class: "mg-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
@@ -57,7 +52,7 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
57
52
|
}; }
|
|
58
53
|
static get style() { return mgSkipLinksCss; }
|
|
59
54
|
}, [1, "mg-skip-links", {
|
|
60
|
-
"links": [
|
|
55
|
+
"links": [16]
|
|
61
56
|
}]);
|
|
62
57
|
function defineCustomElement$1() {
|
|
63
58
|
if (typeof customElements === "undefined") {
|
|
@@ -22,9 +22,8 @@ const mgTabsCss = ".mg-tabs.mg-tabs--size-regular .mg-tabs__navigation-button,.m
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* type TabItem validation function
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
* @returns {boolean} tab item type is valid
|
|
25
|
+
* @param tab - tab item
|
|
26
|
+
* @returns tab item type is valid
|
|
28
27
|
*/
|
|
29
28
|
const isTabItem = (tab) => typeof tab === 'object' && typeof tab.label === 'string';
|
|
30
29
|
const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -42,37 +41,32 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
42
41
|
this.startIndex = 1;
|
|
43
42
|
/**
|
|
44
43
|
* Method to know if given tab has the given status
|
|
45
|
-
*
|
|
46
|
-
* @param
|
|
47
|
-
* @
|
|
48
|
-
* @returns {boolean} status comparaison
|
|
44
|
+
* @param tab - item tab key to set to ACTIVE status
|
|
45
|
+
* @param status - status to valide
|
|
46
|
+
* @returns status comparaison
|
|
49
47
|
*/
|
|
50
48
|
this.tabHasStatus = (tab, status) => tab.status === status;
|
|
51
49
|
/**
|
|
52
50
|
* Method to get element id from index
|
|
53
|
-
*
|
|
54
|
-
* @param
|
|
55
|
-
* @
|
|
56
|
-
* @returns {string} generated element id
|
|
51
|
+
* @param element - to get id
|
|
52
|
+
* @param index - to generate id
|
|
53
|
+
* @returns generated element id
|
|
57
54
|
*/
|
|
58
55
|
this.getElementId = (element, index) => `${element}-${this.getTabItemIndex(index)}`;
|
|
59
56
|
/**
|
|
60
57
|
* Method to get tab item index
|
|
61
|
-
*
|
|
62
|
-
* @
|
|
63
|
-
* @returns {number} index
|
|
58
|
+
* @param index - to get
|
|
59
|
+
* @returns index
|
|
64
60
|
*/
|
|
65
61
|
this.getTabItemIndex = (index) => index + this.startIndex;
|
|
66
62
|
/**
|
|
67
63
|
* Method to get the active-tab value
|
|
68
|
-
*
|
|
69
|
-
* @returns {number} of the active-tab
|
|
64
|
+
* @returns of the active-tab
|
|
70
65
|
*/
|
|
71
66
|
this.getActiveTab = () => this.activeTab || this.getTabItemIndex(this.tabs.map((tab, index) => (Object.assign(Object.assign({}, tab), { index }))).find(tab => this.tabHasStatus(tab, Status.ACTIVE)).index);
|
|
72
67
|
/**
|
|
73
68
|
* Handle click events on tabs
|
|
74
|
-
*
|
|
75
|
-
* @param {MouseEvent} event mouse event
|
|
69
|
+
* @param event - mouse event
|
|
76
70
|
*/
|
|
77
71
|
this.handleClick = (event) => {
|
|
78
72
|
const tabId = event.currentTarget.dataset.index;
|
|
@@ -87,16 +81,13 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
87
81
|
};
|
|
88
82
|
/**
|
|
89
83
|
* get navigation button class from given status
|
|
90
|
-
*
|
|
91
|
-
* @
|
|
92
|
-
* @returns {string} button class/selector variant
|
|
84
|
+
* @param status - button tab status
|
|
85
|
+
* @returns button class/selector variant
|
|
93
86
|
*/
|
|
94
87
|
this.getNavigationButtonClass = (status) => `${this.buttonTabBaseClass}--${status}`;
|
|
95
88
|
/**
|
|
96
89
|
* Handle keyboard event on tabs
|
|
97
|
-
*
|
|
98
|
-
* @param {MouseEvent} event mouse event
|
|
99
|
-
* @returns {void}
|
|
90
|
+
* @param event - mouse event
|
|
100
91
|
*/
|
|
101
92
|
this.handleKeydown = (event) => {
|
|
102
93
|
const parent = event.target.parentElement;
|
|
@@ -134,8 +125,6 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
134
125
|
};
|
|
135
126
|
/**
|
|
136
127
|
* Method to reset focus behavior
|
|
137
|
-
*
|
|
138
|
-
* @returns {void}
|
|
139
128
|
*/
|
|
140
129
|
this.resetFocus = () => {
|
|
141
130
|
// update asynchronously tabindex to prevent get focus on new tabindex at then end of event process
|
|
@@ -160,7 +149,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
160
149
|
this.items = undefined;
|
|
161
150
|
this.activeTab = undefined;
|
|
162
151
|
this.tabs = [];
|
|
163
|
-
this.
|
|
152
|
+
this.classCollection = new ClassList(['mg-tabs']);
|
|
164
153
|
}
|
|
165
154
|
validateLabel(newValue) {
|
|
166
155
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -171,7 +160,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
171
160
|
if (!sizes.includes(newValue)) {
|
|
172
161
|
throw new Error(`<mg-tabs> prop "size" must be one of: ${sizes.join(', ')}`);
|
|
173
162
|
}
|
|
174
|
-
this.
|
|
163
|
+
this.classCollection.add(`mg-tabs--size-${this.size}`);
|
|
175
164
|
}
|
|
176
165
|
validateItems(newValue) {
|
|
177
166
|
// String array
|
|
@@ -214,8 +203,6 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
214
203
|
*************/
|
|
215
204
|
/**
|
|
216
205
|
* Check if component props are well configured on init
|
|
217
|
-
*
|
|
218
|
-
* @returns {void}
|
|
219
206
|
*/
|
|
220
207
|
componentWillLoad() {
|
|
221
208
|
// Check tabs format
|
|
@@ -227,8 +214,6 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
227
214
|
}
|
|
228
215
|
/**
|
|
229
216
|
* add listners
|
|
230
|
-
*
|
|
231
|
-
* @returns {void}
|
|
232
217
|
*/
|
|
233
218
|
componentDidLoad() {
|
|
234
219
|
document.addEventListener('click', (event) => {
|
|
@@ -238,11 +223,10 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
238
223
|
}
|
|
239
224
|
/**
|
|
240
225
|
* Render
|
|
241
|
-
*
|
|
242
|
-
* @returns {HTMLElement} HTML Element
|
|
226
|
+
* @returns HTML Element
|
|
243
227
|
*/
|
|
244
228
|
render() {
|
|
245
|
-
return (h("div", { class: this.
|
|
229
|
+
return (h("div", { class: this.classCollection.join() }, h("header", { role: "tablist", "aria-label": this.label, class: "mg-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
246
230
|
[`${this.buttonTabBaseClass}`]: true,
|
|
247
231
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
248
232
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
@@ -265,7 +249,7 @@ const MgTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
265
249
|
"items": [16],
|
|
266
250
|
"activeTab": [1538, "active-tab"],
|
|
267
251
|
"tabs": [32],
|
|
268
|
-
"
|
|
252
|
+
"classCollection": [32]
|
|
269
253
|
}]);
|
|
270
254
|
function defineCustomElement$1() {
|
|
271
255
|
if (typeof customElements === "undefined") {
|
|
@@ -22,7 +22,7 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
22
22
|
this.variant = variants[0];
|
|
23
23
|
this.outline = undefined;
|
|
24
24
|
this.soft = undefined;
|
|
25
|
-
this.
|
|
25
|
+
this.classCollection = new ClassList(['mg-tag']);
|
|
26
26
|
}
|
|
27
27
|
validateVariant(newValue, oldValue) {
|
|
28
28
|
if (!variants.includes(newValue)) {
|
|
@@ -30,16 +30,16 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
if (oldValue !== undefined) {
|
|
33
|
-
this.
|
|
33
|
+
this.classCollection.delete(`mg-tag--${oldValue}`);
|
|
34
34
|
}
|
|
35
|
-
this.
|
|
35
|
+
this.classCollection.add(`mg-tag--${newValue}`);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
validateOutline(newValue) {
|
|
39
39
|
if (newValue)
|
|
40
|
-
this.
|
|
40
|
+
this.classCollection.add(this.classOutline);
|
|
41
41
|
else
|
|
42
|
-
this.
|
|
42
|
+
this.classCollection.delete(this.classOutline);
|
|
43
43
|
}
|
|
44
44
|
validateSoft(newValue) {
|
|
45
45
|
// usage validation
|
|
@@ -47,18 +47,16 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
47
47
|
throw new Error('<mg-tag> prop "soft" can NOT be used with prop "outline".');
|
|
48
48
|
// apply class
|
|
49
49
|
if (newValue)
|
|
50
|
-
this.
|
|
50
|
+
this.classCollection.add(this.classSoft);
|
|
51
51
|
else
|
|
52
|
-
this.
|
|
52
|
+
this.classCollection.delete(this.classSoft);
|
|
53
53
|
}
|
|
54
54
|
/*************
|
|
55
55
|
* Methods *
|
|
56
56
|
*************/
|
|
57
57
|
/**
|
|
58
58
|
* Validate the given textContent
|
|
59
|
-
*
|
|
60
|
-
* @param {string} textContent html element textContent property
|
|
61
|
-
* @returns {void}
|
|
59
|
+
* @param textContent - html element textContent property
|
|
62
60
|
*/
|
|
63
61
|
validateTextContent(textContent) {
|
|
64
62
|
if (typeof textContent !== 'string' || textContent.trim() === '')
|
|
@@ -69,8 +67,6 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
69
67
|
*************/
|
|
70
68
|
/**
|
|
71
69
|
* Check if props are well configured on init
|
|
72
|
-
*
|
|
73
|
-
* @returns {void}
|
|
74
70
|
*/
|
|
75
71
|
componentWillLoad() {
|
|
76
72
|
this.validateVariant(this.variant);
|
|
@@ -80,11 +76,10 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
80
76
|
}
|
|
81
77
|
/**
|
|
82
78
|
* Render
|
|
83
|
-
*
|
|
84
|
-
* @returns {HTMLElement} HTML Element
|
|
79
|
+
* @returns HTML Element
|
|
85
80
|
*/
|
|
86
81
|
render() {
|
|
87
|
-
return (h("span", { class: this.
|
|
82
|
+
return (h("span", { class: this.classCollection.join() }, h("slot", null)));
|
|
88
83
|
}
|
|
89
84
|
get element() { return this; }
|
|
90
85
|
static get watchers() { return {
|
|
@@ -97,7 +92,7 @@ const MgTag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
97
92
|
"variant": [1],
|
|
98
93
|
"outline": [4],
|
|
99
94
|
"soft": [4],
|
|
100
|
-
"
|
|
95
|
+
"classCollection": [32]
|
|
101
96
|
}]);
|
|
102
97
|
function defineCustomElement$1() {
|
|
103
98
|
if (typeof customElements === "undefined") {
|
|
@@ -18,8 +18,6 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
18
18
|
this.__attachShadow();
|
|
19
19
|
/**
|
|
20
20
|
* Show tooltip
|
|
21
|
-
*
|
|
22
|
-
* @returns {void}
|
|
23
21
|
*/
|
|
24
22
|
this.show = () => {
|
|
25
23
|
// Make the tooltip visible
|
|
@@ -39,8 +37,6 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
39
37
|
};
|
|
40
38
|
/**
|
|
41
39
|
* Hide tooltip
|
|
42
|
-
*
|
|
43
|
-
* @returns {void}
|
|
44
40
|
*/
|
|
45
41
|
this.hide = () => {
|
|
46
42
|
// Hide the tooltip
|
|
@@ -55,9 +51,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
55
51
|
};
|
|
56
52
|
/**
|
|
57
53
|
* Check if clicked outside of component and hidde tooltip
|
|
58
|
-
*
|
|
59
|
-
* @param {MouseEvent} event mouse event
|
|
60
|
-
* @returns {void}
|
|
54
|
+
* @param event - mouse event
|
|
61
55
|
*/
|
|
62
56
|
this.clickOutside = (event) => {
|
|
63
57
|
if (event.target.closest('mg-tooltip') !== this.element)
|
|
@@ -65,9 +59,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
65
59
|
};
|
|
66
60
|
/**
|
|
67
61
|
* Check if 'Escape' key is pressed of component and hidde tooltip
|
|
68
|
-
*
|
|
69
|
-
* @param {KeyboardEvent} event keyboard event
|
|
70
|
-
* @returns {void}
|
|
62
|
+
* @param event - keyboard event
|
|
71
63
|
*/
|
|
72
64
|
this.pressEscape = (event) => {
|
|
73
65
|
if (event.code === 'Escape')
|
|
@@ -75,10 +67,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
75
67
|
};
|
|
76
68
|
/**
|
|
77
69
|
* Method to set display prop
|
|
78
|
-
*
|
|
79
|
-
* @param
|
|
80
|
-
* @param {boolean} condition additionnal condition to apply display prop newValue
|
|
81
|
-
* @returns {void}
|
|
70
|
+
* @param newValue - display prop new value
|
|
71
|
+
* @param condition - additionnal condition to apply display prop newValue
|
|
82
72
|
*/
|
|
83
73
|
this.setDisplay = (newValue, condition = true) => {
|
|
84
74
|
if (!this.disabled && condition)
|
|
@@ -86,11 +76,9 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
86
76
|
};
|
|
87
77
|
/**
|
|
88
78
|
* Action for tooltip element and tooltiped element mouse listener
|
|
89
|
-
*
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
92
|
-
* @param {Guard} conditionalGuard guard condition
|
|
93
|
-
* @returns {void}
|
|
79
|
+
* @param elementGuard - tooltip element guard
|
|
80
|
+
* @param isMouseenter - mouseenter validation
|
|
81
|
+
* @param conditionalGuard - guard condition
|
|
94
82
|
*/
|
|
95
83
|
this.tooltipMouseListenerAction = (elementGuard, isMouseenter, conditionalGuard) => {
|
|
96
84
|
// we mutate elementGuard
|
|
@@ -109,17 +97,13 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
109
97
|
};
|
|
110
98
|
/**
|
|
111
99
|
* Method to reset guard value
|
|
112
|
-
*
|
|
113
|
-
* @returns {void}
|
|
114
100
|
*/
|
|
115
101
|
this.resetGuard = () => {
|
|
116
102
|
this.guard = undefined;
|
|
117
103
|
};
|
|
118
104
|
/**
|
|
119
105
|
* Update slot content when it is a mg-button
|
|
120
|
-
*
|
|
121
|
-
* @param {HTMLMgButtonElement} mgButton slotted mg-button
|
|
122
|
-
* @returns {void}
|
|
106
|
+
* @param mgButton - slotted mg-button
|
|
123
107
|
*/
|
|
124
108
|
this.setMgButtonWrapper = (mgButton) => {
|
|
125
109
|
if (mgButton.disabled) {
|
|
@@ -136,9 +120,8 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
136
120
|
};
|
|
137
121
|
/**
|
|
138
122
|
* Init tooltip
|
|
139
|
-
*
|
|
140
|
-
* @param
|
|
141
|
-
* @param {HTMLElement} interactiveElement interactive element
|
|
123
|
+
* @param slotElement - slotted element
|
|
124
|
+
* @param interactiveElement - interactive element
|
|
142
125
|
*/
|
|
143
126
|
this.initTooltip = (slotElement, interactiveElement) => {
|
|
144
127
|
// Add tabindex to slotted element if we can't find any interactive element
|
|
@@ -214,8 +197,6 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
214
197
|
*************/
|
|
215
198
|
/**
|
|
216
199
|
* set variables
|
|
217
|
-
*
|
|
218
|
-
* @returns {void}
|
|
219
200
|
*/
|
|
220
201
|
componentWillLoad() {
|
|
221
202
|
// Get windows to attach events
|
|
@@ -225,8 +206,6 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
225
206
|
* Get slotted element
|
|
226
207
|
* Check if it already contain an interactive element, if not we need to add a tabIndex attribute
|
|
227
208
|
* We need to attach the focused element to the tooltip (aria-describedby)
|
|
228
|
-
*
|
|
229
|
-
* @returns {void}
|
|
230
209
|
*/
|
|
231
210
|
componentDidLoad() {
|
|
232
211
|
var _a;
|
|
@@ -259,8 +238,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
259
238
|
}
|
|
260
239
|
/**
|
|
261
240
|
* Render
|
|
262
|
-
*
|
|
263
|
-
* @returns {HTMLElement} HTML Element
|
|
241
|
+
* @returns HTML Element
|
|
264
242
|
*/
|
|
265
243
|
render() {
|
|
266
244
|
return (h(Host, null, h("slot", null), h("div", { role: "tooltip", id: this.identifier, class: "mg-tooltip" }, h("span", { innerHTML: this.message }), h("div", { class: "mg-tooltip__arrow", "data-popper-arrow": true }))));
|
|
@@ -276,7 +254,7 @@ const MgTooltip = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
276
254
|
"message": [1],
|
|
277
255
|
"placement": [1],
|
|
278
256
|
"display": [1028],
|
|
279
|
-
"disabled": [
|
|
257
|
+
"disabled": [4]
|
|
280
258
|
}]);
|
|
281
259
|
function defineCustomElement() {
|
|
282
260
|
if (typeof customElements === "undefined") {
|