sodtrack-web-ui 0.87.0 → 0.87.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-ZZ4C27L7.mjs → chunk-FTTXIKMA.mjs} +1 -1
- package/dist/{chunk-Y5HVTC26.mjs → chunk-HV3JCN4E.mjs} +1 -1
- package/dist/chunk-JEYTNPAV.mjs +1 -0
- package/dist/chunk-WB4JKV64.mjs +1 -0
- package/dist/components/autocomplete-new.d.mts +3 -0
- package/dist/components/autocomplete-new.d.ts +3 -0
- package/dist/components/autocomplete-new.js +1 -1
- package/dist/components/autocomplete-new.mjs +1 -1
- package/dist/components/card-expandable.mjs +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/index.mjs +1 -1
- package/dist/components/list-item-arrow.mjs +1 -1
- package/dist/components/list-item-button.mjs +1 -1
- package/dist/components/list-item-checkbox-left.mjs +1 -1
- package/dist/components/list-item-checkbox.mjs +1 -1
- package/dist/components/list-item.mjs +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/switch.mjs +1 -1
- package/dist/styles/index.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-K4WOO5Z2.mjs +0 -1
- package/dist/chunk-SVAYP3BB.mjs +0 -1
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {d}from'./chunk-4MO4OFLX.mjs';import {a as a$5}from'./chunk-KTRSJBA4.mjs';import {a as a$4}from'./chunk-GTPSQXE3.mjs';import {c as c$2}from'./chunk-PTRXL7BY.mjs';import {c as c$4}from'./chunk-GBBE3RHT.mjs';import {d as d$1}from'./chunk-FAMLJ6AJ.mjs';import {a as a$3}from'./chunk-JTO6FE4R.mjs';import {a as a$1}from'./chunk-OG3OUJ6C.mjs';import {c as c$3}from'./chunk-AI4D6AOK.mjs';import {c}from'./chunk-JWB3TN2C.mjs';import {a}from'./chunk-SVAYP3BB.mjs';import {c as c$1,h}from'./chunk-5VHBHGBZ.mjs';import {a as a$2}from'./chunk-XJD5SYZJ.mjs';import be,{createContext,useMemo,useCallback,useContext,useRef,useEffect,useState,useId}from'react';import*as Ie from'@radix-ui/react-portal';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var Qe=be.memo(({handleSelect:e,NoResultsIcon:i,noResultsLabel:t,noResultsDescription:o,noResultsDescriptionLines:s,noResultsAsColumn:p,noResultsButtonOnClick:n,optionDescriptionLines:r,noResultsButtonLabel:l,filteredOptions:u,inputRect:c$1,inputRef:f,popoverPosition:C,optionsListRef:x,selectedOption:b,options:g,setFilteredOptions:R})=>jsx(Ie.Root,{asChild:true,children:jsxs("div",{ref:x,className:"elevation-8 pointer-events-auto fixed z-50 mb-2 hidden max-h-[336px] w-full flex-col overflow-y-auto rounded-lg bg-neutral-50",style:c$1?{width:`${c$1.width}px`,left:c$1.left,top:C==="bottom"?`${c$1.bottom}px`:void 0,bottom:C==="top"?`${window.innerHeight-c$1.top}px`:void 0}:void 0,children:[u.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(a,{title:t,description:o,Icon:i,iconAsColumn:p,descriptionLines:s}),n&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:a=>{x.current.style.display="none",f.current.value="",R(g),n();},children:l})]})]}),u.map(a=>jsx(ke,{title:a.label,disabled:a.disabled,description:a.description,descriptionLines:r,onClick:()=>e(a),className:a$2(b?.value===a.value&&"bg-primary-200")},a.key??a.value))]})})),Pe=Qe;var Ze=336,eo=({options:e,defaultSelectedOption:i,onSelect:t,onClick:o,onInputChange:s,error:p,helperText:n,label:r,placeholder:l,value:u,size:c="md",optionDescriptionLines:f=1,noResultsLabel:C,noResultsIcon:x,noResultsDescription:b,noResultsDescriptionLines:g,noResultsAsColumn:R,noResultsButtonOnClick:a,noResultsButtonLabel:N,className:L,disabled:P})=>{let[m,M]=useState(i??null),O=useRef(null),d=useRef(null),[pe,ue]=useState(),[ce,z]=useState([]),[me,W]=useState("bottom"),[U,ee]=useState(),q=Ze,V=useCallback(v=>{O.current.style.display="none",d.current.value=v.label,M(v),t?.(v);},[t]),w=useCallback(()=>{if(!d?.current)return;let v=d.current.getBoundingClientRect();ue(v);let k=U?U.height:q,I=window.innerHeight-v.bottom>k,te=v.top>k;W(I?"bottom":te?"top":"bottom");},[U?.height]),J=useCallback(()=>{let v=e.filter(k=>k.label.toLowerCase().includes(d?.current?.value.toLowerCase()??""));if(z(v),O?.current){let k=O.current.getBoundingClientRect();ee(k);}},[e]);return useEffect(()=>{z(e);},[e]),useEffect(()=>{if(!u){M(null),d.current&&(d.current.value="");return}(!d.current?.value||m?.value!==u.value)&&(M(u),d.current.value=u.label);},[u]),a$5(O,()=>{O.current.style.display="none",m&&d.current&&(d.current.value=m.label);}),useEffect(()=>{if(d?.current)return w(),d.current.addEventListener("mousedown",w),d.current.addEventListener("input",J),window.addEventListener("scroll",w,true),window.addEventListener("resize",w),()=>{d.current?.removeEventListener("mousedown",w),d.current?.removeEventListener("input",J),window.removeEventListener("scroll",w,true),window.removeEventListener("resize",w);}},[w,J]),jsxs("div",{className:a$2("relative",L),children:[jsx(a$4,{ref:d,autoComplete:"off",list:"",selectMode:true,onChange:v=>{v.target.value||(M(null),t?.(null)),s?.(v);},onClean:()=>{M(null),z(e),t?.(null);},onClick:v=>{O.current.style.display="flex",o?.(v);},onBlur:()=>{m&&d.current&&(d.current.value=m.label);},label:r,helperText:n,placeholder:l,size:c,error:p,disabled:P}),jsx(Pe,{handleSelect:V,noResultsLabel:C,NoResultsIcon:x,optionDescriptionLines:f,noResultsAsColumn:R,noResultsButtonLabel:N,noResultsButtonOnClick:a,noResultsDescription:b,noResultsDescriptionLines:g,filteredOptions:ce,inputRect:pe,inputRef:d,popoverPosition:me,optionsListRef:O,selectedOption:m,options:e,setFilteredOptions:z})]})};var et=({children:e,title:i,titleLines:t,description:o="",descriptionLines:s,disabled:p=false,className:n,...r})=>jsxs("div",{className:"flex w-full flex-col gap-1",...r,children:[jsx("p",{className:a$2("break-all text-sm leading-[130%]",!!o&&"font-medium"),style:t?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:t}:void 0,children:i}),o&&jsx("p",{className:a$2("text-xs leading-[130%]",p?"text-neutral-400":"text-neutral-700"),style:s?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:s}:void 0,children:o})]}),H=et;var ao=({children:e,title:i,titleLines:t,description:o="",descriptionLines:s,startIcon:p,badgeContent:n,hasDivider:r=false,disabled:l=false,onSelect:u,className:c,...f})=>jsxs(y,{hasDescription:!!o,disabled:l,onClick:u,hasDivider:r,className:a$2(!l&&"cursor-pointer",c),...f,children:[p&&be.cloneElement(p,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:l}),jsxs("div",{className:"ml-4 flex gap-2",children:[n&&jsx(a$3,{content:n,size:"lg",variant:"alert",className:a$2("self-center",l&&"bg-neutral-400")}),jsx(h,{className:"h-4.5 w-4.5 self-center"})]})]});var He=({children:e,title:i,titleLines:t=1,description:o="",descriptionLines:s,startIcon:p,hasDivider:n=false,disabled:r=false,checked:l,onCheckedChange:u,className:c,...f})=>jsxs(y,{hasDescription:!!o,disabled:r,hasDivider:n,...f,className:a$2("pr-6",c),children:[p&&be.cloneElement(p,{className:"shrink-0 w-4.5 h-4.5 mr-2"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:r}),jsx(c$2,{size:"sm",checked:l,onCheckedChange:u,className:"ml-4 self-center",disabled:r})]});var F=336,Se=createContext({inputRef:null,optionsListRef:null,autocompleteId:"",inputRect:void 0,showChips:false,filteredOptions:[],currentFocus:-1,popoverPosition:"bottom",setFilteredOptions:()=>{},setCurrentFocus:()=>{},setShowChips:()=>{},setPopoverPosition:()=>{},setInputRect:()=>{},optionsListHeight:F,setOptionsListHeight:()=>{},optionsListRect:void 0,setOptionsListRect:()=>{}}),D=()=>{let e=useContext(Se);if(e===null)throw new Error("useAutocompleteMultipleContext must be used within a AutocompleteMultipleProvider");return e},Be=({children:e})=>{let i=useRef(null),t=useRef(null),o=useId(),[s,p]=useState(),[n,r]=useState(true),[l,u]=useState([]),[c,f]=useState(-1),[C,x]=useState("bottom"),[b,g]=useState(),[R,a]=useState(F);return jsx(Se.Provider,{value:{optionsListRef:i,inputRef:t,autocompleteId:o,inputRect:s,showChips:n,filteredOptions:l,currentFocus:c,popoverPosition:C,setFilteredOptions:u,setCurrentFocus:f,setShowChips:r,setPopoverPosition:x,setInputRect:p,optionsListHeight:R,optionsListRect:b,setOptionsListRect:g,setOptionsListHeight:a},children:e})};var mt=({option:e,onMountWidth:i,size:t})=>{let o=useRef(null);return useEffect(()=>{o.current&&i?.(o.current.clientWidth);},[]),jsx(d,{type:"fill",variant:"standard",ref:o,className:"shrink-0",size:t==="md"?"xs":"sm",hasCloseIcon:false,children:e.label})},ze=mt;var ht=150,bt=be.memo(({selectedOptions:e,error:i,onCleanSelectedOptions:t,disabled:o,size:s})=>{let{autocompleteId:p,inputRect:n,inputRef:r,optionsListRef:l}=D(),u=be.useRef(null),[c,f]=be.useState(new Map),C=useMemo(()=>{if(!n?.width)return [];let b=0,g=n.width-ht,R=0;for(let a=0;a<e.length&&(R+=c.get(a)??0,!(R>g));a++)b++;return e.slice(0,b)},[n?.width,e,c]),x=useCallback(()=>{o||(r?.current?.focus(),l.current.style.display="flex");},[o]);return jsxs("div",{onClick:x,className:a$2("absolute top-0 z-30 flex w-full cursor-pointer flex-nowrap items-center gap-2 pl-3 pr-12",o&&"cursor-not-allowed"),style:{maxWidth:n?.width?n?.width:void 0,height:n?.height?n?.height:void 0},children:[jsx("div",{className:"flex flex-1 gap-1 overflow-hidden",ref:u,children:C.map((b,g)=>jsx(ze,{option:b,onMountWidth:R=>f(a=>new Map(a).set(g,R)),size:s},`chip-input-${p}-${b.value}`))}),e.length>C.length&&jsx("span",{className:"text-base",children:"..."}),e.length>0&&!i&&jsx(a$3,{content:String(e.length),size:s}),i&&e.length>0&&jsx(c$1,{className:"h-6 w-6 text-error-700",onClick:b=>{b.stopPropagation(),t();}})]})}),We=bt;var vt=be.memo(({option:e,index:i,onPressOption:t,isSelected:o,optionDescriptionLines:s})=>{let{currentFocus:p,inputRef:n}=D();return jsx(He,{title:e.label,checked:o,disabled:e.disabled,className:p===i?"bg-primary-200":void 0,onMouseDown:r=>{e.disabled||(n?.current?.value&&r.preventDefault(),t?.(e,r));},description:e.description,descriptionLines:s})}),Le=vt;var Mt=be.memo(({selectedOptions:e,handleSelect:i,NoResultsIcon:t,noResultsLabel:o,noResultsDescription:s,noResultsDescriptionLines:p,noResultsAsColumn:n,noResultsButtonOnClick:r,optionDescriptionLines:l,noResultsButtonLabel:u})=>{let{popoverPosition:c$1,optionsListRef:f,filteredOptions:C,inputRect:x,autocompleteId:b,inputRef:g,optionsListHeight:R}=D(),a$2=useCallback(L=>e.some(P=>P.value===L.value),[e]),N=useMemo(()=>e.filter(L=>L.label.toLowerCase().includes(g?.current?.value.toLowerCase()??"")),[e,g?.current?.value]);return jsx(Ie.Root,{asChild:true,children:jsxs("div",{ref:f,className:"elevation-8 pointer-events-auto fixed z-50 mb-2 hidden w-full flex-col overflow-y-auto rounded-lg bg-neutral-50",style:x?{width:`${x.width}px`,left:x.left,top:c$1==="bottom"?`${x.bottom}px`:void 0,bottom:c$1==="top"?`${window.innerHeight-x.top}px`:void 0,maxHeight:R+"px"}:void 0,children:[C.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(a,{title:o,description:s,Icon:t,iconAsColumn:n,descriptionLines:p}),r&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:L=>{f.current.style.display="none",g.current.value="",r();},children:u})]})]}),N.map((L,P)=>jsx(Le,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$2(L),optionDescriptionLines:l},`autocomplete-option-${b}-${L.key??L.value}`)),C.map((L,P)=>!e.some(m=>m.value===L.value)&&jsx(Le,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$2(L),optionDescriptionLines:l},`autocomplete-option-${b}-${L.key??L.value}`))]})})}),$e=Mt;var It=be.memo(({selectedOptions:e,onSelect:i,error:t,helperText:o,label:s,placeholder:p,options:n,onInputChange:r,size:l,disabled:u})=>{let{setCurrentFocus:c,setFilteredOptions:f,optionsListRef:C,inputRef:x}=D();return jsx(a$4,{ref:x,autoComplete:"off",list:"",disabled:u,selectMode:true,onChange:b=>{c(-1),r?.(b.target.value);},onClean:()=>{c(-1),f(n),i?.(null,e);},onClick:()=>{u||(C.current.style.display="flex");},error:t,helperText:o,label:s,placeholder:p,fixedTopLabel:e.length>0,size:l})}),Ge=It;var _e=({options:e,defaultSelectedOptions:i,onSelect:t,error:o,helperText:s,label:p,placeholder:n,noResultsLabel:r,noResultsIcon:l,noResultsDescription:u,noResultsDescriptionLines:c,noResultsAsColumn:f,noResultsButtonOnClick:C,noResultsButtonLabel:x,className:b,onInputChange:g,value:R,loading:a,size:N="md",optionDescriptionLines:L=1,disabled:P})=>{let{inputRef:m,optionsListRef:M,setFilteredOptions:O,setShowChips:d,setInputRect:pe,setPopoverPosition:ue,setCurrentFocus:ce,showChips:z,setOptionsListRect:me,optionsListRect:W,setOptionsListHeight:U}=D(),ee=useRef(false),[q,V]=useState(i??[]),w=useCallback(A=>{V(E=>{let T,K=E.findIndex(Je=>Je.value===A.value);return K===-1?(T=E.concat(A),t?.(A,T),T):(T=E.toSpliced(K,1),t?.(A,T),T)});},[t]),J=useCallback(()=>{V([]),O(e),t?.(null,[]);},[]),v=useCallback(()=>{d(false);},[]),k=useCallback(()=>{d(true);},[]),I=useCallback(()=>{if(!m?.current)return;let A=m.current.getBoundingClientRect();pe(A);let E=W?W.height>F?F:W.height:F,T=window.innerHeight-A.bottom>E,K=A.top>E;ue(T?"bottom":K?"top":"bottom"),U(K?F:window.innerHeight-A.bottom>F?F:window.innerHeight-A.bottom);},[W?.height]),te=useCallback(()=>{let A=e.filter(E=>E.label.toLowerCase().includes(m?.current?.value.toLowerCase()??""));if(O(A),M?.current){let E=M.current.getBoundingClientRect();me(E);}},[e,M?.current]);return useEffect(()=>{O(e);},[e]),a$5(M,()=>{M.current.style.display="none",ce(-1);}),useEffect(()=>{if(m?.current)return I(),m.current.addEventListener("mousedown",I),m.current.addEventListener("input",te),m.current.addEventListener("focusin",v),m.current.addEventListener("focusout",k),window.addEventListener("scroll",I,true),window.addEventListener("resize",I),()=>{m.current?.removeEventListener("mousedown",I),m.current?.removeEventListener("input",I),m.current?.removeEventListener("focusout",k),m.current?.removeEventListener("focusin",v),window.removeEventListener("scroll",I,true),window.removeEventListener("resize",I);}},[I,k,v,te]),useEffect(()=>{R&&(V(R),d(true));},[R]),useEffect(()=>{a||i&&i.length&&!ee.current&&(V(i),ee.current=true,d(true));},[i,a]),jsxs("div",{className:a$2("relative",b),children:[jsx(Ge,{selectedOptions:q,onSelect:t,error:o,helperText:s,label:p,placeholder:n,handleSelect:w,options:e,onInputChange:g,size:N,disabled:P}),z&&jsx(We,{selectedOptions:q,disabled:P,error:o,onCleanSelectedOptions:J,size:N}),jsx($e,{handleSelect:w,selectedOptions:q,noResultsLabel:r,NoResultsIcon:l,optionDescriptionLines:L,noResultsAsColumn:f,noResultsButtonLabel:x,noResultsButtonOnClick:C,noResultsDescription:u,noResultsDescriptionLines:c})]})};var Ii=e=>jsx(Be,{children:jsx(_e,{...e})});var Ni=({children:e,title:i,titleLines:t=1,description:o,descriptionLines:s=1,StartIcon:p,hasDivider:n=false,disabled:r=false,actionButton:l,isSelected:u=false,className:c$1,...f})=>jsxs(y,{hasDescription:!!o,disabled:r,hasDivider:n,isSelected:u,...f,className:c$1,children:[p&&jsx(p,{className:"mr-2 h-4.5 w-4.5 shrink-0 grow-0"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:r}),l&&jsx(Fragment,{children:l.isIcon?jsx(c$3,{...l,className:"ml-4 self-center",variant:"ghost",size:"sm",disabled:r??l.disabled}):jsx(c,{...l,className:"ml-4 self-center",size:"sm",variant:"ghost",disabled:r??l.disabled})})]});var qi=({title:e,description:i="",descriptionLines:t,hasDivider:o=false,disabled:s=false,checked:p,onCheckedChange:n,className:r,chipStatus:l,chipExpandable:u,...c})=>jsxs(y,{hasDescription:!!i,disabled:s,hasDivider:o,...c,className:a$2("pr-6",r),children:[jsx(c$2,{size:"sm",checked:p,onCheckedChange:n,className:"mr-4 self-center",disabled:s}),jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("p",{className:a$2("line-clamp-1 text-sm leading-[130%] break-all",!!i&&"font-medium"),children:e}),u&&jsx("div",{className:"ml-auto flex min-w-0 flex-shrink-0 items-center justify-end",children:jsx(c$4,{...u})}),l&&jsx("div",{className:"ml-4 flex shrink-0 items-center gap-1",children:jsx(d$1,{...l,size:"xs",className:"shrink-0"})})]}),i&&jsx("p",{className:a$2("text-xs leading-[130%]",s?"text-neutral-400":"text-neutral-700",{"line-clamp-1":t===1,"line-clamp-2":t===2,"line-clamp-3":t===3,"line-clamp-4":t===4}),children:i})]})]});var Tt=({children:e,hasDescription:i=false,disabled:t=false,hasDivider:o=false,className:s,isSelected:p,onClick:n,...r})=>jsxs(Fragment,{children:[jsx("div",{className:a$2("flex flex-row px-3 py-4 text-neutral-900 transition-colors",i?"py-3":"py-3.5",t?"cursor-not-allowed text-neutral-400":"hover:bg-primary-100 focus:bg-primary-200",p&&"bg-primary-200",s),onClick:l=>{t||n?.(l);},...r,children:e}),o&&jsx(a$1,{})]}),y=Tt;var ke=({children:e,title:i,titleLines:t,description:o="",descriptionLines:s,startIcon:p,endIcon:n,hasDivider:r=false,disabled:l=false,isSelected:u=false,className:c,...f})=>jsxs(y,{hasDescription:!!o,disabled:l,hasDivider:r,className:c,isSelected:u,...f,children:[p&&be.cloneElement(p,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:l}),n&&be.cloneElement(n,{className:"min-h-4.5 min-w-4.5 self-center ml-4"})]});export{eo as a,ke as b,ao as c,He as d,Ii as e,Ni as f,qi as g};
|
|
1
|
+
import {d}from'./chunk-4MO4OFLX.mjs';import {a as a$5}from'./chunk-KTRSJBA4.mjs';import {a as a$4}from'./chunk-GTPSQXE3.mjs';import {c as c$2}from'./chunk-PTRXL7BY.mjs';import {c as c$4}from'./chunk-GBBE3RHT.mjs';import {d as d$1}from'./chunk-FAMLJ6AJ.mjs';import {a as a$3}from'./chunk-JTO6FE4R.mjs';import {a as a$1}from'./chunk-OG3OUJ6C.mjs';import {c as c$3}from'./chunk-AI4D6AOK.mjs';import {c}from'./chunk-JWB3TN2C.mjs';import {a}from'./chunk-JEYTNPAV.mjs';import {c as c$1,h}from'./chunk-5VHBHGBZ.mjs';import {a as a$2}from'./chunk-XJD5SYZJ.mjs';import be,{createContext,useMemo,useCallback,useContext,useRef,useEffect,useState,useId}from'react';import*as Ie from'@radix-ui/react-portal';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var Qe=be.memo(({handleSelect:e,NoResultsIcon:i,noResultsLabel:t,noResultsDescription:o,noResultsDescriptionLines:s,noResultsAsColumn:p,noResultsButtonOnClick:n,optionDescriptionLines:r,noResultsButtonLabel:l,filteredOptions:u,inputRect:c$1,inputRef:f,popoverPosition:C,optionsListRef:x,selectedOption:b,options:g,setFilteredOptions:R})=>jsx(Ie.Root,{asChild:true,children:jsxs("div",{ref:x,className:"elevation-8 pointer-events-auto fixed z-50 mb-2 hidden max-h-[336px] w-full flex-col overflow-y-auto rounded-lg bg-neutral-50",style:c$1?{width:`${c$1.width}px`,left:c$1.left,top:C==="bottom"?`${c$1.bottom}px`:void 0,bottom:C==="top"?`${window.innerHeight-c$1.top}px`:void 0}:void 0,children:[u.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(a,{title:t,description:o,Icon:i,iconAsColumn:p,descriptionLines:s}),n&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:a=>{x.current.style.display="none",f.current.value="",R(g),n();},children:l})]})]}),u.map(a=>jsx(ke,{title:a.label,disabled:a.disabled,description:a.description,descriptionLines:r,onClick:()=>e(a),className:a$2(b?.value===a.value&&"bg-primary-200")},a.key??a.value))]})})),Pe=Qe;var Ze=336,eo=({options:e,defaultSelectedOption:i,onSelect:t,onClick:o,onInputChange:s,error:p,helperText:n,label:r,placeholder:l,value:u,size:c="md",optionDescriptionLines:f=1,noResultsLabel:C,noResultsIcon:x,noResultsDescription:b,noResultsDescriptionLines:g,noResultsAsColumn:R,noResultsButtonOnClick:a,noResultsButtonLabel:N,className:L,disabled:P})=>{let[m,M]=useState(i??null),O=useRef(null),d=useRef(null),[pe,ue]=useState(),[ce,z]=useState([]),[me,W]=useState("bottom"),[U,ee]=useState(),q=Ze,V=useCallback(v=>{O.current.style.display="none",d.current.value=v.label,M(v),t?.(v);},[t]),w=useCallback(()=>{if(!d?.current)return;let v=d.current.getBoundingClientRect();ue(v);let k=U?U.height:q,I=window.innerHeight-v.bottom>k,te=v.top>k;W(I?"bottom":te?"top":"bottom");},[U?.height]),J=useCallback(()=>{let v=e.filter(k=>k.label.toLowerCase().includes(d?.current?.value.toLowerCase()??""));if(z(v),O?.current){let k=O.current.getBoundingClientRect();ee(k);}},[e]);return useEffect(()=>{z(e);},[e]),useEffect(()=>{if(!u){M(null),d.current&&(d.current.value="");return}(!d.current?.value||m?.value!==u.value)&&(M(u),d.current.value=u.label);},[u]),a$5(O,()=>{O.current.style.display="none",m&&d.current&&(d.current.value=m.label);}),useEffect(()=>{if(d?.current)return w(),d.current.addEventListener("mousedown",w),d.current.addEventListener("input",J),window.addEventListener("scroll",w,true),window.addEventListener("resize",w),()=>{d.current?.removeEventListener("mousedown",w),d.current?.removeEventListener("input",J),window.removeEventListener("scroll",w,true),window.removeEventListener("resize",w);}},[w,J]),jsxs("div",{className:a$2("relative",L),children:[jsx(a$4,{ref:d,autoComplete:"off",list:"",selectMode:true,onChange:v=>{v.target.value||(M(null),t?.(null)),s?.(v);},onClean:()=>{M(null),z(e),t?.(null);},onClick:v=>{O.current.style.display="flex",o?.(v);},onBlur:()=>{m&&d.current&&(d.current.value=m.label);},label:r,helperText:n,placeholder:l,size:c,error:p,disabled:P}),jsx(Pe,{handleSelect:V,noResultsLabel:C,NoResultsIcon:x,optionDescriptionLines:f,noResultsAsColumn:R,noResultsButtonLabel:N,noResultsButtonOnClick:a,noResultsDescription:b,noResultsDescriptionLines:g,filteredOptions:ce,inputRect:pe,inputRef:d,popoverPosition:me,optionsListRef:O,selectedOption:m,options:e,setFilteredOptions:z})]})};var et=({children:e,title:i,titleLines:t,description:o="",descriptionLines:s,disabled:p=false,className:n,...r})=>jsxs("div",{className:"flex w-full flex-col gap-1",...r,children:[jsx("p",{className:a$2("break-all text-sm leading-[130%]",!!o&&"font-medium"),style:t?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:t}:void 0,children:i}),o&&jsx("p",{className:a$2("text-xs leading-[130%]",p?"text-neutral-400":"text-neutral-700"),style:s?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:s}:void 0,children:o})]}),H=et;var ao=({children:e,title:i,titleLines:t,description:o="",descriptionLines:s,startIcon:p,badgeContent:n,hasDivider:r=false,disabled:l=false,onSelect:u,className:c,...f})=>jsxs(y,{hasDescription:!!o,disabled:l,onClick:u,hasDivider:r,className:a$2(!l&&"cursor-pointer",c),...f,children:[p&&be.cloneElement(p,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:l}),jsxs("div",{className:"ml-4 flex gap-2",children:[n&&jsx(a$3,{content:n,size:"lg",variant:"alert",className:a$2("self-center",l&&"bg-neutral-400")}),jsx(h,{className:"h-4.5 w-4.5 self-center"})]})]});var He=({children:e,title:i,titleLines:t=1,description:o="",descriptionLines:s,startIcon:p,hasDivider:n=false,disabled:r=false,checked:l,onCheckedChange:u,className:c,...f})=>jsxs(y,{hasDescription:!!o,disabled:r,hasDivider:n,...f,className:a$2("pr-6",c),children:[p&&be.cloneElement(p,{className:"shrink-0 w-4.5 h-4.5 mr-2"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:r}),jsx(c$2,{size:"sm",checked:l,onCheckedChange:u,className:"ml-4 self-center",disabled:r})]});var F=336,Se=createContext({inputRef:null,optionsListRef:null,autocompleteId:"",inputRect:void 0,showChips:false,filteredOptions:[],currentFocus:-1,popoverPosition:"bottom",setFilteredOptions:()=>{},setCurrentFocus:()=>{},setShowChips:()=>{},setPopoverPosition:()=>{},setInputRect:()=>{},optionsListHeight:F,setOptionsListHeight:()=>{},optionsListRect:void 0,setOptionsListRect:()=>{}}),D=()=>{let e=useContext(Se);if(e===null)throw new Error("useAutocompleteMultipleContext must be used within a AutocompleteMultipleProvider");return e},Be=({children:e})=>{let i=useRef(null),t=useRef(null),o=useId(),[s,p]=useState(),[n,r]=useState(true),[l,u]=useState([]),[c,f]=useState(-1),[C,x]=useState("bottom"),[b,g]=useState(),[R,a]=useState(F);return jsx(Se.Provider,{value:{optionsListRef:i,inputRef:t,autocompleteId:o,inputRect:s,showChips:n,filteredOptions:l,currentFocus:c,popoverPosition:C,setFilteredOptions:u,setCurrentFocus:f,setShowChips:r,setPopoverPosition:x,setInputRect:p,optionsListHeight:R,optionsListRect:b,setOptionsListRect:g,setOptionsListHeight:a},children:e})};var mt=({option:e,onMountWidth:i,size:t})=>{let o=useRef(null);return useEffect(()=>{o.current&&i?.(o.current.clientWidth);},[]),jsx(d,{type:"fill",variant:"standard",ref:o,className:"shrink-0",size:t==="md"?"xs":"sm",hasCloseIcon:false,children:e.label})},ze=mt;var ht=150,bt=be.memo(({selectedOptions:e,error:i,onCleanSelectedOptions:t,disabled:o,size:s})=>{let{autocompleteId:p,inputRect:n,inputRef:r,optionsListRef:l}=D(),u=be.useRef(null),[c,f]=be.useState(new Map),C=useMemo(()=>{if(!n?.width)return [];let b=0,g=n.width-ht,R=0;for(let a=0;a<e.length&&(R+=c.get(a)??0,!(R>g));a++)b++;return e.slice(0,b)},[n?.width,e,c]),x=useCallback(()=>{o||(r?.current?.focus(),l.current.style.display="flex");},[o]);return jsxs("div",{onClick:x,className:a$2("absolute top-0 z-30 flex w-full cursor-pointer flex-nowrap items-center gap-2 pl-3 pr-12",o&&"cursor-not-allowed"),style:{maxWidth:n?.width?n?.width:void 0,height:n?.height?n?.height:void 0},children:[jsx("div",{className:"flex flex-1 gap-1 overflow-hidden",ref:u,children:C.map((b,g)=>jsx(ze,{option:b,onMountWidth:R=>f(a=>new Map(a).set(g,R)),size:s},`chip-input-${p}-${b.value}`))}),e.length>C.length&&jsx("span",{className:"text-base",children:"..."}),e.length>0&&!i&&jsx(a$3,{content:String(e.length),size:s}),i&&e.length>0&&jsx(c$1,{className:"h-6 w-6 text-error-700",onClick:b=>{b.stopPropagation(),t();}})]})}),We=bt;var vt=be.memo(({option:e,index:i,onPressOption:t,isSelected:o,optionDescriptionLines:s})=>{let{currentFocus:p,inputRef:n}=D();return jsx(He,{title:e.label,checked:o,disabled:e.disabled,className:p===i?"bg-primary-200":void 0,onMouseDown:r=>{e.disabled||(n?.current?.value&&r.preventDefault(),t?.(e,r));},description:e.description,descriptionLines:s})}),Le=vt;var Mt=be.memo(({selectedOptions:e,handleSelect:i,NoResultsIcon:t,noResultsLabel:o,noResultsDescription:s,noResultsDescriptionLines:p,noResultsAsColumn:n,noResultsButtonOnClick:r,optionDescriptionLines:l,noResultsButtonLabel:u})=>{let{popoverPosition:c$1,optionsListRef:f,filteredOptions:C,inputRect:x,autocompleteId:b,inputRef:g,optionsListHeight:R}=D(),a$2=useCallback(L=>e.some(P=>P.value===L.value),[e]),N=useMemo(()=>e.filter(L=>L.label.toLowerCase().includes(g?.current?.value.toLowerCase()??"")),[e,g?.current?.value]);return jsx(Ie.Root,{asChild:true,children:jsxs("div",{ref:f,className:"elevation-8 pointer-events-auto fixed z-50 mb-2 hidden w-full flex-col overflow-y-auto rounded-lg bg-neutral-50",style:x?{width:`${x.width}px`,left:x.left,top:c$1==="bottom"?`${x.bottom}px`:void 0,bottom:c$1==="top"?`${window.innerHeight-x.top}px`:void 0,maxHeight:R+"px"}:void 0,children:[C.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(a,{title:o,description:s,Icon:t,iconAsColumn:n,descriptionLines:p}),r&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:L=>{f.current.style.display="none",g.current.value="",r();},children:u})]})]}),N.map((L,P)=>jsx(Le,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$2(L),optionDescriptionLines:l},`autocomplete-option-${b}-${L.key??L.value}`)),C.map((L,P)=>!e.some(m=>m.value===L.value)&&jsx(Le,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$2(L),optionDescriptionLines:l},`autocomplete-option-${b}-${L.key??L.value}`))]})})}),$e=Mt;var It=be.memo(({selectedOptions:e,onSelect:i,error:t,helperText:o,label:s,placeholder:p,options:n,onInputChange:r,size:l,disabled:u})=>{let{setCurrentFocus:c,setFilteredOptions:f,optionsListRef:C,inputRef:x}=D();return jsx(a$4,{ref:x,autoComplete:"off",list:"",disabled:u,selectMode:true,onChange:b=>{c(-1),r?.(b.target.value);},onClean:()=>{c(-1),f(n),i?.(null,e);},onClick:()=>{u||(C.current.style.display="flex");},error:t,helperText:o,label:s,placeholder:p,fixedTopLabel:e.length>0,size:l})}),Ge=It;var _e=({options:e,defaultSelectedOptions:i,onSelect:t,error:o,helperText:s,label:p,placeholder:n,noResultsLabel:r,noResultsIcon:l,noResultsDescription:u,noResultsDescriptionLines:c,noResultsAsColumn:f,noResultsButtonOnClick:C,noResultsButtonLabel:x,className:b,onInputChange:g,value:R,loading:a,size:N="md",optionDescriptionLines:L=1,disabled:P})=>{let{inputRef:m,optionsListRef:M,setFilteredOptions:O,setShowChips:d,setInputRect:pe,setPopoverPosition:ue,setCurrentFocus:ce,showChips:z,setOptionsListRect:me,optionsListRect:W,setOptionsListHeight:U}=D(),ee=useRef(false),[q,V]=useState(i??[]),w=useCallback(A=>{V(E=>{let T,K=E.findIndex(Je=>Je.value===A.value);return K===-1?(T=E.concat(A),t?.(A,T),T):(T=E.toSpliced(K,1),t?.(A,T),T)});},[t]),J=useCallback(()=>{V([]),O(e),t?.(null,[]);},[]),v=useCallback(()=>{d(false);},[]),k=useCallback(()=>{d(true);},[]),I=useCallback(()=>{if(!m?.current)return;let A=m.current.getBoundingClientRect();pe(A);let E=W?W.height>F?F:W.height:F,T=window.innerHeight-A.bottom>E,K=A.top>E;ue(T?"bottom":K?"top":"bottom"),U(K?F:window.innerHeight-A.bottom>F?F:window.innerHeight-A.bottom);},[W?.height]),te=useCallback(()=>{let A=e.filter(E=>E.label.toLowerCase().includes(m?.current?.value.toLowerCase()??""));if(O(A),M?.current){let E=M.current.getBoundingClientRect();me(E);}},[e,M?.current]);return useEffect(()=>{O(e);},[e]),a$5(M,()=>{M.current.style.display="none",ce(-1);}),useEffect(()=>{if(m?.current)return I(),m.current.addEventListener("mousedown",I),m.current.addEventListener("input",te),m.current.addEventListener("focusin",v),m.current.addEventListener("focusout",k),window.addEventListener("scroll",I,true),window.addEventListener("resize",I),()=>{m.current?.removeEventListener("mousedown",I),m.current?.removeEventListener("input",I),m.current?.removeEventListener("focusout",k),m.current?.removeEventListener("focusin",v),window.removeEventListener("scroll",I,true),window.removeEventListener("resize",I);}},[I,k,v,te]),useEffect(()=>{R&&(V(R),d(true));},[R]),useEffect(()=>{a||i&&i.length&&!ee.current&&(V(i),ee.current=true,d(true));},[i,a]),jsxs("div",{className:a$2("relative",b),children:[jsx(Ge,{selectedOptions:q,onSelect:t,error:o,helperText:s,label:p,placeholder:n,handleSelect:w,options:e,onInputChange:g,size:N,disabled:P}),z&&jsx(We,{selectedOptions:q,disabled:P,error:o,onCleanSelectedOptions:J,size:N}),jsx($e,{handleSelect:w,selectedOptions:q,noResultsLabel:r,NoResultsIcon:l,optionDescriptionLines:L,noResultsAsColumn:f,noResultsButtonLabel:x,noResultsButtonOnClick:C,noResultsDescription:u,noResultsDescriptionLines:c})]})};var Ii=e=>jsx(Be,{children:jsx(_e,{...e})});var Ni=({children:e,title:i,titleLines:t=1,description:o,descriptionLines:s=1,StartIcon:p,hasDivider:n=false,disabled:r=false,actionButton:l,isSelected:u=false,className:c$1,...f})=>jsxs(y,{hasDescription:!!o,disabled:r,hasDivider:n,isSelected:u,...f,className:c$1,children:[p&&jsx(p,{className:"mr-2 h-4.5 w-4.5 shrink-0 grow-0"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:r}),l&&jsx(Fragment,{children:l.isIcon?jsx(c$3,{...l,className:"ml-4 self-center",variant:"ghost",size:"sm",disabled:r??l.disabled}):jsx(c,{...l,className:"ml-4 self-center",size:"sm",variant:"ghost",disabled:r??l.disabled})})]});var qi=({title:e,description:i="",descriptionLines:t,hasDivider:o=false,disabled:s=false,checked:p,onCheckedChange:n,className:r,chipStatus:l,chipExpandable:u,...c})=>jsxs(y,{hasDescription:!!i,disabled:s,hasDivider:o,...c,className:a$2("pr-6",r),children:[jsx(c$2,{size:"sm",checked:p,onCheckedChange:n,className:"mr-4 self-center",disabled:s}),jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsx("p",{className:a$2("line-clamp-1 text-sm leading-[130%] break-all",!!i&&"font-medium"),children:e}),u&&jsx("div",{className:"ml-auto flex min-w-0 flex-shrink-0 items-center justify-end",children:jsx(c$4,{...u})}),l&&jsx("div",{className:"ml-4 flex shrink-0 items-center gap-1",children:jsx(d$1,{...l,size:"xs",className:"shrink-0"})})]}),i&&jsx("p",{className:a$2("text-xs leading-[130%]",s?"text-neutral-400":"text-neutral-700",{"line-clamp-1":t===1,"line-clamp-2":t===2,"line-clamp-3":t===3,"line-clamp-4":t===4}),children:i})]})]});var Tt=({children:e,hasDescription:i=false,disabled:t=false,hasDivider:o=false,className:s,isSelected:p,onClick:n,...r})=>jsxs(Fragment,{children:[jsx("div",{className:a$2("flex flex-row px-3 py-4 text-neutral-900 transition-colors",i?"py-3":"py-3.5",t?"cursor-not-allowed text-neutral-400":"hover:bg-primary-100 focus:bg-primary-200",p&&"bg-primary-200",s),onClick:l=>{t||n?.(l);},...r,children:e}),o&&jsx(a$1,{})]}),y=Tt;var ke=({children:e,title:i,titleLines:t,description:o="",descriptionLines:s,startIcon:p,endIcon:n,hasDivider:r=false,disabled:l=false,isSelected:u=false,className:c,...f})=>jsxs(y,{hasDescription:!!o,disabled:l,hasDivider:r,className:c,isSelected:u,...f,children:[p&&be.cloneElement(p,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(H,{title:i,titleLines:t,description:o,descriptionLines:s,disabled:l}),n&&be.cloneElement(n,{className:"min-h-4.5 min-w-4.5 self-center ml-4"})]});export{eo as a,ke as b,ao as c,He as d,Ii as e,Ni as f,qi as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c as c$1}from'./chunk-PTRXL7BY.mjs';import {c as c$2}from'./chunk-GBBE3RHT.mjs';import {
|
|
1
|
+
import {c as c$1}from'./chunk-PTRXL7BY.mjs';import {c as c$2}from'./chunk-GBBE3RHT.mjs';import {d}from'./chunk-FAMLJ6AJ.mjs';import {c as c$3}from'./chunk-AI4D6AOK.mjs';import {c as c$4}from'./chunk-JWB3TN2C.mjs';import {a as a$1}from'./chunk-DHWOGUID.mjs';import {a as a$2}from'./chunk-GHVRYH3R.mjs';import {e,s,t}from'./chunk-5VHBHGBZ.mjs';import {a}from'./chunk-XJD5SYZJ.mjs';import {useCallback}from'react';import {tv}from'tailwind-variants';import {useCollapsibleContext,Collapsible}from'@ark-ui/react/collapsible';import {getDefaultOptions}from'date-fns';import {jsxs,jsx}from'react/jsx-runtime';var c=tv({slots:{root:"ring-expandable-card-border group/expandable-card flex h-fit flex-col rounded-lg ring transition-all duration-200 ease-in-out ring-inset",header:"flex pt-3 pr-1 pb-2 pl-3",headerLabel:"text-sm leading-[130%] font-semibold empty:hidden",complementaryText:"line-clamp-1 text-xs leading-[130%] text-neutral-900",subtitle:"line-clamp-1 text-xs leading-[130%] text-neutral-700",content:"data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up border-expandable-card-border overflow-hidden group-data-[state=open]/expandable-card:border-t",contentInner:"px-3 pt-4 pb-6",fixedContent:"border-expandable-card-border border-t px-3 pt-6 pb-4"},variants:{background:{white:{root:"bg-neutral-50"},gray:{root:"bg-neutral-100"}}},defaultVariants:{background:"white"}}),j=(a,e)=>e?.startsWith("es")?a?"Contraer":"Expandir":e?.startsWith("pt")?a?"Recolher":"Expandir":a?"Collapse":"Expand",bt=({headerLabel:a$3,complementaryText:e$1,subtitle:o,headerTooltip:n,className:m,action:i,chipStatus:l,badgeExpandable:p,chipExpandable:h,Icon:f,iconButtons:H,checkbox:b,...k})=>{let{header:w,headerLabel:D,complementaryText:M,subtitle:O}=c(),v=useCollapsibleContext(),{locale:F}=getDefaultOptions(),A=j(v.open,F?.code);return jsxs("div",{...k,className:a(w(),m),children:[b&&jsx(c$1,{...b,className:a("m-1",b.className),size:"sm"}),jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[jsxs("div",{className:"flex items-center justify-between gap-3",children:[jsxs("div",{className:"flex items-center gap-2",children:[f&&jsx(f,{className:"h-3.5 w-3.5 shrink-0"}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("b",{className:D(),children:a$3}),e$1&&jsx("span",{className:M(),children:e$1}),n&&jsx(a$1,{content:n,contentClassName:"font-normal normal-case",children:jsx(e,{className:"h-3.5 w-3.5 shrink-0"})})]})]}),jsxs("div",{className:"flex items-center gap-2",children:[l&&jsx(d,{...l,size:"xs",type:"light"}),h&&jsx(c$2,{...h,type:"light"}),p&&jsx(a$2,{...p,size:"md"}),H?.map((d,x)=>{let{tooltipContent:E,...R}=d;return jsx(a$1,{content:E,disabled:!E,children:jsx(c$3,{...R,variant:"standard",size:"xs"})},x)}),i&&(()=>{let{tooltipContent:d,...x}=i;return jsx(a$1,{content:d,disabled:!d,children:jsx(c$4,{...x,size:"xs",variant:"standard"})})})(),jsx(a$1,{content:A,asChild:true,children:jsx(Collapsible.Trigger,{asChild:true,children:jsx(c$3,{Icon:v.open?s:t,variant:"standard",size:"xs"})})})]})]}),o&&jsx("p",{className:O(),children:o})]})]})},xt=({className:a,...e})=>{let{contentInner:o,content:n}=c();return jsx(Collapsible.Content,{className:n(),children:jsx("div",{...e,className:o({className:a})})})},Ct=({className:a,...e})=>{let{fixedContent:o}=c();return jsx("div",{...e,className:o({className:a})})},ut=({className:a,onOpenChange:e,children:o,background:n="white",...m})=>{let{root:i}=c({background:n}),l=useCallback(p=>{e?.(p);},[e]);return jsx(Collapsible.Root,{onOpenChange:l,className:i({className:a}),...m,children:o})};export{bt as a,xt as b,Ct as c,ut as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-DHWOGUID.mjs';import {a as a$2}from'./chunk-GHVRYH3R.mjs';import {q,d,g}from'./chunk-5VHBHGBZ.mjs';import {a}from'./chunk-XJD5SYZJ.mjs';import {useListCollection,useCombobox,Combobox,useComboboxContext}from'@ark-ui/react/combobox';import {useFilter}from'@ark-ui/react/locale';import {Portal}from'@ark-ui/react/portal';import {useRef,useCallback,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var X=({title:n,titleLines:r=2,description:a$1,descriptionLines:p=1,Icon:u,iconAsColumn:s=true,className:c,...m})=>jsxs("div",{className:a("flex gap-2 py-4 pl-4 pr-6",s&&"flex-col items-center gap-1",!s&&!a$1&&"items-center"),...m,children:[u&&jsx(u,{className:a("shrink-0 text-neutral-300"),size:24}),jsxs("div",{className:a("flex flex-col gap-1",s&&"text-center"),children:[jsx("p",{className:a("leading-[130%] text-neutral-500",!!a$1&&"font-medium"),style:r?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:r}:void 0,children:n}),a$1&&jsx("p",{className:"text-sm leading-[130%] text-neutral-500",style:p?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:p}:void 0,children:a$1})]})]}),V=X;function $(){let n=useComboboxContext(),r=useRef(false);return n.value.length&&n.collection.size&&!r.current&&(n.syncSelectedItems(),r.current=true),null}var xe=n=>{let{label:r,error:a$3,required:p,tooltip:u,readOnly:s,options:c,onInputValueChange:m,onSelect:d$1,defaultValue:C,helperText:k,noResultsTitle:A,noResultsDescription:E,noResultsIcon:D,noResultsTitleLines:M,noResultsDescriptionLines:z,value:h,className:B,...H}=n,F=Object.getOwnPropertyNames(n),b=useRef(null),{contains:G}=useFilter({sensitivity:"base"}),{collection:g$1,filter:x,set:W}=useListCollection({initialItems:[],itemToString:t=>t.label,itemToValue:t=>String(t.value),filter:G}),j=useCallback(t=>{let T=c.find(K=>String(K.value)===t.itemValue);T&&d$1?.(T);},[d$1,c]),w=useCallback(t=>{x(t.inputValue),t.reason!==void 0&&m?.(t.inputValue??"");},[x,m]),q$1=useCombobox({collection:g$1,defaultValue:C?[String(C)]:void 0,placeholder:n.placeholder,inputValue:n.inputValue,onInputValueChange:w,value:F.includes("value")?h?[String(h)]:[]:void 0,onSelect:j,inputBehavior:"autocomplete",openOnClick:true,...H}),U=useCallback(()=>{d$1?.(null),w?.({inputValue:"",reason:"clear-trigger"});},[d$1,m]);return useEffect(()=>{W(c);},[c]),useEffect(()=>{b.current&&b.current.value===""&&x("");},[x,b.current?.value]),jsxs(Combobox.RootProvider,{value:q$1,"data-error":a$3,className:a("group flex flex-col",B),children:[jsxs(Combobox.Label,{className:"font-inter flex items-center text-xs leading-[133.33%] font-medium text-neutral-700 data-[disabled]:text-neutral-400",children:[p?jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-red-500",children:"*"}),r]}):r,u&&jsx(a$1,{content:u,className:"ml-2",children:jsx(q,{className:"size-3.5"})})]}),jsx($,{}),jsxs(Combobox.Control,{className:a("group/control mt-1.125 data-[focus]:ring-primary-800 group-data-[error=true]:ring-error-500 relative flex h-10 w-full items-center justify-between gap-2 overflow-hidden rounded-lg bg-neutral-50 px-3 ring ring-neutral-500 transition-shadow group-data-[error=true]:ring-2 group-data-[readonly]:bg-neutral-100 group-data-[readonly]:ring-neutral-300 has-focus:ring-2 data-[disabled]:ring-neutral-400",s&&"pointer-events-none"),children:[jsx(Combobox.Input,{className:a("font-inter flex w-full justify-between text-left text-sm text-neutral-900 outline-0 group-data-[disabled]/control:text-neutral-400 disabled:cursor-not-allowed data-[placeholder-shown]:text-neutral-500",s&&"pointer-events-none",a$3&&"pr-16"),ref:b}),a$3&&jsx(q,{className:"text-error-500 size-4.5 shrink-0"}),!s&&jsx(Combobox.ClearTrigger,{className:"cursor-pointer",onClick:U,children:jsx(d,{className:"size-4.5"})}),jsx(Combobox.Trigger,{className:"cursor-pointer group-data-[disabled]/control:cursor-not-allowed group-data-[disabled]/control:text-neutral-400",children:jsx(g,{className:"size-4.5 transition-transform will-change-transform group-data-[state=open]/control:rotate-180"})})]}),jsx("p",{className:"font-inter text-2xs group-data-[error=true]:text-error-500 mt-1 leading-[133.33%] font-normal text-neutral-700 peer-data-[disabled]:text-neutral-400 empty:hidden",children:k}),jsx(Portal,{children:jsx(Combobox.Positioner,{className:"!z-10000",children:jsx(Combobox.Content,{className:"elevation-9 max-h-67.5 min-w-27.5 overflow-auto rounded-lg bg-neutral-50",children:jsxs(Combobox.ItemGroup,{children:[g$1.items.length>0&&g$1.items.map(t=>jsx(Combobox.Item,{item:t,className:"font-inter data-[highlighted]:bg-primary-100 block w-full cursor-pointer p-3 data-[disabled]:cursor-not-allowed data-[disabled]:text-neutral-400",children:jsx(Combobox.ItemText,{className:"flex w-full min-w-0 flex-col gap-1",asChild:true,children:jsxs("div",{className:"w-full min-w-0",children:[jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsx("p",{className:"min-w-0 flex-1 truncate text-sm leading-[130%] font-medium",children:t.label}),t.badgeExpandable&&jsx("div",{className:"flex shrink-0 justify-end overflow-visible",children:jsx(a$2,{size:"sm",...t.badgeExpandable})})]}),t.description&&jsx("p",{className:"text-xs leading-[130%]",children:t.description})]})})},t.value)),g$1.items.length===0&&jsx(V,{title:A,description:E,Icon:D,descriptionLines:z,titleLines:M})]})})})})]})};export{V as a,xe as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-XJD5SYZJ.mjs';import {Switch}from'@ark-ui/react/switch';import {useState,useEffect}from'react';import {Loader2}from'lucide-react';import {jsxs,jsx}from'react/jsx-runtime';var V=["sm","md"],E=["base","status"],H=["primary","secondary"],j=({size:a$1="md",type:t="base",variant:d="primary",className:l,disabled:b,onCheckedChange:k,label:e,icon:m,loading:i=false,checked:s,defaultChecked:y,...v})=>{let o=s!==void 0,[x,u]=useState(s??y??false);useEffect(()=>{o&&u(s);},[s,o]);let h=i?Loader2:m,f=b||i,w=p=>{o||u(p.checked),k?.(p.checked);};return jsxs(Switch.Root,{className:a("relative flex",l),disabled:f,onCheckedChange:w,checked:x,...v,readOnly:false,"aria-readonly":false,children:[jsxs(Switch.Control,{className:a("group relative inline-flex shrink-0 cursor-pointer items-center rounded-full","transition-all ring-inset",d==="secondary"&&["ring"],t==="base"&&d==="primary"&&["data-[state=checked]:bg-primary-600","data-[state=unchecked]:bg-primary-200","data-[state=unchecked]:ring-primary-400","data-[state=checked]:hover:not-data-disabled:bg-primary-800","data-[state=unchecked]:hover:not-data-disabled:bg-primary-300","data-[state=checked]:active:not-data-disabled:bg-primary-600","data-[state=checked]:active:not-data-disabled:ring-primary-800","data-[state=unchecked]:active:not-data-disabled:bg-primary-300","data-[state=unchecked]:active:not-data-disabled:ring-primary-700","data-disabled:ring-0!"],t==="base"&&d==="secondary"&&["data-[state=checked]:bg-primary-400","data-[state=checked]:ring-primary-600","data-[state=unchecked]:bg-primary-200","data-[state=unchecked]:ring-primary-500","data-[state=checked]:hover:not-data-disabled:bg-primary-500","data-[state=checked]:hover:not-data-disabled:ring-primary-600","data-[state=unchecked]:hover:not-data-disabled:bg-primary-300","active:not-data-disabled:ring-primary-800","data-[state=unchecked]:active:not-data-disabled:bg-primary-300","data-disabled:ring-neutral-400!"],t==="status"&&d==="primary"&&["data-[state=checked]:bg-success-300","data-[state=unchecked]:bg-neutral-400","data-[state=unchecked]:ring-neutral-600","data-[state=checked]:hover:not-data-disabled:bg-success-500","data-[state=unchecked]:hover:not-data-disabled:bg-neutral-500","data-[state=checked]:active:not-data-disabled:ring-success-800","data-[state=unchecked]:active:not-data-disabled:ring-neutral-800","data-disabled:ring-0!"],t==="status"&&d==="secondary"&&["data-[state=checked]:bg-success-100","data-[state=checked]:ring-success-600","data-[state=unchecked]:bg-neutral-300","data-[state=unchecked]:ring-neutral-600","data-[state=checked]:hover:not-data-disabled:bg-success-300","data-[state=unchecked]:hover:not-data-disabled:bg-neutral-400","data-[state=checked]:active:not-data-disabled:ring-success-800","data-[state=unchecked]:active:not-data-disabled:ring-neutral-800","data-disabled:ring-neutral-400!"],"data-[state=unchecked]:not-active:ring-1","active:not-data-disabled:ring-4","data-disabled:cursor-not-allowed","data-disabled:bg-neutral-300!",!e&&a$1==="sm"&&"h-6 w-10",!e&&a$1==="md"&&"h-8 w-14",e&&a$1==="sm"&&["h-6 gap-2","data-[state=checked]:pl-2 data-[state=checked]:pr-1","data-[state=unchecked]:pl-1.5 data-[state=unchecked]:pr-2.5"],e&&a$1==="md"&&["h-8 gap-2","data-[state=checked]:pl-2 data-[state=checked]:pr-1","data-[state=unchecked]:pl-2 data-[state=unchecked]:pr-3"]),children:[e&&jsx("span",{className:a("leading-[133%] font-medium transition-all select-none",t==="base"&&d==="primary"&&["group-data-[state=checked]:not-group-data-disabled:text-neutral-50","group-data-[state=unchecked]:not-group-data-disabled:text-primary-700"],t==="base"&&d==="secondary"&&["group-data-[state=unchecked]:not-group-data-disabled:text-primary-600","group-data-[state=checked]:not-group-data-disabled:text-primary-800"],t==="status"&&["group-data-[state=checked]:not-group-data-disabled:text-success-800","group-data-[state=unchecked]:not-group-data-disabled:text-neutral-800"],"group-data-disabled:text-neutral-600","group-data-[state=checked]:order-1","group-data-[state=unchecked]:order-2",a$1==="sm"&&"text-xs",a$1==="md"&&"text-sm"),children:e}),jsx(Switch.Thumb,{className:a("flex items-center justify-center rounded-full bg-neutral-50 transition-all shrink-0","group-hover:not-group-data-disabled:ring-8","group-active:not-group-data-disabled:ring-7",t==="base"&&["group-hover:not-group-data-disabled:ring-transparent-primary-400-50","group-active:not-group-data-disabled:ring-transparent-primary-400-50"],t==="status"&&["group-data-[state=checked]:group-hover:not-group-data-disabled:ring-transparent-primary-400-50","group-data-[state=unchecked]:group-hover:not-group-data-disabled:ring-transparent-neutral-800-20","group-data-[state=checked]:group-active:not-group-data-disabled:ring-transparent-primary-400-50","group-data-[state=unchecked]:group-active:not-group-data-disabled:ring-transparent-neutral-800-20"],"group-data-disabled:ring-0!",a$1==="sm"&&"size-4 data-[state=unchecked]:size-3",a$1==="md"&&"size-6 data-[state=unchecked]:size-4",a$1==="sm"&&["group-active:data-[state=checked]:not-group-data-disabled:scale-[1.125]","group-active:data-[state=unchecked]:not-group-data-disabled:scale-[1.5]"],a$1==="md"&&["group-active:data-[state=checked]:not-group-data-disabled:scale-[1.08]","group-active:data-[state=unchecked]:not-group-data-disabled:scale-[1.625]"],!e&&"absolute",!e&&a$1==="sm"&&"data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-1.5",!e&&a$1==="md"&&"data-[state=checked]:translate-x-7 data-[state=unchecked]:translate-x-2",e&&"group-data-[state=checked]:order-2",e&&"group-data-[state=unchecked]:order-1"),children:h&&jsx(h,{className:a("transition-colors",i&&"animate-spin",a$1==="sm"&&"size-3 group-data-[state=unchecked]:size-2.5",a$1==="md"&&"size-3.5",t==="base"&&["group-data-[state=checked]:not-group-data-disabled:text-primary-600","group-data-[state=unchecked]:not-group-data-disabled:text-primary-500"],t==="status"&&["group-data-[state=checked]:not-group-data-disabled:text-success-700","group-data-[state=unchecked]:not-group-data-disabled:text-neutral-700"],"group-data-disabled:text-neutral-400")})})]}),jsx(Switch.HiddenInput,{})]})};export{V as a,E as b,H as c,j as d};
|
|
@@ -2,11 +2,14 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { UseComboboxProps } from '@ark-ui/react/combobox';
|
|
3
3
|
import { HTMLAttributes } from 'react';
|
|
4
4
|
import { LucideIcon } from 'lucide-react';
|
|
5
|
+
import { BadgeExpandableProps } from './badge-expandable.mjs';
|
|
6
|
+
import 'tailwind-variants';
|
|
5
7
|
|
|
6
8
|
type AutocompleteNewOption<T extends string | number = string> = {
|
|
7
9
|
label: string;
|
|
8
10
|
description?: string;
|
|
9
11
|
value: T;
|
|
12
|
+
badgeExpandable?: Omit<BadgeExpandableProps, "size">;
|
|
10
13
|
};
|
|
11
14
|
type AutocompleteNewProps<T extends string | number = string> = Omit<UseComboboxProps<AutocompleteNewOption<T>>, "collection" | "onInputValueChange" | "defaultValue" | "onSelect" | "multiple" | "value"> & {
|
|
12
15
|
label: string;
|
|
@@ -2,11 +2,14 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { UseComboboxProps } from '@ark-ui/react/combobox';
|
|
3
3
|
import { HTMLAttributes } from 'react';
|
|
4
4
|
import { LucideIcon } from 'lucide-react';
|
|
5
|
+
import { BadgeExpandableProps } from './badge-expandable.js';
|
|
6
|
+
import 'tailwind-variants';
|
|
5
7
|
|
|
6
8
|
type AutocompleteNewOption<T extends string | number = string> = {
|
|
7
9
|
label: string;
|
|
8
10
|
description?: string;
|
|
9
11
|
value: T;
|
|
12
|
+
badgeExpandable?: Omit<BadgeExpandableProps, "size">;
|
|
10
13
|
};
|
|
11
14
|
type AutocompleteNewProps<T extends string | number = string> = Omit<UseComboboxProps<AutocompleteNewOption<T>>, "collection" | "onInputValueChange" | "defaultValue" | "onSelect" | "multiple" | "value"> & {
|
|
12
15
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var combobox=require('@ark-ui/react/combobox'),locale=require('@ark-ui/react/locale'),portal=require('@ark-ui/react/portal'),lucideReact=require('lucide-react'),tooltip=require('@ark-ui/react/tooltip'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime'),react=require('react');var S=lucideReact.X;var V=lucideReact.ChevronDown;var w=lucideReact.CircleAlert;function n(...o){return tailwindMerge.twMerge(clsx.clsx(o))}var D=({closeDelay:o=500,closeOnClick:a=true,closeOnEscape:l=true,closeOnPointerDown:u=true,closeOnScroll:s=true,interactive:i=true,lazyMount:c=false,openDelay:p=700,unmountOnExit:m=false,content:x,children:f,asChild:b=true,contentClassName:v,className:N,...I})=>jsxRuntime.jsxs(tooltip.TooltipRoot,{closeDelay:o,closeOnClick:a,closeOnEscape:l,closeOnPointerDown:u,closeOnScroll:s,interactive:i,lazyMount:c,openDelay:p,unmountOnExit:m,...I,children:[jsxRuntime.jsx(tooltip.TooltipTrigger,{asChild:b,className:n("cursor-inherit text-left",N),children:b?jsxRuntime.jsx("div",{children:f}):f}),jsxRuntime.jsx(tooltip.TooltipPositioner,{children:jsxRuntime.jsxs(tooltip.TooltipContent,{className:n("font-inter z-30 rounded-lg bg-neutral-900 px-3 py-2 text-center text-sm leading-[142.86%] whitespace-break-spaces text-neutral-50","data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95","data-[placement=left]:text-right data-[placement=left-end]:text-right data-[placement=left-start]:text-right","data-[placement=left]:origin-right data-[placement=left-end]:origin-bottom-right data-[placement=left-start]:origin-top-right","data-[placement=right-end]:right-right data-[placement=right]:text-right data-[placement=right-start]:text-right","data-[placement=right]:origin-left data-[placement=right-end]:origin-bottom-left data-[placement=right-start]:origin-top-left","data-[placement=top]:origin-bottom data-[placement=top-end]:origin-bottom-right data-[placement=top-start]:origin-bottom-left","data-[placement=bottom]:origin-top data-[placement=bottom-end]:origin-top-right data-[placement=bottom-start]:origin-top-left","data-[placement=left]:text-right data-[placement=left-end]:text-right data-[placement=left-start]:text-right","data-[placement=right]:text-left data-[placement=right-end]:text-left data-[placement=right-start]:text-left",v),children:[jsxRuntime.jsx(tooltip.TooltipArrow,{children:jsxRuntime.jsx(tooltip.TooltipArrowTip,{})}),x]})})]});var ae=({title:o,titleLines:a=2,description:l,descriptionLines:u=1,Icon:s,iconAsColumn:i=true,className:c,...p})=>jsxRuntime.jsxs("div",{className:n("flex gap-2 py-4 pl-4 pr-6",i&&"flex-col items-center gap-1",!i&&!l&&"items-center"),...p,children:[s&&jsxRuntime.jsx(s,{className:n("shrink-0 text-neutral-300"),size:24}),jsxRuntime.jsxs("div",{className:n("flex flex-col gap-1",i&&"text-center"),children:[jsxRuntime.jsx("p",{className:n("leading-[130%] text-neutral-500",!!l&&"font-medium"),style:a?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:a}:void 0,children:o}),l&&jsxRuntime.jsx("p",{className:"text-sm leading-[130%] text-neutral-500",style:u?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:u}:void 0,children:l})]})]}),M=ae;function ue(){let o=combobox.useComboboxContext(),a=react.useRef(false);return o.value.length&&o.collection.size&&!a.current&&(o.syncSelectedItems(),a.current=true),null}var nt=o=>{let{label:a,error:l,required:u,tooltip:s,readOnly:i,options:c,onInputValueChange:p,onSelect:m,defaultValue:x,helperText:f,noResultsTitle:b,noResultsDescription:v,noResultsIcon:N,noResultsTitleLines:I,noResultsDescriptionLines:H,value:P,className:F,...U}=o,X=Object.getOwnPropertyNames(o),C=react.useRef(null),{contains:G}=locale.useFilter({sensitivity:"base"}),{collection:h,filter:T,set:W}=combobox.useListCollection({initialItems:[],itemToString:t=>t.label,itemToValue:t=>String(t.value),filter:G}),B=react.useCallback(t=>{let k=c.find(j=>String(j.value)===t.itemValue);k&&m?.(k);},[m,c]),L=react.useCallback(t=>{T(t.inputValue),t.reason!==void 0&&p?.(t.inputValue??"");},[T,p]),q=combobox.useCombobox({collection:h,defaultValue:x?[String(x)]:void 0,placeholder:o.placeholder,inputValue:o.inputValue,onInputValueChange:L,value:X.includes("value")?P?[String(P)]:[]:void 0,onSelect:B,inputBehavior:"autocomplete",openOnClick:true,...U}),K=react.useCallback(()=>{m?.(null),L?.({inputValue:"",reason:"clear-trigger"});},[m,p]);return react.useEffect(()=>{W(c);},[c]),react.useEffect(()=>{C.current&&C.current.value===""&&T("");},[T,C.current?.value]),jsxRuntime.jsxs(combobox.Combobox.RootProvider,{value:q,"data-error":l,className:n("group flex flex-col",F),children:[jsxRuntime.jsxs(combobox.Combobox.Label,{className:"font-inter flex items-center text-xs leading-[133.33%] font-medium text-neutral-700 data-[disabled]:text-neutral-400",children:[u?jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"text-red-500",children:"*"}),a]}):a,s&&jsxRuntime.jsx(D,{content:s,className:"ml-2",children:jsxRuntime.jsx(w,{className:"size-3.5"})})]}),jsxRuntime.jsx(ue,{}),jsxRuntime.jsxs(combobox.Combobox.Control,{className:n("group/control mt-1.125 data-[focus]:ring-primary-800 group-data-[error=true]:ring-error-500 relative flex h-10 w-full items-center justify-between gap-2 overflow-hidden rounded-lg bg-neutral-50 px-3 ring ring-neutral-500 transition-shadow group-data-[error=true]:ring-2 group-data-[readonly]:bg-neutral-100 group-data-[readonly]:ring-neutral-300 has-focus:ring-2 data-[disabled]:ring-neutral-400",i&&"pointer-events-none"),children:[jsxRuntime.jsx(combobox.Combobox.Input,{className:n("font-inter flex w-full justify-between text-left text-sm text-neutral-900 outline-0 group-data-[disabled]/control:text-neutral-400 disabled:cursor-not-allowed data-[placeholder-shown]:text-neutral-500",i&&"pointer-events-none",l&&"pr-16"),ref:C}),l&&jsxRuntime.jsx(w,{className:"text-error-500 size-4.5 shrink-0"}),!i&&jsxRuntime.jsx(combobox.Combobox.ClearTrigger,{className:"cursor-pointer",onClick:K,children:jsxRuntime.jsx(S,{className:"size-4.5"})}),jsxRuntime.jsx(combobox.Combobox.Trigger,{className:"cursor-pointer group-data-[disabled]/control:cursor-not-allowed group-data-[disabled]/control:text-neutral-400",children:jsxRuntime.jsx(V,{className:"size-4.5 transition-transform will-change-transform group-data-[state=open]/control:rotate-180"})})]}),jsxRuntime.jsx("p",{className:"font-inter text-2xs group-data-[error=true]:text-error-500 mt-1 leading-[133.33%] font-normal text-neutral-700 peer-data-[disabled]:text-neutral-400 empty:hidden",children:f}),jsxRuntime.jsx(portal.Portal,{children:jsxRuntime.jsx(combobox.Combobox.Positioner,{className:"!z-10000",children:jsxRuntime.jsx(combobox.Combobox.Content,{className:"elevation-9 max-h-67.5 min-w-27.5 overflow-auto rounded-lg bg-neutral-50",children:jsxRuntime.jsxs(combobox.Combobox.ItemGroup,{children:[h.items.length>0&&h.items.map(t=>jsxRuntime.jsx(combobox.Combobox.Item,{item:t,className:"font-inter data-[highlighted]:bg-primary-100 cursor-pointer p-3 data-[disabled]:cursor-not-allowed data-[disabled]:text-neutral-400",children:jsxRuntime.jsx(combobox.Combobox.ItemText,{className:"flex flex-col gap-1",asChild:true,children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm leading-[130%] font-medium",children:t.label}),t.description&&jsxRuntime.jsx("p",{className:"text-xs leading-[130%]",children:t.description})]})})},t.value)),h.items.length===0&&jsxRuntime.jsx(M,{title:b,description:v,Icon:N,descriptionLines:H,titleLines:I})]})})})})]})};exports.AutocompleteNew=nt;
|
|
1
|
+
'use strict';var combobox=require('@ark-ui/react/combobox'),locale=require('@ark-ui/react/locale'),portal=require('@ark-ui/react/portal'),lucideReact=require('lucide-react'),tooltip=require('@ark-ui/react/tooltip'),clsx=require('clsx'),tailwindMerge=require('tailwind-merge'),jsxRuntime=require('react/jsx-runtime'),react=require('react'),tailwindVariants=require('tailwind-variants');var V=lucideReact.X;var z=lucideReact.ChevronDown;var I=lucideReact.CircleAlert;function r(...n){return tailwindMerge.twMerge(clsx.clsx(n))}var D=({closeDelay:n=500,closeOnClick:a=true,closeOnEscape:o=true,closeOnPointerDown:g=true,closeOnScroll:s=true,interactive:i=true,lazyMount:c=false,openDelay:d=700,unmountOnExit:p=false,content:m,children:x,asChild:b=true,contentClassName:T,className:y,...N})=>jsxRuntime.jsxs(tooltip.TooltipRoot,{closeDelay:n,closeOnClick:a,closeOnEscape:o,closeOnPointerDown:g,closeOnScroll:s,interactive:i,lazyMount:c,openDelay:d,unmountOnExit:p,...N,children:[jsxRuntime.jsx(tooltip.TooltipTrigger,{asChild:b,className:r("cursor-inherit text-left",y),children:b?jsxRuntime.jsx("div",{children:x}):x}),jsxRuntime.jsx(tooltip.TooltipPositioner,{children:jsxRuntime.jsxs(tooltip.TooltipContent,{className:r("font-inter z-30 rounded-lg bg-neutral-900 px-3 py-2 text-center text-sm leading-[142.86%] whitespace-break-spaces text-neutral-50","data-[state=open]:animate-in data-[state=open]:fade-in data-[state=open]:zoom-in-95","data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=closed]:zoom-out-95","data-[placement=left]:text-right data-[placement=left-end]:text-right data-[placement=left-start]:text-right","data-[placement=left]:origin-right data-[placement=left-end]:origin-bottom-right data-[placement=left-start]:origin-top-right","data-[placement=right-end]:right-right data-[placement=right]:text-right data-[placement=right-start]:text-right","data-[placement=right]:origin-left data-[placement=right-end]:origin-bottom-left data-[placement=right-start]:origin-top-left","data-[placement=top]:origin-bottom data-[placement=top-end]:origin-bottom-right data-[placement=top-start]:origin-bottom-left","data-[placement=bottom]:origin-top data-[placement=bottom-end]:origin-top-right data-[placement=bottom-start]:origin-top-left","data-[placement=left]:text-right data-[placement=left-end]:text-right data-[placement=left-start]:text-right","data-[placement=right]:text-left data-[placement=right-end]:text-left data-[placement=right-start]:text-left",T),children:[jsxRuntime.jsx(tooltip.TooltipArrow,{children:jsxRuntime.jsx(tooltip.TooltipArrowTip,{})}),m]})})]});var le=({title:n,titleLines:a=2,description:o,descriptionLines:g=1,Icon:s,iconAsColumn:i=true,className:c,...d})=>jsxRuntime.jsxs("div",{className:r("flex gap-2 py-4 pl-4 pr-6",i&&"flex-col items-center gap-1",!i&&!o&&"items-center"),...d,children:[s&&jsxRuntime.jsx(s,{className:r("shrink-0 text-neutral-300"),size:24}),jsxRuntime.jsxs("div",{className:r("flex flex-col gap-1",i&&"text-center"),children:[jsxRuntime.jsx("p",{className:r("leading-[130%] text-neutral-500",!!o&&"font-medium"),style:a?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:a}:void 0,children:n}),o&&jsxRuntime.jsx("p",{className:"text-sm leading-[130%] text-neutral-500",style:g?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:g}:void 0,children:o})]})]}),M=le;var de=tailwindVariants.tv({slots:{container:"group/expandable-badge flex w-fit items-center gap-0 rounded-full ring transition-all duration-300 ease-in-out ring-inset",icon:"shrink-0 transition-all duration-300",text:"max-w-0 overflow-hidden whitespace-nowrap opacity-0 transition-all duration-300 group-hover/expandable-badge:max-w-fit group-hover/expandable-badge:opacity-100",dot:"size-1.5 shrink-0 rounded-full",leadingSymbolContainer:"flex aspect-square h-full shrink-0 items-center justify-center"},variants:{size:{sm:{container:"hover:pl-0.625 h-4.5 hover:pr-1.5",text:"text-2xs leading-none",icon:"size-3"},md:{container:"h-5 hover:pr-1.5 hover:pl-1",text:"text-xs leading-none",icon:"size-3"},lg:{container:"h-6 hover:pr-1.5",text:"text-sm leading-[143%]",icon:"size-3.5"}},color:{"aqua-100":{container:"bg-aqua-100 ring-aqua-500",icon:"text-aqua-800",text:"text-aqua-800",dot:"bg-aqua-700"},"sky-50":{container:"bg-sky-50 ring-sky-300",icon:"text-sky-800",text:"text-sky-800",dot:"bg-sky-700"},"info-100":{container:"bg-info-100 ring-info-500",icon:"text-info-800",text:"text-info-800",dot:"bg-info-600"},"success-50":{container:"bg-success-50 ring-success-300",icon:"text-success-800",text:"text-success-800",dot:"bg-success-700"},"mint-50":{container:"bg-mint-50 ring-mint-300",icon:"text-mint-800",text:"text-mint-800",dot:"bg-mint-500"},"success-200":{container:"bg-success-200 ring-success-300",icon:"text-success-800",text:"text-success-800",dot:"bg-success-700"},"jungle-200":{container:"bg-jungle-200 ring-mint-500",icon:"text-jungle-800",text:"text-jungle-800",dot:"bg-jungle-700"},"green-200":{container:"bg-green-200 ring-green-600",icon:"text-green-800",text:"text-green-800",dot:"bg-green-700"},"banana-50":{container:"bg-banana-50 ring-banana-500",icon:"text-banana-800",text:"text-banana-800",dot:"bg-banana-700"},"banana-100":{container:"bg-banana-100 ring-banana-500",icon:"text-banana-800",text:"text-banana-800",dot:"bg-banana-700"},"secondary-100":{container:"bg-secondary-100 ring-secondary-400",icon:"text-secondary-900",text:"text-secondary-900",dot:"bg-secondary-700"},"warning-50":{container:"bg-warning-50 ring-warning-300",icon:"text-warning-800",text:"text-warning-800",dot:"bg-warning-600"},"warning-200":{container:"bg-warning-200 ring-warning-500",icon:"text-warning-800",text:"text-warning-800",dot:"bg-warning-700"},"orange-50":{container:"bg-orange-50 ring-orange-200",icon:"text-warning-800",text:"text-warning-800",dot:"bg-orange-500"},"orange-100":{container:"bg-orange-100 ring-orange-300",icon:"text-orange-800",text:"text-orange-800",dot:"bg-orange-600"},"coral-50":{container:"bg-coral-50 ring-coral-300",icon:"text-coral-800",text:"text-coral-800",dot:"bg-coral-600"},"danger-50":{container:"bg-danger-50 ring-danger-300",icon:"text-danger-800",text:"text-danger-800",dot:"bg-danger-600"},"danger-100":{container:"bg-danger-100 ring-danger-300",icon:"text-danger-800",text:"text-danger-800",dot:"bg-danger-600"},"new-50":{container:"bg-new-50 ring-new-300",icon:"text-new-800",text:"text-new-800",dot:"bg-new-500"},"lavender-50":{container:"bg-lavender-50 ring-lavender-300",icon:"text-lavender-800",text:"text-lavender-800",dot:"bg-lavender-700"},"orchid-100":{container:"bg-orchid-100 ring-orchid-300",icon:"text-orchid-800",text:"text-orchid-800",dot:"bg-orchid-700"},"neutral-200":{container:"bg-neutral-200 ring-neutral-500",icon:"text-neutral-800",text:"text-neutral-800",dot:"bg-neutral-700"},"neutral-300":{container:"bg-neutral-300 ring-neutral-600",icon:"text-neutral-800",text:"text-neutral-800",dot:"bg-neutral-700"},"neutral-400":{container:"bg-neutral-400 ring-neutral-700",icon:"text-neutral-800",text:"text-neutral-800",dot:"bg-neutral-700"}}}}),k=react.forwardRef(({text:n,className:a,leading:o,size:g,color:s,...i},c)=>{let{container:d,text:p,dot:m,icon:x,leadingSymbolContainer:b}=de({color:s,size:g});return jsxRuntime.jsxs("div",{ref:c,className:d({className:a}),...i,children:[jsxRuntime.jsx("div",{className:b(),children:o==="dot"?jsxRuntime.jsx("div",{className:m()}):jsxRuntime.jsx(o,{className:x()})}),jsxRuntime.jsx("span",{className:p(),children:n})]})});k.displayName="BadgeExpandable";function fe(){let n=combobox.useComboboxContext(),a=react.useRef(false);return n.value.length&&n.collection.size&&!a.current&&(n.syncSelectedItems(),a.current=true),null}var ft=n=>{let{label:a,error:o,required:g,tooltip:s,readOnly:i,options:c,onInputValueChange:d,onSelect:p,defaultValue:m,helperText:x,noResultsTitle:b,noResultsDescription:T,noResultsIcon:y,noResultsTitleLines:N,noResultsDescriptionLines:q,value:L,className:j,...F}=n,U=Object.getOwnPropertyNames(n),h=react.useRef(null),{contains:X}=locale.useFilter({sensitivity:"base"}),{collection:C,filter:v,set:G}=combobox.useListCollection({initialItems:[],itemToString:t=>t.label,itemToValue:t=>String(t.value),filter:X}),W=react.useCallback(t=>{let E=c.find(Q=>String(Q.value)===t.itemValue);E&&p?.(E);},[p,c]),S=react.useCallback(t=>{v(t.inputValue),t.reason!==void 0&&d?.(t.inputValue??"");},[v,d]),K=combobox.useCombobox({collection:C,defaultValue:m?[String(m)]:void 0,placeholder:n.placeholder,inputValue:n.inputValue,onInputValueChange:S,value:U.includes("value")?L?[String(L)]:[]:void 0,onSelect:W,inputBehavior:"autocomplete",openOnClick:true,...F}),J=react.useCallback(()=>{p?.(null),S?.({inputValue:"",reason:"clear-trigger"});},[p,d]);return react.useEffect(()=>{G(c);},[c]),react.useEffect(()=>{h.current&&h.current.value===""&&v("");},[v,h.current?.value]),jsxRuntime.jsxs(combobox.Combobox.RootProvider,{value:K,"data-error":o,className:r("group flex flex-col",j),children:[jsxRuntime.jsxs(combobox.Combobox.Label,{className:"font-inter flex items-center text-xs leading-[133.33%] font-medium text-neutral-700 data-[disabled]:text-neutral-400",children:[g?jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsx("span",{className:"text-red-500",children:"*"}),a]}):a,s&&jsxRuntime.jsx(D,{content:s,className:"ml-2",children:jsxRuntime.jsx(I,{className:"size-3.5"})})]}),jsxRuntime.jsx(fe,{}),jsxRuntime.jsxs(combobox.Combobox.Control,{className:r("group/control mt-1.125 data-[focus]:ring-primary-800 group-data-[error=true]:ring-error-500 relative flex h-10 w-full items-center justify-between gap-2 overflow-hidden rounded-lg bg-neutral-50 px-3 ring ring-neutral-500 transition-shadow group-data-[error=true]:ring-2 group-data-[readonly]:bg-neutral-100 group-data-[readonly]:ring-neutral-300 has-focus:ring-2 data-[disabled]:ring-neutral-400",i&&"pointer-events-none"),children:[jsxRuntime.jsx(combobox.Combobox.Input,{className:r("font-inter flex w-full justify-between text-left text-sm text-neutral-900 outline-0 group-data-[disabled]/control:text-neutral-400 disabled:cursor-not-allowed data-[placeholder-shown]:text-neutral-500",i&&"pointer-events-none",o&&"pr-16"),ref:h}),o&&jsxRuntime.jsx(I,{className:"text-error-500 size-4.5 shrink-0"}),!i&&jsxRuntime.jsx(combobox.Combobox.ClearTrigger,{className:"cursor-pointer",onClick:J,children:jsxRuntime.jsx(V,{className:"size-4.5"})}),jsxRuntime.jsx(combobox.Combobox.Trigger,{className:"cursor-pointer group-data-[disabled]/control:cursor-not-allowed group-data-[disabled]/control:text-neutral-400",children:jsxRuntime.jsx(z,{className:"size-4.5 transition-transform will-change-transform group-data-[state=open]/control:rotate-180"})})]}),jsxRuntime.jsx("p",{className:"font-inter text-2xs group-data-[error=true]:text-error-500 mt-1 leading-[133.33%] font-normal text-neutral-700 peer-data-[disabled]:text-neutral-400 empty:hidden",children:x}),jsxRuntime.jsx(portal.Portal,{children:jsxRuntime.jsx(combobox.Combobox.Positioner,{className:"!z-10000",children:jsxRuntime.jsx(combobox.Combobox.Content,{className:"elevation-9 max-h-67.5 min-w-27.5 overflow-auto rounded-lg bg-neutral-50",children:jsxRuntime.jsxs(combobox.Combobox.ItemGroup,{children:[C.items.length>0&&C.items.map(t=>jsxRuntime.jsx(combobox.Combobox.Item,{item:t,className:"font-inter data-[highlighted]:bg-primary-100 block w-full cursor-pointer p-3 data-[disabled]:cursor-not-allowed data-[disabled]:text-neutral-400",children:jsxRuntime.jsx(combobox.Combobox.ItemText,{className:"flex w-full min-w-0 flex-col gap-1",asChild:true,children:jsxRuntime.jsxs("div",{className:"w-full min-w-0",children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[jsxRuntime.jsx("p",{className:"min-w-0 flex-1 truncate text-sm leading-[130%] font-medium",children:t.label}),t.badgeExpandable&&jsxRuntime.jsx("div",{className:"flex shrink-0 justify-end overflow-visible",children:jsxRuntime.jsx(k,{size:"sm",...t.badgeExpandable})})]}),t.description&&jsxRuntime.jsx("p",{className:"text-xs leading-[130%]",children:t.description})]})})},t.value)),C.items.length===0&&jsxRuntime.jsx(M,{title:b,description:T,Icon:y,descriptionLines:q,titleLines:N})]})})})})]})};exports.AutocompleteNew=ft;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as AutocompleteNew}from'../chunk-
|
|
1
|
+
export{b as AutocompleteNew}from'../chunk-JEYTNPAV.mjs';import'../chunk-DHWOGUID.mjs';import'../chunk-GHVRYH3R.mjs';import'../chunk-5VHBHGBZ.mjs';import'../chunk-XJD5SYZJ.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as CardExpandable,b as CardExpandableContent,c as CardExpandableFixedContent,a as CardExpandableHeader}from'../chunk-
|
|
1
|
+
export{d as CardExpandable,b as CardExpandableContent,c as CardExpandableFixedContent,a as CardExpandableHeader}from'../chunk-HV3JCN4E.mjs';import'../chunk-PTRXL7BY.mjs';import'../chunk-GBBE3RHT.mjs';import'../chunk-FAMLJ6AJ.mjs';import'../chunk-AI4D6AOK.mjs';import'../chunk-JWB3TN2C.mjs';import'../chunk-DHWOGUID.mjs';import'../chunk-GHVRYH3R.mjs';import'../chunk-5VHBHGBZ.mjs';import'../chunk-XJD5SYZJ.mjs';
|