UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

5 lines 1.86 kB
/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. */ import{f as t,h as e}from"./p-6b7b23d0.js";import{a as o}from"./p-8f3a3e4e.js";import{S as n}from"./p-7fc69a9d.js";import{S as a}from"./p-6b5776af.js";const i=150,c=({actionCount:t,actionHeight:e,height:o,groupCount:n})=>Math.max(t-(({height:t,actionHeight:e,groupCount:o})=>Math.floor((t-2*o)/e))({height:o,actionHeight:e,groupCount:n}),0),l=t=>Array.from(t.querySelectorAll("calcite-action")).filter((t=>!t.closest("calcite-action-menu")||t.slot===n.trigger)),r=({actionGroups:e,expanded:o,overflowCount:n})=>{let i=n;e.reverse().forEach((e=>{let n=0;const c=l(e).reverse();c.forEach((t=>{t.slot===a.menuActions&&(t.removeAttribute("slot"),t.textEnabled=o)})),i>0&&c.some((t=>(c.filter((t=>!t.slot)).length>1&&c.length>2&&!t.closest("calcite-action-menu")&&(t.textEnabled=!0,t.setAttribute("slot",a.menuActions),n++,n>1&&i--),i<1))),t(e)}))};function s({parent:t,expanded:e}){l(t).filter((t=>t.slot!==a.menuActions)).forEach((t=>t.textEnabled=e)),t.querySelectorAll("calcite-action-group").forEach((t=>t.expanded=e))}const p=({expanded:t,intlExpand:n,intlCollapse:a,toggle:i,el:c,position:l,tooltip:r,ref:s,scale:p})=>{const u="rtl"===o(c),f=t?a:n,d=["chevrons-left","chevrons-right"];u&&d.reverse();const g="end"===function(t,e){var o;return t||(null===(o=e.closest("calcite-shell-panel"))||void 0===o?void 0:o.position)||"start"}(l,c),h=e("calcite-action",{icon:t?g?d[1]:d[0]:g?d[0]:d[1],onClick:i,ref:e=>(({tooltip:t,referenceElement:e,expanded:o,ref:n})=>(t&&(t.referenceElement=!o&&e?e:null),n&&n(e),e))({tooltip:r,referenceElement:e,expanded:t,ref:s}),scale:p,text:f,textEnabled:t});return r?e("calcite-tooltip-manager",null,h):h};export{p as E,r as a,c as g,i as o,l as q,s as t}