@mgdis/mg-components 6.24.0 → 6.26.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 +452 -261
- 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 +40 -23
- package/dist/cjs/mg-input-file.cjs.entry.js +12 -11
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +2565 -4013
- 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/assets/jodit/jodit.css +5821 -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 +84 -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 +69 -25
- 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 +9 -8
- 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/custom-properties.css +50 -0
- 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 +262 -9
- 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.conf.js +4 -0
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +51 -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 +24 -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 +294 -284
- 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 +197 -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 +449 -258
- 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 +40 -23
- package/dist/esm/mg-input-file.entry.js +12 -11
- package/dist/esm/mg-input-rich-text-editor.entry.js +2550 -3998
- 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-206505b5.entry.js +1667 -0
- 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-5dff879a.entry.js +1 -0
- package/dist/mg-components/{p-08d3d957.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-bf2252c9.entry.js +1 -0
- package/dist/mg-components/p-d0d12800.entry.js +1 -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 +19 -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-illustrated-message/mg-illustrated-message.conf.d.ts +8 -0
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +9 -1
- 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 +158 -42
- package/ide/intellij/web-types.json +145 -65
- package/ide/vscode/css-custom-data.json +6 -2
- package/ide/vscode/html-custom-data.json +216 -33
- package/package.json +22 -22
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/custom-properties.scss +0 -212
- package/dist/mg-components/p-13feb37a.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-9953b835.entry.js +0 -1
- package/dist/mg-components/p-9c0a9fc7.entry.js +0 -1657
- package/dist/mg-components/p-DshvCiTL.js +0 -2
- package/dist/mg-components/p-a338088e.entry.js +0 -1
- /package/dist/mg-components/{p-C7xjtdiw.js → p-91BOpzAB.js} +0 -0
- /package/dist/mg-components/{p-DSEloqPn.js → p-BfblyCaJ.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { ClassList, isValidString, toString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
3
|
import { normalizeBooleanAttributes } from "@mgdis/core-ui-helpers/dist/stencil";
|
|
4
|
-
import { widths, classReadonly, classDisabled, classDisplayCharacterLeft } from "../mg-input/mg-input.conf";
|
|
4
|
+
import { widths, classReadonly, classDisabled, classDisplayCharacterLeft, } from "../mg-input/mg-input.conf";
|
|
5
5
|
import { initLocales } from "../../../../locales";
|
|
6
6
|
export class MgInputTextarea {
|
|
7
7
|
constructor() {
|
|
@@ -145,7 +145,7 @@ export class MgInputTextarea {
|
|
|
145
145
|
}
|
|
146
146
|
watchMgWidth(newValue) {
|
|
147
147
|
// reset width class
|
|
148
|
-
widths.forEach(width => {
|
|
148
|
+
widths.forEach((width) => {
|
|
149
149
|
this.classCollection.delete(`mg-c-input--width-${width}`);
|
|
150
150
|
});
|
|
151
151
|
// apply new width
|
|
@@ -182,7 +182,7 @@ export class MgInputTextarea {
|
|
|
182
182
|
// - Async operations are completed
|
|
183
183
|
// - No timing issues with Stencil's render cycle
|
|
184
184
|
// - Keep everything in sync both inside and outside the component
|
|
185
|
-
return new Promise(resolve => {
|
|
185
|
+
return new Promise((resolve) => {
|
|
186
186
|
requestAnimationFrame(() => {
|
|
187
187
|
this.checkValidity();
|
|
188
188
|
this.setErrorMessage();
|
|
@@ -229,7 +229,7 @@ export class MgInputTextarea {
|
|
|
229
229
|
// - Async operations are completed
|
|
230
230
|
// - No timing issues with Stencil's render cycle
|
|
231
231
|
// - Keep everything in sync both inside and outside the component
|
|
232
|
-
return new Promise(resolve => {
|
|
232
|
+
return new Promise((resolve) => {
|
|
233
233
|
requestAnimationFrame(() => {
|
|
234
234
|
// unlock validity check by reseting customErrorMessage
|
|
235
235
|
this.customErrorMessage = { lock: false };
|
|
@@ -286,7 +286,7 @@ export class MgInputTextarea {
|
|
|
286
286
|
* @returns HTML Element
|
|
287
287
|
*/
|
|
288
288
|
render() {
|
|
289
|
-
return (h("mg-input", { key: '
|
|
289
|
+
return (h("mg-input", { key: '36575f026a23722bb6d224aaeacf0e80d3e1bbfd', label: this.label, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: this.characterLeftId, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, this.value)) : (h("div", { class: "mg-c-input__input-group-container" }, h("textarea", { class: {
|
|
290
290
|
'mg-c-input__box': true,
|
|
291
291
|
'mg-c-input__box--width': true,
|
|
292
292
|
'mg-c-input__box--resizable': this.resizable === 'both',
|
|
@@ -772,7 +772,7 @@ export class MgInputTextarea {
|
|
|
772
772
|
"composed": true,
|
|
773
773
|
"docs": {
|
|
774
774
|
"tags": [],
|
|
775
|
-
"text": "
|
|
775
|
+
"text": "Emitted event when value change"
|
|
776
776
|
},
|
|
777
777
|
"complexType": {
|
|
778
778
|
"original": "HTMLMgInputTextareaElement['value']",
|
|
@@ -792,7 +792,7 @@ export class MgInputTextarea {
|
|
|
792
792
|
"composed": true,
|
|
793
793
|
"docs": {
|
|
794
794
|
"tags": [],
|
|
795
|
-
"text": "
|
|
795
|
+
"text": "Emitted event when checking validity"
|
|
796
796
|
},
|
|
797
797
|
"complexType": {
|
|
798
798
|
"original": "HTMLMgInputTextareaElement['valid']",
|
|
@@ -97,10 +97,10 @@ export class MgInputToggle {
|
|
|
97
97
|
if (!this.isIcon) {
|
|
98
98
|
// Due to text-overflow set to ellipsis
|
|
99
99
|
// we need to ensure that slot element have title to display value on mouse over
|
|
100
|
-
slots.forEach(slot => slot.setAttribute('title', slot.textContent));
|
|
100
|
+
slots.forEach((slot) => slot.setAttribute('title', slot.textContent));
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
103
|
-
slots.forEach(slot => {
|
|
103
|
+
slots.forEach((slot) => {
|
|
104
104
|
if (slot.nodeName === 'MG-ICON') {
|
|
105
105
|
slot.size = 'small';
|
|
106
106
|
}
|
|
@@ -113,7 +113,7 @@ export class MgInputToggle {
|
|
|
113
113
|
* @returns toggle value
|
|
114
114
|
*/
|
|
115
115
|
this.getCurrentOptionIndex = (value) => {
|
|
116
|
-
return this.options.findIndex(option => toString(option.value) === toString(value)) === 1 ? 1 : 0;
|
|
116
|
+
return this.options.findIndex((option) => toString(option.value) === toString(value)) === 1 ? 1 : 0;
|
|
117
117
|
};
|
|
118
118
|
/**
|
|
119
119
|
* Check if value is checked
|
|
@@ -137,7 +137,8 @@ export class MgInputToggle {
|
|
|
137
137
|
// However, depending on the integration context (e.g., Vue.js), they may also be interpreted as string attributes.
|
|
138
138
|
// To avoid incorrect type interpretation when a boolean is received as a string,
|
|
139
139
|
// we normalize the value and convert it to a proper boolean before internal use.
|
|
140
|
-
else if (['true', 'false'].includes(newValue) &&
|
|
140
|
+
else if (['true', 'false'].includes(newValue) &&
|
|
141
|
+
this.options.every((option) => typeof option.value === 'boolean')) {
|
|
141
142
|
this.value = newValue === 'true';
|
|
142
143
|
// Return early to prevent infinite loop
|
|
143
144
|
return;
|
|
@@ -162,7 +163,7 @@ export class MgInputToggle {
|
|
|
162
163
|
}
|
|
163
164
|
// String array
|
|
164
165
|
else if (allItemsAreString(newValue)) {
|
|
165
|
-
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
166
|
+
this.options = newValue.map((item) => ({ title: item, value: item }));
|
|
166
167
|
}
|
|
167
168
|
// Object array
|
|
168
169
|
else if (Array.isArray(newValue) && newValue.every(isOption)) {
|
|
@@ -242,7 +243,7 @@ export class MgInputToggle {
|
|
|
242
243
|
// - Async operations are completed
|
|
243
244
|
// - No timing issues with Stencil's render cycle
|
|
244
245
|
// - Keep everything in sync both inside and outside the component
|
|
245
|
-
return new Promise(resolve => {
|
|
246
|
+
return new Promise((resolve) => {
|
|
246
247
|
requestAnimationFrame(() => {
|
|
247
248
|
this.errorMessage = undefined;
|
|
248
249
|
resolve();
|
|
@@ -272,7 +273,7 @@ export class MgInputToggle {
|
|
|
272
273
|
*/
|
|
273
274
|
render() {
|
|
274
275
|
const currentOption = this.options[this.getCurrentOptionIndex(this.value)];
|
|
275
|
-
return (h("mg-input", { key: '
|
|
276
|
+
return (h("mg-input", { key: '5402a263042d7c4265d0dae810df6be6ae8d3f2a', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (currentOption && h("b", { class: "mg-c-input__readonly-value" }, currentOption.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.isChecked(this.value).toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.handleSwitchButton, ref: (el) => {
|
|
276
277
|
if (el !== null)
|
|
277
278
|
this.button = el;
|
|
278
279
|
} }, h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-1" })), h("span", { "aria-hidden": "true", class: "mg-c-input__toggle-item-container" }, h("slot", { name: "item-2" }))))));
|
|
@@ -601,7 +602,7 @@ export class MgInputToggle {
|
|
|
601
602
|
"composed": true,
|
|
602
603
|
"docs": {
|
|
603
604
|
"tags": [],
|
|
604
|
-
"text": "
|
|
605
|
+
"text": "Emitted event when value change"
|
|
605
606
|
},
|
|
606
607
|
"complexType": {
|
|
607
608
|
"original": "HTMLMgInputToggleElement['value']",
|
|
@@ -621,7 +622,7 @@ export class MgInputToggle {
|
|
|
621
622
|
"composed": true,
|
|
622
623
|
"docs": {
|
|
623
624
|
"tags": [],
|
|
624
|
-
"text": "
|
|
625
|
+
"text": "Emitted event when checking validity"
|
|
625
626
|
},
|
|
626
627
|
"complexType": {
|
|
627
628
|
"original": "boolean",
|
|
@@ -75,7 +75,7 @@ export class MgItemMore {
|
|
|
75
75
|
*/
|
|
76
76
|
render() {
|
|
77
77
|
const menuItemIdentifier = 'mg-item-more';
|
|
78
|
-
return (h(Host, { key: '
|
|
78
|
+
return (h(Host, { key: '54d11a95e5edc3a45e98541ffc827264e40bc5ec', role: "listitem", "data-mg-popover-guard": `${menuItemIdentifier}-popover` }, this.parentMenu && (h("mg-menu-item", { key: '636e1c03e907071e72766b7ee359f3f93d3df6ae', "data-overflow-more": true, "data-style-direction": directions.HORIZONTAL, identifier: menuItemIdentifier, isIcon: !this.slotlabel.display }, h("mg-icon", { key: 'e751b58f50a3625f6e23b5993a50f8d0c2fb4660', icon: this.icon.icon, slot: "image" }), h("span", { key: 'bc429c525afced68fb5a7668cad3741699216b97', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { key: '05760816f84ef6b6c5d18d058a110b6ec2d182e3', direction: directions.VERTICAL, label: this.messages.menuLabel, ref: (ref) => {
|
|
79
79
|
if (ref !== null)
|
|
80
80
|
this.itemMoreContainer = ref;
|
|
81
81
|
} })))));
|
|
@@ -28,7 +28,7 @@ export class MgMenu {
|
|
|
28
28
|
*/
|
|
29
29
|
this.getMenuItems = (menu = this.element) => {
|
|
30
30
|
var _a, _b;
|
|
31
|
-
const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM');
|
|
31
|
+
const menuItems = Array.from(menu.children).filter((child) => child.nodeName === 'MG-MENU-ITEM');
|
|
32
32
|
const itemMoreMenuItem = (_b = (_a = menu.querySelector('mg-item-more')) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item');
|
|
33
33
|
if (itemMoreMenuItem !== null && itemMoreMenuItem !== undefined) {
|
|
34
34
|
menuItems.push(itemMoreMenuItem);
|
|
@@ -39,7 +39,7 @@ export class MgMenu {
|
|
|
39
39
|
* Update menu items
|
|
40
40
|
*/
|
|
41
41
|
this.updateMenuItems = () => {
|
|
42
|
-
this.getMenuItems().forEach(item => {
|
|
42
|
+
this.getMenuItems().forEach((item) => {
|
|
43
43
|
item.dataset.styleDirection = this.direction;
|
|
44
44
|
});
|
|
45
45
|
// render mg-item-more to manage OverflowBehavior
|
|
@@ -49,7 +49,9 @@ export class MgMenu {
|
|
|
49
49
|
* render mg-item-more
|
|
50
50
|
*/
|
|
51
51
|
this.renderMgItemMore = () => {
|
|
52
|
-
if (this.direction === directions.VERTICAL ||
|
|
52
|
+
if (this.direction === directions.VERTICAL ||
|
|
53
|
+
(this.direction === directions.HORIZONTAL && this.isChildMenu()) ||
|
|
54
|
+
this.element.children.length <= 1) {
|
|
53
55
|
return;
|
|
54
56
|
}
|
|
55
57
|
// Insert mg-item-more outside the mg-menu shadowdom
|
|
@@ -95,7 +97,7 @@ export class MgMenu {
|
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
99
|
const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;
|
|
98
|
-
['click', 'focus'].forEach(trigger => {
|
|
100
|
+
['click', 'focus'].forEach((trigger) => {
|
|
99
101
|
itemToWatch.addEventListener(trigger, () => {
|
|
100
102
|
const focusedItem = event.target.closest('mg-menu').querySelector('[data-has-focus]');
|
|
101
103
|
// exit process if new focused item in the current menu children
|
|
@@ -153,7 +155,7 @@ export class MgMenu {
|
|
|
153
155
|
* @returns HTML Element
|
|
154
156
|
*/
|
|
155
157
|
render() {
|
|
156
|
-
return (h(Host, { key: '
|
|
158
|
+
return (h(Host, { key: '967fc6e01207c5831b7821ccb17db8406cabc262', role: "list", "aria-label": this.label }, h("slot", { key: '9699944cbe1b25434c3ddc6235dae7676b7acb6b' })));
|
|
157
159
|
}
|
|
158
160
|
static get is() { return "mg-menu"; }
|
|
159
161
|
static get encapsulation() { return "shadow"; }
|
|
@@ -68,7 +68,9 @@ export class MgMenuItem {
|
|
|
68
68
|
* @returns truthy if component display popover
|
|
69
69
|
*/
|
|
70
70
|
this.hasPopover = () => this.isDirection(directions.HORIZONTAL) &&
|
|
71
|
-
((this.isInMainMenu() &&
|
|
71
|
+
((this.isInMainMenu() &&
|
|
72
|
+
Array.from(this.element.children).some((element) => element.querySelector('[slot]') === null)) ||
|
|
73
|
+
this.isItemMore) &&
|
|
72
74
|
this.href === undefined;
|
|
73
75
|
/**
|
|
74
76
|
* Method to control if one of component children have active status
|
|
@@ -102,7 +104,8 @@ export class MgMenuItem {
|
|
|
102
104
|
this.updateDisplayNotificationBadge = () => {
|
|
103
105
|
const childMenu = this.element.querySelector('mg-menu');
|
|
104
106
|
this.displayNotificationBadge =
|
|
105
|
-
childMenu !== null &&
|
|
107
|
+
childMenu !== null &&
|
|
108
|
+
Array.from(childMenu.children).some((subItem) => subItem.querySelector('mg-badge') !== null && !subItem.hasAttribute('hidden'));
|
|
106
109
|
};
|
|
107
110
|
/**
|
|
108
111
|
* Update expanded prop
|
|
@@ -130,11 +133,11 @@ export class MgMenuItem {
|
|
|
130
133
|
this.updateSlot = (guard = false) => {
|
|
131
134
|
// slot title AND metadata validation
|
|
132
135
|
// add title on label AND metada slots due to text-overflow on these element
|
|
133
|
-
if (Array.from(this.element.children).find(child => child.getAttribute('slot') === 'label') === undefined) {
|
|
136
|
+
if (Array.from(this.element.children).find((child) => child.getAttribute('slot') === 'label') === undefined) {
|
|
134
137
|
throw new Error(`<${this.name}> slot "label" is required.`);
|
|
135
138
|
}
|
|
136
|
-
['label', 'metadata'].forEach(slot => {
|
|
137
|
-
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach(element => {
|
|
139
|
+
['label', 'metadata'].forEach((slot) => {
|
|
140
|
+
Array.from(this.element.querySelectorAll(`[slot="${slot}"]`)).forEach((element) => {
|
|
138
141
|
if (!isValidString(element.textContent))
|
|
139
142
|
throw new Error(`<${this.name}> slot "${slot}" must have text content.`);
|
|
140
143
|
if ((guard && !element.hasAttribute('title')) || !guard)
|
|
@@ -232,7 +235,7 @@ export class MgMenuItem {
|
|
|
232
235
|
else {
|
|
233
236
|
this.updateExpanded(newValue);
|
|
234
237
|
// when expanded all actives sub-items need to be expanded and non active closed
|
|
235
|
-
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
|
|
238
|
+
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach((item) => {
|
|
236
239
|
if (item !== this.element)
|
|
237
240
|
item.expanded = newValue ? this.hasStatus(item, Status.ACTIVE) : false;
|
|
238
241
|
});
|
|
@@ -243,7 +246,7 @@ export class MgMenuItem {
|
|
|
243
246
|
this.classNavigationButtonClassList.delete(`${this.classNavigationButton}--${oldValue}`);
|
|
244
247
|
this.classNavigationButtonClassList.add(`${this.classNavigationButton}--${newValue}`);
|
|
245
248
|
// manage all sub levels child menu-items level with data-level attribut
|
|
246
|
-
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
|
|
249
|
+
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach((item) => {
|
|
247
250
|
if (this.isDirection(directions.VERTICAL, newValue)) {
|
|
248
251
|
item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
|
|
249
252
|
}
|
|
@@ -261,7 +264,6 @@ export class MgMenuItem {
|
|
|
261
264
|
* direction value in dataset
|
|
262
265
|
* @param newValue - new direction value
|
|
263
266
|
*/
|
|
264
|
-
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
265
267
|
watchDataStyleDirection(newValue) {
|
|
266
268
|
this.direction = newValue;
|
|
267
269
|
this.watchIsIcon(this.isIcon);
|
|
@@ -270,7 +272,6 @@ export class MgMenuItem {
|
|
|
270
272
|
* has focus value in dataset
|
|
271
273
|
* @param newValue - new direction value
|
|
272
274
|
*/
|
|
273
|
-
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
274
275
|
watchDataHasFocus(newValue) {
|
|
275
276
|
if (!isValidString(newValue))
|
|
276
277
|
this.updateExpanded(Boolean(newValue));
|
|
@@ -297,7 +298,7 @@ export class MgMenuItem {
|
|
|
297
298
|
normalizeBooleanAttributes(this);
|
|
298
299
|
// has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
|
|
299
300
|
// we store only matching elements
|
|
300
|
-
this.hasChildren = Array.from(this.element.children).some(child => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
|
|
301
|
+
this.hasChildren = Array.from(this.element.children).some((child) => !['image', 'information', 'label', 'metadata'].includes(child.getAttribute('slot')));
|
|
301
302
|
this.messages = initLocales(this.element).messages.menuItem;
|
|
302
303
|
this.isItemMore = this.element.dataset.overflowMore !== undefined;
|
|
303
304
|
// watchers
|
|
@@ -322,12 +323,12 @@ export class MgMenuItem {
|
|
|
322
323
|
this.updateItem([Status.ACTIVE]);
|
|
323
324
|
// emit loaded event when component is fully loaded
|
|
324
325
|
this.itemLoaded.emit();
|
|
325
|
-
new MutationObserver(mutationsList => {
|
|
326
|
-
if (mutationsList.some(mutation => ['hidden', 'status'].includes(mutation.attributeName)))
|
|
326
|
+
new MutationObserver((mutationsList) => {
|
|
327
|
+
if (mutationsList.some((mutation) => ['hidden', 'status'].includes(mutation.attributeName)))
|
|
327
328
|
this.updateStatus(this.hasChildren ? undefined : [Status.ACTIVE]);
|
|
328
|
-
if (mutationsList.some(mutation => mutation.type === 'characterData'))
|
|
329
|
+
if (mutationsList.some((mutation) => mutation.type === 'characterData'))
|
|
329
330
|
this.updateSlot();
|
|
330
|
-
if (mutationsList.some(mutation => mutation.type === 'childList'))
|
|
331
|
+
if (mutationsList.some((mutation) => mutation.type === 'childList'))
|
|
331
332
|
this.updateItem();
|
|
332
333
|
this.itemUpdated.emit();
|
|
333
334
|
}).observe(this.element, { attributes: true, childList: true, characterData: true, subtree: true });
|
|
@@ -372,7 +373,7 @@ export class MgMenuItem {
|
|
|
372
373
|
['mg-c-menu-item__collapse-container']: true,
|
|
373
374
|
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu() || this.isItemMore) && this.isDirection(directions.HORIZONTAL),
|
|
374
375
|
});
|
|
375
|
-
return (h(Host, { key: '
|
|
376
|
+
return (h(Host, { key: '68705299d83c64af9e915a6e4d471e78ed6d92ab', role: this.isItemMore ? 'presentation' : 'listitem' }, this.hasPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", "onDisplay-change": this.handlePopoverDisplay, identifier: this.popoverIdentifier, "data-fallback-placement": "bottom-end" // use for the last element of the menu if it is placed on the right side
|
|
376
377
|
}, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
377
378
|
this.renderInteractiveElement(),
|
|
378
379
|
h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
@@ -544,7 +545,7 @@ export class MgMenuItem {
|
|
|
544
545
|
"composed": true,
|
|
545
546
|
"docs": {
|
|
546
547
|
"tags": [],
|
|
547
|
-
"text": "
|
|
548
|
+
"text": "Emitted event when item is loaded"
|
|
548
549
|
},
|
|
549
550
|
"complexType": {
|
|
550
551
|
"original": "void",
|
|
@@ -559,7 +560,7 @@ export class MgMenuItem {
|
|
|
559
560
|
"composed": true,
|
|
560
561
|
"docs": {
|
|
561
562
|
"tags": [],
|
|
562
|
-
"text": "
|
|
563
|
+
"text": "Emitted event when item is updated"
|
|
563
564
|
},
|
|
564
565
|
"complexType": {
|
|
565
566
|
"original": "void",
|
|
@@ -11,7 +11,8 @@ import { initLocales } from "../../../locales";
|
|
|
11
11
|
const isMgActionMoreItems = (prop) => {
|
|
12
12
|
const items = prop;
|
|
13
13
|
return (typeof items === 'object' &&
|
|
14
|
-
items.every(item => (typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function') ||
|
|
14
|
+
items.every((item) => (typeof item === 'object' && typeof item.label === 'string' && typeof item.mouseEventHandler === 'function') ||
|
|
15
|
+
isMgActionMoreDivider(item)));
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* MgActionMoreDividerType type guard
|
|
@@ -93,7 +94,9 @@ export class MgActionMore {
|
|
|
93
94
|
if (!isMgActionMoreItems(newValue)) {
|
|
94
95
|
throw new Error(`<${this.name}> prop "items" is required and all values must be the same type, MgActionMoreItemType or MgActionMoreDividerType. Passed value: ${toString(newValue)}.`);
|
|
95
96
|
}
|
|
96
|
-
else if (isMgActionMoreItems(newValue) &&
|
|
97
|
+
else if (isMgActionMoreItems(newValue) &&
|
|
98
|
+
newValue.length > 0 &&
|
|
99
|
+
(isMgActionMoreDivider(newValue[0]) || isMgActionMoreDivider(newValue[newValue.length - 1]))) {
|
|
97
100
|
throw new Error(`<${this.name}> prop "items" can’t have a divider at the beginning or the end of the array. Passed value: ${toString(newValue)}.`);
|
|
98
101
|
}
|
|
99
102
|
}
|
|
@@ -141,11 +144,11 @@ export class MgActionMore {
|
|
|
141
144
|
[`${this.classBase}__chevron--rotate`]: this.expanded === true,
|
|
142
145
|
} }, h("mg-icon", { icon: "chevron-down" })));
|
|
143
146
|
}
|
|
144
|
-
return (h(Host, { key: '
|
|
147
|
+
return (h(Host, { key: 'c72c7ee9bdb39f2361fdcb9f670cc679efdd3589', "data-mg-popover-guard": this.mgPopoverIdentifier }, h("span", { key: 'dd88d690d4600868bc485770b657b46afeccc727', class: this.classBase }, h("mg-popover", { key: 'eaecf2ec0fca98c0233240711ff7fed17374cd81', identifier: this.mgPopoverIdentifier, display: this.expanded, "onDisplay-change": this.handleDisplayChange, "data-fallback-placement": "bottom-end" }, h("mg-button", { key: 'edb2e8556cbfe06aef62caea435205208722dd04', variant: this.button.variant, isIcon: this.button.isIcon, disabled: this.button.disabled, type: "button", label: buttonLabel, onClick: this.handleButton }, this.icon && h("mg-icon", Object.assign({ key: 'a7a5c5bbc906da8dee937312fe373e97d9d74346' }, this.icon)), !this.button.isIcon && buttonContent), h("div", { key: '83cda3d619de43ab8a75605d20082b31230cd7e2', slot: "content" }, h("mg-menu", { key: '37d0fd99fcafb3eb6f2a56a7a805523348146419', direction: directions.VERTICAL, label: this.messages.label }, this.items.map((item) => {
|
|
145
148
|
var _a, _b;
|
|
146
149
|
return isMgActionMoreDivider(item) ? (h("mg-divider", { class: "mg-c-action-more__divider", key: "divider", "full-width": true })) : (h("mg-menu-item", { key: item.label, status: item.status || Status.VISIBLE, target: item.target, href: item.href,
|
|
147
150
|
// eslint-disable-next-line react/jsx-no-bind
|
|
148
|
-
onClick: e => this.handleItemClick(e, item.mouseEventHandler) }, ((_a = item.icon) === null || _a === void 0 ? void 0 : _a.icon) && h("mg-icon", { icon: item.icon.icon, variant: item.icon.variant, variantStyle: item.icon.variantStyle, slot: "image" }), h("span", { slot: "label" }, item.label), ((_b = item.badge) === null || _b === void 0 ? void 0 : _b.label) && h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" })));
|
|
151
|
+
onClick: (e) => this.handleItemClick(e, item.mouseEventHandler) }, ((_a = item.icon) === null || _a === void 0 ? void 0 : _a.icon) && (h("mg-icon", { icon: item.icon.icon, variant: item.icon.variant, variantStyle: item.icon.variantStyle, slot: "image" })), h("span", { slot: "label" }, item.label), ((_b = item.badge) === null || _b === void 0 ? void 0 : _b.label) && (h("mg-badge", { label: item.badge.label, value: item.badge.value, slot: "information", variant: "text-color" }))));
|
|
149
152
|
})))))));
|
|
150
153
|
}
|
|
151
154
|
static get is() { return "mg-action-more"; }
|
|
@@ -60,7 +60,7 @@ export class MgAlert {
|
|
|
60
60
|
// Needed to ensure we don't start the timer
|
|
61
61
|
this[isMouseEvent ? 'isHovered' : 'isFocused'] = true;
|
|
62
62
|
// Restart timer when loose focus AND mouse leave
|
|
63
|
-
this.element.addEventListener(isMouseEvent ? 'mouseleave' : 'focusout', eventOut => {
|
|
63
|
+
this.element.addEventListener(isMouseEvent ? 'mouseleave' : 'focusout', (eventOut) => {
|
|
64
64
|
this[eventOut.type === 'mouseleave' ? 'isHovered' : 'isFocused'] = false;
|
|
65
65
|
// Start timer if needed
|
|
66
66
|
if (!this.isFocused && !this.isHovered)
|
|
@@ -93,7 +93,6 @@ export class MgAlert {
|
|
|
93
93
|
/**
|
|
94
94
|
* Watch hidden prop
|
|
95
95
|
*/
|
|
96
|
-
// eslint-disable-next-line @stencil-community/no-unused-watch
|
|
97
96
|
watchHidden(newValue) {
|
|
98
97
|
if (typeof newValue === 'string' && newValue === '') {
|
|
99
98
|
newValue = true;
|
|
@@ -101,7 +100,7 @@ export class MgAlert {
|
|
|
101
100
|
if (newValue) {
|
|
102
101
|
this.componentHide.emit();
|
|
103
102
|
// Remove event Listener
|
|
104
|
-
['focusin', 'mouseenter'].forEach(event => {
|
|
103
|
+
['focusin', 'mouseenter'].forEach((event) => {
|
|
105
104
|
this.element.removeEventListener(event, this.timerEvents);
|
|
106
105
|
});
|
|
107
106
|
// Clear Timer
|
|
@@ -114,7 +113,7 @@ export class MgAlert {
|
|
|
114
113
|
// Start timer
|
|
115
114
|
this.setTimer();
|
|
116
115
|
// Stop timer when get focus or mouse enter
|
|
117
|
-
['focusin', 'mouseenter'].forEach(event => {
|
|
116
|
+
['focusin', 'mouseenter'].forEach((event) => {
|
|
118
117
|
this.element.addEventListener(event, this.timerEvents);
|
|
119
118
|
});
|
|
120
119
|
}
|
|
@@ -146,7 +145,7 @@ export class MgAlert {
|
|
|
146
145
|
* @returns HTML Element
|
|
147
146
|
*/
|
|
148
147
|
render() {
|
|
149
|
-
return (h("mg-message", { key: '
|
|
148
|
+
return (h("mg-message", { key: 'a691799e6151febf9a74c5a6a539f3bddb1795cf', class: this.classCollection.join(), role: ['info', 'success'].includes(this.variant) ? 'status' : 'alert', variant: this.variant, variantStyle: this.variantStyle, fullWidth: this.fullWidth }, h("slot", { key: '70780ccab7dc02b5e2e9f805df0d242252f5d383' }), this.hasActions ? (h("span", { slot: "actions" }, h("slot", { name: "actions" }))) : (h("span", { class: "mg-c-alert__close-button" }, h("mg-button", { "is-icon": true, variant: "flat", label: this.messages.alert.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" }))))));
|
|
150
149
|
}
|
|
151
150
|
static get is() { return "mg-alert"; }
|
|
152
151
|
static get encapsulation() { return "shadow"; }
|
|
@@ -272,7 +271,7 @@ export class MgAlert {
|
|
|
272
271
|
"composed": true,
|
|
273
272
|
"docs": {
|
|
274
273
|
"tags": [],
|
|
275
|
-
"text": "
|
|
274
|
+
"text": "Emitted event when alert is diplayed"
|
|
276
275
|
},
|
|
277
276
|
"complexType": {
|
|
278
277
|
"original": "void",
|
|
@@ -287,7 +286,7 @@ export class MgAlert {
|
|
|
287
286
|
"composed": true,
|
|
288
287
|
"docs": {
|
|
289
288
|
"tags": [],
|
|
290
|
-
"text": "
|
|
289
|
+
"text": "Emitted event when alert is hidden"
|
|
291
290
|
},
|
|
292
291
|
"complexType": {
|
|
293
292
|
"original": "void",
|
|
@@ -8,16 +8,34 @@ import { isValidString, toString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
|
8
8
|
*/
|
|
9
9
|
const isBreadcrumbItems = (items) => Array.isArray(items) &&
|
|
10
10
|
items.length > 0 &&
|
|
11
|
-
items.every((item, index) => typeof item === 'object' &&
|
|
11
|
+
items.every((item, index) => typeof item === 'object' &&
|
|
12
|
+
item !== null &&
|
|
13
|
+
isValidString(item.label) &&
|
|
14
|
+
(index === items.length - 1 || isValidString(item.href)));
|
|
12
15
|
export class MgBreadcrumb {
|
|
16
|
+
constructor() {
|
|
17
|
+
/***********
|
|
18
|
+
* Methods *
|
|
19
|
+
**********/
|
|
20
|
+
/**
|
|
21
|
+
* Handle item link click: emit item-click event and conditionally prevent native navigation
|
|
22
|
+
* @param event - mouse event
|
|
23
|
+
* @param item - the clicked breadcrumb item
|
|
24
|
+
*/
|
|
25
|
+
this.handleItemClick = (event, item) => {
|
|
26
|
+
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey || event.button === 1)
|
|
27
|
+
return;
|
|
28
|
+
const customEvent = this.itemClick.emit(item);
|
|
29
|
+
if (customEvent.defaultPrevented) {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
13
34
|
validateItems(newValue) {
|
|
14
35
|
if (newValue === undefined || !isBreadcrumbItems(newValue)) {
|
|
15
36
|
throw new Error(`<mg-breadcrumb> prop "items" is required and all values must be the same type, BreadcrumbItemType. Passed value: ${toString(newValue)}.`);
|
|
16
37
|
}
|
|
17
38
|
}
|
|
18
|
-
/***********
|
|
19
|
-
* Methods *
|
|
20
|
-
**********/
|
|
21
39
|
/**
|
|
22
40
|
* Render a single breadcrumb item (link or current page)
|
|
23
41
|
* @param item - The breadcrumb item
|
|
@@ -26,7 +44,7 @@ export class MgBreadcrumb {
|
|
|
26
44
|
*/
|
|
27
45
|
renderItem(item, isLast) {
|
|
28
46
|
if (isValidString(item.href)) {
|
|
29
|
-
return (h("a", { href: item.href, "aria-label": item.icon !== undefined ? item.label : undefined, "aria-current": isLast ? 'page' : undefined }, item.icon !== undefined ? h("mg-icon", { icon: item.icon }) : item.label));
|
|
47
|
+
return (h("a", { href: item.href, "aria-label": item.icon !== undefined ? item.label : undefined, "aria-current": isLast ? 'page' : undefined, onClick: (e) => this.handleItemClick(e, item) }, item.icon !== undefined ? h("mg-icon", { icon: item.icon }) : item.label));
|
|
30
48
|
}
|
|
31
49
|
return h("span", null, item.label);
|
|
32
50
|
}
|
|
@@ -38,7 +56,7 @@ export class MgBreadcrumb {
|
|
|
38
56
|
this.messages = initLocales(this.element).messages.breadcrumb;
|
|
39
57
|
}
|
|
40
58
|
render() {
|
|
41
|
-
return (h("nav", { key: '
|
|
59
|
+
return (h("nav", { key: '17a4a416bb3b1a0fa98846fdcb9f9e8183b15fc3', "aria-label": this.messages.label, class: "mg-c-breadcrumb" }, h("ol", { key: '674d5c7e6331bce5c8b7a0cf5581db2aad29a385', class: "mg-c-breadcrumb__list" }, this.items.map((item, index) => {
|
|
42
60
|
var _a;
|
|
43
61
|
return (h("li", { key: `${index}-${(_a = item.href) !== null && _a !== void 0 ? _a : item.label}`, class: "mg-c-breadcrumb__list-item" }, this.renderItem(item, index === this.items.length - 1)));
|
|
44
62
|
}))));
|
|
@@ -83,6 +101,31 @@ export class MgBreadcrumb {
|
|
|
83
101
|
}
|
|
84
102
|
};
|
|
85
103
|
}
|
|
104
|
+
static get events() {
|
|
105
|
+
return [{
|
|
106
|
+
"method": "itemClick",
|
|
107
|
+
"name": "item-click",
|
|
108
|
+
"bubbles": true,
|
|
109
|
+
"cancelable": true,
|
|
110
|
+
"composed": true,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Emitted event when item link is clicked"
|
|
114
|
+
},
|
|
115
|
+
"complexType": {
|
|
116
|
+
"original": "BreadcrumbItemType",
|
|
117
|
+
"resolved": "{ label: string; href?: string; icon?: \"filter\" | \"address-card\" | \"address-card-outline\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"arrows-up-down\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building\" | \"building-outline\" | \"calculator\" | \"calculator-outline\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-exclamation\" | \"comment-exclamation-outline\" | \"comment-outline\" | \"comment-question\" | \"comment-question-outline\" | \"comment-sms\" | \"comment-sms-outline\" | \"conversation\" | \"conversation-outline\" | \"copy\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"download\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-outline\" | \"eye-slash\" | \"eye-slash-outline\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-cog-outline\" | \"file-download\" | \"file-download-outline\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-upload-outline\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-checked\" | \"floppy-disk-checked-outline\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folder-star-outline\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"glitters\" | \"glitters-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-euro\" | \"hand-euro-outline\" | \"hand-up\" | \"history\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"key\" | \"laptop\" | \"layers\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"link\" | \"list\" | \"loader\" | \"location\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-open\" | \"mail-open-outline\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-outline\" | \"paper-plane-slash\" | \"paper-plane-slash-outline\" | \"paperclip\" | \"pause\" | \"pause-outline\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"plus-circle-outline\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sidebar-arrow-left\" | \"sidebar-arrow-right\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"table\" | \"tag\" | \"tag-outline\" | \"tags\" | \"tags-outline\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"universal-access-outline\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-group-outline\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"; }",
|
|
118
|
+
"references": {
|
|
119
|
+
"BreadcrumbItemType": {
|
|
120
|
+
"location": "import",
|
|
121
|
+
"path": "./mg-breadcrumb.conf",
|
|
122
|
+
"id": "src/components/molecules/mg-breadcrumb/mg-breadcrumb.conf.ts::BreadcrumbItemType",
|
|
123
|
+
"referenceLocation": "BreadcrumbItemType"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}];
|
|
128
|
+
}
|
|
86
129
|
static get elementRef() { return "element"; }
|
|
87
130
|
static get watchers() {
|
|
88
131
|
return [{
|
|
@@ -55,7 +55,7 @@ export class MgDetails {
|
|
|
55
55
|
* @returns HTML Element
|
|
56
56
|
*/
|
|
57
57
|
render() {
|
|
58
|
-
return (h("details", { key: '
|
|
58
|
+
return (h("details", { key: '78dbeab3b3e6c245bda8fad5900b70727fd47595', class: { 'mg-c-details': true, 'mg-c-details--empty-summary': this.isEmptySummary }, onToggle: this.handleToggle, open: this.expanded, ref: (el) => (this.details = el) }, h("summary", { key: '766e4756a66a1f8e6bc2159f30133a0702353f32' }, h("slot", { key: '3473dd0c0fc7de78c1d7ae6f9ee4a4d2fc7835ee', name: "summary" }), h("span", { key: '7c8d3da4df69d2802f104caaf568ac513f9f03b6', class: "mg-c-details__toggle" }, h("mg-icon", { key: '44da384780ab768bde20acb58885280e193de921', icon: "chevron-up", class: { 'mg-c-details__toggle-icon': true, 'mg-c-details__toggle-icon--reverse': !this.expanded } }), h("span", { key: '387de0caa5ae819c89449e5063e0b6e05b3df8fe', class: { 'mg-u-visually-hidden': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { key: '48c1fe8df990a250f098594d9b50df947613955c', class: "mg-c-details__details" }, h("slot", { key: '95554b4d890750cc3b3008965be3e5954d49d810', name: "details" }))));
|
|
59
59
|
}
|
|
60
60
|
static get is() { return "mg-details"; }
|
|
61
61
|
static get encapsulation() { return "shadow"; }
|
|
@@ -34,7 +34,7 @@ export class MgFieldset {
|
|
|
34
34
|
*/
|
|
35
35
|
this.checkValidity = () => {
|
|
36
36
|
var _a;
|
|
37
|
-
this.valid = !(this.mgInputs.some(input => input.invalid) || ((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
37
|
+
this.valid = !(this.mgInputs.some((input) => input.invalid) || ((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
38
38
|
};
|
|
39
39
|
/**
|
|
40
40
|
* Set mgInputs
|
|
@@ -44,7 +44,7 @@ export class MgFieldset {
|
|
|
44
44
|
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT'));
|
|
45
45
|
// Set inputs readonly or disabled based on form configuration
|
|
46
46
|
// Othewise listen to events
|
|
47
|
-
this.mgInputs.forEach(input => {
|
|
47
|
+
this.mgInputs.forEach((input) => {
|
|
48
48
|
// manage special display case for mg-input-file
|
|
49
49
|
if (input.nodeName === 'MG-INPUT-FILE') {
|
|
50
50
|
if (this.readonly) {
|
|
@@ -101,7 +101,7 @@ export class MgFieldset {
|
|
|
101
101
|
*/
|
|
102
102
|
async displayError() {
|
|
103
103
|
if (!this.readonly) {
|
|
104
|
-
this.mgInputs.forEach(input => {
|
|
104
|
+
this.mgInputs.forEach((input) => {
|
|
105
105
|
input.displayError();
|
|
106
106
|
});
|
|
107
107
|
}
|
|
@@ -124,8 +124,8 @@ export class MgFieldset {
|
|
|
124
124
|
componentDidLoad() {
|
|
125
125
|
// Update mgInputs when mgForm content change
|
|
126
126
|
const observerOptions = { childList: true, subtree: true };
|
|
127
|
-
new MutationObserver(mutations => {
|
|
128
|
-
if (mutations.some(mutation => Object.keys(observerOptions).includes(mutation.type))) {
|
|
127
|
+
new MutationObserver((mutations) => {
|
|
128
|
+
if (mutations.some((mutation) => Object.keys(observerOptions).includes(mutation.type))) {
|
|
129
129
|
this.setMgInputs();
|
|
130
130
|
}
|
|
131
131
|
}).observe(this.element, observerOptions);
|
|
@@ -135,7 +135,7 @@ export class MgFieldset {
|
|
|
135
135
|
* @returns HTML Element
|
|
136
136
|
*/
|
|
137
137
|
render() {
|
|
138
|
-
return (h("mg-input", { key: '
|
|
138
|
+
return (h("mg-input", { key: '79ffc6a9c1fe3b06ef94952cf0e37fe50d9fb642', label: this.legend, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: !this.legendHide, labelHeading: this.legendHeading, labelBorderDisplay: this.legendHeading && this.legendBorderDisplay, labelHide: this.legendHide, inputsOnBottom: this.legendHeading !== undefined, tooltip: this.tooltip, tooltipPosition: 'label', helpText: this.helpText, errorMessage: !this.valid && isValidString(this.errorMessage) ? this.errorMessage : undefined }, h("span", { key: '6888e7c1a04147ca09d13e869684292be51105c6', class: "mg-c-input__input-group" }, h("slot", { key: 'd7785630e0f9b640a27568e8ce054c2ab89e0c14' }))));
|
|
139
139
|
}
|
|
140
140
|
static get is() { return "mg-fieldset"; }
|
|
141
141
|
static get encapsulation() { return "shadow"; }
|