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.

38 lines (35 loc) 7.65 kB
import{a as b}from"./chunk-DQ6V5CGR.js";import{a as t}from"./chunk-2MB3Y6WI.js";import{a as u,b as f,c}from"./chunk-DDCCLFYC.js";import{createContextScope as W}from"@radix-ui/react-context";import Y,{useRef as q}from"react";import{useState as j}from"react";function v(){let[r,a]=j("");return{UseRadio:v,selectedValue:r,setSelectedValue:a,isChecked:(o,e)=>e||r===o,iconSizeMapping:{md:"tiny",ml:"small",lg:"medium",xl:"medium"}}}var P=t({base:` flex items-center rounded-pill min-width-size-huge p-onepulse active:border-focused focus:border-focused mb-twopulse `,variants:{hasError:{true:"border-forms-border-error border-halfpulse"},readOnly:{true:"cursor-not-allowed border-[#00000000]"},disabled:{true:"cursor-not-allowed border-[transparent]"},hasIconOnly:{true:`justify-center overflow-hidden `}},compoundVariants:[{readOnly:!0,disabled:!1,class:"cursor-not-allowed"},{hasIconOnly:!0,size:"md",class:""},{hasIconOnly:!0,size:"ml",class:""},{hasIconOnly:!0,size:"lg",class:""},{hasIconOnly:!0,size:"xl",class:""}],defaultVariants:{size:"xl",hasError:!1,readOnly:!1,disabled:!1,hasIconOnly:!1}}),C=t({base:` group flex items-center justify-start rounded-pill min-w-[128px] relative font-wheight-regular font-rdmodern font-regular bg-action-fill-neutral-tertiary-enabled border-action-border-neutral-tertiary-enabled hover:bg-action-fill-neutral-tertiary-hovered hover:border-action-border-neutral-tertiary-hovered active:bg-action-fill-neutral-tertiary-pressed cursor:pointer has-[:focus]:border-action-border-focused border-halfpulse focus:border-action-border-focused focus-visible:border-action-border-focused `,variants:{size:{md:"min-h-medium gap-onepulse px-fourpulse py-onepulse text-threepulse leading-medium",ml:"min-h-mediumlarge gap-twopulse px-fourpulse py-twopulse text-threeandhalfpulse leading-small",lg:"min-h-large gap-twopulse px-fivepulse py-twopulse text-fourpulse leading-small",xl:"min-h-extralarge gap-twopulse px-sixpulse py-threepulse text-fourpulse leading-small"},hasError:{true:` bg-action-fill-neutral-tertiary-enabled border-action-border-neutral-tertiary-enabled focus:border-action-border-neutral-tertiary-enabled hover:bg-action-fill-neutral-tertiary-hovered active:border-action-border-neutral-tertiary-enabled has-[:unchecked]:border-none focus-visible:border-action-border-neutral-tertiary-enabled `},readOnly:{true:` border-[#00000000] bg-[#00000000] hover:border-[#00000000] hover:bg-[#00000000] focus:border-[#00000000] focus:bg-[#00000000] focus-visible:bg-[#00000000] active:border-[#00000000] active:bg-[#00000000] `},disabled:{true:` cursor-not-allowed border-action-fill-neutral-tertiary-disabled bg-action-fill-neutral-tertiary-disabled hover:bg-action-fill-neutral-tertiary-disabled active:bg-action-fill-neutral-tertiary-disabled active:border-action-border-neutral-tertiary-disabled focus:bg-action-fill-neutral-tertiary-disabled focus:border-action-border-neutral-tertiary-disabled focus-visible:bg-action-fill-neutral-tertiary-disabled `},hasIconOnly:{true:`justify-center min-w-[auto] gap-none `}},compoundVariants:[{readOnly:!1,disabled:!1,class:` [&:not(:focus-within)]:has-[:placeholder-shown]:bg-forms-fill [&:not(:focus-within)]:has-[:placeholder-shown]:hover:bg-forms-fill-hovered `},{hasError:!1,readOnly:!1,disabled:!1,class:` `},{hasIconOnly:!0,size:"xl",class:"h-extralarge w-extralarge px-threepulse py-threepulse"},{hasIconOnly:!0,size:"lg",class:"h-large w-large px-twopulse py-twopulse"},{hasIconOnly:!0,size:"ml",class:"h-mediumlarge w-mediumlarge px-twopulse py-twopulse"},{hasIconOnly:!0,size:"md",class:"h-medium w-medium px-twopulse py-twopulse"}],defaultVariants:{size:"xl",hasError:!1,readOnly:!1,disabled:!1,hasIconOnly:!1}}),S=t({base:` flex justify-start items-center font-rdmodern text-text-neutral tracking-tiny font-wheight-regular text-left min-h-small line-clamp-4 mt-[5px] `,variants:{size:{md:"min-h-medium text-threepulse leading-medium",ml:"text-threeandhalfpulse leading-small",lg:"text-fourpulse leading-small",xl:"text-fourpulse leading-small"},readOnly:{true:"text-text-neutral-readonly"},disabled:{true:"cursor-not-allowed text-text-neutral-disabled",false:""},hasIconOnly:{true:"hidden"}},compoundVariants:[{readOnly:!0,disabled:!1,class:"cursor-not-allowed text-text-neutral-readonly"}],defaultVariants:{readOnly:!1,disabled:!1,hasIconOnly:!1}}),N=t({base:` sr-only `,variants:{hasError:{true:"hidden"}}}),k=t({base:` group-has-[:checked]:hidden `,variants:{size:{md:"h-tiny",ml:"h-small",lg:"h-medium",xl:"h-medium"},readOnly:{true:""},disabled:{true:"cursor-not-allowed text-text-neutral-disabled"}}}),E=t({base:` hidden group-has-[:checked]:block `,variants:{size:{md:"h-tiny",ml:"h-small",lg:"h-medium",xl:"h-medium"},readOnly:{true:""},disabled:{true:"cursor-not-allowed text-text-neutral-disabled"}}});import{jsx as p,jsxs as F}from"react/jsx-runtime";var L=r=>{let I=r,{__scopeRadio:a,name:l,value:s,checked:o,children:e,onChange:h,iconOnly:d,id:y=null}=I,g=c(I,["__scopeRadio","name","value","checked","children","onChange","iconOnly","id"]),{disabled:i,size:n="lg",id:A,readOnly:x,error:R,selectedValue:G}=m("RadioButton",a),{iconSizeMapping:z}=v(),U=q(null),T=o||s===G,V=()=>Y.isValidElement(e)?!!e.props.children:!1;return p("div",{className:P({disabled:i,readOnly:x,hasIconOnly:d||!V(),hasError:R}),children:F("label",{className:C({disabled:i,readOnly:x,size:n,hasIconOnly:d||!V(),hasError:R}),"aria-disabled":i,children:[p("input",u({ref:U,type:"radio",className:N({hasError:R}),id:y||A,disabled:i,name:l,value:s,checked:T,onChange:h,defaultChecked:T},g)),p("span",{className:k({size:n}),children:p(b,{size:z[n],symbol:"rdicon-radio-button-unselected",color:i?"colorTextNeutralDisabled":x?"colorTextNeutralReadonly":"colorTextNeutralDefault"})}),p("span",{className:E({size:n}),children:p(b,{size:z[n],symbol:"rdicon-radio-button-selected",color:i?"colorTextNeutralDisabled":x?"colorTextNeutralReadonly":"colorTextNeutralDefault"})}),!d&&e]})})};var H=t({base:` flex justify-start items-center gap-onepulse font-rdmodern font-semibold text-text-danger-alternative text-threepulse `,variants:{size:{md:"px-fourpulse",ml:"px-fourpulse",lg:"px-fivepulse",xl:"px-sixpulse"}},compoundVariants:[]});import{Fragment as K,jsx as O,jsxs as J}from"react/jsx-runtime";var D=s=>{var o=s,{children:r,__scopeRadio:a}=o,l=c(o,["children","__scopeRadio"]);let{error:e,size:h="lg",iconOnly:d}=m("RadioHelperText",a);return e?O(K,{children:!d&&J("div",f(u({},l),{className:H({size:h}),children:[O(b,{symbol:"rdicon-warning-circle",color:"colorTextDangerAlternative",size:"tiny"}),O("span",{className:"line-clamp-2",children:r})]}))}):null};import{jsx as Q}from"react/jsx-runtime";var _=r=>{let{children:a,__scopeRadio:l}=r,{disabled:s,readOnly:o,size:e}=m("RadioLabel",l);return a?Q("span",{className:S({disabled:s,readOnly:o,size:e}),children:a}):null};import{jsx as B}from"react/jsx-runtime";var w="Radio",M=r=>{let n=r,{size:a,children:l,disabled:s,readOnly:o,defaultValue:e,legend:h,error:d,iconOnly:y,__scopeRadio:g}=n,i=c(n,["size","children","disabled","readOnly","defaultValue","legend","error","iconOnly","__scopeRadio"]);return B(Z,f(u({},r),{size:a,disabled:s,readOnly:o,error:d,scope:g,iconOnly:y,selectedValue:e,children:B("fieldset",f(u({},i),{className:"flex flex-col border-none",children:l}))}))};M.displayName=w;var[X]=W(w),[Z,m]=X(w),$={Root:M,Button:L,Label:_,Helper:D};export{$ as a}; //# sourceMappingURL=chunk-IWTOKC3J.js.map