@maggioli-design-system/mds-modal 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/cjs/mds-modal.cjs.entry.js +63 -35
  2. package/dist/collection/common/keyboard-manager.js +40 -0
  3. package/dist/collection/components/mds-modal/mds-modal.css +164 -23
  4. package/dist/collection/components/mds-modal/mds-modal.js +22 -34
  5. package/dist/collection/dictionary/typography.js +5 -1
  6. package/dist/components/mds-modal.js +63 -35
  7. package/dist/esm/mds-modal.entry.js +63 -35
  8. package/dist/esm-es5/mds-modal.entry.js +1 -1
  9. package/dist/mds-modal/mds-modal.esm.js +1 -1
  10. package/dist/mds-modal/p-2a5d50d2.entry.js +1 -0
  11. package/dist/mds-modal/p-64ab5c19.system.entry.js +1 -0
  12. package/dist/mds-modal/p-f856db3e.system.js +1 -1
  13. package/dist/stats.json +22 -19
  14. package/dist/types/common/keyboard-manager.d.ts +11 -0
  15. package/dist/types/dictionary/typography.d.ts +2 -1
  16. package/dist/types/types/typography.d.ts +1 -0
  17. package/package.json +2 -2
  18. package/readme.md +2 -2
  19. package/src/common/keyboard-manager.ts +46 -0
  20. package/src/components/mds-modal/mds-modal.css +3 -2
  21. package/src/components/mds-modal/mds-modal.tsx +22 -40
  22. package/src/components/mds-modal/test/mds-modal.e2e.ts +2 -2
  23. package/src/dictionary/typography.ts +9 -3
  24. package/src/fixtures/icons.json +1 -0
  25. package/src/tailwind/components.css +1 -0
  26. package/src/types/typography.ts +4 -0
  27. package/www/build/mds-modal.esm.js +1 -1
  28. package/www/build/p-2a5d50d2.entry.js +1 -0
  29. package/www/build/p-64ab5c19.system.entry.js +1 -0
  30. package/www/build/p-f856db3e.system.js +1 -1
  31. package/dist/mds-modal/p-1a268c3b.system.entry.js +0 -1
  32. package/dist/mds-modal/p-a8cbce5a.entry.js +0 -1
  33. package/www/build/p-1a268c3b.system.entry.js +0 -1
  34. package/www/build/p-a8cbce5a.entry.js +0 -1
