@mgdis/mg-components 5.15.0 → 5.16.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/loader.cjs.js +1 -1
- package/dist/cjs/{mg-action-more_32.cjs.entry.js → mg-action-more_34.cjs.entry.js} +321 -107
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +4 -2
- package/dist/collection/assets/icons/index.js +179 -0
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.css +43 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +49 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.css +0 -43
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +57 -12
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +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-numeric/mg-input-numeric.js +35 -15
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +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-select/mg-input-select.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +2 -2
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +9 -2
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +11 -3
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.conf.js +4 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +37 -5
- 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.css +135 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +100 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +0 -111
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +42 -43
- package/dist/collection/utils/components.utils.js +8 -7
- package/dist/collection/utils/unit.test.utils.js +6 -5
- package/dist/components/components.utils.js +8 -7
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/mg-action-more.js +29 -16
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-form.js +11 -3
- package/dist/components/mg-icon2.js +66 -14
- package/dist/components/mg-input-checkbox-paginated2.js +18 -12
- package/dist/components/mg-input-checkbox.js +36 -24
- package/dist/components/mg-input-date.js +13 -7
- package/dist/components/mg-input-numeric.js +47 -21
- package/dist/components/mg-input-password.js +13 -7
- package/dist/components/mg-input-radio.js +13 -7
- package/dist/components/mg-input-select2.js +13 -7
- package/dist/components/mg-input-text2.js +15 -9
- package/dist/components/mg-input-textarea.js +15 -9
- package/dist/components/mg-input-toggle.js +12 -6
- package/dist/components/mg-item-more.js +24 -16
- package/dist/components/mg-menu-item2.js +18 -12
- package/dist/components/mg-modal.js +16 -3
- package/dist/components/mg-pagination2.js +16 -10
- package/dist/components/mg-panel.js +21 -15
- package/dist/components/mg-popover-content.d.ts +11 -0
- package/dist/components/mg-popover-content.js +6 -0
- package/dist/components/mg-popover-content2.js +88 -0
- package/dist/components/mg-popover2.js +54 -47
- package/dist/components/mg-tooltip-content.d.ts +11 -0
- package/dist/components/mg-tooltip-content.js +6 -0
- package/dist/components/mg-tooltip-content2.js +41 -0
- package/dist/components/mg-tooltip2.js +64 -15
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mg-action-more_32.entry.js → mg-action-more_34.entry.js} +320 -108
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +4 -2
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-3286bc46.entry.js +1 -0
- package/dist/mg-components/p-91f4a30d.entry.js +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.d.ts +14 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +7 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +19 -0
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +6 -1
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +8 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.conf.d.ts +8 -0
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +8 -2
- package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +47 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +8 -11
- package/dist/types/components.d.ts +59 -0
- package/package.json +8 -8
- package/dist/mg-components/p-4ae1130f.entry.js +0 -1
- package/dist/mg-components/p-6672f590.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i,H as s,g as e}from"./p-3bf1e2f0.js";import{i as o,D as n}from"./p-067080e4.js";var h;!function(t){t.BASE_INDEX="data-overflow-base-index",t.PROXY_INDEX="data-overflow-proxy-index"}(h||(h={}));class r{constructor(t,i){this.element=t,this.render=i,this.disconnect=()=>{this._resizeObserver.disconnect()},this.run=t=>{void 0===this._moreElement&&(this._moreElement=this.render(),this._baseChildren=this.getInteractiveItems(this.element),(()=>"MG-ITEM-MORE"===this._moreElement.nodeName)()&&(this._proxyChildren=this.getInteractiveItems(this._moreElement.shadowRoot.querySelector("mg-menu"))),this._baseChildren.forEach(((t,i)=>{t.setAttribute(h.BASE_INDEX,`${i}`),this._proxyChildren[i].setAttribute(h.PROXY_INDEX,`${i}`)}))),void 0!==t&&this.updateDisplayedItems(t)},this.getInteractiveItems=t=>{var i;return((null===(i=t.children)||void 0===i?void 0:i.length)>0?Array.from(t.children):[]).filter((t=>["MG-MENU-ITEM","MG-BUTTON"].includes(t.nodeName)))},this.updateDisplayedItems=t=>{this.restoreItems();const i={accWidth:0,previousItem:null};[...this._baseChildren,this._moreElement].forEach((s=>{i.accWidth+=s.offsetWidth;const e=null!==i.previousItem&&null!==i.previousItem.getAttribute("hidden");this.toggleItem(s,e&&!this.isMoreElement(s)||this.isOverflowElement(i.accWidth,s,t)||this.isMoreElement(s)&&!e),i.previousItem=s}))},this.isOverflowElement=(t,i,s)=>null!==i.previousElementSibling&&!this.isMoreElement(i)&&(this.isMoreElement(i.nextElementSibling)?t>s:t+this._moreElement.offsetWidth>s),this.isMoreElement=t=>"MG-ITEM-MORE"===t.nodeName,this.toggleItem=(t,i)=>{const s=Number(t.getAttribute(h.BASE_INDEX));this.isMoreElement(t)?this.toggleElement(this._moreElement,i):s>=0&&(this.toggleElement(t,i),this.toggleElement(this._proxyChildren[s],!i))},this.toggleElement=(t,i)=>{i?t.setAttribute("hidden",""):t.removeAttribute("hidden")},this.restoreItems=()=>{[...this._baseChildren,this._moreElement].forEach((t=>t.removeAttribute("hidden")))},void 0===this._resizeObserver&&(this._resizeObserver=new ResizeObserver((t=>{t.forEach((t=>{this.run(t.contentRect.width)}))})),this._resizeObserver.observe(this.element)),this.run()}}const a=class{constructor(i){t(this,i),this.name="mg-item-more",this.renderMgMenuItemOverflowElement=()=>{const t=this.element.shadowRoot.querySelector("mg-menu-item");this.menuItems.forEach((i=>{t.querySelector("mg-menu").appendChild(i.cloneNode(!0))}));const i=Array.from(this.parentMenu.querySelectorAll("mg-menu-item:not([data-overflow-more])"));return Array.from(t.querySelectorAll("mg-menu-item:not([data-overflow-more])")).forEach(((t,s)=>{t.addEventListener("click",(()=>{const t=i[s].shadowRoot.querySelector("a, button");(t instanceof HTMLButtonElement||t instanceof HTMLAnchorElement)&&t.click()})),""!==t.id.trim()&&(t.id=`${t.id}-proxy`),i[s].addEventListener("status-change",(i=>{t.setAttribute("status",i.detail)}))})),this.element},this.icon={icon:"ellipsis-vertical"},this.slotlabel={display:!1},this.size=void 0,this.parentMenu=void 0}validateIcon(t){if("object"!=typeof t||"object"==typeof t&&"string"!=typeof t.icon)throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type.`)}validateSlotLabel(t){if("object"!=typeof t||"object"==typeof t&&"boolean"!=typeof t.display)throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type.`);"string"!=typeof t.label&&(this.slotlabel.label=this.messages.moreLabel)}validateSize(t){if(t&&"string"!=typeof t)throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type.`)}disconnectedCallback(){this.overflowBehavior.disconnect()}componentWillLoad(){this.messages=o(this.element).messages.plusMenu,this.parentMenu=this.element.closest("mg-menu"),this.menuItems=Array.from(this.parentMenu.children).filter((t=>"MG-MENU-ITEM"===t.nodeName)),this.validateIcon(this.icon),this.validateSlotLabel(this.slotlabel),this.validateSize(this.size)}componentDidLoad(){this.overflowBehavior=new r(this.parentMenu,this.renderMgMenuItemOverflowElement)}render(){return i(s,{role:"listitem"},i("mg-menu-item",{"data-overflow-more":!0,"data-size":this.parentMenu.size},i("mg-icon",{icon:this.icon.icon,slot:"image"}),i("span",{class:{"sr-only":!this.slotlabel.display},slot:"label"},this.slotlabel.label),i("mg-menu",{direction:n.VERTICAL,label:this.messages.moreLabel,size:this.size})))}get element(){return e(this)}static get watchers(){return{icon:["validateIcon"],slotlabel:["validateSlotLabel"],size:["validateSize"]}}};a.style=".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{display:flex}";export{a as mg_item_more}
|
|
@@ -4,9 +4,10 @@ export declare class MgTooltip {
|
|
|
4
4
|
* Internal *
|
|
5
5
|
************/
|
|
6
6
|
private popper;
|
|
7
|
-
private
|
|
7
|
+
private mgTooltipContent;
|
|
8
8
|
private tooltipedElement;
|
|
9
9
|
private windows;
|
|
10
|
+
private hasCustomTabIndex;
|
|
10
11
|
private guard;
|
|
11
12
|
/**************
|
|
12
13
|
* Decorators *
|
|
@@ -38,6 +39,7 @@ export declare class MgTooltip {
|
|
|
38
39
|
* Disable tooltip
|
|
39
40
|
*/
|
|
40
41
|
disabled: boolean;
|
|
42
|
+
validateDisabled(newValue: MgTooltip['disabled']): void;
|
|
41
43
|
/**
|
|
42
44
|
* Show tooltip
|
|
43
45
|
*/
|
|
@@ -84,6 +86,10 @@ export declare class MgTooltip {
|
|
|
84
86
|
* @param interactiveElement - interactive element
|
|
85
87
|
*/
|
|
86
88
|
private initTooltip;
|
|
89
|
+
/**
|
|
90
|
+
* Render tooltip content element
|
|
91
|
+
*/
|
|
92
|
+
private renderTooltip;
|
|
87
93
|
/*************
|
|
88
94
|
* Lifecycle *
|
|
89
95
|
*************/
|
|
@@ -24,6 +24,25 @@ export declare class MgInputNumeric {
|
|
|
24
24
|
*/
|
|
25
25
|
value: string;
|
|
26
26
|
validateValue(newValue: MgInputNumeric['value']): void;
|
|
27
|
+
/**
|
|
28
|
+
* Checks if the given value is valid according to the defined rules.
|
|
29
|
+
* @param value - The input value to validate.
|
|
30
|
+
* @param regex - The regular expression for validation.
|
|
31
|
+
* @param integer - The integer part of the value.
|
|
32
|
+
* @param decimal - The decimal part of the value.
|
|
33
|
+
* @returns Returns true if the value is valid, otherwise false.
|
|
34
|
+
*/
|
|
35
|
+
private isValidValue;
|
|
36
|
+
/**
|
|
37
|
+
* Handles invalid input values and returns a corrected value.
|
|
38
|
+
* @returns The corrected value.
|
|
39
|
+
*/
|
|
40
|
+
private handleInvalidValue;
|
|
41
|
+
/**
|
|
42
|
+
* Updates the component values based on the validated input value.
|
|
43
|
+
* @param newValue - The validated input value.
|
|
44
|
+
*/
|
|
45
|
+
private updateValues;
|
|
27
46
|
/**
|
|
28
47
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
29
48
|
*/
|
|
@@ -38,12 +38,17 @@ export declare class MgActionMore {
|
|
|
38
38
|
*/
|
|
39
39
|
expanded: boolean;
|
|
40
40
|
/************
|
|
41
|
-
*
|
|
41
|
+
* Methods *
|
|
42
42
|
***********/
|
|
43
43
|
/**
|
|
44
44
|
* Toogle expanded props
|
|
45
45
|
*/
|
|
46
46
|
private toggleExpanded;
|
|
47
|
+
/**
|
|
48
|
+
* Handle popover display change value
|
|
49
|
+
* @param event - display change updated value
|
|
50
|
+
*/
|
|
51
|
+
private handleDisplayChange;
|
|
47
52
|
/**
|
|
48
53
|
* Button click handler
|
|
49
54
|
*/
|
|
@@ -68,6 +68,14 @@ export declare class MgForm {
|
|
|
68
68
|
* Define required message based on mg-inputs required elements
|
|
69
69
|
*/
|
|
70
70
|
private setRequiredMessage;
|
|
71
|
+
/**
|
|
72
|
+
* Returns a required message based on the count of required inputs.
|
|
73
|
+
* @param requiredInputs - An array of required input elements.
|
|
74
|
+
* @param keySingle - The key for the singular message format.
|
|
75
|
+
* @param keyPlural - The key for the plural message format.
|
|
76
|
+
* @returns The appropriate required message based on the count of required inputs.
|
|
77
|
+
*/
|
|
78
|
+
private getRequiredMessageBasedOnCount;
|
|
71
79
|
/**
|
|
72
80
|
* Check if form is valid
|
|
73
81
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
2
|
import { ClassList } from '../../../utils/components.utils';
|
|
3
|
+
import { DialogRoleType } from './mg-modal.conf';
|
|
3
4
|
export declare class MgModal {
|
|
4
5
|
/************
|
|
5
6
|
* Internal *
|
|
@@ -22,11 +23,16 @@ export declare class MgModal {
|
|
|
22
23
|
* If not set, it will be created.
|
|
23
24
|
*/
|
|
24
25
|
identifier: string;
|
|
26
|
+
/**
|
|
27
|
+
* Modal dialog role.
|
|
28
|
+
*/
|
|
29
|
+
dialogRole: DialogRoleType;
|
|
30
|
+
validateDialogRole(newValue: MgModal['dialogRole']): void;
|
|
25
31
|
/**
|
|
26
32
|
* Displayed modal title
|
|
27
33
|
*/
|
|
28
34
|
modalTitle: string;
|
|
29
|
-
validateModalTitle(newValue:
|
|
35
|
+
validateModalTitle(newValue: MgModal['modalTitle']): void;
|
|
30
36
|
/**
|
|
31
37
|
* Define if modal has a cross button
|
|
32
38
|
*/
|
|
@@ -35,7 +41,7 @@ export declare class MgModal {
|
|
|
35
41
|
* Define if modal is hidden
|
|
36
42
|
*/
|
|
37
43
|
hide: boolean;
|
|
38
|
-
validateHide(newValue:
|
|
44
|
+
validateHide(newValue: MgModal['hide']): void;
|
|
39
45
|
/**
|
|
40
46
|
* Define if component is using actions slot
|
|
41
47
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../../stencil-public-runtime';
|
|
2
|
+
import { ClassList } from '../../../../utils/components.utils';
|
|
3
|
+
export declare class MgPopoverContent {
|
|
4
|
+
/************
|
|
5
|
+
* Internal *
|
|
6
|
+
************/
|
|
7
|
+
private messages;
|
|
8
|
+
/**************
|
|
9
|
+
* Decorators *
|
|
10
|
+
**************/
|
|
11
|
+
/**
|
|
12
|
+
* Get component DOM element
|
|
13
|
+
*/
|
|
14
|
+
element: HTMLMgPopoverContentElement;
|
|
15
|
+
/**
|
|
16
|
+
* Define if popover has a cross button
|
|
17
|
+
*/
|
|
18
|
+
closeButton: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Component classes
|
|
21
|
+
*/
|
|
22
|
+
classCollection: ClassList;
|
|
23
|
+
/**
|
|
24
|
+
* Emited event when close button is clicked
|
|
25
|
+
*/
|
|
26
|
+
hideContent: EventEmitter<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Handle action for close button
|
|
29
|
+
*/
|
|
30
|
+
private handleCloseButton;
|
|
31
|
+
/*************
|
|
32
|
+
* Lifecycle *
|
|
33
|
+
*************/
|
|
34
|
+
/**
|
|
35
|
+
* Check if component props are valide
|
|
36
|
+
*/
|
|
37
|
+
componentWillLoad(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Check if component slots are valide
|
|
40
|
+
*/
|
|
41
|
+
componentDidLoad(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Render
|
|
44
|
+
* @returns HTML Element
|
|
45
|
+
*/
|
|
46
|
+
render(): HTMLElement;
|
|
47
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
2
|
-
import { ClassList } from '../../../utils/components.utils';
|
|
3
2
|
import { Placement } from '@popperjs/core';
|
|
4
3
|
export declare class MgPopover {
|
|
5
4
|
/************
|
|
@@ -7,11 +6,8 @@ export declare class MgPopover {
|
|
|
7
6
|
************/
|
|
8
7
|
private popper;
|
|
9
8
|
private mgPopover;
|
|
10
|
-
private
|
|
9
|
+
private mgPopoverContent;
|
|
11
10
|
private windows;
|
|
12
|
-
private resizeObserver;
|
|
13
|
-
private messages;
|
|
14
|
-
private readonly classArrowHide;
|
|
15
11
|
/**************
|
|
16
12
|
* Decorators *
|
|
17
13
|
**************/
|
|
@@ -37,6 +33,7 @@ export declare class MgPopover {
|
|
|
37
33
|
* Define if popover has a cross button
|
|
38
34
|
*/
|
|
39
35
|
closeButton: boolean;
|
|
36
|
+
validateCloseButton(newValue: MgPopover['arrowHide']): void;
|
|
40
37
|
/**
|
|
41
38
|
* Display popover
|
|
42
39
|
*/
|
|
@@ -46,10 +43,6 @@ export declare class MgPopover {
|
|
|
46
43
|
* Disable popover
|
|
47
44
|
*/
|
|
48
45
|
disabled: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Component classes
|
|
51
|
-
*/
|
|
52
|
-
classCollection: ClassList;
|
|
53
46
|
/**
|
|
54
47
|
* Emited event when display value change
|
|
55
48
|
*/
|
|
@@ -68,9 +61,13 @@ export declare class MgPopover {
|
|
|
68
61
|
*/
|
|
69
62
|
private hide;
|
|
70
63
|
/**
|
|
71
|
-
* Handle
|
|
64
|
+
* Handle content hide event
|
|
65
|
+
*/
|
|
66
|
+
private handleHideContent;
|
|
67
|
+
/**
|
|
68
|
+
* Render popover content element
|
|
72
69
|
*/
|
|
73
|
-
private
|
|
70
|
+
private renderPopoverContent;
|
|
74
71
|
/*************
|
|
75
72
|
* Lifecycle *
|
|
76
73
|
*************/
|
|
@@ -19,6 +19,7 @@ import { IconType, SizeType, SlotLabelType } from "./components/molecules/mg-ite
|
|
|
19
19
|
import { Direction, ItemMoreType, MenuSizeType } from "./components/molecules/menu/mg-menu/mg-menu.conf";
|
|
20
20
|
import { Status } from "./components/molecules/menu/mg-menu-item/mg-menu-item.conf";
|
|
21
21
|
import { VariantType as VariantType2 } from "./components/molecules/mg-message/mg-message.conf";
|
|
22
|
+
import { DialogRoleType } from "./components/molecules/mg-modal/mg-modal.conf";
|
|
22
23
|
import { ExpandToggleDisplayType, TitlePositionType } from "./components/molecules/mg-panel/mg-panel.conf";
|
|
23
24
|
import { Placement } from "@popperjs/core";
|
|
24
25
|
import { SkipLink } from "./components/molecules/mg-skip-links/mg-skip-links.conf";
|
|
@@ -1003,6 +1004,10 @@ export namespace Components {
|
|
|
1003
1004
|
* Define if modal has a cross button
|
|
1004
1005
|
*/
|
|
1005
1006
|
"closeButton": boolean;
|
|
1007
|
+
/**
|
|
1008
|
+
* Modal dialog role.
|
|
1009
|
+
*/
|
|
1010
|
+
"dialogRole": DialogRoleType;
|
|
1006
1011
|
/**
|
|
1007
1012
|
* Define if modal is hidden
|
|
1008
1013
|
*/
|
|
@@ -1106,6 +1111,12 @@ export namespace Components {
|
|
|
1106
1111
|
*/
|
|
1107
1112
|
"placement": Placement;
|
|
1108
1113
|
}
|
|
1114
|
+
interface MgPopoverContent {
|
|
1115
|
+
/**
|
|
1116
|
+
* Define if popover has a cross button
|
|
1117
|
+
*/
|
|
1118
|
+
"closeButton": boolean;
|
|
1119
|
+
}
|
|
1109
1120
|
interface MgSkipLinks {
|
|
1110
1121
|
/**
|
|
1111
1122
|
* Skip links
|
|
@@ -1170,6 +1181,12 @@ export namespace Components {
|
|
|
1170
1181
|
*/
|
|
1171
1182
|
"placement": Placement;
|
|
1172
1183
|
}
|
|
1184
|
+
interface MgTooltipContent {
|
|
1185
|
+
/**
|
|
1186
|
+
* Displayed message in the tooltip
|
|
1187
|
+
*/
|
|
1188
|
+
"message": string;
|
|
1189
|
+
}
|
|
1173
1190
|
}
|
|
1174
1191
|
export interface MgButtonCustomEvent<T> extends CustomEvent<T> {
|
|
1175
1192
|
detail: T;
|
|
@@ -1247,6 +1264,10 @@ export interface MgPopoverCustomEvent<T> extends CustomEvent<T> {
|
|
|
1247
1264
|
detail: T;
|
|
1248
1265
|
target: HTMLMgPopoverElement;
|
|
1249
1266
|
}
|
|
1267
|
+
export interface MgPopoverContentCustomEvent<T> extends CustomEvent<T> {
|
|
1268
|
+
detail: T;
|
|
1269
|
+
target: HTMLMgPopoverContentElement;
|
|
1270
|
+
}
|
|
1250
1271
|
export interface MgSkipLinksCustomEvent<T> extends CustomEvent<T> {
|
|
1251
1272
|
detail: T;
|
|
1252
1273
|
target: HTMLMgSkipLinksElement;
|
|
@@ -1433,6 +1454,12 @@ declare global {
|
|
|
1433
1454
|
prototype: HTMLMgPopoverElement;
|
|
1434
1455
|
new (): HTMLMgPopoverElement;
|
|
1435
1456
|
};
|
|
1457
|
+
interface HTMLMgPopoverContentElement extends Components.MgPopoverContent, HTMLStencilElement {
|
|
1458
|
+
}
|
|
1459
|
+
var HTMLMgPopoverContentElement: {
|
|
1460
|
+
prototype: HTMLMgPopoverContentElement;
|
|
1461
|
+
new (): HTMLMgPopoverContentElement;
|
|
1462
|
+
};
|
|
1436
1463
|
interface HTMLMgSkipLinksElement extends Components.MgSkipLinks, HTMLStencilElement {
|
|
1437
1464
|
}
|
|
1438
1465
|
var HTMLMgSkipLinksElement: {
|
|
@@ -1457,6 +1484,12 @@ declare global {
|
|
|
1457
1484
|
prototype: HTMLMgTooltipElement;
|
|
1458
1485
|
new (): HTMLMgTooltipElement;
|
|
1459
1486
|
};
|
|
1487
|
+
interface HTMLMgTooltipContentElement extends Components.MgTooltipContent, HTMLStencilElement {
|
|
1488
|
+
}
|
|
1489
|
+
var HTMLMgTooltipContentElement: {
|
|
1490
|
+
prototype: HTMLMgTooltipContentElement;
|
|
1491
|
+
new (): HTMLMgTooltipContentElement;
|
|
1492
|
+
};
|
|
1460
1493
|
interface HTMLElementTagNameMap {
|
|
1461
1494
|
"mg-action-more": HTMLMgActionMoreElement;
|
|
1462
1495
|
"mg-badge": HTMLMgBadgeElement;
|
|
@@ -1487,10 +1520,12 @@ declare global {
|
|
|
1487
1520
|
"mg-pagination": HTMLMgPaginationElement;
|
|
1488
1521
|
"mg-panel": HTMLMgPanelElement;
|
|
1489
1522
|
"mg-popover": HTMLMgPopoverElement;
|
|
1523
|
+
"mg-popover-content": HTMLMgPopoverContentElement;
|
|
1490
1524
|
"mg-skip-links": HTMLMgSkipLinksElement;
|
|
1491
1525
|
"mg-tabs": HTMLMgTabsElement;
|
|
1492
1526
|
"mg-tag": HTMLMgTagElement;
|
|
1493
1527
|
"mg-tooltip": HTMLMgTooltipElement;
|
|
1528
|
+
"mg-tooltip-content": HTMLMgTooltipContentElement;
|
|
1494
1529
|
}
|
|
1495
1530
|
}
|
|
1496
1531
|
declare namespace LocalJSX {
|
|
@@ -2540,6 +2575,10 @@ declare namespace LocalJSX {
|
|
|
2540
2575
|
* Define if modal has a cross button
|
|
2541
2576
|
*/
|
|
2542
2577
|
"closeButton"?: boolean;
|
|
2578
|
+
/**
|
|
2579
|
+
* Modal dialog role.
|
|
2580
|
+
*/
|
|
2581
|
+
"dialogRole"?: DialogRoleType;
|
|
2543
2582
|
/**
|
|
2544
2583
|
* Define if modal is hidden
|
|
2545
2584
|
*/
|
|
@@ -2667,6 +2706,16 @@ declare namespace LocalJSX {
|
|
|
2667
2706
|
*/
|
|
2668
2707
|
"placement"?: Placement;
|
|
2669
2708
|
}
|
|
2709
|
+
interface MgPopoverContent {
|
|
2710
|
+
/**
|
|
2711
|
+
* Define if popover has a cross button
|
|
2712
|
+
*/
|
|
2713
|
+
"closeButton"?: boolean;
|
|
2714
|
+
/**
|
|
2715
|
+
* Emited event when close button is clicked
|
|
2716
|
+
*/
|
|
2717
|
+
"onHide-content"?: (event: MgPopoverContentCustomEvent<string>) => void;
|
|
2718
|
+
}
|
|
2670
2719
|
interface MgSkipLinks {
|
|
2671
2720
|
/**
|
|
2672
2721
|
* Skip links
|
|
@@ -2739,6 +2788,12 @@ declare namespace LocalJSX {
|
|
|
2739
2788
|
*/
|
|
2740
2789
|
"placement"?: Placement;
|
|
2741
2790
|
}
|
|
2791
|
+
interface MgTooltipContent {
|
|
2792
|
+
/**
|
|
2793
|
+
* Displayed message in the tooltip
|
|
2794
|
+
*/
|
|
2795
|
+
"message": string;
|
|
2796
|
+
}
|
|
2742
2797
|
interface IntrinsicElements {
|
|
2743
2798
|
"mg-action-more": MgActionMore;
|
|
2744
2799
|
"mg-badge": MgBadge;
|
|
@@ -2769,10 +2824,12 @@ declare namespace LocalJSX {
|
|
|
2769
2824
|
"mg-pagination": MgPagination;
|
|
2770
2825
|
"mg-panel": MgPanel;
|
|
2771
2826
|
"mg-popover": MgPopover;
|
|
2827
|
+
"mg-popover-content": MgPopoverContent;
|
|
2772
2828
|
"mg-skip-links": MgSkipLinks;
|
|
2773
2829
|
"mg-tabs": MgTabs;
|
|
2774
2830
|
"mg-tag": MgTag;
|
|
2775
2831
|
"mg-tooltip": MgTooltip;
|
|
2832
|
+
"mg-tooltip-content": MgTooltipContent;
|
|
2776
2833
|
}
|
|
2777
2834
|
}
|
|
2778
2835
|
export { LocalJSX as JSX };
|
|
@@ -2811,10 +2868,12 @@ declare module "@stencil/core" {
|
|
|
2811
2868
|
"mg-pagination": LocalJSX.MgPagination & JSXBase.HTMLAttributes<HTMLMgPaginationElement>;
|
|
2812
2869
|
"mg-panel": LocalJSX.MgPanel & JSXBase.HTMLAttributes<HTMLMgPanelElement>;
|
|
2813
2870
|
"mg-popover": LocalJSX.MgPopover & JSXBase.HTMLAttributes<HTMLMgPopoverElement>;
|
|
2871
|
+
"mg-popover-content": LocalJSX.MgPopoverContent & JSXBase.HTMLAttributes<HTMLMgPopoverContentElement>;
|
|
2814
2872
|
"mg-skip-links": LocalJSX.MgSkipLinks & JSXBase.HTMLAttributes<HTMLMgSkipLinksElement>;
|
|
2815
2873
|
"mg-tabs": LocalJSX.MgTabs & JSXBase.HTMLAttributes<HTMLMgTabsElement>;
|
|
2816
2874
|
"mg-tag": LocalJSX.MgTag & JSXBase.HTMLAttributes<HTMLMgTagElement>;
|
|
2817
2875
|
"mg-tooltip": LocalJSX.MgTooltip & JSXBase.HTMLAttributes<HTMLMgTooltipElement>;
|
|
2876
|
+
"mg-tooltip-content": LocalJSX.MgTooltipContent & JSXBase.HTMLAttributes<HTMLMgTooltipContentElement>;
|
|
2818
2877
|
}
|
|
2819
2878
|
}
|
|
2820
2879
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mgdis/mg-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.16.0",
|
|
4
4
|
"description": "MG Components",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@popperjs/core": "^2.11.7",
|
|
27
27
|
"@stencil/core": "^2.22.1",
|
|
28
28
|
"normalize.css": "^8.0.1",
|
|
29
|
-
"@mgdis/img": "1.
|
|
29
|
+
"@mgdis/img": "1.2.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@babel/core": "^7.20.12",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@babel/preset-env": "^7.22.5",
|
|
36
36
|
"@babel/preset-react": "^7.22.5",
|
|
37
37
|
"@babel/preset-typescript": "^7.22.5",
|
|
38
|
-
"@playwright/test": "^1.
|
|
38
|
+
"@playwright/test": "^1.x",
|
|
39
39
|
"@pxtrn/storybook-addon-docs-stencil": "^6.4.1",
|
|
40
40
|
"@stencil/sass": "^1.5.2",
|
|
41
41
|
"@storybook/addon-a11y": "^7.2.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@storybook/preset-scss": "^1.0.3",
|
|
50
50
|
"@types/jest": "npm:@types/jest@^26",
|
|
51
51
|
"@types/jest-image-snapshot": "^4.3.2",
|
|
52
|
-
"@types/node": "^18.
|
|
52
|
+
"@types/node": "^18.15.10",
|
|
53
53
|
"babel-loader": "^8.3.0",
|
|
54
54
|
"babel-plugin-jsx-pragmatic": "^1.0.2",
|
|
55
55
|
"chromatic": "^6.15.0",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"style-loader": "^2.0.0",
|
|
75
75
|
"ts-node": "^10.9.1",
|
|
76
76
|
"typescript": "^4.9.5",
|
|
77
|
-
"@mgdis/linting-stencil": "1.1.0",
|
|
78
|
-
"playwright-config": "1.0.0",
|
|
79
77
|
"eslint-config-stencil": "1.1.1",
|
|
80
|
-
"
|
|
78
|
+
"playwright-config": "1.0.0",
|
|
79
|
+
"tsconfig": "1.0.0",
|
|
80
|
+
"@mgdis/linting-stencil": "1.1.0"
|
|
81
81
|
},
|
|
82
82
|
"license": "BSD-3-Clause",
|
|
83
83
|
"scripts": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"lint:prettier:fix": "prettier --write **/*.{ts,tsx,scss,html,mdx,json}",
|
|
93
93
|
"test": "TZ=UTC stencil test --spec --e2e",
|
|
94
94
|
"test:unit": "TZ=UTC stencil test --spec --collectCoverage",
|
|
95
|
-
"test:e2e": "stencil test --e2e",
|
|
95
|
+
"test:e2e": "pnpm prebuild && stencil test --e2e --collectCoverage --collectCoverageFrom=\"src/**/*.e2e.ts\" --reporters=\"default\" --reporters=\"jest-junit\"",
|
|
96
96
|
"test:e2e:playwright": "pnpm --package=@pnpm/@playwright/test dlx playwright test",
|
|
97
97
|
"test:watch": "stencil test --spec --e2e --watchAll",
|
|
98
98
|
"generate": "stencil generate",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as s,g as e}from"./p-3bf1e2f0.js";import{i as o,D as h}from"./p-067080e4.js";var n;!function(t){t.BASE_INDEX="data-overflow-base-index",t.PROXY_INDEX="data-overflow-proxy-index"}(n||(n={}));class r{constructor(t,i){this.element=t,this.render=i,this.disconnect=()=>{this._resizeObserver.disconnect()},this.run=t=>{void 0===this._moreElement&&(this._moreElement=this.render(),this._baseChildren=this.getInteractiveItems(this.element),(()=>"MG-ITEM-MORE"===this._moreElement.nodeName)()&&(this._proxyChildren=this.getInteractiveItems(this._moreElement.shadowRoot.querySelector("mg-menu"))),this._baseChildren.forEach(((t,i)=>{t.setAttribute(n.BASE_INDEX,`${i}`),this._proxyChildren[i].setAttribute(n.PROXY_INDEX,`${i}`)}))),void 0!==t&&this.updateDisplayedItems(t)},this.getInteractiveItems=t=>{var i;return((null===(i=t.children)||void 0===i?void 0:i.length)>0?Array.from(t.children):[]).filter((t=>["MG-MENU-ITEM","MG-BUTTON"].includes(t.nodeName)))},this.updateDisplayedItems=t=>{this.restoreItems();const i={accWidth:0,previousItem:null};[...this._baseChildren,this._moreElement].forEach((s=>{i.accWidth+=s.offsetWidth;const e=null!==i.previousItem&&null!==i.previousItem.getAttribute("hidden");this.toggleItem(s,e&&!this.isMoreElement(s)||this.isOverflowElement(i.accWidth,s,t)||this.isMoreElement(s)&&!e),i.previousItem=s}))},this.isOverflowElement=(t,i,s)=>null!==i.previousElementSibling&&!this.isMoreElement(i)&&(this.isMoreElement(i.nextElementSibling)?t>s:t+this._moreElement.offsetWidth>s),this.isMoreElement=t=>"MG-ITEM-MORE"===t.nodeName,this.toggleItem=(t,i)=>{const s=Number(t.getAttribute(n.BASE_INDEX));this.isMoreElement(t)?this.toggleElement(this._moreElement,i):s>=0&&(this.toggleElement(t,i),this.toggleElement(this._proxyChildren[s],!i))},this.toggleElement=(t,i)=>{i?t.setAttribute("hidden",""):t.removeAttribute("hidden")},this.restoreItems=()=>{[...this._baseChildren,this._moreElement].forEach((t=>t.removeAttribute("hidden")))},void 0===this._resizeObserver&&(this._resizeObserver=new ResizeObserver((t=>{t.forEach((t=>{this.run(t.contentRect.width)}))})),this._resizeObserver.observe(this.element)),this.run()}}const a=class{constructor(i){t(this,i),this.name="mg-item-more",this.renderMgMenuItemOverflowElement=()=>{const t=this.element.shadowRoot.querySelector("mg-menu-item");this.menuItems.forEach((i=>{t.querySelector("mg-menu").appendChild(i.cloneNode(!0))}));const i=Array.from(this.parentMenu.querySelectorAll("mg-menu-item:not([data-overflow-more])"));return Array.from(t.querySelectorAll("mg-menu-item:not([data-overflow-more])")).forEach(((t,s)=>{t.addEventListener("click",(()=>{i[s].shadowRoot.querySelector("a, button").click()})),""!==t.id.trim()&&(t.id=`${t.id}-proxy`),i[s].addEventListener("status-change",(i=>{t.setAttribute("status",i.detail)}))})),this.element},this.icon={icon:"ellipsis-vertical"},this.slotlabel={display:!1},this.size=void 0,this.parentMenu=void 0}validateIcon(t){if("object"!=typeof t||"object"==typeof t&&"string"!=typeof t.icon)throw new Error(`<${this.name}> prop "icon" must match MgItemMore['icon'] type.`)}validateSlotLabel(t){if("object"!=typeof t||"object"==typeof t&&"boolean"!=typeof t.display)throw new Error(`<${this.name}> prop "slotlabel" must match MgItemMore['slotlabel'] type.`);"string"!=typeof t.label&&(this.slotlabel.label=this.messages.moreLabel)}validateSize(t){if(t&&"string"!=typeof t)throw new Error(`<${this.name}> prop "size" must match MgItemMore['size'] type.`)}disconnectedCallback(){this.overflowBehavior.disconnect()}componentWillLoad(){this.messages=o(this.element).messages.plusMenu,this.parentMenu=this.element.closest("mg-menu"),this.menuItems=Array.from(this.parentMenu.children).filter((t=>"MG-MENU-ITEM"===t.nodeName)),this.validateIcon(this.icon),this.validateSlotLabel(this.slotlabel),this.validateSize(this.size)}componentDidLoad(){this.overflowBehavior=new r(this.parentMenu,this.renderMgMenuItemOverflowElement)}render(){return i(s,{role:"menuitem","aria-haspopup":"true"},i("mg-menu-item",{"data-overflow-more":!0,"data-size":this.parentMenu.size},i("mg-icon",{icon:this.icon.icon,slot:"image"}),i("span",{class:{"sr-only":!this.slotlabel.display},slot:"label"},this.slotlabel.label),i("mg-menu",{direction:h.VERTICAL,label:this.messages.moreLabel,size:this.size})))}get element(){return e(this)}static get watchers(){return{icon:["validateIcon"],slotlabel:["validateSlotLabel"],size:["validateSize"]}}};a.style=".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1px) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){.mg-a11y-animation{animation:none !important;transition:none !important}}:host{display:flex}";export{a as mg_item_more}
|