UNPKG

@arcgis/map-components

Version:
4 lines 2.15 kB
/*! 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 */ import{d as l}from"./2XQPUX4C.js";import{P as o,Q as e,U as c,j as n,k as i}from"./HX57SHRL.js";export default $arcgis.t(([u])=>{var p=n`:host,.hint,.error,.section,.actions,.item{display:flex;flex-direction:column;gap:var(--calcite-spacing-md);animation:esri-fade-in .25s ease-in-out}.error{color:var(--calcite-color-status-danger)}.error,.hint{overflow:hidden;p{margin:0;padding:0}}.item-disabled{color:var(--calcite-color-text-1);opacity:var(--calcite-opacity-light)}.item-value{font-weight:var(--calcite-font-weight-semibold)}.actions{justify-content:center}`,s={error:"error",hint:"hint",actions:"actions",section:"section",item:"item",itemDisabled:"item-disabled",itemTitle:"item-title",itemValue:"item-value"},r=class extends o{constructor(){super(...arguments),this._formatter=new u,this.items=[],this.state="disabled",this.unsupportedLabel=""}static{this.properties={hintLabel:1,items:0,state:1,unsupportedLabel:1}}static{this.styles=p}async load(){await this._formatter.when()}render(){switch(this.state){case"unsupported":return i`<section class=${e(s.error)}><p>${this.unsupportedLabel}</p></section>`;case"measuring":return i`<section class=${e(s.hint)}><p>${this.hintLabel}</p></section>`;case"ready":return i`<div class=${e(s.actions)}><slot name=actions></slot></div>`;default:return i`<slot name=settings></slot>${d({formatter:this._formatter,items:this.items})}<div class=${e(s.actions)}><slot name=actions></slot></div>`}}};function d(t){return i`<section class=${e(s.section)}>${t.items.map(a=>h({formatter:t.formatter,measurement:a.measurement,title:a.title}))}</section>`}function h(t){let a=t.measurement.state==="available"?l(t.formatter,t.measurement.value):null,m=t.measurement.state==="unavailable";return i`<div class=${e({[s.item]:!0,[s.itemDisabled]:m})}><span class=${e(s.itemTitle)}>${t.title}</span><span aria-live=polite class=${e(s.itemValue)}>${a??"-"}</span></div>`}c("arcgis-measurement-content",r);return r},"applications/Components/QuantityFormatter")