UNPKG

@rdsaude/pulso-react-components

Version:

Biblioteca de componentes React do Pulso Design System da RD Saúde oferece componentes consistentes e de alto desempenho, alinhados com os padrões da RDSaúde. Ideal para desenvolver aplicações modernas e acessíveis.

23 lines (22 loc) 3.05 kB
import{a as f}from"./chunk-GA6D3G6F.js";import{a as o}from"./chunk-V5IX4U5J.js";import{a as p,b as n,c as l}from"./chunk-UABQX4UA.js";import{createContextScope as B}from"@radix-ui/react-context";var g=o({base:` text-text-neutral-alternative text-threepulse font-bold font-rdmodern line leading-medium text-nowrap `,variants:{isDisabled:{true:"text-text-neutral-disabled"}}});import{Fragment as D,jsx as w}from"react/jsx-runtime";var u=s=>{let{children:t,__scopeSwitch:a}=s,{disabled:e,loading:r}=c(i,a);return w(D,{children:(!r||e)&&w("div",{children:w("label",{className:g({isDisabled:e}),"data-testid":"switch-label","aria-label":t==null?void 0:t.toString(),children:t})})})};import{Fragment as _,jsx as S}from"react/jsx-runtime";var x=s=>{let{__scopeSwitch:t}=s,{disabled:a,loading:e}=c(i,t);return S(_,{children:e&&!a&&S("div",{"data-testid":"switch-refresh",children:S(f,{color:"neutral"})})})};import*as R from"@radix-ui/react-switch";var P=o({base:` flex w-extrasmall h-extrasmall bg-[white] rounded-pill data-[state=checked]:translate-x-[16px] transition-transform `,variants:{}});import{jsx as V}from"react/jsx-runtime";var v=()=>V(R.Thumb,{className:P(),"data-testid":"switch-thumb"});import{forwardRef as A}from"react";import*as y from"@radix-ui/react-switch";var L=o({base:` flex w-mediumlarge min-w-mediumlarge h-small rounded-mediumcontainer p-halfpulse focus-visible:outline outline-2 outline-offset-2 `,variants:{isDisabled:{true:""},isLoading:{true:""}},compoundVariants:[{isDisabled:!0,className:` bg-text-neutral-disabled cursor-not-allowed `},{isDisabled:!1,isLoading:!1,className:` data-[state=unchecked]:bg-[#9E9E9E] data-[state=checked]:bg-action-text-onbrand data-[state=unchecked]:active:bg-[#6B6B6B] data-[state=checked]:active:bg-action-text-onbrand-pressed data-[state=unchecked]:hover:bg-[#828282] data-[state=checked]:hover:bg-action-text-onbrand-hovered `},{isDisabled:!1,isLoading:!0,className:` data-[state=unchecked]:bg-[#6B6B6B] data-[state=checked]:bg-action-text-onbrand-pressed `}]});import{jsx as E}from"react/jsx-runtime";var m=A((s,t)=>{let{children:a,__scopeSwitch:e}=s,b=c(i,e),{disabled:r,loading:h,defaultChecked:d,checked:k}=b,C=l(b,["disabled","loading","defaultChecked","checked"]);return E(y.Root,n(p({},C),{ref:t,defaultChecked:d,checked:k,"data-testid":"switch-toggle",disabled:r||h,className:L({isDisabled:r,isLoading:h}),children:a}))});m.displayName="SwitchToggle";var N=o({base:` flex flex-row gap-twopulse p-twopulse items-center `,variants:{}});import{jsx as T}from"react/jsx-runtime";var i="Switch",I=s=>{let d=s,{disabled:t=!1,loading:a=!1,children:e,__scopeSwitch:r}=d,h=l(d,["disabled","loading","children","__scopeSwitch"]);return T(Y,n(p({},h),{disabled:t,loading:a,scope:r,children:T("div",{className:N(),"data-testid":"switch-root",children:e})}))},[M]=B(i),[Y,c]=M(i),q={Root:I,Toggle:m,Thumb:v,Label:u,Refresh:x};export{q as a}; //# sourceMappingURL=chunk-H35O7DFB.js.map