@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
5 lines (4 loc) • 1.83 kB
JavaScript
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
v3.2.1 */
import{a}from"./DY5YDEPG.js";import{b as A}from"./5RDOSP2E.js";import{b as E}from"./BEA6KQAT.js";import{e as S}from"./3ADX47DD.js";import{d as g,h as v}from"./BJZTU5BQ.js";var b=t=>Array.from(t.querySelectorAll("calcite-action")).filter(e=>e.closest("calcite-action-menu")?e.slot===E.trigger:!0),D=({actionGroups:t,expanded:e,overflowCount:o})=>{let c=o;t.reverse().forEach(l=>{let i=0,s=b(l).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),i++,i>1&&c--),c<1)),l.manager.component.requestUpdate()})},$={chevronsLeft:"chevrons-left",chevronsRight:"chevrons-right"};function y(t,e){return t||e.closest("calcite-shell-panel")?.position||"start"}function G({el:t,expanded:e}){b(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 L=({tooltip:t,referenceElement:e,expanded:o,ref:c})=>(t&&(t.referenceElement=!o&&e?e:null),c&&c(e),e),P=({expanded:t,expandText:e,collapseText:o,expandLabel:c,collapseLabel:l,toggle:i,el:s,position:n,tooltip:f,ref:u,scale:d})=>{let p=S(s)==="rtl",m=t?o:e,x=t?l:c,r=[$.chevronsLeft,$.chevronsRight];p&&r.reverse();let h=y(n,s)==="end",T=h?r[1]:r[0],q=h?r[0]:r[1];return g`<calcite-action .icon=${t?T:q} id=expand-toggle .label=${x} @click=${i} .scale=${d} .text=${m} .textEnabled=${t} title=${(!t&&!f?m:null)??v} ${A(C=>L({tooltip:f,referenceElement:C,expanded:t,ref:u}))}></calcite-action>`};export{b as a,D as b,G as c,P as d};