@@ -0,0 +1 @@
1
+ System.register(["./p-3aeea0b7.system.js"],(function(t){"use strict";var o,i,e,n,a;return{setters:[function(t){o=t.r;i=t.c;e=t.h;n=t.H;a=t.g}],execute:function(){function r(t){var o,i,e="";if("string"==typeof t||"number"==typeof t)e+=t;else if("object"==typeof t)if(Array.isArray(t))for(o=0;o<t.length;o++)t[o]&&(i=r(t[o]))&&(e&&(e+=" "),e+=i);else for(o in t)t[o]&&(e&&(e+=" "),e+=o);return e}function s(){for(var t,o,i=0,e="";i<arguments.length;)(t=arguments[i++])&&(o=r(t))&&(e&&(e+=" "),e+=o);return e}var l='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"/></svg>';var d=function(){function t(){var t=this;this.elements=[];this.handleClickBehaviorDispatchEvent=function(t){if(t.code==="Space"||t.code==="Enter"||t.code==="NumpadEnter"){t.target.click()}};this.handleEscapeBehaviorDispatchEvent=function(o){if(o.code==="Escape"&&t.escapeCallback){t.escapeCallback()}};this.addElement=function(o,i){if(i===void 0){i="element"}t.elements[i]=o};this.attachClickBehavior=function(o){if(o===void 0){o="element"}if(t.elements[o]){t.elements[o].addEventListener("keydown",t.handleClickBehaviorDispatchEvent)}};this.detachClickBehavior=function(o){if(o===void 0){o="element"}if(t.elements[o]){t.elements[o].removeEventListener("keydown",t.handleClickBehaviorDispatchEvent)}};this.attachEscapeBehavior=function(o){t.escapeCallback=o;if(typeof window!==undefined){window.addEventListener("keydown",t.handleEscapeBehaviorDispatchEvent.bind(t))}};this.detachEscapeBehavior=function(){t.escapeCallback=null;if(typeof window!==undefined){window.removeEventListener("keydown",t.handleEscapeBehaviorDispatchEvent.bind(t))}}}return t}();var c="@tailwind components; .focus-off,.focusable,.focusable-light,.focusable-light-off{-webkit-transition-duration:200ms;transition-duration:200ms;-webkit-transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-timing-function:cubic-bezier(0, 0, 0.2, 1);outline-offset:var(--magma-outline-blur-offset);outline:var(--magma-outline-blur);-webkit-transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform, -webkit-box-shadow, -webkit-transform}.focus-on,.focusable-light:focus-visible,.focusable:focus-visible{--magma-outline-blur-offset:var(--magma-outline-focus-offset);--magma-outline-blur:var(--magma-outline-focus)}.focus-light-on,.focusable-light:focus-visible{--magma-outline-blur:2px solid rgb(var(--tone-neutral))}.svg{display:-ms-flexbox;display:flex}.svg svg{aspect-ratio:1 / 1;height:100%;width:100%}.animate-left,.animate-right{opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}.animate-right-intro,.animate-right-outro{-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}.fixed{position:fixed}.absolute{position:absolute}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.ml-auto{margin-left:auto}.flex{display:-ms-flexbox;display:flex}.w-16{width:4rem}.min-w-0{min-width:0px}.max-w-lg{max-width:32rem}.max-w-xl{max-width:36rem}.items-center{-ms-flex-align:center;align-items:center}.gap-4{gap:1rem}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-tone-neutral-09{--tw-border-opacity:1;border-color:rgba(var(--tone-neutral-09), var(--tw-border-opacity))}.bg-transparent{background-color:transparent}.p-8{padding:2rem}.p-4{padding:1rem}.text-tone-neutral-02{--tw-text-opacity:1;color:rgba(var(--tone-neutral-02), var(--tw-text-opacity))}.text-tone-neutral-04{--tw-text-opacity:1;color:rgba(var(--tone-neutral-04), var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-modal-overlay-color:var(--magma-overlay-color, 0 0 0);--mds-modal-overlay-opacity:var(--magma-overlay-opacity, 0.5);--mds-modal-window-background:rgb(var(--tone-neutral));--mds-modal-window-overflow:auto;--mds-modal-window-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);--mds-modal-z-index:var(--magma-modal-z-index);pointer-events:none;position:fixed;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition-duration:700ms;transition-duration:700ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1);background-color:rgba(var(--mds-modal-overlay-color) / 0);-webkit-perspective:600px;perspective:600px;z-index:var(--z-index, 1000)}:host([position=top]){-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}:host([position=bottom]){-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:center;justify-content:center}:host(.animate-bottom-opened),:host(.animate-center-opened),:host(.animate-left-opened),:host(.animate-right-opened),:host(.animate-top-opened){pointer-events:auto;-webkit-transition-duration:500ms;transition-duration:500ms;background-color:rgba(var(--mds-modal-overlay-color) / var(--mds-modal-overlay-opacity))}.close{position:absolute;top:0px;height:2.25rem;width:2.25rem;-webkit-transform-origin:center;transform-origin:center;cursor:pointer;border-radius:9999px;fill:rgb(var(--tone-neutral-10));font-size:2.25rem;line-height:2.5rem;opacity:0;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);-webkit-transition-property:opacity, outline, outline-offset, -webkit-transform;transition-property:opacity, outline, outline-offset, -webkit-transform;transition-property:opacity, outline, outline-offset, transform;transition-property:opacity, outline, outline-offset, transform, -webkit-transform;-webkit-transform:translate(0, 24px) rotate(90deg);transform:translate(0, 24px) rotate(90deg)}.window{display:grid;height:100%;gap:0px;background-color:var(--mds-modal-window-background);-webkit-box-shadow:var(--mds-modal-window-shadow);box-shadow:var(--mds-modal-window-shadow);grid-template-rows:1fr;max-width:calc(100vw - 80px);overflow:var(--mds-modal-window-overflow)}.window--top{grid-template-rows:auto 1fr}.window--bottom{grid-template-rows:1fr auto}.window--top-bottom{grid-template-rows:auto 1fr auto}:host(.animate-bottom){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-bottom){padding:1rem}}:host(.animate-bottom) .window,:host(.animate-bottom)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-bottom-intro) .window,:host(.animate-bottom-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-bottom-opened.animate-bottom-outro) .window,:host(.animate-bottom-opened.animate-bottom-outro)>::slotted([slot=window]),:host(.animate-bottom-opened) .window,:host(.animate-bottom-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-bottom-outro) .window,:host(.animate-bottom-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}:host(.animate-center){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-center){padding:1rem}}:host(.animate-center) .window,:host(.animate-center)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-center-intro) .window,:host(.animate-center-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-center-opened.animate-center-outro) .window,:host(.animate-center-opened.animate-center-outro)>::slotted([slot=window]),:host(.animate-center-opened) .window,:host(.animate-center-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-center-outro) .window,:host(.animate-center-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}:host(.animate-left){-ms-flex-pack:start;justify-content:flex-start}:host(.animate-left) .window,:host(.animate-left)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-left-intro) .window,:host(.animate-left-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-opened.animate-left-outro) .window,:host(.animate-left-opened.animate-left-outro)>::slotted([slot=window]),:host(.animate-left-opened) .window,:host(.animate-left-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-left-opened) .close,:host(.animate-left-opened.animate-left-outro) .close{opacity:1;-webkit-transform:translate(-24px, 24px) rotate(0);transform:translate(-24px, 24px) rotate(0)}:host(.animate-left-outro) .window,:host(.animate-left-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-outro) .close{-webkit-transform:translate(24px, 24px) rotate(-90deg);transform:translate(24px, 24px) rotate(-90deg)}:host(.animate-left) .close{right:0px;-webkit-transform:translate(36px, 24px) rotate(90deg);transform:translate(36px, 24px) rotate(90deg)}:host(.animate-right){-ms-flex-pack:end;justify-content:flex-end}:host(.animate-right) .window,:host(.animate-right)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-right-intro) .window,:host(.animate-right-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-opened.animate-right-outro) .window,:host(.animate-right-opened.animate-right-outro)>::slotted([slot=window]),:host(.animate-right-opened) .window,:host(.animate-right-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-right-opened) .close,:host(.animate-right-opened.animate-right-outro) .close{opacity:1;-webkit-transform:translate(24px, 24px) rotate(0);transform:translate(24px, 24px) rotate(0)}:host(.animate-right-outro) .window,:host(.animate-right-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-outro) .close{-webkit-transform:translate(-24px, 24px) rotate(90deg);transform:translate(-24px, 24px) rotate(90deg)}:host(.animate-right) .close{left:0px;-webkit-transform:translate(-36px, 24px) rotate(-90deg);transform:translate(-36px, 24px) rotate(-90deg)}:host(.animate-top){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-top){padding:1rem}}:host(.animate-top) .window,:host(.animate-top)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-top-intro) .window,:host(.animate-top-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-top-opened.animate-top-outro) .window,:host(.animate-top-opened.animate-top-outro)>::slotted([slot=window]),:host(.animate-top-opened) .window,:host(.animate-top-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-top-outro) .window,:host(.animate-top-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}@media (max-width: 767px){.mobile\\:w-12{width:3rem}}";var m=t("mds_modal",function(){function t(t){var e=this;o(this,t);this.close=i(this,"close",7);this.window=null;this.top=null;this.bottom=null;this.animationState="intro";this.km=new d;this.componentDidLoad=function(){e.km.addElement(e.host,"host");e.km.addElement(e.host.shadowRoot.querySelector(".close"),"close");e.km.attachEscapeBehavior((function(){return e.close.emit()}));e.km.attachClickBehavior("close")};this.animationName=function(t,o){if(t===void 0){t=null}if(o===void 0){o=null}return"animate-".concat(o!==null?o:e.position).concat(t!==null?"-"+t:"")};this.closeModal=function(t){if(t===void 0){t=null}var o;if(((o=t.target)===null||o===void 0?void 0:o.localName)!=="mds-modal"){return}e.opened=t.target!==t.currentTarget;if(!e.opened){e.close.emit()}};this.stateOpened=undefined;this.opened=undefined;this.position=null}t.prototype.componentWillLoad=function(){this.bottom=this.host.querySelector('[slot="bottom"]')!==null;this.top=this.host.querySelector('[slot="top"]')!==null;this.window=this.host.querySelector('[slot="window"]')!==null;this.stateOpened=this.opened;if(this.window&&this.position===null){this.position="center"}if(this.position===null){this.position="right"}if(this.window){var t=this.host.querySelector('[slot="window"]');t.setAttribute("role","modal")}};t.prototype.componentWillRender=function(){this.animationState=this.opened?"intro":"outro";this.host.classList.add(this.animationName())};t.prototype.componentDidRender=function(){var t=this;this.animationDeelay=window.setTimeout((function(){t.animationState=t.animationState==="intro"?"outro":"intro";t.host.classList.remove(t.animationName(t.animationState==="intro"?"outro":"intro"));t.host.classList.add(t.animationName(t.animationState));window.clearTimeout(t.animationDeelay)}),500)};t.prototype.disconnectedCallback=function(){this.km.detachEscapeBehavior();this.km.detachClickBehavior("close")};t.prototype.positionChange=function(t,o){window.clearTimeout(this.animationDeelay);this.host.classList.remove(this.animationName(null,o));this.host.classList.remove(this.animationName("intro",o));this.host.classList.remove(this.animationName("outro",o))};t.prototype.openedChange=function(t){this.stateOpened=t;window.clearTimeout(this.animationDeelay)};t.prototype.onCloseListener=function(){this.opened=false};t.prototype.render=function(){var t=this;return e(n,{"aria-modal":s(this.opened?"true":"false"),class:s(this.stateOpened&&this.animationName("opened")),onClick:function(o){t.closeModal(o)}},this.window?e("slot",{name:"window"}):e("div",{class:s("window",(this.top||this.bottom)&&"window-".concat(this.top?"-top":"").concat(this.bottom?"-bottom":"")),role:"dialog"},this.top&&e("slot",{name:"top"}),e("slot",null),this.bottom&&e("slot",{name:"bottom"})),!this.window&&e("i",{innerHTML:l,tabindex:"0",onClick:function(o){t.closeModal(o)},class:"svg close focusable-light"}))};Object.defineProperty(t.prototype,"host",{get:function(){return a(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{position:["positionChange"],opened:["openedChange"]}},enumerable:false,configurable:true});return t}());m.style=c}}}));
@@ -1 +1 @@
1
- System.register(["./p-3aeea0b7.system.js"],(function(e,t){"use strict";var n,s;return{setters:[function(t){n=t.p;s=t.b;e("setNonce",t.s)}],execute:function(){var e=function(){var e=t.meta.url;var s={};if(e!==""){s.resourcesUrl=new URL(".",e).href}return n(s)};e().then((function(e){return s([["p-1a268c3b.system",[[1,"mds-modal",{opened:[1540],position:[1537],stateOpened:[32]},[[4,"close","onCloseListener"]]]]]],e)}))}}}));
1
+ System.register(["./p-3aeea0b7.system.js"],(function(e,t){"use strict";var n,s;return{setters:[function(t){n=t.p;s=t.b;e("setNonce",t.s)}],execute:function(){var e=function(){var e=t.meta.url;var s={};if(e!==""){s.resourcesUrl=new URL(".",e).href}return n(s)};e().then((function(e){return s([["p-64ab5c19.system",[[1,"mds-modal",{opened:[1540],position:[1537],stateOpened:[32]},[[4,"close","onCloseListener"]]]]]],e)}))}}}));
package/dist/stats.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2023-02-20T10:24:45",
2
+ "timestamp": "2023-03-02T10:00:51",
3
3
  "compiler": {
4
4
  "name": "node",
5
5
  "version": "18.3.0"
@@ -9,13 +9,14 @@
9
9
  "fsNamespace": "mds-modal",
10
10
  "components": 1,
11
11
  "entries": 1,
12
- "bundles": 66,
12
+ "bundles": 67,
13
13
  "outputs": [
14
14
  {
15
15
  "name": "dist-collection",
16
- "files": 25,
16
+ "files": 26,
17
17
  "generatedFiles": [
18
18
  "./dist/collection/common/aria.js",
19
+ "./dist/collection/common/keyboard-manager.js",
19
20
  "./dist/collection/components/mds-modal/mds-modal.js",
20
21
  "./dist/collection/components/mds-modal/meta/dictionary.js",
21
22
  "./dist/collection/components/mds-modal/meta/types.js",
@@ -76,20 +77,20 @@
76
77
  "./dist/mds-modal/index.esm.js",
77
78
  "./dist/mds-modal/mds-modal.esm.js",
78
79
  "./dist/mds-modal/mds-modal.js",
79
- "./dist/mds-modal/p-1a268c3b.system.entry.js",
80
+ "./dist/mds-modal/p-2a5d50d2.entry.js",
80
81
  "./dist/mds-modal/p-3aeea0b7.system.js",
81
82
  "./dist/mds-modal/p-4fdbb5fc.js",
82
83
  "./dist/mds-modal/p-50ea2036.system.js",
83
- "./dist/mds-modal/p-a8cbce5a.entry.js",
84
+ "./dist/mds-modal/p-64ab5c19.system.entry.js",
84
85
  "./dist/mds-modal/p-f856db3e.system.js",
85
86
  "./www/build/index.esm.js",
86
87
  "./www/build/mds-modal.esm.js",
87
88
  "./www/build/mds-modal.js",
88
- "./www/build/p-1a268c3b.system.entry.js",
89
+ "./www/build/p-2a5d50d2.entry.js",
89
90
  "./www/build/p-3aeea0b7.system.js",
90
91
  "./www/build/p-4fdbb5fc.js",
91
92
  "./www/build/p-50ea2036.system.js",
92
- "./www/build/p-a8cbce5a.entry.js",
93
+ "./www/build/p-64ab5c19.system.entry.js",
93
94
  "./www/build/p-f856db3e.system.js"
94
95
  ]
95
96
  },
@@ -123,12 +124,12 @@
123
124
  "components": [
124
125
  "mds-modal"
125
126
  ],
126
- "bundleId": "p-a8cbce5a",
127
- "fileName": "p-a8cbce5a.entry.js",
127
+ "bundleId": "p-2a5d50d2",
128
+ "fileName": "p-2a5d50d2.entry.js",
128
129
  "imports": [
129
130
  "p-4fdbb5fc.js"
130
131
  ],
131
- "originalByteSize": 20030
132
+ "originalByteSize": 21894
132
133
  }
133
134
  ],
134
135
  "esm": [
@@ -142,7 +143,7 @@
142
143
  "imports": [
143
144
  "index-118e6bec.js"
144
145
  ],
145
- "originalByteSize": 20034
146
+ "originalByteSize": 21898
146
147
  }
147
148
  ],
