@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.
49 lines • 26.2 kB
JavaScript
import{a as i}from"./chunk-ZMM3D57J.js";import{a as M}from"./chunk-J7H2C3SX.js";import{a as v}from"./chunk-PHPPC3UR.js";import{a as P}from"./chunk-DQ6V5CGR.js";import{a as ae}from"./chunk-TZXDQB75.js";import{a as p}from"./chunk-2MB3Y6WI.js";import{a,b as n,c as f}from"./chunk-DDCCLFYC.js";import{createContextScope as Mt}from"@radix-ui/react-context";import{jsx as Ke}from"react/jsx-runtime";var ne=({children:e})=>Ke("div",{className:"input-select-actions","data-testid":"input-name-actions",children:e});import{forwardRef as zt,useEffect as Oe,useRef as Ot,useState as Ht}from"react";import{createContextScope as Ue}from"@radix-ui/react-context";import{forwardRef as Ge}from"react";var le=p({base:`
group flex items-center justify-between rounded-pill min-w-[11.25rem] w-full gap-onepulse pl-threepulse pr-onepulse relative py-[0.125rem]
text-text-neutral leading-none border-solid bg-forms-fill border-forms-fill duration-100 ease-in
[&:not(:focus-within)]:has-[:placeholder-shown]:border-forms-border
hover:[&:not(:focus-within)]:has-[:placeholder-shown]:bg-forms-fill-hovered
hover:[&:not(:focus-within)]:has-[:placeholder-shown]:border-forms-border-hovered
focus:border-forms-border-focused focus:bg-forms-fill-focused focus:border-halfpulse
active:border-forms-fill-focused active:bg-forms-fill-focused active:border-halfpulse
has-[:focus]:ring-forms-border-filled has-[:focus]:bg-forms-fill-focused has-[:focus]:border-halfpulse
has-[:active]:ring-forms-border-focused has-[:active]:bg-forms-fill-focused has-[:active]:border-halfpulse
focus-within:ring-action-border-focused
[&:not(:focus-within)]:has-[:placeholder-shown]:bg-forms-fill
[&:not(:focus-within)]:has-[:not(:placeholder-shown)]:border-forms-border-filled
has-[:active]:[&:not(:focus-within)]:has-[:placeholder-shown]:bg-forms-fill-focused
has-[:active]:[&:not(:focus-within)]:has-[:placeholder-shown]:border-forms-border-focused
has-[:active]:[&:not(:focus-within)]:has-[:not(:placeholder-shown)]:border-forms-border-focused
has-[:focus]:has-[:not(:placeholder-shown)]:border-forms-border-focused
`,variants:{size:{md:"h-medium",ml:"h-mediumlarge",lg:"h-large"},hasFilled:{true:`
border-forms-border-filled border-quarterpulse bg-forms-fill-filled
active:border-forms-fill-focused active:bg-forms-fill-focused active:border-halfpulse
hover:bg-forms-fill-filled hover:border-forms-border-filled hover:border-halfpulse
has-[:active]:border-forms-fill-focused has-[:active]:bg-forms-fill-focused has-[:active]:border-halfpulse
[&:not(:focus-within)]:has-[:placeholder-shown]:bg-forms-fill
[&:not(:focus-within)]:has-[:placeholder-shown]:hover:bg-forms-fill-hovered
[&:not(:focus-within)]:has-[:placeholder-shown]:ring-forms-border
[&:not(:focus-within)]:has-[:placeholder-shown]:hover:ring-forms-border-hovered
[&:not(:focus-within)]:has-[:placeholder-shown]:ring-none
`}},defaultVariants:{size:"md"}}),se=p({base:`
peer/field font-wheight-regular text-text-neutral-alternative font-rdmodern font-regular text-threeandhalfpulse leading-none border-none bg-[transparent]
flex-1 align-middle self-center focus-visible:border-none focus-visible:outline-none placeholder:text-text-neutral-alternative
active:placeholder:text-text-neutral-placeholder focus:placeholder:text-text-neutral-placeholder
active:text-text-neutral-placeholder focus:text-text-neutral
`,variants:{size:{md:"h-extrasmall",ml:"h-extrasmall",lg:"h-extrasmall"},hasFilled:{true:`text-text-neutral-alternative active:text-text-neutral
`}},defaultVariants:{size:"md"}}),ie=p({base:"searchbar-button bg-none",variants:{size:{md:"h-medium w-medium min-w-medium",ml:"h-mediumlarge w-mediumlarge min-w-mediumlarge",lg:"h-mediumlarge w-mediumlarge min-w-mediumlarge"}},defaultVariants:{size:"md"}}),de=p({base:`
searchbar-clear-button hidden
peer-focus/field:peer-[:not(:placeholder-shown)]/field:flex peer-focus/field:peer-[:not(:placeholder-shown)]/field:visible
group-hover:peer-[:not(:placeholder-shown)]/field:flex
`,variants:{size:{md:"h-medium w-medium min-w-medium",ml:"h-mediumlarge w-mediumlarge min-w-mediumlarge",lg:"h-mediumlarge w-mediumlarge min-w-mediumlarge"}}});import{jsx as T,jsxs as Ze}from"react/jsx-runtime";var Y="SearchBar",ce=Ge((e,r)=>{let{onChange:o=()=>{},handleSearch:s=()=>{},handleClear:t=()=>{},placeholder:l,datatestid:d="search-bar",value:m="",size:c="md",__scopeSearchBar:b}=e,u=h=>h==="lg"?"ml":h;return T(Qe,n(a({},e),{scope:b,children:Ze("div",{className:i(le({size:c,hasFilled:m!==""})),children:[T("input",{ref:r,type:"text",className:se({size:c,hasFilled:m!==""}),placeholder:l,onChange:h=>o(h),value:m,"data-testid":d}),T(v.Root,{size:u(c),variant:"neutral-tertiary",className:de({size:c}),onClick:t,children:T(v.Icon,{symbol:"rdicon-dismiss-circle-outline"})}),T(v.Root,{size:u(c),variant:"neutral-tertiary",className:ie({size:c}),onClick:s,children:T(v.Icon,{symbol:"rdicon-search"})})]})}))});ce.displayName=Y;var[Je]=Ue(Y),[Qe,Zt]=Je(Y),Xe={Root:ce};import{createContextScope as ot}from"@radix-ui/react-context";import A,{useMemo as be,useState as he}from"react";var pe=p({base:"flex flex-col items-center justify-center gap-twopulse border-none",variants:{disabled:{true:"cursor-not-allowed text-text-neutral-disabled outline-none"},orientation:{horizontal:"rounded-pill",vertical:"rounded-hugecontainer"},context:{brand:"",neutral:""}},compoundVariants:[{orientation:"horizontal",disabled:!1,class:"outline-action-border-focused outline-offset-4 focus:outline-1"},{orientation:"vertical",disabled:!1,class:"outline-action-border-focused outline-offset-4 focus:outline-1"},{context:"brand",disabled:!0,class:"border-border-browsing-border-onbrand-disabled bg-[#E6E6E6]"},{context:"neutral",disabled:!0,class:"border-action-border-neutral-tertiary-disabled bg-action-fill-neutral-tertiary-disabled"}]}),me=p({base:"flex min-w-[6rem] border-none bg-action-fill-emphasis-enabled py-threepulse outline-none",variants:{orientation:{vertical:"max-w-[6rem] flex-col items-center rounded-hugecontainer",horizontal:"h-large max-h-large min-h-large flex-row items-center justify-center gap-twopulse rounded-pill p-threepulse pr-fourpulse"},disabled:{true:"cursor-not-allowed bg-action-fill-emphasis-disabled",false:"hover:bg-action-fill-emphasis-hovered active:bg-action-fill-emphasis-pressed"},context:{brand:"roudend-pill border-none",neutral:"roudend-pill border-none"}},compoundVariants:[{disabled:!1,context:"brand",class:"bg-browsing-fill-onbrand-enabled pressed:bg-browsing-fill-onbrand-pressed hover:bg-browsing-fill-onbrand-hovered active:bg-browsing-fill-onbrand-activated"},{disabled:!1,context:"neutral",class:"bg-action-fill-neutral-tertiary pressed:bg-action-fill-neutral-tertiary-pressed hover:bg-action-fill-neutral-tertiary-hovered active:bg-action-fill-neutral-tertiary-activated"},{disabled:!0,context:"neutral",class:"bg-action-fill-neutral-tertiary-disabled"},{disabled:!0,context:"brand",class:"bg-action-fill-neutral-tertiary-disabled"}]}),fe=p({base:"font-rdmodern text-text-neutral text-threeandhalfpulse leading-small",variants:{orientation:{vertical:"line-clamp-2 text-center",horizontal:"line-clamp-1"},context:{brand:"",neutral:""},disabled:{true:"text-text-neutral-disabled",false:""},isPressed:{true:"",false:""},isHovered:{true:"",false:""}},compoundVariants:[{disabled:!0,context:"neutral",class:"text-text-neutral-disabled"},{disabled:!0,context:"brand",class:"text-text-neutral-disabled"},{isPressed:!1,disabled:!1,context:"brand",class:"active:font-semibold active:text-action-text-onbrand-activated"},{isPressed:!1,disabled:!1,context:"neutral",class:"font-regular"},{isPressed:!0,disabled:!1,context:"brand",class:"font-semibold"},{isPressed:!0,disabled:!1,context:"neutral",class:"font-semibold"},{context:void 0,orientation:"horizontal",class:"font-semibold"},{context:void 0,orientation:"vertical",class:"font-semibold"},{context:"brand",isHovered:!0,disabled:!1,class:"text-action-text-onbrand-hovered"},{context:"brand",isPressed:!0,class:"text-action-text-onbrand-pressed"}]});import{useMemo as je}from"react";import{jsx as et}from"react/jsx-runtime";var ue=e=>{let{__scopeCardCategory:r}=e,{orientation:o,disabled:s,isHovered:t,isPressed:l,context:d}=_("CardCategoryLabel",r),m=je(()=>{if(s&&d==="neutral"||s)return"colorTextNeutralDisabled";if(d==="brand"&&l)return"colorActionTextOnbrandPressed";if(d==="brand"&&t)return"colorActionTextOnbrandHovered";if(d==="neutral"||d==="brand")return"colorTextNeutralAlternative";if(l)return"colorActionTextOnbrandPressed";if(t)return"colorActionTextOnbrandHovered"},[t,l,s,d]);return et(P,n(a({},e),{size:o==="horizontal"?"small":"medium",color:m}))};import{jsx as tt}from"react/jsx-runtime";var V=e=>{let{__scopeCardCategory:r,children:o}=e,{orientation:s,context:t,disabled:l,isPressed:d,isHovered:m}=_("CardCategoryLabel",r);return tt("span",{className:fe({orientation:s,context:t,disabled:l,isPressed:d,isHovered:m}),children:o})};import{jsx as K,jsxs as st}from"react/jsx-runtime";var xe="CardCategory",rt=e=>{let{children:r,orientation:o="horizontal",testID:s,disabled:t,onClick:l,context:d,__scopeCardCategory:m}=e,c=ae(),[b,u]=he(!1),[h,x]=he(!1),S=A.Children.map(r,g=>A.isValidElement(g)&&(g.type===V&&o==="horizontal"||g.type!==V)?g:null),B=be(()=>!t&&h?c.colorBrowsingFillOnbrandPressed:!t&&b?c.colorBrowsingFillOnbrandHovered:t?c.colorBrowsingFillOnbrandDisabled:c.colorBrowsingFillOnbrandEnabled,[t,b,h,c]),w=be(()=>d?"horizontal":o,[d,o]);return K(nt,{scope:m,orientation:w,disabled:t,"data-testid":s,isHovered:b,isPressed:h,context:d,children:st("div",{"data-testid":s,className:pe({disabled:t,orientation:o,context:d}),children:[K("button",{type:"button",className:i(me({orientation:o,disabled:t,context:d})),onClick:l,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onMouseDown:()=>x(!0),onMouseUp:()=>x(!1),style:{backgroundColor:d==="brand"?B:void 0},disabled:t,children:S}),o==="vertical"&&K(V,{children:A.Children.toArray(r).find(g=>A.isValidElement(g)&&g.type===V)})]})})},[at]=ot(xe),[nt,_]=at(xe),lt={Root:rt,Icon:ue,Label:V};import{Slot as it}from"@radix-ui/react-slot";import{jsx as ct}from"react/jsx-runtime";var dt=p({base:"font-bold font-sans leading-tiny tracking-normal no-underline",variants:{variant:{"large-bold":"text-twelvepulse","default-bold":"text-tenpulse","small-bold":"text-eightpulse"}},defaultVariants:{variant:"large-bold"}});function ge(s){var t=s,{variant:e,asChild:r}=t,o=f(t,["variant","asChild"]);return ct(r?it:"h1",n(a({},o),{className:i(dt({variant:e}))}))}import{Slot as pt}from"@radix-ui/react-slot";import{jsx as ft}from"react/jsx-runtime";var mt=p({base:"font-sans text-threeandhalfpulse/small tracking-normal no-underline",variants:{variant:{"default-bold":null,"underline-bold":null,"default-semibold":null,"underline-semibold":null,"default-regular":"font-normal"}},compoundVariants:[{variant:["default-bold","underline-bold"],class:"font-bold"},{variant:["default-semibold","underline-semibold"],class:"font-semibold"},{variant:["underline-bold","underline-semibold"],class:"underline"}],defaultVariants:{variant:"default-bold"}});function ve(s){var t=s,{variant:e,asChild:r}=t,o=f(t,["variant","asChild"]);return ft(r?pt:"p",n(a({},o),{className:i(mt({variant:e}))}))}import{Slot as ut}from"@radix-ui/react-slot";import{jsx as ht}from"react/jsx-runtime";var bt=p({base:"inline font-sans text-threepulse/medium tracking-normal no-underline",variants:{variant:{"default-bold":null,"underline-bold":null,"default-semibold":null,"underline-semibold":null}},compoundVariants:[{variant:["default-bold","underline-bold"],class:"font-bold"},{variant:["default-semibold","underline-semibold"],class:"font-semibold"},{variant:["underline-bold","underline-semibold"],class:"underline"}],defaultVariants:{variant:"default-bold"}});function ye(s){var t=s,{variant:e,asChild:r}=t,o=f(t,["variant","asChild"]);return ht(r?ut:"caption",n(a({},o),{className:i(bt({variant:e}))}))}import{Slot as xt}from"@radix-ui/react-slot";import{jsx as vt}from"react/jsx-runtime";var gt=p({base:"font-sans text-fourpulse/small tracking-normal",variants:{variant:{"default-bold":"no-underline","underline-bold":"underline","default-regular":"font-regular no-underline"}},compoundVariants:[{variant:["default-bold","underline-bold"],class:"font-bold"}],defaultVariants:{variant:"default-bold"}});function Se(s){var t=s,{variant:e,asChild:r}=t,o=f(t,["variant","asChild"]);return vt(r?xt:"h3",n(a({},o),{className:i(gt({variant:e}))}))}import{Slot as yt}from"@radix-ui/react-slot";import{jsx as Pt}from"react/jsx-runtime";var St=p({base:"font-bold font-sans leading-tiny tracking-normal no-underline",variants:{variant:{"large-bold":"text-sevenpulse","default-bold":"text-sixpulse","small-bold":"text-fivepulse"}},defaultVariants:{variant:"large-bold"}});function Pe(s){var t=s,{variant:e,asChild:r}=t,o=f(t,["variant","asChild"]);return Pt(r?yt:"h2",n(a({},o),{className:i(St({variant:e}))}))}var dr={BigNumber:ge,Title:Pe,Subtitle:Se,Body:ve,Caption:ye};import{useState as Ct}from"react";var Ce=p({base:`
flex flex-row bg-[transparent]
`,variants:{size:{tiny:"gap-none",small:"gap-onepulse"}}});import{jsx as k}from"react/jsx-runtime";var hr=l=>{var d=l,{size:e="tiny",value:r,ratingLimit:o=5,onClick:s}=d,t=f(d,["size","value","ratingLimit","onClick"]);let[m,c]=Ct(0),b="colorTextEvaluateDefault";function u(h){let x=h+1;s(x),c(x)}return k("div",n(a({className:Ce({size:e})},t),{children:Array.from({length:o},(h,x)=>{let S=r!=null?r:m,B=Math.floor(S),w=S%1,g=B,N=!1;w>=.5&&(N=!0),w>=.99&&(g+=1,N=!1);let H=x<g,E=x===g&&N;return k("div",{onClick:q=>{q.stopPropagation(),u(x)},role:"button",onKeyDown:()=>u(x),"data-testid":`star-icon-${x}`,children:H?k(P,{symbol:"rdicon-star-filled",color:b,size:e}):E?k(P,{symbol:"rdicon-star-half",color:b,size:e}):k(P,{symbol:"rdicon-star-outline",color:b,size:e})},`${x}-${S}`)})}))};import*as z from"@radix-ui/react-dialog";import*as D from"@radix-ui/react-dialog";import{jsx as we,jsxs as wt}from"react/jsx-runtime";function Re(o){var s=o,{showOverlay:e=!0}=s,r=f(s,["showOverlay"]);let t=i("data-[state=open]:fade-in-20 data-[state=open]:slide-in-from-right data-[state=open]:animate-in data-[state=open]:duration-300 data-[state=open]:ease-out","data-[state=closed]:fade-out data-[state=closed]:slide-out-to-right data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=closed]:ease-in-out");return wt(D.Portal,{children:[e&&we(D.Overlay,{className:i("fixed inset-0 bg-[var(--color-labeling-fill-principal-default)] opacity-[calc(var(--opacity-low)_*_0.01)] ease-in-out","data-[state=open]:fade-in-20 data-[state=open]:animate-in","data-[state=closed]:fade-out data-[state=closed]:animate-out")}),we(D.Content,n(a({},r),{style:{"--sheet-padding":"1rem","--sheet-height":"calc(100vh - (var(--sheet-padding) * 2))","--sheet-max-width":"30rem","--sheet-min-width":"22.5rem"},className:i("z-10 h-[var(--sheet-height)] max-h-[var(--sheet-max-height)] min-w-[var(--sheet-min-width)] max-w-[--sheet-max-width] space-y-4","rounded-[var(--border-radius-mediumcontainer)] border-0","fixed top-[var(--sheet-padding)] right-[var(--sheet-padding)] overflow-y-auto bg-[var(--color-container-fill-default)]",t),"data-slot":"side-sheet-content"}))]})}import*as W from"@radix-ui/react-dialog";import{jsx as I,jsxs as U}from"react/jsx-runtime";function Be({title:e,description:r,showBackButton:o=!0,onBackButton:s,rightActionButton:t}){let c=t!=null?t:{},{icon:l,hidden:d}=c,m=f(c,["icon","hidden"]);return U("header",{className:i("flex w-full items-center justify-between gap-2 px-[var(--padding-inset-fourpulse)] py-[var(--padding-inset-threepulse)]"),"data-slot":"side-sheet-header",children:[U("div",{className:"inline-flex items-center gap-2 overflow-hidden",children:[o&&I(v.Root,{variant:"neutral-tertiary",size:"ml",onClick:s,children:I(v.Icon,{symbol:"rdicon-chevron-left"})}),U("hgroup",{className:i("max-w-full *:line-clamp-2"),children:[I(W.Title,{className:i("font-bold font-sans leading-7 tracking-normal","text-[length:var(--font-size-fivepulse)] text-[var(--color-text-neutral-default)]"),children:e}),I(W.Description,{className:i("font-normal font-sans leading-[140%]","text-[length:var(--font-size-threeandhalfpulse)] text-[var(--color-text-neutral-alternative)]"),children:r})]})]}),m&&d&&I(v.Root,n(a({},t),{className:i("shrink-0"),variant:"neutral-tertiary",size:"ml",children:I(v.Icon,{symbol:l||"rdicon-default"})}))]})}import{jsx as G}from"react/jsx-runtime";var Rt=e=>G(z.Root,n(a({},e),{"data-scope":"side-sheet"})),Bt=e=>G(z.Trigger,n(a({},e),{"data-scope":"side-sheet-trigger"})),Nt=e=>G(z.Close,n(a({},e),{"data-scope":"side-sheet-close"})),Ir={Root:Rt,Trigger:Bt,Content:Re,Header:Be,Close:Nt};import{Drawer as X}from"vaul";import{Drawer as J}from"vaul";import{jsx as Ne,jsxs as Te}from"react/jsx-runtime";function Ve(s){var t=s,{children:e,showOverlay:r=!0}=t,o=f(t,["children","showOverlay"]);return Te(J.Portal,{children:[r&&Ne(J.Overlay,{className:i("fixed inset-0 bg-black/40")}),Te(J.Content,n(a({},o),{className:i("fixed right-0 bottom-0 left-0 h-fit max-h-screen bg-[var(--color-container-fill-default)]","rounded-tl-[var(--border-radius-mediumcontainer)] rounded-tr-[var(--border-radius-mediumcontainer)]"),"data-scope":"bottom-sheet-content",children:[Ne("span",{className:i("block h-[var(--sizing-nano)] w-[var(--sizing-medium)] rounded-[var(--border-radius-smallcontainer)] bg-[var(--color-fill-neutral-fallback)]","-translate-x-1/2 fixed top-1.5 left-1/2")}),e]}))]})}import{Drawer as De}from"vaul";import{jsx as O,jsxs as Q}from"react/jsx-runtime";function Ie({title:e,description:r,iconBackButton:o="rdicon-chevron-left",showBackButton:s=!0,onBackButton:t,rightActionButton:l}){return Q("header",{className:i("mt-1.5 flex w-full items-center justify-between gap-2 px-[var(--padding-inset-fourpulse)] py-[var(--padding-inset-threepulse)]"),"data-slot":"bottom-sheet-header",children:[Q("div",{className:"inline-flex items-center gap-2 overflow-hidden",children:[s&&O(v.Root,{variant:"neutral-tertiary",size:"ml",onClick:t,children:O(v.Icon,{symbol:o})}),Q("hgroup",{className:i("max-w-full space-y-[var(--spacing-stack-onepulse)] *:line-clamp-2"),children:[O(De.Title,{className:i("font-bold font-sans leading-7 tracking-normal","text-[length:var(--font-size-fourpulse)] text-[var(--color-text-neutral-default)]"),children:e}),O(De.Description,{className:i("font-normal font-sans leading-[140%]","text-[length:var(--font-size-threeandhalfpulse)] text-[var(--color-text-neutral-alternative)]"),children:r})]})]}),!(l!=null&&l.hidden)&&O(v.Root,n(a({},l),{className:i("shrink-0"),variant:"neutral-tertiary",size:"ml",children:O(v.Icon,{symbol:(l==null?void 0:l.icon)||"rdicon-default"})}))]})}import{jsx as Z}from"react/jsx-runtime";function Tt(e){return Z(X.Root,n(a({},e),{"data-scope":"bottom-sheet"}))}function Vt(e){return Z(X.Trigger,n(a({},e),{"data-scope":"bottom-sheet-trigger"}))}function Dt(e){return Z(X.Close,n(a({},e),{"data-scope":"bottom-sheet-close"}))}var Jr={Root:Tt,Trigger:Vt,Content:Ve,Header:Ie,Close:Dt};import{useState as It}from"react";function F(){let[e,r]=It();return{useSelect:F,selectedOption:e,setSelectedOption:r}}var ze=p({base:`
flex justify-between w-full h-extrasmall p-none px-twopulse items-center text-text-neutral font-rdmodern flex-1 rounded-none leading-small z-80
placeholder:opacity-transparent focus-visible:border-none focus-visible:outline-none tracking-onepulse
`,variants:{size:{md:"text-threepulse",ml:"text-threeandhalfpulse",lg:"text-threeandhalfpulse",xl:"text-threeandhalfpulse"},readOnly:{true:"text-text-neutral-readonly",false:""},disabled:{true:"text-text-neutral-disabled",false:""},hasError:{true:"bg-forms-fill-error",false:"bg-forms-fill-filled"}},defaultVariants:{size:"md",readOnly:!1,disabled:!1,hasError:!1}});import{jsx as L,jsxs as He}from"react/jsx-runtime";var j=zt(d=>{var m=d,{children:e,__scopeInputSelect:r,onChangeSelectionValue:o,value:s,optionMaxHeight:t}=m,l=f(m,["children","__scopeInputSelect","onChangeSelectionValue","value","optionMaxHeight"]);let{size:c,hasError:b,disabled:u,readOnly:h,placeholder:x,options:S=[]}=C("InputSelectField",r),[B,w]=Ht(!1),{setSelectedOption:g,selectedOption:N}=F(),H=Ot(null),E={label:x!=null?x:"Selecione...",value:""};Oe(()=>{if(s){let y=S.find(R=>R.value===s);return g(y)}return g(E)},[s]),Oe(()=>{function y(R){H.current&&!H.current.contains(R.target)&&w(!1)}return document.addEventListener("mousedown",y),()=>{document.removeEventListener("mousedown",y)}},[]);let q=y=>{g(y),w(!1),o==null||o(y.value)},re=()=>{!u&&!h&&w(!B)};return He("div",{ref:H,className:"relative flex w-full flex-col",children:[He("div",n(a({},Object.keys(l).reduce((R,$)=>($.startsWith("data-")&&(R[$]=l[$]),R),{})),{className:ze(a({size:c,hasError:b,readOnly:h,disabled:u},l)),onClick:()=>re(),onKeyUp:()=>re(),"data-testid":"select-field",children:[N?N.label:E.label,L(ee.Icon,{symbol:B?"rdicon-chevron-up":"rdicon-chevron-down",color:u?"colorTextNeutralDisabled":h?"colorTextNeutralReadonly":"colorTextNeutralDefault"})]})),B&&L("div",{className:"x-full absolute top-full left-0 z-10 w-full py-fivepulse","data-testid":"select-option-menu",children:L(M.Root,n(a({type:"single"},l),{children:L(M.List,{maxHeight:t,children:S==null?void 0:S.map((y,R)=>L(M.Item,{content:y,onPress:()=>q(y),disabled:u,"data-testid":"select-item"},`${y.label}-${R}`))})}))})]})});j.displayName="InputSelectField";var ke=p({base:`
flex w-full border border-solid bg-forms-fill-filled border-forms-border-filled px-onepulse py-threepulse items-center gap-none self-stretch rounded-form border opacity-opaque group hover:border-halfpulse
`,variants:{size:{md:"h-medium text-threepulse",ml:"h-mediumlarge text-threeandhalfpulse",lg:"h-large text-hreeandhalfpulse",xl:"h-extralarge text-threeandhalfpulse"},readOnly:{true:"border-forms-border-readonly bg-forms-fill-readonly text-text-neutral-readonly hover:border-quarterpulse",false:""},disabled:{true:"border-forms-border-disabled bg-forms-fill-disabled text-text-neutral-disabled hover:border-quarterpulse",false:""},hasError:{true:"border-forms-border-error border-quarterpulse bg-forms-fill-error",false:"border-quarterpulse"}},defaultVariants:{}});import{jsx as kt}from"react/jsx-runtime";var Fe=({__scopeInputSelect:e,children:r})=>{let{hasError:o,size:s,disabled:t,readOnly:l}=C("InputSelectHelperText",e);return kt("div",{"data-testid":"select-field-container",className:ke({hasError:o,size:s,disabled:t,readOnly:l}),children:r})};import{useMemo as Ft}from"react";var Le=p({base:"justify-star flex w-[100%] flex-wrap items-center gap-onepulse px-twopulse text-left font-rdmodern font-semibold text-text-neutral-alternative text-threepulse tracking-inline-onepulse",variants:{hasError:{true:"text-text-danger-alternative",false:""},readOnly:{true:"cursor-not-allowed"},disabled:{true:"cursor-not-allowed text-text-neutral-disabled",false:""}},compoundVariants:[{readOnly:!0,disabled:!1,class:"text-text-neutral-readonly"}],defaultVariants:{error:!1,disabled:!1,readOnly:!1}});import{jsx as te,jsxs as Lt}from"react/jsx-runtime";var Ee=l=>{var d=l,{withIcon:e,iconName:r="rdicon-warning-circle",__scopeInputSelect:o,children:s}=d,t=f(d,["withIcon","iconName","__scopeInputSelect","children"]);let{hasError:m,readOnly:c,disabled:b}=C("InputSelectHelperText",o),u=m?"rdicon-warning-circle":r,h=Ft(()=>b?"colorTextNeutralDisabled":c?"colorTextNeutralReadonly":m?"colorTextDangerAlternative":"colorTextNeutralAlternative",[b,m,c]);return s?Lt("div",n(a({},t),{"aria-disabled":b,className:Le({hasError:m,disabled:b,readOnly:c}),children:[e&&te("div",{className:"flex items-center",children:te(P,{symbol:u,color:h,size:"tiny"})}),te("span",{className:"flex flex-1",children:s})]})):null};import Et from"react";import{jsx as Me}from"react/jsx-runtime";function _e(s){var t=s,{__scopeInputSelect:e,color:r="colorTextNeutralDefault"}=t,o=f(t,["__scopeInputSelect","color"]);let{size:l,hasError:d,disabled:m,readOnly:c}=C("InputSelectField",e),b=Et.useMemo(()=>{let u={md:"small",ml:"small",lg:"small",xl:"small"};return u==null?void 0:u[l]},[l]);return Me("div",{className:"flex h-6 h-small w-6 items-center justify-center rounded-none opacity-100",children:Me(P,n(a({},o),{size:b,color:d?"colorTextDangerAlternative":m?"colorTextNeutralDisabled":c?"colorTextNeutralReadonly":"colorTextNeutralDefault"}))})}var Ae=p({base:`
w-[100%] align-middle m-none p-none
text-left font-rdmodern font-semibold tracking-tiny text-text-neutral text-nowrap truncate leading
`,variants:{size:{md:"text-threepulse",ml:"text-threeandhalfpulse",lg:"text-threeandhalfpulse",xl:"text-threeandhalfpulse"},readOnly:{true:"",false:""},disabled:{true:"cursor-not-allowed text-text-neutral-disabled",false:""}},compoundVariants:[{readOnly:!0,disabled:!1,class:"cursor-not-allowed text-text-neutral-readonly"}],defaultVariants:{disabled:!1,readOnly:!1}});import{jsx as We}from"react/jsx-runtime";var qe=({htmlFor:e,__scopeInputSelect:r,children:o})=>{let{size:s,disabled:t,readOnly:l}=C("InputSelectLabel",r);return We("div",{className:"flex h-extrasmall w-[100%] items-center rounded-none rounded-none border-none px-twopulse text-left",children:We("label",{htmlFor:e,className:Ae({disabled:t,readOnly:l,size:s}),"data-testid":"testid-label",children:o})})};import{jsx as $e}from"react/jsx-runtime";var oe="Select",Ye=e=>{let{size:r="md",hasError:o=!1,disabled:s=!1,__scopeInputSelect:t,options:l,children:d,placeholder:m}=e,{selectedOption:c}=F();return $e(At,n(a({},e),{size:r,scope:t,hasError:o,disabled:s,options:l,value:c==null?void 0:c.value,placeholder:m,children:$e("div",{className:"size-${size} min-w-[5rem] flex-1 flex-shrink-0 flex-col items-start gap-halfpulse rounded-none border-none bg-transparent p-none font-rdmodern text-align-center opacity-opaque",children:d})}))};Ye.displayName=oe;var[_t]=Mt(oe),[At,C]=_t(oe),ee={Root:Ye,Label:qe,FieldContainer:Fe,Icon:_e,Field:j,Actions:ne,HelperText:Ee};export{ee as a,Xe as b,lt as c,dr as d,hr as e,Ir as f,Jr as g};
//# sourceMappingURL=chunk-WRI2WVBN.js.map