@tuwaio/nova-core 0.2.3 → 0.2.5
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.cjs +3 -3
- package/dist/index.css +21 -0
- package/dist/index.d.cts +133 -2
- package/dist/index.d.ts +133 -2
- package/dist/index.js +3 -3
- package/package.json +6 -3
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var framerMotion=require('framer-motion'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime'),l=require('react'),
|
|
1
|
+
'use strict';var framerMotion=require('framer-motion'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),metadata=require('@web3icons/common/metadata'),jsxRuntime=require('react/jsx-runtime'),l=require('react'),s=require('@radix-ui/react-dialog');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var l__namespace=/*#__PURE__*/_interopNamespace(l);var s__namespace=/*#__PURE__*/_interopNamespace(s);var po="novacore:cursor-pointer novacore:rounded-md novacore:bg-[var(--tuwa-standart-button-bg)] novacore:px-3 novacore:py-2 novacore:flex novacore:items-center novacore:gap-1 novacore:text-sm novacore:font-semibold novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors novacore:hover:bg-[var(--tuwa-standart-button-hover)] novacore:disabled:cursor-not-allowed novacore:disabled:opacity-50";function i(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var g=o=>o&&typeof o=="object"&&!Array.isArray(o);function z(o,e){let t={...o};return g(o)&&g(e)&&Object.keys(e).forEach(n=>{let a=o[n],r=e[n];g(a)&&g(r)?t[n]=z(a,r):t[n]=r;}),t}function w(o){if(typeof o!="string")return false;let e=o.toLowerCase();return e.includes("solana")&&(e.includes("devnet")||e.includes("testnet"))}var k="Unknown";function C(o){if(typeof o=="number")return metadata.networks.find(a=>a.chainId===o)?.name??k;let[e,t]=o.split(":"),n=metadata.networks.find(a=>a.id===e);if(!n)return k;if(t&&w(o)){let a=t.charAt(0).toUpperCase()+t.slice(1).toLowerCase();return `${n.name} ${a}`}return n.name}function D(o=1200){if(typeof window>"u")return false;let e="ontouchstart"in window,t=navigator.maxTouchPoints>0,n=false;window.matchMedia&&(n=window.matchMedia("(pointer: coarse)").matches);let a=e||t||n,r=window.innerWidth<=o;return a&&r}function Do(o,e,t){if(!o)return "";if(o.length<=e+t)return o;let n=o.slice(0,e),a=o.slice(o.length-t);return `${n}...${a}`}function Vo({className:o,strokeWidth:e,isOpen:t}){return jsxRuntime.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:e??2,stroke:"currentColor",className:i("novacore:w-4 novacore:h-4 novacore:text-[var(--tuwa-text-secondary)]",o),children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{children:t&&jsxRuntime.jsx(framerMotion.motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5",variants:{hidden:{translateY:3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:!t&&jsxRuntime.jsx(framerMotion.motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5",className:"novacore:relative",variants:{hidden:{translateY:-3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})})]})}var B=l__namespace.forwardRef(({className:o,...e},t)=>jsxRuntime.jsxs("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:i("novacore:h-5 novacore:w-5 novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors",o),...e,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}));B.displayName="CloseIcon";var O="flex items-center justify-center novacore:w-full novacore:h-full novacore:rounded-full novacore:text-[var(--tuwa-text-secondary)] novacore:bg-[var(--tuwa-bg-muted)]",d=({animate:o=false,content:e="",className:t})=>jsxRuntime.jsx("div",{className:i(O,"Nova_Web3_Icon",t,{"novacore:animate-pulse":o}),children:e});var Uo=s__namespace.Root,Qo=s__namespace.Trigger,_=s__namespace.Portal,Jo=s__namespace.Close,Y={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},$={initial:{opacity:0,y:"100%"},animate:{opacity:1,y:"0%"},exit:{opacity:0,y:"100%",transition:{duration:.2}}},q={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},L=({className:o,backdropAnimation:e})=>(l__namespace.useEffect(()=>(typeof window<"u"&&window.document.body.classList.add("NovaModalOpen"),()=>{typeof window<"u"&&window.document.body.classList.remove("NovaModalOpen");}),[]),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:e??q,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"novacore:relative novacore:overflow-hidden",children:jsxRuntime.jsx("div",{className:i("novacore:fixed novacore:inset-0 novacore:z-50 novacore:bg-black/55 novacore:backdrop-blur-sm novacore:backdrop-saturate-150",o)})})}));L.displayName=s__namespace.Overlay.displayName;var G=l__namespace.forwardRef(({className:o,children:e,modalAnimation:t,backdropAnimation:n,...a},r)=>{let[u,m]=l__namespace.useState(false);l__namespace.useEffect(()=>{m(D());},[]);let f=t??(u?$:Y);return jsxRuntime.jsxs(_,{children:[jsxRuntime.jsx(L,{backdropAnimation:n}),jsxRuntime.jsx(s__namespace.Content,{"aria-describedby":"tuwa:modal-content",ref:r,className:i("NovaNoScrolling novacore:fixed novacore:bottom-0 novacore:left-0 novacore:p-0 novacore:sm:bottom-auto novacore:sm:left-[50%] novacore:sm:top-[50%] novacore:sm:translate-x-[-50%] novacore:sm:translate-y-[-50%] novacore:z-50 novacore:sm:p-4 novacore:outline-none",o),...a,children:jsxRuntime.jsx(framerMotion.motion.div,{layout:true,className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{variants:f,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",children:jsxRuntime.jsx("div",{className:i("NovaNoScrolling NovaDialogContent__elements novacore:relative novacore:flex novacore:max-h-[98dvh] novacore:w-full novacore:flex-col novacore:gap-3 novacore:overflow-y-auto novacore:rounded-t-2xl novacore:sm:rounded-2xl novacore:shadow-2xl","novacore:border novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)]"),children:e})})})})})]})});G.displayName=s__namespace.Content.displayName;var j=({className:o,...e})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-header",className:i("novacore:sticky novacore:flex novacore:top-0 novacore:z-11 novacore:w-full novacore:flex-row novacore:items-center novacore:justify-between","novacore:border-b novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)] novacore:p-4",o),...e});j.displayName="DialogHeader";var K=({className:o,...e})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-footer",className:i("novacore:flex novacore:flex-col-reverse novacore:sm:flex-row novacore:sm:justify-end novacore:sm:space-x-2",o),...e});K.displayName="DialogFooter";var U=l__namespace.forwardRef(({className:o,...e},t)=>jsxRuntime.jsx(s__namespace.Title,{ref:t,"aria-describedby":"tuwa:modal-title",className:i("novacore:text-lg novacore:font-bold novacore:leading-none novacore:tracking-tight novacore:text-[var(--tuwa-text-primary)] novacore:m-0",o),...e}));U.displayName=s__namespace.Title.displayName;var Q=l__namespace.forwardRef(({className:o,...e},t)=>jsxRuntime.jsx(s__namespace.Description,{"aria-describedby":"tuwa:modal-description",ref:t,className:i("novacore:text-sm novacore:text-[var(--tuwa-text-secondary)]",o),...e}));Q.displayName=s__namespace.Description.displayName;var A=l.lazy(()=>import('@web3icons/react/dynamic').then(o=>({default:o.NetworkIcon})));function ne({chainId:o,variant:e="background",className:t}){let n=C(o),a=typeof o=="string",r=a?o.split(":")[0].toLowerCase():o,u=a&&w(o),m=i("novacore:w-full novacore:h-full novacore:rounded-full",t,{"novacore:[&_path]:first-of-type:fill-[var(--tuwa-testnet-icons)]":u||n.toLowerCase().includes("testnet")});return jsxRuntime.jsx(l.Suspense,{fallback:jsxRuntime.jsx(d,{animate:true,className:t}),children:typeof r=="string"?jsxRuntime.jsx(A,{id:r,variant:e,className:m,fallback:jsxRuntime.jsx(d,{content:"?",className:t})}):jsxRuntime.jsx(A,{chainId:r,variant:e,className:m,fallback:jsxRuntime.jsx(d,{content:"?",className:t})})})}function ce({starsCount:o}){let[e,t]=l.useState(false);l.useEffect(()=>t(true),[]);let n=l.useMemo(()=>e?Array.from({length:o??200}).map(()=>({x:Math.random()*window.innerWidth,y:Math.random()*window.innerHeight,r:Math.random()*1+.5,isSupernova:Math.random()<.1,delay:Math.random()*10,duration:5+Math.random()*5})):[],[e]);return jsxRuntime.jsx("div",{className:"novacore:absolute novacore:inset-0 novacore:z-1 novacore:h-full novacore:w-full novacore:overflow-hidden",children:jsxRuntime.jsxs("svg",{width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("style",{children:`
|
|
2
2
|
/* Pulse animation now includes scale for a more organic feel. */
|
|
3
3
|
@keyframes pulse {
|
|
4
4
|
0%, 100% {
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
transform-origin: center;
|
|
45
45
|
stroke-width: 2;
|
|
46
46
|
}
|
|
47
|
-
`})}),n.map((a,
|
|
48
|
-
exports.ChevronArrowWithAnim=
|
|
47
|
+
`})}),n.map((a,r)=>jsxRuntime.jsx("circle",{cx:a.x,cy:a.y,r:a.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:a.isSupernova?"supernova":"pulsar",style:{animationDelay:`${a.delay}s`,animationDuration:`${a.duration}s`}},r))]})})}function ve({closeToast:o,ariaLabel:e="Close toast notification",title:t="Close toast notification",className:n,iconClassName:a}){return jsxRuntime.jsx("button",{type:"button",onClick:o,"aria-label":e,title:t,className:i("novacore:absolute novacore:top-2 novacore:right-2 novacore:cursor-pointer novacore:rounded-full novacore:p-1","novacore:text-[var(--tuwa-text-tertiary)] novacore:transition-colors","novacore:hover:bg-[var(--tuwa-bg-muted)] novacore:hover:text-[var(--tuwa-text-primary)]",n),children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:i("novacore:h-5 novacore:w-5",a),children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})}var io=l.lazy(()=>import('@web3icons/react/dynamic').then(o=>({default:o.WalletIcon}))),so={walletconnect:"wallet-connect"},co=({className:o})=>jsxRuntime.jsxs("svg",{className:o,fill:"none",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16 0c8.84 0 16 7.16 16 16s-7.16 16-16 16S0 24.84 0 16 7.16 0 16 0",clipRule:"evenodd"}),jsxRuntime.jsx("path",{fill:"#000",fillRule:"evenodd",d:"M16.54 2.01h1.53c.5.09.99.23 1.48.42.21.25.19.48-.05.69q-.195.045-.39 0c-1.86-.65-3.55-.35-5.07.89 2.39.7 3.84 2.27 4.36 4.7.12.85.08 1.68-.12 2.51.87 0 1.74 0 2.61-.02.39-.4.7-.85.94-1.35-.45-.45-.65-.99-.59-1.63-1.15.08-1.79-.44-1.92-1.58.14-1.12.78-1.67 1.92-1.63a.7.7 0 0 0-.12-.49l-.89-.89c-.02-.45.19-.6.62-.47.24.19.46.39.66.62.71-.79 1.5-.89 2.39-.32.44.42.62.94.54 1.55 1.49.02 2.11.76 1.85 2.22-.08.17-.17.34-.27.49.53.59.87 1.28 1.01 2.07.08 4.6.1 9.19.05 13.79-.19 1.58-1 2.71-2.44 3.37-.29.1-.59.2-.89.27H7.2c-1.31-.33-2.05-1.17-2.24-2.51-.03-5.24-.03-10.47 0-15.71.3-1.62 1.28-2.46 2.93-2.54 1.26-1.77 2.98-2.64 5.17-2.61.96-1.01 2.13-1.62 3.5-1.85zm6.11 1.87c.39-.03.7.12.91.44.06.39.09.79.1 1.18.02.12.07.21.17.27.41 0 .82.04 1.23.1.49.26.63.65.42 1.16-.07.14-.18.25-.32.32-.39.06-.79.09-1.18.1-.12.02-.21.07-.27.17l-.15 1.33c-.32.46-.72.55-1.21.27a.76.76 0 0 1-.27-.37c-.06-.41-.09-.82-.1-1.23a.35.35 0 0 0-.27-.17l-1.08-.05c-.46-.24-.62-.61-.47-1.11.14-.27.36-.43.66-.47l.99-.05s.09-.04.12-.07l.15-1.28q.18-.39.57-.54m-10.49.79c2.41-.09 4.12.94 5.15 3.1.44 1.12.48 2.25.12 3.4-.84.06-1.67.07-2.51.02.56-.68.52-1.32-.1-1.92-.26-.13-.54-.19-.84-.17.02-.95 0-1.91-.07-2.86-.21-.41-.55-.58-1.01-.52-.17.03-.31.09-.44.2-.72.92-1.43 1.85-2.14 2.78-.28.45-.29.91-.05 1.38q.225.3.57.42c.34.02.69.03 1.03.02v.69c-1.3.02-2.59 0-3.89-.05-.58-2.1-.08-3.88 1.53-5.34.79-.62 1.68-1 2.66-1.16zm.83 1.82c.07 0 .13.03.17.1l.05 3.05c.04.09.1.16.17.22l.89.05c.22.08.3.24.22.47q-.27.42-.57.81c-.43.02-.85.03-1.28.02 0-.41 0-.82-.02-1.23a.46.46 0 0 0-.17-.17l-1.28-.05c-.3-.1-.37-.29-.22-.57.7-.89 1.39-1.79 2.04-2.71zm-5.81.84h.2a6.1 6.1 0 0 0-.25 3.77c-.59-.13-1.01-.49-1.26-1.06-.36-1.29.08-2.19 1.31-2.71m17.98.83c.05 0 .1 0 .15.02q.825.855.96 2.04.045 1.305 0 2.61a3.76 3.76 0 0 0-2.54-1.55c-.61-.05-1.21-.08-1.82-.1.26-.31.48-.66.64-1.03 1.31.02 1.94-.62 1.87-1.95.26.02.5 0 .74-.05zM5.7 11.22c.41.4.91.65 1.48.76l16.06.05c1.42.13 2.38.87 2.88 2.19.07.24.12.49.15.74.03 2.86.03 5.71 0 8.57-.21 1.44-1 2.38-2.39 2.83-.24.05-.49.08-.74.1-1.26.02-2.53.03-3.79.02 0-1.33 0-2.66.02-3.99l1.55-1.55c1.42-.04 2.09-.78 1.99-2.19-.24-.88-.81-1.34-1.72-1.38-1.2.12-1.81.8-1.82 2.02l-1.92 1.92c-.08.11-.14.22-.2.34-.07 1.61-.1 3.22-.07 4.83h-.44c0-2.28 0-4.56-.02-6.85a1.8 1.8 0 0 0-.15-.34l-1.13-1.13c0-1.23-.61-1.92-1.82-2.07-1.29.17-1.87.91-1.72 2.22q.465 1.395 1.95 1.35l.71.71c0 .3.04.6.1.89.25.21.48.19.69-.05.03-.39.03-.79 0-1.18-.2-.25-.43-.49-.66-.71.15-.1.29-.22.39-.37.3.27.58.55.86.84.02 2.23.03 4.47.02 6.7h-.59c0-1.38 0-2.76-.02-4.14-.15-.25-.35-.31-.62-.17a1 1 0 0 0-.12.22c-.02 1.36-.03 2.73-.02 4.09h-.44c0-.99 0-1.97-.02-2.96-.02-.09-.06-.17-.1-.25-.67-.72-1.36-1.43-2.07-2.12-.06-1.48-.82-2.13-2.29-1.95-1.02.41-1.42 1.16-1.21 2.24q.51 1.32 1.95 1.26l1.55 1.55c.02.74.03 1.48.02 2.22-1.56.02-3.12 0-4.68-.07-.9-.24-1.42-.83-1.55-1.75-.02-4.48-.03-8.96-.02-13.45zm7.79 5.66c.84.06 1.19.5 1.06 1.33-.32.62-.8.79-1.45.52-.46-.37-.56-.82-.32-1.35.18-.26.42-.42.71-.49zm7.43 1.28c.89-.03 1.29.4 1.21 1.28-.33.67-.83.85-1.5.52-.54-.49-.58-1-.1-1.55.12-.11.25-.19.39-.25M9.94 19.94c.84 0 1.22.4 1.16 1.23-.28.68-.76.89-1.45.62-.63-.54-.65-1.09-.05-1.67l.34-.17zm9.75.24c.16.13.3.27.44.42-.53.52-1.05 1.05-1.55 1.6-.02 1.43-.03 2.86-.02 4.28h-.59c0-1.51 0-3.02.02-4.53a71 71 0 0 1 1.7-1.77M11.56 22c.62.53 1.21 1.11 1.75 1.72.02.92.03 1.84.02 2.76h-.59c0-.85 0-1.71-.02-2.56l-1.48-1.48s-.03-.07 0-.1c.12-.11.22-.22.32-.34",clipRule:"evenodd"})]});function ye({walletName:o,variant:e="background",className:t}){let n=i("novacore:w-full novacore:h-full novacore:rounded-full",t),a=o.toLowerCase();if(a==="impersonatedwallet")return jsxRuntime.jsx(co,{className:n});let r=so[a]??a;return jsxRuntime.jsx(l.Suspense,{fallback:jsxRuntime.jsx(d,{animate:true,className:t}),children:jsxRuntime.jsx(io,{id:r,variant:e,className:n,fallback:jsxRuntime.jsx(d,{content:"?",className:t})})})}function Ne(o=2e3){let[e,t]=l.useState(false),[n,a]=l.useState(null),r=l.useCallback(async u=>{if(u)try{await navigator.clipboard.writeText(u),t(!0),a(null),setTimeout(()=>t(!1),o);}catch(m){let f=m instanceof Error?m:new Error("Failed to copy text.");console.error(f),a(f),setTimeout(()=>a(null),o);}},[o]);return {isCopied:e,copy:r,error:n}}function De(o){let e=a=>typeof window<"u"?window.matchMedia(a).matches:false,[t,n]=l.useState(e(o));return l.useEffect(()=>{let a=window.matchMedia(o),r=()=>n(a.matches);return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[o]),t}
|
|
48
|
+
exports.ChevronArrowWithAnim=Vo;exports.CloseIcon=B;exports.Dialog=Uo;exports.DialogClose=Jo;exports.DialogContent=G;exports.DialogDescription=Q;exports.DialogFooter=K;exports.DialogHeader=j;exports.DialogOverlay=L;exports.DialogPortal=_;exports.DialogTitle=U;exports.DialogTrigger=Qo;exports.FallbackIcon=d;exports.NetworkIcon=ne;exports.StarsBackground=ce;exports.ToastCloseButton=ve;exports.WalletIcon=ye;exports.cn=i;exports.deepMerge=z;exports.getChainName=C;exports.isSolanaDev=w;exports.isTouchDevice=D;exports.standardButtonClasses=po;exports.textCenterEllipsis=Do;exports.useCopyToClipboard=Ne;exports.useMediaQuery=De;
|
package/dist/index.css
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
--novacore-tracking-tight: -0.025em;
|
|
15
15
|
--novacore-radius-md: 0.375rem;
|
|
16
16
|
--novacore-radius-2xl: 1rem;
|
|
17
|
+
--novacore-animate-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
17
18
|
--novacore-blur-sm: 8px;
|
|
18
19
|
--novacore-default-transition-duration: 150ms;
|
|
19
20
|
--novacore-default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
@@ -86,6 +87,9 @@
|
|
|
86
87
|
.novacore\:w-full {
|
|
87
88
|
width: 100%;
|
|
88
89
|
}
|
|
90
|
+
.novacore\:animate-pulse {
|
|
91
|
+
animation: var(--novacore-animate-pulse);
|
|
92
|
+
}
|
|
89
93
|
.novacore\:cursor-pointer {
|
|
90
94
|
cursor: pointer;
|
|
91
95
|
}
|
|
@@ -137,6 +141,9 @@
|
|
|
137
141
|
.novacore\:border-\[var\(--tuwa-border-primary\)\] {
|
|
138
142
|
border-color: var(--tuwa-border-primary);
|
|
139
143
|
}
|
|
144
|
+
.novacore\:bg-\[var\(--tuwa-bg-muted\)\] {
|
|
145
|
+
background-color: var(--tuwa-bg-muted);
|
|
146
|
+
}
|
|
140
147
|
.novacore\:bg-\[var\(--tuwa-bg-primary\)\] {
|
|
141
148
|
background-color: var(--tuwa-bg-primary);
|
|
142
149
|
}
|
|
@@ -305,6 +312,13 @@
|
|
|
305
312
|
padding: calc(var(--novacore-spacing) * 4);
|
|
306
313
|
}
|
|
307
314
|
}
|
|
315
|
+
.novacore\:\[\&_path\]\:first-of-type\:fill-\[var\(--tuwa-testnet-icons\)\] {
|
|
316
|
+
& path {
|
|
317
|
+
&:first-of-type {
|
|
318
|
+
fill: var(--tuwa-testnet-icons);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
308
322
|
}
|
|
309
323
|
:root {
|
|
310
324
|
--tuwa-success-bg: oklch(96.2% 0.044 156.743);
|
|
@@ -335,6 +349,7 @@
|
|
|
335
349
|
--tuwa-button-gradient-to-hover: oklch(49.6% 0.265 301.924);
|
|
336
350
|
--tuwa-standart-button-bg: oklch(96.7% 0.003 264.542);
|
|
337
351
|
--tuwa-standart-button-hover: oklch(92.8% 0.006 264.531);
|
|
352
|
+
--tuwa-testnet-icons: #C4BFB8;
|
|
338
353
|
}
|
|
339
354
|
.dark {
|
|
340
355
|
--tuwa-success-bg: oklch(39.3% 0.095 152.535);
|
|
@@ -365,6 +380,7 @@
|
|
|
365
380
|
--tuwa-button-gradient-to-hover: oklch(55.8% 0.288 302.321);
|
|
366
381
|
--tuwa-standart-button-bg: oklch(37.3% 0.034 259.733);
|
|
367
382
|
--tuwa-standart-button-hover: oklch(27.8% 0.033 256.848);
|
|
383
|
+
--tuwa-testnet-icons: #C4BFB8;
|
|
368
384
|
}
|
|
369
385
|
.Toastify {
|
|
370
386
|
pointer-events: auto;
|
|
@@ -552,6 +568,11 @@
|
|
|
552
568
|
inherits: false;
|
|
553
569
|
initial-value: 0;
|
|
554
570
|
}
|
|
571
|
+
@keyframes pulse {
|
|
572
|
+
50% {
|
|
573
|
+
opacity: 0.5;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
555
576
|
@layer properties {
|
|
556
577
|
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
557
578
|
*, ::before, ::after, ::backdrop {
|
package/dist/index.d.cts
CHANGED
|
@@ -15,6 +15,34 @@ declare function ChevronArrowWithAnim({ className, strokeWidth, isOpen, }: {
|
|
|
15
15
|
*/
|
|
16
16
|
declare const CloseIcon: React$1.ForwardRefExoticComponent<React$1.SVGAttributes<SVGSVGElement> & React$1.RefAttributes<SVGSVGElement>>;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Props for the FallbackIcon component.
|
|
20
|
+
*/
|
|
21
|
+
interface FallbackIconProps {
|
|
22
|
+
/**
|
|
23
|
+
* Whether to show a pulse animation to indicate a loading state.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
animate?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Text content to display inside the fallback circle (e.g., "?", "!", or empty).
|
|
29
|
+
* @default ''
|
|
30
|
+
*/
|
|
31
|
+
content?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Additional CSS class names to apply to the container.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A reusable placeholder component used for Suspense fallbacks (loading)
|
|
39
|
+
* or Error fallbacks (when an icon is missing or fails to load).
|
|
40
|
+
*
|
|
41
|
+
* @param props - {@link FallbackIconProps}
|
|
42
|
+
* @returns The rendered fallback element.
|
|
43
|
+
*/
|
|
44
|
+
declare const FallbackIcon: ({ animate, content, className }: FallbackIconProps) => react_jsx_runtime.JSX.Element;
|
|
45
|
+
|
|
18
46
|
declare const Dialog: React$1.FC<DialogPrimitive.DialogProps>;
|
|
19
47
|
declare const DialogTrigger: React$1.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
20
48
|
declare const DialogPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
|
|
@@ -41,6 +69,37 @@ declare const DialogFooter: {
|
|
|
41
69
|
declare const DialogTitle: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> & React$1.RefAttributes<HTMLHeadingElement>>;
|
|
42
70
|
declare const DialogDescription: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React$1.RefAttributes<HTMLParagraphElement>, "ref"> & React$1.RefAttributes<HTMLParagraphElement>>;
|
|
43
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Props for the NetworkIcon component.
|
|
74
|
+
*/
|
|
75
|
+
interface NetworkIconProps {
|
|
76
|
+
/**
|
|
77
|
+
* Chain identifier.
|
|
78
|
+
* - `number`: For EVM networks (e.g., 1, 137).
|
|
79
|
+
* - `string`: For non-EVM networks (e.g., "solana:mainnet", "solana:devnet").
|
|
80
|
+
*/
|
|
81
|
+
chainId: number | string;
|
|
82
|
+
/**
|
|
83
|
+
* Visual style variant for the icon.
|
|
84
|
+
* @default 'background'
|
|
85
|
+
*/
|
|
86
|
+
variant?: 'background' | 'branded' | 'mono';
|
|
87
|
+
/** Additional CSS class names. */
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Renders a network icon based on the chain ID.
|
|
92
|
+
*
|
|
93
|
+
* It handles logic for:
|
|
94
|
+
* 1. Lazy loading the heavy icon library.
|
|
95
|
+
* 2. Normalizing string IDs (e.g., converts "solana:devnet" -> "solana").
|
|
96
|
+
* 3. Applying specific styling for Testnets/Devnets (e.g., muted colors for Solana Devnet).
|
|
97
|
+
*
|
|
98
|
+
* @param props - {@link NetworkIconProps}
|
|
99
|
+
* @returns The network icon or a fallback UI.
|
|
100
|
+
*/
|
|
101
|
+
declare function NetworkIcon({ chainId, variant, className }: NetworkIconProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
44
103
|
declare function StarsBackground({ starsCount }: {
|
|
45
104
|
starsCount?: number;
|
|
46
105
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -57,12 +116,58 @@ type ToastCloseButtonProps = {
|
|
|
57
116
|
* toast library (e.g., react-toastify) to dismiss the notification.
|
|
58
117
|
*/
|
|
59
118
|
closeToast?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Optional custom aria-label for accessibility.
|
|
121
|
+
*/
|
|
122
|
+
ariaLabel?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Optional custom title for the button tooltip.
|
|
125
|
+
*/
|
|
126
|
+
title?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Optional custom className for the button container.
|
|
129
|
+
*/
|
|
130
|
+
className?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Optional custom className for the close icon SVG.
|
|
133
|
+
*/
|
|
134
|
+
iconClassName?: string;
|
|
60
135
|
};
|
|
61
136
|
/**
|
|
62
137
|
* A simple, styled close button component ('X' icon) intended for use within toast notifications.
|
|
63
138
|
* It uses theme-aware CSS variables for styling and i18n labels for accessibility.
|
|
64
139
|
*/
|
|
65
|
-
declare function ToastCloseButton({ closeToast }: ToastCloseButtonProps): react_jsx_runtime.JSX.Element;
|
|
140
|
+
declare function ToastCloseButton({ closeToast, ariaLabel, title, className, iconClassName, }: ToastCloseButtonProps): react_jsx_runtime.JSX.Element;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Props for the WalletIcon component.
|
|
144
|
+
*/
|
|
145
|
+
interface WalletIconProps {
|
|
146
|
+
/**
|
|
147
|
+
* The unique identifier of the wallet.
|
|
148
|
+
* Examples: 'metamask', 'phantom', 'coinbase', 'walletconnect'.
|
|
149
|
+
*/
|
|
150
|
+
walletName: string;
|
|
151
|
+
/**
|
|
152
|
+
* Visual style variant for the icon.
|
|
153
|
+
* @default 'background'
|
|
154
|
+
*/
|
|
155
|
+
variant?: 'background' | 'branded' | 'mono';
|
|
156
|
+
/** Additional CSS class names. */
|
|
157
|
+
className?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Renders a wallet icon based on the wallet name.
|
|
161
|
+
*
|
|
162
|
+
* It handles logic for:
|
|
163
|
+
* 1. Rendering a custom SVG for 'impersonatedwallet' (Watch mode).
|
|
164
|
+
* 2. Normalizing IDs for common wallets (e.g. 'walletconnect' -> 'wallet-connect').
|
|
165
|
+
* 3. Lazy loading other icons from @web3icons/react.
|
|
166
|
+
*
|
|
167
|
+
* @param props - {@link WalletIconProps}
|
|
168
|
+
* @returns The wallet icon or a fallback UI.
|
|
169
|
+
*/
|
|
170
|
+
declare function WalletIcon({ walletName, variant, className }: WalletIconProps): react_jsx_runtime.JSX.Element;
|
|
66
171
|
|
|
67
172
|
/**
|
|
68
173
|
* @file This file contains a custom React hook for copying text to the clipboard.
|
|
@@ -149,6 +254,32 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
149
254
|
*/
|
|
150
255
|
declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
|
|
151
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Retrieves the human-readable name of a blockchain network based on its Chain ID.
|
|
259
|
+
*
|
|
260
|
+
* Supports both:
|
|
261
|
+
* - Numeric IDs (EVM): e.g., `1` -> "Ethereum"
|
|
262
|
+
* - String IDs (Non-EVM): e.g., `"solana:devnet"` -> "Solana Devnet"
|
|
263
|
+
*
|
|
264
|
+
* For formatted string IDs (like "solana:devnet"), it capitalizes the suffix
|
|
265
|
+
* if the network is identified as a development environment.
|
|
266
|
+
*
|
|
267
|
+
* @param chainId - The unique identifier of the chain (number for EVM, string for others).
|
|
268
|
+
* @returns The formatted network name or 'Unknown'.
|
|
269
|
+
*/
|
|
270
|
+
declare function getChainName(chainId: number | string): string;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Determines if the current chain is a Solana development or test network.
|
|
274
|
+
*
|
|
275
|
+
* It strictly checks if the ID is a string containing 'solana' AND
|
|
276
|
+
* indicates a non-production environment ('devnet' or 'testnet').
|
|
277
|
+
*
|
|
278
|
+
* @param chainId - The chain identifier (e.g., "solana:devnet", 1, "ethereum").
|
|
279
|
+
* @returns {boolean} True only if it is a Solana dev/test chain.
|
|
280
|
+
*/
|
|
281
|
+
declare function isSolanaDev(chainId: number | string): boolean;
|
|
282
|
+
|
|
152
283
|
/**
|
|
153
284
|
* @fileoverview Utility function to determine if the current environment supports touch input.
|
|
154
285
|
* This is safe to use in Next.js applications as it checks for the `window` object existence.
|
|
@@ -188,4 +319,4 @@ declare function isTouchDevice(maxWidth?: number): boolean;
|
|
|
188
319
|
*/
|
|
189
320
|
declare function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string;
|
|
190
321
|
|
|
191
|
-
export { ChevronArrowWithAnim, CloseIcon, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, StarsBackground, ToastCloseButton, type ToastCloseButtonProps, cn, deepMerge, isTouchDevice, standardButtonClasses, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
|
|
322
|
+
export { ChevronArrowWithAnim, CloseIcon, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FallbackIcon, type FallbackIconProps, NetworkIcon, StarsBackground, ToastCloseButton, type ToastCloseButtonProps, WalletIcon, cn, deepMerge, getChainName, isSolanaDev, isTouchDevice, standardButtonClasses, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,34 @@ declare function ChevronArrowWithAnim({ className, strokeWidth, isOpen, }: {
|
|
|
15
15
|
*/
|
|
16
16
|
declare const CloseIcon: React$1.ForwardRefExoticComponent<React$1.SVGAttributes<SVGSVGElement> & React$1.RefAttributes<SVGSVGElement>>;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Props for the FallbackIcon component.
|
|
20
|
+
*/
|
|
21
|
+
interface FallbackIconProps {
|
|
22
|
+
/**
|
|
23
|
+
* Whether to show a pulse animation to indicate a loading state.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
animate?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Text content to display inside the fallback circle (e.g., "?", "!", or empty).
|
|
29
|
+
* @default ''
|
|
30
|
+
*/
|
|
31
|
+
content?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Additional CSS class names to apply to the container.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A reusable placeholder component used for Suspense fallbacks (loading)
|
|
39
|
+
* or Error fallbacks (when an icon is missing or fails to load).
|
|
40
|
+
*
|
|
41
|
+
* @param props - {@link FallbackIconProps}
|
|
42
|
+
* @returns The rendered fallback element.
|
|
43
|
+
*/
|
|
44
|
+
declare const FallbackIcon: ({ animate, content, className }: FallbackIconProps) => react_jsx_runtime.JSX.Element;
|
|
45
|
+
|
|
18
46
|
declare const Dialog: React$1.FC<DialogPrimitive.DialogProps>;
|
|
19
47
|
declare const DialogTrigger: React$1.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
20
48
|
declare const DialogPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
|
|
@@ -41,6 +69,37 @@ declare const DialogFooter: {
|
|
|
41
69
|
declare const DialogTitle: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React$1.RefAttributes<HTMLHeadingElement>, "ref"> & React$1.RefAttributes<HTMLHeadingElement>>;
|
|
42
70
|
declare const DialogDescription: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React$1.RefAttributes<HTMLParagraphElement>, "ref"> & React$1.RefAttributes<HTMLParagraphElement>>;
|
|
43
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Props for the NetworkIcon component.
|
|
74
|
+
*/
|
|
75
|
+
interface NetworkIconProps {
|
|
76
|
+
/**
|
|
77
|
+
* Chain identifier.
|
|
78
|
+
* - `number`: For EVM networks (e.g., 1, 137).
|
|
79
|
+
* - `string`: For non-EVM networks (e.g., "solana:mainnet", "solana:devnet").
|
|
80
|
+
*/
|
|
81
|
+
chainId: number | string;
|
|
82
|
+
/**
|
|
83
|
+
* Visual style variant for the icon.
|
|
84
|
+
* @default 'background'
|
|
85
|
+
*/
|
|
86
|
+
variant?: 'background' | 'branded' | 'mono';
|
|
87
|
+
/** Additional CSS class names. */
|
|
88
|
+
className?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Renders a network icon based on the chain ID.
|
|
92
|
+
*
|
|
93
|
+
* It handles logic for:
|
|
94
|
+
* 1. Lazy loading the heavy icon library.
|
|
95
|
+
* 2. Normalizing string IDs (e.g., converts "solana:devnet" -> "solana").
|
|
96
|
+
* 3. Applying specific styling for Testnets/Devnets (e.g., muted colors for Solana Devnet).
|
|
97
|
+
*
|
|
98
|
+
* @param props - {@link NetworkIconProps}
|
|
99
|
+
* @returns The network icon or a fallback UI.
|
|
100
|
+
*/
|
|
101
|
+
declare function NetworkIcon({ chainId, variant, className }: NetworkIconProps): react_jsx_runtime.JSX.Element;
|
|
102
|
+
|
|
44
103
|
declare function StarsBackground({ starsCount }: {
|
|
45
104
|
starsCount?: number;
|
|
46
105
|
}): react_jsx_runtime.JSX.Element;
|
|
@@ -57,12 +116,58 @@ type ToastCloseButtonProps = {
|
|
|
57
116
|
* toast library (e.g., react-toastify) to dismiss the notification.
|
|
58
117
|
*/
|
|
59
118
|
closeToast?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
119
|
+
/**
|
|
120
|
+
* Optional custom aria-label for accessibility.
|
|
121
|
+
*/
|
|
122
|
+
ariaLabel?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Optional custom title for the button tooltip.
|
|
125
|
+
*/
|
|
126
|
+
title?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Optional custom className for the button container.
|
|
129
|
+
*/
|
|
130
|
+
className?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Optional custom className for the close icon SVG.
|
|
133
|
+
*/
|
|
134
|
+
iconClassName?: string;
|
|
60
135
|
};
|
|
61
136
|
/**
|
|
62
137
|
* A simple, styled close button component ('X' icon) intended for use within toast notifications.
|
|
63
138
|
* It uses theme-aware CSS variables for styling and i18n labels for accessibility.
|
|
64
139
|
*/
|
|
65
|
-
declare function ToastCloseButton({ closeToast }: ToastCloseButtonProps): react_jsx_runtime.JSX.Element;
|
|
140
|
+
declare function ToastCloseButton({ closeToast, ariaLabel, title, className, iconClassName, }: ToastCloseButtonProps): react_jsx_runtime.JSX.Element;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Props for the WalletIcon component.
|
|
144
|
+
*/
|
|
145
|
+
interface WalletIconProps {
|
|
146
|
+
/**
|
|
147
|
+
* The unique identifier of the wallet.
|
|
148
|
+
* Examples: 'metamask', 'phantom', 'coinbase', 'walletconnect'.
|
|
149
|
+
*/
|
|
150
|
+
walletName: string;
|
|
151
|
+
/**
|
|
152
|
+
* Visual style variant for the icon.
|
|
153
|
+
* @default 'background'
|
|
154
|
+
*/
|
|
155
|
+
variant?: 'background' | 'branded' | 'mono';
|
|
156
|
+
/** Additional CSS class names. */
|
|
157
|
+
className?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Renders a wallet icon based on the wallet name.
|
|
161
|
+
*
|
|
162
|
+
* It handles logic for:
|
|
163
|
+
* 1. Rendering a custom SVG for 'impersonatedwallet' (Watch mode).
|
|
164
|
+
* 2. Normalizing IDs for common wallets (e.g. 'walletconnect' -> 'wallet-connect').
|
|
165
|
+
* 3. Lazy loading other icons from @web3icons/react.
|
|
166
|
+
*
|
|
167
|
+
* @param props - {@link WalletIconProps}
|
|
168
|
+
* @returns The wallet icon or a fallback UI.
|
|
169
|
+
*/
|
|
170
|
+
declare function WalletIcon({ walletName, variant, className }: WalletIconProps): react_jsx_runtime.JSX.Element;
|
|
66
171
|
|
|
67
172
|
/**
|
|
68
173
|
* @file This file contains a custom React hook for copying text to the clipboard.
|
|
@@ -149,6 +254,32 @@ declare function cn(...inputs: ClassValue[]): string;
|
|
|
149
254
|
*/
|
|
150
255
|
declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
|
|
151
256
|
|
|
257
|
+
/**
|
|
258
|
+
* Retrieves the human-readable name of a blockchain network based on its Chain ID.
|
|
259
|
+
*
|
|
260
|
+
* Supports both:
|
|
261
|
+
* - Numeric IDs (EVM): e.g., `1` -> "Ethereum"
|
|
262
|
+
* - String IDs (Non-EVM): e.g., `"solana:devnet"` -> "Solana Devnet"
|
|
263
|
+
*
|
|
264
|
+
* For formatted string IDs (like "solana:devnet"), it capitalizes the suffix
|
|
265
|
+
* if the network is identified as a development environment.
|
|
266
|
+
*
|
|
267
|
+
* @param chainId - The unique identifier of the chain (number for EVM, string for others).
|
|
268
|
+
* @returns The formatted network name or 'Unknown'.
|
|
269
|
+
*/
|
|
270
|
+
declare function getChainName(chainId: number | string): string;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Determines if the current chain is a Solana development or test network.
|
|
274
|
+
*
|
|
275
|
+
* It strictly checks if the ID is a string containing 'solana' AND
|
|
276
|
+
* indicates a non-production environment ('devnet' or 'testnet').
|
|
277
|
+
*
|
|
278
|
+
* @param chainId - The chain identifier (e.g., "solana:devnet", 1, "ethereum").
|
|
279
|
+
* @returns {boolean} True only if it is a Solana dev/test chain.
|
|
280
|
+
*/
|
|
281
|
+
declare function isSolanaDev(chainId: number | string): boolean;
|
|
282
|
+
|
|
152
283
|
/**
|
|
153
284
|
* @fileoverview Utility function to determine if the current environment supports touch input.
|
|
154
285
|
* This is safe to use in Next.js applications as it checks for the `window` object existence.
|
|
@@ -188,4 +319,4 @@ declare function isTouchDevice(maxWidth?: number): boolean;
|
|
|
188
319
|
*/
|
|
189
320
|
declare function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string;
|
|
190
321
|
|
|
191
|
-
export { ChevronArrowWithAnim, CloseIcon, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, StarsBackground, ToastCloseButton, type ToastCloseButtonProps, cn, deepMerge, isTouchDevice, standardButtonClasses, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
|
|
322
|
+
export { ChevronArrowWithAnim, CloseIcon, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, FallbackIcon, type FallbackIconProps, NetworkIcon, StarsBackground, ToastCloseButton, type ToastCloseButtonProps, WalletIcon, cn, deepMerge, getChainName, isSolanaDev, isTouchDevice, standardButtonClasses, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {motion,AnimatePresence}from'framer-motion';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';import*as l from'react';import {useState,useEffect,useMemo,useCallback}from'react';import*as
|
|
1
|
+
import {motion,AnimatePresence}from'framer-motion';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {networks}from'@web3icons/common/metadata';import {jsxs,jsx}from'react/jsx-runtime';import*as l from'react';import {lazy,Suspense,useState,useEffect,useMemo,useCallback}from'react';import*as s from'@radix-ui/react-dialog';var po="novacore:cursor-pointer novacore:rounded-md novacore:bg-[var(--tuwa-standart-button-bg)] novacore:px-3 novacore:py-2 novacore:flex novacore:items-center novacore:gap-1 novacore:text-sm novacore:font-semibold novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors novacore:hover:bg-[var(--tuwa-standart-button-hover)] novacore:disabled:cursor-not-allowed novacore:disabled:opacity-50";function i(...o){return twMerge(clsx(o))}var g=o=>o&&typeof o=="object"&&!Array.isArray(o);function z(o,e){let t={...o};return g(o)&&g(e)&&Object.keys(e).forEach(n=>{let a=o[n],r=e[n];g(a)&&g(r)?t[n]=z(a,r):t[n]=r;}),t}function w(o){if(typeof o!="string")return false;let e=o.toLowerCase();return e.includes("solana")&&(e.includes("devnet")||e.includes("testnet"))}var k="Unknown";function C(o){if(typeof o=="number")return networks.find(a=>a.chainId===o)?.name??k;let[e,t]=o.split(":"),n=networks.find(a=>a.id===e);if(!n)return k;if(t&&w(o)){let a=t.charAt(0).toUpperCase()+t.slice(1).toLowerCase();return `${n.name} ${a}`}return n.name}function D(o=1200){if(typeof window>"u")return false;let e="ontouchstart"in window,t=navigator.maxTouchPoints>0,n=false;window.matchMedia&&(n=window.matchMedia("(pointer: coarse)").matches);let a=e||t||n,r=window.innerWidth<=o;return a&&r}function Do(o,e,t){if(!o)return "";if(o.length<=e+t)return o;let n=o.slice(0,e),a=o.slice(o.length-t);return `${n}...${a}`}function Vo({className:o,strokeWidth:e,isOpen:t}){return jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:e??2,stroke:"currentColor",className:i("novacore:w-4 novacore:h-4 novacore:text-[var(--tuwa-text-secondary)]",o),children:[jsx(AnimatePresence,{children:t&&jsx(motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5",variants:{hidden:{translateY:3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})}),jsx(AnimatePresence,{children:!t&&jsx(motion.path,{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5",className:"novacore:relative",variants:{hidden:{translateY:-3,scaleY:.8,opacity:0},visible:{translateY:0,scaleY:1,opacity:1}},initial:"hidden",animate:"visible",transition:{duration:.4}})})]})}var B=l.forwardRef(({className:o,...e},t)=>jsxs("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:i("novacore:h-5 novacore:w-5 novacore:text-[var(--tuwa-text-primary)] novacore:transition-colors",o),...e,children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]}));B.displayName="CloseIcon";var O="flex items-center justify-center novacore:w-full novacore:h-full novacore:rounded-full novacore:text-[var(--tuwa-text-secondary)] novacore:bg-[var(--tuwa-bg-muted)]",d=({animate:o=false,content:e="",className:t})=>jsx("div",{className:i(O,"Nova_Web3_Icon",t,{"novacore:animate-pulse":o}),children:e});var Uo=s.Root,Qo=s.Trigger,_=s.Portal,Jo=s.Close,Y={initial:{opacity:0,scale:.9,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.9,transition:{duration:.2}}},$={initial:{opacity:0,y:"100%"},animate:{opacity:1,y:"0%"},exit:{opacity:0,y:"100%",transition:{duration:.2}}},q={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}},L=({className:o,backdropAnimation:e})=>(l.useEffect(()=>(typeof window<"u"&&window.document.body.classList.add("NovaModalOpen"),()=>{typeof window<"u"&&window.document.body.classList.remove("NovaModalOpen");}),[]),jsx(AnimatePresence,{children:jsx(motion.div,{variants:e??q,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"novacore:relative novacore:overflow-hidden",children:jsx("div",{className:i("novacore:fixed novacore:inset-0 novacore:z-50 novacore:bg-black/55 novacore:backdrop-blur-sm novacore:backdrop-saturate-150",o)})})}));L.displayName=s.Overlay.displayName;var G=l.forwardRef(({className:o,children:e,modalAnimation:t,backdropAnimation:n,...a},r)=>{let[u,m]=l.useState(false);l.useEffect(()=>{m(D());},[]);let f=t??(u?$:Y);return jsxs(_,{children:[jsx(L,{backdropAnimation:n}),jsx(s.Content,{"aria-describedby":"tuwa:modal-content",ref:r,className:i("NovaNoScrolling novacore:fixed novacore:bottom-0 novacore:left-0 novacore:p-0 novacore:sm:bottom-auto novacore:sm:left-[50%] novacore:sm:top-[50%] novacore:sm:translate-x-[-50%] novacore:sm:translate-y-[-50%] novacore:z-50 novacore:sm:p-4 novacore:outline-none",o),...a,children:jsx(motion.div,{layout:true,className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",transition:{layout:{duration:.2,ease:[.1,.1,.2,1]}},children:jsx(AnimatePresence,{children:jsx(motion.div,{variants:f,transition:{duration:.2,ease:"easeInOut"},animate:"animate",initial:"initial",exit:"exit",className:"NovaNoScrolling novacore:relative novacore:overflow-hidden",children:jsx("div",{className:i("NovaNoScrolling NovaDialogContent__elements novacore:relative novacore:flex novacore:max-h-[98dvh] novacore:w-full novacore:flex-col novacore:gap-3 novacore:overflow-y-auto novacore:rounded-t-2xl novacore:sm:rounded-2xl novacore:shadow-2xl","novacore:border novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)]"),children:e})})})})})]})});G.displayName=s.Content.displayName;var j=({className:o,...e})=>jsx("div",{"aria-describedby":"tuwa:modal-header",className:i("novacore:sticky novacore:flex novacore:top-0 novacore:z-11 novacore:w-full novacore:flex-row novacore:items-center novacore:justify-between","novacore:border-b novacore:border-[var(--tuwa-border-primary)] novacore:bg-[var(--tuwa-bg-primary)] novacore:p-4",o),...e});j.displayName="DialogHeader";var K=({className:o,...e})=>jsx("div",{"aria-describedby":"tuwa:modal-footer",className:i("novacore:flex novacore:flex-col-reverse novacore:sm:flex-row novacore:sm:justify-end novacore:sm:space-x-2",o),...e});K.displayName="DialogFooter";var U=l.forwardRef(({className:o,...e},t)=>jsx(s.Title,{ref:t,"aria-describedby":"tuwa:modal-title",className:i("novacore:text-lg novacore:font-bold novacore:leading-none novacore:tracking-tight novacore:text-[var(--tuwa-text-primary)] novacore:m-0",o),...e}));U.displayName=s.Title.displayName;var Q=l.forwardRef(({className:o,...e},t)=>jsx(s.Description,{"aria-describedby":"tuwa:modal-description",ref:t,className:i("novacore:text-sm novacore:text-[var(--tuwa-text-secondary)]",o),...e}));Q.displayName=s.Description.displayName;var A=lazy(()=>import('@web3icons/react/dynamic').then(o=>({default:o.NetworkIcon})));function ne({chainId:o,variant:e="background",className:t}){let n=C(o),a=typeof o=="string",r=a?o.split(":")[0].toLowerCase():o,u=a&&w(o),m=i("novacore:w-full novacore:h-full novacore:rounded-full",t,{"novacore:[&_path]:first-of-type:fill-[var(--tuwa-testnet-icons)]":u||n.toLowerCase().includes("testnet")});return jsx(Suspense,{fallback:jsx(d,{animate:true,className:t}),children:typeof r=="string"?jsx(A,{id:r,variant:e,className:m,fallback:jsx(d,{content:"?",className:t})}):jsx(A,{chainId:r,variant:e,className:m,fallback:jsx(d,{content:"?",className:t})})})}function ce({starsCount:o}){let[e,t]=useState(false);useEffect(()=>t(true),[]);let n=useMemo(()=>e?Array.from({length:o??200}).map(()=>({x:Math.random()*window.innerWidth,y:Math.random()*window.innerHeight,r:Math.random()*1+.5,isSupernova:Math.random()<.1,delay:Math.random()*10,duration:5+Math.random()*5})):[],[e]);return jsx("div",{className:"novacore:absolute novacore:inset-0 novacore:z-1 novacore:h-full novacore:w-full novacore:overflow-hidden",children:jsxs("svg",{width:"100%",height:"100%",xmlns:"http://www.w3.org/2000/svg",children:[jsx("defs",{children:jsx("style",{children:`
|
|
2
2
|
/* Pulse animation now includes scale for a more organic feel. */
|
|
3
3
|
@keyframes pulse {
|
|
4
4
|
0%, 100% {
|
|
@@ -44,5 +44,5 @@ import {motion,AnimatePresence}from'framer-motion';import {clsx}from'clsx';impor
|
|
|
44
44
|
transform-origin: center;
|
|
45
45
|
stroke-width: 2;
|
|
46
46
|
}
|
|
47
|
-
`})}),n.map((a,
|
|
48
|
-
export{
|
|
47
|
+
`})}),n.map((a,r)=>jsx("circle",{cx:a.x,cy:a.y,r:a.r,fill:"rgba(var(--tuwa-bg-primary), 0.7)",className:a.isSupernova?"supernova":"pulsar",style:{animationDelay:`${a.delay}s`,animationDuration:`${a.duration}s`}},r))]})})}function ve({closeToast:o,ariaLabel:e="Close toast notification",title:t="Close toast notification",className:n,iconClassName:a}){return jsx("button",{type:"button",onClick:o,"aria-label":e,title:t,className:i("novacore:absolute novacore:top-2 novacore:right-2 novacore:cursor-pointer novacore:rounded-full novacore:p-1","novacore:text-[var(--tuwa-text-tertiary)] novacore:transition-colors","novacore:hover:bg-[var(--tuwa-bg-muted)] novacore:hover:text-[var(--tuwa-text-primary)]",n),children:jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:i("novacore:h-5 novacore:w-5",a),children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})}var io=lazy(()=>import('@web3icons/react/dynamic').then(o=>({default:o.WalletIcon}))),so={walletconnect:"wallet-connect"},co=({className:o})=>jsxs("svg",{className:o,fill:"none",viewBox:"0 0 32 32",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16 0c8.84 0 16 7.16 16 16s-7.16 16-16 16S0 24.84 0 16 7.16 0 16 0",clipRule:"evenodd"}),jsx("path",{fill:"#000",fillRule:"evenodd",d:"M16.54 2.01h1.53c.5.09.99.23 1.48.42.21.25.19.48-.05.69q-.195.045-.39 0c-1.86-.65-3.55-.35-5.07.89 2.39.7 3.84 2.27 4.36 4.7.12.85.08 1.68-.12 2.51.87 0 1.74 0 2.61-.02.39-.4.7-.85.94-1.35-.45-.45-.65-.99-.59-1.63-1.15.08-1.79-.44-1.92-1.58.14-1.12.78-1.67 1.92-1.63a.7.7 0 0 0-.12-.49l-.89-.89c-.02-.45.19-.6.62-.47.24.19.46.39.66.62.71-.79 1.5-.89 2.39-.32.44.42.62.94.54 1.55 1.49.02 2.11.76 1.85 2.22-.08.17-.17.34-.27.49.53.59.87 1.28 1.01 2.07.08 4.6.1 9.19.05 13.79-.19 1.58-1 2.71-2.44 3.37-.29.1-.59.2-.89.27H7.2c-1.31-.33-2.05-1.17-2.24-2.51-.03-5.24-.03-10.47 0-15.71.3-1.62 1.28-2.46 2.93-2.54 1.26-1.77 2.98-2.64 5.17-2.61.96-1.01 2.13-1.62 3.5-1.85zm6.11 1.87c.39-.03.7.12.91.44.06.39.09.79.1 1.18.02.12.07.21.17.27.41 0 .82.04 1.23.1.49.26.63.65.42 1.16-.07.14-.18.25-.32.32-.39.06-.79.09-1.18.1-.12.02-.21.07-.27.17l-.15 1.33c-.32.46-.72.55-1.21.27a.76.76 0 0 1-.27-.37c-.06-.41-.09-.82-.1-1.23a.35.35 0 0 0-.27-.17l-1.08-.05c-.46-.24-.62-.61-.47-1.11.14-.27.36-.43.66-.47l.99-.05s.09-.04.12-.07l.15-1.28q.18-.39.57-.54m-10.49.79c2.41-.09 4.12.94 5.15 3.1.44 1.12.48 2.25.12 3.4-.84.06-1.67.07-2.51.02.56-.68.52-1.32-.1-1.92-.26-.13-.54-.19-.84-.17.02-.95 0-1.91-.07-2.86-.21-.41-.55-.58-1.01-.52-.17.03-.31.09-.44.2-.72.92-1.43 1.85-2.14 2.78-.28.45-.29.91-.05 1.38q.225.3.57.42c.34.02.69.03 1.03.02v.69c-1.3.02-2.59 0-3.89-.05-.58-2.1-.08-3.88 1.53-5.34.79-.62 1.68-1 2.66-1.16zm.83 1.82c.07 0 .13.03.17.1l.05 3.05c.04.09.1.16.17.22l.89.05c.22.08.3.24.22.47q-.27.42-.57.81c-.43.02-.85.03-1.28.02 0-.41 0-.82-.02-1.23a.46.46 0 0 0-.17-.17l-1.28-.05c-.3-.1-.37-.29-.22-.57.7-.89 1.39-1.79 2.04-2.71zm-5.81.84h.2a6.1 6.1 0 0 0-.25 3.77c-.59-.13-1.01-.49-1.26-1.06-.36-1.29.08-2.19 1.31-2.71m17.98.83c.05 0 .1 0 .15.02q.825.855.96 2.04.045 1.305 0 2.61a3.76 3.76 0 0 0-2.54-1.55c-.61-.05-1.21-.08-1.82-.1.26-.31.48-.66.64-1.03 1.31.02 1.94-.62 1.87-1.95.26.02.5 0 .74-.05zM5.7 11.22c.41.4.91.65 1.48.76l16.06.05c1.42.13 2.38.87 2.88 2.19.07.24.12.49.15.74.03 2.86.03 5.71 0 8.57-.21 1.44-1 2.38-2.39 2.83-.24.05-.49.08-.74.1-1.26.02-2.53.03-3.79.02 0-1.33 0-2.66.02-3.99l1.55-1.55c1.42-.04 2.09-.78 1.99-2.19-.24-.88-.81-1.34-1.72-1.38-1.2.12-1.81.8-1.82 2.02l-1.92 1.92c-.08.11-.14.22-.2.34-.07 1.61-.1 3.22-.07 4.83h-.44c0-2.28 0-4.56-.02-6.85a1.8 1.8 0 0 0-.15-.34l-1.13-1.13c0-1.23-.61-1.92-1.82-2.07-1.29.17-1.87.91-1.72 2.22q.465 1.395 1.95 1.35l.71.71c0 .3.04.6.1.89.25.21.48.19.69-.05.03-.39.03-.79 0-1.18-.2-.25-.43-.49-.66-.71.15-.1.29-.22.39-.37.3.27.58.55.86.84.02 2.23.03 4.47.02 6.7h-.59c0-1.38 0-2.76-.02-4.14-.15-.25-.35-.31-.62-.17a1 1 0 0 0-.12.22c-.02 1.36-.03 2.73-.02 4.09h-.44c0-.99 0-1.97-.02-2.96-.02-.09-.06-.17-.1-.25-.67-.72-1.36-1.43-2.07-2.12-.06-1.48-.82-2.13-2.29-1.95-1.02.41-1.42 1.16-1.21 2.24q.51 1.32 1.95 1.26l1.55 1.55c.02.74.03 1.48.02 2.22-1.56.02-3.12 0-4.68-.07-.9-.24-1.42-.83-1.55-1.75-.02-4.48-.03-8.96-.02-13.45zm7.79 5.66c.84.06 1.19.5 1.06 1.33-.32.62-.8.79-1.45.52-.46-.37-.56-.82-.32-1.35.18-.26.42-.42.71-.49zm7.43 1.28c.89-.03 1.29.4 1.21 1.28-.33.67-.83.85-1.5.52-.54-.49-.58-1-.1-1.55.12-.11.25-.19.39-.25M9.94 19.94c.84 0 1.22.4 1.16 1.23-.28.68-.76.89-1.45.62-.63-.54-.65-1.09-.05-1.67l.34-.17zm9.75.24c.16.13.3.27.44.42-.53.52-1.05 1.05-1.55 1.6-.02 1.43-.03 2.86-.02 4.28h-.59c0-1.51 0-3.02.02-4.53a71 71 0 0 1 1.7-1.77M11.56 22c.62.53 1.21 1.11 1.75 1.72.02.92.03 1.84.02 2.76h-.59c0-.85 0-1.71-.02-2.56l-1.48-1.48s-.03-.07 0-.1c.12-.11.22-.22.32-.34",clipRule:"evenodd"})]});function ye({walletName:o,variant:e="background",className:t}){let n=i("novacore:w-full novacore:h-full novacore:rounded-full",t),a=o.toLowerCase();if(a==="impersonatedwallet")return jsx(co,{className:n});let r=so[a]??a;return jsx(Suspense,{fallback:jsx(d,{animate:true,className:t}),children:jsx(io,{id:r,variant:e,className:n,fallback:jsx(d,{content:"?",className:t})})})}function Ne(o=2e3){let[e,t]=useState(false),[n,a]=useState(null),r=useCallback(async u=>{if(u)try{await navigator.clipboard.writeText(u),t(!0),a(null),setTimeout(()=>t(!1),o);}catch(m){let f=m instanceof Error?m:new Error("Failed to copy text.");console.error(f),a(f),setTimeout(()=>a(null),o);}},[o]);return {isCopied:e,copy:r,error:n}}function De(o){let e=a=>typeof window<"u"?window.matchMedia(a).matches:false,[t,n]=useState(e(o));return useEffect(()=>{let a=window.matchMedia(o),r=()=>n(a.matches);return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[o]),t}
|
|
48
|
+
export{Vo as ChevronArrowWithAnim,B as CloseIcon,Uo as Dialog,Jo as DialogClose,G as DialogContent,Q as DialogDescription,K as DialogFooter,j as DialogHeader,L as DialogOverlay,_ as DialogPortal,U as DialogTitle,Qo as DialogTrigger,d as FallbackIcon,ne as NetworkIcon,ce as StarsBackground,ve as ToastCloseButton,ye as WalletIcon,i as cn,z as deepMerge,C as getChainName,w as isSolanaDev,D as isTouchDevice,po as standardButtonClasses,Do as textCenterEllipsis,Ne as useCopyToClipboard,De as useMediaQuery};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/nova-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
],
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@radix-ui/react-dialog": "1.x.x",
|
|
52
|
+
"@web3icons/react": ">=4",
|
|
52
53
|
"clsx": "2.x.x",
|
|
53
54
|
"framer-motion": "12.x.x",
|
|
54
55
|
"react": ">=19.2.3",
|
|
@@ -57,11 +58,13 @@
|
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@tailwindcss/postcss": "^4.1.18",
|
|
59
60
|
"@tailwindcss/vite": "^4.1.18",
|
|
60
|
-
"@types/react": "^19.2.
|
|
61
|
+
"@types/react": "^19.2.8",
|
|
61
62
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
63
|
+
"@web3icons/react": "^4.1.13",
|
|
64
|
+
"@web3icons/common": "^0.11.42",
|
|
62
65
|
"autoprefixer": "^10.4.23",
|
|
63
66
|
"clsx": "^2.1.1",
|
|
64
|
-
"framer-motion": "^12.
|
|
67
|
+
"framer-motion": "^12.26.2",
|
|
65
68
|
"postcss": "^8.5.6",
|
|
66
69
|
"postcss-cli": "^11.0.1",
|
|
67
70
|
"react": "^19.2.3",
|