123456 |
- var __awaiter=this&&this.__awaiter||function(e,t,n,i){function a(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function o(e){try{c(i.next(e))}catch(e){r(e)}}function l(e){try{c(i["throw"](e))}catch(e){r(e)}}function c(e){e.done?n(e.value):a(e.value).then(o,l)}c((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,a,r,o;return o={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function l(e){return function(t){return c([e,t])}}function c(o){if(i)throw new TypeError("Generator is already executing.");while(n)try{if(i=1,a&&(r=o[0]&2?a["return"]:o[0]?a["throw"]||((r=a["return"])&&r.call(a),0):a.next)&&!(r=r.call(a,o[1])).done)return r;if(a=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:n.label++;return{value:o[1],done:false};case 5:n.label++;a=o[1];o=[0];continue;case 7:o=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){n.label=o[1];break}if(o[0]===6&&n.label<r[1]){n.label=r[1];r=o;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(o);break}if(r[2])n.ops.pop();n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e];a=0}finally{i=r=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};
- /*!
- * 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.82
- */import{r as registerInstance,c as createEvent,h,F as Fragment,g as getElement}from"./index-8ece2564.js";import{a as getElementDir,g as getSlotted,t as toAriaBoolean}from"./dom-da697a3f.js";import{H as Heading}from"./Heading-8d613e81.js";import{S as SLOTS$1}from"./resources-3c30f589.js";import{c as connectConditionalSlotComponent,d as disconnectConditionalSlotComponent}from"./conditionalSlot-203be745.js";import{u as updateHostInteraction}from"./interactive-cb5bf285.js";import{c as createObserver}from"./observers-b198f831.js";import"./guid-b4461004.js";var CSS={backButton:"back-button",container:"container",header:"header",heading:"heading",summary:"summary",headerContent:"header-content",headerActions:"header-actions",headerActionsEnd:"header-actions--end",headerActionsStart:"header-actions--start",contentWrapper:"content-wrapper",contentContainer:"content-container",contentHeight:"content-height",fabContainer:"fab-container",footer:"footer",menuContainer:"menu-container",menuButton:"menu-button",menu:"menu",menuOpen:"menu--open"};var ICONS={close:"x",menu:"ellipsis",backLeft:"chevron-left",backRight:"chevron-right"};var SLOTS={headerActionsStart:"header-actions-start",headerActionsEnd:"header-actions-end",headerMenuActions:"header-menu-actions",headerContent:"header-content",fab:"fab",footer:"footer",footerActions:"footer-actions"};var TEXT={back:"Back",close:"Close",open:"Open",options:"Options"};var HEADING_LEVEL=3;var panelCss="@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 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;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:host{-webkit-box-sizing:border-box;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 *{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{position:relative;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;overflow:hidden;--calcite-min-header-height:calc(var(--calcite-icon-size) * 3);--calcite-panel-max-height:unset;--calcite-panel-width:100%;--calcite-panel-min-width:unset;--calcite-panel-max-width:unset}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.header{margin:0px;display:-ms-flexbox;display:flex;-ms-flex-line-pack:justify;align-content:space-between;-ms-flex-align:center;align-items:center;fill:var(--calcite-ui-text-2);color:var(--calcite-ui-text-2)}.heading{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}.header .heading{-ms-flex:1 1 auto;flex:1 1 auto;padding:0.5rem}h1.heading{font-size:var(--calcite-font-size-2);line-height:1.5rem}h2.heading{font-size:var(--calcite-font-size-1);line-height:1.5rem}h3.heading{font-size:var(--calcite-font-size-0);line-height:1.25rem}h4.heading,h5.heading{font-size:var(--calcite-font-size--1);line-height:1rem}.container{margin:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-background);padding:0px;max-height:var(--calcite-panel-max-height);width:var(--calcite-panel-width);max-width:var(--calcite-panel-max-width);min-width:var(--calcite-panel-min-width);-webkit-transition:max-height var(--calcite-animation-timing), width var(--calcite-animation-timing);transition:max-height var(--calcite-animation-timing), width var(--calcite-animation-timing)}:host([height-scale=s]){--calcite-panel-max-height:40vh}:host([height-scale=m]){--calcite-panel-max-height:60vh}:host([height-scale=l]){--calcite-panel-max-height:80vh}:host([width-scale=s]){--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 12vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 300px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 150px)}:host([width-scale=m]){--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 20vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 420px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 240px)}:host([width-scale=l]){--calcite-panel-width:calc(var(--calcite-panel-width-multiplier) * 45vw);--calcite-panel-max-width:calc(var(--calcite-panel-width-multiplier) * 680px);--calcite-panel-min-width:calc(var(--calcite-panel-width-multiplier) * 340px)}.container[hidden]{display:none}:host([loading]) .container,:host([disabled]) .container{position:relative}.header{border-bottom:1px solid;position:-webkit-sticky;position:sticky;top:0px;width:100%;-ms-flex-align:stretch;align-items:stretch;-ms-flex-pack:start;justify-content:flex-start;background-color:var(--calcite-ui-foreground-1);border-bottom-color:var(--calcite-ui-border-3);-ms-flex:0 0 auto;flex:0 0 auto}.header-content{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.875rem;padding-bottom:0.875rem;-webkit-margin-end:auto;margin-inline-end:auto}.header-content .heading,.header-content .summary{display:block;overflow-wrap:break-word;padding:0px}.header-content .heading{margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0.25rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;font-weight:var(--calcite-font-weight-medium)}.header-content .heading:only-child{margin-bottom:0px}.header-content .summary{font-size:var(--calcite-font-size--1);line-height:1rem;color:var(--calcite-ui-text-2)}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-ui-border-3);border-inline-end-width:1px}.header-actions{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch}.header-actions--end,.menu-container:only-child{-webkit-margin-start:auto;margin-inline-start:auto}.menu-button{position:relative;height:100%;-ms-flex:0 1 auto;flex:0 1 auto;-ms-flex-item-align:stretch;align-self:stretch}.menu{min-width:10rem;-ms-flex-flow:column nowrap;flex-flow:column nowrap}.content-wrapper{overflow:auto}.content-height{height:100%}.content-container{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:nowrap;flex-wrap:nowrap;-ms-flex-align:stretch;align-items:stretch;background-color:var(--calcite-ui-background)}.footer{border-top:1px solid;position:-webkit-sticky;position:sticky;bottom:0px;display:-ms-flexbox;display:flex;width:100%;-ms-flex-pack:space-evenly;justify-content:space-evenly;background-color:var(--calcite-ui-foreground-1);border-top-color:var(--calcite-ui-border-3);-ms-flex:0 0 auto;flex:0 0 auto;min-height:3rem;padding:0.5rem}.fab-container{position:-webkit-sticky;position:sticky;bottom:0px;left:0px;right:0px;margin-top:0px;margin-bottom:0px;margin-left:auto;margin-right:auto;display:block;padding:0.5rem;width:-moz-fit-content;width:-webkit-fit-content;width:fit-content}";var Panel=function(){function e(e){var t=this;registerInstance(this,e);this.calcitePanelDismiss=createEvent(this,"calcitePanelDismiss",7);this.calcitePanelDismissedChange=createEvent(this,"calcitePanelDismissedChange",7);this.calcitePanelScroll=createEvent(this,"calcitePanelScroll",7);this.calcitePanelBackClick=createEvent(this,"calcitePanelBackClick",7);this.dismissed=false;this.disabled=false;this.dismissible=false;this.showBackButton=false;this.loading=false;this.menuOpen=false;this.resizeObserver=createObserver("resize",(function(){return t.resizeHandler()}));this.resizeHandler=function(){var e=t.panelScrollEl;if(!e||typeof e.scrollHeight!=="number"||typeof e.offsetHeight!=="number"){return}e.tabIndex=e.scrollHeight>e.offsetHeight?0:-1};this.setContainerRef=function(e){t.containerEl=e};this.setDismissRef=function(e){t.dismissButtonEl=e};this.setBackRef=function(e){t.backButtonEl=e};this.panelKeyDownHandler=function(e){if(e.key==="Escape"){t.dismiss()}};this.dismiss=function(){t.dismissed=true;t.calcitePanelDismiss.emit()};this.panelScrollHandler=function(){t.calcitePanelScroll.emit()};this.backButtonClick=function(){t.calcitePanelBackClick.emit()};this.setPanelScrollEl=function(e){var n,i;t.panelScrollEl=e;(n=t.resizeObserver)===null||n===void 0?void 0:n.disconnect();if(e){(i=t.resizeObserver)===null||i===void 0?void 0:i.observe(e);t.resizeHandler()}}}e.prototype.dismissedHandler=function(){this.calcitePanelDismissedChange.emit()};e.prototype.componentDidRender=function(){updateHostInteraction(this)};e.prototype.connectedCallback=function(){connectConditionalSlotComponent(this)};e.prototype.disconnectedCallback=function(){var e;disconnectConditionalSlotComponent(this);(e=this.resizeObserver)===null||e===void 0?void 0:e.disconnect()};e.prototype.setFocus=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i;return __generator(this,(function(a){if(e==="dismiss-button"){(t=this.dismissButtonEl)===null||t===void 0?void 0:t.setFocus();return[2]}if(e==="back-button"){(n=this.backButtonEl)===null||n===void 0?void 0:n.setFocus();return[2]}(i=this.containerEl)===null||i===void 0?void 0:i.focus();return[2]}))}))};e.prototype.scrollContentTo=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){(t=this.panelScrollEl)===null||t===void 0?void 0:t.scrollTo(e);return[2]}))}))};e.prototype.renderBackButton=function(){var e=this.el;var t=getElementDir(e)==="rtl";var n=this,i=n.showBackButton,a=n.intlBack,r=n.backButtonClick;var o=a||TEXT.back;var l=t?ICONS.backRight:ICONS.backLeft;return i?h("calcite-action",{"aria-label":o,class:CSS.backButton,icon:l,key:"back-button",onClick:r,ref:this.setBackRef,scale:"s",slot:SLOTS.headerActionsStart,text:o}):null};e.prototype.renderHeaderContent=function(){var e=this,t=e.heading,n=e.headingLevel,i=e.summary;var a=t?h(Heading,{class:CSS.heading,level:n||HEADING_LEVEL},t):null;var r=i?h("span",{class:CSS.summary},i):null;return a||r?h("div",{class:CSS.headerContent,key:"header-content"},a,r):null};e.prototype.renderHeaderSlottedContent=function(){return h("div",{class:CSS.headerContent,key:"slotted-header-content"},h("slot",{name:SLOTS.headerContent}))};e.prototype.renderHeaderStartActions=function(){var e;var t=this.el;var n=getSlotted(t,SLOTS.headerActionsStart);return n?h("div",{class:(e={},e[CSS.headerActionsStart]=true,e[CSS.headerActions]=true,e),key:"header-actions-start"},h("slot",{name:SLOTS.headerActionsStart})):null};e.prototype.renderHeaderActionsEnd=function(){var e;var t=this,n=t.dismiss,i=t.dismissible,a=t.el,r=t.intlClose;var o=r||TEXT.close;var l=i?h("calcite-action",{"aria-label":o,icon:ICONS.close,onClick:n,ref:this.setDismissRef,text:o}):null;var c=h("slot",{name:SLOTS.headerActionsEnd});var s=getSlotted(a,SLOTS.headerActionsEnd);return s||l?h("div",{class:(e={},e[CSS.headerActionsEnd]=true,e[CSS.headerActions]=true,e),key:"header-actions-end"},c,l):null};e.prototype.renderMenu=function(){var e=this,t=e.el,n=e.intlOptions,i=e.menuOpen;var a=getSlotted(t,SLOTS.headerMenuActions);return a?h("calcite-action-menu",{flipPlacements:["top","bottom"],key:"menu",label:n||TEXT.options,open:i,placement:"bottom-end"},h("calcite-action",{icon:ICONS.menu,slot:SLOTS$1.trigger,text:n||TEXT.options}),h("slot",{name:SLOTS.headerMenuActions})):null};e.prototype.renderHeaderNode=function(){var e=this,t=e.el,n=e.showBackButton;var i=this.renderBackButton();var a=getSlotted(t,SLOTS.headerContent);var r=a?this.renderHeaderSlottedContent():this.renderHeaderContent();var o=this.renderHeaderStartActions();var l=this.renderHeaderActionsEnd();var c=this.renderMenu();return o||r||l||c||n?h("header",{class:CSS.header},i,o,r,l,c):null};e.prototype.renderFooterNode=function(){var e=this.el;var t=getSlotted(e,SLOTS.footer);var n=getSlotted(e,SLOTS.footerActions);return t||n?h("footer",{class:CSS.footer,key:"footer"},t?h("slot",{key:"footer-slot",name:SLOTS.footer}):null,n?h("slot",{key:"footer-actions-slot",name:SLOTS.footerActions}):null):null};e.prototype.renderContent=function(){var e,t;var n=this.el;var i=getSlotted(n,SLOTS.fab);var a=h("slot",{key:"default-slot"});var r="content-wrapper";return i?h("div",{class:(e={},e[CSS.contentWrapper]=true,e[CSS.contentHeight]=true,e),key:r,onScroll:this.panelScrollHandler,ref:this.setPanelScrollEl},h("section",{class:CSS.contentContainer},a),this.renderFab()):h("section",{class:(t={},t[CSS.contentWrapper]=true,t[CSS.contentContainer]=true,t),key:r,onScroll:this.panelScrollHandler,ref:this.setPanelScrollEl},a)};e.prototype.renderFab=function(){return h("div",{class:CSS.fabContainer},h("slot",{name:SLOTS.fab}))};e.prototype.render=function(){var e=this,t=e.dismissed,n=e.dismissible,i=e.loading,a=e.panelKeyDownHandler;var r=h("article",{"aria-busy":toAriaBoolean(i),class:CSS.container,hidden:n&&t,onKeyDown:a,ref:this.setContainerRef,tabIndex:n?0:-1},this.renderHeaderNode(),this.renderContent(),this.renderFooterNode());return h(Fragment,null,i?h("calcite-scrim",{loading:i}):null,r)};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{dismissed:["dismissedHandler"]}},enumerable:false,configurable:true});return e}();Panel.style=panelCss;export{Panel as calcite_panel};
|