Files
AdminGit 935b9cf92b V5.0.0 //
-> Refonte du système de GESTION DES ROULEMENTS de matériels roulants
-> Cartographie Infra + Widget
2026-10-04 23:47:21 +02:00

2 lines
6.2 KiB
JavaScript

import{r as a,c as t,h as s,H as e,g as o}from"./p-32e583ea.js";import{i,a as d}from"./p-fb2751c2.js";import{i as c,a as l,s as n,n as r}from"./p-52d77e1f.js";const h="wcs-modal{--wcs-modal-backdrop-color:var(--wcs-semantic-color-background-backdrop);--wcs-modal-max-height:80%;--wcs-modal-background-color:var(--wcs-semantic-color-background-surface-primary);--wcs-modal-border-radius:var(--wcs-semantic-border-radius-base);--wcs-modal-padding:calc(3 * var(--wcs-semantic-spacing-base));--wcs-modal-border-width:var(--wcs-semantic-border-width-default);--wcs-modal-border-color:var(--wcs-semantic-color-border-secondary);--wcs-modal-title-margin-bottom:var(--wcs-semantic-spacing-large);--wcs-modal-title-font-size:var(--wcs-semantic-font-size-heading-4);--wcs-modal-title-font-weight:var(--wcs-semantic-font-weight-heavy);--wcs-modal-title-line-height:var(--wcs-semantic-font-line-height-medium);--wcs-modal-actions-margin-top:var(--wcs-semantic-spacing-large);--wcs-modal-width-s:288px;--wcs-modal-width-m:480px;--wcs-modal-width-l:864px;--wcs-modal-width-xl:1200px;z-index:999;position:fixed;top:0;bottom:0;left:0;right:0;display:none;background:var(--wcs-modal-backdrop-color)}wcs-modal[show]{display:flex;height:100vh;width:100vw;align-items:center;justify-content:center}wcs-modal[without-backdrop]{background-color:unset}wcs-modal[without-backdrop] .wcs-modal-container{border:solid var(--wcs-modal-border-width) var(--wcs-modal-border-color)}wcs-modal[hide-actions] .wcs-modal-actions{display:none}.wcs-modal-container{max-height:var(--wcs-modal-max-height, 80%);background-color:var(--wcs-modal-background-color);display:grid;grid-template-columns:100%;grid-template-rows:auto 1fr auto;box-sizing:border-box;pointer-events:auto;background-clip:padding-box;border-radius:var(--wcs-modal-border-radius);z-index:20000;padding:var(--wcs-modal-padding);width:var(--wcs-modal-width-m)}.wcs-modal-container[data-size=s]{width:var(--wcs-modal-width-s)}.wcs-modal-container[data-size=m]{width:var(--wcs-modal-width-m)}.wcs-modal-container[data-size=l]{width:var(--wcs-modal-width-l)}.wcs-modal-container[data-size=xl]{width:var(--wcs-modal-width-xl)}.wcs-modal-header{margin-bottom:var(--wcs-modal-title-margin-bottom);display:flex;align-items:center;justify-content:space-between}.wcs-modal-header h1{font-size:var(--wcs-modal-title-font-size);font-weight:var(--wcs-modal-title-font-weight);line-height:var(--wcs-modal-title-line-height);margin:0}.wcs-modal-content{overflow-y:var(--wcs-modal-overflow-y, auto)}.wcs-modal-actions{margin-top:var(--wcs-modal-actions-margin-top);display:flex;justify-content:flex-end}";const m=h;const w=[];const b=class{constructor(s){a(this,s);this.wcsDialogClosed=t(this,"wcsDialogClosed",7);this.inheritedAttributes={};this.modalId=f++;this.showAttributeChangedMarker=false;this.hasBeenClosedBefore=false;this.withoutBackdrop=false;this.show=false;this.showCloseButton=false;this.closeButtonAriaLabel="Fermer";this.size="m";this.hideActions=false;this.modalTriggerControlsId=undefined;this.initialFocusElementId=undefined;this.disableAutoFocus=false}componentWillLoad(){if(!this.modalTriggerControlsId){console.warn("wcs-modal: You must provide the modal-trigger-controls-id attribute to the modal to make it to work properly")}this.inheritedAttributes=Object.assign(Object.assign({},c(this.el)),l(this.el,w))}componentDidLoad(){this.updateFocusableElements()}componentDidRender(){var a;this.updateFocusableElements();if(this.showAttributeChangedMarker){this.showAttributeChangedMarker=false;if(this.disableAutoFocus){return}if(!this.initialFocusElementId){(a=this.firstFocusableElement)===null||a===void 0?void 0:a.focus()}else{const a=document.getElementById(this.initialFocusElementId);if(!a){console.warn(`wcs-modal: Unable to focus element - ID '${this.initialFocusElementId}' not found in DOM`)}a===null||a===void 0?void 0:a.focus()}}}async setAriaAttribute(a,t){n(this.nativeDivDialog,a,t)}onShowChange(){if(this.show){this.hasBeenClosedBefore=false;this.showAttributeChangedMarker=true}else{if(this.hasBeenClosedBefore){return}this.hasBeenClosedBefore=true;if(this.modalTriggerControlsId){const a=document.getElementById(this.modalTriggerControlsId);if(!a){console.warn(`wcs-modal: Element with id '${this.modalTriggerControlsId}' could not be found`)}a===null||a===void 0?void 0:a.focus()}}}updateFocusableElements(){const a=Array.from(this.el.querySelectorAll("*")).filter((a=>i(a)));this.firstFocusableElement=a.length>0&&a[0];this.lastFocusableElement=a.length>0&&a[a.length-1]}close(){if(this.show){this.show=false;this.wcsDialogClosed.emit()}}onKeyDown(a){if(this.show&&this.showCloseButton&&a.key==="Escape"){this.close()}if(this.show){if(r(a)){this.updateFocusableElements();const t=this.firstFocusableElement;const s=this.lastFocusableElement;if(a.shiftKey&&d(t)){a.preventDefault();s.focus()}else if(!a.shiftKey&&d(s)){a.preventDefault();t.focus()}}}}onCloseButtonClick(a){this.close()}handleSlotContentChange(){this.updateFocusableElements()}render(){const a=`wcs-modal-title-${this.modalId}`;return s(e,{key:"e609fe2024b73cab0bed97c0d3b7012d8deba893"},s("div",Object.assign({key:"23007c4ad4971263f7fd99d0e594216cd112f6ea",class:"wcs-modal-container","data-size":this.size,"aria-modal":"true",role:"dialog","aria-labelledby":a,ref:a=>this.nativeDivDialog=a},this.inheritedAttributes),s("div",{key:"bc3e2ead8e3e73da31882c5e87cde2780d9ef2f9",class:"wcs-modal-header"},s("h1",{key:"87561fc92b0990d00e06463afc111e9bdeab6f20",id:a},s("slot",{key:"dbf6d932257e7a264206ddf7caea8a80e4b2b069",name:"header"})),this.showCloseButton&&s("wcs-button",{key:"97036ea40d111c5ac737b1e3f789571cd524cb2d",shape:"round",mode:"clear",id:"wcs-modal-close-button","aria-label":this.closeButtonAriaLabel,onClick:a=>this.onCloseButtonClick(a)},s("wcs-mat-icon",{key:"24d6b531e788c2760c66804df96037714c9f854b",icon:"close"}))),s("div",{key:"34d9ddf3c4527395864a238f329d7b499eb9791b",class:"wcs-modal-content"},s("slot",{key:"5bbd76fc7de9bc6f5aaec7257e7c73995d3e1447",onSlotchange:()=>this.handleSlotContentChange()})),s("div",{key:"7c332e9d1c1b19b65fabb6f52bc14ab0ed9f4803",class:"wcs-modal-actions"},s("slot",{key:"4c44f2337893ba9e8c852a1b8b16beab9da87e4e",name:"actions"}))))}get el(){return o(this)}static get watchers(){return{show:["onShowChange"]}}};let f=0;b.style=m;export{b as wcs_modal};
//# sourceMappingURL=p-4e2d6227.entry.js.map