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.

74 lines 11.4 kB
import{a as b}from"./chunk-VXMAUSYG.js";import{a as c}from"./chunk-V5IX4U5J.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 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-border-neutral-secondary-pressed cursor:pointer focus-visible:outline-action-border-focused `,variants:{size:{sm:"h-small",md:"h-medium",ml:"h-mediumlarge"},readOnly:{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 `},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 `},count:{false:"",true:""},hasChecked:{true:` border-action-border-neutral-secondary-activated border-halfpulse bg-action-fill-neutral-secondary-activated text-text-neutral has-hover:bg-action-fill-neutral-secondary-hovered has-hover:border-action-border-neutral-secondary-hovered active:bg-action-fill-neutral-secondary-hovered active:border-action-border-neutral-secondary-activated `}},compoundVariants:[{disabled:!0,hasChecked:!0,class:` cursor-not-allowed border-action-border-neutral-secondary-disabled border-halfpulse 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}}),L=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 `}),R=c({base:` hidden group-has-[:checked]:block `,variants:{size:{sm:"h-small",md:"h-tiny",ml:"h-small"},disabled:{true:"cursor-not-allowed"}}}),q=c({base:"",variants:{size:{sm:"h-small",md:"h-small",ml:"h-small"},disabled:{true:"cursor-not-allowed"}}}),B=c({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:t,id:s,name:l,value:n,children:d,onChange:a}=r,{size:o="sm",disabled:e,checked:i,readOnly:p}=u("Chips",t),h=U(null),m=e||p;return j("label",{className:N({checked:i,disabled:e,size:o,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:q({size:o}),children:w(b,{size:"small",symbol:"rdicon-dismiss",color:e?"colorTextNeutralDisabled":"colorTextDangerAlternative"})})]})};import{jsx as Y}from"react/jsx-runtime";var O=r=>{let{__scopeChips:t,children:s}=r,{size:l,disabled:n,checked:d}=u("Label",t);return Y("span",{className:L({disabled:n,size:l,checked:d}),children:s})};import{useRef as G}from"react";import{useState as F}from"react";function C(){let[r,t]=F("");return{selectedValue:r,setSelectedValue:t,iconSizeMapping:{sm:"extra-small",md:"extra-small",ml:"small"}}}import{jsx as v,jsxs as J}from"react/jsx-runtime";var E=r=>{let{__scopeChips:t,children:s,icon:l,onChange:n=()=>{},count:d=0}=r,{size:a="md",disabled:o,checked:e,readOnly:i}=u("Chips",t),{iconSizeMapping:p}=C(),h=G(null),m=e||d>0,g=l||"rdicon-options-filter",k=z=>{if(o||i){z.preventDefault();return}n&&n(z)};return v("div",{className:f(),children:J("button",{type:"button",className:T({size:a,disabled:o,hasChecked:m,readOnly:i}),ref:h,onClick:k,disabled:o||i,children:[v("span",{className:B({size:a}),children:v(b,{size:p[a],symbol:g,color:o?"colorTextNeutralDisabled":"colorTextNeutralDefault"})}),s,d>0&&v("span",{className:_({size:a,disabled:o}),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:t,id:s,name:l,value:n,children:d,onChange:a}=r,{size:o="md",disabled:e,readOnly:i,checked:p}=u("Chips",t),{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:o,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:R({size:o}),children:x(b,{size:h[o],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:t,children:s,disabled:l,__scopeChips:n}=a,d=V(a,["size","children","disabled","__scopeChips"]);return ee(Z,I(S({},r),{size:t,disabled:l,scope:n,children:s}))};A.displayName=P;var[X]=W(P),[Z,u]=X(P),$={Root:A,Single:H,Label:O,Input:D,Multiple:E};export{$ as a}; //# sourceMappingURL=chunk-J77W7MWI.js.map