{"version":3,"file":"alert2.mjs","sources":["../../../../../../packages/components/alert/src/alert.vue"],"sourcesContent":["<template>\r\n  <transition name=\"sg-alert-fade\">\r\n    <div\r\n      v-show=\"visible\"\r\n      :class=\"[\r\n        ns.b(),\r\n        ns.m(type),\r\n        ns.is('center', center),\r\n        ns.is(theme),\r\n        ns.is('description', isDescription)\r\n      ]\"\r\n      role=\"alert\"\r\n    >\r\n      <sg-icon\r\n        v-if=\"showIcon && iconComponent\"\r\n        :class=\"[ns.e('icon')]\"\r\n      >\r\n        <component :is=\"iconComponent\" />\r\n      </sg-icon>\r\n      <div :class=\"ns.e('content')\">\r\n        <div\r\n          v-if=\"title || $slots.title\"\r\n          :class=\"[ns.e('title')]\"\r\n        >\r\n          <slot name=\"title\">{{ title }}</slot>\r\n        </div>\r\n        <div v-if=\"isDescription\" :class=\"ns.e('description')\">\r\n          <slot>\r\n            {{ description }}\r\n          </slot>\r\n        </div>\r\n        <template v-if=\"closable\">\r\n          <div\r\n            v-if=\"closeText\"\r\n            :class=\"[ns.e('closebtn'), ns.is('customed')]\"\r\n            @click=\"close\"\r\n          >\r\n            {{ closeText }}\r\n          </div>\r\n          <sg-icon v-else :class=\"ns.e('closebtn')\" @click=\"close\">\r\n            <Close />\r\n          </sg-icon>\r\n        </template>\r\n      </div>\r\n    </div>\r\n  </transition>\r\n</template>\r\n<script lang=\"ts\">\r\nimport { defineComponent, computed, ref } from 'vue'\r\nimport { SgIcon } from '@sgui-plus/components/icon'\r\nimport { TypeComponents, TypeComponentsMap } from '@sgui-plus/utils/icon'\r\nimport { useNamespace } from '@sgui-plus/hooks'\r\nimport { alertProps, alertEmits } from './alert'\r\n\r\nexport default defineComponent({\r\n  name: 'SgAlert',\r\n\r\n  components: {\r\n    SgIcon,\r\n    ...TypeComponents,\r\n  },\r\n\r\n  props: alertProps,\r\n  emits: alertEmits,\r\n\r\n  setup(props, { emit, slots }) {\r\n    const ns = useNamespace('alert')\r\n\r\n    // state\r\n    const visible = ref(true)\r\n\r\n    // computed\r\n    const iconComponent = computed(\r\n      () => TypeComponentsMap[props.type] || TypeComponentsMap['info']\r\n    )\r\n    // const isBigIcon = computed(() =>\r\n    //   props.description || slots.default ? ns.is('big') : ''\r\n    // )\r\n    // const isBoldTitle = computed(() =>\r\n    //   props.description || slots.default ? ns.is('bold') : ''\r\n    // )\r\n    const isDescription = computed(() => !!props.description || !!slots.default)\r\n\r\n    // methods\r\n    const close = (evt: MouseEvent) => {\r\n      visible.value = false\r\n      emit('onClose', evt)\r\n    }\r\n\r\n    return {\r\n      ns,\r\n      visible,\r\n      iconComponent,\r\n      // isBigIcon,\r\n      // isBoldTitle,\r\n      isDescription,\r\n      close,\r\n    }\r\n  },\r\n})\r\n</script>\r\n"],"names":["_resolveComponent","_openBlock","_createBlock","_Transition","_withCtx","_withDirectives","_createElementVNode","_normalizeClass","_createCommentVNode","_createElementBlock","_Fragment","_toDisplayString"],"mappings":";;;;;;2BACEA,gBA4Ca,CAAA,OAAA,CAAA,CAAA;SA5CbC,SA4Ca,EAAA,EAAAC,WAAA,CAAAC,UAAA,EAAA;AAAA,IAAA,IAAA,EAAA,eAAA;;;AAzCH,IAAA,OAAA,EAAAC,OAAA,CAAA,MAAA;AAAA,MAAiBC,cAAA,CAAAC,kBAAA,CAAA,KAAA,EAAA;AAAA,QAAa,OAAEC,cAAO,CAAA;AAAA,UAAY,QAAG,CAAE,EAAA;AAAA,UAA6B,IAAA,CAAA,EAAA,CAAG,EAAE,IAAC,CAAA,IAAA,CAAA;AAAA,UAAiB,IAAA,CAAA,EAAA,CAAG,GAAE,QAAgB,EAAA,IAAA,CAAA,MAAA,CAAA;AAAA,UAAA,IAAA,CAAA,EAAA,CAAA,EAAA,CAAA,IAAA,CAAA,KAAA,CAAA;AAOvI,UAAA,IAAA,CAAI,GAAC,EAAO,CAAA,aAAA,EAAA,IAAA,CAAA,aAAA,CAAA;AAAA,SAAA,CAAA;AAGJ,QAAA,IAAA,EAAA,OAAA;AAAA,OAAA,EAAA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