@mgdis/mg-components 5.10.0 → 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 +318 -427
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +19 -28
- package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-196151fe.js} +16 -16
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
- package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
- package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +11 -21
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +10 -14
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -13
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
- package/dist/collection/locales/index.js +2 -2
- package/dist/collection/utils/behaviors.utils.js +16 -22
- package/dist/collection/utils/components.utils.js +21 -23
- package/dist/collection/utils/locale.utils.js +14 -14
- package/dist/collection/utils/unit.test.utils.js +7 -10
- package/dist/components/MgInput.js +30 -18
- package/dist/components/components.utils.js +21 -23
- package/dist/components/index2.js +16 -16
- package/dist/components/mg-action-more.js +9 -13
- package/dist/components/mg-badge2.js +8 -9
- package/dist/components/mg-button2.js +16 -20
- package/dist/components/mg-card2.js +8 -10
- package/dist/components/mg-character-left2.js +1 -2
- package/dist/components/mg-details.js +1 -3
- package/dist/components/mg-divider.js +1 -1
- package/dist/components/mg-form.js +7 -15
- package/dist/components/mg-icon2.js +17 -19
- package/dist/components/mg-illustrated-message.js +1 -2
- package/dist/components/mg-input-checkbox.js +9 -10
- package/dist/components/mg-input-date.js +6 -8
- package/dist/components/mg-input-numeric.js +13 -18
- package/dist/components/mg-input-password.js +5 -6
- package/dist/components/mg-input-radio.js +9 -14
- package/dist/components/mg-input-select2.js +20 -28
- package/dist/components/mg-input-text2.js +14 -23
- package/dist/components/mg-input-textarea.js +12 -13
- package/dist/components/mg-input-title2.js +1 -2
- package/dist/components/mg-input-toggle.js +16 -19
- package/dist/components/mg-item-more.js +18 -27
- package/dist/components/mg-menu-item2.js +17 -26
- package/dist/components/mg-menu2.js +9 -16
- package/dist/components/mg-message.js +11 -14
- package/dist/components/mg-modal.js +7 -11
- package/dist/components/mg-pagination.js +11 -13
- package/dist/components/mg-panel.js +6 -15
- package/dist/components/mg-popover2.js +7 -13
- package/dist/components/mg-skip-links.js +2 -4
- package/dist/components/mg-tabs.js +20 -24
- package/dist/components/mg-tag.js +11 -13
- package/dist/components/mg-tooltip2.js +11 -21
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +318 -427
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +19 -28
- package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-9ca023ee.js} +16 -16
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-a56a3157.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 -3
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -21
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -6
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
- 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 -13
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -9
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
- package/dist/types/components.d.ts +22 -34
- package/dist/types/locales/index.d.ts +2 -2
- package/dist/types/utils/behaviors.utils.d.ts +14 -20
- package/dist/types/utils/components.utils.d.ts +18 -20
- package/dist/types/utils/locale.utils.d.ts +14 -14
- package/dist/types/utils/unit.test.utils.d.ts +11 -17
- package/package.json +1 -1
- package/dist/mg-components/p-eb32bb18.entry.js +0 -1
- /package/dist/mg-components/{p-73156ac9.js → p-0d3146d9.js} +0 -0
|
@@ -19,9 +19,8 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
19
19
|
*************/
|
|
20
20
|
/**
|
|
21
21
|
* Close matching menu-item
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @returns {void}
|
|
22
|
+
* @param item - menu-item to close
|
|
23
|
+
* @param condition - addionnal condition
|
|
25
24
|
*/
|
|
26
25
|
this.closeMenuItem = (item, condition) => {
|
|
27
26
|
if (!this.isChildMenu && condition) {
|
|
@@ -30,19 +29,18 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
30
29
|
};
|
|
31
30
|
/**
|
|
32
31
|
* get mg-item-more element
|
|
33
|
-
* @returns
|
|
32
|
+
* @returns mg-item-more element
|
|
34
33
|
*/
|
|
35
34
|
this.getItemMore = () => this.element.querySelector('mg-item-more');
|
|
36
35
|
/**
|
|
37
|
-
* get mg-item-more
|
|
38
|
-
* @returns
|
|
36
|
+
* get mg-item-more child mg-menu-item element
|
|
37
|
+
* @returns mg-menu-item element
|
|
39
38
|
*/
|
|
40
39
|
this.getItemMoreMenuItem = () => { var _a, _b; return (_b = (_a = this.getItemMore()) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item'); };
|
|
41
40
|
/**
|
|
42
41
|
* Set item listend
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @returns {void}
|
|
42
|
+
* @param item - mg-menu-item element
|
|
43
|
+
* @param index - number
|
|
46
44
|
*/
|
|
47
45
|
this.setItemListener = (item, index) => {
|
|
48
46
|
['click', 'focus'].forEach(trigger => {
|
|
@@ -57,7 +55,6 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
57
55
|
};
|
|
58
56
|
/**
|
|
59
57
|
* Store menu-items on component init and add listeners
|
|
60
|
-
* @returns {void}
|
|
61
58
|
*/
|
|
62
59
|
this.initMenuItemsListeners = () => {
|
|
63
60
|
// add listeners on menu item and edit index
|
|
@@ -67,14 +64,12 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
67
64
|
};
|
|
68
65
|
/**
|
|
69
66
|
* Handle item-loaded event on mg-item-more element
|
|
70
|
-
* @returns {void}
|
|
71
67
|
*/
|
|
72
68
|
this.handleItemLoaded = () => {
|
|
73
69
|
this.setItemListener(this.getItemMoreMenuItem(), this.menuItems.length);
|
|
74
70
|
};
|
|
75
71
|
/**
|
|
76
72
|
* render mg-item-more
|
|
77
|
-
* @returns {void}
|
|
78
73
|
*/
|
|
79
74
|
this.renderMgItemMore = () => {
|
|
80
75
|
// /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
|
|
@@ -116,7 +111,6 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
116
111
|
*************/
|
|
117
112
|
/**
|
|
118
113
|
* Validate props
|
|
119
|
-
* @returns {void}
|
|
120
114
|
*/
|
|
121
115
|
componentWillLoad() {
|
|
122
116
|
this.validateDirection(this.direction);
|
|
@@ -126,7 +120,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
126
120
|
}
|
|
127
121
|
/**
|
|
128
122
|
* Check if component slots configuration
|
|
129
|
-
* @returns
|
|
123
|
+
* @returns timeout
|
|
130
124
|
*/
|
|
131
125
|
componentDidLoad() {
|
|
132
126
|
// update props and states after componentDidLoad hook
|
|
@@ -156,14 +150,13 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
156
150
|
}
|
|
157
151
|
/**
|
|
158
152
|
* Add listeners to items
|
|
159
|
-
* @returns {void}
|
|
160
153
|
*/
|
|
161
154
|
componentDidRender() {
|
|
162
155
|
this.initMenuItemsListeners();
|
|
163
156
|
}
|
|
164
157
|
/**
|
|
165
158
|
* Render
|
|
166
|
-
* @returns
|
|
159
|
+
* @returns HTML Element
|
|
167
160
|
*/
|
|
168
161
|
render() {
|
|
169
162
|
return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
|
|
@@ -33,22 +33,19 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
33
|
this.isHovered = false;
|
|
34
34
|
/**
|
|
35
35
|
* Set timer
|
|
36
|
-
* @returns {void}
|
|
37
36
|
*/
|
|
38
37
|
this.setTimer = () => {
|
|
39
38
|
this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
|
|
40
39
|
};
|
|
41
40
|
/**
|
|
42
41
|
* Clear timer
|
|
43
|
-
* @returns {void}
|
|
44
42
|
*/
|
|
45
43
|
this.clearTimer = () => {
|
|
46
44
|
clearTimeout(this.storedTimer);
|
|
47
45
|
};
|
|
48
46
|
/**
|
|
49
47
|
* Event to add on element
|
|
50
|
-
* @param
|
|
51
|
-
* @returns {void}
|
|
48
|
+
* @param event - event
|
|
52
49
|
*/
|
|
53
50
|
this.timerEvents = (event) => {
|
|
54
51
|
this.clearTimer();
|
|
@@ -71,7 +68,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
71
68
|
};
|
|
72
69
|
/**
|
|
73
70
|
* Get icon corresponding to variant
|
|
74
|
-
* @returns
|
|
71
|
+
* @returns icon
|
|
75
72
|
*/
|
|
76
73
|
this.getIcon = () => {
|
|
77
74
|
switch (this.variant) {
|
|
@@ -90,7 +87,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
90
87
|
this.variant = variants[0];
|
|
91
88
|
this.closeButton = false;
|
|
92
89
|
this.hide = false;
|
|
93
|
-
this.
|
|
90
|
+
this.classCollection = new ClassList(['mg-message']);
|
|
94
91
|
this.hasActions = false;
|
|
95
92
|
}
|
|
96
93
|
validateDelay(newValue) {
|
|
@@ -104,9 +101,9 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
104
101
|
}
|
|
105
102
|
else {
|
|
106
103
|
if (oldValue !== undefined) {
|
|
107
|
-
this.
|
|
104
|
+
this.classCollection.delete(`mg-message--${oldValue}`);
|
|
108
105
|
}
|
|
109
|
-
this.
|
|
106
|
+
this.classCollection.add(`mg-message--${newValue}`);
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
validateCloseButton(newValue) {
|
|
@@ -118,7 +115,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
118
115
|
validateHide(newValue) {
|
|
119
116
|
if (newValue) {
|
|
120
117
|
this.componentHide.emit();
|
|
121
|
-
this.
|
|
118
|
+
this.classCollection.add(this.classHide);
|
|
122
119
|
// Remove event Listener
|
|
123
120
|
['focusin', 'mouseenter'].forEach(event => {
|
|
124
121
|
this.element.removeEventListener(event, this.timerEvents);
|
|
@@ -128,7 +125,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
125
|
}
|
|
129
126
|
else {
|
|
130
127
|
this.componentShow.emit();
|
|
131
|
-
this.
|
|
128
|
+
this.classCollection.delete(this.classHide);
|
|
132
129
|
// If delay is set
|
|
133
130
|
if (this.delay > 1) {
|
|
134
131
|
// Start timer
|
|
@@ -155,7 +152,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
155
152
|
this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
|
|
156
153
|
this.validateCloseButton(this.closeButton);
|
|
157
154
|
if (this.closeButton) {
|
|
158
|
-
this.
|
|
155
|
+
this.classCollection.add('mg-message--close-button');
|
|
159
156
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
160
157
|
}
|
|
161
158
|
this.validateDelay(this.delay);
|
|
@@ -163,10 +160,10 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
163
160
|
}
|
|
164
161
|
/**
|
|
165
162
|
* Render
|
|
166
|
-
* @returns
|
|
163
|
+
* @returns HTML Element
|
|
167
164
|
*/
|
|
168
165
|
render() {
|
|
169
|
-
return (h("div", { id: this.identifier, class: this.
|
|
166
|
+
return (h("div", { id: this.identifier, class: this.classCollection.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card", { variant: this.variant, "variant-style": "bar-left" }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))))));
|
|
170
167
|
}
|
|
171
168
|
get element() { return this; }
|
|
172
169
|
static get watchers() { return {
|
|
@@ -182,7 +179,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
182
179
|
"variant": [1],
|
|
183
180
|
"closeButton": [1028, "close-button"],
|
|
184
181
|
"hide": [1028],
|
|
185
|
-
"
|
|
182
|
+
"classCollection": [32],
|
|
186
183
|
"hasActions": [32]
|
|
187
184
|
}]);
|
|
188
185
|
function defineCustomElement$1() {
|
|
@@ -55,7 +55,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
55
55
|
*************/
|
|
56
56
|
/**
|
|
57
57
|
* Handle close button
|
|
58
|
-
* @returns {void}
|
|
59
58
|
*/
|
|
60
59
|
this.handleClose = () => {
|
|
61
60
|
this.hide = true;
|
|
@@ -66,7 +65,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
66
65
|
this.hide = false;
|
|
67
66
|
this.hasActions = false;
|
|
68
67
|
this.hasContent = false;
|
|
69
|
-
this.
|
|
68
|
+
this.classCollection = new ClassList(['mg-modal']);
|
|
70
69
|
}
|
|
71
70
|
validateModalTitle(newValue) {
|
|
72
71
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -76,19 +75,18 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
76
75
|
validateHide(newValue) {
|
|
77
76
|
if (newValue) {
|
|
78
77
|
this.componentHide.emit();
|
|
79
|
-
this.
|
|
78
|
+
this.classCollection.add(this.classHide);
|
|
80
79
|
document.body.style.overflow = this.bodyOverflow;
|
|
81
80
|
}
|
|
82
81
|
else {
|
|
83
82
|
this.componentShow.emit();
|
|
84
|
-
this.
|
|
83
|
+
this.classCollection.delete(this.classHide);
|
|
85
84
|
document.body.style.overflow = 'hidden';
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
/**
|
|
89
88
|
* Handle 'escape' key down
|
|
90
|
-
* @param
|
|
91
|
-
* @returns {void}
|
|
89
|
+
* @param event - keydown event
|
|
92
90
|
*/
|
|
93
91
|
handleKeyDown(event) {
|
|
94
92
|
// we can use 'Escape button" when this not a blocking modal, induced by closeButton value.
|
|
@@ -101,7 +99,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
101
99
|
*************/
|
|
102
100
|
/**
|
|
103
101
|
* Check if component props are well configured on init
|
|
104
|
-
* @returns {void}
|
|
105
102
|
*/
|
|
106
103
|
componentWillLoad() {
|
|
107
104
|
// Store body overflow
|
|
@@ -120,7 +117,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
120
117
|
}
|
|
121
118
|
/**
|
|
122
119
|
* Add observer on component to set focus when displayed
|
|
123
|
-
* @returns {void}
|
|
124
120
|
*/
|
|
125
121
|
componentDidLoad() {
|
|
126
122
|
new MutationObserver(mutationList => {
|
|
@@ -135,10 +131,10 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
135
131
|
}
|
|
136
132
|
/**
|
|
137
133
|
* Render
|
|
138
|
-
* @returns
|
|
134
|
+
* @returns HTML Element
|
|
139
135
|
*/
|
|
140
136
|
render() {
|
|
141
|
-
return (h("div", { role: "alertdialog", id: this.identifier, class: this.
|
|
137
|
+
return (h("div", { role: "alertdialog", id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" })))))));
|
|
142
138
|
}
|
|
143
139
|
get element() { return this; }
|
|
144
140
|
static get watchers() { return {
|
|
@@ -153,7 +149,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
153
149
|
"hide": [1028],
|
|
154
150
|
"hasActions": [32],
|
|
155
151
|
"hasContent": [32],
|
|
156
|
-
"
|
|
152
|
+
"classCollection": [32]
|
|
157
153
|
}, [[8, "keydown", "handleKeyDown"]]]);
|
|
158
154
|
function defineCustomElement$1() {
|
|
159
155
|
if (typeof customElements === "undefined") {
|
|
@@ -18,6 +18,7 @@ const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
|
|
|
18
18
|
/**
|
|
19
19
|
* Range generator
|
|
20
20
|
*
|
|
21
|
+
* ```
|
|
21
22
|
* start by get the range length, add "+ 1" to include last value, ex: Math.ceil((3 + 1 - 1) / 1) => 3
|
|
22
23
|
* then with Array(Math.ceil...) we get the final array with empty values, ex: Array(Math.ceil(2 + 1 - 1) / 1)) => [empty, empty, empty]
|
|
23
24
|
* then with Array(Math.ceil...).keys() we get the Array Iterator from empty values
|
|
@@ -25,14 +26,15 @@ const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
|
|
|
25
26
|
* ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()) => [0, 1, 2]
|
|
26
27
|
* finaly we map values from "start" range and apply the "step" coefficiant,
|
|
27
28
|
* ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()).map(x => 1 + x * 1) => [1, 2, 3]
|
|
29
|
+
* ```
|
|
28
30
|
*
|
|
29
31
|
* range(1, 1) = [1]
|
|
30
32
|
* range(1, 5) = [1, 2, 3, 4, 5]
|
|
31
33
|
* range(10, 20, 2) = [10, 12, 14, 16, 18, 20]
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @returns
|
|
34
|
+
* @param start - start range
|
|
35
|
+
* @param end - start end
|
|
36
|
+
* @param step - step size
|
|
37
|
+
* @returns range numbers
|
|
36
38
|
*/
|
|
37
39
|
const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
|
|
38
40
|
const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -43,8 +45,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
43
45
|
this.currentPageChange = createEvent(this, "current-page-change", 7);
|
|
44
46
|
/**
|
|
45
47
|
* Change current page from target
|
|
46
|
-
* @param
|
|
47
|
-
* @returns {void}
|
|
48
|
+
* @param target - target page
|
|
48
49
|
*/
|
|
49
50
|
this.goToPage = (target) => {
|
|
50
51
|
this.currentPage = target;
|
|
@@ -54,8 +55,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
54
55
|
************/
|
|
55
56
|
/**
|
|
56
57
|
* select handler
|
|
57
|
-
* @param
|
|
58
|
-
* @returns {void}
|
|
58
|
+
* @param event - value change event
|
|
59
59
|
*/
|
|
60
60
|
this.handleSelect = (event) => {
|
|
61
61
|
const to = Number(event.target.value);
|
|
@@ -63,9 +63,8 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* Go to 'previous/next' page button handler
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @returns {void}
|
|
66
|
+
* @param action - navigation action
|
|
67
|
+
* @param disabled - button disable state
|
|
69
68
|
*/
|
|
70
69
|
this.handleGoToPage = (action, disabled) => {
|
|
71
70
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
@@ -95,7 +94,6 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
95
94
|
*************/
|
|
96
95
|
/**
|
|
97
96
|
* Check if props are well configured on init
|
|
98
|
-
* @returns {void}
|
|
99
97
|
*/
|
|
100
98
|
componentWillLoad() {
|
|
101
99
|
// Get locales
|
|
@@ -110,7 +108,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
110
108
|
}
|
|
111
109
|
/**
|
|
112
110
|
* Render
|
|
113
|
-
* @returns
|
|
111
|
+
* @returns HTML Element
|
|
114
112
|
*/
|
|
115
113
|
render() {
|
|
116
114
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
@@ -23,7 +23,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
23
23
|
************/
|
|
24
24
|
/**
|
|
25
25
|
* Toggle is editing state
|
|
26
|
-
* @returns {void}
|
|
27
26
|
*/
|
|
28
27
|
this.toggleIsEditing = () => {
|
|
29
28
|
this.isEditing = !this.isEditing;
|
|
@@ -33,7 +32,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
32
|
************/
|
|
34
33
|
/**
|
|
35
34
|
* Collapse button click handler
|
|
36
|
-
* @returns {void}
|
|
37
35
|
*/
|
|
38
36
|
this.handleCollapseButton = () => {
|
|
39
37
|
if (!this.expandToggleDisabled) {
|
|
@@ -42,22 +40,19 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
42
40
|
};
|
|
43
41
|
/**
|
|
44
42
|
* Edit button click handler
|
|
45
|
-
* @returns {void}
|
|
46
43
|
*/
|
|
47
44
|
this.handleEditButton = () => {
|
|
48
45
|
this.toggleIsEditing();
|
|
49
46
|
};
|
|
50
47
|
/**
|
|
51
48
|
* Update title handler
|
|
52
|
-
* @param
|
|
53
|
-
* @returns {void}
|
|
49
|
+
* @param event - input value change event
|
|
54
50
|
*/
|
|
55
51
|
this.handleUpdateTitle = (event) => {
|
|
56
52
|
this.updatedPanelTitle = event.detail;
|
|
57
53
|
};
|
|
58
54
|
/**
|
|
59
55
|
* Cancel edition button handler
|
|
60
|
-
* @returns {void}
|
|
61
56
|
*/
|
|
62
57
|
this.handleCancelEditButton = () => {
|
|
63
58
|
this.updatedPanelTitle = undefined;
|
|
@@ -65,7 +60,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
65
60
|
};
|
|
66
61
|
/**
|
|
67
62
|
* Validate edition button handler
|
|
68
|
-
* @returns {void}
|
|
69
63
|
*/
|
|
70
64
|
this.handleValidateEditButton = () => {
|
|
71
65
|
if (this.editInputElement.valid) {
|
|
@@ -76,8 +70,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
76
70
|
};
|
|
77
71
|
/**
|
|
78
72
|
* Header left conditional render
|
|
79
|
-
* @
|
|
80
|
-
* @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
|
|
73
|
+
* @returns header left element
|
|
81
74
|
*/
|
|
82
75
|
this.headerLeft = () => {
|
|
83
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)));
|
|
@@ -102,7 +95,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
102
95
|
this.expanded = false;
|
|
103
96
|
this.expandToggleDisabled = undefined;
|
|
104
97
|
this.titleEditable = false;
|
|
105
|
-
this.
|
|
98
|
+
this.classCollection = new ClassList(['mg-panel']);
|
|
106
99
|
this.isEditing = false;
|
|
107
100
|
this.updatedPanelTitle = undefined;
|
|
108
101
|
}
|
|
@@ -128,7 +121,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
121
|
*************/
|
|
129
122
|
/**
|
|
130
123
|
* Check if props are well configured on init
|
|
131
|
-
* @returns {void}
|
|
132
124
|
*/
|
|
133
125
|
componentWillLoad() {
|
|
134
126
|
// Get locales
|
|
@@ -139,7 +131,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
139
131
|
}
|
|
140
132
|
/**
|
|
141
133
|
* Edit DOM after render
|
|
142
|
-
* @returns {void}
|
|
143
134
|
*/
|
|
144
135
|
componentDidRender() {
|
|
145
136
|
// when we are editing we get focus on edition input
|
|
@@ -149,10 +140,10 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
149
140
|
}
|
|
150
141
|
/**
|
|
151
142
|
* Render component
|
|
152
|
-
* @returns
|
|
143
|
+
* @returns html element
|
|
153
144
|
*/
|
|
154
145
|
render() {
|
|
155
|
-
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)))));
|
|
156
147
|
}
|
|
157
148
|
get element() { return this; }
|
|
158
149
|
static get watchers() { return {
|
|
@@ -169,7 +160,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
169
160
|
"expanded": [1028],
|
|
170
161
|
"expandToggleDisabled": [4, "expand-toggle-disabled"],
|
|
171
162
|
"titleEditable": [4, "title-editable"],
|
|
172
|
-
"
|
|
163
|
+
"classCollection": [32],
|
|
173
164
|
"isEditing": [32],
|
|
174
165
|
"updatedPanelTitle": [32]
|
|
175
166
|
}]);
|
|
@@ -19,8 +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
|
-
* @param
|
|
23
|
-
* @returns {void}
|
|
22
|
+
* @param event - mouse event
|
|
24
23
|
*/
|
|
25
24
|
this.clickOutside = (event) => {
|
|
26
25
|
var _a;
|
|
@@ -32,7 +31,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
32
31
|
};
|
|
33
32
|
/**
|
|
34
33
|
* Show popover
|
|
35
|
-
* @returns {void}
|
|
36
34
|
*/
|
|
37
35
|
this.show = () => {
|
|
38
36
|
// Make the popover visible
|
|
@@ -51,7 +49,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
51
49
|
};
|
|
52
50
|
/**
|
|
53
51
|
* Hide popover
|
|
54
|
-
* @returns {void}
|
|
55
52
|
*/
|
|
56
53
|
this.hide = () => {
|
|
57
54
|
// Hide the popover
|
|
@@ -65,7 +62,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
65
62
|
};
|
|
66
63
|
/**
|
|
67
64
|
* Handle action for close button
|
|
68
|
-
* @returns {void}
|
|
69
65
|
*/
|
|
70
66
|
this.handleCloseButton = () => {
|
|
71
67
|
this.display = false;
|
|
@@ -76,13 +72,13 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
76
72
|
this.closeButton = false;
|
|
77
73
|
this.display = false;
|
|
78
74
|
this.disabled = false;
|
|
79
|
-
this.
|
|
75
|
+
this.classCollection = new ClassList(['mg-popover']);
|
|
80
76
|
}
|
|
81
77
|
validateArrowHide(newValue) {
|
|
82
78
|
if (newValue)
|
|
83
|
-
this.
|
|
79
|
+
this.classCollection.add(this.classArrowHide);
|
|
84
80
|
else
|
|
85
|
-
this.
|
|
81
|
+
this.classCollection.delete(this.classArrowHide);
|
|
86
82
|
}
|
|
87
83
|
handleDisplay(newValue) {
|
|
88
84
|
if (newValue) {
|
|
@@ -98,7 +94,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
98
94
|
*************/
|
|
99
95
|
/**
|
|
100
96
|
* Check if component props are well configured on init
|
|
101
|
-
* @returns {void} timeout
|
|
102
97
|
*/
|
|
103
98
|
componentWillLoad() {
|
|
104
99
|
// Get windows to attach events
|
|
@@ -109,7 +104,6 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
109
104
|
}
|
|
110
105
|
/**
|
|
111
106
|
* Check if component props are well configured on init
|
|
112
|
-
* @returns {void}
|
|
113
107
|
*/
|
|
114
108
|
componentDidLoad() {
|
|
115
109
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
@@ -166,10 +160,10 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
166
160
|
}
|
|
167
161
|
/**
|
|
168
162
|
* Render
|
|
169
|
-
* @returns
|
|
163
|
+
* @returns HTML Element
|
|
170
164
|
*/
|
|
171
165
|
render() {
|
|
172
|
-
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 }))));
|
|
173
167
|
}
|
|
174
168
|
get element() { return this; }
|
|
175
169
|
static get watchers() { return {
|
|
@@ -184,7 +178,7 @@ const MgPopover = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
184
178
|
"closeButton": [4, "close-button"],
|
|
185
179
|
"display": [1028],
|
|
186
180
|
"disabled": [4],
|
|
187
|
-
"
|
|
181
|
+
"classCollection": [32]
|
|
188
182
|
}]);
|
|
189
183
|
function defineCustomElement() {
|
|
190
184
|
if (typeof customElements === "undefined") {
|
|
@@ -14,8 +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
|
-
* @param
|
|
18
|
-
* @returns {void}
|
|
17
|
+
* @param event - mouse event
|
|
19
18
|
*/
|
|
20
19
|
this.handleLinkCLick = (event) => {
|
|
21
20
|
event.currentTarget.blur();
|
|
@@ -35,7 +34,6 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
35
34
|
*************/
|
|
36
35
|
/**
|
|
37
36
|
* Check if props are well configured on init
|
|
38
|
-
* @returns {void}
|
|
39
37
|
*/
|
|
40
38
|
componentWillLoad() {
|
|
41
39
|
this.validateLinks(this.links);
|
|
@@ -43,7 +41,7 @@ const MgSkipLinks$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
43
41
|
}
|
|
44
42
|
/**
|
|
45
43
|
* Render
|
|
46
|
-
* @returns
|
|
44
|
+
* @returns HTML Element
|
|
47
45
|
*/
|
|
48
46
|
render() {
|
|
49
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)))))));
|