148
149
  "es5": [
@@ -156,7 +157,7 @@
156
157
  "imports": [
157
158
  "index-118e6bec.js"
158
159
  ],
159
- "originalByteSize": 20034
160
+ "originalByteSize": 21898
160
161
  }
161
162
  ],
162
163
  "system": [
@@ -165,12 +166,12 @@
165
166
  "components": [
166
167
  "mds-modal"
167
168
  ],
168
- "bundleId": "p-1a268c3b.system",
169
- "fileName": "p-1a268c3b.system.entry.js",
169
+ "bundleId": "p-64ab5c19.system",
170
+ "fileName": "p-64ab5c19.system.entry.js",
170
171
  "imports": [
171
172
  "p-3aeea0b7.system.js"
172
173
  ],
173
- "originalByteSize": 20937
174
+ "originalByteSize": 22963
174
175
  }
175
176
  ],
176
177
  "commonjs": [
@@ -184,7 +185,7 @@
184
185
  "imports": [
185
186
  "index-f216518d.js"
186
187
  ],
187
- "originalByteSize": 20111
188
+ "originalByteSize": 21975
188
189
  }
189
190
  ]
190
191
  },
@@ -193,7 +194,7 @@
193
194
  "tag": "mds-modal",
194
195
  "path": "./src/components/mds-modal/mds-modal.js",
