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) 5.43 kB
"use strict";var X=Object.create;var f=Object.defineProperty,Z=Object.defineProperties,$=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertyNames,w=Object.getOwnPropertySymbols,te=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var y=(t,e,o)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,n=(t,e)=>{for(var o in e||(e={}))g.call(e,o)&&y(t,o,e[o]);if(w)for(var o of w(e))N.call(e,o)&&y(t,o,e[o]);return t},u=(t,e)=>Z(t,j(e));var b=(t,e)=>{var o={};for(var r in t)g.call(t,r)&&e.indexOf(r)<0&&(o[r]=t[r]);if(t!=null&&w)for(var r of w(t))e.indexOf(r)<0&&N.call(t,r)&&(o[r]=t[r]);return o};var oe=(t,e)=>{for(var o in e)f(t,o,{get:e[o],enumerable:!0})},C=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ee(e))!g.call(t,s)&&s!==o&&f(t,s,{get:()=>e[s],enumerable:!(r=$(e,s))||r.enumerable});return t};var L=(t,e,o)=>(o=t!=null?X(te(t)):{},C(e||!t||!t.__esModule?f(o,"default",{value:t,enumerable:!0}):o,t)),re=t=>C(f({},"__esModule",{value:!0}),t);var ne={};oe(ne,{Switch:()=>J});module.exports=re(ne);var H=require("@radix-ui/react-context");var E=require("tailwind-variants"),a=(0,E.createTV)({twMergeConfig:{extend:{classGroups:{"font-size":[{text:["threepulse","threeandhalfpulse"]}],"border-width":[{border:["quarterpulse","halfpulse"]}],"--tw-ring-inset":[{ring:["none","quarterpulse","halfpulse"]}]}}}});var D=a({base:` text-text-neutral-alternative text-threepulse font-bold font-rdmodern line leading-medium text-nowrap `,variants:{isDisabled:{true:"text-text-neutral-disabled"}}});var l=require("react/jsx-runtime"),_=t=>{let{children:e,__scopeSwitch:o}=t,{disabled:r,loading:s}=p(c,o);return(0,l.jsx)(l.Fragment,{children:(!s||r)&&(0,l.jsx)("div",{children:(0,l.jsx)("label",{className:D({isDisabled:r}),"data-testid":"switch-label","aria-label":e==null?void 0:e.toString(),children:e})})})};var i=require("@raiadrogasil/pulso-design-tokens"),A=require("react");var x=require("react"),se=require("react/jsx-runtime"),k=(0,x.createContext)({});function I(){let{currentTheme:t}=(0,A.useContext)(k);return n(n({},{rdsaudesistemas:i.RDSAUDESISTEMAS_TOKENS,drogasil:i.DROGASIL_TOKENS,raia:i.RAIA_TOKENS,subscription:i.SUBSCRIPTION_TOKENS,prime:i.PRIME_TOKENS}[t]),i.GLOBALS_TOKENS)}function V(t){let e=I();return{brand:e.colorActionFillBrandPrimaryEnabled,neutral:e.colorTextNeutralReadonly,black:e.colorTextNeutralDefault,white:e.colorTextNeutralInverse}[t]}var h=require("react/jsx-runtime");function T({color:t="brand",srText:e}){return(0,h.jsx)("div",{role:"status",className:"grid size-eightpulse place-items-center","aria-label":e,children:(0,h.jsxs)("svg",{className:"size-sixpulse animate-spin fill-none",viewBox:"0 0 24 24",children:[(0,h.jsx)("path",{fillRule:"evenodd",d:"M0 12c0 6.627 5.373 12 12 12s12-5.373 12-12S18.627 0 12 0v2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12H0z",clipRule:"evenodd",fill:V(t)}),(0,h.jsx)("title",{children:e})]})})}var d=require("react/jsx-runtime"),B=t=>{let{__scopeSwitch:e}=t,{disabled:o,loading:r}=p(c,e);return(0,d.jsx)(d.Fragment,{children:r&&!o&&(0,d.jsx)("div",{"data-testid":"switch-refresh",children:(0,d.jsx)(T,{color:"neutral"})})})};var M=L(require("@radix-ui/react-switch"),1);var O=a({base:` flex w-extrasmall h-extrasmall bg-[white] rounded-pill data-[state=checked]:translate-x-[16px] transition-transform `,variants:{}});var z=require("react/jsx-runtime"),K=()=>(0,z.jsx)(M.Thumb,{className:O(),"data-testid":"switch-thumb"});var G=require("react"),q=L(require("@radix-ui/react-switch"),1);var Y=a({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 `}]});var U=require("react/jsx-runtime"),R=(0,G.forwardRef)((t,e)=>{let{children:o,__scopeSwitch:r}=t,v=p(c,r),{disabled:s,loading:m,defaultChecked:S,checked:Q}=v,W=b(v,["disabled","loading","defaultChecked","checked"]);return(0,U.jsx)(q.Root,u(n({},W),{ref:e,defaultChecked:S,checked:Q,"data-testid":"switch-toggle",disabled:s||m,className:Y({isDisabled:s,isLoading:m}),children:o}))});R.displayName="SwitchToggle";var F=a({base:` flex flex-row gap-twopulse p-twopulse items-center `,variants:{}});var P=require("react/jsx-runtime"),c="Switch",ie=t=>{let S=t,{disabled:e=!1,loading:o=!1,children:r,__scopeSwitch:s}=S,m=b(S,["disabled","loading","children","__scopeSwitch"]);return(0,P.jsx)(ce,u(n({},m),{disabled:e,loading:o,scope:s,children:(0,P.jsx)("div",{className:F(),"data-testid":"switch-root",children:r})}))},[ae]=(0,H.createContextScope)(c),[ce,p]=ae(c),J={Root:ie,Toggle:R,Thumb:K,Label:_,Refresh:B};0&&(module.exports={Switch}); //# sourceMappingURL=index.cjs.map