@maggioli-design-system/mds-modal 3.4.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.
- package/dist/cjs/mds-modal.cjs.entry.js +63 -35
- package/dist/collection/common/keyboard-manager.js +40 -0
- package/dist/collection/components/mds-modal/mds-modal.css +173 -30
- package/dist/collection/components/mds-modal/mds-modal.js +22 -34
- package/dist/collection/dictionary/icon.js +3 -1
- package/dist/collection/dictionary/typography.js +5 -1
- package/dist/components/mds-modal.js +63 -35
- package/dist/esm/mds-modal.entry.js +63 -35
- package/dist/esm-es5/mds-modal.entry.js +1 -1
- package/dist/mds-modal/mds-modal.esm.js +1 -1
- package/dist/mds-modal/p-2a5d50d2.entry.js +1 -0
- package/dist/mds-modal/p-64ab5c19.system.entry.js +1 -0
- package/dist/mds-modal/p-f856db3e.system.js +1 -1
- package/dist/stats.json +56 -21
- package/dist/types/common/keyboard-manager.d.ts +11 -0
- package/dist/types/dictionary/icon.d.ts +2 -1
- package/dist/types/dictionary/typography.d.ts +2 -1
- package/dist/types/types/typography.d.ts +1 -0
- package/package.json +2 -2
- package/readme.md +12 -0
- package/src/common/keyboard-manager.ts +46 -0
- package/src/components/mds-modal/mds-modal.css +13 -10
- package/src/components/mds-modal/mds-modal.tsx +22 -40
- package/src/components/mds-modal/readme.md +12 -0
- package/src/components/mds-modal/test/mds-modal.e2e.ts +2 -2
- package/src/dictionary/icon.ts +4 -0
- package/src/dictionary/typography.ts +9 -3
- package/src/fixtures/icons.json +174 -0
- package/src/fixtures/iconsauce.json +175 -0
- package/src/tailwind/components.css +1 -0
- package/src/types/typography.ts +4 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/p-2a5d50d2.entry.js +1 -0
- package/www/build/p-64ab5c19.system.entry.js +1 -0
- package/www/build/p-f856db3e.system.js +1 -1
- package/dist/mds-modal/p-96e1c297.entry.js +0 -1
- package/dist/mds-modal/p-bd8bddd0.system.entry.js +0 -1
- package/www/build/p-96e1c297.entry.js +0 -1
- package/www/build/p-bd8bddd0.system.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-
|
|
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-
|
|
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":
|
|
12
|
+
"bundles": 67,
|
|
13
13
|
"outputs": [
|
|
14
14
|
{
|
|
15
15
|
"name": "dist-collection",
|
|
16
|
-
"files":
|
|
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",
|
|
80
|
+
"./dist/mds-modal/p-2a5d50d2.entry.js",
|
|
79
81
|
"./dist/mds-modal/p-3aeea0b7.system.js",
|
|
80
82
|
"./dist/mds-modal/p-4fdbb5fc.js",
|
|
81
83
|
"./dist/mds-modal/p-50ea2036.system.js",
|
|
82
|
-
"./dist/mds-modal/p-
|
|
83
|
-
"./dist/mds-modal/p-bd8bddd0.system.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",
|
|
89
|
+
"./www/build/p-2a5d50d2.entry.js",
|
|
88
90
|
"./www/build/p-3aeea0b7.system.js",
|
|
89
91
|
"./www/build/p-4fdbb5fc.js",
|
|
90
92
|
"./www/build/p-50ea2036.system.js",
|
|
91
|
-
"./www/build/p-
|
|
92
|
-
"./www/build/p-bd8bddd0.system.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-
|
|
127
|
-
"fileName": "p-
|
|
127
|
+
"bundleId": "p-2a5d50d2",
|
|
128
|
+
"fileName": "p-2a5d50d2.entry.js",
|
|
128
129
|
"imports": [
|
|
129
130
|
"p-4fdbb5fc.js"
|
|
130
131
|
],
|
|
131
|
-
"originalByteSize":
|
|
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":
|
|
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":
|
|
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-
|
|
169
|
-
"fileName": "p-
|
|
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":
|
|
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":
|
|
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": "
|
|
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": "
|
|
305
|
+
"elementRef": "host",
|
|
305
306
|
"encapsulation": "shadow",
|
|
306
307
|
"shadowDelegatesFocus": false,
|
|
307
308
|
"properties": [
|
|
@@ -414,7 +415,38 @@
|
|
|
414
415
|
"legacyContext": [],
|
|
415
416
|
"internal": false,
|
|
416
417
|
"assetsDirs": [],
|
|
417
|
-
"styleDocs": [
|
|
418
|
+
"styleDocs": [
|
|
419
|
+
{
|
|
420
|
+
"name": "--mds-modal-overlay-color",
|
|
421
|
+
"docs": "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`.",
|
|
422
|
+
"annotation": "prop"
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
"name": "--mds-modal-overlay-opacity",
|
|
426
|
+
"docs": "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`.",
|
|
427
|
+
"annotation": "prop"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"name": "--mds-modal-window-background",
|
|
431
|
+
"docs": "Set the background color of the window",
|
|
432
|
+
"annotation": "prop"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
"name": "--mds-modal-window-overflow",
|
|
436
|
+
"docs": "Set the overflow of the window",
|
|
437
|
+
"annotation": "prop"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
"name": "--mds-modal-window-shadow",
|
|
441
|
+
"docs": "Set the box shadow of the window",
|
|
442
|
+
"annotation": "prop"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "--mds-modal-z-index",
|
|
446
|
+
"docs": "Set the z-index of the window when the component is opened",
|
|
447
|
+
"annotation": "prop"
|
|
448
|
+
}
|
|
449
|
+
],
|
|
418
450
|
"docs": {
|
|
419
451
|
"tags": [],
|
|
420
452
|
"text": ""
|
|
@@ -474,7 +506,8 @@
|
|
|
474
506
|
"onClick",
|
|
475
507
|
"name",
|
|
476
508
|
"role",
|
|
477
|
-
"innerHTML"
|
|
509
|
+
"innerHTML",
|
|
510
|
+
"tabindex"
|
|
478
511
|
],
|
|
479
512
|
"htmlTagNames": [
|
|
480
513
|
"slot",
|
|
@@ -500,6 +533,7 @@
|
|
|
500
533
|
},
|
|
501
534
|
"sourceGraph": {
|
|
502
535
|
"./src/common/aria.ts": [],
|
|
536
|
+
"./src/common/keyboard-manager.ts": [],
|
|
503
537
|
"./src/components/mds-modal/mds-modal.tsx": [],
|
|
504
538
|
"./src/components/mds-modal/meta/dictionary.ts": [],
|
|
505
539
|
"./src/components/mds-modal/meta/types.ts": [],
|
|
@@ -511,7 +545,8 @@
|
|
|
511
545
|
"./src/dictionary/color.ts": [],
|
|
512
546
|
"./src/dictionary/floating-ui.ts": [],
|
|
513
547
|
"./src/dictionary/icon.ts": [
|
|
514
|
-
"./src/fixtures/icons.json"
|
|
548
|
+
"./src/fixtures/icons.json",
|
|
549
|
+
"./src/fixtures/iconsauce.json"
|
|
515
550
|
],
|
|
516
551
|
"./src/dictionary/input-text-type.ts": [],
|
|
517
552
|
"./src/dictionary/loading.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,
|
|
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.
|
|
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.
|
|
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
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
| `close` | Emits when a modal is closed | `CustomEvent<void>` |
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
## CSS Custom Properties
|
|
24
|
+
|
|
25
|
+
| Name | Description |
|
|
26
|
+
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
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
|
+
| `--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
|
+
| `--mds-modal-window-background` | Set the background color 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
|
+
| `--mds-modal-z-index` | Set the z-index of the window when the component is opened |
|
|
33
|
+
|
|
34
|
+
|
|
23
35
|
## Dependencies
|
|
24
36
|
|
|
25
37
|
### Used by
|
|
@@ -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,13 +1,14 @@
|
|
|
1
|
+
@import '../../tailwind/components.css';
|
|
1
2
|
@tailwind components;
|
|
2
3
|
@tailwind utilities;
|
|
3
|
-
@import '../../tailwind/components.css';
|
|
4
4
|
|
|
5
|
-
|
|
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`.
|
|
7
|
-
* @prop --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`.
|
|
8
|
-
* @prop --mds-modal-window-background: Set the background color of the window
|
|
9
|
-
* @prop --mds-modal-window-
|
|
10
|
-
* @prop --mds-modal-
|
|
5
|
+
/**
|
|
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`.
|
|
7
|
+
* @prop --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`.
|
|
8
|
+
* @prop --mds-modal-window-background: Set the background color of the window
|
|
9
|
+
* @prop --mds-modal-window-overflow: Set the overflow of the window
|
|
10
|
+
* @prop --mds-modal-window-shadow: Set the box shadow of the window
|
|
11
|
+
* @prop --mds-modal-z-index: Set the z-index of the window when the component is opened
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
@layer components {
|
|
@@ -72,6 +73,7 @@
|
|
|
72
73
|
--mds-modal-overlay-color: var(--magma-overlay-color, 0 0 0);
|
|
73
74
|
--mds-modal-overlay-opacity: var(--magma-overlay-opacity, 0.5);
|
|
74
75
|
--mds-modal-window-background: theme('colors.tone-neutral');
|
|
76
|
+
--mds-modal-window-overflow: auto;
|
|
75
77
|
--mds-modal-window-shadow: theme('boxShadow.2xl');
|
|
76
78
|
--mds-modal-z-index: var(--magma-modal-z-index);
|
|
77
79
|
|
|
@@ -124,11 +126,12 @@
|
|
|
124
126
|
h-9
|
|
125
127
|
opacity-0
|
|
126
128
|
origin-center
|
|
129
|
+
rounded-full
|
|
127
130
|
text-4xl
|
|
128
131
|
top-0
|
|
129
|
-
transition-cosmetic
|
|
130
132
|
w-9;
|
|
131
133
|
|
|
134
|
+
transition-property: opacity, outline, outline-offset, transform;
|
|
132
135
|
transform: translate(0, 24px) rotate(90deg);
|
|
133
136
|
}
|
|
134
137
|
|
|
@@ -136,13 +139,13 @@
|
|
|
136
139
|
@apply
|
|
137
140
|
gap-0
|
|
138
141
|
grid
|
|
139
|
-
h-full
|
|
140
|
-
overflow-auto;
|
|
142
|
+
h-full;
|
|
141
143
|
|
|
142
144
|
background-color: var(--mds-modal-window-background);
|
|
143
145
|
box-shadow: var(--mds-modal-window-shadow);
|
|
144
146
|
grid-template-rows: 1fr;
|
|
145
147
|
max-width: calc(100vw - 80px);
|
|
148
|
+
overflow: var(--mds-modal-window-overflow);
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
.window--top {
|
|
@@ -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()
|
|
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.
|
|
33
|
-
this.top = this.
|
|
34
|
-
this.window = this.
|
|
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.
|
|
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.
|
|
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.
|
|
60
|
-
this.
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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.
|
|
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.
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
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
|
}
|
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
| `close` | Emits when a modal is closed | `CustomEvent<void>` |
|
|
21
21
|
|
|
22
22
|
|
|
23
|
+
## CSS Custom Properties
|
|
24
|
+
|
|
25
|
+
| Name | Description |
|
|
26
|
+
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
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
|
+
| `--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
|
+
| `--mds-modal-window-background` | Set the background color 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
|
+
| `--mds-modal-z-index` | Set the z-index of the window when the component is opened |
|
|
33
|
+
|
|
34
|
+
|
|
23
35
|
----------------------------------------------
|
|
24
36
|
|
|
25
37
|
Built with love @ **Maggioli Informatica / R&D Department**
|
|
@@ -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>
|
package/src/dictionary/icon.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import jsonIconsDictionary from '../fixtures/icons.json'
|
|
2
|
+
import jsonMggIconsDictionary from '../fixtures/iconsauce.json'
|
|
2
3
|
const iconsDictionary = jsonIconsDictionary
|
|
4
|
+
const mggIconsDictionary = jsonMggIconsDictionary
|
|
5
|
+
|
|
3
6
|
export {
|
|
4
7
|
iconsDictionary,
|
|
8
|
+
mggIconsDictionary,
|
|
5
9
|
}
|
|
@@ -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
|
}
|