123456 |
- /*!
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
- * v1.0.0-beta.97
- */
- import{r as t,c as i,h as a,H as o,g as e}from"./p-91755387.js";import{t as n,o as r,q as s,g as l,a as c,E as d,b as h}from"./p-4ee3752e.js";import{f as p,g as m}from"./p-96bf42e5.js";import{c as u}from"./p-8dc9be64.js";import{c as f,d as x}from"./p-a2f5420b.js";import{d as b}from"./p-622f8ecb.js";import"./p-717298f3.js";import"./p-5d6608fd.js";import"./p-af9e6e54.js";import"./p-d5bfadd8.js";const g=class{constructor(a){t(this,a),this.calciteActionBarToggle=i(this,"calciteActionBarToggle",6),this.expandDisabled=!1,this.expanded=!1,this.layout="vertical",this.overflowActionsDisabled=!1,this.mutationObserver=u("mutation",(()=>{const{el:t,expanded:i}=this;n({parent:t,expanded:i}),this.conditionallyOverflowActions()})),this.resizeObserver=u("resize",(t=>this.resizeHandlerEntries(t))),this.actionMenuOpenChangeHandler=t=>{if(t.detail){const i=t.composedPath();Array.from(this.el.querySelectorAll("calcite-action-group")).forEach((t=>{i.includes(t)||(t.menuOpen=!1)}))}},this.resizeHandlerEntries=t=>{t.forEach(this.resizeHandler)},this.resizeHandler=t=>{const{width:i,height:a}=t.contentRect;this.resize({width:i,height:a})},this.resize=b((({width:t,height:i})=>{const{el:a,expanded:o,expandDisabled:e,layout:n}=this;if("vertical"===n&&!i||"horizontal"===n&&!t)return;const r=s(a),d=e?r.length:r.length+1,p=Array.from(a.querySelectorAll("calcite-action-group")),u=m(a,"bottom-actions")||!e?p.length+1:p.length,{actionHeight:f,actionWidth:x}=l(r),b=h({layout:n,actionCount:d,actionHeight:f,actionWidth:x,height:i,width:t,groupCount:u});c({actionGroups:p,expanded:o,overflowCount:b})}),r),this.conditionallyOverflowActions=()=>{this.overflowActionsDisabled||this.overflowActions()},this.toggleExpand=()=>{this.expanded=!this.expanded,this.calciteActionBarToggle.emit()},this.setExpandToggleRef=t=>{this.expandToggleEl=t}}expandHandler(){this.conditionallyOverflowActions()}expandedHandler(t){n({parent:this.el,expanded:t}),this.conditionallyOverflowActions()}overflowDisabledHandler(t){t?this.resizeObserver.disconnect():this.resizeObserver.observe(this.el)}componentDidLoad(){this.conditionallyOverflowActions()}connectedCallback(){var t,i;const{el:a,expanded:o}=this;n({parent:a,expanded:o}),null===(t=this.mutationObserver)||void 0===t||t.observe(a,{childList:!0,subtree:!0}),this.overflowActionsDisabled||null===(i=this.resizeObserver)||void 0===i||i.observe(a),this.conditionallyOverflowActions(),f(this)}disconnectedCallback(){var t,i;null===(t=this.mutationObserver)||void 0===t||t.disconnect(),null===(i=this.resizeObserver)||void 0===i||i.disconnect(),x(this)}async overflowActions(){this.resize({width:this.el.clientWidth,height:this.el.clientHeight})}async setFocus(t){var i;"expand-toggle"!==t?null===(i=this.el)||void 0===i||i.focus():await p(this.expandToggleEl)}renderBottomActionGroup(){const{expanded:t,expandDisabled:i,intlExpand:o,intlCollapse:e,el:n,position:r,toggleExpand:s,scale:l,layout:c}=this,h=m(n,"expand-tooltip"),p=i?null:a(d,{el:n,expanded:t,intlCollapse:e||"Collapse",intlExpand:o||"Expand",position:r,ref:this.setExpandToggleRef,scale:l,toggle:s,tooltip:h});return m(n,"bottom-actions")||p?a("calcite-action-group",{class:"action-group--bottom",layout:c,scale:l},a("slot",{name:"bottom-actions"}),a("slot",{name:"expand-tooltip"}),p):null}render(){return a(o,{onCalciteActionMenuOpenChange:this.actionMenuOpenChangeHandler},a("slot",null),this.renderBottomActionGroup())}get el(){return e(this)}static get watchers(){return{expandDisabled:["expandHandler"],expanded:["expandedHandler"],overflowActionsDisabled:["overflowDisabledHandler"]}}};g.style="@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:host{box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{pointer-events:auto;display:inline-flex;align-self:stretch;background:transparent;--calcite-action-bar-expanded-max-width:auto}:host([layout=vertical]){flex-direction:column}:host([layout=horizontal]){flex-direction:row}:host([layout=vertical][overflow-actions-disabled]){overflow-y:auto}:host([layout=horizontal][overflow-actions-disabled]){overflow-x:auto}:host([layout=vertical][expanded]){max-inline-size:var(--calcite-action-bar-expanded-max-width)}::slotted(calcite-action-group){border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3)}:host([layout=horizontal]) ::slotted(calcite-action-group){border-width:0px;border-inline-end-width:1px;border-style:solid}::slotted(calcite-action-group:last-child){border-block-end-width:0px;border-inline-end-width:0px}.action-group--bottom{flex-grow:1;justify-content:flex-end;padding-block-end:0px;padding-inline-end:0px}";export{g as calcite_action_bar}
|