195
196
  "source": "./src/components/mds-modal/mds-modal.tsx",
196
- "elementRef": "hostElement",
197
+ "elementRef": "host",
197
198
  "componentClassName": "MdsModal",
198
199
  "assetsDirs": [],
199
200
  "dependencies": [],
@@ -301,7 +302,7 @@
301
302
  "excludeFromCollection": false,
302
303
  "isCollectionDependency": false,
303
304
  "componentClassName": "MdsModal",
304
- "elementRef": "hostElement",
305
+ "elementRef": "host",
305
306
  "encapsulation": "shadow",
306
307
  "shadowDelegatesFocus": false,
307
308
  "properties": [
@@ -505,7 +506,8 @@
505
506
  "onClick",
506
507
  "name",
507
508
  "role",
508
- "innerHTML"
509
+ "innerHTML",
510
+ "tabindex"
509
511
  ],
510
512
  "htmlTagNames": [
511
513
  "slot",
@@ -531,6 +533,7 @@
531
533
  },
532
534
  "sourceGraph": {
533
535
  "./src/common/aria.ts": [],
536
+ "./src/common/keyboard-manager.ts": [],
534
537
  "./src/components/mds-modal/mds-modal.tsx": [],
535
538
  "./src/components/mds-modal/meta/dictionary.ts": [],
536
539
  "./src/components/mds-modal/meta/types.ts": [],
@@ -0,0 +1,11 @@
1
+ export declare class KeyboardManager {
2
+ private escapeCallback;
3
+ private elements;
4
+ private handleClickBehaviorDispatchEvent;
5
+ private handleEscapeBehaviorDispatchEvent;
6
+ addElement: (el: HTMLElement, name?: string) => void;
7
+ attachClickBehavior: (name?: string) => void;
8
+ detachClickBehavior: (name?: string) => void;
9
+ attachEscapeBehavior: (callBack: () => void) => void;
10
+ detachEscapeBehavior: () => void;
11
+ }
@@ -1,9 +1,10 @@
1
1
  declare const typographyDictionary: string[];
2
2
  declare const typographyVariationsDictionary: string[];
3
+ declare const typographyReadingVariationsDictionary: string[];
3
4
  declare const typographyMonoDictionary: string[];
4
5
  declare const typographyTitleDictionary: string[];
5
6
  declare const typographyInfoDictionary: string[];
6
7
  declare const typographyReadDictionary: string[];
7
8
  declare const typographySmallerDictionary: string[];
8
9
  declare const typographyTooltipDictionary: string[];
9
- export { typographyDictionary, typographyVariationsDictionary, typographyMonoDictionary, typographyTitleDictionary, typographyInfoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTooltipDictionary, };
10
+ export { typographyDictionary, typographyInfoDictionary, typographyReadingVariationsDictionary, typographyMonoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTitleDictionary, typographyTooltipDictionary, typographyVariationsDictionary, };
@@ -1,5 +1,6 @@
1
1
  export type TypographyType = 'action' | 'caption' | 'snippet' | 'detail' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'hack' | 'label' | 'option' | 'paragraph' | 'tip';
2
2
  export type TypographyVariants = 'title' | 'info' | 'read' | 'code';
3
+ export type TypographyReadingVariants = 'info' | 'read';
3
4
  export type TypographyTitleType = 'action' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
4
5
  export type TypographyInfoType = 'caption' | 'detail' | 'label' | 'option' | 'paragraph' | 'tip';
5
6
  export type TypographyReadType = 'caption' | 'detail' | 'paragraph';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-modal",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "mds-modal is a web-component from Maggioli Design System Magma, built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScirpt framework you are using.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "test": "stencil test --spec --e2e"
24
24
  },
25
25
  "dependencies": {
26
- "@maggioli-design-system/styles": "^11.1.0",
26
+ "@maggioli-design-system/styles": "^11.2.1",
27
27
  "@stencil/core": "^2.22.2",
28
28
  "clsx": "^1.2.1"
29
29
  },
package/readme.md CHANGED
@@ -27,8 +27,8 @@
27
27
  | `--mds-modal-overlay-color` | Set the overlay color of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`. |
28
28
  | `--mds-modal-overlay-opacity` | Set the overlay color opacity of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`. |
29
29
  | `--mds-modal-window-background` | Set the background color of the window |
30
- | `--mds-modal-window-overflow` | Set the background color of the window |
31
- | `--mds-modal-window-shadow` | Set the oveflow of the window |
30
+ | `--mds-modal-window-overflow` | Set the overflow of the window |
31
+ | `--mds-modal-window-shadow` | Set the box shadow of the window |
32
32
  | `--mds-modal-z-index` | Set the z-index of the window when the component is opened |
