maz-ui
Version:
A standalone components library for Vue.Js 3 & Nuxt.Js 3
1 lines • 3.51 kB
JavaScript
import{t as _plugin_vue_export_helper_default}from"./_plugin-vue_export-helper.ChmETRGw.js";import{computed,createBlock,createCommentVNode,createElementBlock,createElementVNode,createTextVNode,defineAsyncComponent,defineComponent,normalizeClass,normalizeStyle,openBlock,renderSlot,toDisplayString,unref,useId,useSlots}from"vue";import{MazCheckCircle}from"@maz-ui/icons/lazy/MazCheckCircle";import{MazExclamationCircle}from"@maz-ui/icons/lazy/MazExclamationCircle";import{MazXCircle}from"@maz-ui/icons/lazy/MazXCircle";import{MazInformationCircle}from"@maz-ui/icons/lazy/MazInformationCircle";import '../assets/MazAlert.BVM8E_2Y.css';var _hoisted_1=[`aria-labelledby`,`aria-describedby`];var _hoisted_2={key:0,class:`m-alert-icon`,"aria-hidden":`true`};var _hoisted_3={class:`m-alert-body`};var _hoisted_4=[`id`];var _hoisted_5=[`id`];var MazAlert_default=_plugin_vue_export_helper_default(defineComponent({__name:`MazAlert`,props:{title:{},content:{},icon:{type:[Function,Object,String],default:void 0},hideIcon:{type:Boolean,default:!1},color:{default:`info`},iconSize:{default:`md`},roundedSize:{default:`base`},bordered:{type:Boolean,default:!0},variant:{default:`soft`}},setup(__props){let MazIcon=defineAsyncComponent(()=>import(`../components/MazIcon.js`));let slots=useSlots();let instanceId=useId();let headingId=computed(()=>`m-alert-heading-${instanceId}`);let contentId=computed(()=>`m-alert-content-${instanceId}`);let hasTitle=computed(()=>!!__props.title||!!slots.title);let hasContent=computed(()=>!!__props.content||!!slots.default);let colorStyles=computed(()=>({"--m-alert-color":`var(--maz-${__props.color}-700)`,"--m-alert-color-dark":`var(--maz-${__props.color}-400)`,"--m-alert-bg":`var(--maz-${__props.color})`,"--m-alert-fg":`var(--maz-${__props.color}-foreground)`,"--m-alert-border":`var(--maz-${__props.color}-600)`}));let currentIcon=computed(()=>{if(!__props.hideIcon)return __props.icon?__props.icon:{success:MazCheckCircle,warning:MazExclamationCircle,destructive:MazXCircle,info:MazInformationCircle,primary:MazInformationCircle,secondary:MazInformationCircle,accent:MazInformationCircle,contrast:MazInformationCircle}[__props.color]});return(_ctx,_cache)=>(openBlock(),createElementBlock(`div`,{class:normalizeClass([`m-alert m-reset-css`,[`--rounded-${__props.roundedSize}`,`--${__props.variant}`,{"--bordered":__props.bordered}]]),role:`alert`,"aria-labelledby":hasTitle.value?headingId.value:void 0,"aria-describedby":hasContent.value?contentId.value:void 0,style:normalizeStyle(colorStyles.value)},[currentIcon.value?(openBlock(),createElementBlock(`div`,_hoisted_2,[typeof currentIcon.value==`string`?(openBlock(),createBlock(unref(MazIcon),{key:0,name:currentIcon.value,size:__props.iconSize},null,8,[`name`,`size`])):(openBlock(),createBlock(unref(MazIcon),{key:1,icon:currentIcon.value,size:__props.iconSize},null,8,[`icon`,`size`]))])):createCommentVNode(``,!0),createElementVNode(`div`,_hoisted_3,[hasTitle.value?(openBlock(),createElementBlock(`p`,{key:0,id:headingId.value,class:`m-alert-title`},[renderSlot(_ctx.$slots,`title`,{},()=>[createTextVNode(toDisplayString(__props.title),1)],!0)],8,_hoisted_4)):createCommentVNode(``,!0),hasContent.value?(openBlock(),createElementBlock(`div`,{key:1,id:contentId.value,class:`m-alert-content`},[renderSlot(_ctx.$slots,`default`,{},()=>[createTextVNode(toDisplayString(__props.content),1)],!0)],8,_hoisted_5)):createCommentVNode(``,!0)])],14,_hoisted_1))}}),[[`__scopeId`,`data-v-6fe77ca9`]]);export{MazAlert_default as t};