148 lines
74 KiB
JavaScript
148 lines
74 KiB
JavaScript
|
import{u as e,v as t,G as i,M as c,_ as o,i as r,e as n,t as a,B as d,$ as s,o as p,I as l,y as m,p as h,q as u,r as f,n as b,a as g,h as k,J as x,K as _,g as y,w as v,R as T,j as w,A as E}from"./main-ad130be7.js";import{c as O,o as I}from"./c.82eccc94.js";import{o as C}from"./c.8e28b461.js";var A,R,S={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",IS_OPEN_BELOW:"mdc-menu-surface--is-open-below",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"},F={CLOSED_EVENT:"MDCMenuSurface:closed",CLOSING_EVENT:"MDCMenuSurface:closing",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")},B={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67,TOUCH_EVENT_WAIT_MS:30};!function(e){e[e.BOTTOM=1]="BOTTOM",e[e.CENTER=2]="CENTER",e[e.RIGHT=4]="RIGHT",e[e.FLIP_RTL=8]="FLIP_RTL"}(A||(A={})),function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=4]="TOP_RIGHT",e[e.BOTTOM_LEFT=1]="BOTTOM_LEFT",e[e.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",e[e.TOP_START=8]="TOP_START",e[e.TOP_END=12]="TOP_END",e[e.BOTTOM_START=9]="BOTTOM_START",e[e.BOTTOM_END=13]="BOTTOM_END"}(R||(R={}));var M=function(c){function o(e){var i=c.call(this,t(t({},o.defaultAdapter),e))||this;return i.isSurfaceOpen=!1,i.isQuickOpen=!1,i.isHoistedElement=!1,i.isFixedPosition=!1,i.isHorizontallyCenteredOnViewport=!1,i.maxHeight=0,i.openBottomBias=0,i.openAnimationEndTimerId=0,i.closeAnimationEndTimerId=0,i.animationRequestId=0,i.anchorCorner=R.TOP_START,i.originCorner=R.TOP_START,i.anchorMargin={top:0,right:0,bottom:0,left:0},i.position={x:0,y:0},i}return e(o,c),Object.defineProperty(o,"cssClasses",{get:function(){return S},enumerable:!1,configurable:!0}),Object.defineProperty(o,"strings",{get:function(){return F},enumerable:!1,configurable:!0}),Object.defineProperty(o,"numbers",{get:function(){return B},enumerable:!1,configurable:!0}),Object.defineProperty(o,"Corner",{get:function(){return R},enumerable:!1,configurable:!0}),Object.defineProperty(o,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},hasAnchor:function(){return!1},isElementInContainer:function(){return!1},isFocused:function(){return!1},isRtl:function(){return!1},getInnerDimensions:function(){return{height:0,width:0}},getAnchorDimensions:function(){return null},getWindowDimensions:function(){return{height:0,width:0}},getBodyDimensions:function(){return{height:0,width:0}},getWindowScroll:function(){return{x:0,y:0}},setPosition:function(){},setMaxHeight:function(){},setTransformOrigin:function(){},saveFocus:function(){},restoreFocus:function(){},notifyClose:function(){},notifyOpen:function(){},notifyClosing:function(){}}},enumerable:!1,configurable:!0}),o.prototype.init=function(){var e=o.cssClasses,t=e.ROOT,i=e.OPEN;if(!this.adapter.hasClass(t))throw new Error(t+" class required in root element.");this.adapter.hasClass(i)&&(this.isSurfaceOpen=!0)},o.prototype.destroy=function(){clearTimeout(this.openAnimationEndTimerId),clearTimeout(this.closeAnimationEndTimerId),cancelAnimationFrame(this.animationRequestId)},o.prototype.setAnchorCorner=function(e){this.anchorCorner=e},o.prototype.flipCornerHorizontally=function(){this.originCorner=this.originCorner^A.RIGHT},o.prototype.setAnchorMargin=function(e){this.anchorMargin.top=e.top||0,this.anchorMargin.right=e.right||0,this.anchorMargin.bottom=e.bottom||0,this.anchorMargin.left=e.left||0},o.prototype.setIsHoisted=function(e){this.isHoistedElement=e},o.prototype.setFixedPosition=function(e){this.isFixedPosition=e},o.prototype.isFixed=function(){return this.isFixedPosition},o.prototype.setAbsolutePosition=function(e,t){this.position.x=this.isFinite(e)?e:0,this.position.y=this.isFinite(t)?t:0},o.prototype.setIsHorizontallyCenteredOnVi
|
||
|
<div
|
||
|
class="mdc-menu-surface ${p(e)}"
|
||
|
style="${l(t)}"
|
||
|
@keydown=${this.onKeydown}
|
||
|
@opened=${this.registerBodyClick}
|
||
|
@closed=${this.deregisterBodyClick}>
|
||
|
<slot></slot>
|
||
|
</div>`}createAdapter(){return Object.assign(Object.assign({},m(this.mdcRoot)),{hasAnchor:()=>!!this.anchor,notifyClose:()=>{const e=new CustomEvent("closed",{bubbles:!0,composed:!0});this.open=!1,this.mdcRoot.dispatchEvent(e)},notifyClosing:()=>{const e=new CustomEvent("closing",{bubbles:!0,composed:!0});this.mdcRoot.dispatchEvent(e)},notifyOpen:()=>{const e=new CustomEvent("opened",{bubbles:!0,composed:!0});this.open=!0,this.mdcRoot.dispatchEvent(e)},isElementInContainer:()=>!1,isRtl:()=>!!this.mdcRoot&&"rtl"===getComputedStyle(this.mdcRoot).direction,setTransformOrigin:e=>{this.mdcRoot&&(this.styleTransformOrigin=e)},isFocused:()=>h(this),saveFocus:()=>{const e=u(),t=e.length;t||(this.previouslyFocused=null),this.previouslyFocused=e[t-1]},restoreFocus:()=>{this.previouslyFocused&&"focus"in this.previouslyFocused&&this.previouslyFocused.focus()},getInnerDimensions:()=>{const e=this.mdcRoot;return e?{width:e.offsetWidth,height:e.offsetHeight}:{width:0,height:0}},getAnchorDimensions:()=>{const e=this.anchor;return e?e.getBoundingClientRect():null},getBodyDimensions:()=>({width:document.body.clientWidth,height:document.body.clientHeight}),getWindowDimensions:()=>({width:window.innerWidth,height:window.innerHeight}),getWindowScroll:()=>({x:window.pageXOffset,y:window.pageYOffset}),setPosition:e=>{this.mdcRoot&&(this.styleLeft="left"in e?`${e.left}px`:"",this.styleRight="right"in e?`${e.right}px`:"",this.styleTop="top"in e?`${e.top}px`:"",this.styleBottom="bottom"in e?`${e.bottom}px`:"")},setMaxHeight:async e=>{this.mdcRoot&&(this.styleMaxHeight=e,await this.updateComplete,this.styleMaxHeight=`var(--mdc-menu-max-height, ${e})`)}})}onKeydown(e){this.mdcFoundation&&this.mdcFoundation.handleKeydown(e)}onBodyClick(e){if(this.stayOpenOnBodyClick)return;-1===e.composedPath().indexOf(this)&&this.close()}registerBodyClick(){this.onBodyClickBound=this.onBodyClick.bind(this),document.body.addEventListener("click",this.onBodyClickBound,{passive:!0,capture:!0})}deregisterBodyClick(){document.body.removeEventListener("click",this.onBodyClickBound,{capture:!0})}close(){this.open=!1}show(){this.open=!0}}o([r(".mdc-menu-surface")],N.prototype,"mdcRoot",void 0),o([r("slot")],N.prototype,"slotElement",void 0),o([n({type:Boolean}),C((function(e){this.mdcFoundation&&!this.fixed&&this.mdcFoundation.setIsHoisted(e)}))],N.prototype,"absolute",void 0),o([n({type:Boolean})],N.prototype,"fullwidth",void 0),o([n({type:Boolean}),C((function(e){this.mdcFoundation&&!this.absolute&&this.mdcFoundation.setFixedPosition(e)}))],N.prototype,"fixed",void 0),o([n({type:Number}),C((function(e){this.mdcFoundation&&null!==this.y&&null!==e&&(this.mdcFoundation.setAbsolutePosition(e,this.y),this.mdcFoundation.setAnchorMargin({left:e,top:this.y,right:-e,bottom:this.y}))}))],N.prototype,"x",void 0),o([n({type:Number}),C((function(e){this.mdcFoundation&&null!==this.x&&null!==e&&(this.mdcFoundation.setAbsolutePosition(this.x,e),this.mdcFoundation.setAnchorMargin({left:this.x,top:e,right:-this.x,bottom:e}))}))],N.prototype,"y",void 0),o([n({type:Boolean}),C((function(e){this.mdcFoundation&&this.mdcFoundation.setQuickOpen(e)}))],N.prototype,"quick",void 0),o([n({type:Boolean,reflect:!0}),C((function(e,t){this.mdcFoundation&&(e?this.mdcFoundation.open():void 0!==t&&this.mdcFoundation.close())}))],N.prototype,"open",void 0),o([n({type:Boolean})],N.prototype,"stayOpenOnBodyClick",void 0),o([a(),C((function(e){this.mdcFoundation&&this.mdcFoundation.setAnchorCorner(e)}))],N.prototype,"bitwiseCorner",void 0),o([n({type:String}),C((function(e){if(this.mdcFoundation){const t="START"===e||"END"===e,i=null===this.previousMenuCorner,c=!i&&e!==this.previousMenuCorner,o=i&&"END"===e;t&&(c||o)&&(this.bitwiseCorner=this.bitwiseCorner^A.RIGHT,this.mdcFoundation.flipCornerHorizontally(),this.previousMenuCorner=e)}}))],N.prototype,"menuCorner",void 0),o([n({type:String}),C((function(e){if(this.mdcFoundation&&e){let t=L[e];"END"===this.menuCorner&&(t^=A.RIGHT),this.bitwiseCorner=t}}))],N.prototype,"corner",void 0),o([a()],N.prototype,"styleTop",void 0),o([a()],N.prototype,"styleLeft"
|
||
|
<mwc-menu-surface
|
||
|
?hidden=${!this.open}
|
||
|
.anchor=${this.anchor}
|
||
|
.open=${this.open}
|
||
|
.quick=${this.quick}
|
||
|
.corner=${this.corner}
|
||
|
.x=${this.x}
|
||
|
.y=${this.y}
|
||
|
.absolute=${this.absolute}
|
||
|
.fixed=${this.fixed}
|
||
|
.fullwidth=${this.fullwidth}
|
||
|
.menuCorner=${this.menuCorner}
|
||
|
?stayOpenOnBodyClick=${this.stayOpenOnBodyClick}
|
||
|
class="mdc-menu mdc-menu-surface"
|
||
|
@closed=${this.onClosed}
|
||
|
@opened=${this.onOpened}
|
||
|
@keydown=${this.onKeydown}>
|
||
|
<mwc-list
|
||
|
rootTabbable
|
||
|
.innerAriaLabel=${this.innerAriaLabel}
|
||
|
.innerRole=${this.innerRole}
|
||
|
.multi=${this.multi}
|
||
|
class="mdc-deprecated-list"
|
||
|
.itemRoles=${e}
|
||
|
.wrapFocus=${this.wrapFocus}
|
||
|
.activatable=${this.activatable}
|
||
|
@action=${this.onAction}>
|
||
|
<slot></slot>
|
||
|
</mwc-list>
|
||
|
</mwc-menu-surface>`}createAdapter(){return{addClassToElementAtIndex:(e,t)=>{const i=this.listElement;if(!i)return;const c=i.items[e];c&&("mdc-menu-item--selected"===t?this.forceGroupSelection&&!c.selected&&i.toggle(e,!0):c.classList.add(t))},removeClassFromElementAtIndex:(e,t)=>{const i=this.listElement;if(!i)return;const c=i.items[e];c&&("mdc-menu-item--selected"===t?c.selected&&i.toggle(e,!1):c.classList.remove(t))},addAttributeToElementAtIndex:(e,t,i)=>{const c=this.listElement;if(!c)return;const o=c.items[e];o&&o.setAttribute(t,i)},removeAttributeFromElementAtIndex:(e,t)=>{const i=this.listElement;if(!i)return;const c=i.items[e];c&&c.removeAttribute(t)},getAttributeFromElementAtIndex:(e,t)=>{const i=this.listElement;if(!i)return null;const c=i.items[e];return c?c.getAttribute(t):null},elementContainsClass:(e,t)=>e.classList.contains(t),closeSurface:()=>{this.open=!1},getElementIndex:e=>{const t=this.listElement;return t?t.items.indexOf(e):-1},notifySelected:()=>{},getMenuItemCount:()=>{const e=this.listElement;return e?e.items.length:0},focusItemAtIndex:e=>{const t=this.listElement;if(!t)return;const i=t.items[e];i&&i.focus()},focusListRoot:()=>{this.listElement&&this.listElement.focus()},getSelectedSiblingOfItemAtIndex:e=>{const t=this.listElement;if(!t)return-1;const i=t.items[e];if(!i||!i.group)return-1;for(let c=0;c<t.items.length;c++){if(c===e)continue;const o=t.items[c];if(o.selected&&o.group===i.group)return c}return-1},isSelectableItemAtIndex:e=>{const t=this.listElement;if(!t)return!1;const i=t.items[e];return!!i&&i.hasAttribute("group")}}}onKeydown(e){this.mdcFoundation&&this.mdcFoundation.handleKeydown(e)}onAction(e){const t=this.listElement;if(this.mdcFoundation&&t){const i=e.detail.index,c=t.items[i];c&&this.mdcFoundation.handleItemAction(c)}}onOpened(){this.open=!0,this.mdcFoundation&&this.mdcFoundation.handleMenuSurfaceOpened()}onClosed(){this.open=!1}async getUpdateComplete(){await this._listUpdateComplete;return await super.getUpdateComplete()}async firstUpdated(){super.firstUpdated();const e=this.listElement;e&&(this._listUpdateComplete=e.updateComplete,await this._listUpdateComplete)}select(e){const t=this.listElement;t&&t.select(e)}close(){this.open=!1}show(){this.open=!0}getFocusedItemIndex(){const e=this.listElement;return e?e.getFocusedItemIndex():-1}focusItemAtIndex(e){const t=this.listElement;t&&t.focusItemAtIndex(e)}layout(e=!0){const t=this.listElement;t&&t.layout(e)}}o([r(".mdc-menu")],W.prototype,"mdcRoot",void 0),o([r("slot")],W.prototype,"slotElement",void 0),o([n({type:Object})],W.prototype,"anchor",void 0),o([n({type:Boolean,reflect:!0})],W.prototype,"open",void 0),o([n({type:Boolean})],W.prototype,"quick",void 0),o([n({type:Boolean})],W.prototype,"wrapFocus",void 0),o([n({type:String})],W.prototype,"innerRole",void 0),o([n({type:String})],W.prototype,"innerAriaLabel",void 0),o([n({type:String})],W.prototype,"corner",void 0),o([n({type:Number})],W.prototype,"x",void 0),o([n({type:Number})],W.prototype,"y",void 0),o([n({type:Boolean})],W.prototype,"absolute",void 0),o([n({type:Boolean})],W.prototype,"multi",void 0),o([n({type:Boolean})],W.prototype,"activatable",void 0),o([n({type:Boolean})],W.prototype,"fixed",void 0),o([n({type:Boolean})],W.prototype,"forceGroupSelection",void 0),o([n({type:Boolean})],W.prototype,"fullwidth",void 0),o([n({type:String})],W.prototype,"menuCorner",void 0),o([n({type:Boolean})],W.prototype,"stayOpenOnBodyClick",void 0),o([n({type:String}),C((function(e){this.mdcFoundation&&this.mdcFoundation.setDefaultFocusState(P[e])}))],W.prototype,"defaultFocus",void 0);const q=f`mwc-list ::slotted([mwc-list-item]:not([twoline])),mwc-list ::slotted([noninteractive]:not([twoline])){height:var(--mdc-menu-item-height, 48px)}`;let K=class extends W{};var V,X;K.styles=[q],K=o([b("mwc-menu")],K);const Q=null!==(X=null===(V=window.ShadyDOM)||void 0===V?void 0:V.inUse)&&void 0!==X&&X;class Y extends d{constructor(){super(...arguments),this.disabled=!1,this.containingForm=null,this.formDataListener=e=>{this.disabled||this.setFormData(e.formData)}}findFormElement(){if(!th
|
||
|
<div class="mdc-chip ${this.noText?"no-text":""}">
|
||
|
${this.hasIcon?s`<div class="mdc-chip__icon mdc-chip__icon--leading">
|
||
|
<slot name="icon"></slot>
|
||
|
</div>`:null}
|
||
|
<div class="mdc-chip__ripple"></div>
|
||
|
<span role="gridcell">
|
||
|
<span role="button" tabindex="0" class="mdc-chip__primary-action">
|
||
|
<span class="mdc-chip__text"><slot></slot></span>
|
||
|
</span>
|
||
|
</span>
|
||
|
${this.hasTrailingIcon?s`<div class="mdc-chip__icon mdc-chip__icon--trailing">
|
||
|
<slot name="trailing-icon"></slot>
|
||
|
</div>`:null}
|
||
|
</div>
|
||
|
`}},{kind:"get",static:!0,key:"styles",value:function(){return f`
|
||
|
${x(J)}
|
||
|
.mdc-chip {
|
||
|
background-color: var(
|
||
|
--ha-chip-background-color,
|
||
|
rgba(var(--rgb-primary-text-color), 0.15)
|
||
|
);
|
||
|
color: var(--ha-chip-text-color, var(--primary-text-color));
|
||
|
}
|
||
|
|
||
|
.mdc-chip.no-text {
|
||
|
padding: 0 10px;
|
||
|
}
|
||
|
|
||
|
.mdc-chip:hover {
|
||
|
color: var(--ha-chip-text-color, var(--primary-text-color));
|
||
|
}
|
||
|
|
||
|
.mdc-chip__icon--leading,
|
||
|
.mdc-chip__icon--trailing {
|
||
|
--mdc-icon-size: 18px;
|
||
|
line-height: 14px;
|
||
|
color: var(--ha-chip-icon-color, var(--ha-chip-text-color));
|
||
|
}
|
||
|
.mdc-chip.mdc-chip--selected .mdc-chip__checkmark,
|
||
|
.mdc-chip .mdc-chip__icon--leading:not(.mdc-chip__icon--leading-hidden) {
|
||
|
margin-right: -4px;
|
||
|
margin-inline-start: -4px;
|
||
|
margin-inline-end: 4px;
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
|
||
|
span[role="gridcell"] {
|
||
|
line-height: 14px;
|
||
|
}
|
||
|
`}}]}}),k);class Z extends Y{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this.name="",this.value="on",this.reducedTouchTarget=!1,this.animationClass="",this.shouldRenderRipple=!1,this.focused=!1,this.mdcFoundationClass=void 0,this.mdcFoundation=void 0,this.rippleElement=null,this.rippleHandlers=new T((()=>(this.shouldRenderRipple=!0,this.ripple.then((e=>this.rippleElement=e)),this.ripple)))}createAdapter(){return{}}update(e){const t=e.get("indeterminate"),i=e.get("checked"),c=e.get("disabled");if(void 0!==t||void 0!==i||void 0!==c){const e=this.calculateAnimationStateName(!!i,!!t,!!c),o=this.calculateAnimationStateName(this.checked,this.indeterminate,this.disabled);this.animationClass=`${e}-${o}`}super.update(e)}calculateAnimationStateName(e,t,i){return i?"disabled":t?"indeterminate":e?"checked":"unchecked"}renderRipple(){return this.shouldRenderRipple?this.renderRippleTemplate():""}renderRippleTemplate(){return s`<mwc-ripple
|
||
|
.disabled="${this.disabled}"
|
||
|
unbounded></mwc-ripple>`}render(){const e=this.indeterminate||this.checked,t={"mdc-checkbox--disabled":this.disabled,"mdc-checkbox--selected":e,"mdc-checkbox--touch":!this.reducedTouchTarget,"mdc-ripple-upgraded--background-focused":this.focused,"mdc-checkbox--anim-checked-indeterminate":"checked-indeterminate"==this.animationClass,"mdc-checkbox--anim-checked-unchecked":"checked-unchecked"==this.animationClass,"mdc-checkbox--anim-indeterminate-checked":"indeterminate-checked"==this.animationClass,"mdc-checkbox--anim-indeterminate-unchecked":"indeterminate-unchecked"==this.animationClass,"mdc-checkbox--anim-unchecked-checked":"unchecked-checked"==this.animationClass,"mdc-checkbox--anim-unchecked-indeterminate":"unchecked-indeterminate"==this.animationClass},i=this.indeterminate?"mixed":void 0;return s`
|
||
|
<div class="mdc-checkbox mdc-checkbox--upgraded ${p(t)}">
|
||
|
<input type="checkbox"
|
||
|
class="mdc-checkbox__native-control"
|
||
|
name="${w(this.name)}"
|
||
|
aria-checked="${w(i)}"
|
||
|
aria-label="${w(this.ariaLabel)}"
|
||
|
aria-labelledby="${w(this.ariaLabelledBy)}"
|
||
|
aria-describedby="${w(this.ariaDescribedBy)}"
|
||
|
data-indeterminate="${this.indeterminate?"true":"false"}"
|
||
|
?disabled="${this.disabled}"
|
||
|
.indeterminate="${this.indeterminate}"
|
||
|
.checked="${this.checked}"
|
||
|
.value="${this.value}"
|
||
|
@change="${this.handleChange}"
|
||
|
@focus="${this.handleFocus}"
|
||
|
@blur="${this.handleBlur}"
|
||
|
@mousedown="${this.handleRippleMouseDown}"
|
||
|
@mouseenter="${this.handleRippleMouseEnter}"
|
||
|
@mouseleave="${this.handleRippleMouseLeave}"
|
||
|
@touchstart="${this.handleRippleTouchStart}"
|
||
|
@touchend="${this.handleRippleDeactivate}"
|
||
|
@touchcancel="${this.handleRippleDeactivate}">
|
||
|
<div class="mdc-checkbox__background"
|
||
|
@animationend="${this.resetAnimationClass}">
|
||
|
<svg class="mdc-checkbox__checkmark"
|
||
|
viewBox="0 0 24 24">
|
||
|
<path class="mdc-checkbox__checkmark-path"
|
||
|
fill="none"
|
||
|
d="M1.73,12.91 8.1,19.28 22.79,4.59"></path>
|
||
|
</svg>
|
||
|
<div class="mdc-checkbox__mixedmark"></div>
|
||
|
</div>
|
||
|
${this.renderRipple()}
|
||
|
</div>`}setFormData(e){this.name&&this.checked&&e.append(this.name,this.value)}handleFocus(){this.focused=!0,this.handleRippleFocus()}handleBlur(){this.focused=!1,this.handleRippleBlur()}handleRippleMouseDown(e){const t=()=>{window.removeEventListener("mouseup",t),this.handleRippleDeactivate()};window.addEventListener("mouseup",t),this.rippleHandlers.startPress(e)}handleRippleTouchStart(e){this.rippleHandlers.startPress(e)}handleRippleDeactivate(){this.rippleHandlers.endPress()}handleRippleMouseEnter(){this.rippleHandlers.startHover()}handleRippleMouseLeave(){this.rippleHandlers.endHover()}handleRippleFocus(){this.rippleHandlers.startFocus()}handleRippleBlur(){this.rippleHandlers.endFocus()}handleChange(){this.checked=this.formElement.checked,this.indeterminate=this.formElement.indeterminate}resetAnimationClass(){this.animationClass=""}get isRippleActive(){var e;return(null===(e=this.rippleElement)||void 0===e?void 0:e.isActive)||!1}}o([r(".mdc-checkbox")],Z.prototype,"mdcRoot",void 0),o([r("input")],Z.prototype,"formElement",void 0),o([n({type:Boolean,reflect:!0})],Z.prototype,"checked",void 0),o([n({type:Boolean})],Z.prototype,"indeterminate",void 0),o([n({type:Boolean,reflect:!0})],Z.prototype,"disabled",void 0),o([n({type:String,reflect:!0})],Z.prototype,"name",void 0),o([n({type:String})],Z.prototype,"value",void 0),o([_,n({type:String,attribute:"aria-label"})],Z.prototype,"ariaLabel",void 0),o([_,n({type:String,attribute:"aria-labelledby"})],Z.prototype,"ariaLabelledBy",void 0),o([_,n({type:String,attribute:"aria-describedby"})],Z.prototype,"ariaDescribedBy",void 0),o([n({type:Boolean})],Z.prototype,"reducedTouchTarget",void 0),o([a()],Z.prototype,"animationClass",void 0),o([a()],Z.prototype,"shouldRenderRipple",void 0),o([a()],Z.prototype,"focused",void 0),o([y("mwc-ripple")],Z.prototype,"ripple",void 0),o([v({passive:!0})],Z.prototype,"handleRippleTouchStart",null);const ee=f`.mdc-checkbox{padding:calc((40px - 18px) / 2);padding:calc((var(--mdc-checkbox-ripple-size, 40px) - 18px) / 2);margin:calc((40px - 40px) / 2);margin:calc((var(--mdc-checkbox-touch-target-size, 40px) - 40px) / 2)}.mdc-checkbox .mdc-checkbox__ripple::before,.mdc-checkbox .mdc-checkbox__ripple::after{background-color:#000;background-color:var(--mdc-ripple-color, #000)}.mdc-checkbox:hover .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-ripple-surface--hover .mdc-checkbox__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-checkbox.mdc-ripple-upgraded--background-focused .mdc-checkbox__ripple::before,.mdc-checkbox:not(.mdc-ripple-upgraded):focus .mdc-checkbox__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-checkbox:not(.mdc-ripple-upgraded) .mdc-checkbox__ripple::after{transition:opacity 150ms linear}.mdc-checkbox:not(.mdc-ripple-upgraded):active .mdc-checkbox__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-checkbox.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-checkbox.mdc-checkbox--selected .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-checkbox--selected .mdc-checkbox__ripple::after{background-color:#018786;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #018786))}.mdc-checkbox.mdc-checkbox--selected:hover .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-checkbox--selected.mdc-ripple-surface--hover .mdc-checkbox__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-checkbox.mdc-checkbox--selected.mdc-ripple-upgraded--background-focused .mdc-checkbox__ripple::before,.mdc-checkbox.mdc-checkbox--selected:not(.mdc-ripple-upgraded):focus .mdc-checkbox__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-checkbox.mdc-checkbox--selected:not(.mdc-ripple-upgraded) .mdc-checkbox__ripple::after{transition:opacity 150ms linear}.mdc-checkbox.mdc-checkbox--selected:not(.mdc-ripple-upgraded):active .mdc-checkbox__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(
|
||
|
:host {
|
||
|
--mdc-theme-secondary: var(--primary-color);
|
||
|
}
|
||
|
`]}]}}),Z);var te={ROOT:"mdc-form-field"},ie={LABEL_SELECTOR:".mdc-form-field > label"},ce=function(i){function c(e){var o=i.call(this,t(t({},c.defaultAdapter),e))||this;return o.click=function(){o.handleClick()},o}return e(c,i),Object.defineProperty(c,"cssClasses",{get:function(){return te},enumerable:!1,configurable:!0}),Object.defineProperty(c,"strings",{get:function(){return ie},enumerable:!1,configurable:!0}),Object.defineProperty(c,"defaultAdapter",{get:function(){return{activateInputRipple:function(){},deactivateInputRipple:function(){},deregisterInteractionHandler:function(){},registerInteractionHandler:function(){}}},enumerable:!1,configurable:!0}),c.prototype.init=function(){this.adapter.registerInteractionHandler("click",this.click)},c.prototype.destroy=function(){this.adapter.deregisterInteractionHandler("click",this.click)},c.prototype.handleClick=function(){var e=this;this.adapter.activateInputRipple(),requestAnimationFrame((function(){e.adapter.deactivateInputRipple()}))},c}(c);class oe extends d{constructor(){super(...arguments),this.alignEnd=!1,this.spaceBetween=!1,this.nowrap=!1,this.label="",this.mdcFoundationClass=ce}createAdapter(){return{registerInteractionHandler:(e,t)=>{this.labelEl.addEventListener(e,t)},deregisterInteractionHandler:(e,t)=>{this.labelEl.removeEventListener(e,t)},activateInputRipple:async()=>{const e=this.input;if(e instanceof Y){const t=await e.ripple;t&&t.startPress()}},deactivateInputRipple:async()=>{const e=this.input;if(e instanceof Y){const t=await e.ripple;t&&t.endPress()}}}}get input(){var e,t;return null!==(t=null===(e=this.slottedInputs)||void 0===e?void 0:e[0])&&void 0!==t?t:null}render(){const e={"mdc-form-field--align-end":this.alignEnd,"mdc-form-field--space-between":this.spaceBetween,"mdc-form-field--nowrap":this.nowrap};return s`
|
||
|
<div class="mdc-form-field ${p(e)}">
|
||
|
<slot></slot>
|
||
|
<label class="mdc-label"
|
||
|
@click="${this._labelClick}">${this.label}</label>
|
||
|
</div>`}click(){this._labelClick()}_labelClick(){const e=this.input;e&&(e.focus(),e.click())}}o([n({type:Boolean})],oe.prototype,"alignEnd",void 0),o([n({type:Boolean})],oe.prototype,"spaceBetween",void 0),o([n({type:Boolean})],oe.prototype,"nowrap",void 0),o([n({type:String}),C((async function(e){var t;null===(t=this.input)||void 0===t||t.setAttribute("aria-label",e)}))],oe.prototype,"label",void 0),o([r(".mdc-form-field")],oe.prototype,"mdcRoot",void 0),o([I("",!0,"*")],oe.prototype,"slottedInputs",void 0),o([r("label")],oe.prototype,"labelEl",void 0);const re=f`.mdc-form-field{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-body2-font-size, 0.875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87));display:inline-flex;align-items:center;vertical-align:middle}.mdc-form-field>label{margin-left:0;margin-right:auto;padding-left:4px;padding-right:0;order:0}[dir=rtl] .mdc-form-field>label,.mdc-form-field>label[dir=rtl]{margin-left:auto;margin-right:0}[dir=rtl] .mdc-form-field>label,.mdc-form-field>label[dir=rtl]{padding-left:0;padding-right:4px}.mdc-form-field--nowrap>label{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.mdc-form-field--align-end>label{margin-left:auto;margin-right:0;padding-left:0;padding-right:4px;order:-1}[dir=rtl] .mdc-form-field--align-end>label,.mdc-form-field--align-end>label[dir=rtl]{margin-left:0;margin-right:auto}[dir=rtl] .mdc-form-field--align-end>label,.mdc-form-field--align-end>label[dir=rtl]{padding-left:4px;padding-right:0}.mdc-form-field--space-between{justify-content:space-between}.mdc-form-field--space-between>label{margin:0}[dir=rtl] .mdc-form-field--space-between>label,.mdc-form-field--space-between>label[dir=rtl]{margin:0}:host{display:inline-flex}.mdc-form-field{width:100%}::slotted(*){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-body2-font-size, 0.875rem);line-height:1.25rem;line-height:var(--mdc-typography-body2-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);color:rgba(0, 0, 0, 0.87);color:var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87))}::slotted(mwc-switch){margin-right:10px}[dir=rtl] ::slotted(mwc-switch),::slotted(mwc-switch[dir=rtl]){margin-left:10px}`;g([b("ha-formfield")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",key:"_labelClick",value:function(){const e=this.input;if(e)switch(e.focus(),e.tagName){case"HA-CHECKBOX":case"HA-RADIO":e.checked=!e.checked,E(e,"change");break;default:e.click()}}},{kind:"field",static:!0,key:"styles",value:()=>[re,f`
|
||
|
:host(:not([alignEnd])) ::slotted(ha-switch) {
|
||
|
margin-right: 10px;
|
||
|
margin-inline-end: 10px;
|
||
|
margin-inline-start: inline;
|
||
|
}
|
||
|
.mdc-form-field > label {
|
||
|
direction: var(--direction);
|
||
|
margin-inline-start: 0;
|
||
|
margin-inline-end: auto;
|
||
|
padding-inline-start: 4px;
|
||
|
padding-inline-end: 0;
|
||
|
}
|
||
|
`]}]}}),oe);export{R as C,Y as F,oe as a,ee as b,Z as c,J as d,re as s};
|