UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

5 lines 2.42 kB
/*! * All material copyright ESRI, All Rights Reserved, unless otherwise specified. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details. */ System.register(["./p-65dbbfb5.system.js","./p-ec9bab33.system.js","./p-f78023f1.system.js","./p-5958acc8.system.js"],(function(t){"use strict";var e,n,r,o,i;return{setters:[function(t){e=t.f;n=t.h},function(t){r=t.a},function(t){o=t.S},function(t){i=t.S}],execute:function(){t("t",p);var c=t("o",150);var a=2;var u=function(t){var e=t.height,n=t.actionHeight,r=t.groupCount;return Math.floor((e-r*a)/n)};var l=t("g",(function(t){var e=t.actionCount,n=t.actionHeight,r=t.height,o=t.groupCount;return Math.max(e-u({height:r,actionHeight:n,groupCount:o}),0)}));var f=t("q",(function(t){return Array.from(t.querySelectorAll("calcite-action")).filter((function(t){return t.closest("calcite-action-menu")?t.slot===o.trigger:true}))}));var s=t("a",(function(t){var n=t.actionGroups,r=t.expanded,o=t.overflowCount;var c=o;n.reverse().forEach((function(t){var n=0;var o=f(t).reverse();o.forEach((function(t){if(t.slot===i.menuActions){t.removeAttribute("slot");t.textEnabled=r}}));if(c>0){o.some((function(t){var e=o.filter((function(t){return!t.slot}));if(e.length>1&&o.length>2&&!t.closest("calcite-action-menu")){t.textEnabled=true;t.setAttribute("slot",i.menuActions);n++;if(n>1){c--}}return c<1}))}e(t)}))}));var v={chevronsLeft:"chevrons-left",chevronsRight:"chevrons-right"};function h(t,e){var n;return t||((n=e.closest("calcite-shell-panel"))===null||n===void 0?void 0:n.position)||"start"}function p(t){var e=t.parent,n=t.expanded;f(e).filter((function(t){return t.slot!==i.menuActions})).forEach((function(t){return t.textEnabled=n}));e.querySelectorAll("calcite-action-group").forEach((function(t){return t.expanded=n}))}var g=function(t){var e=t.tooltip,n=t.referenceElement,r=t.expanded,o=t.ref;if(e){e.referenceElement=!r&&n?n:null}if(o){o(n)}return n};var d=t("E",(function(t){var e=t.expanded,o=t.intlExpand,i=t.intlCollapse,c=t.toggle,a=t.el,u=t.position,l=t.tooltip,f=t.ref,s=t.scale;var p=r(a)==="rtl";var d=e?i:o;var m=[v.chevronsLeft,v.chevronsRight];if(p){m.reverse()}var x=h(u,a)==="end";var E=x?m[1]:m[0];var b=x?m[0]:m[1];var y=n("calcite-action",{icon:e?E:b,onClick:c,ref:function(t){return g({tooltip:l,referenceElement:t,expanded:e,ref:f})},scale:s,text:d,textEnabled:e});return l?n("calcite-tooltip-manager",null,y):y}))}}}));