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.

47 lines 27.8 kB
import{a as U}from"./chunk-PX2FEMH2.js";import{a as M}from"./chunk-I2462MXS.js";import{a as x}from"./chunk-DRZFR5FK.js";import{a as s}from"./chunk-JOWCR2VE.js";import{a as P}from"./chunk-MLZGVFI5.js";import{c as ne}from"./chunk-QQVWOIX7.js";import{a as p}from"./chunk-DDOE6RPR.js";import{a,b as n,c as f}from"./chunk-UABQX4UA.js";import{createContextScope as Wt}from"@radix-ui/react-context";import{jsx as Ge}from"react/jsx-runtime";var se=({children:t})=>Ge("div",{className:"input-select-actions","data-testid":"input-name-actions",children:t});import{forwardRef as kt,useEffect as ke,useRef as Ht,useState as Et}from"react";import{createContextScope as Je}from"@radix-ui/react-context";import{forwardRef as Qe}from"react";var ie=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"}}),de=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"}}),ce=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"}}),pe=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 et}from"react/jsx-runtime";var K="SearchBar",me=Qe((t,l)=>{let{onChange:o=()=>{},handleSearch:i=()=>{},handleClear:e=()=>{},placeholder:r,datatestid:d="search-bar",value:m="",size:c="md",__scopeSearchBar:b}=t,u=h=>h==="lg"?"ml":h;return T(Ze,n(a({},t),{scope:b,children:et("div",{className:s(ie({size:c,hasFilled:m!==""})),children:[T("input",{ref:l,type:"text",className:de({size:c,hasFilled:m!==""}),placeholder:r,onChange:h=>o(h),value:m,"data-testid":d}),T(x.Root,{size:u(c),variant:"neutral-tertiary",className:pe({size:c}),onClick:e,children:T(x.Icon,{symbol:"rdicon-dismiss-circle-outline"})}),T(x.Root,{size:u(c),variant:"neutral-tertiary",className:ce({size:c}),onClick:i,children:T(x.Icon,{symbol:"rdicon-search"})})]})}))});me.displayName=K;var[Xe]=Je(K),[Ze,to]=Xe(K),je={Root:me};import{createContextScope as at}from"@radix-ui/react-context";import A,{useMemo as xe,useState as ge}from"react";var fe=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"}]}),ue=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"}]}),be=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 tt}from"react";import{jsx as ot}from"react/jsx-runtime";var he=t=>{let{__scopeCardCategory:l}=t,{orientation:o,disabled:i,isHovered:e,isPressed:r,context:d}=_("CardCategoryLabel",l),m=tt(()=>{if(i&&d==="neutral"||i)return"colorTextNeutralDisabled";if(d==="brand"&&r)return"colorActionTextOnbrandPressed";if(d==="brand"&&e)return"colorActionTextOnbrandHovered";if(d==="neutral"||d==="brand")return"colorTextNeutralAlternative";if(r)return"colorActionTextOnbrandPressed";if(e)return"colorActionTextOnbrandHovered"},[e,r,i,d]);return ot(P,n(a({},t),{size:o==="horizontal"?"small":"medium",color:m}))};import{jsx as rt}from"react/jsx-runtime";var D=t=>{let{__scopeCardCategory:l,children:o}=t,{orientation:i,context:e,disabled:r,isPressed:d,isHovered:m}=_("CardCategoryLabel",l);return rt("span",{className:be({orientation:i,context:e,disabled:r,isPressed:d,isHovered:m}),children:o})};import{jsx as G,jsxs as dt}from"react/jsx-runtime";var ve="CardCategory",lt=t=>{let{children:l,orientation:o="horizontal",testID:i,disabled:e,onClick:r,context:d,__scopeCardCategory:m}=t,c=ne(),[b,u]=ge(!1),[h,S]=ge(!1),C=A.Children.map(l,g=>A.isValidElement(g)&&(g.type===D&&o==="horizontal"||g.type!==D)?g:null),B=xe(()=>!e&&h?c.colorBrowsingFillOnbrandPressed:!e&&b?c.colorBrowsingFillOnbrandHovered:e?c.colorBrowsingFillOnbrandDisabled:c.colorBrowsingFillOnbrandEnabled,[e,b,h,c]),R=xe(()=>d?"horizontal":o,[d,o]);return G(st,{scope:m,orientation:R,disabled:e,"data-testid":i,isHovered:b,isPressed:h,context:d,children:dt("div",{"data-testid":i,className:fe({disabled:e,orientation:o,context:d}),children:[G("button",{type:"button",className:s(ue({orientation:o,disabled:e,context:d})),onClick:r,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onMouseDown:()=>S(!0),onMouseUp:()=>S(!1),style:{backgroundColor:d==="brand"?B:void 0},disabled:e,children:C}),o==="vertical"&&G(D,{children:A.Children.toArray(l).find(g=>A.isValidElement(g)&&g.type===D)})]})})},[nt]=at(ve),[st,_]=nt(ve),it={Root:lt,Icon:he,Label:D};import{Slot as ct}from"@radix-ui/react-slot";import{jsx as mt}from"react/jsx-runtime";var pt=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 ye(i){var e=i,{variant:t,asChild:l}=e,o=f(e,["variant","asChild"]);return mt(l?ct:"h1",n(a({},o),{className:s(pt({variant:t}))}))}import{Slot as ft}from"@radix-ui/react-slot";import{jsx as bt}from"react/jsx-runtime";var ut=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 Se(i){var e=i,{variant:t,asChild:l}=e,o=f(e,["variant","asChild"]);return bt(l?ft:"p",n(a({},o),{className:s(ut({variant:t}))}))}import{Slot as ht}from"@radix-ui/react-slot";import{jsx as gt}from"react/jsx-runtime";var xt=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 Pe(i){var e=i,{variant:t,asChild:l}=e,o=f(e,["variant","asChild"]);return gt(l?ht:"caption",n(a({},o),{className:s(xt({variant:t}))}))}import{Slot as vt}from"@radix-ui/react-slot";import{jsx as St}from"react/jsx-runtime";var yt=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 Ce(i){var e=i,{variant:t,asChild:l}=e,o=f(e,["variant","asChild"]);return St(l?vt:"h3",n(a({},o),{className:s(yt({variant:t}))}))}import{Slot as Pt}from"@radix-ui/react-slot";import{jsx as wt}from"react/jsx-runtime";var Ct=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 we(i){var e=i,{variant:t,asChild:l}=e,o=f(e,["variant","asChild"]);return wt(l?Pt:"h2",n(a({},o),{className:s(Ct({variant:t}))}))}var mr={BigNumber:ye,Title:we,Subtitle:Ce,Body:Se,Caption:Pe};import*as V from"@radix-ui/react-dialog";import*as z from"@radix-ui/react-dialog";import{jsx as Ne,jsxs as Nt}from"react/jsx-runtime";function Be(o){var i=o,{showOverlay:t=!0}=i,l=f(i,["showOverlay"]);let e=s("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 Nt(z.Portal,{children:[t&&Ne(z.Overlay,{className:s("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")}),Ne(z.Content,n(a({},l),{style:{"--sheet-padding":"1rem","--sheet-height":"calc(100vh - (var(--sheet-padding) * 2))","--sheet-max-width":"30rem","--sheet-min-width":"22.5rem"},className:s("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)]",e),"data-slot":"side-sheet-content"}))]})}import*as W from"@radix-ui/react-dialog";import{jsx as I,jsxs as J}from"react/jsx-runtime";function Re({title:t,description:l,showBackButton:o=!0,onBackButton:i,rightActionButton:e}){let c=e!=null?e:{},{icon:r,hidden:d}=c,m=f(c,["icon","hidden"]);return J("header",{className:s("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:[J("div",{className:"inline-flex items-center gap-2 overflow-hidden",children:[o&&I(x.Root,{variant:"neutral-tertiary",size:"ml",onClick:i,children:I(x.Icon,{symbol:"rdicon-chevron-left"})}),J("hgroup",{className:s("max-w-full *:line-clamp-2"),children:[I(W.Title,{className:s("font-bold font-sans leading-7 tracking-normal","text-[length:var(--font-size-fivepulse)] text-[var(--color-text-neutral-default)]"),children:t}),I(W.Description,{className:s("font-normal font-sans leading-[140%]","text-[length:var(--font-size-threeandhalfpulse)] text-[var(--color-text-neutral-alternative)]"),children:l})]})]}),m&&d&&I(x.Root,n(a({},e),{className:s("shrink-0"),variant:"neutral-tertiary",size:"ml",children:I(x.Icon,{symbol:r||"rdicon-default"})}))]})}import{jsx as Q}from"react/jsx-runtime";var Bt=t=>Q(V.Root,n(a({},t),{"data-scope":"side-sheet"})),Rt=t=>Q(V.Trigger,n(a({},t),{"data-scope":"side-sheet-trigger"})),Tt=t=>Q(V.Close,n(a({},t),{"data-scope":"side-sheet-close"})),Nr={Root:Bt,Trigger:Rt,Content:Be,Header:Re,Close:Tt};import{Drawer as j}from"vaul";import{Drawer as X}from"vaul";import{jsx as Te,jsxs as De}from"react/jsx-runtime";function ze(i){var e=i,{children:t,showOverlay:l=!0}=e,o=f(e,["children","showOverlay"]);return De(X.Portal,{children:[l&&Te(X.Overlay,{className:s("fixed inset-0 bg-black/40")}),De(X.Content,n(a({},o),{className:s("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:[Te("span",{className:s("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")}),t]}))]})}import{Drawer as Ie}from"vaul";import{jsx as O,jsxs as Z}from"react/jsx-runtime";function Ve({title:t,description:l,iconBackButton:o="rdicon-chevron-left",showBackButton:i=!0,onBackButton:e,rightActionButton:r}){return Z("header",{className:s("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:[Z("div",{className:"inline-flex items-center gap-2 overflow-hidden",children:[i&&O(x.Root,{variant:"neutral-tertiary",size:"ml",onClick:e,children:O(x.Icon,{symbol:o})}),Z("hgroup",{className:s("max-w-full space-y-[var(--spacing-stack-onepulse)] *:line-clamp-2"),children:[O(Ie.Title,{className:s("font-bold font-sans leading-7 tracking-normal","text-[length:var(--font-size-fourpulse)] text-[var(--color-text-neutral-default)]"),children:t}),O(Ie.Description,{className:s("font-normal font-sans leading-[140%]","text-[length:var(--font-size-threeandhalfpulse)] text-[var(--color-text-neutral-alternative)]"),children:l})]})]}),!(r!=null&&r.hidden)&&O(x.Root,n(a({},r),{className:s("shrink-0"),variant:"neutral-tertiary",size:"ml",children:O(x.Icon,{symbol:(r==null?void 0:r.icon)||"rdicon-default"})}))]})}import{jsx as ee}from"react/jsx-runtime";function Dt(t){return ee(j.Root,n(a({},t),{"data-scope":"bottom-sheet"}))}function zt(t){return ee(j.Trigger,n(a({},t),{"data-scope":"bottom-sheet-trigger"}))}function It(t){return ee(j.Close,n(a({},t),{"data-scope":"bottom-sheet-close"}))}var qr={Root:Dt,Trigger:zt,Content:ze,Header:Ve,Close:It};import{Slot as Vt,Slottable as Ot}from"@radix-ui/react-slot";var Oe=p({slots:{root:["relative min-w-64 flex-1 space-y-[var(--spacing-stack-twopulse)] bg-[var(--color-container-fill-default)] p-[var(--padding-inset-fourpulse)] outline-none"],header:"flex items-center gap-x-2",title:"line-clamp-2 font-bold text-[length:var(--font-size-threeandhalfpulse)] text-[var(--color-text-neutral-default)] leading-[var(--line-height-small)]",description:"line-clamp-4 font-normal text-[length:var(--font-size-threeandhalfpulse)] text-[var(--color-text-neutral-default)] leading-[var(--line-height-small)]",separator:"before:absolute before:bottom-0 before:h-px before:w-[calc(100%_-_2rem)] before:bg-[var(--color-fill-neutral-fallback)] before:content-['']"},variants:{isDisabled:{true:{root:"cursor-not-allowed bg-[var(--color-container-fill-disabled)] *:select-none",title:"text-[var(--color-text-neutral-disabled)]",description:"text-[var(--color-text-neutral-disabled)]"},false:{root:["hover:bg-[var(--color-container-fill-hovered)] active:bg-[var(--color-container-fill-pressed)]"]}}}});import{jsx as N,jsxs as q}from"react/jsx-runtime";function ea(h){var S=h,{children:t,title:l,titleAs:o="h3",description:i,disabled:e=!1,tag:r,leftIcon:d,showSeparator:m=!1,asChild:c=!1,rootProps:b}=S,u=f(S,["children","title","titleAs","description","disabled","tag","leftIcon","showSeparator","asChild","rootProps"]);let C=c?Vt:"a",{root:B,header:R,title:g,description:F,separator:L}=Oe({isDisabled:e}),k=e?"colorTextNeutralDisabled":"colorTextNeutralDefault",Y=!e&&typeof r!="undefined";return N("li",n(a({},b),{className:s("inline-flex w-full list-none"),children:q("div",{role:"button","aria-disabled":e,className:s(B({className:m&&L()})),children:[q("header",{className:s(R()),children:[d&&N(P,{size:"small",color:k,symbol:d,"aria-hidden":!0}),q("div",{className:s("grid flex-1 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-2"),children:[q(o,{className:s(g()),children:[l,N(C,n(a({},u),{className:s(e?"hidden":"absolute inset-0 outline-0 focus-visible:ring-[length:var(--border-width-halfpulse)] focus-visible:ring-[var(--color-container-border-focused)]"),tabIndex:0,"aria-labelledby":l,children:N(Ot,{children:t})}))]}),Y&&N(U.Root,{variants:r.variant||"principal",children:N(U.Label,{children:r.label})})]}),N(P,{size:"extra-small",symbol:"rdicon-chevron-right",color:k,"aria-hidden":!0})]}),i&&N("p",{className:s(F()),children:i})]})}))}import{useState as Lt}from"react";function H(){let[t,l]=Lt();return{useSelect:H,selectedOption:t,setSelectedOption:l}}var Le=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 E,jsxs as He}from"react/jsx-runtime";var te=kt(d=>{var m=d,{children:t,__scopeInputSelect:l,onChangeSelectionValue:o,value:i,optionMaxHeight:e}=m,r=f(m,["children","__scopeInputSelect","onChangeSelectionValue","value","optionMaxHeight"]);let{size:c,hasError:b,disabled:u,readOnly:h,placeholder:S,options:C=[]}=y("InputSelectField",l),[B,R]=Et(!1),{setSelectedOption:g,selectedOption:F}=H(),L=Ht(null),k={label:S!=null?S:"Selecione...",value:""};ke(()=>{if(i){let v=C.find(w=>w.value===i);return g(v)}return g(k)},[i]),ke(()=>{function v(w){L.current&&!L.current.contains(w.target)&&R(!1)}return document.addEventListener("mousedown",v),()=>{document.removeEventListener("mousedown",v)}},[]);let Y=v=>{g(v),R(!1),o==null||o(v.value)},le=()=>{!u&&!h&&R(!B)};return He("div",{ref:L,className:"relative flex w-full flex-col",children:[He("div",n(a({},Object.keys(r).reduce((w,$)=>($.startsWith("data-")&&(w[$]=r[$]),w),{})),{className:Le(a({size:c,hasError:b,readOnly:h,disabled:u},r)),onClick:()=>le(),onKeyUp:()=>le(),"data-testid":"select-field",children:[F?F.label:k.label,E(oe.Icon,{symbol:B?"rdicon-chevron-up":"rdicon-chevron-down",color:u?"colorTextNeutralDisabled":h?"colorTextNeutralReadonly":"colorTextNeutralDefault"})]})),B&&E("div",{className:"x-full absolute top-full left-0 z-10 w-full py-fivepulse","data-testid":"select-option-menu",children:E(M.Root,n(a({type:"single"},r),{children:E(M.List,{children:C==null?void 0:C.map((v,w)=>E(M.Item,{content:v,onPress:()=>Y(v),disabled:u,"data-testid":"select-item"},`${v.label}-${w}`))})}))})]})});te.displayName="InputSelectField";var Ee=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 Ft}from"react/jsx-runtime";var Fe=({__scopeInputSelect:t,children:l})=>{let{hasError:o,size:i,disabled:e,readOnly:r}=y("InputSelectHelperText",t);return Ft("div",{"data-testid":"select-field-container",className:Ee({hasError:o,size:i,disabled:e,readOnly:r}),children:l})};import{useMemo as Mt}from"react";var Me=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 re,jsxs as _t}from"react/jsx-runtime";var _e=r=>{var d=r,{withIcon:t,iconName:l="rdicon-warning-circle",__scopeInputSelect:o,children:i}=d,e=f(d,["withIcon","iconName","__scopeInputSelect","children"]);let{hasError:m,readOnly:c,disabled:b}=y("InputSelectHelperText",o),u=m?"rdicon-warning-circle":l,h=Mt(()=>b?"colorTextNeutralDisabled":c?"colorTextNeutralReadonly":m?"colorTextDangerAlternative":"colorTextNeutralAlternative",[b,m,c]);return i?_t("div",n(a({},e),{"aria-disabled":b,className:Me({hasError:m,disabled:b,readOnly:c}),children:[t&&re("div",{className:"flex items-center",children:re(P,{symbol:u,color:h,size:"tiny"})}),re("span",{className:"flex flex-1",children:i})]})):null};import At from"react";import{jsx as Ae}from"react/jsx-runtime";function We(i){var e=i,{__scopeInputSelect:t,color:l="colorTextNeutralDefault"}=e,o=f(e,["__scopeInputSelect","color"]);let{size:r,hasError:d,disabled:m,readOnly:c}=y("InputSelectField",t),b=At.useMemo(()=>{let u={md:"small",ml:"small",lg:"small",xl:"small"};return u==null?void 0:u[r]},[r]);return Ae("div",{className:"flex h-6 h-small w-6 items-center justify-center rounded-none opacity-100",children:Ae(P,n(a({},o),{size:b,color:d?"colorTextDangerAlternative":m?"colorTextNeutralDisabled":c?"colorTextNeutralReadonly":"colorTextNeutralDefault"}))})}var qe=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 Ye}from"react/jsx-runtime";var $e=({htmlFor:t,__scopeInputSelect:l,children:o})=>{let{size:i,disabled:e,readOnly:r}=y("InputSelectLabel",l);return Ye("div",{className:"flex h-extrasmall w-[100%] items-center rounded-none rounded-none border-none px-twopulse text-left",children:Ye("label",{htmlFor:t,className:qe({disabled:e,readOnly:r,size:i}),"data-testid":"testid-label",children:o})})};import{jsx as Ue}from"react/jsx-runtime";var ae="Select",Ke=t=>{let{size:l="md",hasError:o=!1,disabled:i=!1,__scopeInputSelect:e,options:r,children:d,placeholder:m}=t,{selectedOption:c}=H();return Ue(Yt,n(a({},t),{size:l,scope:e,hasError:o,disabled:i,options:r,value:c==null?void 0:c.value,placeholder:m,children:Ue("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})}))};Ke.displayName=ae;var[qt]=Wt(ae),[Yt,y]=qt(ae),oe={Root:Ke,Label:$e,FieldContainer:Fe,Icon:We,Field:te,Actions:se,HelperText:_e};export{oe as a,je as b,it as c,mr as d,Nr as e,qr as f,ea as g}; //# sourceMappingURL=chunk-V365FH73.js.map