@tuwaio/nova-core 1.0.0-fix-integrate-orbit-alpha.1.64ac306 → 1.0.0-fix-integrate-orbit-alpha.3.521f7fb

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 CHANGED
@@ -1,2 +1,3 @@
1
- 'use strict';var react=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function w(e=2e3){let[o,t]=react.useState(false),[n,r]=react.useState(null),s=react.useCallback(async a=>{if(a)try{await navigator.clipboard.writeText(a),t(!0),r(null),setTimeout(()=>t(!1),e);}catch(c){let l=c instanceof Error?c:new Error("Failed to copy text.");console.error(l),r(l),setTimeout(()=>r(null),e);}},[e]);return {isCopied:o,copy:s,error:n}}function E(e){let o=r=>typeof window<"u"?window.matchMedia(r).matches:false,[t,n]=react.useState(o(e));return react.useEffect(()=>{let r=window.matchMedia(e),s=()=>n(r.matches);return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[e]),t}function v(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var i=e=>e&&typeof e=="object"&&!Array.isArray(e);function g(e,o){let t={...e};return i(e)&&i(o)&&Object.keys(o).forEach(n=>{let r=e[n],s=o[n];i(r)&&i(s)?t[n]=g(r,s):t[n]=s;}),t}function R(e,o,t){if(!e)return "";if(e.length<=o+t)return e;let n=e.slice(0,o),r=e.slice(e.length-t);return `${n}...${r}`}exports.cn=v;exports.deepMerge=g;exports.textCenterEllipsis=R;exports.useCopyToClipboard=w;exports.useMediaQuery=E;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var c=require('react'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime'),i=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 c__namespace=/*#__PURE__*/_interopNamespace(c);var i__namespace=/*#__PURE__*/_interopNamespace(i);function n(...e){return tailwindMerge.twMerge(clsx.clsx(e))}var m=e=>e&&typeof e=="object"&&!Array.isArray(e);function x(e,t){let o={...e};return m(e)&&m(t)&&Object.keys(t).forEach(r=>{let a=e[r],l=t[r];m(a)&&m(l)?o[r]=x(a,l):o[r]=l;}),o}function j(e,t,o){if(!e)return "";if(e.length<=t+o)return e;let r=e.slice(0,t),a=e.slice(e.length-o);return `${r}...${a}`}var D=c__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsxs("svg",{ref:o,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n("h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors",e),...t,children:[jsxRuntime.jsx("path",{d:"M18 6 6 18"}),jsxRuntime.jsx("path",{d:"m6 6 12 12"})]}));D.displayName="CloseIcon";var K=i__namespace.Root,U=i__namespace.Trigger,P=i__namespace.Portal,X=i__namespace.Close,v=c__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx(i__namespace.Overlay,{ref:o,className:n("fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150","animate-in fade-in-0",e),...t}));v.displayName=i__namespace.Overlay.displayName;var h=c__namespace.forwardRef(({className:e,children:t,...o},r)=>jsxRuntime.jsxs(P,{children:[jsxRuntime.jsx(v,{}),jsxRuntime.jsx(i__namespace.Content,{"aria-describedby":"tuwa:modal-content",ref:r,className:n("fixed left-[50%] top-[50%] z-50 w-full max-w-full translate-x-[-50%] translate-y-[-50%] p-4 outline-none",e),...o,children:jsxRuntime.jsx("div",{className:"relative rounded-2xl overflow-hidden",children:jsxRuntime.jsx("div",{className:n("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-2xl shadow-2xl","border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]","animate-in fade-in-0 zoom-in-95 lide-in-from-top-[48%] duration-350"),children:t})})})]}));h.displayName=i__namespace.Content.displayName;var C=({className:e,...t})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-header",className:n("sticky flex top-0 z-11 w-full flex-row items-center justify-between","border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4",e),...t});C.displayName="DialogHeader";var T=({className:e,...t})=>jsxRuntime.jsx("div",{"aria-describedby":"tuwa:modal-footer",className:n("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});T.displayName="DialogFooter";var N=c__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx(i__namespace.Title,{ref:o,"aria-describedby":"tuwa:modal-title",className:n("text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0",e),...t}));N.displayName=i__namespace.Title.displayName;var E=c__namespace.forwardRef(({className:e,...t},o)=>jsxRuntime.jsx(i__namespace.Description,{"aria-describedby":"tuwa:modal-description",ref:o,className:n("text-sm text-[var(--tuwa-text-secondary)]",e),...t}));E.displayName=i__namespace.Description.displayName;function q(e=2e3){let[t,o]=c.useState(false),[r,a]=c.useState(null),l=c.useCallback(async d=>{if(d)try{await navigator.clipboard.writeText(d),o(!0),a(null),setTimeout(()=>o(!1),e);}catch(f){let p=f instanceof Error?f:new Error("Failed to copy text.");console.error(p),a(p),setTimeout(()=>a(null),e);}},[e]);return {isCopied:t,copy:l,error:r}}function oe(e){let t=a=>typeof window<"u"?window.matchMedia(a).matches:false,[o,r]=c.useState(t(e));return c.useEffect(()=>{let a=window.matchMedia(e),l=()=>r(a.matches);return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[e]),o}
2
+ exports.CloseIcon=D;exports.Dialog=K;exports.DialogClose=X;exports.DialogContent=h;exports.DialogDescription=E;exports.DialogFooter=T;exports.DialogHeader=C;exports.DialogOverlay=v;exports.DialogPortal=P;exports.DialogTitle=N;exports.DialogTrigger=U;exports.cn=n;exports.deepMerge=x;exports.textCenterEllipsis=j;exports.useCopyToClipboard=q;exports.useMediaQuery=oe;//# sourceMappingURL=index.cjs.map
2
3
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts","../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts"],"names":["useCopyToClipboard","timeout","isCopied","setIsCopied","useState","error","setError","copy","useCallback","text","e","copyError","useMediaQuery","query","getMatches","q","matches","setMatches","useEffect","media","listener","cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end"],"mappings":"qGA6BO,SAASA,CAAAA,CAAmBC,CAAAA,CAAU,GAAA,CAI3C,CACA,GAAM,CAACC,CAAAA,CAAUC,CAAW,CAAA,CAAIC,cAAAA,CAAS,KAAK,CAAA,CACxC,CAACC,CAAAA,CAAOC,CAAQ,CAAA,CAAIF,eAAuB,IAAI,CAAA,CAE/CG,CAAAA,CAAOC,iBAAAA,CACX,MAAOC,CAAAA,EAAiB,CACtB,GAAKA,EAEL,GAAI,CACF,MAAM,SAAA,CAAU,SAAA,CAAU,SAAA,CAAUA,CAAI,CAAA,CACxCN,EAAY,CAAA,CAAI,CAAA,CAChBG,CAAAA,CAAS,IAAI,CAAA,CAEb,UAAA,CAAW,IAAMH,CAAAA,CAAY,EAAK,CAAA,CAAGF,CAAO,EAC9C,CAAA,MAASS,CAAAA,CAAG,CACV,IAAMC,CAAAA,CAAYD,aAAa,KAAA,CAAQA,CAAAA,CAAI,IAAI,KAAA,CAAM,sBAAsB,CAAA,CAC3E,OAAA,CAAQ,KAAA,CAAMC,CAAS,CAAA,CACvBL,CAAAA,CAASK,CAAS,CAAA,CAGlB,UAAA,CAAW,IAAML,CAAAA,CAAS,IAAI,EAAGL,CAAO,EAC1C,CACF,C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AAcJ,EAAOG,CAAc,CAAA,CACnCE,CAAAA,CAAcJ,CAAAA,CAAOE,CAAc,CAAA,CAGrCN,CAAAA,CAASO,CAAW,GAAKP,CAAAA,CAASQ,CAAW,CAAA,CAG9CH,CAAAA,CAA+BC,CAAG,CAAA,CAAIJ,CAAAA,CAAUK,CAAAA,CAAaC,CAAW,CAAA,CAGxEH,CAAAA,CAA+BC,CAAG,CAAA,CAAIE,EAE3C,CAAC,CAAA,CAGIH,CACT,CCjCO,SAASI,CAAAA,CAAmBC,CAAAA,CAAgCC,CAAAA,CAAcC,CAAAA,CAAoB,CACnG,GAAI,CAACF,EACH,OAAO,EAAA,CAIT,GAAIA,CAAAA,CAAI,MAAA,EAAUC,CAAAA,CAAOC,CAAAA,CACvB,OAAOF,EAGT,IAAMG,CAAAA,CAAQH,CAAAA,CAAI,KAAA,CAAM,CAAA,CAAGC,CAAI,CAAA,CACzBG,CAAAA,CAAMJ,EAAI,KAAA,CAAMA,CAAAA,CAAI,MAAA,CAASE,CAAE,EAErC,OAAO,CAAA,EAAGC,CAAK,CAAA,GAAA,EAAMC,CAAG,CAAA,CAC1B","file":"index.cjs","sourcesContent":["/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n","/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts","../src/components/CloseIcon.tsx","../src/components/Modal.tsx","../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts"],"names":["cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end","CloseIcon","g","className","props","ref","jsxs","jsx","Dialog","i","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","c","DialogContent","children","DialogHeader","DialogFooter","DialogTitle","DialogDescription","useCopyToClipboard","timeout","isCopied","setIsCopied","useState","error","setError","copy","useCallback","text","e","copyError","useMediaQuery","query","getMatches","q","matches","setMatches","useEffect","media","listener"],"mappings":"skBAwBO,SAASA,CAAAA,CAAAA,GAAMC,EAA8B,CAClD,OAAOC,qBAAAA,CAAQC,SAAAA,CAAKF,CAAM,CAAC,CAC7B,CChBA,IAAMG,CAAAA,CAAYC,CAAAA,EACTA,CAAAA,EAAQ,OAAOA,CAAAA,EAAS,QAAA,EAAY,CAAC,KAAA,CAAM,QAAQA,CAAI,CAAA,CAkBzD,SAASC,CAAAA,CAA4BC,CAAAA,CAAWC,CAAAA,CAAuB,CAE5E,IAAMC,EAAS,CAAE,GAAGF,CAAO,CAAA,CAE3B,OAAIH,CAAAA,CAASG,CAAM,CAAA,EAAKH,EAASI,CAAM,CAAA,EAErC,MAAA,CAAO,IAAA,CAAKA,CAAM,CAAA,CAAE,OAAA,CAASE,CAAAA,EAAQ,CACnC,IAAMC,CAAAA,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C,CAAAA,CAASC,CAAU,CAAA,CAAIb,UAAAA,CAAkBU,CAAAA,CAAWD,CAAK,CAAC,CAAA,CAEjE,OAAAK,WAAAA,CAAU,IAAM,CACd,IAAMC,CAAAA,CAAQ,MAAA,CAAO,WAAWN,CAAK,CAAA,CAC/BO,CAAAA,CAAW,IAAMH,CAAAA,CAAWE,CAAAA,CAAM,OAAO,CAAA,CAG/C,OAAAC,CAAAA,EAAS,CACT,MAAA,CAAO,gBAAA,CAAiB,QAAA,CAAUA,CAAQ,CAAA,CAEnC,IAAM,OAAO,mBAAA,CAAoB,QAAA,CAAUA,CAAQ,CAC5D,CAAA,CAAG,CAACP,CAAK,CAAC,EAEHG,CACT","file":"index.cjs","sourcesContent":["/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n","import * as React from 'react';\n\nimport { cn } from '../utils';\n\n/**\n * A reusable close button icon (X mark) styled with TUWA color scheme.\n */\nexport const CloseIcon = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGSVGElement>>(\n ({ className, ...props }, ref) => (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn('h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors', className)}\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n ),\n);\nCloseIcon.displayName = 'CloseIcon';\n","import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport * as React from 'react';\n\nimport { cn } from '../utils';\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150',\n 'animate-in fade-in-0',\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n\n <DialogPrimitive.Content\n aria-describedby=\"tuwa:modal-content\"\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 w-full max-w-full translate-x-[-50%] translate-y-[-50%] p-4 outline-none',\n className,\n )}\n {...props}\n >\n <div className=\"relative rounded-2xl overflow-hidden\">\n <div\n className={cn(\n 'relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-2xl shadow-2xl',\n 'border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]',\n 'animate-in fade-in-0 zoom-in-95 lide-in-from-top-[48%] duration-350',\n )}\n >\n {children}\n </div>\n </div>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-header\"\n className={cn(\n 'sticky flex top-0 z-11 w-full flex-row items-center justify-between',\n 'border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4',\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-footer\"\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n aria-describedby=\"tuwa:modal-title\"\n className={cn('text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n aria-describedby=\"tuwa:modal-description\"\n ref={ref}\n className={cn('text-sm text-[var(--tuwa-text-secondary)]', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n"]}
package/dist/index.css CHANGED
@@ -1,73 +1,559 @@
1
+ /*! tailwindcss v4.1.13 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
+ @layer theme, base, components, utilities;
4
+ @layer utilities {
5
+ .fixed {
6
+ position: fixed;
7
+ }
8
+ .relative {
9
+ position: relative;
10
+ }
11
+ .sticky {
12
+ position: sticky;
13
+ }
14
+ .inset-0 {
15
+ inset: calc(0.25rem * 0);
16
+ }
17
+ .top-0 {
18
+ top: calc(0.25rem * 0);
19
+ }
20
+ .top-\[50\%\] {
21
+ top: 50%;
22
+ }
23
+ .left-\[50\%\] {
24
+ left: 50%;
25
+ }
26
+ .z-11 {
27
+ z-index: 11;
28
+ }
29
+ .z-50 {
30
+ z-index: 50;
31
+ }
32
+ .m-0 {
33
+ margin: calc(0.25rem * 0);
34
+ }
35
+ .contents {
36
+ display: contents;
37
+ }
38
+ .flex {
39
+ display: flex;
40
+ }
41
+ .h-5 {
42
+ height: calc(0.25rem * 5);
43
+ }
44
+ .max-h-\[98dvh\] {
45
+ max-height: 98dvh;
46
+ }
47
+ .w-5 {
48
+ width: calc(0.25rem * 5);
49
+ }
50
+ .w-full {
51
+ width: 100%;
52
+ }
53
+ .max-w-full {
54
+ max-width: 100%;
55
+ }
56
+ .translate-x-\[-50\%\] {
57
+ --tw-translate-x: -50%;
58
+ translate: var(--tw-translate-x) var(--tw-translate-y);
59
+ }
60
+ .translate-y-\[-50\%\] {
61
+ --tw-translate-y: -50%;
62
+ translate: var(--tw-translate-x) var(--tw-translate-y);
63
+ }
64
+ .animate-in {
65
+ animation: enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none);
66
+ }
67
+ .resize {
68
+ resize: both;
69
+ }
70
+ .flex-col {
71
+ flex-direction: column;
72
+ }
73
+ .flex-col-reverse {
74
+ flex-direction: column-reverse;
75
+ }
76
+ .flex-row {
77
+ flex-direction: row;
78
+ }
79
+ .items-center {
80
+ align-items: center;
81
+ }
82
+ .justify-between {
83
+ justify-content: space-between;
84
+ }
85
+ .gap-3 {
86
+ gap: calc(0.25rem * 3);
87
+ }
88
+ .truncate {
89
+ overflow: hidden;
90
+ text-overflow: ellipsis;
91
+ white-space: nowrap;
92
+ }
93
+ .overflow-hidden {
94
+ overflow: hidden;
95
+ }
96
+ .overflow-y-auto {
97
+ overflow-y: auto;
98
+ }
99
+ .rounded-2xl {
100
+ border-radius: 1rem;
101
+ }
102
+ .border {
103
+ border-style: var(--tw-border-style);
104
+ border-width: 1px;
105
+ }
106
+ .border-b {
107
+ border-bottom-style: var(--tw-border-style);
108
+ border-bottom-width: 1px;
109
+ }
110
+ .border-\[var\(--tuwa-border-primary\)\] {
111
+ border-color: var(--tuwa-border-primary);
112
+ }
113
+ .bg-\[var\(--tuwa-bg-primary\)\] {
114
+ background-color: var(--tuwa-bg-primary);
115
+ }
116
+ .bg-\[var\(--tuwa-color-primary\)\] {
117
+ background-color: var(--tuwa-color-primary);
118
+ }
119
+ .bg-black\/55 {
120
+ background-color: color-mix(in oklab, #000 55%, transparent);
121
+ }
122
+ .bg-red-500 {
123
+ background-color: oklch(63.7% 0.237 25.331);
124
+ }
125
+ .p-2 {
126
+ padding: calc(0.25rem * 2);
127
+ }
128
+ .p-4 {
129
+ padding: calc(0.25rem * 4);
130
+ }
131
+ .p-\[var\(--tuwa-spacing-md\)\] {
132
+ padding: var(--tuwa-spacing-md);
133
+ }
134
+ .text-lg {
135
+ font-size: 1.125rem;
136
+ line-height: var(--tw-leading, calc(1.75 / 1.125));
137
+ }
138
+ .text-sm {
139
+ font-size: 0.875rem;
140
+ line-height: var(--tw-leading, calc(1.25 / 0.875));
141
+ }
142
+ .leading-none {
143
+ --tw-leading: 1;
144
+ line-height: 1;
145
+ }
146
+ .font-bold {
147
+ --tw-font-weight: 700;
148
+ font-weight: 700;
149
+ }
150
+ .tracking-tight {
151
+ --tw-tracking: -0.025em;
152
+ letter-spacing: -0.025em;
153
+ }
154
+ .text-\[var\(--tuwa-color-foreground\)\] {
155
+ color: var(--tuwa-color-foreground);
156
+ }
157
+ .text-\[var\(--tuwa-text-primary\)\] {
158
+ color: var(--tuwa-text-primary);
159
+ }
160
+ .text-\[var\(--tuwa-text-secondary\)\] {
161
+ color: var(--tuwa-text-secondary);
162
+ }
163
+ .shadow-2xl {
164
+ --tw-shadow: 0 25px 50px -12px var(--tw-shadow-color, rgb(0 0 0 / 0.25));
165
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
166
+ }
167
+ .backdrop-blur-sm {
168
+ --tw-backdrop-blur: blur(8px);
169
+ backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
170
+ }
171
+ .backdrop-saturate-150 {
172
+ --tw-backdrop-saturate: saturate(150%);
173
+ backdrop-filter: var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);
174
+ }
175
+ .transition-colors {
176
+ transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
177
+ transition-timing-function: var(--tw-ease, cubic-bezier(0.4, 0, 0.2, 1));
178
+ transition-duration: var(--tw-duration, 150ms);
179
+ }
180
+ .duration-350 {
181
+ --tw-duration: 350ms;
182
+ transition-duration: 350ms;
183
+ }
184
+ .fade-in-0 {
185
+ --tw-enter-opacity: calc(0/100);
186
+ --tw-enter-opacity: 0;
187
+ }
188
+ .outline-none {
189
+ --tw-outline-style: none;
190
+ outline-style: none;
191
+ }
192
+ .zoom-in-95 {
193
+ --tw-enter-scale: calc(95*1%);
194
+ --tw-enter-scale: .95;
195
+ }
196
+ .sm\:flex-row {
197
+ @media (width >= 40rem) {
198
+ flex-direction: row;
199
+ }
200
+ }
201
+ .sm\:justify-end {
202
+ @media (width >= 40rem) {
203
+ justify-content: flex-end;
204
+ }
205
+ }
206
+ .sm\:space-x-2 {
207
+ @media (width >= 40rem) {
208
+ :where(& > :not(:last-child)) {
209
+ --tw-space-x-reverse: 0;
210
+ margin-inline-start: calc(calc(0.25rem * 2) * var(--tw-space-x-reverse));
211
+ margin-inline-end: calc(calc(0.25rem * 2) * calc(1 - var(--tw-space-x-reverse)));
212
+ }
213
+ }
214
+ }
215
+ }
216
+ @property --tw-animation-delay {
217
+ syntax: "*";
218
+ inherits: false;
219
+ initial-value: 0s;
220
+ }
221
+ @property --tw-animation-direction {
222
+ syntax: "*";
223
+ inherits: false;
224
+ initial-value: normal;
225
+ }
226
+ @property --tw-animation-duration {
227
+ syntax: "*";
228
+ inherits: false;
229
+ }
230
+ @property --tw-animation-fill-mode {
231
+ syntax: "*";
232
+ inherits: false;
233
+ initial-value: none;
234
+ }
235
+ @property --tw-animation-iteration-count {
236
+ syntax: "*";
237
+ inherits: false;
238
+ initial-value: 1;
239
+ }
240
+ @property --tw-enter-blur {
241
+ syntax: "*";
242
+ inherits: false;
243
+ initial-value: 0;
244
+ }
245
+ @property --tw-enter-opacity {
246
+ syntax: "*";
247
+ inherits: false;
248
+ initial-value: 1;
249
+ }
250
+ @property --tw-enter-rotate {
251
+ syntax: "*";
252
+ inherits: false;
253
+ initial-value: 0;
254
+ }
255
+ @property --tw-enter-scale {
256
+ syntax: "*";
257
+ inherits: false;
258
+ initial-value: 1;
259
+ }
260
+ @property --tw-enter-translate-x {
261
+ syntax: "*";
262
+ inherits: false;
263
+ initial-value: 0;
264
+ }
265
+ @property --tw-enter-translate-y {
266
+ syntax: "*";
267
+ inherits: false;
268
+ initial-value: 0;
269
+ }
270
+ @property --tw-exit-blur {
271
+ syntax: "*";
272
+ inherits: false;
273
+ initial-value: 0;
274
+ }
275
+ @property --tw-exit-opacity {
276
+ syntax: "*";
277
+ inherits: false;
278
+ initial-value: 1;
279
+ }
280
+ @property --tw-exit-rotate {
281
+ syntax: "*";
282
+ inherits: false;
283
+ initial-value: 0;
284
+ }
285
+ @property --tw-exit-scale {
286
+ syntax: "*";
287
+ inherits: false;
288
+ initial-value: 1;
289
+ }
290
+ @property --tw-exit-translate-x {
291
+ syntax: "*";
292
+ inherits: false;
293
+ initial-value: 0;
294
+ }
295
+ @property --tw-exit-translate-y {
296
+ syntax: "*";
297
+ inherits: false;
298
+ initial-value: 0;
299
+ }
1
300
  :root {
2
- --tuwa-success-bg: theme('colors.green.100');
3
- --tuwa-success-text: theme('colors.green.700');
4
- --tuwa-success-icon: theme('colors.green.500');
5
-
6
- --tuwa-error-bg: theme('colors.red.100');
7
- --tuwa-error-text: theme('colors.red.700');
8
- --tuwa-error-icon: theme('colors.red.500');
9
-
10
- --tuwa-pending-bg: theme('colors.yellow.100');
11
- --tuwa-pending-text: theme('colors.yellow.800');
12
- --tuwa-pending-icon: theme('colors.yellow.600');
13
-
14
- --tuwa-info-bg: theme('colors.gray.100');
15
- --tuwa-info-text: theme('colors.gray.600');
16
- --tuwa-info-icon: theme('colors.gray.500');
17
-
18
- --tuwa-text-primary: theme('colors.gray.900');
19
- --tuwa-text-secondary: theme('colors.gray.500');
20
- --tuwa-text-tertiary: theme('colors.gray.400');
21
- --tuwa-text-accent: theme('colors.blue.600');
22
- --tuwa-text-on-accent: theme('colors.white');
23
-
24
- --tuwa-bg-primary: theme('colors.white');
25
- --tuwa-bg-secondary: theme('colors.gray.50');
26
- --tuwa-bg-muted: theme('colors.gray.100');
27
-
28
- --tuwa-border-primary: theme('colors.gray.200');
29
- --tuwa-border-secondary: theme('colors.gray.100');
30
-
31
- --tuwa-button-gradient-from: theme('colors.blue.600');
32
- --tuwa-button-gradient-to: theme('colors.purple.600');
33
-
34
- --tuwa-button-gradient-from-hover: theme('colors.blue.700');
35
- --tuwa-button-gradient-to-hover: theme('colors.purple.700');
36
- }
37
-
301
+ --tuwa-success-bg: oklch(96.2% 0.044 156.743);
302
+ --tuwa-success-text: oklch(52.7% 0.154 150.069);
303
+ --tuwa-success-icon: oklch(72.3% 0.219 149.579);
304
+ --tuwa-error-bg: oklch(93.6% 0.032 17.717);
305
+ --tuwa-error-text: oklch(50.5% 0.213 27.518);
306
+ --tuwa-error-icon: oklch(63.7% 0.237 25.331);
307
+ --tuwa-pending-bg: oklch(97.3% 0.071 103.193);
308
+ --tuwa-pending-text: oklch(47.6% 0.114 61.907);
309
+ --tuwa-pending-icon: oklch(68.1% 0.162 75.834);
310
+ --tuwa-info-bg: oklch(96.7% 0.003 264.542);
311
+ --tuwa-info-text: oklch(44.6% 0.03 256.802);
312
+ --tuwa-info-icon: oklch(55.1% 0.027 264.364);
313
+ --tuwa-text-primary: oklch(21% 0.034 264.665);
314
+ --tuwa-text-secondary: oklch(55.1% 0.027 264.364);
315
+ --tuwa-text-tertiary: oklch(70.7% 0.022 261.325);
316
+ --tuwa-text-accent: oklch(54.6% 0.245 262.881);
317
+ --tuwa-text-on-accent: #fff;
318
+ --tuwa-bg-primary: #fff;
319
+ --tuwa-bg-secondary: oklch(98.5% 0.002 247.839);
320
+ --tuwa-bg-muted: oklch(96.7% 0.003 264.542);
321
+ --tuwa-border-primary: oklch(92.8% 0.006 264.531);
322
+ --tuwa-border-secondary: oklch(96.7% 0.003 264.542);
323
+ --tuwa-button-gradient-from: oklch(54.6% 0.245 262.881);
324
+ --tuwa-button-gradient-to: oklch(55.8% 0.288 302.321);
325
+ --tuwa-button-gradient-from-hover: oklch(48.8% 0.243 264.376);
326
+ --tuwa-button-gradient-to-hover: oklch(49.6% 0.265 301.924);
327
+ }
38
328
  .dark {
39
- --tuwa-success-bg: theme('colors.green.900');
40
- --tuwa-success-text: theme('colors.green.300');
41
- --tuwa-success-icon: theme('colors.green.400');
42
-
43
- --tuwa-error-bg: theme('colors.red.900');
44
- --tuwa-error-text: theme('colors.red.300');
45
- --tuwa-error-icon: theme('colors.red.400');
46
-
47
- --tuwa-pending-bg: theme('colors.yellow.900');
48
- --tuwa-pending-text: theme('colors.yellow.300');
49
- --tuwa-pending-icon: theme('colors.yellow.400');
50
-
51
- --tuwa-info-bg: theme('colors.gray.700');
52
- --tuwa-info-text: theme('colors.gray.300');
53
- --tuwa-info-icon: theme('colors.gray.400');
54
-
55
- --tuwa-text-primary: theme('colors.gray.50');
56
- --tuwa-text-secondary: theme('colors.gray.400');
57
- --tuwa-text-tertiary: theme('colors.gray.500');
58
- --tuwa-text-accent: theme('colors.blue.400');
59
- --tuwa-text-on-accent: theme('colors.white');
60
-
61
- --tuwa-bg-primary: theme('colors.gray.900');
62
- --tuwa-bg-secondary: theme('colors.gray.800');
63
- --tuwa-bg-muted: theme('colors.gray.700');
64
-
65
- --tuwa-border-primary: theme('colors.gray.700');
66
- --tuwa-border-secondary: theme('colors.gray.800');
67
-
68
- --tuwa-button-gradient-from: theme('colors.blue.500');
69
- --tuwa-button-gradient-to: theme('colors.purple.500');
70
-
71
- --tuwa-button-gradient-from-hover: theme('colors.blue.600');
72
- --tuwa-button-gradient-to-hover: theme('colors.purple.600');
73
- }
329
+ --tuwa-success-bg: oklch(39.3% 0.095 152.535);
330
+ --tuwa-success-text: oklch(87.1% 0.15 154.449);
331
+ --tuwa-success-icon: oklch(79.2% 0.209 151.711);
332
+ --tuwa-error-bg: oklch(39.6% 0.141 25.723);
333
+ --tuwa-error-text: oklch(80.8% 0.114 19.571);
334
+ --tuwa-error-icon: oklch(70.4% 0.191 22.216);
335
+ --tuwa-pending-bg: oklch(42.1% 0.095 57.708);
336
+ --tuwa-pending-text: oklch(90.5% 0.182 98.111);
337
+ --tuwa-pending-icon: oklch(85.2% 0.199 91.936);
338
+ --tuwa-info-bg: oklch(37.3% 0.034 259.733);
339
+ --tuwa-info-text: oklch(87.2% 0.01 258.338);
340
+ --tuwa-info-icon: oklch(70.7% 0.022 261.325);
341
+ --tuwa-text-primary: oklch(98.5% 0.002 247.839);
342
+ --tuwa-text-secondary: oklch(70.7% 0.022 261.325);
343
+ --tuwa-text-tertiary: oklch(55.1% 0.027 264.364);
344
+ --tuwa-text-accent: oklch(70.7% 0.165 254.624);
345
+ --tuwa-text-on-accent: #fff;
346
+ --tuwa-bg-primary: oklch(21% 0.034 264.665);
347
+ --tuwa-bg-secondary: oklch(27.8% 0.033 256.848);
348
+ --tuwa-bg-muted: oklch(37.3% 0.034 259.733);
349
+ --tuwa-border-primary: oklch(37.3% 0.034 259.733);
350
+ --tuwa-border-secondary: oklch(27.8% 0.033 256.848);
351
+ --tuwa-button-gradient-from: oklch(62.3% 0.214 259.815);
352
+ --tuwa-button-gradient-to: oklch(62.7% 0.265 303.9);
353
+ --tuwa-button-gradient-from-hover: oklch(54.6% 0.245 262.881);
354
+ --tuwa-button-gradient-to-hover: oklch(55.8% 0.288 302.321);
355
+ }
356
+ @property --tw-translate-x {
357
+ syntax: "*";
358
+ inherits: false;
359
+ initial-value: 0;
360
+ }
361
+ @property --tw-translate-y {
362
+ syntax: "*";
363
+ inherits: false;
364
+ initial-value: 0;
365
+ }
366
+ @property --tw-translate-z {
367
+ syntax: "*";
368
+ inherits: false;
369
+ initial-value: 0;
370
+ }
371
+ @property --tw-border-style {
372
+ syntax: "*";
373
+ inherits: false;
374
+ initial-value: solid;
375
+ }
376
+ @property --tw-leading {
377
+ syntax: "*";
378
+ inherits: false;
379
+ }
380
+ @property --tw-font-weight {
381
+ syntax: "*";
382
+ inherits: false;
383
+ }
384
+ @property --tw-tracking {
385
+ syntax: "*";
386
+ inherits: false;
387
+ }
388
+ @property --tw-shadow {
389
+ syntax: "*";
390
+ inherits: false;
391
+ initial-value: 0 0 #0000;
392
+ }
393
+ @property --tw-shadow-color {
394
+ syntax: "*";
395
+ inherits: false;
396
+ }
397
+ @property --tw-shadow-alpha {
398
+ syntax: "<percentage>";
399
+ inherits: false;
400
+ initial-value: 100%;
401
+ }
402
+ @property --tw-inset-shadow {
403
+ syntax: "*";
404
+ inherits: false;
405
+ initial-value: 0 0 #0000;
406
+ }
407
+ @property --tw-inset-shadow-color {
408
+ syntax: "*";
409
+ inherits: false;
410
+ }
411
+ @property --tw-inset-shadow-alpha {
412
+ syntax: "<percentage>";
413
+ inherits: false;
414
+ initial-value: 100%;
415
+ }
416
+ @property --tw-ring-color {
417
+ syntax: "*";
418
+ inherits: false;
419
+ }
420
+ @property --tw-ring-shadow {
421
+ syntax: "*";
422
+ inherits: false;
423
+ initial-value: 0 0 #0000;
424
+ }
425
+ @property --tw-inset-ring-color {
426
+ syntax: "*";
427
+ inherits: false;
428
+ }
429
+ @property --tw-inset-ring-shadow {
430
+ syntax: "*";
431
+ inherits: false;
432
+ initial-value: 0 0 #0000;
433
+ }
434
+ @property --tw-ring-inset {
435
+ syntax: "*";
436
+ inherits: false;
437
+ }
438
+ @property --tw-ring-offset-width {
439
+ syntax: "<length>";
440
+ inherits: false;
441
+ initial-value: 0px;
442
+ }
443
+ @property --tw-ring-offset-color {
444
+ syntax: "*";
445
+ inherits: false;
446
+ initial-value: #fff;
447
+ }
448
+ @property --tw-ring-offset-shadow {
449
+ syntax: "*";
450
+ inherits: false;
451
+ initial-value: 0 0 #0000;
452
+ }
453
+ @property --tw-backdrop-blur {
454
+ syntax: "*";
455
+ inherits: false;
456
+ }
457
+ @property --tw-backdrop-brightness {
458
+ syntax: "*";
459
+ inherits: false;
460
+ }
461
+ @property --tw-backdrop-contrast {
462
+ syntax: "*";
463
+ inherits: false;
464
+ }
465
+ @property --tw-backdrop-grayscale {
466
+ syntax: "*";
467
+ inherits: false;
468
+ }
469
+ @property --tw-backdrop-hue-rotate {
470
+ syntax: "*";
471
+ inherits: false;
472
+ }
473
+ @property --tw-backdrop-invert {
474
+ syntax: "*";
475
+ inherits: false;
476
+ }
477
+ @property --tw-backdrop-opacity {
478
+ syntax: "*";
479
+ inherits: false;
480
+ }
481
+ @property --tw-backdrop-saturate {
482
+ syntax: "*";
483
+ inherits: false;
484
+ }
485
+ @property --tw-backdrop-sepia {
486
+ syntax: "*";
487
+ inherits: false;
488
+ }
489
+ @property --tw-duration {
490
+ syntax: "*";
491
+ inherits: false;
492
+ }
493
+ @property --tw-space-x-reverse {
494
+ syntax: "*";
495
+ inherits: false;
496
+ initial-value: 0;
497
+ }
498
+ @keyframes enter {
499
+ from {
500
+ opacity: var(--tw-enter-opacity,1);
501
+ transform: translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0));
502
+ filter: blur(var(--tw-enter-blur,0));
503
+ }
504
+ }
505
+ @layer properties {
506
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
507
+ *, ::before, ::after, ::backdrop {
508
+ --tw-translate-x: 0;
509
+ --tw-translate-y: 0;
510
+ --tw-translate-z: 0;
511
+ --tw-border-style: solid;
512
+ --tw-leading: initial;
513
+ --tw-font-weight: initial;
514
+ --tw-tracking: initial;
515
+ --tw-shadow: 0 0 #0000;
516
+ --tw-shadow-color: initial;
517
+ --tw-shadow-alpha: 100%;
518
+ --tw-inset-shadow: 0 0 #0000;
519
+ --tw-inset-shadow-color: initial;
520
+ --tw-inset-shadow-alpha: 100%;
521
+ --tw-ring-color: initial;
522
+ --tw-ring-shadow: 0 0 #0000;
523
+ --tw-inset-ring-color: initial;
524
+ --tw-inset-ring-shadow: 0 0 #0000;
525
+ --tw-ring-inset: initial;
526
+ --tw-ring-offset-width: 0px;
527
+ --tw-ring-offset-color: #fff;
528
+ --tw-ring-offset-shadow: 0 0 #0000;
529
+ --tw-backdrop-blur: initial;
530
+ --tw-backdrop-brightness: initial;
531
+ --tw-backdrop-contrast: initial;
532
+ --tw-backdrop-grayscale: initial;
533
+ --tw-backdrop-hue-rotate: initial;
534
+ --tw-backdrop-invert: initial;
535
+ --tw-backdrop-opacity: initial;
536
+ --tw-backdrop-saturate: initial;
537
+ --tw-backdrop-sepia: initial;
538
+ --tw-duration: initial;
539
+ --tw-space-x-reverse: 0;
540
+ --tw-animation-delay: 0s;
541
+ --tw-animation-direction: normal;
542
+ --tw-animation-duration: initial;
543
+ --tw-animation-fill-mode: none;
544
+ --tw-animation-iteration-count: 1;
545
+ --tw-enter-blur: 0;
546
+ --tw-enter-opacity: 1;
547
+ --tw-enter-rotate: 0;
548
+ --tw-enter-scale: 1;
549
+ --tw-enter-translate-x: 0;
550
+ --tw-enter-translate-y: 0;
551
+ --tw-exit-blur: 0;
552
+ --tw-exit-opacity: 1;
553
+ --tw-exit-rotate: 0;
554
+ --tw-exit-scale: 1;
555
+ --tw-exit-translate-x: 0;
556
+ --tw-exit-translate-y: 0;
557
+ }
558
+ }
559
+ }
package/dist/index.d.cts CHANGED
@@ -1,5 +1,30 @@
1
+ import * as React from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
1
4
  import { ClassValue } from 'clsx';
2
5
 
6
+ /**
7
+ * A reusable close button icon (X mark) styled with TUWA color scheme.
8
+ */
9
+ declare const CloseIcon: React.ForwardRefExoticComponent<React.SVGAttributes<SVGSVGElement> & React.RefAttributes<SVGSVGElement>>;
10
+
11
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
12
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
13
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
14
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
15
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
+ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
+ declare const DialogHeader: {
18
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
19
+ displayName: string;
20
+ };
21
+ declare const DialogFooter: {
22
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
23
+ displayName: string;
24
+ };
25
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
26
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
27
+
3
28
  /**
4
29
  * @file This file contains a custom React hook for copying text to the clipboard.
5
30
  */
