@gits-id/alert
Advanced tools
Comparing version
@@ -1,1 +0,1 @@ | ||
var VAlert=function(a,e){"use strict";function f(n,o){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})])}function p(n,o){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})])}function u(n,o){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])}const m=e.createElementVNode("div",{class:"flex-grow"},null,-1),y={key:0,class:"pl-4 flex items-center"},l=e.defineComponent({__name:"VAlert",props:{modelValue:{type:Boolean,default:!0},color:{type:String,default:"default"},icon:{type:String,default:""},dismissable:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},solid:{type:Boolean,default:!1},border:{type:String,default:""}},emits:["dismissed","update:modelValue"],setup(n,{emit:o}){const t=n,{color:c,modelValue:d}=e.toRefs(t),s=e.ref(d.value);e.watch(d,r=>{s.value=r}),e.watch(s,r=>{o("update:modelValue",r)});const w=e.computed(()=>{let r={};t.outlined?r={primary:"border-primary-500 bg-transparent text-primary-500",secondary:"border-secondary-500 bg-transparent text-secondary-500",error:"border-error-500 bg-transparent text-error-500",info:"border-info-500 bg-transparent text-info-500",warning:"border-warning-500 bg-transparent text-warning-500",success:"border-success-500 bg-transparent text-success-500",dark:"border-gray-900 bg-transparent text-gray-900",default:"border-gray-500"}:t.solid?t.border?r={primary:"border-primary-400 bg-primary-500 text-white",secondary:"border-secondary-400 bg-secondary-500 text-white",error:"border-error-400 bg-error-500 text-white",info:"border-info-400 bg-info-500 text-white",warning:"border-warning-400 bg-warning-500 text-white",success:"border-success-400 bg-success-500 text-white",dark:"border-gray-500 bg-gray-900 text-white",default:"border-gray-500 bg-white"}:r={primary:"border-primary-500 bg-primary-500 text-white",secondary:"border-secondary-500 bg-secondary-500 text-white",error:"border-error-500 bg-error-500 text-white",info:"border-info-500 bg-info-500 text-white",warning:"border-warning-500 bg-warning-500 text-white",success:"border-success-500 bg-success-500 text-white",dark:"border-gray-900 bg-gray-900 text-white",default:"border-gray-500 bg-white"}:r={primary:"border-primary-500 bg-primary-100 text-primary-500",secondary:"border-secondary-500 bg-secondary-100 text-secondary-500",error:"border-error-500 bg-error-100 text-error-500",info:"border-info-500 bg-info-100 text-info-500",warning:"border-warning-500 bg-warning-100 text-warning-500",success:"border-success-500 bg-success-100 text-success-500",dark:"border-gray-900 bg-gray-900 text-white",default:"border-gray-500"};const g={top:"border-t-8",left:"border-l-8",right:"border-r-8",bottom:"border-b-8"};return[r[c.value],t.border?g[t.border]:""]}),i=e.computed(()=>{switch(c.value){case"primary":return"text-primary-500";case"secondary":return"text-secondary-500";case"error":return"text-error-500";case"info":return"text-info-500";case"warning":return"text-warning-500";case"success":return"text-success-500";default:return""}}),b=()=>{s.value=!1,o("dismissed")};return(r,g)=>(e.openBlock(),e.createBlock(e.Transition,{"enter-active-class":"duration-150 ease-out","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"duration-100 ease-in","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["px-4 py-3 border rounded-md flex w-full items-center",e.unref(w)])},[e.createElementVNode("div",null,[e.renderSlot(r.$slots,"icon",{icon:t.icon},()=>[t.icon==="warning"?(e.openBlock(),e.createBlock(e.unref(p),{key:0,class:e.normalizeClass(["w-8 h-8 mr-3",e.unref(i)])},null,8,["class"])):e.createCommentVNode("",!0),t.icon==="success"?(e.openBlock(),e.createBlock(e.unref(f),{key:1,class:e.normalizeClass(["w-8 h-8 mr-3",e.unref(i)])},null,8,["class"])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",null,[e.renderSlot(r.$slots,"default")]),m,t.dismissable?(e.openBlock(),e.createElementBlock("div",y,[e.renderSlot(r.$slots,"x-button",{dismiss:b},()=>[e.createElementVNode("button",{class:"focus:outline-none",onClick:b},[e.renderSlot(r.$slots,"x-icon",{},()=>[e.createVNode(e.unref(u),{class:"w-5 h-5"})])])])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}});return a.VAlert=l,a.default=l,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),a}({},Vue); | ||
var VAlert=function(n,e,f){"use strict";const s=(t=>t&&typeof t=="object"&&"default"in t?t:{default:t})(f),k="",m={class:"alert-content"},u={key:0,class:"alert-dismissable"},c=e.defineComponent({__name:"VAlert",props:{modelValue:{type:Boolean,default:!0},color:{type:String,default:"default"},icon:{type:String,default:""},dismissable:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},solid:{type:Boolean,default:!1},border:{type:String,default:""},transition:{type:String,default:"fade"},iconClass:{type:String,default:""}},emits:["update:modelValue","dismissed"],setup(t,{emit:r}){const o=t,{modelValue:i}=e.toRefs(o),a=e.ref(i.value);e.watch(i,l=>{a.value=l}),e.watch(a,l=>{r("update:modelValue",l)});const y=e.computed(()=>[`alert-${o.color}`,{"alert--outlined":o.outlined,"alert--solid":o.solid,"alert--bordered":o.border}]),d=()=>{a.value=!1,r("dismissed")},V={info:"heroicons:information-circle",success:"heroicons:check-circle",warning:"heroicons:exclamation-triangle",error:"heroicons:x-circle"};return(l,p)=>(e.openBlock(),e.createBlock(e.Transition,{name:t.transition},{default:e.withCtx(()=>[a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["alert",e.unref(y)])},[e.renderSlot(l.$slots,"icon",{icon:t.icon},()=>[t.icon?(e.openBlock(),e.createBlock(e.unref(s.default),{key:0,name:V[t.icon]||t.icon,class:e.normalizeClass(["alert-icon",t.iconClass])},null,8,["name","class"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",m,[e.renderSlot(l.$slots,"default")]),t.dismissable?(e.openBlock(),e.createElementBlock("div",u,[e.renderSlot(l.$slots,"x-button",{dismiss:d},()=>[e.createElementVNode("button",{class:"alert-dismissable-button","aria-label":"Close",onClick:d},[e.renderSlot(l.$slots,"x-icon",{},()=>[e.createVNode(e.unref(s.default),{name:"heroicons:x-mark",class:"alert-x-icon"})])])])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3},8,["name"]))}});return n.VAlert=c,n.default=c,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),n}({},Vue,Icon); |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");function g(a,o){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})])}function f(a,o){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})])}function p(a,o){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])}const m=e.createElementVNode("div",{class:"flex-grow"},null,-1),y={key:0,class:"pl-4 flex items-center"},u=e.defineComponent({__name:"VAlert",props:{modelValue:{type:Boolean,default:!0},color:{type:String,default:"default"},icon:{type:String,default:""},dismissable:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},solid:{type:Boolean,default:!1},border:{type:String,default:""}},emits:["dismissed","update:modelValue"],setup(a,{emit:o}){const t=a,{color:s,modelValue:l}=e.toRefs(t),n=e.ref(l.value);e.watch(l,r=>{n.value=r}),e.watch(n,r=>{o("update:modelValue",r)});const b=e.computed(()=>{let r={};t.outlined?r={primary:"border-primary-500 bg-transparent text-primary-500",secondary:"border-secondary-500 bg-transparent text-secondary-500",error:"border-error-500 bg-transparent text-error-500",info:"border-info-500 bg-transparent text-info-500",warning:"border-warning-500 bg-transparent text-warning-500",success:"border-success-500 bg-transparent text-success-500",dark:"border-gray-900 bg-transparent text-gray-900",default:"border-gray-500"}:t.solid?t.border?r={primary:"border-primary-400 bg-primary-500 text-white",secondary:"border-secondary-400 bg-secondary-500 text-white",error:"border-error-400 bg-error-500 text-white",info:"border-info-400 bg-info-500 text-white",warning:"border-warning-400 bg-warning-500 text-white",success:"border-success-400 bg-success-500 text-white",dark:"border-gray-500 bg-gray-900 text-white",default:"border-gray-500 bg-white"}:r={primary:"border-primary-500 bg-primary-500 text-white",secondary:"border-secondary-500 bg-secondary-500 text-white",error:"border-error-500 bg-error-500 text-white",info:"border-info-500 bg-info-500 text-white",warning:"border-warning-500 bg-warning-500 text-white",success:"border-success-500 bg-success-500 text-white",dark:"border-gray-900 bg-gray-900 text-white",default:"border-gray-500 bg-white"}:r={primary:"border-primary-500 bg-primary-100 text-primary-500",secondary:"border-secondary-500 bg-secondary-100 text-secondary-500",error:"border-error-500 bg-error-100 text-error-500",info:"border-info-500 bg-info-100 text-info-500",warning:"border-warning-500 bg-warning-100 text-warning-500",success:"border-success-500 bg-success-100 text-success-500",dark:"border-gray-900 bg-gray-900 text-white",default:"border-gray-500"};const i={top:"border-t-8",left:"border-l-8",right:"border-r-8",bottom:"border-b-8"};return[r[s.value],t.border?i[t.border]:""]}),c=e.computed(()=>{switch(s.value){case"primary":return"text-primary-500";case"secondary":return"text-secondary-500";case"error":return"text-error-500";case"info":return"text-info-500";case"warning":return"text-warning-500";case"success":return"text-success-500";default:return""}}),d=()=>{n.value=!1,o("dismissed")};return(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{"enter-active-class":"duration-150 ease-out","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"duration-100 ease-in","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["px-4 py-3 border rounded-md flex w-full items-center",e.unref(b)])},[e.createElementVNode("div",null,[e.renderSlot(r.$slots,"icon",{icon:t.icon},()=>[t.icon==="warning"?(e.openBlock(),e.createBlock(e.unref(f),{key:0,class:e.normalizeClass(["w-8 h-8 mr-3",e.unref(c)])},null,8,["class"])):e.createCommentVNode("",!0),t.icon==="success"?(e.openBlock(),e.createBlock(e.unref(g),{key:1,class:e.normalizeClass(["w-8 h-8 mr-3",e.unref(c)])},null,8,["class"])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",null,[e.renderSlot(r.$slots,"default")]),m,t.dismissable?(e.openBlock(),e.createElementBlock("div",y,[e.renderSlot(r.$slots,"x-button",{dismiss:d},()=>[e.createElementVNode("button",{class:"focus:outline-none",onClick:d},[e.renderSlot(r.$slots,"x-icon",{},()=>[e.createVNode(e.unref(p),{class:"w-5 h-5"})])])])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}});exports.VAlert=u;exports.default=u; | ||
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),m=require("@gits-id/icon"),f=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},c=f(m);const y={class:"alert-content"},p={key:0,class:"alert-dismissable"},i=e.defineComponent({__name:"VAlert",props:{modelValue:{type:Boolean,default:!0},color:{type:String,default:"default"},icon:{type:String,default:""},dismissable:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},solid:{type:Boolean,default:!1},border:{type:String,default:""},transition:{type:String,default:"fade"},iconClass:{type:String,default:""}},emits:["update:modelValue","dismissed"],setup(t,{emit:a}){const l=t,{modelValue:s}=e.toRefs(l),n=e.ref(s.value);e.watch(s,o=>{n.value=o}),e.watch(n,o=>{a("update:modelValue",o)});const d=e.computed(()=>[`alert-${l.color}`,{"alert--outlined":l.outlined,"alert--solid":l.solid,"alert--bordered":l.border}]),r=()=>{n.value=!1,a("dismissed")},u={info:"heroicons:information-circle",success:"heroicons:check-circle",warning:"heroicons:exclamation-triangle",error:"heroicons:x-circle"};return(o,b)=>(e.openBlock(),e.createBlock(e.Transition,{name:t.transition},{default:e.withCtx(()=>[n.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["alert",e.unref(d)])},[e.renderSlot(o.$slots,"icon",{icon:t.icon},()=>[t.icon?(e.openBlock(),e.createBlock(e.unref(c.default),{key:0,name:u[t.icon]||t.icon,class:e.normalizeClass(["alert-icon",t.iconClass])},null,8,["name","class"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",y,[e.renderSlot(o.$slots,"default")]),t.dismissable?(e.openBlock(),e.createElementBlock("div",p,[e.renderSlot(o.$slots,"x-button",{dismiss:r},()=>[e.createElementVNode("button",{class:"alert-dismissable-button","aria-label":"Close",onClick:r},[e.renderSlot(o.$slots,"x-icon",{},()=>[e.createVNode(e.unref(c.default),{name:"heroicons:x-mark",class:"alert-x-icon"})])])])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3},8,["name"]))}});exports.VAlert=i;exports.default=i; |
@@ -1,1 +0,1 @@ | ||
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.VAlert={},o.Vue))})(this,function(o,e){"use strict";function g(a,n){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z","clip-rule":"evenodd"})])}function p(a,n){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"})])}function u(a,n){return e.openBlock(),e.createBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[e.createVNode("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})])}const m=e.createElementVNode("div",{class:"flex-grow"},null,-1),y={key:0,class:"pl-4 flex items-center"},l=e.defineComponent({__name:"VAlert",props:{modelValue:{type:Boolean,default:!0},color:{type:String,default:"default"},icon:{type:String,default:""},dismissable:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},solid:{type:Boolean,default:!1},border:{type:String,default:""}},emits:["dismissed","update:modelValue"],setup(a,{emit:n}){const t=a,{color:c,modelValue:d}=e.toRefs(t),s=e.ref(d.value);e.watch(d,r=>{s.value=r}),e.watch(s,r=>{n("update:modelValue",r)});const w=e.computed(()=>{let r={};t.outlined?r={primary:"border-primary-500 bg-transparent text-primary-500",secondary:"border-secondary-500 bg-transparent text-secondary-500",error:"border-error-500 bg-transparent text-error-500",info:"border-info-500 bg-transparent text-info-500",warning:"border-warning-500 bg-transparent text-warning-500",success:"border-success-500 bg-transparent text-success-500",dark:"border-gray-900 bg-transparent text-gray-900",default:"border-gray-500"}:t.solid?t.border?r={primary:"border-primary-400 bg-primary-500 text-white",secondary:"border-secondary-400 bg-secondary-500 text-white",error:"border-error-400 bg-error-500 text-white",info:"border-info-400 bg-info-500 text-white",warning:"border-warning-400 bg-warning-500 text-white",success:"border-success-400 bg-success-500 text-white",dark:"border-gray-500 bg-gray-900 text-white",default:"border-gray-500 bg-white"}:r={primary:"border-primary-500 bg-primary-500 text-white",secondary:"border-secondary-500 bg-secondary-500 text-white",error:"border-error-500 bg-error-500 text-white",info:"border-info-500 bg-info-500 text-white",warning:"border-warning-500 bg-warning-500 text-white",success:"border-success-500 bg-success-500 text-white",dark:"border-gray-900 bg-gray-900 text-white",default:"border-gray-500 bg-white"}:r={primary:"border-primary-500 bg-primary-100 text-primary-500",secondary:"border-secondary-500 bg-secondary-100 text-secondary-500",error:"border-error-500 bg-error-100 text-error-500",info:"border-info-500 bg-info-100 text-info-500",warning:"border-warning-500 bg-warning-100 text-warning-500",success:"border-success-500 bg-success-100 text-success-500",dark:"border-gray-900 bg-gray-900 text-white",default:"border-gray-500"};const f={top:"border-t-8",left:"border-l-8",right:"border-r-8",bottom:"border-b-8"};return[r[c.value],t.border?f[t.border]:""]}),i=e.computed(()=>{switch(c.value){case"primary":return"text-primary-500";case"secondary":return"text-secondary-500";case"error":return"text-error-500";case"info":return"text-info-500";case"warning":return"text-warning-500";case"success":return"text-success-500";default:return""}}),b=()=>{s.value=!1,n("dismissed")};return(r,f)=>(e.openBlock(),e.createBlock(e.Transition,{"enter-active-class":"duration-150 ease-out","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"duration-100 ease-in","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["px-4 py-3 border rounded-md flex w-full items-center",e.unref(w)])},[e.createElementVNode("div",null,[e.renderSlot(r.$slots,"icon",{icon:t.icon},()=>[t.icon==="warning"?(e.openBlock(),e.createBlock(e.unref(p),{key:0,class:e.normalizeClass(["w-8 h-8 mr-3",e.unref(i)])},null,8,["class"])):e.createCommentVNode("",!0),t.icon==="success"?(e.openBlock(),e.createBlock(e.unref(g),{key:1,class:e.normalizeClass(["w-8 h-8 mr-3",e.unref(i)])},null,8,["class"])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",null,[e.renderSlot(r.$slots,"default")]),m,t.dismissable?(e.openBlock(),e.createElementBlock("div",y,[e.renderSlot(r.$slots,"x-button",{dismiss:b},()=>[e.createElementVNode("button",{class:"focus:outline-none",onClick:b},[e.renderSlot(r.$slots,"x-icon",{},()=>[e.createVNode(e.unref(u),{class:"w-5 h-5"})])])])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3}))}});o.VAlert=l,o.default=l,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@gits-id/icon")):typeof define=="function"&&define.amd?define(["exports","vue","@gits-id/icon"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.VAlert={},o.Vue,o.Icon))})(this,function(o,e,f){"use strict";const s=(t=>t&&typeof t=="object"&&"default"in t?t:{default:t})(f),V="",m={class:"alert-content"},u={key:0,class:"alert-dismissable"},i=e.defineComponent({__name:"VAlert",props:{modelValue:{type:Boolean,default:!0},color:{type:String,default:"default"},icon:{type:String,default:""},dismissable:{type:Boolean,default:!1},outlined:{type:Boolean,default:!1},solid:{type:Boolean,default:!1},border:{type:String,default:""},transition:{type:String,default:"fade"},iconClass:{type:String,default:""}},emits:["update:modelValue","dismissed"],setup(t,{emit:c}){const l=t,{modelValue:r}=e.toRefs(l),a=e.ref(r.value);e.watch(r,n=>{a.value=n}),e.watch(a,n=>{c("update:modelValue",n)});const p=e.computed(()=>[`alert-${l.color}`,{"alert--outlined":l.outlined,"alert--solid":l.solid,"alert--bordered":l.border}]),d=()=>{a.value=!1,c("dismissed")},y={info:"heroicons:information-circle",success:"heroicons:check-circle",warning:"heroicons:exclamation-triangle",error:"heroicons:x-circle"};return(n,k)=>(e.openBlock(),e.createBlock(e.Transition,{name:t.transition},{default:e.withCtx(()=>[a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["alert",e.unref(p)])},[e.renderSlot(n.$slots,"icon",{icon:t.icon},()=>[t.icon?(e.openBlock(),e.createBlock(e.unref(s.default),{key:0,name:y[t.icon]||t.icon,class:e.normalizeClass(["alert-icon",t.iconClass])},null,8,["name","class"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",m,[e.renderSlot(n.$slots,"default")]),t.dismissable?(e.openBlock(),e.createElementBlock("div",u,[e.renderSlot(n.$slots,"x-button",{dismiss:d},()=>[e.createElementVNode("button",{class:"alert-dismissable-button","aria-label":"Close",onClick:d},[e.renderSlot(n.$slots,"x-icon",{},()=>[e.createVNode(e.unref(s.default),{name:"heroicons:x-mark",class:"alert-x-icon"})])])])])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)]),_:3},8,["name"]))}});o.VAlert=i,o.default=i,Object.defineProperties(o,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -13,2 +13,4 @@ declare const _default: { | ||
border: string; | ||
transition: string; | ||
iconClass: string; | ||
}> & Omit<Readonly<import("vue").ExtractPropTypes<{ | ||
@@ -43,6 +45,14 @@ modelValue: { | ||
}; | ||
transition: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
iconClass: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
}>> & { | ||
onDismissed?: ((...args: any[]) => any) | undefined; | ||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; | ||
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "modelValue" | "color" | "icon" | "dismissable" | "outlined" | "solid" | "border">; | ||
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined; | ||
onDismissed?: (() => any) | undefined; | ||
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "modelValue" | "color" | "icon" | "dismissable" | "outlined" | "solid" | "border" | "transition" | "iconClass">; | ||
$attrs: { | ||
@@ -59,3 +69,3 @@ [x: string]: unknown; | ||
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}>> | null; | ||
$emit: (event: "dismissed" | "update:modelValue", ...args: any[]) => void; | ||
$emit: ((event: "update:modelValue", value: boolean) => void) & ((event: "dismissed") => void); | ||
$el: any; | ||
@@ -91,6 +101,18 @@ $options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{ | ||
}; | ||
transition: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
iconClass: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
}>> & { | ||
onDismissed?: ((...args: any[]) => any) | undefined; | ||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("dismissed" | "update:modelValue")[], string, { | ||
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined; | ||
onDismissed?: (() => any) | undefined; | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { | ||
"update:modelValue": (value: boolean) => void; | ||
} & { | ||
dismissed: () => void; | ||
}, string, { | ||
modelValue: boolean; | ||
@@ -103,2 +125,4 @@ color: string; | ||
border: string; | ||
transition: string; | ||
iconClass: string; | ||
}> & { | ||
@@ -153,5 +177,13 @@ beforeCreate?: ((() => void) | (() => void)[]) | undefined; | ||
}; | ||
transition: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
iconClass: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
}>> & { | ||
onDismissed?: ((...args: any[]) => any) | undefined; | ||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; | ||
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined; | ||
onDismissed?: (() => any) | undefined; | ||
} & import("vue").ShallowUnwrapRef<{}> & {} & import("vue").ComponentCustomProperties; | ||
@@ -190,6 +222,18 @@ __isFragment?: undefined; | ||
}; | ||
transition: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
iconClass: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
}>> & { | ||
onDismissed?: ((...args: any[]) => any) | undefined; | ||
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined; | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("dismissed" | "update:modelValue")[], "dismissed" | "update:modelValue", { | ||
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined; | ||
onDismissed?: (() => any) | undefined; | ||
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, { | ||
"update:modelValue": (value: boolean) => void; | ||
} & { | ||
dismissed: () => void; | ||
}, string, { | ||
modelValue: boolean; | ||
@@ -202,2 +246,4 @@ color: string; | ||
border: string; | ||
transition: string; | ||
iconClass: string; | ||
}> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => { | ||
@@ -204,0 +250,0 @@ $slots: typeof import('./VAlert.vue.__VLS_template').default; |
{ | ||
"name": "@gits-id/alert", | ||
"version": "0.11.10", | ||
"version": "0.11.11-alpha.0", | ||
"description": "GITS Alert Component", | ||
@@ -15,7 +15,8 @@ "scripts": { | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"author": "Warsono <warsono16694@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@gits-id/icon": "^0.11.10", | ||
"@gits-id/theme": "^0.11.10", | ||
"@gits-id/utils": "^0.11.10", | ||
"@heroicons/vue": "^1.0.6", | ||
"vue": "^3.2.33" | ||
@@ -32,3 +33,3 @@ }, | ||
}, | ||
"gitHead": "73e3452946775714e36592e956ecd52858dffd48", | ||
"gitHead": "99eba5d7433ce4e843c57737c447b2adc3b06a0c", | ||
"main": "dist/alert.umd.js", | ||
@@ -35,0 +36,0 @@ "unpkg": "dist/alert.iife.js", |
# GITS Alert Component | ||
> Alert Component | ||
## Installation | ||
npm | ||
via npm | ||
@@ -13,3 +11,3 @@ ``` | ||
yarn | ||
via yarn | ||
@@ -20,3 +18,3 @@ ``` | ||
pnpm | ||
via pnpm | ||
@@ -33,3 +31,6 @@ ``` | ||
<script setup lang="ts"> | ||
// import component | ||
import Alert from '@gits-id/alert'; | ||
// import styles | ||
import '@gits-id/alert/dist/style.css'; | ||
</script> | ||
@@ -44,3 +45,3 @@ | ||
View `Alert` documentation [here](https://gits-ui.web.app/?path=/story/components-alert--default). | ||
View full documentation [here](https://gitsindonesia.github.io/ui-component/components/alert). | ||
@@ -47,0 +48,0 @@ ## License |
import VAlert from './VAlert.vue'; | ||
import {themeColors} from '@gits-id/utils/colors'; | ||
import {Meta, Story} from '@storybook/vue3'; | ||
import {InformationCircleIcon, XCircleIcon} from '@heroicons/vue/outline'; | ||
import Icon from '@gits-id/icon'; | ||
@@ -75,2 +75,26 @@ export default { | ||
export const Outlined = Template.bind({}); | ||
Outlined.args = { | ||
outlined: true, | ||
}; | ||
Outlined.parameters = { | ||
docs: { | ||
source: { | ||
code: `<v-alert solid>Alert text</v-alert>`, | ||
}, | ||
}, | ||
}; | ||
export const Bordered = Template.bind({}); | ||
Bordered.args = { | ||
border: true, | ||
}; | ||
Bordered.parameters = { | ||
docs: { | ||
source: { | ||
code: `<v-alert border>Alert text</v-alert>`, | ||
}, | ||
}, | ||
}; | ||
export const Dismissable = Template.bind({}); | ||
@@ -88,7 +112,7 @@ Dismissable.args = { | ||
export const Icon = Template.bind({}); | ||
Icon.args = { | ||
export const Icons = Template.bind({}); | ||
Icons.args = { | ||
icon: 'success', | ||
}; | ||
Icon.parameters = { | ||
Icons.parameters = { | ||
docs: { | ||
@@ -102,10 +126,10 @@ source: { | ||
export const CustomSlots = () => ({ | ||
components: {VAlert, InformationCircleIcon, XCircleIcon}, | ||
components: {VAlert, Icon}, | ||
template: ` | ||
<v-alert color="error" dismissable> | ||
<template #icon> | ||
<InformationCircleIcon class="fill-current w-6 h-6 mr-2" /> | ||
<Icon name="ri:alarm-warning-fill" class="fill-current w-6 h-6 mr-2" /> | ||
</template> | ||
<template #x-icon> | ||
<XCircleIcon class="fill-current w-6 h-6 text-error-500" /> | ||
<Icon name="ri:close-fill" class="fill-current w-6 h-6 text-error-500" /> | ||
</template> | ||
@@ -122,6 +146,6 @@ | ||
<template #icon> | ||
<InformationCircleIcon class="fill-current w-6 h-6 mr-2" /> | ||
<Icon name="ri:alarm-warning-fill" class="fill-current w-6 h-6 mr-2" /> | ||
</template> | ||
<template #x-icon> | ||
<XCircleIcon class="fill-current w-6 h-6 text-error-500" /> | ||
<Icon name="ri:close-fill" class="fill-current w-6 h-6 text-error-500" /> | ||
</template> | ||
@@ -128,0 +152,0 @@ |
@@ -7,5 +7,3 @@ import {defineConfig} from 'vite'; | ||
export default defineConfig({ | ||
plugins: [ | ||
vue(), | ||
], | ||
plugins: [vue()], | ||
esbuild: { | ||
@@ -24,3 +22,3 @@ exclude: ['./src/**/**.stories.ts'], | ||
// into your library | ||
external: ['vue', '@heroicons/vue', '@gits-id/utils'], | ||
external: ['vue', '@gits-id/icon', '@gits-id/utils'], | ||
output: { | ||
@@ -30,7 +28,7 @@ // Provide global variables to use in the UMD build | ||
globals: { | ||
vue: 'Vue' | ||
} | ||
vue: 'Vue', | ||
}, | ||
}, | ||
resolve: { | ||
dedupe: "vue" | ||
dedupe: 'vue', | ||
}, | ||
@@ -37,0 +35,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
21
5%1
-50%47
2.17%38962
-16.84%4
33.33%631
-7.75%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed