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