UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 1.45 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ import{loadCalciteComponents as e}from"./componentsUtils.js";import{tsx as t}from"./widget.js";const n=()=>e({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch"),tooltip:()=>import("@esri/calcite-components/dist/components/calcite-tooltip")}),i="esri-labeled-switch",o={label:`${i}__label`,labelContent:`${i}__label-content`,iconInfo:`${i}__icon_info`,iconWarning:`${i}__icon_warning`,tooltip:`${i}__tooltip`};function c({checked:e,disabled:n,hint:i,key:c,label:l,topLayerDisabled:a,onChange:s,hintIcon:r,hintKind:p}){return t("calcite-label",{class:o.label,disabled:n,key:c,layout:"inline-space-between",scale:"s"},i?t("div",{class:o.labelContent,key:"label-content"},t("div",null,l),t("calcite-icon",{class:"warning"!==p?o.iconInfo:o.iconWarning,icon:r??"information",id:c,onclick:e=>e.stopPropagation(),onpointerdown:e=>{e.preventDefault(),e.stopPropagation();const t=e.target.nextElementSibling;t.open=!t.open},scale:"s",tabIndex:0}),t("calcite-tooltip",{class:o.tooltip,overlayPositioning:"fixed",referenceElement:c,topLayerDisabled:a},i)):l,t("calcite-switch",{checked:e,disabled:n,scale:"s",onCalciteSwitchChange:e=>s(e.currentTarget.checked)}))}export{c as LabeledSwitch,n as loadLabeledSwitchComponents};