33
33
 
34
34
 
@@ -0,0 +1,46 @@
1
+ export class KeyboardManager {
2
+ private escapeCallback: () => void
3
+ private elements = []
4
+
5
+ private handleClickBehaviorDispatchEvent = (event: KeyboardEvent): void => {
6
+ if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
7
+ (event.target as HTMLElement).click()
8
+ }
9
+ }
10
+
11
+ private handleEscapeBehaviorDispatchEvent = (event: KeyboardEvent): void => {
12
+ if (event.code === 'Escape' && this.escapeCallback) {
13
+ this.escapeCallback()
14
+ }
15
+ }
16
+
17
+ addElement = (el: HTMLElement, name = 'element'): void => {
18
+ this.elements[name] = el
19
+ }
20
+
21
+ attachClickBehavior = (name = 'element'): void => {
22
+ if (this.elements[name]) {
23
+ this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent)
24
+ }
25
+ }
26
+
27
+ detachClickBehavior = (name = 'element'): void => {
28
+ if (this.elements[name]) {
29
+ this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent)
30
+ }
31
+ }
32
+
33
+ attachEscapeBehavior = (callBack: () => void): void => {
34
+ this.escapeCallback = callBack
35
+ if (typeof window !== undefined) {
36
+ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this))
37
+ }
38
+ }
39
+
40
+ detachEscapeBehavior = (): void => {
41
+ this.escapeCallback = null
42
+ if (typeof window !== undefined) {
43
+ window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this))
44
+ }
45
+ }
46
+ }
@@ -1,6 +1,6 @@
1
+ @import '../../tailwind/components.css';
1
2
  @tailwind components;
2
3
  @tailwind utilities;
3
- @import '../../tailwind/components.css';
4
4
 
