@mgdis/mg-components 6.23.0 → 6.25.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/index-Acmyl4hv.js +5 -0
- package/dist/cjs/{index-BxB20_Vw.js → index-B6J2EllP.js} +3 -1
- package/dist/cjs/{index-BEF-cqV9.js → index-BmFwLEZT.js} +5 -1
- package/dist/cjs/{index-CpENFzEo.js → index-DrZECzp6.js} +14 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +394 -260
- package/dist/cjs/mg-alert.cjs.entry.js +7 -8
- package/dist/cjs/mg-breadcrumb.cjs.entry.js +27 -10
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-fieldset.cjs.entry.js +8 -8
- package/dist/cjs/mg-illustration.cjs.entry.js +57 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js +46 -28
- package/dist/cjs/mg-input-file.cjs.entry.js +12 -11
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +3367 -4140
- package/dist/cjs/mg-loader.cjs.entry.js +5 -5
- package/dist/cjs/mg-progress.cjs.entry.js +3 -3
- package/dist/collection/assets/illustrations/index.js +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
- package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +4 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.conf.js +4 -0
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +62 -3
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/atoms/mg-illustration/mg-illustration.conf.js +1 -0
- package/dist/collection/components/atoms/mg-illustration/mg-illustration.js +95 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -7
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +49 -19
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +5 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxPaginated.js +5 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +30 -22
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +75 -30
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +14 -8
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +8 -7
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +21 -12
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +7 -7
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +15 -10
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +29 -3
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +260 -7
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -19
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +18 -13
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +7 -7
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +10 -9
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +7 -5
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +18 -17
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +7 -4
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +6 -7
- package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +49 -6
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +6 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js +16 -13
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +2 -2
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +8 -4
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +13 -4
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +29 -37
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -3
- package/dist/collection/components/molecules/mg-table/mg-table.js +10 -6
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +12 -9
- package/dist/collection/utils/behaviors.utils.js +3 -3
- package/dist/collection/utils/playwright.fixture.js +7 -2
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-alert.js +1 -1
- package/dist/components/mg-badge2.js +1 -1
- package/dist/components/mg-breadcrumb.js +1 -1
- package/dist/components/mg-button2.js +1 -1
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-character-left2.js +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-divider2.js +1 -1
- package/dist/components/mg-fieldset.js +1 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-icon2.js +1 -1
- package/dist/components/mg-illustrated-message.js +1 -1
- package/dist/components/mg-illustration.d.ts +11 -0
- package/dist/components/mg-illustration.js +1 -0
- package/dist/components/mg-input-checkbox.js +1 -1
- package/dist/components/mg-input-combobox.js +1 -1
- package/dist/components/mg-input-date.js +1 -1
- package/dist/components/mg-input-file.js +1 -1
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +1 -1
- package/dist/components/mg-input-rich-text-editor.js +298 -289
- package/dist/components/mg-input-select2.js +1 -1
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +1 -1
- package/dist/components/mg-input-title2.js +1 -1
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-input2.js +1 -1
- package/dist/components/mg-item-more2.js +1 -1
- package/dist/components/mg-loader2.js +1 -1
- package/dist/components/mg-menu-item2.js +1 -1
- package/dist/components/mg-message2.js +1 -1
- package/dist/components/mg-modal.js +1 -1
- package/dist/components/mg-pagination.js +1 -1
- package/dist/components/mg-panel.js +1 -1
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover2.js +1 -1
- package/dist/components/mg-progress.js +1 -1
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-table.js +1 -1
- package/dist/components/mg-tabs2.js +1 -1
- package/dist/components/mg-tag.js +1 -1
- package/dist/components/mg-tooltip-content2.js +1 -1
- package/dist/components/mg-tooltip2.js +1 -1
- package/dist/custom-elements.json +178 -48
- package/dist/esm/{index-C7xjtdiw.js → index-91BOpzAB.js} +14 -6
- package/dist/esm/{index-DSEloqPn.js → index-BfblyCaJ.js} +3 -1
- package/dist/esm/index-Ci9Hv7DG.js +3 -0
- package/dist/esm/{index-DshvCiTL.js → index-D4bO_UCn.js} +5 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +391 -257
- package/dist/esm/mg-alert.entry.js +7 -8
- package/dist/esm/mg-breadcrumb.entry.js +27 -10
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-fieldset.entry.js +8 -8
- package/dist/esm/mg-illustration.entry.js +55 -0
- package/dist/esm/mg-input-combobox.entry.js +46 -28
- package/dist/esm/mg-input-file.entry.js +12 -11
- package/dist/esm/mg-input-rich-text-editor.entry.js +3352 -4125
- package/dist/esm/mg-loader.entry.js +5 -5
- package/dist/esm/mg-progress.entry.js +3 -3
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-cdb01923.entry.js → p-3ad7441c.entry.js} +1 -1
- package/dist/mg-components/p-413b4536.entry.js +1 -0
- package/dist/mg-components/p-4693077a.entry.js +1 -0
- package/dist/mg-components/p-5dff879a.entry.js +1 -0
- package/dist/mg-components/{p-236bb1d2.entry.js → p-96fc508e.entry.js} +1 -1
- package/dist/mg-components/p-Ci9Hv7DG.js +1 -0
- package/dist/mg-components/p-D4bO_UCn.js +2 -0
- package/dist/mg-components/{p-d0b6d8f5.entry.js → p-ad533d08.entry.js} +1 -1
- package/dist/mg-components/p-b20f3698.entry.js +1 -0
- package/dist/mg-components/p-d0d12800.entry.js +1 -0
- package/dist/mg-components/p-ec4bd337.entry.js +1667 -0
- package/dist/mg-components/p-f8e58181.entry.js +1 -0
- package/dist/types/assets/illustrations/index.d.ts +21 -0
- package/dist/types/components/atoms/mg-divider/mg-divider.conf.d.ts +9 -0
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +13 -0
- package/dist/types/components/atoms/mg-illustration/mg-illustration.conf.d.ts +5 -0
- package/dist/types/components/atoms/mg-illustration/mg-illustration.d.ts +24 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +18 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +10 -5
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +25 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +61 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -2
- package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +2 -2
- package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +2 -2
- package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +11 -0
- package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +1 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -3
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +1 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -1
- package/dist/types/components.d.ts +145 -40
- package/ide/intellij/web-types.json +134 -64
- package/ide/vscode/css-custom-data.json +6 -2
- package/ide/vscode/html-custom-data.json +190 -32
- package/package.json +22 -22
- package/dist/mg-components/p-13feb37a.entry.js +0 -1
- package/dist/mg-components/p-79265ad3.entry.js +0 -1
- package/dist/mg-components/p-7c63e469.entry.js +0 -1
- package/dist/mg-components/p-7fd3e519.entry.js +0 -1
- package/dist/mg-components/p-DshvCiTL.js +0 -2
- package/dist/mg-components/p-a0e2c886.entry.js +0 -1
- package/dist/mg-components/p-d698fa67.entry.js +0 -1658
- /package/dist/mg-components/{p-C7xjtdiw.js → p-91BOpzAB.js} +0 -0
- /package/dist/mg-components/{p-DSEloqPn.js → p-BfblyCaJ.js} +0 -0
|
@@ -54,17 +54,20 @@ export class MgForm {
|
|
|
54
54
|
}
|
|
55
55
|
// If the form is disabled or readonly none of them are required
|
|
56
56
|
// Check if all fields are not editable (readonly or disabled)
|
|
57
|
-
const isEditable = input => !(input.disabled || input.readonly);
|
|
58
|
-
const isMgInputToggle = input => input.nodeName === 'MG-INPUT-TOGGLE';
|
|
59
|
-
if (!this.disabled &&
|
|
57
|
+
const isEditable = (input) => !(input.disabled || input.readonly);
|
|
58
|
+
const isMgInputToggle = (input) => input.nodeName === 'MG-INPUT-TOGGLE';
|
|
59
|
+
if (!this.disabled &&
|
|
60
|
+
!this.readonly &&
|
|
61
|
+
this.mgInputs.some((input) => isEditable(input) && !isMgInputToggle(input))) {
|
|
60
62
|
// Get editable inputs
|
|
61
63
|
const editableInputs = this.mgInputs.filter(isEditable);
|
|
62
64
|
// Get required inputs
|
|
63
65
|
// mg-input-toggle can not be required
|
|
64
|
-
const requiredInputs = editableInputs.filter(input => !isMgInputToggle(input) && input.required);
|
|
66
|
+
const requiredInputs = editableInputs.filter((input) => !isMgInputToggle(input) && input.required);
|
|
65
67
|
// All inputs are required
|
|
66
|
-
if ([requiredInputs.length, editableInputs.length].every(length => length === 1) ||
|
|
67
|
-
(requiredInputs.length > 1 &&
|
|
68
|
+
if ([requiredInputs.length, editableInputs.length].every((length) => length === 1) ||
|
|
69
|
+
(requiredInputs.length > 1 &&
|
|
70
|
+
requiredInputs.length === editableInputs.filter((input) => !isMgInputToggle(input)).length)) {
|
|
68
71
|
this.requiredMessageText = this.getRequiredMessageBasedOnCount(requiredInputs, 'allRequiredSingle', 'allRequired');
|
|
69
72
|
this.classCollection.add(this.classAllRequired);
|
|
70
73
|
}
|
|
@@ -88,7 +91,7 @@ export class MgForm {
|
|
|
88
91
|
this.checkValidity = () => {
|
|
89
92
|
// Update required on input event
|
|
90
93
|
this.setRequiredMessage();
|
|
91
|
-
this.valid = !this.mgInputs.some(input => input.invalid);
|
|
94
|
+
this.valid = !this.mgInputs.some((input) => input.invalid);
|
|
92
95
|
this.invalid = !this.valid;
|
|
93
96
|
// We need to send valid event if it is the same value
|
|
94
97
|
this.formValid.emit(this.valid);
|
|
@@ -109,7 +112,7 @@ export class MgForm {
|
|
|
109
112
|
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT'));
|
|
110
113
|
// Set inputs readonly or disabled based on form configuration
|
|
111
114
|
// Othewise listen to events
|
|
112
|
-
this.mgInputs.forEach(input => {
|
|
115
|
+
this.mgInputs.forEach((input) => {
|
|
113
116
|
if (this.labelOnTop) {
|
|
114
117
|
input.labelOnTop = true;
|
|
115
118
|
}
|
|
@@ -167,7 +170,7 @@ export class MgForm {
|
|
|
167
170
|
async displayError() {
|
|
168
171
|
if (!this.readonly) {
|
|
169
172
|
const mgFieldsets = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-FIELDSET'));
|
|
170
|
-
[...mgFieldsets, ...this.mgInputs].forEach(input => {
|
|
173
|
+
[...mgFieldsets, ...this.mgInputs].forEach((input) => {
|
|
171
174
|
var _a;
|
|
172
175
|
(_a = input.displayError) === null || _a === void 0 ? void 0 : _a.call(input);
|
|
173
176
|
});
|
|
@@ -205,7 +208,7 @@ export class MgForm {
|
|
|
205
208
|
// Get slotted mgButtons
|
|
206
209
|
this.mgButtons = Array.from(this.element.querySelectorAll('mg-button'));
|
|
207
210
|
// Set button form identifier
|
|
208
|
-
this.mgButtons.forEach(mgButton => {
|
|
211
|
+
this.mgButtons.forEach((mgButton) => {
|
|
209
212
|
mgButton.setAttribute('form', this.identifier);
|
|
210
213
|
if (mgButton.type === 'reset') {
|
|
211
214
|
mgButton.addEventListener('click', () => {
|
|
@@ -232,8 +235,8 @@ export class MgForm {
|
|
|
232
235
|
componentDidLoad() {
|
|
233
236
|
// Update mgInputs when mgForm content change
|
|
234
237
|
const observerOptions = { childList: true, subtree: true };
|
|
235
|
-
new MutationObserver(mutations => {
|
|
236
|
-
if (mutations.some(mutation => Object.keys(observerOptions).includes(mutation.type))) {
|
|
238
|
+
new MutationObserver((mutations) => {
|
|
239
|
+
if (mutations.some((mutation) => Object.keys(observerOptions).includes(mutation.type))) {
|
|
237
240
|
this.setMgInputs();
|
|
238
241
|
this.checkValidity();
|
|
239
242
|
}
|
|
@@ -244,7 +247,7 @@ export class MgForm {
|
|
|
244
247
|
* @returns HTML Element
|
|
245
248
|
*/
|
|
246
249
|
render() {
|
|
247
|
-
return (h("form", { key: '
|
|
250
|
+
return (h("form", { key: '65d3e11931386af2dedd953f58505e2c71cd99ff', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: '7546db3b8a4259fd7d092cc7b912b6593fab9d84', innerHTML: this.requiredMessageText }), h("slot", { key: '0023ed360230ea97395a249b230e02bb7a4bdbda' }), !this.readonly && !this.disabled && h("slot", { key: 'de84e088ff029eff487be1ed8b4766425c558c29', name: "actions" })));
|
|
248
251
|
}
|
|
249
252
|
static get is() { return "mg-form"; }
|
|
250
253
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { ClassList, isTagName, toString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
|
-
import { directions, sizes } from "./mg-illustrated-message.conf";
|
|
3
|
+
import { directions, sizes, } from "./mg-illustrated-message.conf";
|
|
4
4
|
/**
|
|
5
5
|
* @slot illustration - Illustration content
|
|
6
6
|
* @slot title - Title content
|
|
@@ -81,7 +81,7 @@ export class MgIllustratedMessage {
|
|
|
81
81
|
* @returns HTML Element
|
|
82
82
|
*/
|
|
83
83
|
render() {
|
|
84
|
-
return (h("div", { key: '
|
|
84
|
+
return (h("div", { key: '87fb97f2eff23d0793e1829a2ac533be7c670f59', class: this.classCollection.join() }, h("div", { key: 'c3395aefc56c00f625a7510ce73204097abbfc06', class: "mg-c-illustrated-message__illustration" }, h("slot", { key: '2505490d95166f2490e75cac403a90c693507502', name: "illustration" })), h("div", { key: '12b89745d353f0a31575f48c15d864459eb2d77e', class: "mg-c-illustrated-message__slots" }, h("slot", { key: 'c56b865f24c818ef40e3e0adb7efb698e509fba9', name: "title" }), h("slot", { key: '018faf36cfd88e1ac38b13636e7c7da7b44c9b40', name: "details" }))));
|
|
85
85
|
}
|
|
86
86
|
static get is() { return "mg-illustrated-message"; }
|
|
87
87
|
static get encapsulation() { return "shadow"; }
|
|
@@ -29,7 +29,7 @@ export class MgLoader {
|
|
|
29
29
|
* @returns HTML Element
|
|
30
30
|
*/
|
|
31
31
|
render() {
|
|
32
|
-
return (h("div", { key: '
|
|
32
|
+
return (h("div", { key: 'a2e3880baccec9691a9fd6abbdb9e01d452136aa', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '044153b87e799f1f51cb3c9c6236bf6b8b328cf5', icon: "loader", spin: true }), h("span", { key: '5e4293bd33bd2a51b7557ebf26037991e4fc853e', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
|
|
33
33
|
}
|
|
34
34
|
static get is() { return "mg-loader"; }
|
|
35
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -100,9 +100,9 @@ export class MgMessage {
|
|
|
100
100
|
* @returns HTML Element
|
|
101
101
|
*/
|
|
102
102
|
render() {
|
|
103
|
-
return (h("div", { key: '
|
|
103
|
+
return (h("div", { key: 'a182451917bfe33de32c893d9eeedd52b11f8b15', class: this.classCollection.join() }, h("mg-card", { key: '9dd0da031d97f669e885a1681b72e5a086e79c0b', shadow: this.variantStyle !== 'background' }, h("span", { key: '158c2470a10ab9d677e2031c28ad0d43c09e4cf2', class: "mg-c-message__icon" }, h("mg-icon", { key: 'f7d0cb02781d2bf5a71fbd7f9498ebf4dca31edf', icon: this.getIcon() })), h("div", { key: '56a7299983c30ea4527bb19a46ac0677b6e8c40e', class: "mg-c-message__content" }, h("span", { key: '744ad763177f92bdbac37d43a5a58f221ff97e69', class: "mg-c-message__content-slot" }, h("slot", { key: '14b7f22e206bd074336287809574b2a5abfe5bf5' })), this.hasActions && [
|
|
104
104
|
h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
|
|
105
|
-
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '
|
|
105
|
+
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '104be326f73ded002cba9a471491ca614227e3d5', name: "actions" })),
|
|
106
106
|
]))));
|
|
107
107
|
}
|
|
108
108
|
static get is() { return "mg-message"; }
|
|
@@ -106,11 +106,11 @@ export class MgModal {
|
|
|
106
106
|
* @returns HTML Element
|
|
107
107
|
*/
|
|
108
108
|
render() {
|
|
109
|
-
return (h("dialog", { key: '
|
|
109
|
+
return (h("dialog", { key: '3b802b99d96be80d8071c89be6537269866e6fff', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
110
110
|
if (el !== null) {
|
|
111
111
|
this.dialog = el;
|
|
112
112
|
}
|
|
113
|
-
} }, h("mg-card", { key: '
|
|
113
|
+
} }, h("mg-card", { key: '4985b4af69968577ffd36a6a2b1f96274703d146', shadow: true }, h("div", { key: 'c4aed6d29dc5ee00f323dcbaecff9532f370ec98', class: "mg-c-modal__dialog" }, h("header", { key: '3bfeb66d59144c0cba3fd82c1fb4dee2ed62cea7', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: '55205da6c8991444ff53da7224b28c7475b0e173', class: "mg-c-modal__close-button" }, h("mg-button", { key: 'da7fdea3a124a559cb637beea9d5565c1f777eea', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: '77c2ab2bcacdda9fa179b480651507a1d6584686', icon: "cross" })))), h("h1", { key: 'cedb5efc709de2d18e81409139da790349a48bb8', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: '7f24e65244836c08dbf7465f8c80970080003bcd', class: "mg-c-modal__content" }, h("slot", { key: '36d7c2a0ef1bb1024887da08298391962285bbf8' })), this.hasActions && (h("footer", { key: '5967d650e4e58726641a3c960d82aa7ee588e38f', class: "mg-c-modal__footer" }, h("slot", { key: 'c275b8235acb658ded3db7c69b931000a5ff14d2', name: "actions" })))))));
|
|
114
114
|
}
|
|
115
115
|
static get is() { return "mg-modal"; }
|
|
116
116
|
static get encapsulation() { return "shadow"; }
|
|
@@ -23,7 +23,7 @@ import { initLocales } from "./../../../locales";
|
|
|
23
23
|
* @param step - step size
|
|
24
24
|
* @returns range numbers
|
|
25
25
|
*/
|
|
26
|
-
const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
|
|
26
|
+
const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map((x) => start + x * step);
|
|
27
27
|
export class MgPagination {
|
|
28
28
|
constructor() {
|
|
29
29
|
/**
|
|
@@ -71,7 +71,9 @@ export class MgPagination {
|
|
|
71
71
|
* @param disabled - button disable state
|
|
72
72
|
*/
|
|
73
73
|
this.handleGoToPage = (action, disabled) => {
|
|
74
|
-
!disabled
|
|
74
|
+
if (!disabled) {
|
|
75
|
+
this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
76
|
+
}
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
watchIdentifier(newValue) {
|
|
@@ -94,7 +96,9 @@ export class MgPagination {
|
|
|
94
96
|
this.currentPageChange.emit(newValue);
|
|
95
97
|
}
|
|
96
98
|
watchPaginationMessages(newValue) {
|
|
97
|
-
if (Boolean(newValue) &&
|
|
99
|
+
if (Boolean(newValue) &&
|
|
100
|
+
(typeof newValue !== 'object' ||
|
|
101
|
+
!['next', 'previous', 'nextLabel', 'previousLabel'].every((key) => isValidString(newValue[key])))) {
|
|
98
102
|
throw new Error('<mg-pagination> prop "messages" must be a valid "PaginationMessagesType".');
|
|
99
103
|
}
|
|
100
104
|
}
|
|
@@ -134,7 +138,7 @@ export class MgPagination {
|
|
|
134
138
|
// eslint-disable-next-line react/jsx-no-bind
|
|
135
139
|
onClick: () => this.handleGoToPage(action, disabled), disabled: disabled, variant: "flat", isIcon: this.hideNavigationLabels }, action === NavigationAction.PREVIOUS && h("mg-icon", { icon: "chevron-left" }), !this.hideNavigationLabels && navigationMessages[action], action === NavigationAction.NEXT && h("mg-icon", { icon: "chevron-right" })));
|
|
136
140
|
};
|
|
137
|
-
return (h(Host, { hidden: this.totalPages < 2 }, h("nav", { role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("div", { class: "mg-c-pagination__page-count" }, h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map(page => page.toString()), label: this.localesMessages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("span", { class: "mg-u-visually-hidden" }, this.localesMessages.pagination.page, " ", this.currentPage), "/ ", this.totalPages,
|
|
141
|
+
return (h(Host, { hidden: this.totalPages < 2 }, h("nav", { role: "navigation", "aria-label": this.label, id: this.identifier, class: { 'mg-c-pagination': true, 'mg-c-pagination--hide-page-count': this.hidePageCount } }, navigationActionButton(this.currentPage <= 1, NavigationAction.PREVIOUS), !this.hidePageCount && (h("div", { class: "mg-c-pagination__page-count" }, h("mg-input-select", { identifier: `${this.identifier}-select`, items: range(1, this.totalPages).map((page) => page.toString()), label: this.localesMessages.pagination.selectPage, "label-hide": true, "on-value-change": this.handleSelect, value: this.currentPage.toString(), "placeholder-hide": true }), h("p", { class: "mg-c-pagination__page-count-text" }, h("span", { class: "mg-u-visually-hidden" }, this.localesMessages.pagination.page, " ", this.currentPage), "/ ", this.totalPages, ' ', this.totalPages > 1 ? this.localesMessages.pagination.pages : this.localesMessages.pagination.page))), navigationActionButton(this.currentPage >= this.totalPages, NavigationAction.NEXT))));
|
|
138
142
|
}
|
|
139
143
|
static get is() { return "mg-pagination"; }
|
|
140
144
|
static get encapsulation() { return "shadow"; }
|
|
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { ClassList, createID, isValidString, isValideID, toString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
3
|
import { normalizeBooleanAttributes } from "@mgdis/core-ui-helpers/dist/stencil";
|
|
4
4
|
import { initLocales } from "../../../locales";
|
|
5
|
-
import { expandToggleDisplays, titlePositions } from "./mg-panel.conf";
|
|
5
|
+
import { expandToggleDisplays, titlePositions, } from "./mg-panel.conf";
|
|
6
6
|
/**
|
|
7
7
|
* @slot - Panel content
|
|
8
8
|
* @slot panel-title - Panel title content (replaces panel-title prop when used)
|
|
@@ -110,7 +110,12 @@ export class MgPanel {
|
|
|
110
110
|
* Render collapse button
|
|
111
111
|
* @returns collpase button
|
|
112
112
|
*/
|
|
113
|
-
this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.expandToggleDisplay === 'icon' ? this.panelTitle : undefined }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: {
|
|
113
|
+
this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.expandToggleDisplay === 'icon' ? this.panelTitle : undefined }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: {
|
|
114
|
+
'mg-c-panel__collapse-button-icon': true,
|
|
115
|
+
'mg-c-panel__collapse-button-icon--reverse': !this.expanded,
|
|
116
|
+
} }), !this.isEditing &&
|
|
117
|
+
this.expandToggleDisplay !== 'icon' &&
|
|
118
|
+
(this.hasPanelTitleSlot() ? h("slot", { name: "panel-title" }) : this.panelTitle))));
|
|
114
119
|
/**
|
|
115
120
|
* Render edit button
|
|
116
121
|
* @returns edit Button
|
|
@@ -142,7 +147,11 @@ export class MgPanel {
|
|
|
142
147
|
*/
|
|
143
148
|
this.renderHeaderChildren = () => {
|
|
144
149
|
const children = [
|
|
145
|
-
h("div", { class: {
|
|
150
|
+
h("div", { class: {
|
|
151
|
+
'mg-c-panel__header-title': true,
|
|
152
|
+
'mg-c-panel__header-title--full': this.isEditing,
|
|
153
|
+
'mg-c-panel__header-title--reverse': this.titlePosition === 'right',
|
|
154
|
+
}, key: this.panelTitle }, this.renderTitle()),
|
|
146
155
|
h("div", { class: "mg-c-panel__header-content", key: "slot-header" }, h("slot", { name: "header-right" })),
|
|
147
156
|
];
|
|
148
157
|
return this.titlePosition === 'right' ? children.reverse() : children;
|
|
@@ -236,7 +245,7 @@ export class MgPanel {
|
|
|
236
245
|
*/
|
|
237
246
|
render() {
|
|
238
247
|
const headerId = `${this.identifier}-header`;
|
|
239
|
-
return (h("section", { key: '
|
|
248
|
+
return (h("section", { key: '33e6da36cbb92f19bcd957de7758c1a13ced5e83', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: 'df278e46b4604d8c5dce2abeffb2e979b02f34e9', shadow: this.shadow }, h("header", { key: 'b68012115af4bb5b62b6357fc07cbf50876ac08f', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: '3dfec67e6531fc0dff866e102ac36bd6c6a48834', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: '56c63dd0b0e98968594ff713c2c6ee2a3269b74b' })))));
|
|
240
249
|
}
|
|
241
250
|
static get is() { return "mg-panel"; }
|
|
242
251
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js
CHANGED
|
@@ -46,7 +46,7 @@ export class MgPopoverContent {
|
|
|
46
46
|
* @returns HTML Element
|
|
47
47
|
*/
|
|
48
48
|
render() {
|
|
49
|
-
return (h(Host, { key: '
|
|
49
|
+
return (h(Host, { key: '7035d8f560b811596c9c641abc7fe28ee9fdf3a2' }, h("mg-card", { key: 'badc81425100283dac69cad111514d8c3edfba45', class: this.classCollection.join(), shadow: true }, this.closeButton && (h("mg-button", { key: 'cb20d8c7db741051b532c3b1653d578df859f0d0', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: '389dc26f4cfdbb899b2b9eb4b27ceb6369209b2f', icon: "cross" }))), h("div", { key: '29b6721af3b6e06760affd6565e740bbc667f457', class: "mg-c-popover-content__title" }, h("slot", { key: '5834364d298a4e65a9170f003d0ec1f5e8868c4a', name: "title" })), h("slot", { key: '8398f497064fe097151ca263225349a9d84d4f36', name: "content" }))));
|
|
50
50
|
}
|
|
51
51
|
static get is() { return "mg-popover-content"; }
|
|
52
52
|
static get encapsulation() { return "shadow"; }
|
|
@@ -98,7 +98,7 @@ export class MgPopoverContent {
|
|
|
98
98
|
"composed": true,
|
|
99
99
|
"docs": {
|
|
100
100
|
"tags": [],
|
|
101
|
-
"text": "
|
|
101
|
+
"text": "Emitted event when close button is clicked"
|
|
102
102
|
},
|
|
103
103
|
"complexType": {
|
|
104
104
|
"original": "void",
|
|
@@ -16,11 +16,7 @@ export class MgPopover {
|
|
|
16
16
|
/**
|
|
17
17
|
* Popover placement
|
|
18
18
|
*/
|
|
19
|
-
this.placement = 'bottom';
|
|
20
|
-
/**
|
|
21
|
-
* Hide popover arrow
|
|
22
|
-
*/
|
|
23
|
-
this.arrowHide = false;
|
|
19
|
+
this.placement = 'bottom-start';
|
|
24
20
|
/**
|
|
25
21
|
* Define if popover has a cross button
|
|
26
22
|
*/
|
|
@@ -38,7 +34,16 @@ export class MgPopover {
|
|
|
38
34
|
* @param event - mouse event
|
|
39
35
|
*/
|
|
40
36
|
this.clickOutside = (event) => {
|
|
41
|
-
|
|
37
|
+
// `click` is a composed event, so `composedPath()` lists every node it travels
|
|
38
|
+
// through, including across shadow boundaries. Relying on it instead of
|
|
39
|
+
// `event.target` keeps the popover open when it (or its guarded trigger) is
|
|
40
|
+
// nested inside another component's shadow DOM: there `event.target` is
|
|
41
|
+
// retargeted to the outer shadow host and `closest()` cannot reach the popover
|
|
42
|
+
// nor the `data-mg-popover-guard` element.
|
|
43
|
+
const path = event.composedPath();
|
|
44
|
+
const isInside = path.includes(this.element) ||
|
|
45
|
+
path.some((node) => node instanceof HTMLElement && node.dataset.mgPopoverGuard === this.identifier);
|
|
46
|
+
if (!this.disabled && !isInside) {
|
|
42
47
|
this.display = false;
|
|
43
48
|
}
|
|
44
49
|
};
|
|
@@ -76,7 +81,7 @@ export class MgPopover {
|
|
|
76
81
|
* @param newValue - if true enable popper listners
|
|
77
82
|
*/
|
|
78
83
|
this.setPopperListeners = (newValue) => {
|
|
79
|
-
this.popper.setOptions(options => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: newValue }] })));
|
|
84
|
+
this.popper.setOptions((options) => (Object.assign(Object.assign({}, options), { modifiers: [...options.modifiers, { name: 'eventListeners', enabled: newValue }] })));
|
|
80
85
|
};
|
|
81
86
|
/**
|
|
82
87
|
* Manage all clickOustside listeners
|
|
@@ -113,13 +118,9 @@ export class MgPopover {
|
|
|
113
118
|
this.mgPopoverContent.setAttribute('slot', 'content');
|
|
114
119
|
this.mgPopoverContent.setAttribute('id', this.identifier);
|
|
115
120
|
this.mgPopoverContent.addEventListener('hide-content', this.handleHideContent);
|
|
116
|
-
const arrow = document.createElement('div');
|
|
117
|
-
arrow.setAttribute('slot', 'arrow');
|
|
118
|
-
arrow.dataset.popperArrow = '';
|
|
119
|
-
this.mgPopoverContent.appendChild(arrow);
|
|
120
121
|
// insert elements in DOM
|
|
121
|
-
['[slot="title"]', '[slot="content"]:not(mg-popover-content)'].forEach(slotType => {
|
|
122
|
-
Array.from(this.element.querySelectorAll(slotType)).forEach(slot => {
|
|
122
|
+
['[slot="title"]', '[slot="content"]:not(mg-popover-content)'].forEach((slotType) => {
|
|
123
|
+
Array.from(this.element.querySelectorAll(slotType)).forEach((slot) => {
|
|
123
124
|
this.mgPopoverContent.appendChild(slot);
|
|
124
125
|
});
|
|
125
126
|
});
|
|
@@ -137,12 +138,6 @@ export class MgPopover {
|
|
|
137
138
|
// use renderPopoverContent to update popover-content id
|
|
138
139
|
this.renderPopoverContent();
|
|
139
140
|
}
|
|
140
|
-
validateArrowHide(newValue) {
|
|
141
|
-
if (newValue)
|
|
142
|
-
this.mgPopoverContent.dataset.arrowHide = '';
|
|
143
|
-
else
|
|
144
|
-
delete this.mgPopoverContent.dataset.arrowHide;
|
|
145
|
-
}
|
|
146
141
|
validateCloseButton(newValue) {
|
|
147
142
|
this.mgPopoverContent.closeButton = newValue;
|
|
148
143
|
}
|
|
@@ -174,7 +169,6 @@ export class MgPopover {
|
|
|
174
169
|
this.renderPopoverContent();
|
|
175
170
|
this.validateCloseButton(this.closeButton);
|
|
176
171
|
this.validateIdentifier(this.identifier);
|
|
177
|
-
this.validateArrowHide(this.arrowHide);
|
|
178
172
|
}
|
|
179
173
|
/**
|
|
180
174
|
* Check if component props are well configured on init
|
|
@@ -199,7 +193,8 @@ export class MgPopover {
|
|
|
199
193
|
{
|
|
200
194
|
name: 'offset',
|
|
201
195
|
options: {
|
|
202
|
-
|
|
196
|
+
// 2px gap with the trigger element, applied on the main axis only (no cross-axis shift so `-start`/`-end` stay aligned)
|
|
197
|
+
offset: [0, 2],
|
|
203
198
|
},
|
|
204
199
|
},
|
|
205
200
|
{
|
|
@@ -211,7 +206,7 @@ export class MgPopover {
|
|
|
211
206
|
],
|
|
212
207
|
});
|
|
213
208
|
// add resize observer
|
|
214
|
-
[this.interactiveElement, this.element.querySelector('mg-popover-content')].forEach(element => {
|
|
209
|
+
[this.interactiveElement, this.element.querySelector('mg-popover-content')].forEach((element) => {
|
|
215
210
|
new ResizeObserver(() => {
|
|
216
211
|
this.popper.update();
|
|
217
212
|
}).observe(element);
|
|
@@ -228,7 +223,7 @@ export class MgPopover {
|
|
|
228
223
|
}
|
|
229
224
|
});
|
|
230
225
|
// Add events to hide popover
|
|
231
|
-
this.element.addEventListener('keydown', e => {
|
|
226
|
+
this.element.addEventListener('keydown', (e) => {
|
|
232
227
|
if (!this.disabled && e.code === 'Escape') {
|
|
233
228
|
this.display = false;
|
|
234
229
|
this.componentClose.emit();
|
|
@@ -242,7 +237,7 @@ export class MgPopover {
|
|
|
242
237
|
* @returns HTML Element
|
|
243
238
|
*/
|
|
244
239
|
render() {
|
|
245
|
-
return (h(Host, { key: '
|
|
240
|
+
return (h(Host, { key: '9e62e60ba76045222b9c69b34245c3825004f8d6' }, h("slot", { key: '4be1a5c1221e1985cd0c0b4f7b19435d097bee4e' }), h("slot", { key: '07c2003dc3ad0bb7059e75e95e0de2862a64fd22', name: "content" })));
|
|
246
241
|
}
|
|
247
242
|
static get is() { return "mg-popover"; }
|
|
248
243
|
static get encapsulation() { return "shadow"; }
|
|
@@ -303,27 +298,27 @@ export class MgPopover {
|
|
|
303
298
|
"setter": false,
|
|
304
299
|
"reflect": false,
|
|
305
300
|
"attribute": "placement",
|
|
306
|
-
"defaultValue": "'bottom'"
|
|
301
|
+
"defaultValue": "'bottom-start'"
|
|
307
302
|
},
|
|
308
303
|
"arrowHide": {
|
|
309
|
-
"type": "
|
|
304
|
+
"type": "unknown",
|
|
310
305
|
"mutable": false,
|
|
311
306
|
"complexType": {
|
|
312
|
-
"original": "
|
|
313
|
-
"resolved": "
|
|
307
|
+
"original": "never",
|
|
308
|
+
"resolved": "never",
|
|
314
309
|
"references": {}
|
|
315
310
|
},
|
|
316
311
|
"required": false,
|
|
317
312
|
"optional": false,
|
|
318
313
|
"docs": {
|
|
319
|
-
"tags": [
|
|
314
|
+
"tags": [{
|
|
315
|
+
"name": "deprecated",
|
|
316
|
+
"text": "this prop is deprecated and will be removed in future releases. The popover arrow has been removed."
|
|
317
|
+
}],
|
|
320
318
|
"text": "Hide popover arrow"
|
|
321
319
|
},
|
|
322
320
|
"getter": false,
|
|
323
|
-
"setter": false
|
|
324
|
-
"reflect": false,
|
|
325
|
-
"attribute": "arrow-hide",
|
|
326
|
-
"defaultValue": "false"
|
|
321
|
+
"setter": false
|
|
327
322
|
},
|
|
328
323
|
"closeButton": {
|
|
329
324
|
"type": "boolean",
|
|
@@ -396,7 +391,7 @@ export class MgPopover {
|
|
|
396
391
|
"composed": true,
|
|
397
392
|
"docs": {
|
|
398
393
|
"tags": [],
|
|
399
|
-
"text": "
|
|
394
|
+
"text": "Emitted event when display value change"
|
|
400
395
|
},
|
|
401
396
|
"complexType": {
|
|
402
397
|
"original": "HTMLMgPopoverElement['display']",
|
|
@@ -430,9 +425,6 @@ export class MgPopover {
|
|
|
430
425
|
return [{
|
|
431
426
|
"propName": "identifier",
|
|
432
427
|
"methodName": "validateIdentifier"
|
|
433
|
-
}, {
|
|
434
|
-
"propName": "arrowHide",
|
|
435
|
-
"methodName": "validateArrowHide"
|
|
436
428
|
}, {
|
|
437
429
|
"propName": "closeButton",
|
|
438
430
|
"methodName": "validateCloseButton"
|
|
@@ -65,7 +65,7 @@ export class MgProgress {
|
|
|
65
65
|
* @returns HTML Element
|
|
66
66
|
*/
|
|
67
67
|
render() {
|
|
68
|
-
return (h(Host, { key: '
|
|
68
|
+
return (h(Host, { key: '3682d5f1980678e39594dab8223805deb4b425d4', role: this.ariaRole, "aria-label": this.label, "aria-valuenow": this.value, "aria-valuemin": this.min, "aria-valuemax": this.max }, h("div", { key: '001d511a866ec0526c4ffd01a8a90448b6f40819', class: "mg-c-progress" }, h("div", { key: '504fa583f5b8186236871f3f2cd886acb40614ef', class: { 'mg-c-progress__bar': true, 'mg-c-progress__bar--active': this.value > this.min } }, h("div", { key: '044c9297d5a12c9d8c6d3b76d17dd2ba6a1a9719', class: "mg-c-progress__fill", style: {
|
|
69
69
|
width: `${Math.round(((this.value - this.min) / (this.max - this.min)) * 100)}%`,
|
|
70
70
|
} })))));
|
|
71
71
|
}
|
|
@@ -17,7 +17,9 @@ export class MgSkipLinks {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
validateLinks(links) {
|
|
20
|
-
if (links === undefined ||
|
|
20
|
+
if (links === undefined ||
|
|
21
|
+
links.length === 0 ||
|
|
22
|
+
links.some((link) => !isValidString(link.href) || !link.href.startsWith('#') || !isValidString(link.label))) {
|
|
21
23
|
throw new Error(`<mg-skip-links> prop "links": Cannot be empty and each link must contains an href starting with a "#" and a non empty label attributes.`);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
@@ -36,7 +38,7 @@ export class MgSkipLinks {
|
|
|
36
38
|
* @returns HTML Element
|
|
37
39
|
*/
|
|
38
40
|
render() {
|
|
39
|
-
return (h("nav", { key: '
|
|
41
|
+
return (h("nav", { key: '9208da538e001be23c8cc78e8a34498cd072cdc6', class: "mg-c-skip-links", role: "navigation", "aria-label": this.messages.skipLinks.navLabel }, h("ul", { key: 'fcd69f398fad6964d5c017bb652ad7b8de34dee6', class: "mg-c-skip-links__list", role: "list" }, this.links.map((link) => (h("li", { key: link.href }, h("a", { class: "mg-c-skip-links__link", href: link.href, onClick: this.handleLinkCLick }, link.label)))))));
|
|
40
42
|
}
|
|
41
43
|
static get is() { return "mg-skip-links"; }
|
|
42
44
|
static get encapsulation() { return "shadow"; }
|
|
@@ -87,7 +89,7 @@ export class MgSkipLinks {
|
|
|
87
89
|
"composed": true,
|
|
88
90
|
"docs": {
|
|
89
91
|
"tags": [],
|
|
90
|
-
"text": "
|
|
92
|
+
"text": "Emitted event when link is clicked"
|
|
91
93
|
},
|
|
92
94
|
"complexType": {
|
|
93
95
|
"original": "string",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassList, toString, createID, isValidString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
2
|
-
import { textAlignments, dataTypes, sizes } from "./mg-table.conf";
|
|
2
|
+
import { textAlignments, dataTypes, sizes, } from "./mg-table.conf";
|
|
3
3
|
import { initLocales } from "../../../locales";
|
|
4
4
|
/**
|
|
5
5
|
* Check if value is a valid align object
|
|
@@ -22,7 +22,7 @@ typeof newValue === 'object' &&
|
|
|
22
22
|
(value.sortable !== undefined && typeof value.sortable === 'boolean') ||
|
|
23
23
|
(value.datatype !== undefined && dataTypes.includes(value.datatype))) &&
|
|
24
24
|
// ensure no extra properties are present
|
|
25
|
-
Object.keys(value).every(key => ['align', 'sortable', 'datatype'].includes(key)));
|
|
25
|
+
Object.keys(value).every((key) => ['align', 'sortable', 'datatype'].includes(key)));
|
|
26
26
|
/**
|
|
27
27
|
* Compare values
|
|
28
28
|
* @param firstValue - First value
|
|
@@ -150,12 +150,16 @@ export class MgTable {
|
|
|
150
150
|
// Add event listener
|
|
151
151
|
button.addEventListener('click', () => {
|
|
152
152
|
// Reset aria pressed
|
|
153
|
-
table
|
|
153
|
+
table
|
|
154
|
+
.querySelectorAll(`thead td:not(:nth-child(${key})) [aria-pressed],thead th:not(:nth-child(${key})) [aria-pressed]`)
|
|
155
|
+
.forEach((ariaPressed) => {
|
|
154
156
|
ariaPressed.removeAttribute('aria-pressed');
|
|
155
157
|
ariaPressed.querySelector('mg-icon').setAttribute('icon', 'arrows-up-down');
|
|
156
158
|
});
|
|
157
159
|
// Reset aria sort
|
|
158
|
-
table
|
|
160
|
+
table
|
|
161
|
+
.querySelectorAll(`thead td:not(:nth-child(${key}))[aria-sort],thead th:not(:nth-child(${key}))[aria-sort]`)
|
|
162
|
+
.forEach((ariaSort) => {
|
|
159
163
|
ariaSort.removeAttribute('aria-sort');
|
|
160
164
|
});
|
|
161
165
|
// Set aria pressed
|
|
@@ -190,7 +194,7 @@ export class MgTable {
|
|
|
190
194
|
// If sort order is none, return to original order
|
|
191
195
|
if (sortOrder === 'none') {
|
|
192
196
|
// Append rows to table
|
|
193
|
-
rowsDefault.forEach(row => table.querySelector('tbody').append(row));
|
|
197
|
+
rowsDefault.forEach((row) => table.querySelector('tbody').append(row));
|
|
194
198
|
return;
|
|
195
199
|
}
|
|
196
200
|
// Set a copy of rows
|
|
@@ -208,7 +212,7 @@ export class MgTable {
|
|
|
208
212
|
return compareValues(cellValueA, cellValueB, sortOrder === 'descending', value.datatype);
|
|
209
213
|
});
|
|
210
214
|
// Append rows to table
|
|
211
|
-
rows.forEach(row => table.querySelector('tbody').append(row));
|
|
215
|
+
rows.forEach((row) => table.querySelector('tbody').append(row));
|
|
212
216
|
});
|
|
213
217
|
}
|
|
214
218
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { createID, ClassList, allItemsAreString, isValidString, nextTick, toString, isValideID } from "@mgdis/core-ui-helpers/dist/utils";
|
|
2
|
+
import { createID, ClassList, allItemsAreString, isValidString, nextTick, toString, isValideID, } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
3
|
import { Status } from "./mg-tabs.conf";
|
|
4
4
|
import { Keys } from "../../../utils/events.utils";
|
|
5
5
|
/**
|
|
@@ -141,7 +141,7 @@ export class MgTabs {
|
|
|
141
141
|
* Validate slots setting
|
|
142
142
|
*/
|
|
143
143
|
this.validateSlots = () => {
|
|
144
|
-
const slots = Array.from(this.element.children).filter(slot => { var _a; return (_a = slot.getAttribute('slot')) === null || _a === void 0 ? void 0 : _a.includes('tab_content-'); });
|
|
144
|
+
const slots = Array.from(this.element.children).filter((slot) => { var _a; return (_a = slot.getAttribute('slot')) === null || _a === void 0 ? void 0 : _a.includes('tab_content-'); });
|
|
145
145
|
if (slots.length !== this.tabs.length)
|
|
146
146
|
throw new Error('<mg-tabs> Must have slots counts equal to tabs count.');
|
|
147
147
|
};
|
|
@@ -159,7 +159,7 @@ export class MgTabs {
|
|
|
159
159
|
validateItems(newValue) {
|
|
160
160
|
// String array
|
|
161
161
|
if (allItemsAreString(newValue))
|
|
162
|
-
this.tabs = newValue.map(item => ({ label: item, status: Status.VISIBLE }));
|
|
162
|
+
this.tabs = newValue.map((item) => ({ label: item, status: Status.VISIBLE }));
|
|
163
163
|
// Object array
|
|
164
164
|
else if (Array.isArray(newValue) && newValue.length > 0 && newValue.every(isTabItem))
|
|
165
165
|
this.tabs = newValue;
|
|
@@ -170,11 +170,14 @@ export class MgTabs {
|
|
|
170
170
|
// when `active-tab` is undefined we set default value by searching an item with `Status.ACTIVE` or we use the `startIndex` has fallback value
|
|
171
171
|
// after setting new value to `active-tab` the validate will be triggered again with the updated value and process the tab update
|
|
172
172
|
if (newValue === undefined) {
|
|
173
|
-
this.activeTab = this.tabs.some(tab => this.tabHasStatus(tab, Status.ACTIVE))
|
|
174
|
-
? this.getTabItemIndex(this.tabs.findIndex(tab => this.tabHasStatus(tab, Status.ACTIVE)))
|
|
173
|
+
this.activeTab = this.tabs.some((tab) => this.tabHasStatus(tab, Status.ACTIVE))
|
|
174
|
+
? this.getTabItemIndex(this.tabs.findIndex((tab) => this.tabHasStatus(tab, Status.ACTIVE)))
|
|
175
175
|
: this.startIndex;
|
|
176
176
|
}
|
|
177
|
-
else if (typeof newValue === 'number' &&
|
|
177
|
+
else if (typeof newValue === 'number' &&
|
|
178
|
+
newValue >= this.startIndex &&
|
|
179
|
+
newValue <= this.tabs.length &&
|
|
180
|
+
this.isActivableTab(this.tabs[newValue - this.startIndex])) {
|
|
178
181
|
// if new 'active-tab' is activable we update tab status to ACTIVE and toggle past ACTIVE to VISIBLE
|
|
179
182
|
this.tabs.forEach((tab, index) => {
|
|
180
183
|
const isNewActiveTab = index === newValue - this.startIndex;
|
|
@@ -223,13 +226,13 @@ export class MgTabs {
|
|
|
223
226
|
* @returns HTML Element
|
|
224
227
|
*/
|
|
225
228
|
render() {
|
|
226
|
-
return (h("div", { key: '
|
|
229
|
+
return (h("div", { key: '37be8d325dfea3a7b828236f3cc21da57be28154', class: this.classCollection.join() }, h("header", { key: 'd88f10c0331984a759f8abc311f11d913fb25206', role: "tablist", "aria-label": this.label, class: "mg-c-tabs__header" }, this.tabs.map((tab, index) => (h("button", { key: tab.label, role: "tab", id: this.getElementId(this.identifier, index), class: {
|
|
227
230
|
[`${this.buttonTabBaseClass}`]: true,
|
|
228
231
|
[`${this.buttonTabBaseClass}--horizontal`]: true,
|
|
229
232
|
[`${this.getNavigationButtonClass(Status.ACTIVE)}`]: this.tabHasStatus(tab, Status.ACTIVE),
|
|
230
233
|
[`${this.getNavigationButtonClass(Status.DISABLED)}`]: this.tabHasStatus(tab, Status.DISABLED),
|
|
231
234
|
[`${this.getNavigationButtonClass(Status.HIDDEN)}`]: this.tabHasStatus(tab, Status.HIDDEN),
|
|
232
|
-
}, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon, size: "small" }), tab.label, tab.badge !== undefined && h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' }))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-c-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
|
|
235
|
+
}, tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, "aria-selected": this.tabHasStatus(tab, Status.ACTIVE).toString(), "aria-controls": this.getElementId(this.tabPanel, index), "aria-disabled": this.tabHasStatus(tab, Status.DISABLED), onClick: this.handleClick, onKeyDown: this.handleKeydown, "data-index": this.getTabItemIndex(index) }, tab.icon !== undefined && h("mg-icon", { icon: tab.icon, size: "small" }), tab.label, tab.badge !== undefined && (h("mg-badge", { variant: "text-color", value: tab.badge.value, label: tab.badge.label, outline: tab.badge.role === 'information' })))))), this.tabs.map((tab, index) => (h("article", { key: tab.label, role: "tabpanel", id: this.getElementId(this.tabPanel, index), hidden: !this.tabHasStatus(tab, Status.ACTIVE), "aria-labelledby": this.getElementId(this.identifier, index), tabindex: this.tabHasStatus(tab, Status.ACTIVE) ? 0 : -1, class: "mg-c-tabs__content-container" }, h("slot", { name: this.getElementId('tab_content', index) }))))));
|
|
233
236
|
}
|
|
234
237
|
static get is() { return "mg-tabs"; }
|
|
235
238
|
static get encapsulation() { return "shadow"; }
|
|
@@ -364,7 +367,7 @@ export class MgTabs {
|
|
|
364
367
|
"composed": true,
|
|
365
368
|
"docs": {
|
|
366
369
|
"tags": [],
|
|
367
|
-
"text": "
|
|
370
|
+
"text": "Emitted event when active tab change"
|
|
368
371
|
},
|
|
369
372
|
"complexType": {
|
|
370
373
|
"original": "HTMLMgTabsElement['activeTab']",
|
|
@@ -60,13 +60,13 @@ export class OverflowBehavior {
|
|
|
60
60
|
throw new Error('OverflowBehavior - all constructor params are required');
|
|
61
61
|
}
|
|
62
62
|
const items = Array.from(this.parentElement.children);
|
|
63
|
-
this._resizeObserver = new ResizeObserver(entries => {
|
|
63
|
+
this._resizeObserver = new ResizeObserver((entries) => {
|
|
64
64
|
this._availableWidth = entries
|
|
65
|
-
.map(entry => entry.contentRect.width)
|
|
65
|
+
.map((entry) => entry.contentRect.width)
|
|
66
66
|
.sort((a, b) => a - b)
|
|
67
67
|
.shift();
|
|
68
68
|
// reset items
|
|
69
|
-
items.forEach(item => this.toggleItem(item, false));
|
|
69
|
+
items.forEach((item) => this.toggleItem(item, false));
|
|
70
70
|
let accWidth = 0;
|
|
71
71
|
items.forEach((item, index) => {
|
|
72
72
|
accWidth += item.offsetWidth;
|