UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 6.92 kB
export const __rspack_esm_id=7774;export const __rspack_esm_ids=[7774];export const __webpack_modules__={89865(t,o,e){e.a(t,async function(t,o){try{e(18111),e(61701);var a=e(62826),i=(e(22395),e(5124)),r=e(22441),n=e(1087),l=e(18350),s=(e(67094),t([l]));l=(s.then?(await s)():s)[0];class u extends i.WF{render(){return i.qy` <wa-button-group childSelector="ha-button"> ${this.buttons.map(t=>i.qy`<ha-button iconTag="ha-svg-icon" class="icon" .variant="${this.active===t.value&&this.activeVariant?this.activeVariant:this.variant}" .size="${this.size}" .value="${t.value}" @click="${this._handleClick}" .title="${t.label}" .appearance="${this.active===t.value?"accent":"filled"}"> ${t.iconPath?i.qy`<ha-svg-icon aria-label="${t.label}" .path="${t.iconPath}"></ha-svg-icon>`:t.label} </ha-button>`)} </wa-button-group> `}_handleClick(t){this.active=t.currentTarget.value,(0,n.r)(this,"value-changed",{value:this.active})}constructor(...t){super(...t),this.size="medium",this.nowrap=!1,this.fullWidth=!1,this.variant="brand"}}u.styles=i.AH`:host{--mdc-icon-size:var(--button-toggle-icon-size, 20px)}:host([no-wrap]) wa-button-group::part(base){flex-wrap:nowrap}wa-button-group{padding:var(--ha-button-toggle-group-padding)}:host([full-width]) wa-button-group,:host([full-width]) wa-button-group::part(base){width:100%}:host([full-width]) ha-button{flex:1}`,(0,a.Cg)([(0,r.MZ)({attribute:!1})],u.prototype,"buttons",void 0),(0,a.Cg)([(0,r.MZ)()],u.prototype,"active",void 0),(0,a.Cg)([(0,r.MZ)({reflect:!0})],u.prototype,"size",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"no-wrap"})],u.prototype,"nowrap",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"full-width"})],u.prototype,"fullWidth",void 0),(0,a.Cg)([(0,r.MZ)()],u.prototype,"variant",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"active-variant"})],u.prototype,"activeVariant",void 0),u=(0,a.Cg)([(0,r.EM)("ha-button-toggle-group")],u),o()}catch(t){o(t)}})},79949(t,o,e){e.a(t,async function(t,a){try{e.r(o),e.d(o,{HaButtonToggleSelector:()=>c});e(18111),e(7588),e(61701);var i=e(62826),r=e(5124),n=e(22441),l=e(1087),s=e(52220),u=e(89865),d=t([u]);u=(d.then?(await d)():d)[0];class c extends r.WF{render(){const t=this.selector.button_toggle?.options?.map(t=>"object"==typeof t?t:{value:t,label:t})||[],o=this.selector.button_toggle?.translation_key;this.localizeValue&&o&&t.forEach(t=>{const e=this.localizeValue(`${o}.options.${t.value}`);e&&(t.label=e)}),this.selector.button_toggle?.sort&&t.sort((t,o)=>(0,s.SH)(t.label,o.label,this.hass.locale.language));const e=t.map(t=>({label:t.label,value:t.value}));return r.qy` ${this.label} <ha-button-toggle-group .buttons="${e}" .active="${this.value}" @value-changed="${this._valueChanged}"></ha-button-toggle-group> `}_valueChanged(t){t.stopPropagation();const o=t.detail?.value||t.target.value;this.disabled||void 0===o||o===(this.value??"")||(0,l.r)(this,"value-changed",{value:o})}constructor(...t){super(...t),this.disabled=!1,this.required=!0}}c.styles=r.AH`:host{position:relative;display:flex;justify-content:space-between;flex-wrap:wrap;gap:var(--ha-space-2);align-items:center}@media all and (max-width:600px){ha-button-toggle-group{flex:1}}`,(0,i.Cg)([(0,n.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],c.prototype,"selector",void 0),(0,i.Cg)([(0,n.MZ)()],c.prototype,"value",void 0),(0,i.Cg)([(0,n.MZ)()],c.prototype,"label",void 0),(0,i.Cg)([(0,n.MZ)()],c.prototype,"helper",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],c.prototype,"localizeValue",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],c.prototype,"disabled",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],c.prototype,"required",void 0),c=(0,i.Cg)([(0,n.EM)("ha-selector-button_toggle")],c),a()}catch(t){a(t)}})},22395(t,o,e){var a=e(5124),i=e(22441),r=e(717),n=a.AH`:host{display:inline-flex}.button-group{display:flex;position:relative;isolation:isolate;flex-wrap:wrap}@media (hover:hover){.button-group::slotted(:hover),.button-group>:hover{z-index:1}}.button-group::slotted(:focus),.button-group::slotted([aria-checked=true]),.button-group::slotted([checked]),.button-group>:focus,.button-group>[aria-checked=true],.button-group>[checked]{z-index:2!important}:host([orientation=horizontal]) .button-group{flex-direction:row}:host([orientation=vertical]) .button-group{flex-direction:column}:host([orientation=horizontal]){--_button-horizontal-indent:var(--wa-form-control-border-width);--_button-horizontal-indent-outlined:calc(var(--wa-form-control-border-width) * -1)}:host([orientation=vertical]){--_button-vertical-indent:var(--wa-form-control-border-width);--_button-vertical-indent-outlined:calc(var(--wa-form-control-border-width) * -1)}::slotted(:not(:first-child):not(:last-child)){--_button-start-start-radius:0;--_button-start-end-radius:0;--_button-end-start-radius:0;--_button-end-end-radius:0}:host([orientation=horizontal]) ::slotted(:first-child:not(:last-child)){--_button-start-end-radius:0;--_button-end-end-radius:0}:host([orientation=horizontal]) ::slotted(:last-child:not(:first-child)){--_button-start-start-radius:0;--_button-end-start-radius:0}:host([orientation=vertical]) ::slotted(:first-child:not(:last-child)){--_button-end-start-radius:0;--_button-end-end-radius:0}:host([orientation=vertical]) ::slotted(:last-child:not(:first-child)){--_button-start-start-radius:0;--_button-start-end-radius:0}`,l=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u=(t,o,e,a)=>{for(var i,r=a>1?void 0:a?s(o,e):o,n=t.length-1;n>=0;n--)(i=t[n])&&(r=(a?i(o,e,r):i(r))||r);return a&&r&&l(o,e,r),r};let d=class extends r.A{updated(t){super.updated(t),t.has("orientation")&&this.setAttribute("aria-orientation",this.orientation)}handleFocus(t){const o=c(t.target,this.childSelector);o?.classList.add("button-focus")}handleBlur(t){const o=c(t.target,this.childSelector);o?.classList.remove("button-focus")}handleMouseOver(t){const o=c(t.target,this.childSelector);o?.classList.add("button-hover")}handleMouseOut(t){const o=c(t.target,this.childSelector);o?.classList.remove("button-hover")}render(){return a.qy` <slot part="base" class="button-group" role="${this.disableRole?"presentation":"group"}" aria-label="${this.label}" aria-orientation="${this.orientation}" @focusout="${this.handleBlur}" @focusin="${this.handleFocus}" @mouseover="${this.handleMouseOver}" @mouseout="${this.handleMouseOut}"></slot> `}constructor(){super(...arguments),this.disableRole=!1,this.hasOutlined=!1,this.label="",this.orientation="horizontal",this.childSelector="wa-button, wa-radio-button"}};function c(t,o){return t.closest(o)??t.querySelector(o)}d.css=[n],u([(0,i.P)("slot")],d.prototype,"defaultSlot",2),u([(0,i.wk)()],d.prototype,"disableRole",2),u([(0,i.wk)()],d.prototype,"hasOutlined",2),u([(0,i.MZ)()],d.prototype,"label",2),u([(0,i.MZ)({reflect:!0})],d.prototype,"orientation",2),u([(0,i.MZ)()],d.prototype,"childSelector",2),d=u([(0,i.EM)("wa-button-group")],d)}};