-
Notifications
You must be signed in to change notification settings - Fork 0
/
p-2a484b51.entry.js
5 lines (5 loc) · 7.94 KB
/
p-2a484b51.entry.js
1
2
3
4
5
/*!
* Built by BASIS
* Copyright BASIS International Ltd.
*/
import{r,c as t,d as a,h as e,H as d,g as o}from"./p-00e3df8e.js";import"./p-384ad3a0.js";import{t as i}from"./p-dc076e70.js";import{h as c}from"./p-3e9fe89f.js";const s=class{constructor(a){r(this,a),this.closedEvent=t(this,"dwc-drawer-closed",7),this.openedEvent=t(this,"dwc-drawer-opened",7),this.$lastActiveElement=null,this.autofocus=!1,this.contained=!1,this.footerVisible=!0,this.headerVisible=!0,this.label="Drawer",this.opened=!1,this.placement="left"}onOpenedChanged(){this.opened?this.doOpen():this.doClose()}connectedCallback(){this.handleInternalCloseClick=this.handleInternalCloseClick.bind(this)}componentDidLoad(){this.opened&&this.doOpen()}handleClick(r){r.target.closest("[data-drawer-close]")&&(r.preventDefault(),this.opened=!1)}async open(){this.opened=!0}async close(){this.opened=!1}doOpen(){this.contained||(this.$lastActiveElement=i(document.activeElement),this.$focusTrap&&this.autofocus&&a((()=>{requestAnimationFrame((()=>{const r=this.$focusTrap.getFocusableElements().filter((r=>{var t,a;if(r.closest('[slot="header-actions"]'))return!1;const e=r.getRootNode();return!(null===(t=e.host)||void 0===t?void 0:t.closest('[slot="header-actions"]'))&&!(null===(a=e.host)||void 0===a?void 0:a.closest('[part="header-actions"]'))}));if(r.length>0)try{r[0].focus(),r[0].setFocus()}catch(r){}}))}))),this.openedEvent.emit()}doClose(){if(!this.contained&&(this.el.tabIndex=-1,null!=this.$lastActiveElement)){this.$lastActiveElement.focus();try{this.$lastActiveElement.setFocus()}catch(r){}this.$lastActiveElement=null}this.closedEvent.emit()}handleInternalCloseClick(){this.opened=!1}render(){return e(d,{key:"e92e90ab7533d077a6a44fd382dc50c671394bee",class:c({"bbj-opened":this.opened})},e("focus-trap",{key:"90976bb0dea42299d8b0f19979428a66d46d7fdc",ref:r=>this.$focusTrap=r},e("dwc-backdrop",{key:"9128665c5ab7e13521e0959f38914de87d1a0a5a",part:"backdrop",visible:this.opened,onClick:this.handleInternalCloseClick}),e("div",{key:"5e6065ae06b20c38d67e0b29b9a1fda903a4c39f",part:"control",role:"dialog","aria-modal":!this.contained,"aria-hidden":this.opened?"false":"true","aria-label":this.label},this.headerVisible&&e("header",{key:"def662cab763c8de43a193d2a2fdd195d171e7b0",part:"header"},e("slot",{key:"33ff08070f34aed2b6c4ed26a5728d1ad0d6d0b0",name:"title"},e("div",{key:"e8add7b3db61aed5b6b5a6027310828710b32b91",part:"title",innerHTML:this.label.length>0?this.label:String.fromCharCode(65279)})),e("div",{key:"3967a467ab92581e63d01ddbabd5cc6ed4cd2935",part:"header-actions"},e("slot",{key:"1d5cff570591b44c6483bc1f7e4d7af895bfec89",name:"header-actions"}),e("dwc-icon-button",{key:"746decbfb3a87766fd3927073e65e0977d2b15f6",part:"close-button",pool:"dwc",name:"icon-x",onClick:this.handleInternalCloseClick}))),e("section",{key:"5aa15eadb3c2b4b6a9273e1ce91af2c7e14bd17f",part:"body"},e("slot",{key:"83f34a077d8d9f98dc4093ad4571ee434538c985"})),this.footerVisible&&e("footer",{key:"a399dff4f14f7ff6149d6e04246021d23897c1c4",part:"footer"},e("slot",{key:"9bc8ed37173c93fefef6e060d916f534cd010981",name:"footer"})))))}get el(){return o(this)}static get watchers(){return{opened:["onOpenedChanged"]}}};s.style="@media (prefers-reduced-motion: reduce){*,::before,::after{animation-delay:-1ms !important;animation-duration:1ms !important;animation-iteration-count:1 !important;background-attachment:initial !important;scroll-behavior:auto !important;transition-delay:0s !important;transition-duration:0s !important}}:host{box-sizing:border-box;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;position:relative;-webkit-tap-highlight-color:transparent;text-size-adjust:100%}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{--_dwc-drawer-size:var(--dwc-drawer-size, 25em);--_dwc-drawer-max-size:var(--dwc-drawer-max-size, 90%);--_dwc-drawer-max-width:var(--dwc-drawer-max-width, 576px);--_dwc-drawer-border:var(--dwc-drawer-border, var(--dwc-border-width) var(--dwc-border-style) var(--dwc-color-default));--_dwc-drawer-header-space:var(--dwc-drawer-header-space, var(--dwc-space-m));--_dwc-drawer-body-space:var(--dwc-drawer-body-space, var(--dwc-space-m));--_dwc-drawer-footer-space:var(--dwc-drawer-footer-space, var(--dwc-space-m));z-index:var(--dwc-backdrop-zindex, var(--dwc-zindex-h0))}:host([opened]){contain:strict;inset:0;position:fixed}[part=backdrop]{cursor:var(--dwc-cursor-click)}[part=control]{background:var(--dwc-drawer-background, var(--dwc-surface-3));box-sizing:border-box;display:flex;flex-direction:column;height:100%;justify-content:inherit;max-width:var(--_dwc-drawer-max-size);overflow:auto;overscroll-behavior:contain;position:fixed;touch-action:none;transform:translateX(-100%);transition:transform var(--dwc-transition), box-shadow var(--dwc-transition);width:var(--_dwc-drawer-size);z-index:var(--dwc-backdrop-zindex, var(--dwc-zindex-h0))}:host([opened]) [part=control]{box-shadow:var(--dwc-drawer-shadow, var(--dwc-shadow-xl));touch-action:manipulation;transform:translateX(0%)}:host([placement=left]) [part=control]{border-right:var(--_dwc-drawer-border);bottom:var(--dwc-drawer-bottom, 0);left:var(--dwc-drawer-left, 0);padding-left:env(safe-area-inset-left);right:var(--dwc-drawer-right, auto);top:var(--dwc-drawer-top, 0)}:host([placement=right]) [part=control]{border-left:var(--_dwc-drawer-border);left:var(--dwc-drawer-left, auto);padding-right:env(safe-area-inset-right);right:var(--dwc-drawer-right, 0);top:var(--dwc-drawer-top, 0);transform:translateX(100%)}:host([opened][placement=right]) [part=control]{transform:translateX(0%)}:host([placement=top]) [part=control],:host([placement=top-center]) [part=control]{border-bottom:var(--_dwc-drawer-border);bottom:var(--dwc-drawer-bottom, auto);height:var(--_dwc-drawer-size);left:0;max-height:var(--_dwc-drawer-max-size);max-width:100%;padding-top:env(safe-area-inset-top);right:var(--dwc-drawer-right, 0);top:var(--dwc-drawer-top, 0);transform:translateY(-100%);width:100%}:host([opened][placement=top]) [part=control],:host([opened][placement=top-center]) [part=control]{transform:translateY(0%)}:host([placement=bottom]) [part=control],:host([placement=bottom-center]) [part=control]{border-top:var(--_dwc-drawer-border);bottom:var(--dwc-drawer-bottom, 0);height:var(--_dwc-drawer-size);left:var(--dwc-drawer-left, 0);max-height:var(--_dwc-drawer-max-size);max-width:100%;padding-bottom:env(safe-area-inset-bottom);right:var(--dwc-drawer-right, 0);top:var(--dwc-drawer-top, auto);transform:translateY(100%);width:100%}:host([opened][placement=bottom]) [part=control],:host([opened][placement=bottom-center]) [part=control]{transform:translateY(0%)}:host([placement=top-center]) [part=control],:host([placement=bottom-center]) [part=control]{margin-left:auto;margin-right:auto;max-width:var(--_dwc-drawer-max-width)}:host([placement=top-center]) [part=control]{border-bottom-left-radius:var(--dwc-drawer-border-radius, var(--dwc-border-radius));border-bottom-right-radius:var(--dwc-drawer-border-radius, var(--dwc-border-radius))}:host([placement=bottom-center]) [part=control]{border-top-left-radius:var(--dwc-drawer-border-radius, var(--dwc-border-radius));border-top-right-radius:var(--dwc-drawer-border-radius, var(--dwc-border-radius))}[part=header]{align-items:center;border-bottom:var(--_dwc-drawer-border);display:flex}[part=title],[part=header] ::slotted([slot=title]),[part=header] ::slotted([slot=drawer-title]){flex:1 1 auto;font:inherit;font-size:var(--dwc-font-size-xl);font-weight:var(--dwc-font-weight-semibold);margin:0;padding:var(--_dwc-drawer-header-space)}[part=header-actions]{display:flex;flex-shrink:0;flex-wrap:wrap;gap:var(--dwc-space-xs);justify-content:end;padding:0 var(--_dwc-drawer-header-space)}[part=header-actions] dwc-icon-button,[part=header-actions] ::slotted(dwc-icon-button){--dwc-icon-size:var(--dwc-font-size-xl);align-items:center;display:flex;flex:0 0 auto}[part=body]{display:block;flex:1 1 auto;overflow:auto;-webkit-overflow-scrolling:touch;padding:var(--_dwc-drawer-body-space)}[part=footer]{padding:var(--_dwc-drawer-footer-space);text-align:right}";export{s as dwc_drawer}