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,QAvBO,sBAuBC;AACN,UAAI,IAAI,GAAc;AACpB,QAAA,WAAW,EAAE,SADO;AAEpB,QAAA,KAAK,EAAE;AACL,UAAA,IAAI,EAAE;AADD,SAFa;AAKpB,QAAA,KAAK,EAAE,KAAK,OALQ;AAMpB,QAAA,KAAK,EAAE,KAAK,MANQ;AAOpB,QAAA,UAAU,EAAE,CAAC;AACX,UAAA,IAAI,EAAE,MADK;AAEX,UAAA,KAAK,EAAE,KAAK;AAFD,SAAD;AAPQ,OAAtB;;AAaA,UAAI,CAAC,KAAK,aAAV,EAAyB;AACvB,YAAM,QAAQ,GAAG,KAAK,OAAL,GAAe,KAAK,YAApB,GAAmC,KAAK,kBAAzD;AACA,QAAA,IAAI,GAAG,QAAQ,CAAC,KAAK,aAAN,EAAqB,IAArB,CAAf;AACD;;AAED,aAAO,KAAK,cAAL,CAAoB,KAApB,EAA2B,IAA3B,EAAiC,CAAC,KAAK,UAAL,EAAD,CAAjC,CAAP;AACD,KA3CM;;AA4CP;AACA,IAAA,MA7CO,oBA6CD;AACJ,WAAK,QAAL,GAAgB,CAAC,KAAK,QAAtB;AACD;AA/CM,GA/JF;AAiNP,EAAA,MAjNO,kBAiNC,CAjND,EAiNE;AACP,QAAM,MAAM,GAAG,KAAK,QAAL,EAAf;AAEA,QAAI,CAAC,KAAK,UAAV,EAAsB,OAAO,MAAP;AAEtB,WAAO,CAAC,CAAC,YAAD,EAAe;AACrB,MAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,KAAK,UADN;AAEL,QAAA,MAAM,EAAE,KAAK,MAFR;AAGL,QAAA,IAAI,EAAE,KAAK;AAHN;AADc,KAAf,EAML,CAAC,MAAD,CANK,CAAR;AAOD;AA7NM,CAJM,C","sourcesContent":["// Styles\nimport './VAlert.sass'\n\n// Extensions\nimport VSheet from '../VSheet'\n\n// Components\nimport VBtn from '../VBtn'\nimport VIcon from '../VIcon'\n\n// Mixins\nimport Toggleable from '../../mixins/toggleable'\nimport Themeable from '../../mixins/themeable'\nimport Transitionable from '../../mixins/transitionable'\n\n// Utilities\nimport mixins from '../../util/mixins'\nimport { breaking } from '../../util/console'\n\n// Types\nimport { VNodeData } from 'vue'\nimport { VNode } from 'vue/types'\n\n/* @vue/component */\nexport default mixins(\n VSheet,\n Toggleable,\n Transitionable\n).extend({\n name: 'v-alert',\n\n props: {\n border: {\n type: String,\n validator (val: string) {\n return [\n 'top',\n 'right',\n 'bottom',\n 'left',\n ].includes(val)\n },\n },\n closeLabel: {\n type: String,\n default: '$vuetify.close',\n },\n coloredBorder: Boolean,\n dense: Boolean,\n dismissible: Boolean,\n icon: {\n default: '',\n type: [Boolean, String],\n validator (val: boolean | string) {\n return typeof val === 'string' || val === false\n },\n },\n outlined: Boolean,\n prominent: Boolean,\n text: Boolean,\n type: {\n type: String,\n validator (val: string) {\n return [\n 'info',\n 'error',\n 'success',\n 'warning',\n ].includes(val)\n },\n },\n value: {\n type: Boolean,\n default: true,\n },\n },\n\n computed: {\n __cachedBorder (): VNode | null {\n if (!this.border) return null\n\n let data: VNodeData = {\n staticClass: 'v-alert__border',\n class: {\n [`v-alert__border--${this.border}`]: true,\n },\n }\n\n if (this.coloredBorder) {\n data = this.setBackgroundColor(this.computedColor, data)\n data.class['v-alert__border--has-color'] = true\n }\n\n return this.$createElement('div', data)\n },\n __cachedDismissible (): VNode | null {\n if (!this.dismissible) return null\n\n const color = this.iconColor\n\n return this.$createElement(VBtn, {\n staticClass: 'v-alert__dismissible',\n props: {\n color,\n icon: true,\n },\n attrs: {\n 'aria-label': this.$vuetify.lang.t(this.closeLabel),\n },\n on: {\n click: () => (this.isActive = false),\n },\n }, [\n this.$createElement(VIcon, {\n props: { color },\n }, '$vuetify.icons.cancel'),\n ])\n },\n __cachedIcon (): VNode | null {\n if (!this.computedIcon) return null\n\n return this.$createElement(VIcon, {\n staticClass: 'v-alert__icon',\n props: { color: this.iconColor },\n }, this.computedIcon)\n },\n classes (): object {\n const classes: Record<string, boolean> = {\n ...VSheet.options.computed.classes.call(this),\n 'v-alert--border': Boolean(this.border),\n 'v-alert--dense': this.dense,\n 'v-alert--outlined': this.outlined,\n 'v-alert--prominent': this.prominent,\n 'v-alert--text': this.text,\n }\n\n if (this.border) {\n classes[`v-alert--border-${this.border}`] = true\n }\n\n return classes\n },\n computedColor (): string {\n return this.color || this.type\n },\n computedIcon (): string | boolean {\n if (this.icon === false) return false\n if (typeof this.icon === 'string' && this.icon) return this.icon\n\n switch (this.type) {\n case 'info': return '$vuetify.icons.info'\n case 'error': return '$vuetify.icons.error'\n case 'success': return '$vuetify.icons.success'\n case 'warning': return '$vuetify.icons.warning'\n default: return false\n }\n },\n hasColoredIcon (): boolean {\n return (\n this.hasText ||\n (Boolean(this.border) && this.coloredBorder)\n )\n },\n hasText (): boolean {\n return this.text || this.outlined\n },\n iconColor (): string | undefined {\n return this.hasColoredIcon ? this.computedColor : undefined\n },\n isDark (): boolean {\n if (\n this.type &&\n !this.coloredBorder &&\n !this.outlined\n ) return true\n\n return Themeable.options.computed.isDark.call(this)\n },\n },\n\n created () {\n /* istanbul ignore next */\n if (this.$attrs.hasOwnProperty('outline')) {\n breaking('outline', 'outlined', this)\n }\n },\n\n methods: {\n genWrapper (): VNode {\n const children = [\n this.$slots.prepend || this.__cachedIcon,\n this.genContent(),\n this.__cachedBorder,\n this.$slots.append,\n this.$scopedSlots.close\n ? this.$scopedSlots.close({ toggle: this.toggle })\n : this.__cachedDismissible,\n ]\n\n const data: VNodeData = {\n staticClass: 'v-alert__wrapper',\n }\n\n return this.$createElement('div', data, children)\n },\n genContent (): VNode {\n return this.$createElement('div', {\n staticClass: 'v-alert__content',\n }, this.$slots.default)\n },\n genAlert (): VNode {\n let data: VNodeData = {\n staticClass: 'v-alert',\n attrs: {\n role: 'alert',\n },\n class: this.classes,\n style: this.styles,\n directives: [{\n name: 'show',\n value: this.isActive,\n }],\n }\n\n if (!this.coloredBorder) {\n const setColor = this.hasText ? this.setTextColor : this.setBackgroundColor\n data = setColor(this.computedColor, data)\n }\n\n return this.$createElement('div', data, [this.genWrapper()])\n },\n /** @public */\n toggle () {\n this.isActive = !this.isActive\n },\n },\n\n render (h): VNode {\n const render = this.genAlert()\n\n if (!this.transition) return render\n\n return h('transition', {\n props: {\n name: this.transition,\n origin: this.origin,\n mode: this.mode,\n },\n }, [render])\n },\n})\n"],"sourceRoot":"","file":"VAlert.js"} |