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