395 lines
198 KiB
JavaScript
395 lines
198 KiB
JavaScript
|
import{x as e,z as t,M as i,f as d,e as o,B as c,i as l,y as n,k as a,d as r,ab as s,t as m,h,ac as p,R as f,p as u,_ as b,n as x,I as g,J as _,L as v,A as y,ad as k,N as w,Z as E,D as I,E as C,G as A,O as L,q as R,ae as T}from"./main-85e087f9.js";import{o as O}from"./c.8e28b461.js";import{o as z,L as F,s as S,n as D,a as $,K as V,C as B}from"./c.eab7754a.js";var N,M,H={ROOT:"mdc-form-field"},P={LABEL_SELECTOR:".mdc-form-field > label"},U=function(i){function d(e){var o=i.call(this,t(t({},d.defaultAdapter),e))||this;return o.click=function(){o.handleClick()},o}return e(d,i),Object.defineProperty(d,"cssClasses",{get:function(){return H},enumerable:!1,configurable:!0}),Object.defineProperty(d,"strings",{get:function(){return P},enumerable:!1,configurable:!0}),Object.defineProperty(d,"defaultAdapter",{get:function(){return{activateInputRipple:function(){},deactivateInputRipple:function(){},deregisterInteractionHandler:function(){},registerInteractionHandler:function(){}}},enumerable:!1,configurable:!0}),d.prototype.init=function(){this.adapter.registerInteractionHandler("click",this.click)},d.prototype.destroy=function(){this.adapter.deregisterInteractionHandler("click",this.click)},d.prototype.handleClick=function(){var e=this;this.adapter.activateInputRipple(),requestAnimationFrame((function(){e.adapter.deactivateInputRipple()}))},d}(i);const Y=null!==(M=null===(N=window.ShadyDOM)||void 0===N?void 0:N.inUse)&&void 0!==M&&M;class X extends c{constructor(){super(...arguments),this.disabled=!1,this.containingForm=null,this.formDataListener=e=>{this.disabled||this.setFormData(e.formData)}}findFormElement(){if(!this.shadowRoot||Y)return null;const e=this.getRootNode().querySelectorAll("form");for(const t of Array.from(e))if(t.contains(this))return t;return null}connectedCallback(){var e;super.connectedCallback(),this.containingForm=this.findFormElement(),null===(e=this.containingForm)||void 0===e||e.addEventListener("formdata",this.formDataListener)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this.containingForm)||void 0===e||e.removeEventListener("formdata",this.formDataListener),this.containingForm=null}click(){this.formElement&&!this.disabled&&(this.formElement.focus(),this.formElement.click())}firstUpdated(){super.firstUpdated(),this.shadowRoot&&this.mdcRoot.addEventListener("change",(e=>{this.dispatchEvent(new Event("change",e))}))}}X.shadowRootOptions={mode:"open",delegatesFocus:!0},d([o({type:Boolean})],X.prototype,"disabled",void 0);class W extends c{constructor(){super(...arguments),this.alignEnd=!1,this.spaceBetween=!1,this.nowrap=!1,this.label="",this.mdcFoundationClass=U}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 X){const t=await e.ripple;t&&t.startPress()}},deactivateInputRipple:async()=>{const e=this.input;if(e instanceof X){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 n`
|
||
|
<div class="mdc-form-field ${a(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())}}d([o({type:Boolean})],W.prototype,"alignEnd",void 0),d([o({type:Boolean})],W.prototype,"spaceBetween",void 0),d([o({type:Boolean})],W.prototype,"nowrap",void 0),d([o({type:String}),O((async function(e){var t;null===(t=this.input)||void 0===t||t.setAttribute("aria-label",e)}))],W.prototype,"label",void 0),d([l(".mdc-form-field")],W.prototype,"mdcRoot",void 0),d([z("",!0,"*")],W.prototype,"slottedInputs",void 0),d([l("label")],W.prototype,"labelEl",void 0);const j=r`.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}`;class G extends X{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 f((()=>(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"),d=e.get("disabled");if(void 0!==t||void 0!==i||void 0!==d){const e=this.calculateAnimationStateName(!!i,!!t,!!d),o=this.calculateAnimationStateName(this.checked,this.indeterminate
|
||
|
.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 n`
|
||
|
<div class="mdc-checkbox mdc-checkbox--upgraded ${a(t)}">
|
||
|
<input type="checkbox"
|
||
|
class="mdc-checkbox__native-control"
|
||
|
name="${u(this.name)}"
|
||
|
aria-checked="${u(i)}"
|
||
|
aria-label="${u(this.ariaLabel)}"
|
||
|
aria-labelledby="${u(this.ariaLabelledBy)}"
|
||
|
aria-describedby="${u(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}}d([l(".mdc-checkbox")],G.prototype,"mdcRoot",void 0),d([l("input")],G.prototype,"formElement",void 0),d([o({type:Boolean,reflect:!0})],G.prototype,"checked",void 0),d([o({type:Boolean})],G.prototype,"indeterminate",void 0),d([o({type:Boolean,reflect:!0})],G.prototype,"disabled",void 0),d([o({type:String,reflect:!0})],G.prototype,"name",void 0),d([o({type:String})],G.prototype,"value",void 0),d([s,o({type:String,attribute:"aria-label"})],G.prototype,"ariaLabel",void 0),d([s,o({type:String,attribute:"aria-labelledby"})],G.prototype,"ariaLabelledBy",void 0),d([s,o({type:String,attribute:"aria-describedby"})],G.prototype,"ariaDescribedBy",void 0),d([o({type:Boolean})],G.prototype,"reducedTouchTarget",void 0),d([m()],G.prototype,"animationClass",void 0),d([m()],G.prototype,"shouldRenderRipple",void 0),d([m()],G.prototype,"focused",void 0),d([h("mwc-ripple")],G.prototype,"ripple",void 0),d([p({passive:!0})],G.prototype,"handleRippleTouchStart",null);const q=r`.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);
|
||
|
}
|
||
|
`]}]}}),G);var K={NOTCH_ELEMENT_SELECTOR:".mdc-notched-outline__notch"},Q={NOTCH_ELEMENT_PADDING:8},J={NO_LABEL:"mdc-notched-outline--no-label",OUTLINE_NOTCHED:"mdc-notched-outline--notched",OUTLINE_UPGRADED:"mdc-notched-outline--upgraded"},Z=function(i){function d(e){return i.call(this,t(t({},d.defaultAdapter),e))||this}return e(d,i),Object.defineProperty(d,"strings",{get:function(){return K},enumerable:!1,configurable:!0}),Object.defineProperty(d,"cssClasses",{get:function(){return J},enumerable:!1,configurable:!0}),Object.defineProperty(d,"numbers",{get:function(){return Q},enumerable:!1,configurable:!0}),Object.defineProperty(d,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},setNotchWidthProperty:function(){},removeNotchWidthProperty:function(){}}},enumerable:!1,configurable:!0}),d.prototype.notch=function(e){var t=d.cssClasses.OUTLINE_NOTCHED;e>0&&(e+=Q.NOTCH_ELEMENT_PADDING),this.adapter.setNotchWidthProperty(e),this.adapter.addClass(t)},d.prototype.closeNotch=function(){var e=d.cssClasses.OUTLINE_NOTCHED;this.adapter.removeClass(e),this.adapter.removeNotchWidthProperty()},d}(i);class ee extends c{constructor(){super(...arguments),this.mdcFoundationClass=Z,this.width=0,this.open=!1,this.lastOpen=this.open}createAdapter(){return{addClass:e=>this.mdcRoot.classList.add(e),removeClass:e=>this.mdcRoot.classList.remove(e),setNotchWidthProperty:e=>this.notchElement.style.setProperty("width",`${e}px`),removeNotchWidthProperty:()=>this.notchElement.style.removeProperty("width")}}openOrClose(e,t){this.mdcFoundation&&(e&&void 0!==t?this.mdcFoundation.notch(t):this.mdcFoundation.closeNotch())}render(){this.openOrClose(this.open,this.width);const e=a({"mdc-notched-outline--notched":this.open});return n`
|
||
|
<span class="mdc-notched-outline ${e}">
|
||
|
<span class="mdc-notched-outline__leading"></span>
|
||
|
<span class="mdc-notched-outline__notch">
|
||
|
<slot></slot>
|
||
|
</span>
|
||
|
<span class="mdc-notched-outline__trailing"></span>
|
||
|
</span>`}}d([l(".mdc-notched-outline")],ee.prototype,"mdcRoot",void 0),d([o({type:Number})],ee.prototype,"width",void 0),d([o({type:Boolean,reflect:!0})],ee.prototype,"open",void 0),d([l(".mdc-notched-outline__notch")],ee.prototype,"notchElement",void 0);const te=r`.mdc-notched-outline{display:flex;position:absolute;top:0;right:0;left:0;box-sizing:border-box;width:100%;max-width:100%;height:100%;text-align:left;pointer-events:none}[dir=rtl] .mdc-notched-outline,.mdc-notched-outline[dir=rtl]{text-align:right}.mdc-notched-outline__leading,.mdc-notched-outline__notch,.mdc-notched-outline__trailing{box-sizing:border-box;height:100%;border-top:1px solid;border-bottom:1px solid;pointer-events:none}.mdc-notched-outline__leading{border-left:1px solid;border-right:none;width:12px}[dir=rtl] .mdc-notched-outline__leading,.mdc-notched-outline__leading[dir=rtl]{border-left:none;border-right:1px solid}.mdc-notched-outline__trailing{border-left:none;border-right:1px solid;flex-grow:1}[dir=rtl] .mdc-notched-outline__trailing,.mdc-notched-outline__trailing[dir=rtl]{border-left:1px solid;border-right:none}.mdc-notched-outline__notch{flex:0 0 auto;width:auto;max-width:calc(100% - 12px * 2)}.mdc-notched-outline .mdc-floating-label{display:inline-block;position:relative;max-width:100%}.mdc-notched-outline .mdc-floating-label--float-above{text-overflow:clip}.mdc-notched-outline--upgraded .mdc-floating-label--float-above{max-width:calc(100% / 0.75)}.mdc-notched-outline--notched .mdc-notched-outline__notch{padding-left:0;padding-right:8px;border-top:none}[dir=rtl] .mdc-notched-outline--notched .mdc-notched-outline__notch,.mdc-notched-outline--notched .mdc-notched-outline__notch[dir=rtl]{padding-left:8px;padding-right:0}.mdc-notched-outline--no-label .mdc-notched-outline__notch{display:none}:host{display:block;position:absolute;right:0;left:0;box-sizing:border-box;width:100%;max-width:100%;height:100%;text-align:left;pointer-events:none}[dir=rtl] :host,:host([dir=rtl]){text-align:right}::slotted(.mdc-floating-label){display:inline-block;position:relative;top:17px;bottom:auto;max-width:100%}::slotted(.mdc-floating-label--float-above){text-overflow:clip}.mdc-notched-outline--upgraded ::slotted(.mdc-floating-label--float-above){max-width:calc(100% / 0.75)}.mdc-notched-outline .mdc-notched-outline__leading{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border-bottom-left-radius:var(--mdc-shape-small, 4px)}[dir=rtl] .mdc-notched-outline .mdc-notched-outline__leading,.mdc-notched-outline .mdc-notched-outline__leading[dir=rtl]{border-top-left-radius:0;border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:4px;border-bottom-right-radius:var(--mdc-shape-small, 4px);border-bottom-left-radius:0}@supports(top: max(0%)){.mdc-notched-outline .mdc-notched-outline__leading{width:max(12px, var(--mdc-shape-small, 4px))}}@supports(top: max(0%)){.mdc-notched-outline .mdc-notched-outline__notch{max-width:calc(100% - max(12px, var(--mdc-shape-small, 4px)) * 2)}}.mdc-notched-outline .mdc-notched-outline__trailing{border-top-left-radius:0;border-top-right-radius:4px;border-top-right-radius:var(--mdc-shape-small, 4px);border-bottom-right-radius:4px;border-bottom-right-radius:var(--mdc-shape-small, 4px);border-bottom-left-radius:0}[dir=rtl] .mdc-notched-outline .mdc-notched-outline__trailing,.mdc-notched-outline .mdc-notched-outline__trailing[dir=rtl]{border-top-left-radius:4px;border-top-left-radius:var(--mdc-shape-small, 4px);border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border-bottom-left-radius:var(--mdc-shape-small, 4px)}.mdc-notched-outline__leading,.mdc-notched-outline__notch,.mdc-notched-outline__trailing{border-color:var(--mdc-notched-outline-border-color, var(--mdc-theme-primary, #6200ee));border-width:1px;border-width:var(--mdc-notched-outline-stroke-width, 1px)}.mdc-notched-outline--notched .mdc-notched-outline__notch{padding-top:0;padding-top:var(-
|
||
|
<label class="mdc-text-field ${a(i)}">
|
||
|
${this.renderRipple()}
|
||
|
${this.outlined?this.renderOutline():this.renderLabel()}
|
||
|
${this.renderLeadingIcon()}
|
||
|
${this.renderPrefix()}
|
||
|
${this.renderInput(t)}
|
||
|
${this.renderSuffix()}
|
||
|
${this.renderTrailingIcon()}
|
||
|
${this.renderLineRipple()}
|
||
|
</label>
|
||
|
${this.renderHelperText(t,e)}
|
||
|
`}updated(e){e.has("value")&&void 0!==e.get("value")&&(this.mdcFoundation.setValue(this.value),this.autoValidate&&this.reportValidity())}renderRipple(){return this.outlined?"":n`
|
||
|
<span class="mdc-text-field__ripple"></span>
|
||
|
`}renderOutline(){return this.outlined?n`
|
||
|
<mwc-notched-outline
|
||
|
.width=${this.outlineWidth}
|
||
|
.open=${this.outlineOpen}
|
||
|
class="mdc-notched-outline">
|
||
|
${this.renderLabel()}
|
||
|
</mwc-notched-outline>`:""}renderLabel(){return this.label?n`
|
||
|
<span
|
||
|
.floatingLabelFoundation=${ce(this.label)}
|
||
|
id="label">${this.label}</span>
|
||
|
`:""}renderLeadingIcon(){return this.icon?this.renderIcon(this.icon):""}renderTrailingIcon(){return this.iconTrailing?this.renderIcon(this.iconTrailing,!0):""}renderIcon(e,t=!1){return n`<i class="material-icons mdc-text-field__icon ${a({"mdc-text-field__icon--leading":!t,"mdc-text-field__icon--trailing":t})}">${e}</i>`}renderPrefix(){return this.prefix?this.renderAffix(this.prefix):""}renderSuffix(){return this.suffix?this.renderAffix(this.suffix,!0):""}renderAffix(e,t=!1){return n`<span class="mdc-text-field__affix ${a({"mdc-text-field__affix--prefix":!t,"mdc-text-field__affix--suffix":t})}">
|
||
|
${e}</span>`}renderInput(e){const t=-1===this.minLength?void 0:this.minLength,i=-1===this.maxLength?void 0:this.maxLength,d=this.autocapitalize?this.autocapitalize:void 0,o=this.validationMessage&&!this.isUiValid,c=this.label?"label":void 0,l=e?"helper-text":void 0,a=this.focused||this.helperPersistent||o?"helper-text":void 0;return n`
|
||
|
<input
|
||
|
aria-labelledby=${u(c)}
|
||
|
aria-controls="${u(l)}"
|
||
|
aria-describedby="${u(a)}"
|
||
|
class="mdc-text-field__input"
|
||
|
type="${this.type}"
|
||
|
.value="${Te(this.value)}"
|
||
|
?disabled="${this.disabled}"
|
||
|
placeholder="${this.placeholder}"
|
||
|
?required="${this.required}"
|
||
|
?readonly="${this.readOnly}"
|
||
|
minlength="${u(t)}"
|
||
|
maxlength="${u(i)}"
|
||
|
pattern="${u(this.pattern?this.pattern:void 0)}"
|
||
|
min="${u(""===this.min?void 0:this.min)}"
|
||
|
max="${u(""===this.max?void 0:this.max)}"
|
||
|
step="${u(null===this.step?void 0:this.step)}"
|
||
|
size="${u(null===this.size?void 0:this.size)}"
|
||
|
name="${u(""===this.name?void 0:this.name)}"
|
||
|
inputmode="${u(this.inputMode)}"
|
||
|
autocapitalize="${u(d)}"
|
||
|
@input="${this.handleInputChange}"
|
||
|
@focus="${this.onInputFocus}"
|
||
|
@blur="${this.onInputBlur}">`}renderLineRipple(){return this.outlined?"":n`
|
||
|
<span .lineRippleFoundation=${ae()}></span>
|
||
|
`}renderHelperText(e,t){const i=this.validationMessage&&!this.isUiValid,d={"mdc-text-field-helper-text--persistent":this.helperPersistent,"mdc-text-field-helper-text--validation-msg":i},o=this.focused||this.helperPersistent||i?void 0:"true",c=i?this.validationMessage:this.helper;return e?n`
|
||
|
<div class="mdc-text-field-helper-line">
|
||
|
<div id="helper-text"
|
||
|
aria-hidden="${u(o)}"
|
||
|
class="mdc-text-field-helper-text ${a(d)}"
|
||
|
>${c}</div>
|
||
|
${this.renderCharCounter(t)}
|
||
|
</div>`:""}renderCharCounter(e){const t=Math.min(this.value.length,this.maxLength);return e?n`
|
||
|
<span class="mdc-text-field-character-counter"
|
||
|
>${t} / ${this.maxLength}</span>`:""}onInputFocus(){this.focused=!0}onInputBlur(){this.focused=!1,this.reportValidity()}checkValidity(){const e=this._checkValidity(this.value);if(!e){const e=new Event("invalid",{bubbles:!1,cancelable:!0});this.dispatchEvent(e)}return e}reportValidity(){const e=this.checkValidity();return this.mdcFoundation.setValid(e),this.isUiValid=e,e}_checkValidity(e){const t=this.formElement.validity;let i=ze(t);if(this.validityTransform){const t=this.validityTransform(e,i);i=Object.assign(Object.assign({},i),t),this.mdcFoundation.setUseNativeValidation(!1)}else this.mdcFoundation.setUseNativeValidation(!0);return this._validity=i,this._validity.valid}setCustomValidity(e){this.validationMessage=e,this.formElement.setCustomValidity(e)}handleInputChange(){this.value=this.formElement.value}createAdapter(){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},this.getRootAdapterMethods()),this.getInputAdapterMethods()),this.getLabelAdapterMethods()),this.getLineRippleAdapterMethods()),this.getOutlineAdapterMethods())}getRootAdapterMethods(){return Object.assign({registerTextFieldInteractionHandler:(e,t)=>this.addEventListener(e,t),deregisterTextFieldInteractionHandler:(e,t)=>this.removeEventListener(e,t),registerValidationAttributeChangeHandler:e=>{const t=new MutationObserver((t=>{e((e=>e.map((e=>e.attributeName)).filter((e=>e)))(t))}));return t.observe(this.formElement,{attributes:!0}),t},deregisterValidationAttributeChangeHandler:e=>e.disconnect()},I(this.mdcRoot))}getInputAdapterMethods(){return{getNativeInput:()=>this.formElement,setInputAttr:()=>{},removeInputAttr:()=>{},isFocused:()=>!!this.shadowRoot&&this.shadowRoot.activeElement===this.formElement,registerInputInteractionHandler:(e,t)=>this.formElement.addEventListener(e,t,{passive:e in Oe}),deregisterInputInteractionHandler:(e,t)=>this.formElement.removeEventListener(e,t)}}getLabelAdapterMethods(){return{floatLabel:e=>this.labelElement&&this.labelElement.floatingLabelFoundation.float(e),getLabelWidth:()=>this.labelElement?this.labelElement.floatingLabelFoundation.getWidth():0,hasLabel:()=>Boolean(this.labelElement),shakeLabel:e=>this.labelElement&&this.labelElement.floatingLabelFoundation.shake(e),setLabelRequired:e=>{this.labelElement&&this.labelElement.floatingLabelFoundation.setRequired(e)}}}getLineRippleAdapterMethods(){return{activateLineRipple:()=>{this.lineRippleElement&&this.lineRippleElement.lineRippleFoundation.activate()},deactivateLineRipple:()=>{this.lineRippleElement&&this.lineRippleElement.lineRippleFoundation.deactivate()},setLineRippleTransformOrigin:e=>{this.lineRippleElement&&this.lineRippleElement.lineRippleFoundation.setRippleCenter(e)}}}async getUpdateComplete(){var e;const t=await super.getUpdateComplete();return await(null===(e=this.outlineElement)||void 0===e?void 0:e.updateComplete),t}firstUpdated(){var e;super.firstUpdated(),this.mdcFoundation.setValidateOnValueChange(this.autoValidate),this.validateOnInitialRender&&this.reportValidity(),null===(e=this.outlineElement)||void 0===e||e.updateComplete.then((()=>{var e;this.outlineWidth=(null===(e=this.labelElement)||void 0===e?void 0:e.floatingLabelFoundation.getWidth())||0}))}getOutlineAdapterMethods(){return{closeOutline:()=>this.outlineElement&&(this.outlineOpen=!1),hasOutline:()=>Boolean(this.outlineElement),notchOutline:e=>{this.outlineElement&&!this.outlineOpen&&(this.outlineWidth=e,this.outlineOpen=!0)}}}async layout(){await this.updateComplete;const e=this.labelElement;if(!e)return void(this.outlineOpen=!1);const t=!!this.label&&!!this.value;if(e.floatingLabelFoundation.float(t),!this.outlined)return;this.outlineOpen=t,await this.updateComplete;const i=e.floatingLabelFoundation.getWidth();this.outlineOpen&&(this.outlineWidth=i,await this.updateComplete)}}d([l(".mdc-text-field")],Fe.prototype,"mdcRoot",void 0),d([l("input")],Fe.prototype,"formElement",void 0),d([l(".mdc-floating-label")],Fe.prototype,"labelElement",void 0),d([l(".mdc-line-ripple")],Fe.prototype,"lineRippleElement",void 0),d([l("mwc-notched-outline")],Fe.proto
|
||
|
<span
|
||
|
class="mdc-text-field__icon mdc-text-field__icon--${i}"
|
||
|
tabindex=${t?1:-1}
|
||
|
>
|
||
|
<slot name="${i}Icon"></slot>
|
||
|
</span>
|
||
|
`}},{kind:"field",static:!0,key:"styles",value:()=>[Se,r`
|
||
|
.mdc-text-field__input {
|
||
|
width: var(--ha-textfield-input-width, 100%);
|
||
|
}
|
||
|
.mdc-text-field:not(.mdc-text-field--with-leading-icon) {
|
||
|
padding: var(--text-field-padding, 0px 16px);
|
||
|
}
|
||
|
.mdc-text-field__affix--suffix {
|
||
|
padding-left: var(--text-field-suffix-padding-left, 12px);
|
||
|
padding-right: var(--text-field-suffix-padding-right, 0px);
|
||
|
padding-inline-start: var(--text-field-suffix-padding-left, 12px);
|
||
|
padding-inline-end: var(--text-field-suffix-padding-right, 0px);
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
.mdc-text-field--with-leading-icon {
|
||
|
padding-inline-start: var(--text-field-suffix-padding-left, 0px);
|
||
|
padding-inline-end: var(--text-field-suffix-padding-right, 16px);
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
|
||
|
.mdc-text-field:not(.mdc-text-field--disabled)
|
||
|
.mdc-text-field__affix--suffix {
|
||
|
color: var(--secondary-text-color);
|
||
|
}
|
||
|
|
||
|
.mdc-text-field__icon {
|
||
|
color: var(--secondary-text-color);
|
||
|
}
|
||
|
|
||
|
.mdc-text-field__icon--leading {
|
||
|
margin-inline-start: 16px;
|
||
|
margin-inline-end: 8px;
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
|
||
|
.mdc-floating-label:not(.mdc-floating-label--float-above) {
|
||
|
text-overflow: ellipsis;
|
||
|
width: inherit;
|
||
|
padding-right: 30px;
|
||
|
padding-inline-end: 30px;
|
||
|
padding-inline-start: initial;
|
||
|
box-sizing: border-box;
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
|
||
|
input {
|
||
|
text-align: var(--text-field-text-align, start);
|
||
|
}
|
||
|
|
||
|
/* Chrome, Safari, Edge, Opera */
|
||
|
:host([no-spinner]) input::-webkit-outer-spin-button,
|
||
|
:host([no-spinner]) input::-webkit-inner-spin-button {
|
||
|
-webkit-appearance: none;
|
||
|
margin: 0;
|
||
|
}
|
||
|
|
||
|
/* Firefox */
|
||
|
:host([no-spinner]) input[type="number"] {
|
||
|
-moz-appearance: textfield;
|
||
|
}
|
||
|
|
||
|
.mdc-text-field__ripple {
|
||
|
overflow: hidden;
|
||
|
}
|
||
|
|
||
|
.mdc-text-field {
|
||
|
overflow: var(--text-field-overflow);
|
||
|
}
|
||
|
|
||
|
.mdc-floating-label {
|
||
|
inset-inline-start: 16px !important;
|
||
|
inset-inline-end: initial !important;
|
||
|
transform-origin: var(--float-start);
|
||
|
direction: var(--direction);
|
||
|
text-align: var(--float-start);
|
||
|
}
|
||
|
|
||
|
.mdc-text-field--with-leading-icon.mdc-text-field--filled
|
||
|
.mdc-floating-label {
|
||
|
max-width: calc(100% - 48px);
|
||
|
inset-inline-start: 48px !important;
|
||
|
inset-inline-end: initial !important;
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
|
||
|
.mdc-text-field__input[type="number"] {
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
`,"rtl"===document.dir?r`
|
||
|
.mdc-text-field__affix--suffix,
|
||
|
.mdc-text-field--with-leading-icon,
|
||
|
.mdc-text-field__icon--leading,
|
||
|
.mdc-floating-label,
|
||
|
.mdc-text-field--with-leading-icon.mdc-text-field--filled
|
||
|
.mdc-floating-label,
|
||
|
.mdc-text-field__input[type="number"] {
|
||
|
direction: rtl;
|
||
|
}
|
||
|
`:r``]}]}}),Fe);let De=class extends G{};De.styles=[q],De=d([x("mwc-checkbox")],De);class $e extends F{constructor(){super(...arguments),this.left=!1,this.graphic="control"}render(){const e={"mdc-deprecated-list-item__graphic":this.left,"mdc-deprecated-list-item__meta":!this.left},t=this.renderText(),i=this.graphic&&"control"!==this.graphic&&!this.left?this.renderGraphic():n``,d=this.hasMeta&&this.left?this.renderMeta():n``,o=this.renderRipple();return n`
|
||
|
${o}
|
||
|
${i}
|
||
|
${this.left?"":t}
|
||
|
<span class=${a(e)}>
|
||
|
<mwc-checkbox
|
||
|
reducedTouchTarget
|
||
|
tabindex=${this.tabindex}
|
||
|
.checked=${this.selected}
|
||
|
?disabled=${this.disabled}
|
||
|
@change=${this.onChange}>
|
||
|
</mwc-checkbox>
|
||
|
</span>
|
||
|
${this.left?t:""}
|
||
|
${d}`}async onChange(e){const t=e.target;this.selected===t.checked||(this._skipPropRequest=!0,this.selected=t.checked,await this.updateComplete,this._skipPropRequest=!1)}}d([l("slot")],$e.prototype,"slotElement",void 0),d([l("mwc-checkbox")],$e.prototype,"checkboxElement",void 0),d([o({type:Boolean})],$e.prototype,"left",void 0),d([o({type:String,reflect:!0})],$e.prototype,"graphic",void 0);const Ve=r`:host(:not([twoline])){height:56px}:host(:not([left])) .mdc-deprecated-list-item__meta{height:40px;width:40px}`;b([x("ha-check-list-item")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",static:!0,key:"styles",value:()=>[S,Ve,r`
|
||
|
:host {
|
||
|
--mdc-theme-secondary: var(--primary-color);
|
||
|
}
|
||
|
`]}]}}),$e),b([x("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":if(e.disabled)break;e.checked=!e.checked,L(e,"change");break;default:e.click()}}},{kind:"field",static:!0,key:"styles",value:()=>[j,r`
|
||
|
: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;
|
||
|
}
|
||
|
`]}]}}),W);const Be=e=>e.stopPropagation();var Ne=["input","button","textarea","select"],Me=function(e){var t=e.target;if(t){var i=(""+t.tagName).toLowerCase();-1===Ne.indexOf(i)&&e.preventDefault()}};function He(e,t){for(var i=new Map,d=0;d<e;d++){var o=t(d).trim();if(o){var c=o[0].toLowerCase();i.has(c)||i.set(c,[]),i.get(c).push({text:o.toLowerCase(),index:d})}}return i.forEach((function(e){e.sort((function(e,t){return e.index-t.index}))})),i}function Pe(e,t){var i,d=e.nextChar,o=e.focusItemAtIndex,c=e.sortedIndexByFirstChar,l=e.focusedItemIndex,n=e.skipFocus,a=e.isItemAtIndexDisabled;return clearTimeout(t.bufferClearTimeout),t.bufferClearTimeout=setTimeout((function(){!function(e){e.typeaheadBuffer=""}(t)}),D.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS),t.typeaheadBuffer=t.typeaheadBuffer+d,i=1===t.typeaheadBuffer.length?function(e,t,i,d){var o=d.typeaheadBuffer[0],c=e.get(o);if(!c)return-1;if(o===d.currentFirstChar&&c[d.sortedIndexCursor].index===t){d.sortedIndexCursor=(d.sortedIndexCursor+1)%c.length;var l=c[d.sortedIndexCursor].index;if(!i(l))return l}d.currentFirstChar=o;var n,a=-1;for(n=0;n<c.length;n++)if(!i(c[n].index)){a=n;break}for(;n<c.length;n++)if(c[n].index>t&&!i(c[n].index)){a=n;break}if(-1!==a)return d.sortedIndexCursor=a,c[d.sortedIndexCursor].index;return-1}(c,l,a,t):function(e,t,i){var d=i.typeaheadBuffer[0],o=e.get(d);if(!o)return-1;var c=o[i.sortedIndexCursor];if(0===c.text.lastIndexOf(i.typeaheadBuffer,0)&&!t(c.index))return c.index;var l=(i.sortedIndexCursor+1)%o.length,n=-1;for(;l!==i.sortedIndexCursor;){var a=o[l],r=0===a.text.lastIndexOf(i.typeaheadBuffer,0),s=!t(a.index);if(r&&s){n=l;break}l=(l+1)%o.length}if(-1!==n)return i.sortedIndexCursor=n,o[i.sortedIndexCursor].index;return-1}(c,a,t),-1===i||n||o(i),i}function Ue(e){return e.typeaheadBuffer.length>0}var Ye={ACTIVATED:"mdc-select--activated",DISABLED:"mdc-select--disabled",FOCUSED:"mdc-select--focused",INVALID:"mdc-select--invalid",MENU_INVALID:"mdc-select__menu--invalid",OUTLINED:"mdc-select--outlined",REQUIRED:"mdc-select--required",ROOT:"mdc-select",WITH_LEADING_ICON:"mdc-select--with-leading-icon"},Xe={ARIA_CONTROLS:"aria-controls",ARIA_DESCRIBEDBY:"aria-describedby",ARIA_SELECTED_ATTR:"aria-selected",CHANGE_EVENT:"MDCSelect:change",HIDDEN_INPUT_SELECTOR:'input[type="hidden"]',LABEL_SELECTOR:".mdc-floating-label",LEADING_ICON_SELECTOR:".mdc-select__icon",LINE_RIPPLE_SELECTOR:".mdc-line-ripple",MENU_SELECTOR:".mdc-select__menu",OUTLINE_SELECTOR:".mdc-notched-outline",SELECTED_TEXT_SELECTOR:".mdc-select__selected-text",SELECT_ANCHOR_SELECTOR:".mdc-select__anchor",VALUE_ATTR:"data-value"},We={LABEL_SCALE:.75,UNSET_INDEX:-1,CLICK_DEBOUNCE_TIMEOUT_MS:330},je=function(i){function d(e,o){void 0===o&&(o={});var c=i.call(this,t(t({},d.defaultAdapter),e))||this;return c.disabled=!1,c.isMenuOpen=!1,c.useDefaultValidation=!0,c.customValidity=!0,c.lastSelectedIndex=We.UNSET_INDEX,c.clickDebounceTimeout=0,c.recentlyClicked=!1,c.leadingIcon=o.leadingIcon,c.helperText=o.helperText,c}return e(d,i),Object.defineProperty(d,"cssClasses",{get:function(){return Ye},enumerable:!1,configurable:!0}),Object.defineProperty(d,"numbers",{get:function(){return We},enumerable:!1,configurable:!0}),Object.defineProperty(d,"strings",{get:function(){return Xe},enumerable:!1,configurable:!0}),Object.defineProperty(d,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){return!1},activateBottomLine:function(){},deactivateBottomLine:function(){},getSelectedIndex:function(){return-1},setSelectedIndex:function(){},hasLabel:function(){return!1},floatLabel:function(){},getLabelWidth:function(){return 0},setLabelRequired:function(){},hasOutline:function(){return!1},notchOutline:function(){},closeOutline:function(){},setRippleCenter:function(){},notifyChange:function(){},setSelectedText:function(){},isSelectAnchorFocused:function(){return!1},getSelectAnchorAttr:function(){return""},setSelectAnchorAttr:function(){},removeSelectAnchorAttr:function(){},addMenuClass:function(){},removeMenuClass:function(){},openMenu:function(){},clo
|
||
|
<div
|
||
|
class="mdc-select ${a(e)}">
|
||
|
<input
|
||
|
class="formElement"
|
||
|
name="${this.name}"
|
||
|
.value="${this.value}"
|
||
|
hidden
|
||
|
?disabled="${this.disabled}"
|
||
|
?required=${this.required}>
|
||
|
<!-- @ts-ignore -->
|
||
|
<div class="mdc-select__anchor"
|
||
|
aria-autocomplete="none"
|
||
|
role="combobox"
|
||
|
aria-expanded=${this.menuOpen}
|
||
|
aria-invalid=${!this.isUiValid}
|
||
|
aria-haspopup="listbox"
|
||
|
aria-labelledby=${u(i)}
|
||
|
aria-required=${this.required}
|
||
|
aria-describedby=${u(d)}
|
||
|
@click=${this.onClick}
|
||
|
@focus=${this.onFocus}
|
||
|
@blur=${this.onBlur}
|
||
|
@keydown=${this.onKeydown}>
|
||
|
${this.renderRipple()}
|
||
|
${this.outlined?this.renderOutline():this.renderLabel()}
|
||
|
${this.renderLeadingIcon()}
|
||
|
<span class="mdc-select__selected-text-container">
|
||
|
<span class="mdc-select__selected-text">${this.selectedText}</span>
|
||
|
</span>
|
||
|
<span class="mdc-select__dropdown-icon">
|
||
|
<svg
|
||
|
class="mdc-select__dropdown-icon-graphic"
|
||
|
viewBox="7 10 10 5"
|
||
|
focusable="false">
|
||
|
<polygon
|
||
|
class="mdc-select__dropdown-icon-inactive"
|
||
|
stroke="none"
|
||
|
fill-rule="evenodd"
|
||
|
points="7 10 12 15 17 10">
|
||
|
</polygon>
|
||
|
<polygon
|
||
|
class="mdc-select__dropdown-icon-active"
|
||
|
stroke="none"
|
||
|
fill-rule="evenodd"
|
||
|
points="7 15 12 10 17 15">
|
||
|
</polygon>
|
||
|
</svg>
|
||
|
</span>
|
||
|
${this.renderLineRipple()}
|
||
|
</div>
|
||
|
<mwc-menu
|
||
|
innerRole="listbox"
|
||
|
wrapFocus
|
||
|
class="mdc-select__menu mdc-menu mdc-menu-surface ${a(t)}"
|
||
|
activatable
|
||
|
.fullwidth=${!this.fixedMenuPosition&&!this.naturalMenuWidth}
|
||
|
.open=${this.menuOpen}
|
||
|
.anchor=${this.anchorElement}
|
||
|
.fixed=${this.fixedMenuPosition}
|
||
|
@selected=${this.onSelected}
|
||
|
@opened=${this.onOpened}
|
||
|
@closed=${this.onClosed}
|
||
|
@items-updated=${this.onItemsUpdated}
|
||
|
@keydown=${this.handleTypeahead}>
|
||
|
<slot></slot>
|
||
|
</mwc-menu>
|
||
|
</div>
|
||
|
${this.renderHelperText()}`}renderRipple(){return this.outlined?E:n`
|
||
|
<span class="mdc-select__ripple"></span>
|
||
|
`}renderOutline(){return this.outlined?n`
|
||
|
<mwc-notched-outline
|
||
|
.width=${this.outlineWidth}
|
||
|
.open=${this.outlineOpen}
|
||
|
class="mdc-notched-outline">
|
||
|
${this.renderLabel()}
|
||
|
</mwc-notched-outline>`:E}renderLabel(){return this.label?n`
|
||
|
<span
|
||
|
.floatingLabelFoundation=${ce(this.label)}
|
||
|
id="label">${this.label}</span>
|
||
|
`:E}renderLeadingIcon(){return this.icon?n`<mwc-icon class="mdc-select__icon"><div>${this.icon}</div></mwc-icon>`:E}renderLineRipple(){return this.outlined?E:n`
|
||
|
<span .lineRippleFoundation=${ae()}></span>
|
||
|
`}renderHelperText(){if(!this.shouldRenderHelperText)return E;const e=this.validationMessage&&!this.isUiValid;return n`
|
||
|
<p
|
||
|
class="mdc-select-helper-text ${a({"mdc-select-helper-text--validation-msg":e})}"
|
||
|
id="helper-text">${e?this.validationMessage:this.helper}</p>`}createAdapter(){return Object.assign(Object.assign({},I(this.mdcRoot)),{activateBottomLine:()=>{this.lineRippleElement&&this.lineRippleElement.lineRippleFoundation.activate()},deactivateBottomLine:()=>{this.lineRippleElement&&this.lineRippleElement.lineRippleFoundation.deactivate()},hasLabel:()=>!!this.label,floatLabel:e=>{this.labelElement&&this.labelElement.floatingLabelFoundation.float(e)},getLabelWidth:()=>this.labelElement?this.labelElement.floatingLabelFoundation.getWidth():0,setLabelRequired:e=>{this.labelElement&&this.labelElement.floatingLabelFoundation.setRequired(e)},hasOutline:()=>this.outlined,notchOutline:e=>{this.outlineElement&&!this.outlineOpen&&(this.outlineWidth=e,this.outlineOpen=!0)},closeOutline:()=>{this.outlineElement&&(this.outlineOpen=!1)},setRippleCenter:e=>{if(this.lineRippleElement){this.lineRippleElement.lineRippleFoundation.setRippleCenter(e)}},notifyChange:async e=>{if(!this.valueSetDirectly&&e===this.value)return;this.valueSetDirectly=!1,this.value=e,await this.updateComplete;const t=new Event("change",{bubbles:!0});this.dispatchEvent(t)},setSelectedText:e=>this.selectedText=e,isSelectAnchorFocused:()=>{const e=this.anchorElement;if(!e)return!1;return e.getRootNode().activeElement===e},getSelectAnchorAttr:e=>{const t=this.anchorElement;return t?t.getAttribute(e):null},setSelectAnchorAttr:(e,t)=>{const i=this.anchorElement;i&&i.setAttribute(e,t)},removeSelectAnchorAttr:e=>{const t=this.anchorElement;t&&t.removeAttribute(e)},openMenu:()=>{this.menuOpen=!0},closeMenu:()=>{this.menuOpen=!1},addMenuClass:()=>{},removeMenuClass:()=>{},getAnchorElement:()=>this.anchorElement,setMenuAnchorElement:()=>{},setMenuAnchorCorner:()=>{const e=this.menuElement;e&&(e.corner="BOTTOM_START")},setMenuWrapFocus:e=>{const t=this.menuElement;t&&(t.wrapFocus=e)},focusMenuItemAtIndex:e=>{const t=this.menuElement;if(!t)return;const i=t.items[e];i&&i.focus()},getMenuItemCount:()=>{const e=this.menuElement;return e?e.items.length:0},getMenuItemValues:()=>{const e=this.menuElement;if(!e)return[];return e.items.map((e=>e.value))},getMenuItemTextAtIndex:e=>{const t=this.menuElement;if(!t)return"";const i=t.items[e];return i?i.text:""},getSelectedIndex:()=>this.index,setSelectedIndex:()=>{},isTypeaheadInProgress:()=>Ue(this.typeaheadState),typeaheadMatchItem:(e,t)=>{if(!this.menuElement)return-1;const i={focusItemAtIndex:e=>{this.menuElement.focusItemAtIndex(e)},focusedItemIndex:t||this.menuElement.getFocusedItemIndex(),nextChar:e,sortedIndexByFirstChar:this.sortedIndexByFirstChar,skipFocus:!1,isItemAtIndexDisabled:e=>this.items[e].disabled},d=Pe(i,this.typeaheadState);return-1!==d&&this.select(d),d}})}checkValidity(){const e=this._checkValidity(this.value);if(!e){const e=new Event("invalid",{bubbles:!1,cancelable:!0});this.dispatchEvent(e)}return e}reportValidity(){const e=this.checkValidity();return this.isUiValid=e,e}_checkValidity(e){const t=this.formElement.validity;let i=Ge(t);if(this.validityTransform){const t=this.validityTransform(e,i);i=Object.assign(Object.assign({},i),t)}return this._validity=i,this._validity.valid}setCustomValidity(e){this.validationMessage=e,this.formElement.setCustomValidity(e)}async getUpdateComplete(){await this._menuUpdateComplete;return await super.getUpdateComplete()}async firstUpdated(){const e=this.menuElement;if(e&&(this._menuUpdateComplete=e.updateComplete,await this._menuUpdateComplete),super.firstUpdated(),this.mdcFoundation.isValid=()=>!0,this.mdcFoundation.setValid=()=>{},this.mdcFoundation.setDisabled(this.disabled),this.validateOnInitialRender&&this.reportValidity(),!this.selected){!this.items.length&&this.slotElement&&this.slotElement.assignedNodes({flatten:!0}).length&&(await new Promise((e=>requestAnimationFrame(e))),await this.layout());const e=this.items.length&&""===this.items[0].value;if(!this.value&&e)return void this.select(0);this.selectByValue(this.value)}this.sortedIndexByFirstChar=He(this.items.length,(e=>this.items[e].text))}onItemsUpdated(){this.sortedIndexByFirstChar=He(this.items.lengt
|
||
|
><slot name="icon"></slot
|
||
|
></span>`:E}},{kind:"method",key:"connectedCallback",value:function(){C(A(i.prototype),"connectedCallback",this).call(this),window.addEventListener("translations-updated",this._translationsUpdated)}},{kind:"method",key:"disconnectedCallback",value:function(){C(A(i.prototype),"disconnectedCallback",this).call(this),window.removeEventListener("translations-updated",this._translationsUpdated)}},{kind:"field",key:"_translationsUpdated",value(){return Qe((async()=>{await T(),this.layoutOptions()}),500)}},{kind:"field",static:!0,key:"styles",value:()=>[Ke,r`
|
||
|
.mdc-select:not(.mdc-select--disabled) .mdc-select__icon {
|
||
|
color: var(--secondary-text-color);
|
||
|
}
|
||
|
.mdc-select__anchor {
|
||
|
width: var(--ha-select-min-width, 200px);
|
||
|
}
|
||
|
.mdc-select--filled .mdc-floating-label {
|
||
|
inset-inline-start: 12px;
|
||
|
inset-inline-end: initial;
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
.mdc-select--filled.mdc-select--with-leading-icon .mdc-floating-label {
|
||
|
inset-inline-start: 48px;
|
||
|
inset-inline-end: initial;
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
.mdc-select .mdc-select__anchor {
|
||
|
padding-inline-start: 12px;
|
||
|
padding-inline-end: 0px;
|
||
|
direction: var(--direction);
|
||
|
}
|
||
|
.mdc-select__anchor .mdc-floating-label--float-above {
|
||
|
transform-origin: var(--float-start);
|
||
|
}
|
||
|
`]}]}}),qe);const Je=Symbol("selection controller");class Ze{constructor(){this.selected=null,this.ordered=null,this.set=new Set}}class et{constructor(e){this.sets={},this.focusedSet=null,this.mouseIsDown=!1,this.updating=!1,e.addEventListener("keydown",(e=>{this.keyDownHandler(e)})),e.addEventListener("mousedown",(()=>{this.mousedownHandler()})),e.addEventListener("mouseup",(()=>{this.mouseupHandler()}))}static getController(e){const t=!("global"in e)||"global"in e&&e.global?document:e.getRootNode();let i=t[Je];return void 0===i&&(i=new et(t),t[Je]=i),i}keyDownHandler(e){const t=e.target;"checked"in t&&this.has(t)&&("ArrowRight"==e.key||"ArrowDown"==e.key?this.selectNext(t):"ArrowLeft"!=e.key&&"ArrowUp"!=e.key||this.selectPrevious(t))}mousedownHandler(){this.mouseIsDown=!0}mouseupHandler(){this.mouseIsDown=!1}has(e){return this.getSet(e.name).set.has(e)}selectPrevious(e){const t=this.getOrdered(e),i=t.indexOf(e),d=t[i-1]||t[t.length-1];return this.select(d),d}selectNext(e){const t=this.getOrdered(e),i=t.indexOf(e),d=t[i+1]||t[0];return this.select(d),d}select(e){e.click()}focus(e){if(this.mouseIsDown)return;const t=this.getSet(e.name),i=this.focusedSet;this.focusedSet=t,i!=t&&t.selected&&t.selected!=e&&t.selected.focus()}isAnySelected(e){const t=this.getSet(e.name);for(const e of t.set)if(e.checked)return!0;return!1}getOrdered(e){const t=this.getSet(e.name);return t.ordered||(t.ordered=Array.from(t.set),t.ordered.sort(((e,t)=>e.compareDocumentPosition(t)==Node.DOCUMENT_POSITION_PRECEDING?1:0))),t.ordered}getSet(e){return this.sets[e]||(this.sets[e]=new Ze),this.sets[e]}register(e){const t=e.name||e.getAttribute("name")||"",i=this.getSet(t);i.set.add(e),i.ordered=null}unregister(e){const t=this.getSet(e.name);t.set.delete(e),t.ordered=null,t.selected==e&&(t.selected=null)}update(e){if(this.updating)return;this.updating=!0;const t=this.getSet(e.name);if(e.checked){for(const i of t.set)i!=e&&(i.checked=!1);t.selected=e}if(this.isAnySelected(e))for(const e of t.set){if(void 0===e.formElementTabIndex)break;e.formElementTabIndex=e.checked?0:-1}this.updating=!1}}var tt={NATIVE_CONTROL_SELECTOR:".mdc-radio__native-control"},it={DISABLED:"mdc-radio--disabled",ROOT:"mdc-radio"},dt=function(i){function d(e){return i.call(this,t(t({},d.defaultAdapter),e))||this}return e(d,i),Object.defineProperty(d,"cssClasses",{get:function(){return it},enumerable:!1,configurable:!0}),Object.defineProperty(d,"strings",{get:function(){return tt},enumerable:!1,configurable:!0}),Object.defineProperty(d,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},setNativeControlDisabled:function(){}}},enumerable:!1,configurable:!0}),d.prototype.setDisabled=function(e){var t=d.cssClasses.DISABLED;this.adapter.setNativeControlDisabled(e),e?this.adapter.addClass(t):this.adapter.removeClass(t)},d}(i);class ot extends X{constructor(){super(...arguments),this._checked=!1,this.useStateLayerCustomProperties=!1,this.global=!1,this.disabled=!1,this.value="on",this.name="",this.reducedTouchTarget=!1,this.mdcFoundationClass=dt,this.formElementTabIndex=0,this.focused=!1,this.shouldRenderRipple=!1,this.rippleElement=null,this.rippleHandlers=new f((()=>(this.shouldRenderRipple=!0,this.ripple.then((e=>{this.rippleElement=e})),this.ripple)))}get checked(){return this._checked}set checked(e){var t,i;const d=this._checked;e!==d&&(this._checked=e,this.formElement&&(this.formElement.checked=e),null===(t=this._selectionController)||void 0===t||t.update(this),!1===e&&(null===(i=this.formElement)||void 0===i||i.blur()),this.requestUpdate("checked",d),this.dispatchEvent(new Event("checked",{bubbles:!0,composed:!0})))}_handleUpdatedValue(e){this.formElement.value=e}renderRipple(){return this.shouldRenderRipple?n`<mwc-ripple unbounded accent
|
||
|
.internalUseStateLayerCustomProperties="${this.useStateLayerCustomProperties}"
|
||
|
.disabled="${this.disabled}"></mwc-ripple>`:""}get isRippleActive(){var e;return(null===(e=this.rippleElement)||void 0===e?void 0:e.isActive)||!1}connectedCallback(){super.connectedCallback(),this._selectionController=et.getController(this),this._selectionController.register(this),this._selectionController.update(this)}disconnectedCallback(){this._selectionController.unregister(this),this._selectionController=void 0}focus(){this.formElement.focus()}createAdapter(){return Object.assign(Object.assign({},I(this.mdcRoot)),{setNativeControlDisabled:e=>{this.formElement.disabled=e}})}handleFocus(){this.focused=!0,this.handleRippleFocus()}handleClick(){this.formElement.focus()}handleBlur(){this.focused=!1,this.formElement.blur(),this.rippleHandlers.endFocus()}setFormData(e){this.name&&this.checked&&e.append(this.name,this.value)}render(){const e={"mdc-radio--touch":!this.reducedTouchTarget,"mdc-ripple-upgraded--background-focused":this.focused,"mdc-radio--disabled":this.disabled};return n`
|
||
|
<div class="mdc-radio ${a(e)}">
|
||
|
<input
|
||
|
tabindex="${this.formElementTabIndex}"
|
||
|
class="mdc-radio__native-control"
|
||
|
type="radio"
|
||
|
name="${this.name}"
|
||
|
aria-label="${u(this.ariaLabel)}"
|
||
|
aria-labelledby="${u(this.ariaLabelledBy)}"
|
||
|
.checked="${this.checked}"
|
||
|
.value="${this.value}"
|
||
|
?disabled="${this.disabled}"
|
||
|
@change="${this.changeHandler}"
|
||
|
@focus="${this.handleFocus}"
|
||
|
@click="${this.handleClick}"
|
||
|
@blur="${this.handleBlur}"
|
||
|
@mousedown="${this.handleRippleMouseDown}"
|
||
|
@mouseenter="${this.handleRippleMouseEnter}"
|
||
|
@mouseleave="${this.handleRippleMouseLeave}"
|
||
|
@touchstart="${this.handleRippleTouchStart}"
|
||
|
@touchend="${this.handleRippleDeactivate}"
|
||
|
@touchcancel="${this.handleRippleDeactivate}">
|
||
|
<div class="mdc-radio__background">
|
||
|
<div class="mdc-radio__outer-circle"></div>
|
||
|
<div class="mdc-radio__inner-circle"></div>
|
||
|
</div>
|
||
|
${this.renderRipple()}
|
||
|
</div>`}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()}changeHandler(){this.checked=this.formElement.checked}}d([l(".mdc-radio")],ot.prototype,"mdcRoot",void 0),d([l("input")],ot.prototype,"formElement",void 0),d([m()],ot.prototype,"useStateLayerCustomProperties",void 0),d([o({type:Boolean})],ot.prototype,"global",void 0),d([o({type:Boolean,reflect:!0})],ot.prototype,"checked",null),d([o({type:Boolean}),O((function(e){this.mdcFoundation.setDisabled(e)}))],ot.prototype,"disabled",void 0),d([o({type:String}),O((function(e){this._handleUpdatedValue(e)}))],ot.prototype,"value",void 0),d([o({type:String})],ot.prototype,"name",void 0),d([o({type:Boolean})],ot.prototype,"reducedTouchTarget",void 0),d([o({type:Number})],ot.prototype,"formElementTabIndex",void 0),d([m()],ot.prototype,"focused",void 0),d([m()],ot.prototype,"shouldRenderRipple",void 0),d([h("mwc-ripple")],ot.prototype,"ripple",void 0),d([s,o({attribute:"aria-label"})],ot.prototype,"ariaLabel",void 0),d([s,o({attribute:"aria-labelledby"})],ot.prototype,"ariaLabelledBy",void 0),d([p({passive:!0})],ot.prototype,"handleRippleTouchStart",null);const ct=r`.mdc-touch-target-wrapper{display:inline}.mdc-radio{padding:calc((40px - 20px) / 2)}.mdc-radio .mdc-radio__native-control:enabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0, 0, 0, 0.54)}.mdc-radio .mdc-radio__native-control:enabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:#018786;border-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__native-control:enabled+.mdc-radio__background .mdc-radio__inner-circle{border-color:#018786;border-color:var(--mdc-theme-secondary, #018786)}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0, 0, 0, 0.38)}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:rgba(0, 0, 0, 0.38)}.mdc-radio [aria-disabled=true] .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle,.mdc-radio .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{border-color:rgba(0, 0, 0, 0.38)}.mdc-radio .mdc-radio__background::before{background-color:#018786;background-color:var(--mdc-theme-secondary, #018786)}.mdc-radio .mdc-radio__background::before{top:calc(-1 * (40px - 20px) / 2);left:calc(-1 * (40px - 20px) / 2);width:40px;height:40px}.mdc-radio .mdc-radio__native-control{top:calc((40px - 40px) / 2);right:calc((40px - 40px) / 2);left:calc((40px - 40px) / 2);width:40px;height:40px}@media screen and (forced-colors: active),(-ms-high-contrast: active){.mdc-radio [aria-disabled=true] .mdc-radio__native-control:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:not(:checked)+.mdc-radio__background .mdc-radio__outer-circle{border-color:GrayText}.mdc-radio [aria-disabled=true] .mdc-radio__native-control:checked+.mdc-radio__background .mdc-radio__outer-circle,.mdc-radio .mdc-radio__native-control:disabled:checked+.mdc-radio__background .mdc-radio__outer-circle{border-color:GrayText}.mdc-radio [aria-disabled=true] .mdc-radio__native-control+.mdc-radio__background .mdc-radio__inner-circle,.mdc-radio .mdc-radio__native-control:disabled+.mdc-radio__background .mdc-radio__inner-circle{border-color:GrayText}}.mdc-radio{display:inline-block;position:relative;fle
|
||
|
:host {
|
||
|
--mdc-theme-secondary: var(--primary-color);
|
||
|
}
|
||
|
`]}]}}),ot);export{W as F,Fe as T,Be as a,Ce as b,Se as c,Qe as d,ye as e,Re as f,Te as l,Ae as m,ve as n,Le as p,we as r,j as s,_e as t,Ee as u};
|