UNPKG

@accounter/client

Version:
1 lines 5.62 kB
import{s as e}from"./dist-ypP48_Ax.js";import{a as t,i as n,o as r,t as i}from"./utils-CbS-oR5I.js";var a=e(r(),1),o=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,s=t,c=(e,t)=>n=>{if(t?.variants==null)return s(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let s=o(t)||o(a);return r[e][s]}),c=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return s(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...c}[t]):{...i,...c}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},l=Object.defineProperty,u=(e,t)=>l(e,`name`,{value:t,configurable:!0});function d(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}u(d,`setRef`);function f(...e){return t=>{let n=!1,r=e.map(e=>{let r=d(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():d(e[t],null)}}}}u(f,`composeRefs`);function p(...e){return a.useCallback(f(...e),e)}u(p,`useComposedRefs`);var m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0});function g(e){let t=a.forwardRef((t,n)=>{let{children:r,...i}=t,o=null,s=!1,c=[];T(r)&&typeof k==`function`&&(r=k(r._payload)),a.Children.forEach(r,e=>{if(C(e)){s=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;T(n)&&typeof k==`function`&&(n=k(n._payload)),o=b(t,n),c.push(o?.props?.children)}else c.push(e)}),o?o=a.cloneElement(o,void 0,c):!s&&a.Children.count(r)===1&&a.isValidElement(r)&&(o=r);let l=o?S(o):void 0,u=p(n,l);if(!o){if(r||r===0)throw Error(s?O(e):D(e));return r}let d=x(i,o.props??{});return o.type!==a.Fragment&&(d.ref=n?u:l),a.cloneElement(o,d)});return t.displayName=`${e}.Slot`,t}h(g,`createSlot`);var _=g(`Slot`),v=Symbol.for(`radix.slottable`);function y(e){let t=h(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=v,t}h(y,`createSlottable`);var b=h((e,t)=>{if(`child`in e.props){let t=e.props.child;return a.isValidElement(t)?a.cloneElement(t,void 0,e.props.children(t.props.children)):null}return a.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function x(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}h(x,`mergeProps`);function S(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}h(S,`getElementRef`);function C(e){return a.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===v}h(C,`isSlottable`);var w=Symbol.for(`react.lazy`);function T(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===w&&`_payload`in e&&E(e._payload)}h(T,`isLazyComponent`);function E(e){return typeof e==`object`&&!!e&&`then`in e}h(E,`isPromiseLike`);var D=h(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),O=h(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),k=a.use,A=n(),j=c(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-gray-950 focus-visible:ring-gray-950/50 focus-visible:ring-[3px] aria-invalid:ring-red-500/20 dark:aria-invalid:ring-red-500/40 aria-invalid:border-red-500 dark:focus-visible:border-gray-300 dark:focus-visible:ring-gray-300/50 dark:aria-invalid:ring-red-900/20 dark:dark:aria-invalid:ring-red-900/40 dark:aria-invalid:border-red-900`,{variants:{variant:{default:`bg-gray-900 text-gray-50 shadow-xs hover:bg-gray-900/90 dark:bg-gray-50 dark:text-gray-900 dark:hover:bg-gray-50/90`,destructive:`bg-red-500 text-white shadow-xs hover:bg-red-500/90 focus-visible:ring-red-500/20 dark:focus-visible:ring-red-500/40 dark:bg-red-500/60 dark:bg-red-900 dark:hover:bg-red-900/90 dark:focus-visible:ring-red-900/20 dark:dark:focus-visible:ring-red-900/40 dark:dark:bg-red-900/60`,outline:`border bg-white shadow-xs hover:bg-gray-100 hover:text-gray-900 dark:bg-gray-200/30 dark:border-gray-200 dark:hover:bg-gray-200/50 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50 dark:dark:bg-gray-800/30 dark:dark:border-gray-800 dark:dark:hover:bg-gray-800/50`,secondary:`bg-gray-100 text-gray-900 shadow-xs hover:bg-gray-100/80 dark:bg-gray-800 dark:text-gray-50 dark:hover:bg-gray-800/80`,ghost:`hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-100/50 dark:hover:bg-gray-800 dark:hover:text-gray-50 dark:dark:hover:bg-gray-800/50`,link:`text-gray-900 underline-offset-4 hover:underline dark:text-gray-50`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,sm:`h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5`,lg:`h-10 rounded-md px-6 has-[>svg]:px-4`,icon:`size-9`}},defaultVariants:{variant:`default`,size:`default`}});function M({className:e,variant:t,size:n,asChild:r=!1,...a}){let o=r?_:`button`;return(0,A.jsx)(o,{"data-slot":`button`,className:i(j({variant:t,size:n,className:e})),...a})}export{y as a,c,g as i,j as n,f as o,_ as r,p as s,M as t};