UNPKG

@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 4.12 kB
"use strict";var e=require("react"),t=require("clsx");function r(e){return e&&e.__esModule?e:{default:e}}function l(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var l=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,l.get?l:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,Object.freeze(t)}var n=l(e),o=r(t),a=Object.defineProperty,i=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable,u=(e,t,r)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,d=(e,t)=>{for(var r in t||(t={}))s.call(t,r)&&u(e,r,t[r]);if(i)for(var r of i(t))c.call(t,r)&&u(e,r,t[r]);return e},f=(e,t)=>{var r={};for(var l in e)s.call(e,l)&&t.indexOf(l)<0&&(r[l]=e[l]);if(null!=e&&i)for(var l of i(e))t.indexOf(l)<0&&c.call(e,l)&&(r[l]=e[l]);return r},h="SUI-Alert-module-root-iWdIE",m="SUI-Alert-module-icon-Oi33-",v="SUI-Alert-module-body-qZIZQ",w="SUI-Alert-module-title-sl4FM",p=e=>{var t=e,{size:r,width:l,height:o}=t,a=f(t,["size","width","height"]);return n.createElement("svg",d({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=r?r:l,height:null!=r?r:o},a),n.createElement("circle",{cx:"12",cy:"12",r:"10",fill:"none"}),n.createElement("path",{d:"m9 12 2 2 4-4",fill:"none",stroke:"currentColor"}))},g={success:p,info:e=>{var t=e,{size:r,width:l,height:o}=t,a=f(t,["size","width","height"]);return n.createElement("svg",d({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=r?r:l,height:null!=r?r:o},a),n.createElement("circle",{cx:12,cy:12,r:10,fill:"none"}),n.createElement("path",{d:"M12 16v-4M12 8h.01",fill:"none",stroke:"currentColor"}))},warning:e=>{var t=e,{size:r,width:l,height:o}=t,a=f(t,["size","width","height"]);return n.createElement("svg",d({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=r?r:l,height:null!=r?r:o},a),n.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:e=>{var t=e,{size:r,width:l,height:o}=t,a=f(t,["size","width","height"]);return n.createElement("svg",d({xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:null!=r?r:l,height:null!=r?r:o},a),n.createElement("circle",{cx:12,cy:12,r:10,fill:"none"}),n.createElement("path",{d:"m15 9-6 6M9 9l6 6",fill:"none",stroke:"currentColor"}))}};function E(e){var t=e,{iconName:r,icon:l,size:o}=t,a=f(t,["iconName","icon","size"]);if(!1===l)return null;const i=g[r];return i?n.default.createElement(i,d({size:o},a)):n.default.createElement(p,d({size:o},a))}var k=e.forwardRef((e,t)=>{const r=e,{children:l,severity:a="success",variant:i="default",color:s="inherit",actionElement:c,icon:u=!0,alertTitle:p=!1,open:g=!0,className:k="",iconClassName:y="",bodyClassName:N="",titleClassName:b="",textClassName:x=""}=r,C=f(r,["children","severity","variant","color","actionElement","icon","alertTitle","open","className","iconClassName","bodyClassName","titleClassName","textClassName"]),O=o.default(h,k),z=o.default(m,y),j=o.default(v,N),L=o.default(w,b),M=o.default(x),I="error"===a||"warning"===a?"assertive":"polite",A=`${i}-${"inherit"===s?a:s}`,P="boolean"==typeof u;const S=!0===p?a:"string"==typeof p?p:null;return n.default.createElement("div",d({className:O,ref:t,role:"alert","aria-live":I,"data-variant":A,"data-open":g},C),P?n.default.createElement(E,{className:z,iconName:a,icon:u,size:24}):u,n.default.createElement("div",{className:j},S&&n.default.createElement("span",{className:L},S),n.default.createElement("span",{className:M},l)),c&&n.default.createElement("div",{className:m},c))});k.displayName="Alert";var y=k;module.exports=y;