@arcgis/map-components
Version:
ArcGIS Map Components
44 lines (43 loc) • 2.28 kB
JavaScript
import { c as d } from "../../chunks/runtime.js";
import { ref as h } from "lit-html/directives/ref.js";
import { html as n } from "lit-html";
import { keyed as p } from "lit-html/directives/keyed.js";
import { LitElement as m, createEvent as b, safeClassMap as c } from "@arcgis/lumina";
import { css as f } from "@lit/reactive-element/css-tag.js";
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
v4.33.13 */
const g = f`.label{--calcite-label-margin-bottom: 0}.label-content{display:flex;flex:1;gap:var(--calcite-spacing-sm);align-items:center;text-wrap:balance}.label-content>div{flex-grow:1}.icon{margin-top:-1px;&.info{color:var(--calcite-color-status-info)}&.warning{color:var(--calcite-color-status-warning)}}.tooltip{text-wrap:wrap}`, e = {
label: "label",
labelContent: "label-content",
iconInfo: "icon info",
iconWarning: "icon warning",
tooltip: "tooltip"
};
class w extends m {
constructor() {
super(...arguments), this.checked = !1, this.disabled = !1, this.hintKind = "info", this.arcgisCheckedChanged = b();
}
static {
this.properties = { _icon: 16, checked: 7, disabled: 7, label: 1, hint: 1, hintIcon: 1, hintKind: 1 };
}
static {
this.styles = g;
}
async destroy() {
await this.manager.destroy();
}
_setIconRef(t) {
this._icon = t;
}
render() {
const { label: t, hint: a, hintKind: l, hintIcon: o, checked: s, disabled: r } = this;
return n`<calcite-label class=${c(e.label)} layout=inline-space-between scale=s>${a ? p("label-content", n`<div class=${c(e.labelContent)}><div>${t}</div><calcite-icon class=${c(l !== "warning" ? e.iconInfo : e.iconWarning)} .icon=${o ?? "information"} @click=${(i) => i.stopPropagation()} scale=s tabindex=0 ${h(this._setIconRef)}></calcite-icon><calcite-tooltip class=${c(e.tooltip)} overlay-positioning=fixed .referenceElement=${this._icon ?? void 0}>${a}</calcite-tooltip></div>`) : t}<calcite-switch .checked=${s} .disabled=${r} scale=s @calciteSwitchChange=${(i) => {
this.checked = i.target.checked, this.arcgisCheckedChanged.emit(i.target.checked);
}}></calcite-switch></calcite-label>`;
}
}
d("arcgis-labeled-switch", w);
export {
w as LabeledSwitch
};