UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

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