UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

3 lines (2 loc) 1.75 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */ import{a,d as S}from"./IT6LC2JX.js";import{c as $}from"./ONZUNTVX.js";import{e as E}from"./ZQBZ5QPB.js";import{D as A,h as g,l as v}from"./G7AHLVJ5.js";var d=t=>Array.from(t.querySelectorAll("calcite-action")).filter(e=>e.closest("calcite-action-menu")?e.slot===$.trigger:!0),D=({actionGroups:t,expanded:e,overflowCount:o})=>{let c=o;t.reverse().forEach(i=>{let l=0,s=d(i).filter(n=>S(n.parentElement)).reverse();s.forEach(n=>{n.slot===a.menuActions&&(n.removeAttribute("slot"),n.textEnabled=e)}),c>0&&s.some(n=>(s.filter(u=>!u.slot).length>1&&s.length>2&&!n.closest("calcite-action-menu")&&(n.textEnabled=!0,n.setAttribute("slot",a.menuActions),l++,l>1&&c--),c<1)),i.manager.component.requestUpdate()})},b={chevronsLeft:"chevrons-left",chevronsRight:"chevrons-right"};function L(t,e){return t||e.closest("calcite-shell-panel")?.position||"start"}function P({el:t,expanded:e}){d(t).filter(o=>o.slot!==a.menuActions).forEach(o=>o.textEnabled=e),t.querySelectorAll("calcite-action-group, calcite-action-menu").forEach(o=>o.expanded=e)}var G=({tooltip:t,referenceElement:e,expanded:o,ref:c})=>(t&&(t.referenceElement=!o&&e?e:null),c&&c(e),e),U=({expanded:t,expandText:e,collapseText:o,expandLabel:c,collapseLabel:i,toggle:l,el:s,position:n,tooltip:f,ref:u,scale:p})=>{let T=E(s)==="rtl",m=t?o:e,q=t?i:c,r=[b.chevronsLeft,b.chevronsRight];T&&r.reverse();let h=L(n,s)==="end",x=h?r[1]:r[0],C=h?r[0]:r[1];return g`<calcite-action .aria=${{expanded:t}} .icon=${t?x:C} id=expand-toggle .label=${q} @click=${l} .scale=${p} .text=${m} .textEnabled=${t} title=${(!t&&!f?m:null)??v} ${A(y=>G({tooltip:f,referenceElement:y,expanded:t,ref:u}))}></calcite-action>`};export{d as a,D as b,P as c,U as d};