@@ -103,4 +128,4 @@ declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
103
128
  */
104
129
  declare function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string;
105
130
 
106
- export { cn, deepMerge, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
131
+ export { CloseIcon, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, cn, deepMerge, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,30 @@
1
+ import * as React from 'react';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
1
4
  import { ClassValue } from 'clsx';
2
5
 
6
+ /**
7
+ * A reusable close button icon (X mark) styled with TUWA color scheme.
8
+ */
9
+ declare const CloseIcon: React.ForwardRefExoticComponent<React.SVGAttributes<SVGSVGElement> & React.RefAttributes<SVGSVGElement>>;
10
+
11
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
12
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
13
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
14
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
15
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
+ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
17
+ declare const DialogHeader: {
18
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
19
+ displayName: string;
20
+ };
21
+ declare const DialogFooter: {
22
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
23
+ displayName: string;
24
+ };
25
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
26
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
27
+
3
28
  /**
4
29
  * @file This file contains a custom React hook for copying text to the clipboard.
5
30
  */
@@ -103,4 +128,4 @@ declare function deepMerge<T extends object>(target: T, source: Partial<T>): T;
103
128
  */
104
129
  declare function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string;
105
130
 
106
- export { cn, deepMerge, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
131
+ export { CloseIcon, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, cn, deepMerge, textCenterEllipsis, useCopyToClipboard, useMediaQuery };
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- import {useState,useCallback,useEffect}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function w(e=2e3){let[o,t]=useState(false),[n,r]=useState(null),s=useCallback(async a=>{if(a)try{await navigator.clipboard.writeText(a),t(!0),r(null),setTimeout(()=>t(!1),e);}catch(c){let l=c instanceof Error?c:new Error("Failed to copy text.");console.error(l),r(l),setTimeout(()=>r(null),e);}},[e]);return {isCopied:o,copy:s,error:n}}function E(e){let o=r=>typeof window<"u"?window.matchMedia(r).matches:false,[t,n]=useState(o(e));return useEffect(()=>{let r=window.matchMedia(e),s=()=>n(r.matches);return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[e]),t}function v(...e){return twMerge(clsx(e))}var i=e=>e&&typeof e=="object"&&!Array.isArray(e);function g(e,o){let t={...e};return i(e)&&i(o)&&Object.keys(o).forEach(n=>{let r=e[n],s=o[n];i(r)&&i(s)?t[n]=g(r,s):t[n]=s;}),t}function R(e,o,t){if(!e)return "";if(e.length<=o+t)return e;let n=e.slice(0,o),r=e.slice(e.length-t);return `${n}...${r}`}export{v as cn,g as deepMerge,R as textCenterEllipsis,w as useCopyToClipboard,E as useMediaQuery};//# sourceMappingURL=index.js.map
1
+ import*as c from'react';import {useState,useCallback,useEffect}from'react';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsxs,jsx}from'react/jsx-runtime';import*as i from'@radix-ui/react-dialog';function n(...e){return twMerge(clsx(e))}var m=e=>e&&typeof e=="object"&&!Array.isArray(e);function x(e,t){let o={...e};return m(e)&&m(t)&&Object.keys(t).forEach(r=>{let a=e[r],l=t[r];m(a)&&m(l)?o[r]=x(a,l):o[r]=l;}),o}function j(e,t,o){if(!e)return "";if(e.length<=t+o)return e;let r=e.slice(0,t),a=e.slice(e.length-o);return `${r}...${a}`}var D=c.forwardRef(({className:e,...t},o)=>jsxs("svg",{ref:o,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n("h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors",e),...t,children:[jsx("path",{d:"M18 6 6 18"}),jsx("path",{d:"m6 6 12 12"})]}));D.displayName="CloseIcon";var K=i.Root,U=i.Trigger,P=i.Portal,X=i.Close,v=c.forwardRef(({className:e,...t},o)=>jsx(i.Overlay,{ref:o,className:n("fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150","animate-in fade-in-0",e),...t}));v.displayName=i.Overlay.displayName;var h=c.forwardRef(({className:e,children:t,...o},r)=>jsxs(P,{children:[jsx(v,{}),jsx(i.Content,{"aria-describedby":"tuwa:modal-content",ref:r,className:n("fixed left-[50%] top-[50%] z-50 w-full max-w-full translate-x-[-50%] translate-y-[-50%] p-4 outline-none",e),...o,children:jsx("div",{className:"relative rounded-2xl overflow-hidden",children:jsx("div",{className:n("relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-2xl shadow-2xl","border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]","animate-in fade-in-0 zoom-in-95 lide-in-from-top-[48%] duration-350"),children:t})})})]}));h.displayName=i.Content.displayName;var C=({className:e,...t})=>jsx("div",{"aria-describedby":"tuwa:modal-header",className:n("sticky flex top-0 z-11 w-full flex-row items-center justify-between","border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4",e),...t});C.displayName="DialogHeader";var T=({className:e,...t})=>jsx("div",{"aria-describedby":"tuwa:modal-footer",className:n("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});T.displayName="DialogFooter";var N=c.forwardRef(({className:e,...t},o)=>jsx(i.Title,{ref:o,"aria-describedby":"tuwa:modal-title",className:n("text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0",e),...t}));N.displayName=i.Title.displayName;var E=c.forwardRef(({className:e,...t},o)=>jsx(i.Description,{"aria-describedby":"tuwa:modal-description",ref:o,className:n("text-sm text-[var(--tuwa-text-secondary)]",e),...t}));E.displayName=i.Description.displayName;function q(e=2e3){let[t,o]=useState(false),[r,a]=useState(null),l=useCallback(async d=>{if(d)try{await navigator.clipboard.writeText(d),o(!0),a(null),setTimeout(()=>o(!1),e);}catch(f){let p=f instanceof Error?f:new Error("Failed to copy text.");console.error(p),a(p),setTimeout(()=>a(null),e);}},[e]);return {isCopied:t,copy:l,error:r}}function oe(e){let t=a=>typeof window<"u"?window.matchMedia(a).matches:false,[o,r]=useState(t(e));return useEffect(()=>{let a=window.matchMedia(e),l=()=>r(a.matches);return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[e]),o}
2
+ export{D as CloseIcon,K as Dialog,X as DialogClose,h as DialogContent,E as DialogDescription,T as DialogFooter,C as DialogHeader,v as DialogOverlay,P as DialogPortal,N as DialogTitle,U as DialogTrigger,n as cn,x as deepMerge,j as textCenterEllipsis,q as useCopyToClipboard,oe as useMediaQuery};//# sourceMappingURL=index.js.map
2
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts","../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts"],"names":["useCopyToClipboard","timeout","isCopied","setIsCopied","useState","error","setError","copy","useCallback","text","e","copyError","useMediaQuery","query","getMatches","q","matches","setMatches","useEffect","media","listener","cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end"],"mappings":"gHA6BO,SAASA,CAAAA,CAAmBC,CAAAA,CAAU,GAAA,CAI3C,CACA,GAAM,CAACC,CAAAA,CAAUC,CAAW,CAAA,CAAIC,QAAAA,CAAS,KAAK,CAAA,CACxC,CAACC,CAAAA,CAAOC,CAAQ,CAAA,CAAIF,SAAuB,IAAI,CAAA,CAE/CG,CAAAA,CAAOC,WAAAA,CACX,MAAOC,CAAAA,EAAiB,CACtB,GAAKA,EAEL,GAAI,CACF,MAAM,SAAA,CAAU,SAAA,CAAU,SAAA,CAAUA,CAAI,CAAA,CACxCN,EAAY,CAAA,CAAI,CAAA,CAChBG,CAAAA,CAAS,IAAI,CAAA,CAEb,UAAA,CAAW,IAAMH,CAAAA,CAAY,EAAK,CAAA,CAAGF,CAAO,EAC9C,CAAA,MAASS,CAAAA,CAAG,CACV,IAAMC,CAAAA,CAAYD,aAAa,KAAA,CAAQA,CAAAA,CAAI,IAAI,KAAA,CAAM,sBAAsB,CAAA,CAC3E,OAAA,CAAQ,KAAA,CAAMC,CAAS,CAAA,CACvBL,CAAAA,CAASK,CAAS,CAAA,CAGlB,UAAA,CAAW,IAAML,CAAAA,CAAS,IAAI,EAAGL,CAAO,EAC1C,CACF,CAAA,CACA,CAACA,CAAO,CACV,CAAA,CAEA,OAAO,CAAE,QAAA,CAAAC,CAAAA,CAAU,IAAA,CAAAK,CAAAA,CAAM,KAAA,CAAAF,CAAM,CACjC,CCpDO,SAASO,CAAAA,CAAcC,EAAwB,CACpD,IAAMC,CAAAA,CAAcC,CAAAA,EACd,OAAO,MAAA,CAAW,GAAA,CACb,MAAA,CAAO,WAAWA,CAAC,CAAA,CAAE,OAAA,CAEvB,KAAA,CAGH,CAACC,CAAAA,CAASC,CAAU,CAAA,CAAIb,SAAkBU,CAAAA,CAAWD,CAAK,CAAC,CAAA,CAEjE,OAAAK,SAAAA,CAAU,IA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CAIT,GAAIA,CAAAA,CAAI,MAAA,EAAUC,CAAAA,CAAOC,CAAAA,CACvB,OAAOF,EAGT,IAAMG,CAAAA,CAAQH,CAAAA,CAAI,KAAA,CAAM,CAAA,CAAGC,CAAI,CAAA,CACzBG,CAAAA,CAAMJ,EAAI,KAAA,CAAMA,CAAAA,CAAI,MAAA,CAASE,CAAE,EAErC,OAAO,CAAA,EAAGC,CAAK,CAAA,GAAA,EAAMC,CAAG,CAAA,CAC1B","file":"index.js","sourcesContent":["/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n","/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/cn.ts","../src/utils/deepMerge.ts","../src/utils/textCenterEllipsis.ts","../src/components/CloseIcon.tsx","../src/components/Modal.tsx","../src/hooks/useCopyToClipboard.ts","../src/hooks/useMediaQuery.ts"],"names":["cn","inputs","twMerge","clsx","isObject","item","deepMerge","target","source","output","key","targetValue","sourceValue","textCenterEllipsis","str","from","to","start","end","CloseIcon","g","className","props","ref","jsxs","jsx","Dialog","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","DialogContent","children","DialogHeader","DialogFooter","DialogTitle","DialogDescription","useCopyToClipboard","timeout","isCopied","setIsCopied","useState","error","setError","copy","useCallback","text","e","copyError","useMediaQuery","query","getMatches","q","matches","setMatches","useEffect","media","listener"],"mappings":"0NAwBO,SAASA,CAAAA,CAAAA,GAAMC,EAA8B,CAClD,OAAOC,OAAAA,CAAQC,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CChBA,IAAMG,CAAAA,CAAYC,CAAAA,EACTA,CAAAA,EAAQ,OAAOA,CAAAA,EAAS,QAAA,EAAY,CAAC,KAAA,CAAM,QAAQA,CAAI,CAAA,CAkBzD,SAASC,CAAAA,CAA4BC,CAAAA,CAAWC,CAAAA,CAAuB,CAE5E,IAAMC,EAAS,CAAE,GAAGF,CAAO,CAAA,CAE3B,OAAIH,CAAAA,CAASG,CAAM,CAAA,EAAKH,EAASI,CAAM,CAAA,EAErC,MAAA,CAAO,IAAA,CAAKA,CAAM,CAAA,CAAE,OAAA,CAASE,CAAAA,EAAQ,CACnC,IAAMC,CAAAA,CAAcJ,CAAAA,CAAOG,CAAc,CAAA,CACnCE,CAAAA,CAAcJ,CAAAA,CAAOE,CAAc,EAGrCN,CAAAA,CAASO,CAAW,CAAA,EAAKP,CAAAA,CAASQ,CAAW,CAAA,CAG9CH,CAAAA,CAA+BC,CAAG,CAAA,CAAIJ,CAAAA,CAAUK,CAAAA,CAAaC,CAAW,CAAA,CAGxEH,CAAAA,CAA+BC,CAAG,CAAA,CAAIE,EAE3C,CAAC,CAAA,CAGIH,CACT,CCjCO,SAASI,CAAAA,CAAmBC,CAAAA,CAAgCC,CAAAA,CAAcC,EAAoB,CACnG,GAAI,CAACF,CAAAA,CACH,OAAO,EAAA,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cesContent":["/**\n * @file This file contains a utility function for conditionally merging Tailwind CSS classes.\n */\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\n/**\n * A utility function to conditionally join class names together and resolve\n * conflicting Tailwind CSS classes.\n *\n * It combines the functionality of `clsx` and `tailwind-merge`.\n *\n * @param {...ClassValue[]} inputs - A list of class values to be combined.\n * This can include strings, numbers, objects, arrays, and booleans.\n * @returns {string} The final, merged class name string.\n *\n * @example\n * cn('p-4', 'bg-red-500', { 'font-bold': true }); // => 'p-4 bg-red-500 font-bold'\n * cn('p-2', 'p-4'); // => 'p-4' (tailwind-merge resolves the conflict)\n *\n * @see https://github.com/dcastil/tailwind-merge\n * @see https://github.com/lukeed/clsx\n */\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * @file This file contains a utility for performing a deep (recursive) merge of two objects.\n */\n\n/**\n * Checks if the provided item is a plain object (i.e., not null and not an array).\n *\n * @param {any} item - The item to check.\n * @returns {item is Record<string, any>} True if the item is a plain object, otherwise false.\n */\nconst isObject = (item: any): item is Record<string, any> => {\n return item && typeof item === 'object' && !Array.isArray(item);\n};\n\n/**\n * Recursively merges the properties of a source object into a target object.\n * This function creates a new object and does not mutate the original target.\n *\n * @template T - The type of the objects being merged.\n * @param {T} target - The base object.\n * @param {Partial<T>} source - The object with properties to merge into the target.\n * @returns {T} A new object representing the merged result.\n *\n * @example\n * const defaults = { a: 1, b: { c: 2, d: 3 } };\n * const custom = { b: { c: 99 } };\n * const result = deepMerge(defaults, custom);\n * // result will be { a: 1, b: { c: 99, d: 3 } }\n */\nexport function deepMerge<T extends object>(target: T, source: Partial<T>): T {\n // Start with a shallow copy of the target to avoid mutation.\n const output = { ...target };\n\n if (isObject(target) && isObject(source)) {\n // Iterate over the keys in the source object.\n Object.keys(source).forEach((key) => {\n const targetValue = target[key as keyof T];\n const sourceValue = source[key as keyof T];\n\n // If the value is an object in both target and source, merge them recursively.\n if (isObject(targetValue) && isObject(sourceValue)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n (output as Record<string, any>)[key] = deepMerge(targetValue, sourceValue);\n } else {\n // Otherwise, the source value overwrites the target value.\n (output as Record<string, any>)[key] = sourceValue;\n }\n });\n }\n\n return output;\n}\n","/**\n * @file This file contains a utility function for truncating a string with a center ellipsis.\n */\n\n/**\n * Truncates a string by showing a specified number of characters from the start and end,\n * with an ellipsis in the middle. If the string is too short to be truncated, it's returned as is.\n *\n * @param {string} str - The string to truncate.\n * @param {number} from - The number of characters to show from the beginning of the string.\n * @param {number} to - The number of characters to show from the end of the string.\n * @returns {string} The truncated string, or the original string if it's too short.\n *\n * @example\n * const hash = '0x1234567890abcdef1234567890abcdef';\n * textCenterEllipsis(hash, 6, 4); // => \"0x1234...cdef\"\n *\n * textCenterEllipsis('short', 6, 4); // => \"short\"\n */\nexport function textCenterEllipsis(str: string | undefined | null, from: number, to: number): string {\n if (!str) {\n return '';\n }\n\n // If the string is short enough, don't truncate it.\n if (str.length <= from + to) {\n return str;\n }\n\n const start = str.slice(0, from);\n const end = str.slice(str.length - to);\n\n return `${start}...${end}`;\n}\n","import * as React from 'react';\n\nimport { cn } from '../utils';\n\n/**\n * A reusable close button icon (X mark) styled with TUWA color scheme.\n */\nexport const CloseIcon = React.forwardRef<SVGSVGElement, React.SVGAttributes<SVGSVGElement>>(\n ({ className, ...props }, ref) => (\n <svg\n ref={ref}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn('h-5 w-5 text-[var(--tuwa-text-primary)] transition-colors', className)}\n {...props}\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n ),\n);\nCloseIcon.displayName = 'CloseIcon';\n","import * as DialogPrimitive from '@radix-ui/react-dialog';\nimport * as React from 'react';\n\nimport { cn } from '../utils';\n\nconst Dialog = DialogPrimitive.Root;\nconst DialogTrigger = DialogPrimitive.Trigger;\nconst DialogPortal = DialogPrimitive.Portal;\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 bg-black/55 backdrop-blur-sm backdrop-saturate-150',\n 'animate-in fade-in-0',\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n <DialogPortal>\n <DialogOverlay />\n\n <DialogPrimitive.Content\n aria-describedby=\"tuwa:modal-content\"\n ref={ref}\n className={cn(\n 'fixed left-[50%] top-[50%] z-50 w-full max-w-full translate-x-[-50%] translate-y-[-50%] p-4 outline-none',\n className,\n )}\n {...props}\n >\n <div className=\"relative rounded-2xl overflow-hidden\">\n <div\n className={cn(\n 'relative flex max-h-[98dvh] w-full flex-col gap-3 overflow-y-auto rounded-2xl shadow-2xl',\n 'border border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)]',\n 'animate-in fade-in-0 zoom-in-95 lide-in-from-top-[48%] duration-350',\n )}\n >\n {children}\n </div>\n </div>\n </DialogPrimitive.Content>\n </DialogPortal>\n));\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-header\"\n className={cn(\n 'sticky flex top-0 z-11 w-full flex-row items-center justify-between',\n 'border-b border-[var(--tuwa-border-primary)] bg-[var(--tuwa-bg-primary)] p-4',\n className,\n )}\n {...props}\n />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n aria-describedby=\"tuwa:modal-footer\"\n className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n aria-describedby=\"tuwa:modal-title\"\n className={cn('text-lg font-bold leading-none tracking-tight text-[var(--tuwa-text-primary)] m-0', className)}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n aria-describedby=\"tuwa:modal-description\"\n ref={ref}\n className={cn('text-sm text-[var(--tuwa-text-secondary)]', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","/**\n * @file This file contains a custom React hook for copying text to the clipboard.\n */\n\nimport { useCallback, useState } from 'react';\n\n/**\n * A custom React hook that provides functionality to copy text to the clipboard.\n * It also manages a \"copied\" state with a timeout for user feedback.\n *\n * @param {number} [timeout=2000] - The duration in milliseconds to keep the `isCopied` state as true.\n * @returns {{\n * isCopied: boolean;\n * copy: (text: string) => Promise<void>;\n * error: Error | null;\n * }} An object containing the `isCopied` state, the `copy` function, and any potential error.\n *\n * @example\n * const MyComponent = () => {\n * const { isCopied, copy } = useCopyToClipboard();\n * const textToCopy = '0x123...';\n *\n * return (\n * <button onClick={() => copy(textToCopy)}>\n * {isCopied ? 'Copied!' : 'Copy Address'}\n * </button>\n * );\n * }\n */\nexport function useCopyToClipboard(timeout = 2000): {\n isCopied: boolean;\n copy: (text: string) => Promise<void>;\n error: Error | null;\n} {\n const [isCopied, setIsCopied] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n\n const copy = useCallback(\n async (text: string) => {\n if (!text) return;\n\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setError(null);\n\n setTimeout(() => setIsCopied(false), timeout);\n } catch (e) {\n const copyError = e instanceof Error ? e : new Error('Failed to copy text.');\n console.error(copyError);\n setError(copyError);\n\n // Reset error state after timeout as well\n setTimeout(() => setError(null), timeout);\n }\n },\n [timeout],\n );\n\n return { isCopied, copy, error };\n}\n","import { useEffect, useState } from 'react';\n\n/**\n * A custom hook to detect if a media query matches the current screen dimensions.\n * Handles SSR gracefully.\n * @param {string} query - The media query string (e.g., '(max-width: 767px)').\n * @returns {boolean} Whether the query matches or not.\n */\nexport function useMediaQuery(query: string): boolean {\n const getMatches = (q: string): boolean => {\n if (typeof window !== 'undefined') {\n return window.matchMedia(q).matches;\n }\n return false;\n };\n\n const [matches, setMatches] = useState<boolean>(getMatches(query));\n\n useEffect(() => {\n const media = window.matchMedia(query);\n const listener = () => setMatches(media.matches);\n\n // Re-check on mount and subscribe to changes\n listener();\n window.addEventListener('resize', listener);\n\n return () => window.removeEventListener('resize', listener);\n }, [query]);\n\n return matches;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuwaio/nova-core",
3
- "version": "1.0.0-fix-integrate-orbit-alpha.1.64ac306",
3
+ "version": "1.0.0-fix-integrate-orbit-alpha.3.521f7fb",
4
4
  "private": false,
5
5
  "author": "Oleksandr Tkach",
6
6
  "license": "Apache-2.0",
@@ -48,6 +48,7 @@
48
48
  }
49
49
  ],
50
50
  "peerDependencies": {
51
+ "@radix-ui/react-dialog": ">=1.1",
51
52
  "clsx": ">=2",
52
53
  "react": ">=19",
53
54
  "tailwind-merge": ">=3"
@@ -56,6 +57,7 @@
56
57
  "@tailwindcss/postcss": "^4.1.13",
57
58
  "@tailwindcss/vite": "^4.1.13",
58
59
  "@types/react": "^19.1.13",
60
+ "@radix-ui/react-dialog": "^1.1.15",
59
61
  "autoprefixer": "^10.4.21",
60
62
  "clsx": "^2.1.1",
61
63
  "postcss": "^8.5.6",
@@ -63,8 +65,9 @@
63
65
  "react": "^19.1.1",
64
66
  "tailwindcss": "^4.1.13",
65
67
  "tailwind-merge": "^3.3.1",
68
+ "tw-animate-css": "^1.4.0",
66
69
  "tsup": "^8.5.0",
67
- "typescript": "~5.9.2"
70
+ "typescript": "^5.9.2"
68
71
  },
69
72
  "scripts": {
70
73
  "build": "tsup && pnpm exec postcss ./src/styles/variables.css -o ./dist/index.css"