@start-base/start-ui
Version:
<p align="center"> <a href="https://startbase.dev" target="_blank"> <img src="https://startbase.dev/apple-touch-icon.png" width="60px" style="padding-top: 60px" /> </a> </p>
1 lines • 3.68 kB
JavaScript
import*as e from"react";import t,{forwardRef as r}from"react";import n from"clsx";var l=Object.defineProperty,o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(e,t,r)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c=(e,t)=>{for(var r in t||(t={}))i.call(t,r)&&s(e,r,t[r]);if(o)for(var r of o(t))a.call(t,r)&&s(e,r,t[r]);return e},m=(e,t)=>{var r={};for(var n in e)i.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&o)for(var n of o(e))t.indexOf(n)<0&&a.call(e,n)&&(r[n]=e[n]);return r},h="SUI-Alert-module-root-iWdIE",d="SUI-Alert-module-icon-Oi33-",u="SUI-Alert-module-body-qZIZQ",v="SUI-Alert-module-title-sl4FM",w=t=>{var r=t,{size:n,width:l,height:o}=r,i=m(r,["size","width","height"]);return e.createElement("svg",c({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=n?n:l,height:null!=n?n:o},i),e.createElement("circle",{cx:"12",cy:"12",r:"10",fill:"none"}),e.createElement("path",{d:"m9 12 2 2 4-4",fill:"none",stroke:"currentColor"}))},f={success:w,info:t=>{var r=t,{size:n,width:l,height:o}=r,i=m(r,["size","width","height"]);return e.createElement("svg",c({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=n?n:l,height:null!=n?n:o},i),e.createElement("circle",{cx:12,cy:12,r:10,fill:"none"}),e.createElement("path",{d:"M12 16v-4M12 8h.01",fill:"none",stroke:"currentColor"}))},warning:t=>{var r=t,{size:n,width:l,height:o}=r,i=m(r,["size","width","height"]);return e.createElement("svg",c({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=n?n:l,height:null!=n?n:o},i),e.createElement("path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3M12 9v4M12 17h.01",fill:"none",stroke:"currentColor"}))},error:t=>{var r=t,{size:n,width:l,height:o}=r,i=m(r,["size","width","height"]);return e.createElement("svg",c({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=n?n:l,height:null!=n?n:o},i),e.createElement("circle",{cx:12,cy:12,r:10,fill:"none"}),e.createElement("path",{d:"m15 9-6 6M9 9l6 6",fill:"none",stroke:"currentColor"}))}};function p(e){var r=e,{iconName:n,icon:l,size:o}=r,i=m(r,["iconName","icon","size"]);if(!1===l)return null;const a=f[n];return a?t.createElement(a,c({size:o},i)):t.createElement(w,c({size:o},i))}var g=r((e,r)=>{const l=e,{children:o,severity:i="success",variant:a="default",color:s="inherit",actionElement:w,icon:f=!0,alertTitle:g=!1,open:E=!0,className:k="",iconClassName:N="",bodyClassName:y="",titleClassName:x="",textClassName:C=""}=l,b=m(l,["children","severity","variant","color","actionElement","icon","alertTitle","open","className","iconClassName","bodyClassName","titleClassName","textClassName"]),z=n(h,k),O=n(d,N),j=n(u,y),L=n(v,x),I=n(C),A="error"===i||"warning"===i?"assertive":"polite",M=`${a}-${"inherit"===s?i:s}`,S="boolean"==typeof f;const W=!0===g?i:"string"==typeof g?g:null;return t.createElement("div",c({className:z,ref:r,role:"alert","aria-live":A,"data-variant":M,"data-open":E},b),S?t.createElement(p,{className:O,iconName:i,icon:f,size:24}):f,t.createElement("div",{className:j},W&&t.createElement("span",{className:L},W),t.createElement("span",{className:I},o)),w&&t.createElement("div",{className:d},w))});g.displayName="Alert";var E=g;export{E as default};