UNPKG

@arcgis/map-components

Version:
53 lines (52 loc) 2.44 kB
import { c as l } from "../../chunks/runtime.js"; import { html as o } from "lit-html"; import { usePropertyChange as c } from "@arcgis/lumina/controllers"; import { reEmitEvent as n } from "@arcgis/lumina/controllers/accessor"; import { classes as m } from "@arcgis/components-utils"; import d from "@arcgis/core/widgets/Home/HomeViewModel.js"; import { LitElement as h, createEvent as g, noShadowRoot as p, safeClassMap as i, nothing as v } from "@arcgis/lumina"; import { u as w } from "../../chunks/useT9n.js"; import { m as f } from "../../chunks/useViewModel.js"; import { g as a } from "../../chunks/globalCss.js"; import { css as u } 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 b = u`@layer{arcgis-home{display:block}}`, y = { base: "esri-home" }, M = f(d); class $ extends h { constructor() { super(...arguments), this.messages = w(), this.viewModel = M(this), this.autoDestroyDisabled = !1, this.goToOverride = this.viewModel.goToOverride, this.icon = "home", this.position = "top-left", this.state = this.viewModel.state, this.viewpoint = this.viewModel.viewpoint, this.arcgisGo = n(() => this.viewModel, "go"), this.arcgisPropertyChange = c()("state"), this.arcgisReady = g(); } static { this.properties = { autoDestroyDisabled: 5, goToOverride: 0, icon: 1, label: 1, messageOverrides: 0, position: 3, referenceElement: 1, state: 3, viewpoint: 0 }; } static { this.shadowRootOptions = p; } static { this.styles = b; } async cancelGo() { this.viewModel.cancelGo(); } async destroy() { await this.manager.destroy(); } async go() { this.viewModel.go(); } _go() { const { viewModel: e } = this; e.state === "going-home" ? e.cancelGo() : e.go(); } render() { const { messages: e, icon: r } = this, t = this.viewModel?.state, s = t === "going-home"; return o`<div class=${i(m(y.base, a.widget))}><calcite-button class=${i(a.widgetButton)} .disabled=${t === "disabled"} .iconStart=${s ? void 0 : r ?? void 0} kind=neutral .label=${e.componentLabel} @click=${this._go} .scale=${s ? "s" : "m"} title=${(t === "going-home" ? e.cancel : e.title) ?? v}>${s ? o`<calcite-loader inline label></calcite-loader>` : null}</calcite-button></div>`; } } l("arcgis-home", $); export { $ as ArcgisHome };