UNPKG

@spark-ui/internal-utils

Version:

package for sharing reusable code and resources across the codebase

1 lines 1.63 kB
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};let n=require(`react`);var r=t({}),i=t({designs:()=>s,intents:()=>o,shapes:()=>c,sizes:()=>a}),a=[`current`,`sm`,`md`,`lg`,`xl`],o=[`current`,`main`,`support`,`success`,`error`,`info`,`alert`,`danger`,`neutral`,`surface`,`surfaceInverse`,`accent`],s=[`filled`,`outlined`,`tinted`,`ghost`,`contrast`,`dashed`],c=[`rounded`,`square`,`pill`];function l(e){return(0,n.isValidElement)(e)&&function(e){return(0,n.isValidElement)(e)&&!!e.props.children}(e)&&n.Children.toArray(e.props.children).reduce((e,t)=>e||(0,n.isValidElement)(t),!1)}Object.defineProperty(exports,`VariantTypes`,{enumerable:!0,get:function(){return r}}),exports.createSplitProps=()=>(e,t)=>t.reduce((e,t)=>{let[n,r]=e,i=t;return r[i]!==void 0&&(n[i]=r[i]),delete r[i],[n,r]},[{},{...e}]),exports.deepFind=function e(t,r){let i;return n.Children.toArray(t).find((t,a,o)=>r(t,a,o)?(i=t,!0):!(!(0,n.isValidElement)(t)||!l(t))&&(i=e(t.props.children,r),i!==void 0)),i},exports.makeVariants=function(e){return e},exports.omit=function(e,t){let n={};return Object.keys(e).forEach(r=>{let i=r;t.includes(i)||(n[i]=e[i])}),n},exports.tw=function(e){return e},exports.useEvent=function(e,t={}){let{sync:r=!1}=t,i=function(e){let t=(0,n.useRef)(e);return t.current=e,t}(e);return(0,n.useCallback)((...e)=>r?queueMicrotask(()=>i.current?.(...e)):i.current?.(...e),[r,i])},Object.defineProperty(exports,`variantConstants`,{enumerable:!0,get:function(){return i}});