@momentum-design/components 0.134.6 → 0.134.8
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/browser/index.js +2 -2
- package/dist/browser/index.js.map +3 -3
- package/dist/components/tooltip/tooltip.component.d.ts +20 -3
- package/dist/components/tooltip/tooltip.component.js +53 -22
- package/dist/custom-elements.json +32 -11
- package/dist/utils/mixins/OverflowMixin.js +1 -2
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
:host([size='20']) {
|
|
150
150
|
--mdc-button-height: 1.25rem;
|
|
151
151
|
}
|
|
152
|
-
`,...Et()],Tf=ax;var fr=class extends Mt(Nt(Ve(ri(te(X))))){constructor(){super();this.size=ja.SIZE;this.role=ja.ROLE;this.type=ja.TYPE;this.prevTabindex=0;this.internals=this.attachInternals(),this.addEventListener("click",this.executeAction.bind(this)),this.addEventListener("keydown",this.handleKeyDown.bind(this)),this.addEventListener("keyup",this.handleKeyUp.bind(this)),this.addEventListener("blur",this.handleBlur.bind(this))}get form(){return this.internals.form}update(t){super.update(t),t.has("disabled")&&this.setDisabled(this,this.disabled),t.has("softDisabled")&&this.setSoftDisabled(this,this.softDisabled),t.has("active")&&(this.active!==void 0&&(this.ariaStateKey=this.ariaStateKey||ja.ARIA_STATE_KEY),this.setActive(this,this.active))}executeAction(){this.type===Rs.SUBMIT&&this.form&&this.form.requestSubmit(),this.type===Rs.RESET&&this.form&&this.form.reset()}setActive(t,e){this.ariaStateKey&&this.ariaStateKey.split(",").filter(l=>l.trim().startsWith("aria-")).forEach(l=>{e===!0?t.setAttribute(l.trim(),"true"):e===!1?t.setAttribute(l.trim(),"false"):t.removeAttribute(l.trim())})}setSoftDisabled(t,e){e?t.setAttribute("aria-disabled","true"):t.removeAttribute("aria-disabled")}setDisabled(t,e){e?(t.setAttribute("aria-disabled","true"),this.prevTabindex=this.tabIndex,this.tabIndex=-1):(this.tabIndex===-1&&(this.tabIndex=this.prevTabindex),t.removeAttribute("aria-disabled"))}triggerClickEvent(){this.click()}handleBlur(){this.classList.contains("pressed")&&this.classList.remove("pressed")}handleKeyDown(t){let e=this.getActionForKeyEvent(t);(e===Y.ENTER||e===Y.SPACE)&&(this.classList.add("pressed"),e===Y.ENTER&&(this.triggerClickEvent(),this.keyDownEventHandled()),t.preventDefault())}handleKeyUp(t){let e=this.getActionForKeyEvent(t);if(e===Y.ENTER||e===Y.SPACE){let i=this.classList.contains("pressed");this.classList.remove("pressed"),e===Y.SPACE&&i&&this.triggerClickEvent()}}render(){return S` <slot></slot> `}};fr.formAssociated=!0,fr.styles=[...X.styles,...Tf],h([u({type:Boolean,reflect:!0})],fr.prototype,"active",2),h([u({type:Boolean,attribute:"soft-disabled",reflect:!0})],fr.prototype,"softDisabled",2),h([u({type:Number,reflect:!0})],fr.prototype,"size",2),h([u({type:String,reflect:!0})],fr.prototype,"role",2),h([u({type:String,reflect:!0})],fr.prototype,"ariaStateKey",2),h([u({reflect:!0})],fr.prototype,"type",2),h([u({type:String,reflect:!0})],fr.prototype,"name",2),h([u({type:String,reflect:!0})],fr.prototype,"value",2);var fe=fr;var Rl=a=>{class o extends a{get overflowElement(){return this}isWidthOverflowing(){let e=this.overflowElement;return e.scrollWidth>e.clientWidth}isHeightOverflowing(){
|
|
152
|
+
`,...Et()],Tf=ax;var fr=class extends Mt(Nt(Ve(ri(te(X))))){constructor(){super();this.size=ja.SIZE;this.role=ja.ROLE;this.type=ja.TYPE;this.prevTabindex=0;this.internals=this.attachInternals(),this.addEventListener("click",this.executeAction.bind(this)),this.addEventListener("keydown",this.handleKeyDown.bind(this)),this.addEventListener("keyup",this.handleKeyUp.bind(this)),this.addEventListener("blur",this.handleBlur.bind(this))}get form(){return this.internals.form}update(t){super.update(t),t.has("disabled")&&this.setDisabled(this,this.disabled),t.has("softDisabled")&&this.setSoftDisabled(this,this.softDisabled),t.has("active")&&(this.active!==void 0&&(this.ariaStateKey=this.ariaStateKey||ja.ARIA_STATE_KEY),this.setActive(this,this.active))}executeAction(){this.type===Rs.SUBMIT&&this.form&&this.form.requestSubmit(),this.type===Rs.RESET&&this.form&&this.form.reset()}setActive(t,e){this.ariaStateKey&&this.ariaStateKey.split(",").filter(l=>l.trim().startsWith("aria-")).forEach(l=>{e===!0?t.setAttribute(l.trim(),"true"):e===!1?t.setAttribute(l.trim(),"false"):t.removeAttribute(l.trim())})}setSoftDisabled(t,e){e?t.setAttribute("aria-disabled","true"):t.removeAttribute("aria-disabled")}setDisabled(t,e){e?(t.setAttribute("aria-disabled","true"),this.prevTabindex=this.tabIndex,this.tabIndex=-1):(this.tabIndex===-1&&(this.tabIndex=this.prevTabindex),t.removeAttribute("aria-disabled"))}triggerClickEvent(){this.click()}handleBlur(){this.classList.contains("pressed")&&this.classList.remove("pressed")}handleKeyDown(t){let e=this.getActionForKeyEvent(t);(e===Y.ENTER||e===Y.SPACE)&&(this.classList.add("pressed"),e===Y.ENTER&&(this.triggerClickEvent(),this.keyDownEventHandled()),t.preventDefault())}handleKeyUp(t){let e=this.getActionForKeyEvent(t);if(e===Y.ENTER||e===Y.SPACE){let i=this.classList.contains("pressed");this.classList.remove("pressed"),e===Y.SPACE&&i&&this.triggerClickEvent()}}render(){return S` <slot></slot> `}};fr.formAssociated=!0,fr.styles=[...X.styles,...Tf],h([u({type:Boolean,reflect:!0})],fr.prototype,"active",2),h([u({type:Boolean,attribute:"soft-disabled",reflect:!0})],fr.prototype,"softDisabled",2),h([u({type:Number,reflect:!0})],fr.prototype,"size",2),h([u({type:String,reflect:!0})],fr.prototype,"role",2),h([u({type:String,reflect:!0})],fr.prototype,"ariaStateKey",2),h([u({reflect:!0})],fr.prototype,"type",2),h([u({type:String,reflect:!0})],fr.prototype,"name",2),h([u({type:String,reflect:!0})],fr.prototype,"value",2);var fe=fr;var Rl=a=>{class o extends a{get overflowElement(){return this}isWidthOverflowing(){let e=this.overflowElement;return e.scrollWidth>e.clientWidth}isHeightOverflowing(){return this.scrollHeight>this.clientHeight}}return o};var nx=H`
|
|
153
153
|
:host {
|
|
154
154
|
--mdc-button-prefix-icon-size: 1rem;
|
|
155
155
|
--mdc-button-postfix-icon-size: 1rem;
|
|
@@ -4857,7 +4857,7 @@
|
|
|
4857
4857
|
:host([color='contrast'])::part(popover-content) {
|
|
4858
4858
|
color: var(--mdc-tooltip-text-color-contrast);
|
|
4859
4859
|
}
|
|
4860
|
-
`,Vb=[J0];var ca=class extends nr{constructor(){super(...arguments);this.tooltipType=Ze.TOOLTIP_TYPE;this.onlyShowWhenTriggerOverflows=Ze.ONLY_SHOW_WHEN_TRIGGER_OVERFLOWS}connectedCallback(){super.connectedCallback(),this.role=et.TOOLTIP,this.ariaHidden=Ze.ARIA_HIDDEN,this.backdrop=Ze.BACKDROP,this.delay=this.delay||Ze.DELAY,this.disableAriaExpanded=Ze.DISABLE_ARIA_EXPANDED,this.hideOnBlur=Ze.HIDE_ON_BLUR,this.hideOnEscape=Ze.HIDE_ON_ESCAPE,this.offset=this.offset||Ze.OFFSET,this.placement=this.placement||Ze.PLACEMENT,this.trigger=Ze.TRIGGER,this.closeButton=bt.CLOSE_BUTTON,this.disableFlip=bt.DISABLE_FLIP,this.focusBackToTrigger=bt.FOCUS_BACK,this.focusTrap=bt.FOCUS_TRAP,this.hideOnOutsideClick=bt.HIDE_ON_CLICK_OUTSIDE,this.interactive=bt.INTERACTIVE,this.preventScroll=bt.PREVENT_SCROLL,this.size=bt.SIZE}setTooltipType(t){this.setAttribute("tooltip-type",Object.values(Or).includes(t)?t:Ze.TOOLTIP_TYPE)}
|
|
4860
|
+
`,Vb=[J0];var ca=class extends nr{constructor(){super(...arguments);this.tooltipType=Ze.TOOLTIP_TYPE;this.onlyShowWhenTriggerOverflows=Ze.ONLY_SHOW_WHEN_TRIGGER_OVERFLOWS;this.autoGeneratedId=null}connectedCallback(){super.connectedCallback(),this.role=et.TOOLTIP,this.ariaHidden=Ze.ARIA_HIDDEN,this.backdrop=Ze.BACKDROP,this.delay=this.delay||Ze.DELAY,this.disableAriaExpanded=Ze.DISABLE_ARIA_EXPANDED,this.hideOnBlur=Ze.HIDE_ON_BLUR,this.hideOnEscape=Ze.HIDE_ON_ESCAPE,this.offset=this.offset||Ze.OFFSET,this.placement=this.placement||Ze.PLACEMENT,this.trigger=Ze.TRIGGER,this.closeButton=bt.CLOSE_BUTTON,this.disableFlip=bt.DISABLE_FLIP,this.focusBackToTrigger=bt.FOCUS_BACK,this.focusTrap=bt.FOCUS_TRAP,this.hideOnOutsideClick=bt.HIDE_ON_CLICK_OUTSIDE,this.interactive=bt.INTERACTIVE,this.preventScroll=bt.PREVENT_SCROLL,this.size=bt.SIZE}setTooltipType(t){this.setAttribute("tooltip-type",Object.values(Or).includes(t)?t:Ze.TOOLTIP_TYPE)}ensureId(){if(this.id.length>0){this.autoGeneratedId&&this.id!==this.autoGeneratedId&&(this.autoGeneratedId=null);return}this.autoGeneratedId||(this.autoGeneratedId=`mdc-tooltip-${ze()}`),this.id=this.autoGeneratedId}syncTriggerAriaForId(){if(this.triggerElement)switch(this.tooltipType){case Or.DESCRIPTION:this.triggerElement.setAttribute("aria-describedby",this.id);break;case Or.LABEL:this.triggerElement.setAttribute("aria-labelledby",this.id);break;default:break}}onPlacementUpdated(){Object.values(Lt).includes(this.placement)||(this.placement=Ze.PLACEMENT)}onTooltipTypeUpdated(t){let e=t.get("tooltipType");if(Object.values(Or).includes(this.tooltipType)||this.setTooltipType(Ze.TOOLTIP_TYPE),this.triggerElement)switch(this.tooltipType){case Or.DESCRIPTION:e===Or.LABEL&&this.triggerElement.removeAttribute("aria-labelledby"),this.triggerElement.setAttribute("aria-describedby",this.id);break;case Or.LABEL:e===Or.DESCRIPTION&&this.triggerElement.removeAttribute("aria-describedby"),this.triggerElement.setAttribute("aria-labelledby",this.id);break;default:e===Or.DESCRIPTION?this.triggerElement.removeAttribute("aria-describedby"):e===Or.LABEL&&this.triggerElement.removeAttribute("aria-labelledby");break}}async isOpenUpdated(t,e){let{triggerElement:i}=this;t===e||!i||(e||this.depthManager.remove([this]),await super.isOpenUpdated(t,e))}willUpdate(t){super.willUpdate(t);let e=t.has("id");e&&this.ensureId(),t.has("placement")&&this.onPlacementUpdated(),t.has("tooltipType")?this.onTooltipTypeUpdated(t):e&&this.syncTriggerAriaForId()}show(){this.onlyShowWhenTriggerOverflows&&this.triggerElement&&Ll(this.triggerElement)&&!this.triggerElement.isWidthOverflowing()||super.show()}};ca.styles=[...nr.styles,...Vb],h([u({type:String,attribute:"tooltip-type",reflect:!0})],ca.prototype,"tooltipType",2),h([u({type:Boolean,attribute:"only-show-when-trigger-overflows",reflect:!0})],ca.prototype,"onlyShowWhenTriggerOverflows",2);var Pp=ca;Pp.register(Vn);var tS=Pp;var zb=B.constructTagName("toggle"),zn={DEFAULT:"default",COMPACT:"compact"};var Fp={SIZE:zn.DEFAULT,VALIDATION_MESSAGE:"Please toggle this switch if you want to proceed."};var mi=a=>{class o extends a{constructor(){super(...arguments);this.controlTypeProviderContext=Ie.consume({host:this,context:lp.Context})}willUpdate(){this.controlType&&Dd.includes(this.controlType)||(this.controlTypeProviderContext.value?this.controlType=this.controlTypeProviderContext.value:this.controlType=Rd.CONTROL_TYPE)}}return h([u({type:String,attribute:"control-type",reflect:!0})],o.prototype,"controlType",2),o};var tc=B.constructTagName("menuitemcheckbox"),Bn={NONE:"none",CHECKBOX:"checkbox",CHECKMARK:"checkmark",TOGGLE:"toggle"},Bb={INDICATOR:Bn.CHECKBOX};var eS=H`
|
|
4861
4861
|
:host::part(checkmark-icon) {
|
|
4862
4862
|
--mdc-icon-fill-color: currentColor;
|
|
4863
4863
|
}
|