@cypress-design/vue-alert 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(e,a){typeof exports=="object"&&typeof module<"u"?module.exports=a(require("vue"),require("@cypress-design/icon-registry")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/icon-registry"],a):(e=typeof globalThis<"u"?globalThis:e||self,e.Alert=a(e.Vue,e.IconRegistry))})(this,function(e,a){"use strict";function b(o){if(o&&o.__esModule)return o;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const r in o)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(o,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>o[r]})}}return t.default=o,Object.freeze(t)}const m=b(a),p=({body:o,compiledClasses:t,size:r,class:s,interactiveColorsOnGroup:c,...n})=>{const l=Object.keys(n).reduce((i,d)=>(a.ICON_COLOR_PROP_NAMES.includes(d)||(i[d]=n[d]),i),{}),C={width:r,height:r,fill:"none",innerHTML:o,...l};return t.length&&(C.class=t.join(" ")),C},y=o=>{const{sizeWithDefault:t,compiledClasses:r}=m.getComponentAttributes({...o,availableSizes:["16"]}),s={16:'<path d="M3 13 13 3M3 3l10 10" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}[t];if(!s)throw Error(`Icon "action-delete-large" is not available in size ${t}`);return e.h("svg",p({...o,size:t,body:s,compiledClasses:r}))},h=o=>{const{sizeWithDefault:t,compiledClasses:r}=m.getComponentAttributes({...o,availableSizes:["16"]}),s={16:'<path d="M12.95 12.95a7 7 0 1 1-9.9-9.9 7 7 0 0 1 9.9 9.9Z" stroke="currentColor" stroke-width="2" class="icon-dark"/><path d="m6 8 1.5 2L10 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon-dark"/>'}[t];if(!s)throw Error(`Icon "checkmark-outline" is not available in size ${t}`);return e.h("svg",p({...o,size:t,body:s,compiledClasses:r}))},k=o=>{const{sizeWithDefault:t,compiledClasses:r}=m.getComponentAttributes({...o,availableSizes:["8","16"]}),s={8:'<path d="m1 2.5 3 3 3-3" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',16:'<path d="m4 6 4 4 4-4" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}[t];if(!s)throw Error(`Icon "chevron-down-small" is not available in size ${t}`);return e.h("svg",p({...o,size:t,body:s,compiledClasses:r}))},f=o=>{const{sizeWithDefault:t,compiledClasses:r}=m.getComponentAttributes({...o,availableSizes:["16"]}),s={16:'<path fill-rule="evenodd" clip-rule="evenodd" d="M2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Zm6-8a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm1 5a1 1 0 0 0-2 0v3a1 1 0 0 0 2 0V5Zm-1 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" fill="currentColor" class="icon-dark"/>'}[t];if(!s)throw Error(`Icon "warning-circle" is not available in size ${t}`);return e.h("svg",p({...o,size:t,body:s,compiledClasses:r}))},g={neutral:{headerClass:"text-gray-800 bg-gray-100",bodyClass:"bg-gray-50 text-gray-500",borderClass:"border-gray-100",detailsHeaderClass:"text-gray-600",iconCloseColor:"gray-600",iconColor:"gray-500",iconChevronColor:"gray-300"},info:{headerClass:"text-indigo-700 bg-indigo-100",bodyClass:"bg-indigo-50 text-indigo-500",borderClass:"border-indigo-100",detailsHeaderClass:"text-indigo-600",iconCloseColor:"indigo-500",iconColor:"indigo-500",iconChevronColor:"indigo-300"},warning:{headerClass:"text-orange-700 bg-orange-100",bodyClass:"bg-orange-50 text-orange-500",borderClass:"border-orange-100",detailsHeaderClass:"text-orange-600",iconCloseColor:"orange-500",iconColor:"orange-400",iconChevronColor:"orange-300"},error:{headerClass:"text-red-700 bg-red-100",bodyClass:"bg-red-50 text-red-500",borderClass:"border-red-100",detailsHeaderClass:"text-red-600",iconCloseColor:"red-500",iconColor:"red-400",iconChevronColor:"red-300"},success:{headerClass:"text-jade-700 bg-jade-100",bodyClass:"bg-jade-50 text-jade-600",borderClass:"border-jade-100",detailsHeaderClass:"text-jade-600",iconCloseColor:"jade-600",iconColor:"jade-500",iconChevronColor:"jade-300"}},j="",x=(o,t)=>{const r=o.__vccOpts||o;for(const[s,c]of t)r[s]=c;return r},_={class:"flex-1 font-medium"},z={class:"mt-16px"};return x(e.defineComponent({__name:"Alert",props:{type:{default:"info"},detailsTitle:{default:"Additional details"},dismissible:{type:Boolean},noIcon:{type:Boolean},notRounded:{type:Boolean},duration:null},emits:["dismiss"],setup(o,{emit:t}){const r=o,s=e.ref(!1),c=e.useSlots(),n=e.computed(()=>g[r.type]);let l;e.onMounted(()=>{r.duration&&(l=setTimeout(C,r.duration))}),e.onUnmounted(()=>{l&&clearTimeout(l)});function C(){s.value=!0,t("dismiss"),l&&(clearTimeout(l),l=void 0)}const i=e.computed(()=>({strokeColor:g[r.type].iconColor,class:"my-4px mr-8px"})),d=e.computed(()=>{switch(r.type){case"info":return null;case"success":return()=>e.h(h,i.value);case"warning":return()=>e.h(f,i.value);case"error":return()=>e.h(f,i.value);default:return null}});return(u,V)=>s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["overflow-hidden text-left",r.notRounded?void 0:"rounded"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex p-16px",e.unref(n).headerClass])},[e.renderSlot(u.$slots,"icon",e.normalizeProps(e.guardReactiveProps(e.unref(i))),()=>[!r.noIcon&&e.unref(d)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(d)),e.normalizeProps(e.mergeProps({key:0},e.unref(i))),null,16)):e.createCommentVNode("",!0)],!0),e.createElementVNode("div",_,[e.renderSlot(u.$slots,"default",{},void 0,!0)]),o.dismissible?(e.openBlock(),e.createElementBlock("button",{key:0,class:"m-4px ml-8px h-16px",onClick:C,"aria-label":"Dismiss"},[e.createVNode(e.unref(y),{"stroke-color":e.unref(n).iconCloseColor},null,8,["stroke-color"])])):e.createCommentVNode("",!0)],2),e.unref(c).body?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-16px",e.unref(n).bodyClass])},[e.renderSlot(u.$slots,"body",{},void 0,!0)],2)):e.createCommentVNode("",!0),e.unref(c).details?(e.openBlock(),e.createElementBlock("details",{key:1,class:e.normalizeClass(["p-16px border-t-1",[e.unref(n).bodyClass,e.unref(n).borderClass]])},[e.createElementVNode("summary",{class:e.normalizeClass(["flex font-medium cursor-pointer",e.unref(n).detailsHeaderClass])},[e.createVNode(e.unref(k),{strokeColor:e.unref(n).iconChevronColor,class:"icon my-4px mr-8px"},null,8,["strokeColor"]),e.createTextVNode(" "+e.toDisplayString(r.detailsTitle),1)],2),e.createElementVNode("div",z,[e.renderSlot(u.$slots,"details",{},void 0,!0)])],2)):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-5e7e1d8e"]])});
1
+ (function(e,i){typeof exports=="object"&&typeof module<"u"?module.exports=i(require("vue"),require("@cypress-design/icon-registry"),require("@cypress-design/details-animation")):typeof define=="function"&&define.amd?define(["vue","@cypress-design/icon-registry","@cypress-design/details-animation"],i):(e=typeof globalThis<"u"?globalThis:e||self,e.Alert=i(e.Vue,e.CyIconRegistry,e.CyDetailsAnimation))})(this,function(e,i,h){"use strict";function k(o){if(o&&o.__esModule)return o;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const t in o)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(o,t);Object.defineProperty(r,t,s.get?s:{enumerable:!0,get:()=>o[t]})}}return r.default=o,Object.freeze(r)}const m=k(i),p=({body:o,compiledClasses:r,size:t,class:s,interactiveColorsOnGroup:u,...a})=>{const c=Object.keys(a).reduce((l,d)=>(i.ICON_COLOR_PROP_NAMES.includes(d)||(l[d]=a[d]),l),{}),n={width:t,height:t,fill:"none",innerHTML:o,...c};return r.length&&(n.class=r.join(" ")),n},x=o=>{const{sizeWithDefault:r,compiledClasses:t}=m.getComponentAttributes({...o,availableSizes:["16"]}),s={16:'<path d="M3 13 13 3M3 3l10 10" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}[r];if(!s)throw Error(`Icon "action-delete-large" is not available in size ${r}`);return e.h("svg",p({...o,size:r,body:s,compiledClasses:t}))},z=o=>{const{sizeWithDefault:r,compiledClasses:t}=m.getComponentAttributes({...o,availableSizes:["16"]}),s={16:'<path d="M12.95 12.95a7 7 0 1 1-9.9-9.9 7 7 0 0 1 9.9 9.9Z" stroke="currentColor" stroke-width="2" class="icon-dark"/><path d="m6 8 1.5 2L10 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon-dark"/>'}[r];if(!s)throw Error(`Icon "checkmark-outline" is not available in size ${r}`);return e.h("svg",p({...o,size:r,body:s,compiledClasses:t}))},j=o=>{const{sizeWithDefault:r,compiledClasses:t}=m.getComponentAttributes({...o,availableSizes:["8","16"]}),s={8:'<path d="m1 2.5 3 3 3-3" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>',16:'<path d="m4 6 4 4 4-4" stroke="currentColor" class="icon-dark" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'}[r];if(!s)throw Error(`Icon "chevron-down-small" is not available in size ${r}`);return e.h("svg",p({...o,size:r,body:s,compiledClasses:t}))},g=o=>{const{sizeWithDefault:r,compiledClasses:t}=m.getComponentAttributes({...o,availableSizes:["16"]}),s={16:'<path fill-rule="evenodd" clip-rule="evenodd" d="M2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Zm6-8a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm1 5a1 1 0 0 0-2 0v3a1 1 0 0 0 2 0V5Zm-1 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" fill="currentColor" class="icon-dark"/>'}[r];if(!s)throw Error(`Icon "warning-circle" is not available in size ${r}`);return e.h("svg",p({...o,size:r,body:s,compiledClasses:t}))},y={neutral:{headerClass:"text-gray-800 bg-gray-100",bodyClass:"bg-gray-50 text-gray-500",borderClass:"border-gray-100",detailsHeaderClass:"text-gray-600",iconCloseColor:"gray-600",iconColor:"gray-500",iconChevronColor:"gray-300"},info:{headerClass:"text-indigo-700 bg-indigo-100",bodyClass:"bg-indigo-50 text-indigo-500",borderClass:"border-indigo-100",detailsHeaderClass:"text-indigo-600",iconCloseColor:"indigo-500",iconColor:"indigo-500",iconChevronColor:"indigo-300"},warning:{headerClass:"text-orange-700 bg-orange-100",bodyClass:"bg-orange-50 text-orange-500",borderClass:"border-orange-100",detailsHeaderClass:"text-orange-600",iconCloseColor:"orange-500",iconColor:"orange-400",iconChevronColor:"orange-300"},error:{headerClass:"text-red-700 bg-red-100",bodyClass:"bg-red-50 text-red-500",borderClass:"border-red-100",detailsHeaderClass:"text-red-600",iconCloseColor:"red-500",iconColor:"red-400",iconChevronColor:"red-300"},success:{headerClass:"text-jade-700 bg-jade-100",bodyClass:"bg-jade-50 text-jade-600",borderClass:"border-jade-100",detailsHeaderClass:"text-jade-600",iconCloseColor:"jade-600",iconColor:"jade-500",iconChevronColor:"jade-300"}},w={class:"flex-1 font-medium"},N={class:"mt-16px"};return e.defineComponent({__name:"Alert",props:{type:{default:"info"},detailsTitle:{default:"Additional details"},dismissible:{type:Boolean},noIcon:{type:Boolean},notRounded:{type:Boolean},duration:null},emits:["dismiss"],setup(o,{emit:r}){const t=o,s=e.ref(!1),u=e.useSlots(),a=e.ref(null),c=e.ref(null),n=e.computed(()=>y[t.type]);let l;e.onMounted(()=>{t.duration&&(l=setTimeout(d,t.duration))}),e.onMounted(()=>{a.value&&c.value&&new h.DetailsAnimation(a.value,c.value)}),e.onUnmounted(()=>{l&&clearTimeout(l)});function d(){s.value=!0,r("dismiss"),l&&(clearTimeout(l),l=void 0)}const C=e.computed(()=>({strokeColor:y[t.type].iconColor,class:"my-4px mr-8px"})),b=e.computed(()=>{switch(t.type){case"info":return null;case"success":return()=>e.h(z,C.value);case"warning":return()=>e.h(g,C.value);case"error":return()=>e.h(g,C.value);default:return null}});return(f,V)=>s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["overflow-hidden text-left",t.notRounded?void 0:"rounded"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex p-16px",e.unref(n).headerClass])},[e.renderSlot(f.$slots,"icon",e.normalizeProps(e.guardReactiveProps(e.unref(C))),()=>[!t.noIcon&&e.unref(b)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(b)),e.normalizeProps(e.mergeProps({key:0},e.unref(C))),null,16)):e.createCommentVNode("",!0)]),e.createElementVNode("div",w,[e.renderSlot(f.$slots,"default")]),o.dismissible?(e.openBlock(),e.createElementBlock("button",{key:0,class:"m-4px ml-8px h-16px",onClick:d,"aria-label":"Dismiss"},[e.createVNode(e.unref(x),{"stroke-color":e.unref(n).iconCloseColor},null,8,["stroke-color"])])):e.createCommentVNode("",!0)],2),e.unref(u).body?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-16px",e.unref(n).bodyClass])},[e.renderSlot(f.$slots,"body")],2)):e.createCommentVNode("",!0),e.unref(u).details?(e.openBlock(),e.createElementBlock("details",{key:1,class:e.normalizeClass(["p-16px border-t-1",[e.unref(n).bodyClass,e.unref(n).borderClass]]),ref_key:"detailsRef",ref:a},[e.createElementVNode("summary",{class:e.normalizeClass(["flex font-medium cursor-pointer details-none",e.unref(n).detailsHeaderClass])},[e.createVNode(e.unref(j),{strokeColor:e.unref(n).iconChevronColor,class:"icon my-4px mr-8px transition transform -rotate-90 open:rotate-0"},null,8,["strokeColor"]),e.createTextVNode(" "+e.toDisplayString(t.detailsTitle),1)],2),e.createElementVNode("div",{ref_key:"contentRef",ref:c},[e.createElementVNode("div",N,[e.renderSlot(f.$slots,"details")])],512)],2)):e.createCommentVNode("",!0)],2))}})});
2
2
 
3
- /* <windicss-keep class="overflow-hidden text-left rounded flex p-16px flex-1 font-medium m-4px ml-8px h-16px border-t-1 cursor-pointer my-4px mr-8px mt-16px transform text-gray-800 bg-gray-100 bg-gray-50 text-gray-500 border-gray-100 text-gray-600 text-indigo-700 bg-indigo-100 bg-indigo-50 text-indigo-500 border-indigo-100 text-indigo-600 text-orange-700 bg-orange-100 bg-orange-50 text-orange-500 border-orange-100 text-orange-600 text-red-700 bg-red-100 bg-red-50 text-red-500 border-red-100 text-red-600 text-jade-700 bg-jade-100 bg-jade-50 text-jade-600 border-jade-100 icon-dark-gray-600 icon-dark-gray-500 icon-dark-gray-300 icon-dark-indigo-500 icon-dark-indigo-300 icon-dark-orange-500 icon-dark-orange-400 icon-dark-orange-300 icon-dark-red-500 icon-dark-red-400 icon-dark-red-300 icon-dark-jade-600 icon-dark-jade-500 icon-dark-jade-300"> */
3
+ /* <windicss-keep class="overflow-hidden text-left rounded flex p-16px flex-1 font-medium m-4px ml-8px h-16px border-t-1 cursor-pointer details-none my-4px mr-8px transition transform -rotate-90 open:rotate-0 mt-16px text-gray-800 bg-gray-100 bg-gray-50 text-gray-500 border-gray-100 text-gray-600 text-indigo-700 bg-indigo-100 bg-indigo-50 text-indigo-500 border-indigo-100 text-indigo-600 text-orange-700 bg-orange-100 bg-orange-50 text-orange-500 border-orange-100 text-orange-600 text-red-700 bg-red-100 bg-red-50 text-red-500 border-red-100 text-red-600 text-jade-700 bg-jade-100 bg-jade-50 text-jade-600 border-jade-100 icon-dark-gray-600 icon-dark-gray-500 icon-dark-gray-300 icon-dark-indigo-500 icon-dark-indigo-300 icon-dark-orange-500 icon-dark-orange-400 icon-dark-orange-300 icon-dark-red-500 icon-dark-red-400 icon-dark-red-300 icon-dark-jade-600 icon-dark-jade-500 icon-dark-jade-300"> */
4
4
  //# sourceMappingURL=index.umd.js.map