p-edc5bf01.js 1.8 KB

123456
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.82
  5. */
  6. import{f as t,h as e}from"./p-f74193a3.js";import{a as o}from"./p-f383e414.js";import{S as n}from"./p-89b2f38d.js";import{S as a}from"./p-7f183647.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),r=t=>Array.from(t.querySelectorAll("calcite-action")).filter((t=>!t.closest("calcite-action-menu")||t.slot===n.trigger)),l=({actionGroups:e,expanded:o,overflowCount:n})=>{let i=n;e.reverse().forEach((e=>{let n=0;const c=r(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}){r(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:r,tooltip:l,ref:s,scale:p})=>{const f="rtl"===o(c),u=t?a:n,d=["chevrons-left","chevrons-right"];f&&d.reverse();const h="end"===function(t,e){var o;return t||(null===(o=e.closest("calcite-shell-panel"))||void 0===o?void 0:o.position)||"start"}(r,c);return e("calcite-action",{icon:t?h?d[1]:d[0]:h?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:l,referenceElement:e,expanded:t,ref:s}),scale:p,text:u,textEnabled:t})};export{p as E,l as a,c as g,i as o,r as q,s as t}