@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.
67 lines • 10.6 kB
JavaScript
import{a as b}from"./chunk-34ABDYZX.js";import{a as c}from"./chunk-DDOE6RPR.js";import{a as S,b as I,c as V}from"./chunk-UABQX4UA.js";import{createContextScope as W}from"@radix-ui/react-context";import{useRef as U}from"react";var f=c({base:`
flex items-center justify-center rounded-pill min-width-size-huge p-px outline-none
active:border-focused focus:border-focused w-fit m-px border-halfpulse border-transparent
focus-visible:border-action-border-focused
`,variants:{disabled:{true:"cursor-not-allowed border-transparent"}},defaultVariants:{disabled:!1}}),M=c({base:`
group flex items-center justify-center rounded-pill min-w-16 relative px-fourpulse gap-twopulse border-quarterpulse text-text-neutral-alternative
bg-action-fill-neutral-secondary-enabled border-action-border-neutral-secondary-enabled
hover:border-action-border-neutral-secondary-hovered hover:bg-action-fill-neutral-secondary-hovered
active:bg-action-fill-neutral-secondary-pressed active:border-action-border-neutral-secondary-pressed cursor:pointer
`,variants:{size:{sm:"",md:"h-medium",ml:"h-mediumlarge"},readOnly:{true:`
border-action-border-neutral-secondary-enabled border-quarterpulse bg-action-fill-neutral-secondary-enabled
hover:bg-action-fill-neutral-secondary-enabled hover:border-action-border-neutral-secondary-enabled
active:border-action-border-neutral-secondary-enabled active:bg-action-fill-neutral-secondary-enabled
`},disabled:{true:`
cursor-not-allowed border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
hover:bg-action-fill-neutral-secondary-disabled hover:border-action-border-neutral-secondary-disabled
active:border-action-border-neutral-secondary-disabled active:bg-action-fill-neutral-secondary-disabled
`},checked:{true:`
border-action-border-neutral-secondary-enabled border-halfpulse bg-action-fill-neutral-secondary-activated pl-twopulse text-text-neutral
hover:text-text-neutral
`}},compoundVariants:[{disabled:!0,checked:!0,class:`
cursor-not-allowed border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
hover:bg-action-fill-neutral-secondary-disabled hover:border-action-border-neutral-secondary-disabled
active:border-action-border-neutral-secondary-disabled active:bg-action-fill-neutral-secondary-disabled
`}],defaultVariants:{size:"md",disabled:!1,checked:!1}}),N=c({base:`
group flex items-center justify-center rounded-pill min-w-10 relative px-twopulse py-onepulse gap-onepulse border-quarterpulse text-text-neutral-alternative
bg-action-fill-neutral-secondary-enabled border-action-border-neutral-secondary-enabled
active:bg-action-fill-neutral-secondary-pressed active:border-action-border-neutral-secondary-pressed cursor:pointer
hover:border-action-border-neutral-secondary-hovered hover:bg-action-fill-neutral-secondary-hovered
`,variants:{size:{sm:"h-small",md:"h-medium",ml:"h-medium"},disabled:{true:`
cursor-not-allowed border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
hover:bg-action-fill-neutral-secondary-disabled hover:border-action-border-neutral-secondary-disabled
active:border-action-border-neutral-secondary-disabled active:bg-action-fill-neutral-secondary-disabled
`},readOnly:{true:`
cursor-not-allowed text-text-neutral-readonly border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
hover:bg-action-fill-neutral-secondary-disabled hover:border-action-border-neutral-secondary-disabled
active:border-action-border-neutral-secondary-disabled active:bg-action-fill-neutral-secondary-disabled
`},checked:{true:"border-action-border-neutral-secondary-enabled border-quarterpulse"}},compoundVariants:[{disabled:!0,checked:!0,class:`
cursor-not-allowed border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
hover:bg-action-fill-neutral-secondary-disabled hover:border-action-border-neutral-secondary-disabled
active:border-action-border-neutral-secondary-disabled active:bg-action-fill-neutral-secondary-disabled
`},{checked:!0,readOnly:!0,class:`
cursor-not-allowed text-text-neutral-readonly border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
hover:bg-action-fill-neutral-secondary-disabled hover:border-action-border-neutral-secondary-disabled
active:border-action-border-neutral-secondary-disabled active:bg-action-fill-neutral-secondary-disabled
`}],defaultVariants:{size:"md",disabled:!1,checked:!1}}),T=c({base:`
group flex items-center justify-center rounded-pill min-w-[64px] relative px-twopulse gap-twopulse border-quarterpulse text-[length:var(--font-size-threeandhalfpulse)] text-text-neutral-alternative outline-none
bg-action-fill-neutral-secondary-enabled border-action-border-neutral-secondary-enabled
`,variants:{size:{sm:"h-medium",md:"h-medium",ml:"h-mediumlarge"},disabled:{false:`
has-hover:bg-action-fill-neutral-secondary-hovered has-hover:border-action-border-neutral-secondary-hovered
active:bg-action-fill-neutral-secondary-pressed active:border-action-fill-neutral-secondary-pressed cursor:pointer
focus-visible:outline-action-border-focused
`,true:`
cursor-not-allowed border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
`},hasChecked:{true:`
border-action-border-neutral-secondary-activated border-halfpulse bg-action-fill-neutral-secondary-activated text-text-neutral
enabled:has-hover:border-quarterpulse enabled:has-hover:bg-action-fill-neutral-secondary-hovered enabled:has-hover:border-action-border-neutral-secondary-hovered
enabled:active:border-quarterpulse enabled:active:bg-action-fill-neutral-secondary-pressed enabled:active:border-action-border-neutral-secondary-pressed
`}},compoundVariants:[{disabled:!0,hasChecked:!0,class:`
cursor-not-allowed border-action-border-neutral-secondary-disabled border-quarterpulse bg-action-fill-neutral-secondary-disabled
`}],defaultVariants:{size:"md",disabled:!1,checked:!1}}),q=c({base:"flex h-extrasmall items-center justify-center font-bold text-text-neutral-alternative leading-small",variants:{size:{sm:"text-threeandhalfpulse",md:"h-medium min-w-medium text-threeandhalfpulse",ml:"h-mediumlarge min-w-mediumlarge text-threeandhalfpulse"},disabled:{true:"cursor-not-allowed text-text-neutral-disabled"},readonly:{true:"cursor-not-allowed text-text-neutral-readonly"},checked:{true:"text-action-text-neutral"}},compoundVariants:[{checked:!0,disabled:!0,class:"cursor-not-allowed text-text-neutral-disabled"}],defaultVariants:{disabled:!1,checked:!1}}),y=c({base:`
hidden
`}),L=c({base:`
hidden group-has-[:checked]:block
`,variants:{size:{sm:"h-small",md:"h-tiny",ml:"h-small"},disabled:{true:"cursor-not-allowed"}}}),R=c({base:"",variants:{size:{sm:"h-small",md:"h-small",ml:"h-small"},disabled:{true:"cursor-not-allowed"}}}),B=c({base:"flex items-center",variants:{size:{sm:"h-small",md:"h-extrasmall",ml:"h-small"},disabled:{true:"cursor-not-allowed"}}}),_=c({base:` flex justify-center items-center rounded-pill border-none bg-text-neutral text-threepulse text-text-neutral-inverse
`,variants:{size:{sm:"h-extrasmall w-extrasmall",md:"h-extrasmall w-extrasmall",ml:"h-small w-small"},disabled:{true:"cursor-not-allowed bg-text-neutral-disabled"}}});import{jsx as w,jsxs as j}from"react/jsx-runtime";var D=r=>{let{__scopeChips:o,id:s,name:l,value:n,children:d,onChange:a}=r,{size:t="sm",disabled:e,checked:i,readOnly:p}=u("Chips",o),h=U(null),m=e||p;return j("label",{className:N({checked:i,disabled:e,size:t,readOnly:p}),"aria-disabled":e,style:{cursor:e||p?"not-allowed":"pointer"},children:[w("input",{ref:h,type:"checkbox",className:y(),id:s,disabled:e,name:l,value:n,checked:i,onChange:a,readOnly:p}),d,i&&w("span",{className:R({size:t}),children:w(b,{size:"small",symbol:"rdicon-dismiss",color:e?"colorTextNeutralDisabled":"colorTextDangerAlternative"})})]})};import{jsx as Y}from"react/jsx-runtime";var E=r=>{let{__scopeChips:o,children:s}=r,{size:l,disabled:n,checked:d}=u("Label",o);return Y("span",{className:q({disabled:n,size:l,checked:d}),children:s})};import{useRef as G}from"react";import{useState as F}from"react";function C(){let[r,o]=F("");return{selectedValue:r,setSelectedValue:o,iconSizeMapping:{sm:"extra-small",md:"extra-small",ml:"small"}}}import{jsx as v,jsxs as J}from"react/jsx-runtime";var O=r=>{let{__scopeChips:o,children:s,icon:l,onChange:n=()=>{},count:d=0}=r,{size:a="md",disabled:t,checked:e,readOnly:i}=u("Chips",o),{iconSizeMapping:p}=C(),h=G(null),m=e||d>0,g=l||"rdicon-options-filter",k=z=>{if(t||i){z.preventDefault();return}n&&n(z)};return v("div",{className:f(),children:J("button",{type:"button",className:T({size:a,disabled:t||i,hasChecked:m}),ref:h,onClick:k,disabled:t||i,children:[v("span",{className:B({size:a}),children:v(b,{size:p[a],symbol:g,color:t?"colorTextNeutralDisabled":"colorTextNeutralDefault"})}),s,d>0&&v("span",{className:_({size:a,disabled:t}),children:d>9?"9+":d})]})})};import{useRef as K}from"react";import{jsx as x,jsxs as Q}from"react/jsx-runtime";var H=r=>{let{__scopeChips:o,id:s,name:l,value:n,children:d,onChange:a}=r,{size:t="md",disabled:e,readOnly:i,checked:p}=u("Chips",o),{iconSizeMapping:h}=C(),m=K(null),g=k=>{if(e||i){k.preventDefault();return}a&&a()};return x("button",{ref:m,className:f(),type:"button",disabled:e||i,onClick:g,id:s,name:l,value:n,children:Q("label",{className:M({checked:p,disabled:e,size:t,readOnly:i}),"aria-disabled":e,children:[x("input",{type:"checkbox",className:y(),id:s,disabled:e,name:l,value:n,checked:p,readOnly:!0,tabIndex:-1}),x("span",{className:L({size:t}),children:x(b,{size:h[t],symbol:"rdicon-checkmark",color:e?"colorTextNeutralDisabled":"colorTextNeutralDefault"})}),d]})})};import{jsx as ee}from"react/jsx-runtime";var P="Chips",A=r=>{let a=r,{size:o,children:s,disabled:l,__scopeChips:n}=a,d=V(a,["size","children","disabled","__scopeChips"]);return ee(Z,I(S({},r),{size:o,disabled:l,scope:n,children:s}))};A.displayName=P;var[X]=W(P),[Z,u]=X(P),$={Root:A,Single:H,Label:E,Input:D,Multiple:O};export{$ as a};
//# sourceMappingURL=chunk-YHS3D5IQ.js.map