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.

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