5
5
  /**
6
6
  * @prop --mds-modal-overlay-color: Set the overlay color of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`.
@@ -126,11 +126,12 @@
126
126
  h-9
127
127
  opacity-0
128
128
  origin-center
129
+ rounded-full
129
130
  text-4xl
130
131
  top-0
131
- transition-cosmetic
132
132
  w-9;
133
133
 
134
+ transition-property: opacity, outline, outline-offset, transform;
134
135
  transform: translate(0, 24px) rotate(90deg);
135
136
  }
136
137
 
@@ -2,6 +2,7 @@ import { Component, Element, Event, EventEmitter, Host, h, Listen, Prop, Watch,
2
2
  import clsx from 'clsx'
3
3
  import { ModalPositionType, ModalAnimationStateType } from './meta/types'
4
4
  import miBaselineClose from '@icon/mi/baseline/close.svg'
5
+ import { KeyboardManager } from '@common/keyboard-manager'
5
6
 
6
7
  @Component({
7
8
  tag: 'mds-modal',
@@ -15,8 +16,9 @@ export class MdsModal {
15
16
  private top: boolean = null
16
17
  private bottom: boolean = null
17
18
  private animationState: ModalAnimationStateType = 'intro'
19
+ private km = new KeyboardManager()
18
20
  @State() stateOpened: boolean
19
- @Element() hostElement: HTMLMdsModalElement
21
+ @Element() host: HTMLMdsModalElement
20
22
 
21
23
  /**
22
24
  * Specifies if the modal is opened or not
@@ -29,9 +31,9 @@ export class MdsModal {
29
31
  @Prop({ reflect: true, mutable: true }) position?: ModalPositionType = null
30
32
 
31
33
  componentWillLoad (): void {
32
- this.bottom = this.hostElement.querySelector('[slot="bottom"]') !== null
33
- this.top = this.hostElement.querySelector('[slot="top"]') !== null
34
- this.window = this.hostElement.querySelector('[slot="window"]') !== null
34
+ this.bottom = this.host.querySelector('[slot="bottom"]') !== null
35
+ this.top = this.host.querySelector('[slot="top"]') !== null
36
+ this.window = this.host.querySelector('[slot="window"]') !== null
35
37
  this.stateOpened = this.opened
36
38
 
37
39
  if (this.window && this.position === null) {
@@ -43,34 +45,35 @@ export class MdsModal {
43
45
  }
44
46
 
45
47
  if (this.window) {
46
- const modal = this.hostElement.querySelector('[slot="window"]')
48
+ const modal = this.host.querySelector('[slot="window"]')
47
49
  modal.setAttribute('role', 'modal')
48
50
  }
49
51
  }
50
52
 
51
53
  componentWillRender (): void {
52
54
  this.animationState = this.opened ? 'intro' : 'outro'
53
- this.hostElement.classList.add(this.animationName())
55
+ this.host.classList.add(this.animationName())
54
56
  }
55
57
 
56
58
  componentDidRender (): void {
57
59
  this.animationDeelay = window.setTimeout(() => {
58
60
  this.animationState = this.animationState === 'intro' ? 'outro' : 'intro'
59
- this.hostElement.classList.remove(this.animationName(this.animationState === 'intro' ? 'outro' : 'intro'))
60
- this.hostElement.classList.add(this.animationName(this.animationState))
61
+ this.host.classList.remove(this.animationName(this.animationState === 'intro' ? 'outro' : 'intro'))
62
+ this.host.classList.add(this.animationName(this.animationState))
61
63
  window.clearTimeout(this.animationDeelay)
62
64
  }, 500)
65
+ }
63
66
 
64
- if (this.opened) {
65
- this.addKeyboardEscapeListener()
66
- return
67
- }
68
-
69
- this.removeKeyboardEscapeListener()
67
+ componentDidLoad = (): void => {
68
+ this.km.addElement(this.host, 'host')
69
+ this.km.addElement(this.host.shadowRoot.querySelector('.close'), 'close')
70
+ this.km.attachEscapeBehavior(() => this.close.emit())
71
+ this.km.attachClickBehavior('close')
70
72
  }
71
73
 
72
74
  disconnectedCallback (): void {
73
- this.removeKeyboardEscapeListener()
75
+ this.km.detachEscapeBehavior()
76
+ this.km.detachClickBehavior('close')
74
77
  }
75
78
 
76
79
  private animationName = (customState: string = null, customPosition: string = null): string => {
@@ -80,36 +83,15 @@ export class MdsModal {
80
83
  @Watch('position')
81
84
  positionChange (_newValue: string, oldValue: string): void {
82
85
  window.clearTimeout(this.animationDeelay)
83
- this.hostElement.classList.remove(this.animationName(null, oldValue))
84
- this.hostElement.classList.remove(this.animationName('intro', oldValue))
85
- this.hostElement.classList.remove(this.animationName('outro', oldValue))
86
- }
87
-
88
- private checkKeyboardEscape = (event: KeyboardEvent): void => {
89
- if (event.code === 'Escape') {
90
- this.close.emit()
91
- }
92
- }
93
-
94
- private addKeyboardEscapeListener (): void {
95
- window.addEventListener('keydown', this.checkKeyboardEscape.bind(this))
96
- }
97
-
98
- private removeKeyboardEscapeListener (): void {
99
- window.removeEventListener('keydown', this.checkKeyboardEscape.bind(this))
86
+ this.host.classList.remove(this.animationName(null, oldValue))
87
+ this.host.classList.remove(this.animationName('intro', oldValue))
88
+ this.host.classList.remove(this.animationName('outro', oldValue))
100
89
  }
101
90
 
102
91
  @Watch('opened')
103
92
  openedChange (newValue: boolean): void {
104
93
  this.stateOpened = newValue
105
94
  window.clearTimeout(this.animationDeelay)
106
-
107
- if (newValue) {
108
- this.addKeyboardEscapeListener()
109
- return
110
- }
111
-
112
- this.removeKeyboardEscapeListener()
113
95
  }
114
96
 
115
97
  /**
@@ -149,7 +131,7 @@ export class MdsModal {
149
131
  }
150
132
  </div>
151
133
  }
152
- { !this.window && <i innerHTML={miBaselineClose} class="svg close"/> }
134
+ { !this.window && <i innerHTML={miBaselineClose} tabindex="0" onClick={(e: Event) => { this.closeModal(e) }} class="svg close focusable-light"/> }
153
135
  </Host>
154
136
  )
155
137
  }
@@ -21,7 +21,7 @@ describe('mds-modal', () => {
21
21
  <div class="window" role="dialog">
22
22
  <slot></slot>
23
23
  </div>
24
- <i class="close svg">
24
+ <i class="close focusable-light svg" tabindex="0">
25
25
  <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
26
26
  <path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"></path>
27
27
  </svg>
@@ -41,7 +41,7 @@ describe('mds-modal', () => {
41
41
  <div class="window" role="dialog">
42
42
  <slot></slot>
43
43
  </div>
44
- <i class="close svg">
44
+ <i class="close focusable-light svg" tabindex="0">
45
45
  <svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
46
46
  <path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"></path>
47
47
  </svg>
@@ -23,6 +23,11 @@ const typographyVariationsDictionary = [
23
23
  'code',
24
24
  ]
25
25
 
26
+ const typographyReadingVariationsDictionary = [
27
+ 'info',
28
+ 'read',
29
+ ]
30
+
26
31
  const typographyMonoDictionary = [
27
32
  'snippet',
28
33
  'hack',
@@ -66,11 +71,12 @@ const typographyTooltipDictionary = [
66
71
 
67
72
  export {
68
73
  typographyDictionary,
69
- typographyVariationsDictionary,
70
- typographyMonoDictionary,
71
- typographyTitleDictionary,
72
74
  typographyInfoDictionary,
75
+ typographyReadingVariationsDictionary,
76
+ typographyMonoDictionary,
73
77
  typographyReadDictionary,
74
78
  typographySmallerDictionary,
79
+ typographyTitleDictionary,
75
80
  typographyTooltipDictionary,
81
+ typographyVariationsDictionary,
76
82
  }
@@ -202,6 +202,7 @@
202
202
  "mi/baseline/css",
203
203
  "mi/baseline/description",
204
204
  "mi/baseline/done",
205
+ "mi/baseline/downhill-skiing",
205
206
  "mi/baseline/eco",
206
207
  "mi/baseline/email",
207
208
  "mi/baseline/error",
@@ -1,3 +1,4 @@
1
+ @import '~@maggioli-design-system/styles/dist/tailwind/components.css';
1
2
  @tailwind components;
2
3
 
3
4
  @layer components {
@@ -21,6 +21,10 @@ export type TypographyVariants =
21
21
  | 'read'
22
22
  | 'code'
23
23
 
24
+ export type TypographyReadingVariants =
25
+ | 'info'
26
+ | 'read'
27
+
24
28
  export type TypographyTitleType =
25
29
  | 'action'
26
30
  | 'h1'
@@ -1 +1 @@
1
- import{p as e,b as o}from"./p-4fdbb5fc.js";export{s as setNonce}from"./p-4fdbb5fc.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-a8cbce5a",[[1,"mds-modal",{opened:[1540],position:[1537],stateOpened:[32]},[[4,"close","onCloseListener"]]]]]],e)));
1
+ import{p as e,b as o}from"./p-4fdbb5fc.js";export{s as setNonce}from"./p-4fdbb5fc.js";(()=>{const o=import.meta.url,s={};return""!==o&&(s.resourcesUrl=new URL(".",o).href),e(s)})().then((e=>o([["p-2a5d50d2",[[1,"mds-modal",{opened:[1540],position:[1537],stateOpened:[32]},[[4,"close","onCloseListener"]]]]]],e)));
@@ -0,0 +1 @@
1
+ import{r as t,c as o,h as i,H as r,g as e}from"./p-4fdbb5fc.js";function n(t){var o,i,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t)if(Array.isArray(t))for(o=0;o<t.length;o++)t[o]&&(i=n(t[o]))&&(r&&(r+=" "),r+=i);else for(o in t)t[o]&&(r&&(r+=" "),r+=o);return r}function a(){for(var t,o,i=0,r="";i<arguments.length;)(t=arguments[i++])&&(o=n(t))&&(r&&(r+=" "),r+=o);return r}class s{constructor(){this.elements=[],this.handleClickBehaviorDispatchEvent=t=>{"Space"!==t.code&&"Enter"!==t.code&&"NumpadEnter"!==t.code||t.target.click()},this.handleEscapeBehaviorDispatchEvent=t=>{"Escape"===t.code&&this.escapeCallback&&this.escapeCallback()},this.addElement=(t,o="element")=>{this.elements[o]=t},this.attachClickBehavior=(t="element")=>{this.elements[t]&&this.elements[t].addEventListener("keydown",this.handleClickBehaviorDispatchEvent)},this.detachClickBehavior=(t="element")=>{this.elements[t]&&this.elements[t].removeEventListener("keydown",this.handleClickBehaviorDispatchEvent)},this.attachEscapeBehavior=t=>{this.escapeCallback=t,void 0!==typeof window&&window.addEventListener("keydown",this.handleEscapeBehaviorDispatchEvent.bind(this))},this.detachEscapeBehavior=()=>{this.escapeCallback=null,void 0!==typeof window&&window.removeEventListener("keydown",this.handleEscapeBehaviorDispatchEvent.bind(this))}}}const l=class{constructor(i){t(this,i),this.close=o(this,"close",7),this.window=null,this.top=null,this.bottom=null,this.animationState="intro",this.km=new s,this.componentDidLoad=()=>{this.km.addElement(this.host,"host"),this.km.addElement(this.host.shadowRoot.querySelector(".close"),"close"),this.km.attachEscapeBehavior((()=>this.close.emit())),this.km.attachClickBehavior("close")},this.animationName=(t=null,o=null)=>`animate-${null!==o?o:this.position}${null!==t?"-"+t:""}`,this.closeModal=(t=null)=>{var o;"mds-modal"===(null===(o=t.target)||void 0===o?void 0:o.localName)&&(this.opened=t.target!==t.currentTarget,this.opened||this.close.emit())},this.stateOpened=void 0,this.opened=void 0,this.position=null}componentWillLoad(){this.bottom=null!==this.host.querySelector('[slot="bottom"]'),this.top=null!==this.host.querySelector('[slot="top"]'),this.window=null!==this.host.querySelector('[slot="window"]'),this.stateOpened=this.opened,this.window&&null===this.position&&(this.position="center"),null===this.position&&(this.position="right"),this.window&&this.host.querySelector('[slot="window"]').setAttribute("role","modal")}componentWillRender(){this.animationState=this.opened?"intro":"outro",this.host.classList.add(this.animationName())}componentDidRender(){this.animationDeelay=window.setTimeout((()=>{this.animationState="intro"===this.animationState?"outro":"intro",this.host.classList.remove(this.animationName("intro"===this.animationState?"outro":"intro")),this.host.classList.add(this.animationName(this.animationState)),window.clearTimeout(this.animationDeelay)}),500)}disconnectedCallback(){this.km.detachEscapeBehavior(),this.km.detachClickBehavior("close")}positionChange(t,o){window.clearTimeout(this.animationDeelay),this.host.classList.remove(this.animationName(null,o)),this.host.classList.remove(this.animationName("intro",o)),this.host.classList.remove(this.animationName("outro",o))}openedChange(t){this.stateOpened=t,window.clearTimeout(this.animationDeelay)}onCloseListener(){this.opened=!1}render(){return i(r,{"aria-modal":a(this.opened?"true":"false"),class:a(this.stateOpened&&this.animationName("opened")),onClick:t=>{this.closeModal(t)}},this.window?i("slot",{name:"window"}):i("div",{class:a("window",(this.top||this.bottom)&&`window-${this.top?"-top":""}${this.bottom?"-bottom":""}`),role:"dialog"},this.top&&i("slot",{name:"top"}),i("slot",null),this.bottom&&i("slot",{name:"bottom"})),!this.window&&i("i",{innerHTML:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z"/></svg>',tabindex:"0",onClick:t=>{this.closeModal(t)},class:"svg close focusable-light"}))}get host(){return e(this)}static get watchers(){return{position:["positionChange"],opened:["openedChange"]}}};l.style="@tailwind components; .focus-off,.focusable,.focusable-light,.focusable-light-off{-webkit-transition-duration:200ms;transition-duration:200ms;-webkit-transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-timing-function:cubic-bezier(0, 0, 0.2, 1);outline-offset:var(--magma-outline-blur-offset);outline:var(--magma-outline-blur);-webkit-transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform, -webkit-box-shadow, -webkit-transform}.focus-on,.focusable-light:focus-visible,.focusable:focus-visible{--magma-outline-blur-offset:var(--magma-outline-focus-offset);--magma-outline-blur:var(--magma-outline-focus)}.focus-light-on,.focusable-light:focus-visible{--magma-outline-blur:2px solid rgb(var(--tone-neutral))}.svg{display:-ms-flexbox;display:flex}.svg svg{aspect-ratio:1 / 1;height:100%;width:100%}.animate-left,.animate-right{opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}.animate-right-intro,.animate-right-outro{-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}.fixed{position:fixed}.absolute{position:absolute}.mx-6{margin-left:1.5rem;margin-right:1.5rem}.ml-auto{margin-left:auto}.flex{display:-ms-flexbox;display:flex}.w-16{width:4rem}.min-w-0{min-width:0px}.max-w-lg{max-width:32rem}.max-w-xl{max-width:36rem}.items-center{-ms-flex-align:center;align-items:center}.gap-4{gap:1rem}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rounded-full{border-radius:9999px}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-t{border-top-width:1px}.border-tone-neutral-09{--tw-border-opacity:1;border-color:rgba(var(--tone-neutral-09), var(--tw-border-opacity))}.bg-transparent{background-color:transparent}.p-8{padding:2rem}.p-4{padding:1rem}.text-tone-neutral-02{--tw-text-opacity:1;color:rgba(var(--tone-neutral-02), var(--tw-text-opacity))}.text-tone-neutral-04{--tw-text-opacity:1;color:rgba(var(--tone-neutral-04), var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-modal-overlay-color:var(--magma-overlay-color, 0 0 0);--mds-modal-overlay-opacity:var(--magma-overlay-opacity, 0.5);--mds-modal-window-background:rgb(var(--tone-neutral));--mds-modal-window-overflow:auto;--mds-modal-window-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);--mds-modal-z-index:var(--magma-modal-z-index);pointer-events:none;position:fixed;top:0px;right:0px;bottom:0px;left:0px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;-webkit-transition-duration:700ms;transition-duration:700ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1);background-color:rgba(var(--mds-modal-overlay-color) / 0);-webkit-perspective:600px;perspective:600px;z-index:var(--z-index, 1000)}:host([position=top]){-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:center;justify-content:center}:host([position=bottom]){-ms-flex-align:end;align-items:flex-end;-ms-flex-pack:center;justify-content:center}:host(.animate-bottom-opened),:host(.animate-center-opened),:host(.animate-left-opened),:host(.animate-right-opened),:host(.animate-top-opened){pointer-events:auto;-webkit-transition-duration:500ms;transition-duration:500ms;background-color:rgba(var(--mds-modal-overlay-color) / var(--mds-modal-overlay-opacity))}.close{position:absolute;top:0px;height:2.25rem;width:2.25rem;-webkit-transform-origin:center;transform-origin:center;cursor:pointer;border-radius:9999px;fill:rgb(var(--tone-neutral-10));font-size:2.25rem;line-height:2.5rem;opacity:0;-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);transition-timing-function:cubic-bezier(0.77, 0, 0.175, 1);-webkit-transition-property:opacity, outline, outline-offset, -webkit-transform;transition-property:opacity, outline, outline-offset, -webkit-transform;transition-property:opacity, outline, outline-offset, transform;transition-property:opacity, outline, outline-offset, transform, -webkit-transform;-webkit-transform:translate(0, 24px) rotate(90deg);transform:translate(0, 24px) rotate(90deg)}.window{display:grid;height:100%;gap:0px;background-color:var(--mds-modal-window-background);-webkit-box-shadow:var(--mds-modal-window-shadow);box-shadow:var(--mds-modal-window-shadow);grid-template-rows:1fr;max-width:calc(100vw - 80px);overflow:var(--mds-modal-window-overflow)}.window--top{grid-template-rows:auto 1fr}.window--bottom{grid-template-rows:1fr auto}.window--top-bottom{grid-template-rows:auto 1fr auto}:host(.animate-bottom){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-bottom){padding:1rem}}:host(.animate-bottom) .window,:host(.animate-bottom)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-bottom-intro) .window,:host(.animate-bottom-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-bottom-opened.animate-bottom-outro) .window,:host(.animate-bottom-opened.animate-bottom-outro)>::slotted([slot=window]),:host(.animate-bottom-opened) .window,:host(.animate-bottom-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-bottom-outro) .window,:host(.animate-bottom-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}:host(.animate-center){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-center){padding:1rem}}:host(.animate-center) .window,:host(.animate-center)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-center-intro) .window,:host(.animate-center-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-center-opened.animate-center-outro) .window,:host(.animate-center-opened.animate-center-outro)>::slotted([slot=window]),:host(.animate-center-opened) .window,:host(.animate-center-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-center-outro) .window,:host(.animate-center-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}:host(.animate-left){-ms-flex-pack:start;justify-content:flex-start}:host(.animate-left) .window,:host(.animate-left)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-left-intro) .window,:host(.animate-left-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-opened.animate-left-outro) .window,:host(.animate-left-opened.animate-left-outro)>::slotted([slot=window]),:host(.animate-left-opened) .window,:host(.animate-left-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-left-opened) .close,:host(.animate-left-opened.animate-left-outro) .close{opacity:1;-webkit-transform:translate(-24px, 24px) rotate(0);transform:translate(-24px, 24px) rotate(0)}:host(.animate-left-outro) .window,:host(.animate-left-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(-100% - 50px));transform:translateX(calc(-100% - 50px))}:host(.animate-left-outro) .close{-webkit-transform:translate(24px, 24px) rotate(-90deg);transform:translate(24px, 24px) rotate(-90deg)}:host(.animate-left) .close{right:0px;-webkit-transform:translate(36px, 24px) rotate(90deg);transform:translate(36px, 24px) rotate(90deg)}:host(.animate-right){-ms-flex-pack:end;justify-content:flex-end}:host(.animate-right) .window,:host(.animate-right)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-right-intro) .window,:host(.animate-right-intro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-opened.animate-right-outro) .window,:host(.animate-right-opened.animate-right-outro)>::slotted([slot=window]),:host(.animate-right-opened) .window,:host(.animate-right-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:translateX(0);transform:translateX(0)}:host(.animate-right-opened) .close,:host(.animate-right-opened.animate-right-outro) .close{opacity:1;-webkit-transform:translate(24px, 24px) rotate(0);transform:translate(24px, 24px) rotate(0)}:host(.animate-right-outro) .window,:host(.animate-right-outro)>::slotted([slot=window]){-webkit-transform:translateX(calc(100% + 50px));transform:translateX(calc(100% + 50px))}:host(.animate-right-outro) .close{-webkit-transform:translate(-24px, 24px) rotate(90deg);transform:translate(-24px, 24px) rotate(90deg)}:host(.animate-right) .close{left:0px;-webkit-transform:translate(-36px, 24px) rotate(-90deg);transform:translate(-36px, 24px) rotate(-90deg)}:host(.animate-top){-ms-flex-pack:center;justify-content:center;padding:2rem}@media (max-width: 767px){:host(.animate-top){padding:1rem}}:host(.animate-top) .window,:host(.animate-top)>::slotted([slot=window]){opacity:0;-webkit-transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, height, margin, opacity, padding, width, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width;transition-property:background-color, border-color, box-shadow, color, fill, height, margin, opacity, padding, transform, width, -webkit-box-shadow, -webkit-transform;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:500ms;transition-duration:500ms;-webkit-transition-timing-function:cubic-bezier(1, 0, 0, 1);transition-timing-function:cubic-bezier(1, 0, 0, 1)}:host(.animate-top-intro) .window,:host(.animate-top-intro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(40%);transform:rotateX(-22deg) scale(0.5) translateY(40%)}:host(.animate-top-opened.animate-top-outro) .window,:host(.animate-top-opened.animate-top-outro)>::slotted([slot=window]),:host(.animate-top-opened) .window,:host(.animate-top-opened)>::slotted([slot=window]){opacity:1;-webkit-transform:rotateX(0) scale(1) translateY(0);transform:rotateX(0) scale(1) translateY(0)}:host(.animate-top-outro) .window,:host(.animate-top-outro)>::slotted([slot=window]){-webkit-transform:rotateX(-22deg) scale(0.5) translateY(-40%);transform:rotateX(-22deg) scale(0.5) translateY(-40%)}@media (max-width: 767px){.mobile\\:w-12{width:3rem}}";export{l as mds_modal}