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.

2 lines 5.27 kB
import{a as R}from"./chunk-DRZFR5FK.js";import{a as f}from"./chunk-MLZGVFI5.js";import{c as C}from"./chunk-QQVWOIX7.js";import{a as x}from"./chunk-DDOE6RPR.js";import{c as O}from"./chunk-UABQX4UA.js";import{jsx as S}from"react/jsx-runtime";var p=()=>S("div",{className:"x-full flex py-onepulse","data-testid":"separator",children:S("div",{className:"flex-1 border-border-neutral border-hairline","data-testid":"divider-line"})});import{jsx as D}from"react/jsx-runtime";var h=({controls:t,testID:e})=>D("div",{"data-testid":e,className:"x-full flex items-center gap-threepulse border-border-neutral border-t-[length:var(--border-width-quarterpulse)] bg-fill-neutral p-threepulse ",children:t.slice(0,2).map((o,i)=>{let n=o.type==="confirm"?"brand-primary":"neutral-tertiary";return D(R.Root,{size:"lg",variant:n,onClick:o.handler,className:"flex-1",children:o.label},String(i))})});import{createContextScope as Y}from"@radix-ui/react-context";import I from"react";import{jsx as g,jsxs as B}from"react/jsx-runtime";function y({children:t,title:e}){let o=!!(e!=null&&e.length);return B("div",{className:"flex flex-col",children:[g(p,{}),g("div",{className:"px-fivepulse py-twopulse",children:o&&g("h2",{className:"font-bold text-rdmodern text-text-neutral-readonly text-threeandhalfpulse leading-small",children:e})}),t]})}import{useCallback as w,useState as $}from"react";var E=x({base:"flex items-center space-x-2",variants:{type:{single:"px-twopulse py-onepulse",multi:"px-twopulse py-onepulse"}}}),ae=x({base:"gap-onepulse p-onepulse"}),k=x({base:["bg-action-fill-neutral-tertiary-enabled","border-border-neutral-tertiary-enabled","border-none","duration-100 ease-in","focus:border-x-halfpulse","focus:border-y-halfpulse","focus:border-action-border-focused","focus:rounded-pill","hover:bg-action-fill-neutral-tertiary-hovered","hover:border-action-border-neutral-tertiary-hovered","hover:rounded-pill","disabled:cursor-not-allowed","disabled:bg-action-fill-neutral-tertiary-disabled","disabled:border-action-border-neutral-tertiary-disabled","disabled:border-none","active:bg-action-fill-neutral-tertiary-pressed","active:border-action-border-neutral-tertiary-pressed","active:rounded-pill","px-twopulse","py-onepulse"]});import{jsx as a,jsxs as T}from"react/jsx-runtime";function b({type:t="multi",content:e,checked:o,customColor:i,disabled:n,testID:c,onPress:l}){let[s,r]=$(!1),d=!!e.prefixIcon,_=!!e.description,F=w(()=>r(!0),[]),G=w(()=>r(!1),[]),A=m=>{let N=d?23:25;return m&&m.length>N?`${m.substr(0,N)}...`:m};return a("button",{onMouseDown:F,onMouseUp:G,onClick:l,"data-testid":c,disabled:n,type:"button",className:k(),children:T("div",{className:E({type:t}),children:[t==="multi"&&a("div",{className:"flex items-center p-onepulse",children:a(f,{symbol:o?"rdicon-checkbox-checked":"rdicon-checkbox-unchecked",color:n?"colorTextNeutralDisabled":o?i||"colorActionFillBrandPrimaryEnabled":"colorTextNeutralDefault",size:"small"})}),d&&a(f,{symbol:e.prefixIcon,color:n?"colorTextNeutralDisabled":"colorTextNeutralDefault",size:"small"}),T("div",{className:"flex flex-1 flex-col items-start gap-halfpulse p-onepulse ",children:[a("p",{className:`tracking font-rdmodern font-regular text-threeandhalfpulse leading-small ${n?"text-text-neutral-disabled":"text-text-neutral"}`,children:e.label}),_&&a("p",{className:`tracking font-rdmodern font-regular text-threepulse leading-small ${n?"text-text-neutral-disabled":"text-text-neutral-placeholder"}`,children:A(e.description)})]}),t==="single"&&o&&a(f,{symbol:"rdicon-checkmark",color:"colorTextSuccessAlternative",size:"small"})]})})}import v from"react";import z from"react";function P(t){return z.isValidElement(t)&&t.type===b}import{jsx as U}from"react/jsx-runtime";var q="Only Fragment, OptionMenu.Item and Group components are allowed as children of OptionMenu.List. Please remove or replace any other elements.",W=0,H=()=>{let t=Date.now().toString(36),e=(++W).toString(36);return`${t}-${e}`};function M(e){var t=O(e,[]);let{__scopeOptionMenu:o,children:i,testID:n}=t,c=C(),{type:l}=L("OptionMenuList",o),s=[];return v.Children.forEach(i,r=>{if(v.isValidElement(r)){if(r.type===v.Fragment){let d=r.props.children;s.push(d);return}if(P(r)||r.type===y||r.type===p)s.push(r);else throw new Error(q)}}),s=s.map(r=>P(r)?v.cloneElement(r,{key:H(),type:l}):r),U("div",{className:"flex max-h-80 flex-col overflow-y-auto px-onepulse py-onepulse","data-testid":n,children:s})}import{jsx as u}from"react/jsx-runtime";var V="OptionMenu",J=t=>{let{type:e,children:o,customEmptyMessage:i="N\xE3o foi encontrado nenhum resultado.",testID:n,__scopeOptionMenu:c}=t,l=I.Children.map(o,s=>{if(I.isValidElement(s)&&(s.type===M||s.type===h))return s});return u(Q,{scope:c,type:e,"data-testid":n,children:u("div",{className:"rounded-form border-border-neutral border-quarterpulse bg-fill-neutral py-onepulse",children:I.Children.count(o)>0?u("div",{className:"flex-grow",children:l}):u("div",{className:"flex items-start justify-center",children:u("p",{className:"tracking px-onepulse py-twopulse font-regular text-rdmodern text-text-neutral text-threeandhalfpulse leading-small",children:i})})})})},[K]=Y(V),[Q,L]=K(V),X={Root:J,Footer:h,Divider:p,Item:b,List:M,Group:y};export{X as a}; //# sourceMappingURL=chunk-I2462MXS.js.map