{"version":3,"sources":["components/alert.js"],"names":["dmx","Component","attributes","show","type","Boolean","default","String","closable","methods","toggle","this","$node","classList","contains","hide","setType","style","setTextContent","text","render","node","$parse","setAttribute","add","self","$closeButton","jQuery","on","props","setProperty","update","append","detach","remove","off","removeProperty","offsetWidth","one","types","map","apply","textContent","beforeDestroy"],"mappings":";;;;;;AAAAA,IAAAC,UAAA,YAAA,CAEAC,WAAA,CACAC,KAAA,CACAC,KAAAC,QACAC,SAAA,GAGAF,KAAA,CACAA,KAAAG,OACAD,QAAA,WAGAE,SAAA,CACAJ,KAAAC,QACAC,SAAA,IAIAG,QAAA,CACAC,OAAA,WACAC,KAAAA,KAAAC,MAAAC,UAAAC,SAAA,QAAA,OAAA,WAGAX,KAAA,WACAQ,KAAAR,QAGAY,KAAA,WACAJ,KAAAI,QAGAC,QAAA,SAAAC,GACAN,KAAAK,QAAAC,IAGAC,eAAA,SAAAC,GACAR,KAAAO,eAAAC,KAIAC,OAAA,SAAAC,GACAV,KAAAC,MAAAS,EACAV,KAAAW,SAEAD,EAAAE,aAAA,OAAA,SACAF,EAAAR,UAAAW,IAAA,SAEA,IAAAC,EAAAd,KACAA,KAAAe,aAAAC,OAAA,2GAAAC,GAAA,iBAAA,WACAH,EAAAV,SAGAJ,KAAAkB,MAAA1B,MACAQ,KAAAC,MAAAK,MAAAa,YAAA,UAAA,QAGAnB,KAAAoB,OAAA,KAGAA,OAAA,SAAAF,GACAA,EAAAzB,MAAAO,KAAAkB,MAAAzB,MACAO,KAAAK,QAAAL,KAAAkB,MAAAzB,MAGAyB,EAAA1B,MAAAQ,KAAAkB,MAAA1B,MACAQ,KAAAA,KAAAkB,MAAA1B,KAAA,OAAA,UAGA0B,EAAArB,UAAAG,KAAAkB,MAAArB,WACAG,KAAAkB,MAAArB,UACAmB,OAAAhB,KAAAC,OAAAoB,OAAArB,KAAAe,cACAf,KAAAC,MAAAC,UAAAW,IAAA,uBAEAb,KAAAe,aAAAO,SACAtB,KAAAC,MAAAC,UAAAqB,OAAA,wBAKA/B,KAAA,WACAwB,OAAAhB,KAAAC,OAAAuB,IAAA,0BACAxB,KAAAC,MAAAK,MAAAmB,eAAA,WACAzB,KAAAC,MAAAyB,YACA1B,KAAAC,MAAAC,UAAAW,IAAA,SAGAT,KAAA,WACAY,OAAAhB,KAAAC,OAAAuB,IAAA,0BACAxB,KAAAC,MAAAC,UAAAC,SAAA,QACAa,OAAAhB,KAAAC,OAAA0B,IAAA,yBAAA,WACA3B,KAAAM,MAAAa,YAAA,UAAA,UAGAnB,KAAAC,MAAAK,MAAAa,YAAA,UAAA,QAEAnB,KAAAC,MAAAC,UAAAqB,OAAA,SAGAlB,QAAA,SAAAZ,GACA,IAAAmC,EAAA,CAAA,UAAA,YAAA,UAAA,SAAA,UAAA,OAAA,QAAA,QAAAC,IAAA,SAAApC,GAAA,MAAA,SAAAA,IACAO,KAAAC,MAAAC,UAAAqB,OAAAO,MAAA9B,KAAAC,MAAAC,UAAA0B,GACA5B,KAAAC,MAAAC,UAAAW,IAAA,SAAApB,IAGAc,eAAA,SAAAC,GACAR,KAAAe,aAAAO,SACAtB,KAAAC,MAAA8B,YAAAvB,EACAR,KAAAkB,MAAArB,UACAmB,OAAAhB,KAAAC,OAAAoB,OAAArB,KAAAe,eAIAiB,cAAA,WACAhB,OAAAhB,KAAAe,cAAAS,IAAA","file":"../dmxBootstrap4Alert/dmxBootstrap4Alert.js","sourcesContent":["dmx.Component('bs4-alert', {\r\n\r\n attributes: {\r\n show: {\r\n type: Boolean,\r\n default: false\r\n },\r\n\r\n type: {\r\n type: String,\r\n default: 'primary' // primary, secondary, success, danger, warning, info, light, dark\r\n },\r\n\r\n closable: {\r\n type: Boolean,\r\n default: false\r\n }\r\n },\r\n\r\n methods: {\r\n toggle: function() {\r\n this[this.$node.classList.contains('show') ? 'hide' : 'show']();\r\n },\r\n\r\n show: function() {\r\n this.show();\r\n },\r\n\r\n hide: function() {\r\n this.hide();\r\n },\r\n\r\n setType: function(style) {\r\n this.setType(style);\r\n },\r\n\r\n setTextContent: function(text) {\r\n this.setTextContent(text)\r\n }\r\n },\r\n\r\n render: function(node) {\r\n this.$node = node;\r\n this.$parse();\r\n\r\n node.setAttribute('role', 'alert');\r\n node.classList.add('alert');\r\n\r\n var self = this;\r\n this.$closeButton = jQuery('').on('click.bs.alert', function() {\r\n self.hide();\r\n });\r\n\r\n if (!this.props.show) {\r\n this.$node.style.setProperty('display', 'none');\r\n }\r\n\r\n this.update({});\r\n },\r\n\r\n update: function(props) {\r\n if (props.type != this.props.type) {\r\n this.setType(this.props.type);\r\n }\r\n\r\n if (props.show != this.props.show) {\r\n this[this.props.show ? 'show' : 'hide']();\r\n }\r\n\r\n if (props.closable != this.props.closable) {\r\n if (this.props.closable) {\r\n jQuery(this.$node).append(this.$closeButton);\r\n this.$node.classList.add('alert-dismissible');\r\n } else {\r\n this.$closeButton.detach();\r\n this.$node.classList.remove('alert-dismissible');\r\n }\r\n }\r\n },\r\n\r\n show: function() {\r\n jQuery(this.$node).off('transitionend.bs.alert');\r\n this.$node.style.removeProperty('display');\r\n this.$node.offsetWidth;\r\n this.$node.classList.add('show');\r\n },\r\n\r\n hide: function() {\r\n jQuery(this.$node).off('transitionend.bs.alert');\r\n if (this.$node.classList.contains('fade')) {\r\n jQuery(this.$node).one('transitionend.bs.alert', function() {\r\n this.style.setProperty('display', 'none');\r\n });\r\n } else {\r\n this.$node.style.setProperty('display', 'none');\r\n }\r\n this.$node.classList.remove('show');\r\n },\r\n\r\n setType: function(type) {\r\n var types = ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark'].map(function(type) { return 'alert-' + type });\r\n this.$node.classList.remove.apply(this.$node.classList, types);\r\n this.$node.classList.add('alert-' + type);\r\n },\r\n\r\n setTextContent: function(text) {\r\n this.$closeButton.detach();\r\n this.$node.textContent = text;\r\n if (this.props.closable) {\r\n jQuery(this.$node).append(this.$closeButton);\r\n }\r\n },\r\n\r\n beforeDestroy: function() {\r\n jQuery(this.$closeButton).off('.bs.alert');\r\n }\r\n\r\n});\r\n"]}