@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.52 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{loadCalciteComponents as e}from"./componentsUtils.js";import"./widgetUtils.js";import{tsx as t}from"./jsxFactory.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,onChange:a,hintIcon:s,hintKind:r}){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"!==r?o.iconInfo:o.iconWarning,icon:s??"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},i)):l,t("calcite-switch",{checked:e,disabled:n,scale:"s",onCalciteSwitchChange:e=>a(e.currentTarget.checked)}))}export{c as LabeledSwitch,n as loadLabeledSwitchComponents};