@mgdis/mg-components 6.5.0 → 6.6.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-ede3b3dc.js → index-019dd5c0.js} +2 -2
- package/dist/cjs/{index-ede3b3dc.js.map → index-019dd5c0.js.map} +1 -1
- package/dist/cjs/index-1a5a1081.js +4 -0
- package/dist/cjs/{index.es-a112f649.js → index.es-903492c5.js} +26 -27
- package/dist/cjs/index.es-903492c5.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_36.cjs.entry.js +230 -196
- package/dist/cjs/mg-action-more_36.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +4 -4
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +16790 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js.map +1 -0
- package/dist/cjs/mg-input.conf-5bbcea79.js +23 -0
- package/dist/cjs/mg-input.conf-5bbcea79.js.map +1 -0
- package/dist/cjs/mg-loader.cjs.entry.js +3 -3
- package/dist/cjs/mg-progress.cjs.entry.js +2 -2
- package/dist/collection/assets/icons/index.js +1 -1
- package/dist/collection/assets/icons/index.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +3 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +110 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +846 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +3 -5
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +4 -4
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +16 -17
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +8 -6
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +3 -3
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +2 -2
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js +5 -2
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +74 -17
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js.map +1 -1
- 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 +3 -3
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +3 -3
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/types/index.js.map +1 -1
- package/dist/collection/utils/behaviors.utils.js +4 -1
- package/dist/collection/utils/behaviors.utils.js.map +1 -1
- package/dist/collection/utils/floating-ui.utils.js +1 -6
- package/dist/collection/utils/floating-ui.utils.js.map +1 -1
- package/dist/components/floating-ui.utils.js +1 -6
- package/dist/components/floating-ui.utils.js.map +1 -1
- package/dist/components/index.es.js +24 -25
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/mg-action-more.js +2 -2
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-alert.js +3 -3
- package/dist/components/mg-badge2.js +2 -2
- package/dist/components/mg-button2.js +2 -2
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-card2.js.map +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-form.js +4 -4
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon2.js +3 -3
- package/dist/components/mg-icon2.js.map +1 -1
- package/dist/components/mg-illustrated-message.js +69 -16
- package/dist/components/mg-illustrated-message.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +4 -4
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-date.js +7 -7
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +9 -9
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +3 -3
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +5 -5
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-rich-text-editor.d.ts +11 -0
- package/dist/components/mg-input-rich-text-editor.js +16866 -0
- package/dist/components/mg-input-rich-text-editor.js.map +1 -0
- package/dist/components/mg-input-select2.js +6 -6
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +7 -9
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +5 -5
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-toggle.js +4 -4
- package/dist/components/mg-input2.js +1 -1
- package/dist/components/mg-input2.js.map +1 -1
- package/dist/components/mg-item-more2.js +17 -15
- package/dist/components/mg-item-more2.js.map +1 -1
- package/dist/components/mg-loader.js +1 -1
- package/dist/components/mg-menu-item2.js +11 -9
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-message2.js +4 -4
- package/dist/components/mg-modal.js +4 -4
- package/dist/components/mg-pagination2.js +3 -3
- package/dist/components/mg-panel.js +3 -3
- package/dist/components/mg-popover-content2.js +4 -4
- package/dist/components/mg-popover2.js +3 -3
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-progress.js +1 -1
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs.js +4 -4
- package/dist/components/mg-tag.js +2 -2
- package/dist/components/mg-tooltip2.js +5 -5
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/index-5059254f.js +4 -0
- package/dist/esm/{index-a7c3b5c5.js → index-6b7bdd63.js} +2 -2
- package/dist/esm/{index-a7c3b5c5.js.map → index-6b7bdd63.js.map} +1 -1
- package/dist/esm/{index.es-5e0101ac.js → index.es-b80b758c.js} +25 -26
- package/dist/esm/index.es-b80b758c.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_36.entry.js +181 -147
- package/dist/esm/mg-action-more_36.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +4 -4
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-input-rich-text-editor.entry.js +16786 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js.map +1 -0
- package/dist/esm/mg-input.conf-712c7bb6.js +16 -0
- package/dist/esm/mg-input.conf-712c7bb6.js.map +1 -0
- package/dist/esm/mg-loader.entry.js +3 -3
- package/dist/esm/mg-progress.entry.js +2 -2
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/{p-2403e01d.entry.js → p-0ae49cc4.entry.js} +2 -2
- package/dist/mg-components/p-17f0b7eb.entry.js +2 -0
- package/dist/mg-components/p-17f0b7eb.entry.js.map +1 -0
- package/dist/mg-components/p-1c126a81.entry.js +2 -0
- package/dist/mg-components/p-1c126a81.entry.js.map +1 -0
- package/dist/mg-components/p-2884f369.js +2 -0
- package/dist/mg-components/p-2884f369.js.map +1 -0
- package/dist/mg-components/{p-ad64ab4a.entry.js → p-361cc090.entry.js} +2 -2
- package/dist/mg-components/p-3c6710be.js +2 -0
- package/dist/mg-components/p-3c6710be.js.map +1 -0
- package/dist/mg-components/{p-d9731ebc.js → p-4049bd40.js} +2 -2
- package/dist/mg-components/{p-1a162791.entry.js → p-c4f37d1f.entry.js} +2 -2
- package/dist/types/assets/icons/index.d.ts +1 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/index.d.ts +21 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +202 -0
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +2 -6
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +3 -2
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +4 -3
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.conf.d.ts +10 -3
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +17 -3
- package/dist/types/components.d.ts +217 -8
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/utils/floating-ui.utils.d.ts +1 -1
- package/ide/intellij/web-types.json +374 -17
- package/ide/vscode/css-custom-data.json +4 -0
- package/ide/vscode/html-custom-data.json +289 -4
- package/package.json +21 -20
- package/dist/cjs/index.es-a112f649.js.map +0 -1
- package/dist/esm/index.es-5e0101ac.js.map +0 -1
- package/dist/mg-components/p-6c831a83.entry.js +0 -2
- package/dist/mg-components/p-6c831a83.entry.js.map +0 -1
- package/dist/mg-components/p-b6c1a6ce.js +0 -2
- package/dist/mg-components/p-b6c1a6ce.js.map +0 -1
- /package/dist/mg-components/{p-2403e01d.entry.js.map → p-0ae49cc4.entry.js.map} +0 -0
- /package/dist/mg-components/{p-ad64ab4a.entry.js.map → p-361cc090.entry.js.map} +0 -0
- /package/dist/mg-components/{p-d9731ebc.js.map → p-4049bd40.js.map} +0 -0
- /package/dist/mg-components/{p-1a162791.entry.js.map → p-c4f37d1f.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { Z as Ze, V as Ve, J as Je, m as me } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$5, b as classReadonly, e as classDisabled } from './mg-input2.js';
|
|
4
4
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
5
5
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
@@ -61,7 +61,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
61
61
|
/**
|
|
62
62
|
* Component classes
|
|
63
63
|
*/
|
|
64
|
-
this.classCollection = new
|
|
64
|
+
this.classCollection = new Ze(['mg-c-input--toggle']);
|
|
65
65
|
/**
|
|
66
66
|
* Checked internal value
|
|
67
67
|
*/
|
|
@@ -125,7 +125,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
125
125
|
throw new Error(`<mg-input-toggle> prop "items" require 2 items. Passed value: ${Ve(newValue)}.`);
|
|
126
126
|
}
|
|
127
127
|
// String array
|
|
128
|
-
else if (
|
|
128
|
+
else if (Je(newValue)) {
|
|
129
129
|
this.options = newValue.map(item => ({ title: item, value: item }));
|
|
130
130
|
}
|
|
131
131
|
// Object array
|
|
@@ -248,7 +248,7 @@ const MgInputToggle$1 = /*@__PURE__*/ proxyCustomElement(class MgInputToggle ext
|
|
|
248
248
|
*/
|
|
249
249
|
render() {
|
|
250
250
|
const checkedItem = this.getCheckedItem(this.checked);
|
|
251
|
-
return (h("mg-input", { key: '
|
|
251
|
+
return (h("mg-input", { key: 'cb5b7d47c6c0550d4c413894fda26e3e1dfd360a', label: this.label, helpText: this.helpText, identifier: this.identifier, class: this.classCollection.join(), ariaDescribedbyIDs: [], labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: undefined, tooltip: this.tooltip, tooltipPosition: this.tooltipPosition, errorMessage: this.errorMessage }, this.readonly ? (checkedItem && h("b", { class: "mg-c-input__readonly-value" }, checkedItem.title)) : (h("button", { type: "button", role: "switch", "aria-checked": this.checked.toString(), "aria-readonly": this.disabled || this.readonly, id: this.identifier, class: "mg-c-input__button-toggle", disabled: this.disabled || this.readonly, onClick: this.toggleChecked }, 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" }))))));
|
|
252
252
|
}
|
|
253
253
|
get element() { return this; }
|
|
254
254
|
static get watchers() { return {
|
|
@@ -254,7 +254,7 @@ const MgInput = /*@__PURE__*/ proxyCustomElement(class MgInput extends HTMLEleme
|
|
|
254
254
|
*/
|
|
255
255
|
render() {
|
|
256
256
|
const isGroup = this.isFieldset && !this.isReadonly;
|
|
257
|
-
return (h(Host, { key: '
|
|
257
|
+
return (h(Host, { key: '77264d2ab6e11c17aa41084e1a92a1f73ca0dfdb', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: '4ad77f1659c1b89fd162a9a5c12cdedaaa6be803', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: 'b542d2b90f48a2cc40cde20f1ee17e69770f13c6', name: this.slotLabel }), this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: 'ef262dc7bfef3b06bc261b2755c317e5c8d8c710', class: "mg-c-input__input-container" }, h("div", { key: '4ec59056ceebad738164f242dd272a5bdb89aaa0', class: "mg-c-input__input" }, h("slot", { key: '1cefe1817b4c33cac440fe6cde1cb780bde52c05' }), this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()), this.helptextMessageSlotElement && (h("div", { key: '568732b397b397195f123376ef1a958a8043dc28', class: "mg-c-input__help-text" }, h("slot", { key: '98092704188057b00b24815ab03d874b96d46b4c', name: this.slotHelpText }))), !this.isDisabled && this.errorMessage && (h("div", { key: 'd72f798a577b626b8b7d0de4094b68c4fd105535', class: "mg-c-input__error", "aria-live": "assertive" }, h("slot", { key: 'd258365216d2a3f1810776b06f603aa392e12808', name: this.slotError }))))));
|
|
258
258
|
}
|
|
259
259
|
get element() { return this; }
|
|
260
260
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-input2.js","mappings":";;;;;;;AAAA;;;MAGa,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAW;AAIlD;;;AAGO,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,CAAU,CAAC;MAoC/C,aAAa,GAAG,uBAAuB;MACvC,aAAa,GAAG,uBAAuB;MACvC,aAAa,GAAG,uBAAuB;MACvC,iBAAiB,GAAG;;ACjDjC,MAAM,UAAU,GAAG,wgJAAwgJ,CAAC;AAC5hJ,sBAAe,UAAU;;MCcZ,OAAO;IALpB;;;;QAamB,cAAS,GAAG,OAAO,CAAC;QACpB,cAAS,GAAG,OAAO,CAAC;QACpB,iBAAY,GAAG,WAAW,CAAC;;QAO3B,eAAU,GAAG,YAAY,CAAC;QAC1B,kBAAa,GAAG,uBAAuB,CAAC;QACxC,oBAAe,GAAG,0BAA0B,CAAC;;;;QAgDtD,cAAS,GAAY,KAAK,CAAC;;;;QAiB3B,oBAAe,GAAoB,OAAO,CAAC;;;;QAW3C,aAAQ,GAAY,KAAK,CAAC;;;;QAgFzB,e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C,aAAa,EAAE,CAC7G,EACN,4DAAK,KAAK,EAAC,6BAA6B,IACtC,4DAAK,KAAK,EAAC,mBAAmB,IAC5B,8DAAa,EACZ,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,eAAe,KAAK,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAC7G,EACL,IAAI,CAAC,0BAA0B,KAC9B,4DAAK,KAAK,EAAC,uBAAuB,IAChC,6DAAM,IAAI,EAAE,IAAI,CAAC,YAAY,GAAS,CAClC,CACP,EACA,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,YAAY,KACpC,4DAAK,KAAK,EAAC,mBAAmB,eAAW,WAAW,IAClD,6DAAM,IAAI,EAAE,IAAI,CAAC,SAAS,GAAS,CAC/B,CACP,CACG,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["isValidString","toString","isValideID"],"sources":["src/components/molecules/inputs/mg-input/mg-input.conf.ts","../styles/dist/components/mg-input.css?tag=mg-input&encapsulation=shadow","src/components/molecules/inputs/mg-input/mg-input.tsx"],"sourcesContent":["/**\n * Possible input width\n */\nexport const widths = [2, 4, 16, 'full'] as const;\n\nexport type Width = (typeof widths)[number];\n\n/**\n * Possible tootltip postions\n */\nexport const tooltipPositions = ['input', 'label'] as const;\n\nexport type TooltipPosition = (typeof tooltipPositions)[number];\n\n/**\n * Base interface for common methods\n */\ninterface InputBaseMethods {\n required: boolean;\n invalid: boolean;\n labelOnTop: boolean;\n readonly: boolean;\n displayError: () => Promise<void>;\n reset: () => Promise<void>;\n}\n\n/**\n * Possible Input types\n */\nexport type HTMLMgInputsElement =\n | (HTMLMgInputElement & InputBaseMethods)\n | HTMLMgInputCheckboxElement\n | HTMLMgInputDateElement\n | HTMLMgInputNumericElement\n | HTMLMgInputPasswordElement\n | HTMLMgInputRadioElement\n | HTMLMgInputSelectElement\n | HTMLMgInputTextElement\n | HTMLMgInputTextareaElement\n | (HTMLMgInputToggleElement & InputBaseMethods);\n\n/**\n * Available WindowEvent types\n */\nexport type EventType = keyof WindowEventMap & 'blur';\n\nexport const classFieldset = 'mg-c-input--fieldset';\nexport const classDisabled = 'mg-c-input--disabled';\nexport const classReadonly = 'mg-c-input--readonly';\nexport const classVerticalList = 'mg-c-input--vertical-list';\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-input-border-width: Defines the width of the input border. Default value is `--mg-b-size-border`.\n * @prop --mg-c-input-border-radius: Defines the border radius of the input. Default value is `--mg-b-size-radius`.\n * @prop --mg-c-input-color-border: Defines the color of the input border. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-placeholder-color-text: Defines the color of the placeholder text. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-color-box-shadow-focus: Defines the shadow color of the input when focused. Default value is `rgba(0, 221, 255, 0.5)`.\n * @prop --mg-c-input-error-color-background: Defines the background color of the input error message. Default value is `color-mix(in srgb, var(--mg-b-color-danger), white 95%)`.\n * @prop --mg-c-input-toggle-border-radius-ratio: Defines the border radius ratio of the input toggle. Default value is `2`.\n * @prop --mg-c-input-check-size: Defines the size of the input check. Default value is `--mg-b-size-16`.\n */:host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;min-height:var(--mg-b-size-min-height);align-items:flex-start}.mg-c-input__input-container{width:100%;min-height:var(--mg-b-size-min-height)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-b-size-16);height:var(--mg-b-size-16);margin-left:var(--mg-b-size-8)}@media print{.mg-c-input__input-container mg-tooltip{display:none}}.mg-c-input__input{display:flex;min-height:var(--mg-b-size-min-height);align-items:center;justify-content:start}.mg-c-input__input mg-tooltip{align-self:baseline;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input ::slotted(.mg-c-input__button-toggle:disabled){opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input__title{display:flex;width:var(--mg-c-input-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);margin-right:var(--mg-c-input-title-horizontal-space, var(--mg-b-size-8));text-align:right}.mg-c-input__title slot[name=label]+mg-tooltip{margin-left:var(--mg-b-size-4)}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input__error{display:inline-block;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-b-size-radius);background:var(--mg-c-input-error-color-background);color:var(--mg-b-color-danger)}.mg-c-input__error ::slotted(*),.mg-c-input__help-text ::slotted(*){font-size:var(--mg-b-font-size-small);text-align:start}:host(:not(.mg-c-input--textarea)) .mg-c-input__input+.mg-c-input__error,:host(:not(.mg-c-input--textarea)) .mg-c-input__input+.mg-c-input__help-text{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--readonly) .mg-c-input__input mg-tooltip{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}:host(.mg-c-input){display:flex;margin-bottom:var(--mg-c-input-margin-bottom, 0)}:host(.mg-c-input.mg-c-input--checkbox) .mg-c-input__input,:host(.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset;align-items:flex-start}:host(.mg-c-input.mg-c-input--checkbox,.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset}:host(.mg-c-input.mg-c-input--fieldset:not(.mg-c-input--checkbox-multi,.mg-c-input--readonly)) .mg-c-input__input-container mg-tooltip{margin-left:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--label-on-top){flex-direction:column}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}@media screen and (max-width: 767px){:host(.mg-c-input){flex-direction:column}:host(.mg-c-input) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}}/*# sourceMappingURL=mg-input.css.map */\n","import { Component, h, Prop, Element, Watch, Host, State } from '@stencil/core';\nimport { isValideID, isValidString, toString } from '@mgdis/stencil-helpers';\nimport { tooltipPositions, type TooltipPosition, classFieldset, classReadonly, classDisabled, classVerticalList } from './mg-input.conf';\n\n/**\n * @slot - Input content\n * @slot label - Label content\n * @slot help-text - Help text content\n * @slot error - error content\n */\n@Component({\n tag: 'mg-input',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input.css',\n shadow: true,\n})\nexport class MgInput {\n /************\n * Internal *\n ************/\n\n // HTML selectors\n private helpTextId: string;\n private helpTextErrorId: string;\n private readonly slotLabel = 'label';\n private readonly slotError = 'error';\n private readonly slotHelpText = 'help-text';\n\n // slots elements\n private errorMessageSlotElement: HTMLElement;\n private helptextMessageSlotElement: HTMLElement;\n\n // style\n private readonly classInput = 'mg-c-input';\n private readonly classHasError = 'mg-c-input--has-error';\n private readonly classLabelOnTop = 'mg-c-input--label-on-top';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n @Watch('identifier')\n watchIdentifier(newValue: MgInput['identifier']): void {\n if (!isValidString(newValue)) {\n throw new Error(`<mg-input> prop \"identifier\" is required and must be a string. Passed value: ${toString(newValue)}.`);\n } else if (!isValideID(newValue)) {\n console.error(`<mg-input> prop \"identifier\" value is invalid. Passed value: ${toString(newValue)}.`);\n } else {\n this.helpTextId = `${this.identifier}-help-text`;\n this.helpTextErrorId = `${this.identifier}-error`;\n }\n }\n\n /**\n * Define input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop?: boolean;\n @Watch('labelOnTop')\n watchLabelOnTop(newValue: MgInput['labelOnTop']): void {\n if (newValue) {\n this.element.classList.add(this.classLabelOnTop);\n } else {\n this.element.classList.remove(this.classLabelOnTop);\n }\n }\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide: boolean = false;\n @Watch('labelHide')\n @Watch('labelOnTop')\n watchLabelConfig(): void {\n if (this.labelHide && this.labelOnTop) {\n throw new Error('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\".');\n }\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip?: string;\n\n /**\n * Define tooltip position\n */\n @Prop() tooltipPosition: TooltipPosition = 'input';\n @Watch('tooltipPosition')\n watchTooltipPosition(newValue: MgInput['tooltipPosition']) {\n if (!tooltipPositions.includes(newValue)) {\n throw new Error(`<mg-input> prop \"tooltipPosition\" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define if input is required\n */\n @Prop() required: boolean = false;\n\n /**\n * Define error message to display\n */\n @Prop() errorMessage?: string;\n @Watch('errorMessage')\n watchErrorMessage(newValue: MgInput['errorMessage']): void {\n if (newValue !== undefined) {\n this.element.classList.add(this.classHasError);\n this.renderErrorMessage();\n } else {\n this.element.classList.remove(this.classHasError);\n this.errorMessageSlotElement?.remove();\n this.errorMessageSlotElement = undefined;\n }\n }\n\n /**\n * Define help text to display\n */\n @Prop() helpText?: string;\n @Watch('helpText')\n watchHelpText(newValue: MgInput['helpText']): void {\n if (newValue && !this.isReadonly) {\n this.renderHelpText();\n } else {\n this.helptextMessageSlotElement?.remove();\n this.helptextMessageSlotElement = undefined;\n }\n }\n\n /**\n * Define aria-describedby ids to link with\n */\n @Prop() ariaDescribedbyIDs: string[];\n @Watch('identifier')\n @Watch('errorMessage')\n @Watch('helpText')\n @Watch('ariaDescribedbyIDs')\n watchAriaDescribedbyIDs(): void {\n if (this.isReadonly) return;\n // a11y IDs\n const ariaDescribedbyIDs = new Set(this.ariaDescribedbyIDs);\n // Help text\n if (this.helpText !== undefined) {\n this.renderHelpText();\n if (!ariaDescribedbyIDs.has(this.helpTextId)) ariaDescribedbyIDs.add(this.helpTextId);\n }\n\n // Error Message\n if (this.errorMessage !== undefined) {\n this.renderErrorMessage();\n if (!ariaDescribedbyIDs.has(this.helpTextErrorId)) ariaDescribedbyIDs.add(this.helpTextErrorId);\n }\n\n this.element.querySelectorAll('input,select,textarea,[role=\"switch\"]').forEach(element => {\n if(ariaDescribedbyIDs.size) element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));\n else element.removeAttribute('aria-describedby');\n });\n }\n\n /**\n * Component classes\n */\n // eslint-disable-next-line @stencil-community/no-unused-watch\n @Watch('class')\n watchClass(): void {\n if (!this.element.classList.contains(this.classInput)) {\n this.element.classList.add(this.classInput);\n }\n this.isFieldset = this.element.classList.contains(classFieldset);\n this.isReadonly = this.element.classList.contains(classReadonly);\n this.isDisabled = this.element.classList.contains(classDisabled);\n this.isVerticalList = this.element.classList.contains(classVerticalList);\n }\n\n /**\n * Element is fieldset\n */\n @State() isFieldset: boolean = false;\n\n /**\n * Element is readonly\n */\n @State() isReadonly: boolean = false;\n\n /**\n * Element is disabled\n */\n @State() isDisabled: boolean = false;\n\n /**\n * Element is disabled\n */\n @State() isVerticalList: boolean = false;\n\n /**\n * Trigger label update\n */\n // eslint-disable-next-line @stencil-community/no-unused-watch\n @Watch('class')\n @Watch('label')\n @Watch('required')\n @Watch('isReadonly')\n @Watch('isFieldset')\n watchLabel(): void {\n if (!isValidString(this.label)) {\n throw new Error(`<mg-input> prop \"label\" is required and must be a string. Passed value: ${toString(this.label)}.`);\n } else {\n this.watchAriaDescribedbyIDs();\n this.renderLabel();\n }\n }\n\n /************\n * Methods *\n ************/\n\n /**\n * Render input label\n */\n private renderLabel(): void {\n let labelSlotElement: HTMLMgInputTitleElement = this.element.querySelector(`[slot=${this.slotLabel}]`);\n\n // first remove previous labelslot if exist\n labelSlotElement?.remove();\n\n // create title element\n labelSlotElement = document.createElement('mg-input-title');\n [\n ['slot', this.slotLabel],\n ['identifier', this.identifier],\n ['readonly', this.isReadonly.toString()],\n ['required', ((this.required && !this.isDisabled) || false).toString()],\n ['is-legend', this.isFieldset.toString()],\n ].forEach(([attr, val]) => {\n labelSlotElement.setAttribute(attr, val);\n });\n\n // create label element\n const label = document.createElement('span');\n label.classList.add('mg-c-input-title__text');\n label.textContent = this.label;\n\n labelSlotElement.appendChild(label);\n this.element.appendChild(labelSlotElement);\n }\n\n /**\n * Render error message\n */\n private renderErrorMessage(): void {\n this.errorMessageSlotElement = this.element.querySelector(`[slot=${this.slotError}]`);\n if (this.errorMessageSlotElement === null) {\n this.errorMessageSlotElement = document.createElement('div');\n this.errorMessageSlotElement.setAttribute('slot', this.slotError);\n this.element.appendChild(this.errorMessageSlotElement);\n }\n this.errorMessageSlotElement.setAttribute('id', this.helpTextErrorId);\n this.errorMessageSlotElement.innerHTML = this.errorMessage;\n }\n\n /**\n * Render help text message\n */\n private renderHelpText(): void {\n this.helptextMessageSlotElement = this.element.querySelector(`[slot=${this.slotHelpText}]`);\n if (this.helptextMessageSlotElement === null) {\n this.helptextMessageSlotElement = document.createElement('div');\n this.helptextMessageSlotElement.setAttribute('slot', this.slotHelpText);\n this.element.appendChild(this.helptextMessageSlotElement);\n }\n this.helptextMessageSlotElement.setAttribute('id', this.helpTextId);\n this.helptextMessageSlotElement.innerHTML = this.helpText;\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n this.watchIdentifier(this.identifier);\n this.watchLabel();\n this.watchClass();\n this.watchLabelOnTop(this.labelOnTop);\n this.watchLabelConfig();\n this.watchTooltipPosition(this.tooltipPosition);\n this.watchHelpText(this.helpText);\n this.watchErrorMessage(this.errorMessage);\n }\n\n /**\n * Validate slots\n */\n componentDidLoad(): void {\n this.watchAriaDescribedbyIDs();\n if (!this.isReadonly && !this.isFieldset && this.element.querySelector(`#${this.identifier}`) === null) {\n throw new Error(`<mg-input> \"identifier\" prop has no target for id: ${this.identifier}. Add an id to the targeted input.`);\n }\n }\n\n /**\n * Get tooltip node\n * @returns mg-tooltip\n */\n private renderTooltip = (): HTMLMgTooltipElement => (\n <mg-tooltip identifier={`${this.identifier}-tooltip`} message={this.tooltip}>\n <mg-icon icon=\"info-circle\"></mg-icon>\n </mg-tooltip>\n );\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const isGroup = this.isFieldset && !this.isReadonly;\n return (\n <Host class={this.element.classList.toString()} role={isGroup ? 'group' : undefined} aria-labelledby={isGroup ? `${this.identifier}-title` : undefined}>\n <div class={{ 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide }}>\n <slot name={this.slotLabel}></slot>\n {this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()}\n </div>\n <div class=\"mg-c-input__input-container\">\n <div class=\"mg-c-input__input\">\n <slot></slot>\n {this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()}\n </div>\n {this.helptextMessageSlotElement && (\n <div class=\"mg-c-input__help-text\">\n <slot name={this.slotHelpText}></slot>\n </div>\n )}\n {!this.isDisabled && this.errorMessage && (\n <div class=\"mg-c-input__error\" aria-live=\"assertive\">\n <slot name={this.slotError}></slot>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
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,CAC/B,CACP,CACG,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["isValidString","toString","isValideID"],"sources":["src/components/molecules/inputs/mg-input/mg-input.conf.ts","../styles/dist/components/mg-input.css?tag=mg-input&encapsulation=shadow","src/components/molecules/inputs/mg-input/mg-input.tsx"],"sourcesContent":["/**\n * Possible input width\n */\nexport const widths = [2, 4, 16, 'full'] as const;\n\nexport type Width = (typeof widths)[number];\n\n/**\n * Possible tootltip postions\n */\nexport const tooltipPositions = ['input', 'label'] as const;\n\nexport type TooltipPosition = (typeof tooltipPositions)[number];\n\n/**\n * Base interface for common methods\n */\ninterface InputBaseMethods {\n required: boolean;\n invalid: boolean;\n labelOnTop: boolean;\n readonly: boolean;\n displayError: () => Promise<void>;\n reset: () => Promise<void>;\n}\n\n/**\n * Possible Input types\n */\nexport type HTMLMgInputsElement =\n | (HTMLMgInputElement & InputBaseMethods)\n | HTMLMgInputCheckboxElement\n | HTMLMgInputDateElement\n | HTMLMgInputNumericElement\n | HTMLMgInputPasswordElement\n | HTMLMgInputRadioElement\n | HTMLMgInputSelectElement\n | HTMLMgInputTextElement\n | HTMLMgInputTextareaElement\n | (HTMLMgInputToggleElement & InputBaseMethods);\n\n/**\n * Available WindowEvent types\n */\nexport type EventType = keyof WindowEventMap & 'blur';\n\nexport const classFieldset = 'mg-c-input--fieldset';\nexport const classDisabled = 'mg-c-input--disabled';\nexport const classReadonly = 'mg-c-input--readonly';\nexport const classVerticalList = 'mg-c-input--vertical-list';\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-input-border-width: Defines the width of the input border. Default value is `--mg-b-size-border`.\n * @prop --mg-c-input-border-radius: Defines the border radius of the input. Default value is `--mg-b-size-radius`.\n * @prop --mg-c-input-color-border: Defines the color of the input border. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-placeholder-color-text: Defines the color of the placeholder text. Default value is `rgb(181, 194, 201)`.\n * @prop --mg-c-input-color-box-shadow-focus: Defines the shadow color of the input when focused. Default value is `rgba(0, 221, 255, 0.5)`.\n * @prop --mg-c-input-error-color-background: Defines the background color of the input error message. Default value is `color-mix(in srgb, var(--mg-b-color-danger), white 95%)`.\n * @prop --mg-c-input-toggle-border-radius-ratio: Defines the border radius ratio of the input toggle. Default value is `2`.\n * @prop --mg-c-input-check-size: Defines the size of the input check. Default value is `--mg-b-size-16`.\n */:host{display:block}.mg-c-input__input mg-icon,.mg-c-input__error mg-icon{display:flex}.mg-c-input{display:flex;min-height:var(--mg-b-size-min-height);align-items:flex-start}.mg-c-input__input-container{width:100%;min-height:var(--mg-b-size-min-height)}.mg-c-input__input-container mg-tooltip{display:inline-flex;width:var(--mg-b-size-16);height:var(--mg-b-size-16);margin-left:var(--mg-b-size-8)}@media print{.mg-c-input__input-container mg-tooltip{display:none}}.mg-c-input__input{display:flex;min-height:var(--mg-b-size-min-height);align-items:center;justify-content:start}.mg-c-input__input mg-tooltip{align-self:baseline;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input__input ::slotted(.mg-c-input__button-toggle:disabled){opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input__title{display:flex;width:var(--mg-c-input-title-width, auto);flex-shrink:0;align-items:baseline;justify-content:flex-end;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);margin-right:var(--mg-c-input-title-horizontal-space, var(--mg-b-size-8));text-align:right}.mg-c-input__title slot[name=label]+mg-tooltip{margin-left:var(--mg-b-size-4)}.mg-c-input__title mg-icon{display:inline-flex;vertical-align:text-bottom}.mg-c-input__error{display:inline-block;padding:var(--mg-b-size-4) var(--mg-b-size-8);border-radius:var(--mg-b-size-radius);background:var(--mg-c-input-error-color-background);color:var(--mg-b-color-danger)}.mg-c-input__error ::slotted(*),.mg-c-input__help-text ::slotted(*){font-size:var(--mg-b-font-size-small);text-align:start}:host(:not(.mg-c-input--textarea)) .mg-c-input__input+.mg-c-input__error,:host(:not(.mg-c-input--textarea)) .mg-c-input__input+.mg-c-input__help-text{margin-top:var(--mg-b-size-4)}:host(.mg-c-input.mg-c-input--readonly) .mg-c-input__input mg-tooltip{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}:host(.mg-c-input){display:flex;margin-bottom:var(--mg-c-input-margin-bottom, 0)}:host(.mg-c-input.mg-c-input--checkbox) .mg-c-input__input,:host(.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset;align-items:flex-start}:host(.mg-c-input.mg-c-input--checkbox,.mg-c-input.mg-c-input--radio) .mg-c-input__input{min-height:unset}:host(.mg-c-input.mg-c-input--fieldset:not(.mg-c-input--checkbox-multi,.mg-c-input--readonly)) .mg-c-input__input-container mg-tooltip{margin-left:var(--mg-b-size-32)}:host(.mg-c-input.mg-c-input--label-on-top){flex-direction:column}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input.mg-c-input--label-on-top) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}@media screen and (max-width: 767px){:host(.mg-c-input){flex-direction:column}:host(.mg-c-input) .mg-c-input__title{width:100%;flex:0;justify-content:flex-start;margin-top:0;margin-right:0;margin-bottom:var(--mg-b-size-4);text-align:left}:host(.mg-c-input) .mg-c-input__title ::slotted(mg-input-title){flex-shrink:1}}/*# sourceMappingURL=mg-input.css.map */\n","import { Component, h, Prop, Element, Watch, Host, State } from '@stencil/core';\nimport { isValideID, isValidString, toString } from '@mgdis/stencil-helpers';\nimport { tooltipPositions, type TooltipPosition, classFieldset, classReadonly, classDisabled, classVerticalList } from './mg-input.conf';\n\n/**\n * @slot - Input content\n * @slot label - Label content\n * @slot help-text - Help text content\n * @slot error - error content\n */\n@Component({\n tag: 'mg-input',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-input.css',\n shadow: true,\n})\nexport class MgInput {\n /************\n * Internal *\n ************/\n\n // HTML selectors\n private helpTextId: string;\n private helpTextErrorId: string;\n private readonly slotLabel = 'label';\n private readonly slotError = 'error';\n private readonly slotHelpText = 'help-text';\n\n // slots elements\n private errorMessageSlotElement: HTMLElement;\n private helptextMessageSlotElement: HTMLElement;\n\n // style\n private readonly classInput = 'mg-c-input';\n private readonly classHasError = 'mg-c-input--has-error';\n private readonly classLabelOnTop = 'mg-c-input--label-on-top';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgInputElement;\n\n /**\n * Identifier is used for the element ID (id is a reserved prop in Stencil.js)\n */\n @Prop() identifier!: string;\n @Watch('identifier')\n watchIdentifier(newValue: MgInput['identifier']): void {\n if (!isValidString(newValue)) {\n throw new Error(`<mg-input> prop \"identifier\" is required and must be a string. Passed value: ${toString(newValue)}.`);\n } else if (!isValideID(newValue)) {\n console.error(`<mg-input> prop \"identifier\" value is invalid. Passed value: ${toString(newValue)}.`);\n } else {\n this.helpTextId = `${this.identifier}-help-text`;\n this.helpTextErrorId = `${this.identifier}-error`;\n }\n }\n\n /**\n * Define input label\n */\n @Prop() label!: string;\n\n /**\n * Define if label is displayed on top\n */\n @Prop() labelOnTop?: boolean;\n @Watch('labelOnTop')\n watchLabelOnTop(newValue: MgInput['labelOnTop']): void {\n if (newValue) {\n this.element.classList.add(this.classLabelOnTop);\n } else {\n this.element.classList.remove(this.classLabelOnTop);\n }\n }\n\n /**\n * Define if label is visible\n */\n @Prop() labelHide: boolean = false;\n @Watch('labelHide')\n @Watch('labelOnTop')\n watchLabelConfig(): void {\n if (this.labelHide && this.labelOnTop) {\n throw new Error('<mg-input> prop \"labelOnTop\" must not be paired with the prop \"labelHide\".');\n }\n }\n\n /**\n * Add a tooltip message next to the input\n */\n @Prop() tooltip?: string;\n\n /**\n * Define tooltip position\n */\n @Prop() tooltipPosition: TooltipPosition = 'input';\n @Watch('tooltipPosition')\n watchTooltipPosition(newValue: MgInput['tooltipPosition']) {\n if (!tooltipPositions.includes(newValue)) {\n throw new Error(`<mg-input> prop \"tooltipPosition\" must be one of: ${tooltipPositions.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define if input is required\n */\n @Prop() required: boolean = false;\n\n /**\n * Define error message to display\n */\n @Prop() errorMessage?: string;\n @Watch('errorMessage')\n watchErrorMessage(newValue: MgInput['errorMessage']): void {\n if (newValue !== undefined) {\n this.element.classList.add(this.classHasError);\n this.renderErrorMessage();\n } else {\n this.element.classList.remove(this.classHasError);\n this.errorMessageSlotElement?.remove();\n this.errorMessageSlotElement = undefined;\n }\n }\n\n /**\n * Define help text to display\n */\n @Prop() helpText?: string;\n @Watch('helpText')\n watchHelpText(newValue: MgInput['helpText']): void {\n if (newValue && !this.isReadonly) {\n this.renderHelpText();\n } else {\n this.helptextMessageSlotElement?.remove();\n this.helptextMessageSlotElement = undefined;\n }\n }\n\n /**\n * Define aria-describedby ids to link with\n */\n @Prop() ariaDescribedbyIDs: string[];\n @Watch('identifier')\n @Watch('errorMessage')\n @Watch('helpText')\n @Watch('ariaDescribedbyIDs')\n watchAriaDescribedbyIDs(): void {\n if (this.isReadonly) return;\n // a11y IDs\n const ariaDescribedbyIDs = new Set(this.ariaDescribedbyIDs);\n // Help text\n if (this.helpText !== undefined) {\n this.renderHelpText();\n if (!ariaDescribedbyIDs.has(this.helpTextId)) ariaDescribedbyIDs.add(this.helpTextId);\n }\n\n // Error Message\n if (this.errorMessage !== undefined) {\n this.renderErrorMessage();\n if (!ariaDescribedbyIDs.has(this.helpTextErrorId)) ariaDescribedbyIDs.add(this.helpTextErrorId);\n }\n\n this.element.querySelectorAll('input,select,textarea,[role=\"switch\"]').forEach(element => {\n if (ariaDescribedbyIDs.size) element.setAttribute('aria-describedby', Array.from(ariaDescribedbyIDs).join(' '));\n else element.removeAttribute('aria-describedby');\n });\n }\n\n /**\n * Component classes\n */\n // eslint-disable-next-line @stencil-community/no-unused-watch\n @Watch('class')\n watchClass(): void {\n if (!this.element.classList.contains(this.classInput)) {\n this.element.classList.add(this.classInput);\n }\n this.isFieldset = this.element.classList.contains(classFieldset);\n this.isReadonly = this.element.classList.contains(classReadonly);\n this.isDisabled = this.element.classList.contains(classDisabled);\n this.isVerticalList = this.element.classList.contains(classVerticalList);\n }\n\n /**\n * Element is fieldset\n */\n @State() isFieldset: boolean = false;\n\n /**\n * Element is readonly\n */\n @State() isReadonly: boolean = false;\n\n /**\n * Element is disabled\n */\n @State() isDisabled: boolean = false;\n\n /**\n * Element is disabled\n */\n @State() isVerticalList: boolean = false;\n\n /**\n * Trigger label update\n */\n // eslint-disable-next-line @stencil-community/no-unused-watch\n @Watch('class')\n @Watch('label')\n @Watch('required')\n @Watch('isReadonly')\n @Watch('isFieldset')\n watchLabel(): void {\n if (!isValidString(this.label)) {\n throw new Error(`<mg-input> prop \"label\" is required and must be a string. Passed value: ${toString(this.label)}.`);\n } else {\n this.watchAriaDescribedbyIDs();\n this.renderLabel();\n }\n }\n\n /************\n * Methods *\n ************/\n\n /**\n * Render input label\n */\n private renderLabel(): void {\n let labelSlotElement: HTMLMgInputTitleElement = this.element.querySelector(`[slot=${this.slotLabel}]`);\n\n // first remove previous labelslot if exist\n labelSlotElement?.remove();\n\n // create title element\n labelSlotElement = document.createElement('mg-input-title');\n [\n ['slot', this.slotLabel],\n ['identifier', this.identifier],\n ['readonly', this.isReadonly.toString()],\n ['required', ((this.required && !this.isDisabled) || false).toString()],\n ['is-legend', this.isFieldset.toString()],\n ].forEach(([attr, val]) => {\n labelSlotElement.setAttribute(attr, val);\n });\n\n // create label element\n const label = document.createElement('span');\n label.classList.add('mg-c-input-title__text');\n label.textContent = this.label;\n\n labelSlotElement.appendChild(label);\n this.element.appendChild(labelSlotElement);\n }\n\n /**\n * Render error message\n */\n private renderErrorMessage(): void {\n this.errorMessageSlotElement = this.element.querySelector(`[slot=${this.slotError}]`);\n if (this.errorMessageSlotElement === null) {\n this.errorMessageSlotElement = document.createElement('div');\n this.errorMessageSlotElement.setAttribute('slot', this.slotError);\n this.element.appendChild(this.errorMessageSlotElement);\n }\n this.errorMessageSlotElement.setAttribute('id', this.helpTextErrorId);\n this.errorMessageSlotElement.innerHTML = this.errorMessage;\n }\n\n /**\n * Render help text message\n */\n private renderHelpText(): void {\n this.helptextMessageSlotElement = this.element.querySelector(`[slot=${this.slotHelpText}]`);\n if (this.helptextMessageSlotElement === null) {\n this.helptextMessageSlotElement = document.createElement('div');\n this.helptextMessageSlotElement.setAttribute('slot', this.slotHelpText);\n this.element.appendChild(this.helptextMessageSlotElement);\n }\n this.helptextMessageSlotElement.setAttribute('id', this.helpTextId);\n this.helptextMessageSlotElement.innerHTML = this.helpText;\n }\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Check if component props are well configured on init\n */\n componentWillLoad(): void {\n this.watchIdentifier(this.identifier);\n this.watchLabel();\n this.watchClass();\n this.watchLabelOnTop(this.labelOnTop);\n this.watchLabelConfig();\n this.watchTooltipPosition(this.tooltipPosition);\n this.watchHelpText(this.helpText);\n this.watchErrorMessage(this.errorMessage);\n }\n\n /**\n * Validate slots\n */\n componentDidLoad(): void {\n this.watchAriaDescribedbyIDs();\n if (!this.isReadonly && !this.isFieldset && this.element.querySelector(`#${this.identifier}`) === null) {\n throw new Error(`<mg-input> \"identifier\" prop has no target for id: ${this.identifier}. Add an id to the targeted input.`);\n }\n }\n\n /**\n * Get tooltip node\n * @returns mg-tooltip\n */\n private renderTooltip = (): HTMLMgTooltipElement => (\n <mg-tooltip identifier={`${this.identifier}-tooltip`} message={this.tooltip}>\n <mg-icon icon=\"info-circle\"></mg-icon>\n </mg-tooltip>\n );\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const isGroup = this.isFieldset && !this.isReadonly;\n return (\n <Host class={this.element.classList.toString()} role={isGroup ? 'group' : undefined} aria-labelledby={isGroup ? `${this.identifier}-title` : undefined}>\n <div class={{ 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide }}>\n <slot name={this.slotLabel}></slot>\n {this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()}\n </div>\n <div class=\"mg-c-input__input-container\">\n <div class=\"mg-c-input__input\">\n <slot></slot>\n {this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()}\n </div>\n {this.helptextMessageSlotElement && (\n <div class=\"mg-c-input__help-text\">\n <slot name={this.slotHelpText}></slot>\n </div>\n )}\n {!this.isDisabled && this.errorMessage && (\n <div class=\"mg-c-input__error\" aria-live=\"assertive\">\n <slot name={this.slotError}></slot>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { V as Ve } from './index.es.js';
|
|
3
|
-
import { d as defineCustomElement$4,
|
|
3
|
+
import { d as defineCustomElement$4, a as directions, s as sizes } from './mg-menu-item2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { d as defineCustomElement$8 } from './mg-badge2.js';
|
|
6
6
|
import { d as defineCustomElement$7 } from './mg-button2.js';
|
|
@@ -72,7 +72,10 @@ class OverflowBehavior {
|
|
|
72
72
|
}
|
|
73
73
|
const items = Array.from(this.parentElement.children);
|
|
74
74
|
this._resizeObserver = new ResizeObserver(entries => {
|
|
75
|
-
this._availableWidth = entries
|
|
75
|
+
this._availableWidth = entries
|
|
76
|
+
.map(entry => entry.contentRect.width)
|
|
77
|
+
.sort((a, b) => a - b)
|
|
78
|
+
.shift();
|
|
76
79
|
// reset items
|
|
77
80
|
items.forEach(item => this.toggleItem(item, false));
|
|
78
81
|
let accWidth = 0;
|
|
@@ -101,7 +104,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
101
104
|
/**
|
|
102
105
|
* Component display direction.
|
|
103
106
|
*/
|
|
104
|
-
this.direction =
|
|
107
|
+
this.direction = directions.HORIZONTAL;
|
|
105
108
|
/**
|
|
106
109
|
* Define mg-menu size
|
|
107
110
|
*/
|
|
@@ -131,7 +134,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
131
134
|
* Update menu items
|
|
132
135
|
*/
|
|
133
136
|
this.updateMenuItems = () => {
|
|
134
|
-
this.getMenuItems().forEach(
|
|
137
|
+
this.getMenuItems().forEach(item => {
|
|
135
138
|
item.dataset.styleDirection = this.direction;
|
|
136
139
|
});
|
|
137
140
|
// render mg-item-more to manage OverflowBehavior
|
|
@@ -142,7 +145,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
142
145
|
*/
|
|
143
146
|
this.renderMgItemMore = () => {
|
|
144
147
|
var _a;
|
|
145
|
-
if (this.direction ===
|
|
148
|
+
if (this.direction === directions.VERTICAL || (this.direction === directions.HORIZONTAL && this.isChildMenu()) || this.element.children.length <= 1) {
|
|
146
149
|
return;
|
|
147
150
|
}
|
|
148
151
|
// Insert mg-item-more outside the mg-menu shadowdom
|
|
@@ -165,16 +168,16 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
170
|
validateDirection(newValue) {
|
|
168
|
-
if (![
|
|
169
|
-
throw new Error(`<${this.name}> prop "direction" must be one of: ${
|
|
171
|
+
if (![directions.VERTICAL, directions.HORIZONTAL].includes(newValue)) {
|
|
172
|
+
throw new Error(`<${this.name}> prop "direction" must be one of: ${directions.HORIZONTAL}, ${directions.VERTICAL}. Passed value: ${Ve(newValue)}.`);
|
|
170
173
|
}
|
|
171
174
|
else {
|
|
172
175
|
this.updateMenuItems();
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
validateItemMore(newValue) {
|
|
176
|
-
if (newValue !== undefined && this.direction !==
|
|
177
|
-
throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${
|
|
179
|
+
if (newValue !== undefined && this.direction !== directions.HORIZONTAL) {
|
|
180
|
+
throw new Error(`<${this.name}> prop "itemmore" must be paired with direction ${directions.HORIZONTAL}.`);
|
|
178
181
|
}
|
|
179
182
|
else if (newValue !== undefined) {
|
|
180
183
|
this.renderMgItemMore();
|
|
@@ -199,13 +202,12 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
199
202
|
return;
|
|
200
203
|
// reset expanded on previous active menu item
|
|
201
204
|
if (focusedItem)
|
|
202
|
-
focusedItem.removeAttribute(
|
|
205
|
+
focusedItem.removeAttribute('data-has-focus');
|
|
203
206
|
// update focusedMenuItem with new value
|
|
204
207
|
itemToWatch.setAttribute('data-has-focus', 'true');
|
|
205
208
|
});
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
|
-
;
|
|
209
211
|
/*************
|
|
210
212
|
* Lifecycle *
|
|
211
213
|
*************/
|
|
@@ -225,7 +227,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
225
227
|
// set menu-items
|
|
226
228
|
this.updateMenuItems();
|
|
227
229
|
// add listener to close main menu when focus leave it
|
|
228
|
-
if (!this.isChildMenu() && this.direction ===
|
|
230
|
+
if (!this.isChildMenu() && this.direction === directions.HORIZONTAL) {
|
|
229
231
|
document.addEventListener('focusin', (event) => {
|
|
230
232
|
const isElementChild = (element) => {
|
|
231
233
|
if (element === this.element)
|
|
@@ -251,7 +253,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class MgMenu extends HTMLElement
|
|
|
251
253
|
* @returns HTML Element
|
|
252
254
|
*/
|
|
253
255
|
render() {
|
|
254
|
-
return (h(Host, { key: '
|
|
256
|
+
return (h(Host, { key: '90442ca5c29abf5c94004374d20558f8b4752e6e', role: "list", "aria-label": this.label }, h("slot", { key: 'cfef557986ef4f545eca4542f7ee6e984052a198' })));
|
|
255
257
|
}
|
|
256
258
|
get element() { return this; }
|
|
257
259
|
static get watchers() { return {
|
|
@@ -411,8 +413,8 @@ const MgItemMore = /*@__PURE__*/ proxyCustomElement(class MgItemMore extends HTM
|
|
|
411
413
|
* @returns HTML Element
|
|
412
414
|
*/
|
|
413
415
|
render() {
|
|
414
|
-
const menuItemIdentifier =
|
|
415
|
-
return (h(Host, { key: '
|
|
416
|
+
const menuItemIdentifier = 'mg-item-more';
|
|
417
|
+
return (h(Host, { key: 'e6f29a59e69c25c27a8425b528e041b2dd11fb61', role: "listitem", "data-mg-popover-guard": `${menuItemIdentifier}-popover` }, this.parentMenu && (h("mg-menu-item", { key: 'b3d6550e2f99f95ae61551acfc63ee3c3a84c384', "data-overflow-more": true, "data-size": this.parentMenu.size, "data-style-direction": directions.HORIZONTAL, identifier: menuItemIdentifier }, h("mg-icon", { key: 'a4e720eb9c2c330f3df51cd2ace470c60e567cef', icon: this.icon.icon, size: this.size, slot: "image" }), h("span", { key: 'd5e59b95acea1676289fe54dc9382bedccb3d1ff', class: { 'mg-u-visually-hidden': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { key: '8424b294a7570b99b6e044e7080c34896384bf14', direction: directions.VERTICAL, label: this.messages.menuLabel, size: this.size, ref: ref => {
|
|
416
418
|
if (ref !== null)
|
|
417
419
|
this.itemMoreContainer = ref;
|
|
418
420
|
} })))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"mg-item-more2.js","mappings":";;;;;;;;;;;AAAA;;;MAGa,gBAAgB;IAK3B,YACU,aAA0B,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E,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG;gBAAM,IAAI,GAAG,KAAK,IAAI;oBAAE,IAAI,CAAC,iBAAiB,GAAG,GAAG,CAAA;aAAC,GAAY,CACtJ,CAChB,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["toString"],"sources":["src/utils/behaviors.utils.ts","../styles/dist/components/mg-menu.css?tag=mg-menu&encapsulation=shadow","src/components/molecules/menu/mg-menu/mg-menu.tsx","../styles/dist/components/mg-item-more.css?tag=mg-item-more&encapsulation=shadow","src/components/molecules/internals/mg-item-more/mg-item-more.tsx"],"sourcesContent":["/**\n * \n */\nexport class OverflowBehavior {\n // variables\n private _resizeObserver: ResizeObserver;\n private _availableWidth: number;\n\n constructor(\n private parentElement: HTMLElement,\n private itemMoreElement: HTMLElement,\n private itemMoreContainerElement: HTMLElement\n ) {\n if(!this.parentElement || !this.itemMoreElement || !this.itemMoreContainerElement) {\n throw new Error('OverflowBehavior - all construtor params are required')\n }\n\n const items = Array.from(this.parentElement.children) as HTMLElement[]\n\n this._resizeObserver = new ResizeObserver(entries => {\n this._availableWidth = entries.map(entry => entry.contentRect.width).sort((a, b) => a - b).shift();\n // reset items\n items.forEach(item => this.toggleItem(item, false));\n \n let accWidth = 0;\n\n items.forEach((item, index) => {\n accWidth += item.offsetWidth;\n if(index) this.toggleItem(item, this.isOverflowElement(accWidth, item))\n });\n });\n this._resizeObserver.observe(this.parentElement);\n }\n\n /**********\n * Public *\n **********/\n\n /**\n * Disconnect ResizeObserver\n */\n public disconnect = (): void => {\n this._resizeObserver.disconnect();\n };\n\n /************\n * Internal *\n ************/\n\n /**\n * Utility method to know if element is HTMLMgItemMoreElement\n * @param element - element to match with 'MORE' element\n * @returns truthy if element is the 'MORE' element\n */\n private isMoreElement = (element: HTMLElement): element is HTMLMgItemMoreElement => element === this.itemMoreElement;\n\n /**\n * Utility method to know if item overflow partialy or totaly in the container\n * @param cumulateWidth - previous sibling elements cumulate width + item width\n * @param item - item HTML element\n * @returns truthy if element is overflow\n */\n private isOverflowElement = (cumulateWidth: number, item: HTMLElement): boolean => {\n const displayMgItemMore = this.itemMoreContainerElement.children.length > 0\n if (!this.isMoreElement(item)) {\n if (item.nextElementSibling.nodeName !== 'MG-ITEM-MORE' && !displayMgItemMore) return cumulateWidth + this.itemMoreElement.offsetWidth > this._availableWidth;\n else return cumulateWidth > this._availableWidth;\n }\n else return !displayMgItemMore;\n };\n\n /**\n * Toogle item from isHidden condition\n * @param item - item to update\n * @param isHidden - item is hidden\n */\n private toggleItem = (item: HTMLElement, isHidden: boolean):void => {\n if (this.isMoreElement(item) && isHidden) item.setAttribute('hidden', '');\n else if(this.isMoreElement(item) && !isHidden) item.removeAttribute('hidden');\n else if (!this.isMoreElement(item) && isHidden) this.itemMoreContainerElement.appendChild(item)\n else if(!this.isMoreElement(item) && item.parentElement !== this.parentElement) this.parentElement.insertBefore(item, this.itemMoreElement)\n }\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;min-width:0;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}/*# sourceMappingURL=mg-menu.css.map */\n","import { Component, h, Prop, Element, Watch, Host, Listen } from '@stencil/core';\nimport { Direction, sizes } from './mg-menu.conf';\nimport type { MenuSizeType, ItemMoreType, DirectionType } from './mg-menu.conf';\nimport { toString } from '@mgdis/stencil-helpers';\n\n/**\n * @slot - Menu content\n */\n@Component({\n tag: 'mg-menu',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu.css',\n shadow: true,\n})\nexport class MgMenu {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuElement;\n\n /**\n * Menu label. Include short menu description.\n * Required to define accessibility required attribute `aria-label`\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgMenu['label']): void {\n if (newValue === undefined && !this.element.hasAttribute('aria-label')) {\n throw new Error(`<${this.name}> prop \"label\" is required. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Component display direction.\n */\n @Prop({ reflect: true }) direction: DirectionType = Direction.HORIZONTAL;\n @Watch('direction')\n validateDirection(newValue: MgMenu['direction']): void {\n if (![Direction.VERTICAL, Direction.HORIZONTAL].includes(newValue)) {\n throw new Error(`<${this.name}> prop \"direction\" must be one of: ${Direction.HORIZONTAL}, ${Direction.VERTICAL}. Passed value: ${toString(newValue)}.`);\n } else {\n this.updateMenuItems();\n }\n }\n\n /**\n * Customize \"mg-item-more\" element\n * Used with direction: 'vertical' to manage overflow\n */\n @Prop() itemmore?: ItemMoreType;\n @Watch('itemmore')\n validateItemMore(newValue: MgMenu['itemmore']): void {\n if (newValue !== undefined && this.direction !== Direction.HORIZONTAL) {\n throw new Error(`<${this.name}> prop \"itemmore\" must be paired with direction ${Direction.HORIZONTAL}.`);\n } else if (newValue !== undefined) {\n this.renderMgItemMore();\n }\n }\n\n /**\n * Define mg-menu size\n */\n @Prop() size: MenuSizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgMenu['size']): void {\n if (!sizes.includes(newValue)) {\n throw new Error(`<${this.name}> prop \"size\" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define mg-menu-item listener when they are loaded\n * @param event - mg-item-loaded \"item-loaded\" custom event\n */\n @Listen('item-loaded')\n updateItemListener(event: CustomEvent & { target: HTMLMgMenuItemElement}): void {\n const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;\n\n ['click', 'focus'].forEach(trigger => {\n itemToWatch.addEventListener(trigger, ():void => {\n const focusedItem: HTMLMgMenuItemElement = event.target.closest('mg-menu').querySelector('[data-has-focus]')\n // exit process if new focused item in the current menu children\n if(focusedItem === itemToWatch) return;\n\n // reset expanded on previous active menu item\n if(focusedItem) focusedItem.removeAttribute(\"data-has-focus\");\n\n // update focusedMenuItem with new value\n itemToWatch.setAttribute('data-has-focus','true');\n });\n })\n };\n\n /*************\n * Methods *\n *************/\n\n /**\n * Test if menu is a child menu\n * @returns truthy if menu is a child menu\n */\n private isChildMenu = (): boolean => this.element.closest('mg-menu-item') !== null;\n\n /**\n * Get menu children items\n * @returns menu children mg-menu-item\n */\n private getMenuItems = (menu = this.element): HTMLMgMenuItemElement[] => {\n const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM') as HTMLMgMenuItemElement[];\n const itemMoreMenuItem = menu.querySelector('mg-item-more')?.shadowRoot?.querySelector('mg-menu-item');\n if(itemMoreMenuItem) {\n menuItems.push(itemMoreMenuItem)\n }\n return menuItems;\n }\n\n /**\n * Update menu items\n */\n private updateMenuItems = (): void => {\n this.getMenuItems().forEach((item) => {\n item.dataset.styleDirection = this.direction\n })\n\n // render mg-item-more to manage OverflowBehavior\n this.renderMgItemMore();\n }\n\n /**\n * render mg-item-more\n */\n private renderMgItemMore = (): void => {\n if (this.direction === Direction.VERTICAL || this.direction === Direction.HORIZONTAL && this.isChildMenu() || this.element.children.length <= 1) {\n return;\n }\n\n // Insert mg-item-more outside the mg-menu shadowdom\n let itemMoreElement = this.element.querySelector('mg-item-more')\n if (itemMoreElement === null) {\n itemMoreElement = document.createElement('mg-item-more');\n this.element.appendChild(itemMoreElement);\n }\n\n // update mg-item-more props\n for (const propertie in this.itemmore) {\n itemMoreElement[propertie] = this.itemmore[propertie];\n }\n if (this.itemmore?.size === undefined) itemMoreElement.size = this.size;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.validateDirection(this.direction);\n this.validateLabel(this.label);\n this.validateItemMore(this.itemmore);\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n */\n componentDidLoad(): void {\n // set menu-items\n this.updateMenuItems();\n\n // add listener to close main menu when focus leave it\n if(!this.isChildMenu() && this.direction === Direction.HORIZONTAL) {\n document.addEventListener('focusin', (event: FocusEvent & { target: HTMLElement}):void => {\n const isElementChild = (element: HTMLElement):boolean => {\n if (element === this.element) return true;\n else if(!element.parentElement) return false;\n else return isElementChild(element.parentElement);\n };\n \n if(!event.target.closest('mg-menu') || !isElementChild(event.target)) {\n const focusedItem = this.element.querySelector('[data-has-focus]')\n // reset expanded on previous active menu item\n if(focusedItem) focusedItem.removeAttribute('data-has-focus');\n }\n })\n }\n // add mutation observer to improve global reactivity\n new MutationObserver(this.updateMenuItems).observe(this.element, { childList: true });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"list\" aria-label={this.label}>\n <slot></slot>\n </Host>\n );\n }\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host:not([hidden]){display:flex}/*# sourceMappingURL=mg-item-more.css.map */\n","import { Component, h, Prop, Element, Host, Watch, State } from '@stencil/core';\nimport { toString } from '@mgdis/stencil-helpers';\nimport type { IconType, SizeType, SlotLabelType } from './mg-item-more.conf';\nimport type { MessageType } from '../../../../locales/index.conf';\nimport { OverflowBehavior } from '../../../../utils/behaviors.utils';\nimport { Direction, sizes } from '../../menu/mg-menu/mg-menu.conf';\nimport { initLocales } from '../../../../locales';\n\n/**\n * @internal\n */\n@Component({\n tag: 'mg-item-more',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-item-more.css',\n shadow: true,\n})\nexport class MgItemMore {\n /************\n * Internal *\n ************/\n private readonly name = 'mg-item-more';\n private messages: MessageType;\n private overflowBehavior: OverflowBehavior;\n private itemMoreContainer: HTMLMgMenuElement\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgItemMoreElement;\n\n /**\n * Define icon\n */\n @Prop() icon?: IconType = { icon: 'ellipsis-vertical' };\n @Watch('icon')\n validateIcon(newValue: MgItemMore['icon']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))\n throw new Error(`<${this.name}> prop \"icon\" must match MgItemMore['icon'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define slot label element\n */\n @Prop() slotlabel?: SlotLabelType = { display: false };\n @Watch('slotlabel')\n validateSlotLabel(newValue: MgItemMore['slotlabel']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))\n throw new Error(`<${this.name}> prop \"slotlabel\" must match MgItemMore['slotlabel'] type. Passed value: ${toString(newValue)}.`);\n else if (typeof newValue.label !== 'string') this.slotlabel.label = this.messages.menuLabel;\n }\n\n /**\n * Define component child menu size.\n */\n @Prop() size?: SizeType;\n @Watch('size')\n validateSize(newValue: MgItemMore['size']): void {\n if (newValue && !sizes.includes(newValue)) throw new Error(`<${this.name}> prop \"size\" must match MgItemMore['size'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define component parent menu.\n */\n @State() parentMenu: HTMLMgMenuElement;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Set variables and validate props\n */\n componentWillLoad(): void {\n // init variables\n this.messages = initLocales(this.element).messages.itemMore as MessageType;\n\n // validate props\n this.validateIcon(this.icon);\n this.validateSlotLabel(this.slotlabel);\n this.validateSize(this.size);\n }\n\n /**\n * Ensure parent DOM is fully rendered with timeout method before parse elements\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // ensure parent menu is fully rendered\n return setTimeout(() => {\n this.parentMenu = this.element.closest('mg-menu');\n });\n }\n\n /**\n * Set OverflowBehavior when parentMenu state is upate AND defined\n */\n componentDidUpdate(): void {\n if (this.parentMenu && this.overflowBehavior === undefined) {\n this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.element, this.itemMoreContainer);\n }\n }\n\n /**\n * Disconnect overflow ResizeObserver\n */\n disconnectedCallback(): void {\n this.overflowBehavior?.disconnect();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const menuItemIdentifier = \"mg-item-more\"\n return (\n <Host role=\"listitem\" data-mg-popover-guard={`${menuItemIdentifier}-popover`}>\n {this.parentMenu && (\n <mg-menu-item\n data-overflow-more\n data-size={this.parentMenu.size}\n data-style-direction={Direction.HORIZONTAL}\n identifier={menuItemIdentifier}\n >\n <mg-icon icon={this.icon.icon} size={this.size} slot=\"image\"></mg-icon>\n <span class={{ 'mg-u-visually-hidden': !this.slotlabel.display }} slot=\"label\">\n {this.slotlabel.label}\n </span>\n <mg-menu direction={Direction.VERTICAL} label={this.messages.menuLabel} size={this.size} ref={(ref) => {if (ref !== null) this.itemMoreContainer = ref}}></mg-menu>\n </mg-menu-item>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"mg-item-more2.js","mappings":";;;;;;;;;;;AAAA;;;MAGa,gBAAgB;IAK3B,YACU,aAA0B,EAC1B,eAA4B,EAC5B,wBAAqC;QAFrC,kBAAa,GAAb,aAAa,CAAa;QAC1B,oBAAe,GAAf,eAAe,CAAa;QAC5B,6BAAwB,GAAx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AAI,GAAG,KAAK,IAAI;oBAAE,IAAI,CAAC,iBAAiB,GAAG,GAAG,CAAC;aAChD,GACQ,CACE,CAChB,CACI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["toString"],"sources":["src/utils/behaviors.utils.ts","../styles/dist/components/mg-menu.css?tag=mg-menu&encapsulation=shadow","src/components/molecules/menu/mg-menu/mg-menu.tsx","../styles/dist/components/mg-item-more.css?tag=mg-item-more&encapsulation=shadow","src/components/molecules/internals/mg-item-more/mg-item-more.tsx"],"sourcesContent":["/**\n *\n */\nexport class OverflowBehavior {\n // variables\n private _resizeObserver: ResizeObserver;\n private _availableWidth: number;\n\n constructor(\n private parentElement: HTMLElement,\n private itemMoreElement: HTMLElement,\n private itemMoreContainerElement: HTMLElement,\n ) {\n if (!this.parentElement || !this.itemMoreElement || !this.itemMoreContainerElement) {\n throw new Error('OverflowBehavior - all construtor params are required');\n }\n\n const items = Array.from(this.parentElement.children) as HTMLElement[];\n\n this._resizeObserver = new ResizeObserver(entries => {\n this._availableWidth = entries\n .map(entry => entry.contentRect.width)\n .sort((a, b) => a - b)\n .shift();\n // reset items\n items.forEach(item => this.toggleItem(item, false));\n\n let accWidth = 0;\n\n items.forEach((item, index) => {\n accWidth += item.offsetWidth;\n if (index) this.toggleItem(item, this.isOverflowElement(accWidth, item));\n });\n });\n this._resizeObserver.observe(this.parentElement);\n }\n\n /**********\n * Public *\n **********/\n\n /**\n * Disconnect ResizeObserver\n */\n public disconnect = (): void => {\n this._resizeObserver.disconnect();\n };\n\n /************\n * Internal *\n ************/\n\n /**\n * Utility method to know if element is HTMLMgItemMoreElement\n * @param element - element to match with 'MORE' element\n * @returns truthy if element is the 'MORE' element\n */\n private isMoreElement = (element: HTMLElement): element is HTMLMgItemMoreElement => element === this.itemMoreElement;\n\n /**\n * Utility method to know if item overflow partialy or totaly in the container\n * @param cumulateWidth - previous sibling elements cumulate width + item width\n * @param item - item HTML element\n * @returns truthy if element is overflow\n */\n private isOverflowElement = (cumulateWidth: number, item: HTMLElement): boolean => {\n const displayMgItemMore = this.itemMoreContainerElement.children.length > 0;\n if (!this.isMoreElement(item)) {\n if (item.nextElementSibling.nodeName !== 'MG-ITEM-MORE' && !displayMgItemMore) return cumulateWidth + this.itemMoreElement.offsetWidth > this._availableWidth;\n else return cumulateWidth > this._availableWidth;\n } else return !displayMgItemMore;\n };\n\n /**\n * Toogle item from isHidden condition\n * @param item - item to update\n * @param isHidden - item is hidden\n */\n private toggleItem = (item: HTMLElement, isHidden: boolean): void => {\n if (this.isMoreElement(item) && isHidden) item.setAttribute('hidden', '');\n else if (this.isMoreElement(item) && !isHidden) item.removeAttribute('hidden');\n else if (!this.isMoreElement(item) && isHidden) this.itemMoreContainerElement.appendChild(item);\n else if (!this.isMoreElement(item) && item.parentElement !== this.parentElement) this.parentElement.insertBefore(item, this.itemMoreElement);\n };\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}/*!\n * @prop --mg-c-menu-color-background: Defines the background color of the menu. Unset by default, fallback on `--mg-b-color-light`.\n */:host{display:inline-flex;width:100%;min-width:0;background-color:var(--mg-c-menu-color-background, var(--mg-b-color-light))}:host([direction=vertical]){display:flex;height:100%;flex-direction:column;overflow-y:auto}/*# sourceMappingURL=mg-menu.css.map */\n","import { Component, h, Prop, Element, Watch, Host, Listen } from '@stencil/core';\nimport { directions, sizes } from './mg-menu.conf';\nimport type { MenuSizeType, ItemMoreType } from './mg-menu.conf';\nimport { toString } from '@mgdis/stencil-helpers';\nimport { Direction } from '../../../../types';\n\n/**\n * @slot - Menu content\n */\n@Component({\n tag: 'mg-menu',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-menu.css',\n shadow: true,\n})\nexport class MgMenu {\n /************\n * Internal *\n ************/\n\n private readonly name = 'mg-menu';\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgMenuElement;\n\n /**\n * Menu label. Include short menu description.\n * Required to define accessibility required attribute `aria-label`\n */\n @Prop() label!: string;\n @Watch('label')\n validateLabel(newValue: MgMenu['label']): void {\n if (newValue === undefined && !this.element.hasAttribute('aria-label')) {\n throw new Error(`<${this.name}> prop \"label\" is required. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Component display direction.\n */\n @Prop({ reflect: true }) direction: Direction = directions.HORIZONTAL;\n @Watch('direction')\n validateDirection(newValue: MgMenu['direction']): void {\n if (![directions.VERTICAL, directions.HORIZONTAL].includes(newValue)) {\n throw new Error(`<${this.name}> prop \"direction\" must be one of: ${directions.HORIZONTAL}, ${directions.VERTICAL}. Passed value: ${toString(newValue)}.`);\n } else {\n this.updateMenuItems();\n }\n }\n\n /**\n * Customize \"mg-item-more\" element\n * Used with direction: 'vertical' to manage overflow\n */\n @Prop() itemmore?: ItemMoreType;\n @Watch('itemmore')\n validateItemMore(newValue: MgMenu['itemmore']): void {\n if (newValue !== undefined && this.direction !== directions.HORIZONTAL) {\n throw new Error(`<${this.name}> prop \"itemmore\" must be paired with direction ${directions.HORIZONTAL}.`);\n } else if (newValue !== undefined) {\n this.renderMgItemMore();\n }\n }\n\n /**\n * Define mg-menu size\n */\n @Prop() size: MenuSizeType = 'medium';\n @Watch('size')\n validateSize(newValue: MgMenu['size']): void {\n if (!sizes.includes(newValue)) {\n throw new Error(`<${this.name}> prop \"size\" must be one of: ${sizes.join(', ')}. Passed value: ${toString(newValue)}.`);\n }\n }\n\n /**\n * Define mg-menu-item listener when they are loaded\n * @param event - mg-item-loaded \"item-loaded\" custom event\n */\n @Listen('item-loaded')\n updateItemListener(event: CustomEvent & { target: HTMLMgMenuItemElement }): void {\n const itemToWatch = event.target.nodeName === 'MG-ITEM-MORE' ? event.target.shadowRoot.querySelector('mg-menu-item') : event.target;\n\n ['click', 'focus'].forEach(trigger => {\n itemToWatch.addEventListener(trigger, (): void => {\n const focusedItem: HTMLMgMenuItemElement = event.target.closest('mg-menu').querySelector('[data-has-focus]');\n // exit process if new focused item in the current menu children\n if (focusedItem === itemToWatch) return;\n\n // reset expanded on previous active menu item\n if (focusedItem) focusedItem.removeAttribute('data-has-focus');\n\n // update focusedMenuItem with new value\n itemToWatch.setAttribute('data-has-focus', 'true');\n });\n });\n }\n\n /*************\n * Methods *\n *************/\n\n /**\n * Test if menu is a child menu\n * @returns truthy if menu is a child menu\n */\n private isChildMenu = (): boolean => this.element.closest('mg-menu-item') !== null;\n\n /**\n * Get menu children items\n * @returns menu children mg-menu-item\n */\n private getMenuItems = (menu = this.element): HTMLMgMenuItemElement[] => {\n const menuItems = Array.from(menu.children).filter(child => child.nodeName === 'MG-MENU-ITEM') as HTMLMgMenuItemElement[];\n const itemMoreMenuItem = menu.querySelector('mg-item-more')?.shadowRoot?.querySelector('mg-menu-item');\n if (itemMoreMenuItem) {\n menuItems.push(itemMoreMenuItem);\n }\n return menuItems;\n };\n\n /**\n * Update menu items\n */\n private updateMenuItems = (): void => {\n this.getMenuItems().forEach(item => {\n item.dataset.styleDirection = this.direction;\n });\n\n // render mg-item-more to manage OverflowBehavior\n this.renderMgItemMore();\n };\n\n /**\n * render mg-item-more\n */\n private renderMgItemMore = (): void => {\n if (this.direction === directions.VERTICAL || (this.direction === directions.HORIZONTAL && this.isChildMenu()) || this.element.children.length <= 1) {\n return;\n }\n\n // Insert mg-item-more outside the mg-menu shadowdom\n let itemMoreElement = this.element.querySelector('mg-item-more');\n if (itemMoreElement === null) {\n itemMoreElement = document.createElement('mg-item-more');\n this.element.appendChild(itemMoreElement);\n }\n\n // update mg-item-more props\n for (const propertie in this.itemmore) {\n itemMoreElement[propertie] = this.itemmore[propertie];\n }\n if (this.itemmore?.size === undefined) itemMoreElement.size = this.size;\n };\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Validate props\n */\n componentWillLoad(): void {\n this.validateDirection(this.direction);\n this.validateLabel(this.label);\n this.validateItemMore(this.itemmore);\n this.validateSize(this.size);\n }\n\n /**\n * Check if component slots configuration\n */\n componentDidLoad(): void {\n // set menu-items\n this.updateMenuItems();\n\n // add listener to close main menu when focus leave it\n if (!this.isChildMenu() && this.direction === directions.HORIZONTAL) {\n document.addEventListener('focusin', (event: FocusEvent & { target: HTMLElement }): void => {\n const isElementChild = (element: HTMLElement): boolean => {\n if (element === this.element) return true;\n else if (!element.parentElement) return false;\n else return isElementChild(element.parentElement);\n };\n\n if (!event.target.closest('mg-menu') || !isElementChild(event.target)) {\n const focusedItem = this.element.querySelector('[data-has-focus]');\n // reset expanded on previous active menu item\n if (focusedItem) focusedItem.removeAttribute('data-has-focus');\n }\n });\n }\n // add mutation observer to improve global reactivity\n new MutationObserver(this.updateMenuItems).observe(this.element, { childList: true });\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n return (\n <Host role=\"list\" aria-label={this.label}>\n <slot></slot>\n </Host>\n );\n }\n}\n",".mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media(prefers-reduced-motion){*{animation:none !important;transition:none !important}}:host:not([hidden]){display:flex}/*# sourceMappingURL=mg-item-more.css.map */\n","import { Component, h, Prop, Element, Host, Watch, State } from '@stencil/core';\nimport { toString } from '@mgdis/stencil-helpers';\nimport type { IconType, SizeType, SlotLabelType } from './mg-item-more.conf';\nimport type { MessageType } from '../../../../locales/index.conf';\nimport { OverflowBehavior } from '../../../../utils/behaviors.utils';\nimport { directions, sizes } from '../../menu/mg-menu/mg-menu.conf';\nimport { initLocales } from '../../../../locales';\n\n/**\n * @internal\n */\n@Component({\n tag: 'mg-item-more',\n styleUrl: '../../../../../node_modules/@mgdis/styles/dist/components/mg-item-more.css',\n shadow: true,\n})\nexport class MgItemMore {\n /************\n * Internal *\n ************/\n private readonly name = 'mg-item-more';\n private messages: MessageType;\n private overflowBehavior: OverflowBehavior;\n private itemMoreContainer: HTMLMgMenuElement;\n\n /**************\n * Decorators *\n **************/\n\n /**\n * Get component DOM element\n */\n @Element() element: HTMLMgItemMoreElement;\n\n /**\n * Define icon\n */\n @Prop() icon?: IconType = { icon: 'ellipsis-vertical' };\n @Watch('icon')\n validateIcon(newValue: MgItemMore['icon']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.icon !== 'string'))\n throw new Error(`<${this.name}> prop \"icon\" must match MgItemMore['icon'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define slot label element\n */\n @Prop() slotlabel?: SlotLabelType = { display: false };\n @Watch('slotlabel')\n validateSlotLabel(newValue: MgItemMore['slotlabel']): void {\n if (typeof newValue !== 'object' || (typeof newValue === 'object' && typeof newValue.display !== 'boolean'))\n throw new Error(`<${this.name}> prop \"slotlabel\" must match MgItemMore['slotlabel'] type. Passed value: ${toString(newValue)}.`);\n else if (typeof newValue.label !== 'string') this.slotlabel.label = this.messages.menuLabel;\n }\n\n /**\n * Define component child menu size.\n */\n @Prop() size?: SizeType;\n @Watch('size')\n validateSize(newValue: MgItemMore['size']): void {\n if (newValue && !sizes.includes(newValue)) throw new Error(`<${this.name}> prop \"size\" must match MgItemMore['size'] type. Passed value: ${toString(newValue)}.`);\n }\n\n /**\n * Define component parent menu.\n */\n @State() parentMenu: HTMLMgMenuElement;\n\n /*************\n * Lifecycle *\n *************/\n\n /**\n * Set variables and validate props\n */\n componentWillLoad(): void {\n // init variables\n this.messages = initLocales(this.element).messages.itemMore as MessageType;\n\n // validate props\n this.validateIcon(this.icon);\n this.validateSlotLabel(this.slotlabel);\n this.validateSize(this.size);\n }\n\n /**\n * Ensure parent DOM is fully rendered with timeout method before parse elements\n * @returns timeout\n */\n componentDidLoad(): ReturnType<typeof setTimeout> {\n // ensure parent menu is fully rendered\n return setTimeout(() => {\n this.parentMenu = this.element.closest('mg-menu');\n });\n }\n\n /**\n * Set OverflowBehavior when parentMenu state is upate AND defined\n */\n componentDidUpdate(): void {\n if (this.parentMenu && this.overflowBehavior === undefined) {\n this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.element, this.itemMoreContainer);\n }\n }\n\n /**\n * Disconnect overflow ResizeObserver\n */\n disconnectedCallback(): void {\n this.overflowBehavior?.disconnect();\n }\n\n /**\n * Render\n * @returns HTML Element\n */\n render(): HTMLElement {\n const menuItemIdentifier = 'mg-item-more';\n return (\n <Host role=\"listitem\" data-mg-popover-guard={`${menuItemIdentifier}-popover`}>\n {this.parentMenu && (\n <mg-menu-item data-overflow-more data-size={this.parentMenu.size} data-style-direction={directions.HORIZONTAL} identifier={menuItemIdentifier}>\n <mg-icon icon={this.icon.icon} size={this.size} slot=\"image\"></mg-icon>\n <span class={{ 'mg-u-visually-hidden': !this.slotlabel.display }} slot=\"label\">\n {this.slotlabel.label}\n </span>\n <mg-menu\n direction={directions.VERTICAL}\n label={this.messages.menuLabel}\n size={this.size}\n ref={ref => {\n if (ref !== null) this.itemMoreContainer = ref;\n }}\n ></mg-menu>\n </mg-menu-item>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -33,7 +33,7 @@ const MgLoader$1 = /*@__PURE__*/ proxyCustomElement(class MgLoader extends HTMLE
|
|
|
33
33
|
* @returns HTML Element
|
|
34
34
|
*/
|
|
35
35
|
render() {
|
|
36
|
-
return (h("div", { key: '
|
|
36
|
+
return (h("div", { key: 'b9442e1060b119499a8f35444be6b371d340dffc', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '9ef418d26dd97c570147c99948509368a8abe84b', icon: "loader", spin: true }), h("span", { key: '4cff50728afc076ffa202fa1b3973573d2a073e8', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgess)));
|
|
37
37
|
}
|
|
38
38
|
get element() { return this; }
|
|
39
39
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { G as Ge,
|
|
2
|
+
import { G as Ge, Z as Ze, m as me, X as Xe, V as Ve, s as st } from './index.es.js';
|
|
3
3
|
import { i as initLocales } from './index2.js';
|
|
4
4
|
import { d as defineCustomElement$6 } from './mg-badge2.js';
|
|
5
5
|
import { d as defineCustomElement$5 } from './mg-button2.js';
|
|
@@ -25,7 +25,7 @@ const targets = ['_blank', '_self', '_parent', '_top'];
|
|
|
25
25
|
/**
|
|
26
26
|
* Menu direction values
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
28
|
+
const directions = {
|
|
29
29
|
VERTICAL: 'vertical',
|
|
30
30
|
HORIZONTAL: 'horizontal',
|
|
31
31
|
};
|
|
@@ -74,7 +74,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
|
|
|
74
74
|
/**
|
|
75
75
|
* Component button classes
|
|
76
76
|
*/
|
|
77
|
-
this.navigationButtonClassList = new
|
|
77
|
+
this.navigationButtonClassList = new Ze([this.navigationButton]);
|
|
78
78
|
/**
|
|
79
79
|
* Does component have children.
|
|
80
80
|
*/
|
|
@@ -98,7 +98,9 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
|
|
|
98
98
|
* Condition to know if component should display a mg-popover
|
|
99
99
|
* @returns truthy if component display popover
|
|
100
100
|
*/
|
|
101
|
-
this.hasPopover = () => this.isDirection(
|
|
101
|
+
this.hasPopover = () => this.isDirection(directions.HORIZONTAL) &&
|
|
102
|
+
((this.isInMainMenu() && Array.from(this.element.children).some(element => !element.querySelector('[slot]'))) || this.isItemMore) &&
|
|
103
|
+
this.href === undefined;
|
|
102
104
|
/**
|
|
103
105
|
* Method to control if one of component children have active status
|
|
104
106
|
* @returns truthy if component has active child
|
|
@@ -140,7 +142,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
|
|
|
140
142
|
this.updateExpanded = (newValue) => {
|
|
141
143
|
if (this.isInteractiveItem()) {
|
|
142
144
|
// item is always expanded in vertical menu when has active child
|
|
143
|
-
this.expanded = this.isDirection(
|
|
145
|
+
this.expanded = (this.isDirection(directions.VERTICAL) && this.hasActiveChild()) || newValue;
|
|
144
146
|
}
|
|
145
147
|
};
|
|
146
148
|
/**
|
|
@@ -272,7 +274,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
|
|
|
272
274
|
this.navigationButtonClassList.add(`${this.navigationButton}--${newValue}`);
|
|
273
275
|
// manage all sub levels child menu-items level with data-level attribut
|
|
274
276
|
Array.from(this.element.querySelectorAll('mg-menu-item')).forEach(item => {
|
|
275
|
-
if (this.isDirection(
|
|
277
|
+
if (this.isDirection(directions.VERTICAL, newValue)) {
|
|
276
278
|
item.dataset.level = `${(Number(item.dataset.level) || 1) + 1}`;
|
|
277
279
|
}
|
|
278
280
|
else {
|
|
@@ -390,9 +392,9 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class MgMenuItem extends HTM
|
|
|
390
392
|
render() {
|
|
391
393
|
const getContainerClasses = () => ({
|
|
392
394
|
['mg-c-menu-item__collapse-container']: true,
|
|
393
|
-
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu() || this.isItemMore) && this.isDirection(
|
|
395
|
+
['mg-c-menu-item__collapse-container--first-level']: (this.isInMainMenu() || this.isItemMore) && this.isDirection(directions.HORIZONTAL),
|
|
394
396
|
});
|
|
395
|
-
return (h(Host, { key: '
|
|
397
|
+
return (h(Host, { key: 'cea7dac5e51bf47c5a9a1ae060f634ef455ac1b3', role: this.isItemMore ? 'presentation' : 'listitem' }, this.hasPopover() ? (h("mg-popover", { display: this.expanded, placement: "bottom-start", arrowHide: true, "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
|
|
396
398
|
}, this.renderInteractiveElement(), h("div", { class: getContainerClasses(), slot: "content" }, this.renderSlot()))) : ([
|
|
397
399
|
this.renderInteractiveElement(),
|
|
398
400
|
h("div", { key: "vertical-container", class: getContainerClasses(), hidden: !this.expanded }, this.renderSlot()),
|
|
@@ -479,6 +481,6 @@ function defineCustomElement() {
|
|
|
479
481
|
}
|
|
480
482
|
defineCustomElement();
|
|
481
483
|
|
|
482
|
-
export {
|
|
484
|
+
export { MgMenuItem as M, Status as S, directions as a, defineCustomElement as d, sizes as s };
|
|
483
485
|
|
|
484
486
|
//# sourceMappingURL=mg-menu-item2.js.map
|