sodtrack-web-ui 0.70.0 → 0.70.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/dist/{chunk-PEZAQAZU.mjs → chunk-SSXC2FWW.mjs} +1 -1
- package/dist/{chunk-CGNYJ73H.mjs → chunk-V2JAVT3M.mjs} +1 -1
- package/dist/components/drawer.mjs +1 -1
- package/dist/components/index.js +1 -1
- 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.mjs +1 -1
- package/dist/components/list-item.mjs +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'./chunk-7NJTMO4L.mjs';import {
|
|
1
|
+
import {c}from'./chunk-7NJTMO4L.mjs';import {c as c$2}from'./chunk-35JUETHD.mjs';import {j}from'./chunk-ANNKZIP4.mjs';import {c as c$1}from'./chunk-FSC7SJ6L.mjs';import {a}from'./chunk-BO6XI5BE.mjs';import*as s from'react';import*as e from'@radix-ui/react-dialog';import*as R from'@radix-ui/react-visually-hidden';import {jsx,jsxs}from'react/jsx-runtime';var I=["sm","md","lg","xl"],T=({...r})=>jsx(e.Root,{...r});T.displayName="Drawer";var S=e.Trigger,B=e.Portal,V=e.Close,v=s.forwardRef(({className:r,...a$1},o)=>jsx(e.Overlay,{ref:o,className:a("fixed inset-0 z-50 bg-neutral-900/60","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=open]:animate-in data-[state=closed]:animate-out","transition-all",r),...a$1}));v.displayName=e.Overlay.displayName;var h=s.forwardRef(({className:r,size:a$1="sm",title:o,description:i,children:f,isLoading:d=false,loadingText:n="",buttons:D,hideHeader:c$1=false,onPointerDownOutside:C,...P},H)=>jsx(B,{children:jsx(v,{children:jsxs(e.Content,{onPointerDownOutside:m=>{m.target instanceof Element&&m.target.closest(".pac-container")&&m.preventDefault(),C?.(m);},ref:H,...!i||c$1?{"aria-describedby":void 0}:{},className:a("fixed right-0 top-0 z-50 flex h-full flex-col overflow-y-auto bg-neutral-50 pl-6 pr-8 pt-10",a$1==="sm"&&"w-[29.375rem] max-w-[29.375rem]",a$1==="md"&&"w-[47.5rem] max-w-[47.5rem]",a$1==="lg"&&"w-[58.75rem] max-w-[58.75rem]",a$1==="xl"&&"w-[78.125rem] max-w-[78.125rem]","data-[state=open]:animate-slide-in","data-[state=closed]:animate-swipe-out",r),...P,children:[c$1?jsx(R.Root,{children:jsx(j,{children:"Drawer"})}):jsx(x,{title:o,description:i,buttons:D}),jsx("div",{className:a("flex flex-1 flex-col pb-6",r),children:d?jsxs("div",{className:"flex flex-1 flex-col items-center justify-center",children:[jsx(c,{size:"lg"}),n&&jsx("p",{children:n})]}):f})]})})}));h.displayName="DrawerContent";var x=({className:r,title:a$1,description:o,buttons:i=[],...f})=>jsxs("div",{className:a("mb-7",r),...f,children:[jsxs("div",{className:"flex justify-between gap-2",children:[a$1&&jsx(N,{children:a$1}),!Array.isArray(i)&&i.visible!==false&&jsx(c$1,{size:"sm",variant:"ghost",...i}),Array.isArray(i)&&jsx("div",{className:"flex gap-1",children:i.map(({visible:d=true,...n},D)=>d?jsx(c$2,{variant:"ghost",size:"sm",...n},D):null)})]}),o&&jsx(b,{className:"mt-1",children:o})]});x.displayName="DrawerHeader";var E=({className:r,...a$1})=>jsx("div",{className:a("mt-auto flex pt-6",r),...a$1});E.displayName="DrawerFooter";var N=s.forwardRef(({className:r,...a$1},o)=>jsx(e.Title,{ref:o,className:a("font-jakarta text-2xl font-semibold leading-[130%] text-neutral-900",r),...a$1}));N.displayName=e.Title.displayName;var b=s.forwardRef(({className:r,...a$1},o)=>jsx(e.Description,{ref:o,className:a("text-sm leading-[130%] text-neutral-900",r),...a$1}));b.displayName=e.Description.displayName;export{I as a,T as b,S as c,B as d,V as e,v as f,h as g,x as h,E as i,N as j,b as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c as c$3}from'./chunk-35JUETHD.mjs';import {a as a$4}from'./chunk-KTRSJBA4.mjs';import {a as a$3}from'./chunk-5JYXZUPM.mjs';import {c as c$2}from'./chunk-UXLVGJGJ.mjs';import {d}from'./chunk-KTTNV2CJ.mjs';import {a}from'./chunk-T2IU5QUU.mjs';import {a as a$2}from'./chunk-SXEHG5TZ.mjs';import {c}from'./chunk-FSC7SJ6L.mjs';import {c as c$1,h}from'./chunk-4HYLZVI5.mjs';import {a as a$1}from'./chunk-BO6XI5BE.mjs';import be,{createContext,useMemo,useCallback,useContext,useRef,useEffect,useState,useId}from'react';import*as Oe from'@radix-ui/react-portal';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var qe=({title:e,titleLines:i=2,description:t,descriptionLines:o=1,Icon:p,iconAsColumn:l=true,className:n,...r})=>jsxs("div",{className:a$1("flex gap-2 py-4 pl-4 pr-6",l&&"flex-col items-center gap-1",!l&&!t&&"items-center"),...r,children:[p&&jsx(p,{className:a$1("shrink-0 text-neutral-300"),size:24}),jsxs("div",{className:a$1("flex flex-col gap-1",l&&"text-center"),children:[jsx("p",{className:a$1("leading-[130%] text-neutral-500",!!t&&"font-medium"),style:i?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:i}:void 0,children:e}),t&&jsx("p",{className:"text-sm leading-[130%] text-neutral-500",style:o?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:o}:void 0,children:t})]})]}),ne=qe;var Ke=be.memo(({handleSelect:e,NoResultsIcon:i,noResultsLabel:t,noResultsDescription:o,noResultsDescriptionLines:p,noResultsAsColumn:l,noResultsButtonOnClick:n,optionDescriptionLines:r,noResultsButtonLabel:s,filteredOptions:c$1,inputRect:u,inputRef:b,popoverPosition:x,optionsListRef:v,selectedOption:h,options:g,setFilteredOptions:C})=>jsx(Oe.Root,{asChild:true,children:jsxs("div",{ref:v,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:u?{width:`${u.width}px`,left:u.left,top:x==="bottom"?`${u.bottom}px`:void 0,bottom:x==="top"?`${window.innerHeight-u.top}px`:void 0}:void 0,children:[c$1.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(ne,{title:t,description:o,Icon:i,iconAsColumn:l,descriptionLines:p}),n&&jsxs(Fragment,{children:[jsx(a,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:a=>{v.current.style.display="none",b.current.value="",C(g),n();},children:s})]})]}),c$1.map(a=>jsx(Ie,{title:a.label,disabled:a.disabled,description:a.description,descriptionLines:r,onClick:()=>e(a),className:a$1(h?.value===a.value&&"bg-primary-200")},a.key??a.value))]})})),we=Ke;var Ye=336,oo=({options:e,defaultSelectedOption:i,onSelect:t,onClick:o,onInputChange:p,error:l,helperText:n,label:r,placeholder:s,value:c,size:u="md",optionDescriptionLines:b=1,noResultsLabel:x,noResultsIcon:v,noResultsDescription:h,noResultsDescriptionLines:g,noResultsAsColumn:C,noResultsButtonOnClick:a,noResultsButtonLabel:N,className:L,disabled:P})=>{let[m,A]=useState(i??null),O=useRef(null),d=useRef(null),[le,se]=useState(),[pe,B]=useState([]),[ue,z]=useState("bottom"),[X,j]=useState(),U=Ye,W=useCallback(R=>{O.current.style.display="none",d.current.value=R.label,A(R),t?.(R);},[t]),w=useCallback(()=>{if(!d?.current)return;let R=d.current.getBoundingClientRect();se(R);let E=X?X.height:U,I=window.innerHeight-R.bottom>E,ee=R.top>E;z(I?"bottom":ee?"top":"bottom");},[X?.height]),q=useCallback(()=>{let R=e.filter(E=>E.label.toLowerCase().includes(d?.current?.value.toLowerCase()??""));if(B(R),O?.current){let E=O.current.getBoundingClientRect();j(E);}},[e]);return useEffect(()=>{B(e);},[e]),useEffect(()=>{if(!c){A(null),d.current&&(d.current.value="");return}(!d.current?.value||m?.value!==c.value)&&(A(c),d.current.value=c.label);},[c]),a$4(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",q),window.addEventListener("scroll",w,true),window.addEventListener("resize",w),()=>{d.current?.removeEventListener("mousedown",w),d.current?.removeEventListener("input",q),window.removeEventListener("scroll",w,true),window.removeEventListener("resize",w);}},[w,q]),jsxs("div",{className:a$1("relative",L),children:[jsx(a$3,{ref:d,autoComplete:"off",list:"",selectMode:true,onChange:R=>{R.target.value||(A(null),t?.(null)),p?.(R);},onClean:()=>{A(null),B(e),t?.(null);},onClick:R=>{O.current.style.display="flex",o?.(R);},onBlur:()=>{m&&d.current&&(d.current.value=m.label);},label:r,helperText:n,placeholder:s,size:u,error:l,disabled:P}),jsx(we,{handleSelect:W,noResultsLabel:x,NoResultsIcon:v,optionDescriptionLines:b,noResultsAsColumn:C,noResultsButtonLabel:N,noResultsButtonOnClick:a,noResultsDescription:h,noResultsDescriptionLines:g,filteredOptions:pe,inputRect:le,inputRef:d,popoverPosition:ue,optionsListRef:O,selectedOption:m,options:e,setFilteredOptions:B})]})};var je=({children:e,title:i,titleLines:t,description:o="",descriptionLines:p,disabled:l=false,className:n,...r})=>jsxs("div",{className:"flex w-full flex-col gap-1",...r,children:[jsx("p",{className:a$1("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$1("text-xs leading-[130%]",l?"text-neutral-400":"text-neutral-700"),style:p?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:p}:void 0,children:o})]}),T=je;var bo=({children:e,title:i,titleLines:t,description:o="",descriptionLines:p,startIcon:l,badgeContent:n,hasDivider:r=false,disabled:s=false,onSelect:c,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:s,onClick:c,hasDivider:r,className:a$1(!s&&"cursor-pointer",u),...b,children:[l&&be.cloneElement(l,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:s}),jsxs("div",{className:"ml-4 flex gap-2",children:[n&&jsx(a$2,{content:n,size:"lg",variant:"alert",className:a$1("self-center",s&&"bg-neutral-400")}),jsx(h,{className:"h-4.5 w-4.5 self-center"})]})]});var De=({children:e,title:i,titleLines:t=1,description:o="",descriptionLines:p,startIcon:l,hasDivider:n=false,disabled:r=false,checked:s,onCheckedChange:c,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:r,hasDivider:n,...b,className:a$1("pr-6",u),children:[l&&be.cloneElement(l,{className:"shrink-0 w-4.5 h-4.5 mr-2"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:r}),jsx(c$2,{size:"sm",checked:s,onCheckedChange:c,className:"ml-4 self-center",disabled:r})]});var k=336,He=createContext({inputRef:null,optionsListRef:null,autocompleteId:"",inputRect:void 0,showChips:false,filteredOptions:[],currentFocus:-1,popoverPosition:"bottom",setFilteredOptions:()=>{},setCurrentFocus:()=>{},setShowChips:()=>{},setPopoverPosition:()=>{},setInputRect:()=>{},optionsListHeight:k,setOptionsListHeight:()=>{},optionsListRect:void 0,setOptionsListRect:()=>{}}),F=()=>{let e=useContext(He);if(e===null)throw new Error("useAutocompleteMultipleContext must be used within a AutocompleteMultipleProvider");return e},Ne=({children:e})=>{let i=useRef(null),t=useRef(null),o=useId(),[p,l]=useState(),[n,r]=useState(true),[s,c]=useState([]),[u,b]=useState(-1),[x,v]=useState("bottom"),[h,g]=useState(),[C,a]=useState(k);return jsx(He.Provider,{value:{optionsListRef:i,inputRef:t,autocompleteId:o,inputRect:p,showChips:n,filteredOptions:s,currentFocus:u,popoverPosition:x,setFilteredOptions:c,setCurrentFocus:b,setShowChips:r,setPopoverPosition:v,setInputRect:l,optionsListHeight:C,optionsListRect:h,setOptionsListRect:g,setOptionsListHeight:a},children:e})};var ct=({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})},Se=ct;var ft=150,bt=be.memo(({selectedOptions:e,error:i,onCleanSelectedOptions:t,disabled:o,size:p})=>{let{autocompleteId:l,inputRect:n,inputRef:r,optionsListRef:s}=F(),c=be.useRef(null),[u,b]=be.useState(new Map),x=useMemo(()=>{if(!n?.width)return [];let h=0,g=n.width-ft,C=0;for(let a=0;a<e.length&&(C+=u.get(a)??0,!(C>g));a++)h++;return e.slice(0,h)},[n?.width,e,u]),v=useCallback(()=>{o||(r?.current?.focus(),s.current.style.display="flex");},[o]);return jsxs("div",{onClick:v,className:a$1("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:c,children:x.map((h,g)=>jsx(Se,{option:h,onMountWidth:C=>b(a=>new Map(a).set(g,C)),size:p},`chip-input-${l}-${h.value}`))}),e.length>x.length&&jsx("span",{className:"text-base",children:"..."}),e.length>0&&!i&&jsx(a$2,{content:String(e.length),size:p}),i&&e.length>0&&jsx(c$1,{className:"h-6 w-6 text-error-700",onClick:h=>{h.stopPropagation(),t();}})]})}),Be=bt;var vt=be.memo(({option:e,index:i,onPressOption:t,isSelected:o,optionDescriptionLines:p})=>{let{currentFocus:l,inputRef:n}=F();return jsx(De,{title:e.label,checked:o,disabled:e.disabled,className:l===i?"bg-primary-200":void 0,onMouseDown:r=>{e.disabled||(n?.current?.value&&r.preventDefault(),t?.(e,r));},description:e.description,descriptionLines:p})}),he=vt;var Mt=be.memo(({selectedOptions:e,handleSelect:i,NoResultsIcon:t,noResultsLabel:o,noResultsDescription:p,noResultsDescriptionLines:l,noResultsAsColumn:n,noResultsButtonOnClick:r,optionDescriptionLines:s,noResultsButtonLabel:c$1})=>{let{popoverPosition:u,optionsListRef:b,filteredOptions:x,inputRect:v,autocompleteId:h,inputRef:g,optionsListHeight:C}=F(),a$1=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(Oe.Root,{asChild:true,children:jsxs("div",{ref:b,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:v?{width:`${v.width}px`,left:v.left,top:u==="bottom"?`${v.bottom}px`:void 0,bottom:u==="top"?`${window.innerHeight-v.top}px`:void 0,maxHeight:C+"px"}:void 0,children:[x.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(ne,{title:o,description:p,Icon:t,iconAsColumn:n,descriptionLines:l}),r&&jsxs(Fragment,{children:[jsx(a,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:L=>{b.current.style.display="none",g.current.value="",r();},children:c$1})]})]}),N.map((L,P)=>jsx(he,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$1(L),optionDescriptionLines:s},`autocomplete-option-${h}-${L.key??L.value}`)),x.map((L,P)=>!e.some(m=>m.value===L.value)&&jsx(he,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$1(L),optionDescriptionLines:s},`autocomplete-option-${h}-${L.key??L.value}`))]})})}),We=Mt;var wt=be.memo(({selectedOptions:e,onSelect:i,error:t,helperText:o,label:p,placeholder:l,options:n,onInputChange:r,size:s,disabled:c})=>{let{setCurrentFocus:u,setFilteredOptions:b,optionsListRef:x,inputRef:v}=F();return jsx(a$3,{ref:v,autoComplete:"off",list:"",disabled:c,selectMode:true,onChange:h=>{u(-1),r?.(h.target.value);},onClean:()=>{u(-1),b(n),i?.(null,e);},onClick:()=>{c||(x.current.style.display="flex");},error:t,helperText:o,label:p,placeholder:l,fixedTopLabel:e.length>0,size:s})}),Ve=wt;var Ge=({options:e,defaultSelectedOptions:i,onSelect:t,error:o,helperText:p,label:l,placeholder:n,noResultsLabel:r,noResultsIcon:s,noResultsDescription:c,noResultsDescriptionLines:u,noResultsAsColumn:b,noResultsButtonOnClick:x,noResultsButtonLabel:v,className:h,onInputChange:g,value:C,loading:a,size:N="md",optionDescriptionLines:L=1,disabled:P})=>{let{inputRef:m,optionsListRef:A,setFilteredOptions:O,setShowChips:d,setInputRect:le,setPopoverPosition:se,setCurrentFocus:pe,showChips:B,setOptionsListRect:ue,optionsListRect:z,setOptionsListHeight:X}=F(),j=useRef(false),[U,W]=useState(i??[]),w=useCallback(M=>{W(y=>{let D,J=y.findIndex(Ue=>Ue.value===M.value);return J===-1?(D=y.concat(M),t?.(M,D),D):(D=y.toSpliced(J,1),t?.(M,D),D)});},[t]),q=useCallback(()=>{W([]),O(e),t?.(null,[]);},[]),R=useCallback(()=>{d(false);},[]),E=useCallback(()=>{d(true);},[]),I=useCallback(()=>{if(!m?.current)return;let M=m.current.getBoundingClientRect();le(M);let y=z?z.height>k?k:z.height:k,D=window.innerHeight-M.bottom>y,J=M.top>y;se(D?"bottom":J?"top":"bottom"),X(J?k:window.innerHeight-M.bottom>k?k:window.innerHeight-M.bottom);},[z?.height]),ee=useCallback(()=>{let M=e.filter(y=>y.label.toLowerCase().includes(m?.current?.value.toLowerCase()??""));if(O(M),A?.current){let y=A.current.getBoundingClientRect();ue(y);}},[e,A?.current]);return useEffect(()=>{O(e);},[e]),a$4(A,()=>{A.current.style.display="none",pe(-1);}),useEffect(()=>{if(m?.current)return I(),m.current.addEventListener("mousedown",I),m.current.addEventListener("input",ee),m.current.addEventListener("focusin",R),m.current.addEventListener("focusout",E),window.addEventListener("scroll",I,true),window.addEventListener("resize",I),()=>{m.current?.removeEventListener("mousedown",I),m.current?.removeEventListener("input",I),m.current?.removeEventListener("focusout",E),m.current?.removeEventListener("focusin",R),window.removeEventListener("scroll",I,true),window.removeEventListener("resize",I);}},[I,E,R,ee]),useEffect(()=>{C&&(W(C),d(true));},[C]),useEffect(()=>{a||i&&i.length&&!j.current&&(W(i),j.current=true,d(true));},[i,a]),jsxs("div",{className:a$1("relative",h),children:[jsx(Ve,{selectedOptions:U,onSelect:t,error:o,helperText:p,label:l,placeholder:n,handleSelect:w,options:e,onInputChange:g,size:N,disabled:P}),B&&jsx(Be,{selectedOptions:U,disabled:P,error:o,onCleanSelectedOptions:q,size:N}),jsx(We,{handleSelect:w,selectedOptions:U,noResultsLabel:r,NoResultsIcon:s,optionDescriptionLines:L,noResultsAsColumn:b,noResultsButtonLabel:v,noResultsButtonOnClick:x,noResultsDescription:c,noResultsDescriptionLines:u})]})};var Ei=e=>jsx(Ne,{children:jsx(Ge,{...e})});var Bi=({children:e,title:i,titleLines:t=1,description:o,descriptionLines:p=1,StartIcon:l,hasDivider:n=false,disabled:r=false,actionButton:s,isSelected:c$1=false,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:r,hasDivider:n,isSelected:c$1,...b,className:u,children:[l&&jsx(l,{className:"mr-2 h-4.5 w-4.5 shrink-0 grow-0"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:r}),s&&jsx(Fragment,{children:s.isIcon?jsx(c$3,{...s,className:"ml-4 self-center",variant:"ghost",size:"sm",disabled:r??s.disabled}):jsx(c,{...s,className:"ml-4 self-center",size:"sm",variant:"ghost",disabled:r??s.disabled})})]});var Dt=({children:e,hasDescription:i=false,disabled:t=false,hasDivider:o=false,className:p,isSelected:l,onClick:n,...r})=>jsxs(Fragment,{children:[jsx("div",{className:a$1("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",l&&"bg-primary-200",p),onClick:s=>{t||n?.(s);},...r,children:e}),o&&jsx(a,{})]}),H=Dt;var Ie=({children:e,title:i,titleLines:t,description:o="",descriptionLines:p,startIcon:l,endIcon:n,hasDivider:r=false,disabled:s=false,isSelected:c=false,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:s,hasDivider:r,className:u,isSelected:c,...b,children:[l&&be.cloneElement(l,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:s}),n&&be.cloneElement(n,{className:"min-h-4.5 min-w-4.5 self-center ml-4"})]});export{oo as a,Ie as b,bo as c,De as d,Ei as e,Bi as f};
|
|
1
|
+
import {c as c$3}from'./chunk-35JUETHD.mjs';import {a as a$4}from'./chunk-KTRSJBA4.mjs';import {a as a$3}from'./chunk-5JYXZUPM.mjs';import {c as c$2}from'./chunk-UXLVGJGJ.mjs';import {d}from'./chunk-KTTNV2CJ.mjs';import {a}from'./chunk-T2IU5QUU.mjs';import {a as a$2}from'./chunk-SXEHG5TZ.mjs';import {c}from'./chunk-FSC7SJ6L.mjs';import {c as c$1,h}from'./chunk-4HYLZVI5.mjs';import {a as a$1}from'./chunk-BO6XI5BE.mjs';import be,{createContext,useMemo,useCallback,useContext,useRef,useEffect,useState,useId}from'react';import*as Oe from'@radix-ui/react-portal';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var qe=({title:e,titleLines:i=2,description:t,descriptionLines:o=1,Icon:p,iconAsColumn:l=true,className:n,...r})=>jsxs("div",{className:a$1("flex gap-2 py-4 pl-4 pr-6",l&&"flex-col items-center gap-1",!l&&!t&&"items-center"),...r,children:[p&&jsx(p,{className:a$1("shrink-0 text-neutral-300"),size:24}),jsxs("div",{className:a$1("flex flex-col gap-1",l&&"text-center"),children:[jsx("p",{className:a$1("leading-[130%] text-neutral-500",!!t&&"font-medium"),style:i?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:i}:void 0,children:e}),t&&jsx("p",{className:"text-sm leading-[130%] text-neutral-500",style:o?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:o}:void 0,children:t})]})]}),ne=qe;var Ke=be.memo(({handleSelect:e,NoResultsIcon:i,noResultsLabel:t,noResultsDescription:o,noResultsDescriptionLines:p,noResultsAsColumn:l,noResultsButtonOnClick:n,optionDescriptionLines:r,noResultsButtonLabel:s,filteredOptions:c$1,inputRect:u,inputRef:b,popoverPosition:x,optionsListRef:v,selectedOption:h,options:g,setFilteredOptions:C})=>jsx(Oe.Root,{asChild:true,children:jsxs("div",{ref:v,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:u?{width:`${u.width}px`,left:u.left,top:x==="bottom"?`${u.bottom}px`:void 0,bottom:x==="top"?`${window.innerHeight-u.top}px`:void 0}:void 0,children:[c$1.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(ne,{title:t,description:o,Icon:i,iconAsColumn:l,descriptionLines:p}),n&&jsxs(Fragment,{children:[jsx(a,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:a=>{v.current.style.display="none",b.current.value="",C(g),n();},children:s})]})]}),c$1.map(a=>jsx(Ie,{title:a.label,disabled:a.disabled,description:a.description,descriptionLines:r,onClick:()=>e(a),className:a$1(h?.value===a.value&&"bg-primary-200")},a.key??a.value))]})})),we=Ke;var Ye=336,oo=({options:e,defaultSelectedOption:i,onSelect:t,onClick:o,onInputChange:p,error:l,helperText:n,label:r,placeholder:s,value:c,size:u="md",optionDescriptionLines:b=1,noResultsLabel:x,noResultsIcon:v,noResultsDescription:h,noResultsDescriptionLines:g,noResultsAsColumn:C,noResultsButtonOnClick:a,noResultsButtonLabel:N,className:L,disabled:P})=>{let[m,A]=useState(i??null),O=useRef(null),d=useRef(null),[le,se]=useState(),[pe,B]=useState([]),[ue,z]=useState("bottom"),[X,j]=useState(),U=Ye,W=useCallback(R=>{O.current.style.display="none",d.current.value=R.label,A(R),t?.(R);},[t]),w=useCallback(()=>{if(!d?.current)return;let R=d.current.getBoundingClientRect();se(R);let E=X?X.height:U,I=window.innerHeight-R.bottom>E,ee=R.top>E;z(I?"bottom":ee?"top":"bottom");},[X?.height]),q=useCallback(()=>{let R=e.filter(E=>E.label.toLowerCase().includes(d?.current?.value.toLowerCase()??""));if(B(R),O?.current){let E=O.current.getBoundingClientRect();j(E);}},[e]);return useEffect(()=>{B(e);},[e]),useEffect(()=>{if(!c){A(null),d.current&&(d.current.value="");return}(!d.current?.value||m?.value!==c.value)&&(A(c),d.current.value=c.label);},[c]),a$4(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",q),window.addEventListener("scroll",w,true),window.addEventListener("resize",w),()=>{d.current?.removeEventListener("mousedown",w),d.current?.removeEventListener("input",q),window.removeEventListener("scroll",w,true),window.removeEventListener("resize",w);}},[w,q]),jsxs("div",{className:a$1("relative",L),children:[jsx(a$3,{ref:d,autoComplete:"off",list:"",selectMode:true,onChange:R=>{R.target.value||(A(null),t?.(null)),p?.(R);},onClean:()=>{A(null),B(e),t?.(null);},onClick:R=>{O.current.style.display="flex",o?.(R);},onBlur:()=>{m&&d.current&&(d.current.value=m.label);},label:r,helperText:n,placeholder:s,size:u,error:l,disabled:P}),jsx(we,{handleSelect:W,noResultsLabel:x,NoResultsIcon:v,optionDescriptionLines:b,noResultsAsColumn:C,noResultsButtonLabel:N,noResultsButtonOnClick:a,noResultsDescription:h,noResultsDescriptionLines:g,filteredOptions:pe,inputRect:le,inputRef:d,popoverPosition:ue,optionsListRef:O,selectedOption:m,options:e,setFilteredOptions:B})]})};var je=({children:e,title:i,titleLines:t,description:o="",descriptionLines:p,disabled:l=false,className:n,...r})=>jsxs("div",{className:"flex w-full flex-col gap-1",...r,children:[jsx("p",{className:a$1("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$1("text-xs leading-[130%]",l?"text-neutral-400":"text-neutral-700"),style:p?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:p}:void 0,children:o})]}),T=je;var bo=({children:e,title:i,titleLines:t,description:o="",descriptionLines:p,startIcon:l,badgeContent:n,hasDivider:r=false,disabled:s=false,onSelect:c,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:s,onClick:c,hasDivider:r,className:a$1(!s&&"cursor-pointer",u),...b,children:[l&&be.cloneElement(l,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:s}),jsxs("div",{className:"ml-4 flex gap-2",children:[n&&jsx(a$2,{content:n,size:"lg",variant:"alert",className:a$1("self-center",s&&"bg-neutral-400")}),jsx(h,{className:"h-4.5 w-4.5 self-center"})]})]});var De=({children:e,title:i,titleLines:t=1,description:o="",descriptionLines:p,startIcon:l,hasDivider:n=false,disabled:r=false,checked:s,onCheckedChange:c,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:r,hasDivider:n,...b,className:a$1("pr-6",u),children:[l&&be.cloneElement(l,{className:"shrink-0 w-4.5 h-4.5 mr-2"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:r}),jsx(c$2,{size:"sm",checked:s,onCheckedChange:c,className:"ml-4 self-center",disabled:r})]});var k=336,He=createContext({inputRef:null,optionsListRef:null,autocompleteId:"",inputRect:void 0,showChips:false,filteredOptions:[],currentFocus:-1,popoverPosition:"bottom",setFilteredOptions:()=>{},setCurrentFocus:()=>{},setShowChips:()=>{},setPopoverPosition:()=>{},setInputRect:()=>{},optionsListHeight:k,setOptionsListHeight:()=>{},optionsListRect:void 0,setOptionsListRect:()=>{}}),F=()=>{let e=useContext(He);if(e===null)throw new Error("useAutocompleteMultipleContext must be used within a AutocompleteMultipleProvider");return e},Ne=({children:e})=>{let i=useRef(null),t=useRef(null),o=useId(),[p,l]=useState(),[n,r]=useState(true),[s,c]=useState([]),[u,b]=useState(-1),[x,v]=useState("bottom"),[h,g]=useState(),[C,a]=useState(k);return jsx(He.Provider,{value:{optionsListRef:i,inputRef:t,autocompleteId:o,inputRect:p,showChips:n,filteredOptions:s,currentFocus:u,popoverPosition:x,setFilteredOptions:c,setCurrentFocus:b,setShowChips:r,setPopoverPosition:v,setInputRect:l,optionsListHeight:C,optionsListRect:h,setOptionsListRect:g,setOptionsListHeight:a},children:e})};var ct=({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})},Se=ct;var ft=150,bt=be.memo(({selectedOptions:e,error:i,onCleanSelectedOptions:t,disabled:o,size:p})=>{let{autocompleteId:l,inputRect:n,inputRef:r,optionsListRef:s}=F(),c=be.useRef(null),[u,b]=be.useState(new Map),x=useMemo(()=>{if(!n?.width)return [];let h=0,g=n.width-ft,C=0;for(let a=0;a<e.length&&(C+=u.get(a)??0,!(C>g));a++)h++;return e.slice(0,h)},[n?.width,e,u]),v=useCallback(()=>{o||(r?.current?.focus(),s.current.style.display="flex");},[o]);return jsxs("div",{onClick:v,className:a$1("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:c,children:x.map((h,g)=>jsx(Se,{option:h,onMountWidth:C=>b(a=>new Map(a).set(g,C)),size:p},`chip-input-${l}-${h.value}`))}),e.length>x.length&&jsx("span",{className:"text-base",children:"..."}),e.length>0&&!i&&jsx(a$2,{content:String(e.length),size:p}),i&&e.length>0&&jsx(c$1,{className:"h-6 w-6 text-error-700",onClick:h=>{h.stopPropagation(),t();}})]})}),Be=bt;var vt=be.memo(({option:e,index:i,onPressOption:t,isSelected:o,optionDescriptionLines:p})=>{let{currentFocus:l,inputRef:n}=F();return jsx(De,{title:e.label,checked:o,disabled:e.disabled,className:l===i?"bg-primary-200":void 0,onMouseDown:r=>{e.disabled||(n?.current?.value&&r.preventDefault(),t?.(e,r));},description:e.description,descriptionLines:p})}),he=vt;var Mt=be.memo(({selectedOptions:e,handleSelect:i,NoResultsIcon:t,noResultsLabel:o,noResultsDescription:p,noResultsDescriptionLines:l,noResultsAsColumn:n,noResultsButtonOnClick:r,optionDescriptionLines:s,noResultsButtonLabel:c$1})=>{let{popoverPosition:u,optionsListRef:b,filteredOptions:x,inputRect:v,autocompleteId:h,inputRef:g,optionsListHeight:C}=F(),a$1=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(Oe.Root,{asChild:true,children:jsxs("div",{ref:b,className:"elevation-8 pointer-events-auto fixed z-10000 mb-2 hidden w-full flex-col overflow-y-auto rounded-lg bg-neutral-50",style:v?{width:`${v.width}px`,left:v.left,top:u==="bottom"?`${v.bottom}px`:void 0,bottom:u==="top"?`${window.innerHeight-v.top}px`:void 0,maxHeight:C+"px"}:void 0,children:[x.length===0&&jsxs("div",{className:"elevation-8 flex max-h-88 flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(ne,{title:o,description:p,Icon:t,iconAsColumn:n,descriptionLines:l}),r&&jsxs(Fragment,{children:[jsx(a,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:L=>{b.current.style.display="none",g.current.value="",r();},children:c$1})]})]}),N.map((L,P)=>jsx(he,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$1(L),optionDescriptionLines:s},`autocomplete-option-${h}-${L.key??L.value}`)),x.map((L,P)=>!e.some(m=>m.value===L.value)&&jsx(he,{option:L,index:P,onPressOption:m=>i(m),isSelected:a$1(L),optionDescriptionLines:s},`autocomplete-option-${h}-${L.key??L.value}`))]})})}),We=Mt;var wt=be.memo(({selectedOptions:e,onSelect:i,error:t,helperText:o,label:p,placeholder:l,options:n,onInputChange:r,size:s,disabled:c})=>{let{setCurrentFocus:u,setFilteredOptions:b,optionsListRef:x,inputRef:v}=F();return jsx(a$3,{ref:v,autoComplete:"off",list:"",disabled:c,selectMode:true,onChange:h=>{u(-1),r?.(h.target.value);},onClean:()=>{u(-1),b(n),i?.(null,e);},onClick:()=>{c||(x.current.style.display="flex");},error:t,helperText:o,label:p,placeholder:l,fixedTopLabel:e.length>0,size:s})}),Ve=wt;var Ge=({options:e,defaultSelectedOptions:i,onSelect:t,error:o,helperText:p,label:l,placeholder:n,noResultsLabel:r,noResultsIcon:s,noResultsDescription:c,noResultsDescriptionLines:u,noResultsAsColumn:b,noResultsButtonOnClick:x,noResultsButtonLabel:v,className:h,onInputChange:g,value:C,loading:a,size:N="md",optionDescriptionLines:L=1,disabled:P})=>{let{inputRef:m,optionsListRef:A,setFilteredOptions:O,setShowChips:d,setInputRect:le,setPopoverPosition:se,setCurrentFocus:pe,showChips:B,setOptionsListRect:ue,optionsListRect:z,setOptionsListHeight:X}=F(),j=useRef(false),[U,W]=useState(i??[]),w=useCallback(M=>{W(y=>{let D,J=y.findIndex(Ue=>Ue.value===M.value);return J===-1?(D=y.concat(M),t?.(M,D),D):(D=y.toSpliced(J,1),t?.(M,D),D)});},[t]),q=useCallback(()=>{W([]),O(e),t?.(null,[]);},[]),R=useCallback(()=>{d(false);},[]),E=useCallback(()=>{d(true);},[]),I=useCallback(()=>{if(!m?.current)return;let M=m.current.getBoundingClientRect();le(M);let y=z?z.height>k?k:z.height:k,D=window.innerHeight-M.bottom>y,J=M.top>y;se(D?"bottom":J?"top":"bottom"),X(J?k:window.innerHeight-M.bottom>k?k:window.innerHeight-M.bottom);},[z?.height]),ee=useCallback(()=>{let M=e.filter(y=>y.label.toLowerCase().includes(m?.current?.value.toLowerCase()??""));if(O(M),A?.current){let y=A.current.getBoundingClientRect();ue(y);}},[e,A?.current]);return useEffect(()=>{O(e);},[e]),a$4(A,()=>{A.current.style.display="none",pe(-1);}),useEffect(()=>{if(m?.current)return I(),m.current.addEventListener("mousedown",I),m.current.addEventListener("input",ee),m.current.addEventListener("focusin",R),m.current.addEventListener("focusout",E),window.addEventListener("scroll",I,true),window.addEventListener("resize",I),()=>{m.current?.removeEventListener("mousedown",I),m.current?.removeEventListener("input",I),m.current?.removeEventListener("focusout",E),m.current?.removeEventListener("focusin",R),window.removeEventListener("scroll",I,true),window.removeEventListener("resize",I);}},[I,E,R,ee]),useEffect(()=>{C&&(W(C),d(true));},[C]),useEffect(()=>{a||i&&i.length&&!j.current&&(W(i),j.current=true,d(true));},[i,a]),jsxs("div",{className:a$1("relative",h),children:[jsx(Ve,{selectedOptions:U,onSelect:t,error:o,helperText:p,label:l,placeholder:n,handleSelect:w,options:e,onInputChange:g,size:N,disabled:P}),B&&jsx(Be,{selectedOptions:U,disabled:P,error:o,onCleanSelectedOptions:q,size:N}),jsx(We,{handleSelect:w,selectedOptions:U,noResultsLabel:r,NoResultsIcon:s,optionDescriptionLines:L,noResultsAsColumn:b,noResultsButtonLabel:v,noResultsButtonOnClick:x,noResultsDescription:c,noResultsDescriptionLines:u})]})};var Ei=e=>jsx(Ne,{children:jsx(Ge,{...e})});var Bi=({children:e,title:i,titleLines:t=1,description:o,descriptionLines:p=1,StartIcon:l,hasDivider:n=false,disabled:r=false,actionButton:s,isSelected:c$1=false,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:r,hasDivider:n,isSelected:c$1,...b,className:u,children:[l&&jsx(l,{className:"mr-2 h-4.5 w-4.5 shrink-0 grow-0"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:r}),s&&jsx(Fragment,{children:s.isIcon?jsx(c$3,{...s,className:"ml-4 self-center",variant:"ghost",size:"sm",disabled:r??s.disabled}):jsx(c,{...s,className:"ml-4 self-center",size:"sm",variant:"ghost",disabled:r??s.disabled})})]});var Dt=({children:e,hasDescription:i=false,disabled:t=false,hasDivider:o=false,className:p,isSelected:l,onClick:n,...r})=>jsxs(Fragment,{children:[jsx("div",{className:a$1("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",l&&"bg-primary-200",p),onClick:s=>{t||n?.(s);},...r,children:e}),o&&jsx(a,{})]}),H=Dt;var Ie=({children:e,title:i,titleLines:t,description:o="",descriptionLines:p,startIcon:l,endIcon:n,hasDivider:r=false,disabled:s=false,isSelected:c=false,className:u,...b})=>jsxs(H,{hasDescription:!!o,disabled:s,hasDivider:r,className:u,isSelected:c,...b,children:[l&&be.cloneElement(l,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(T,{title:i,titleLines:t,description:o,descriptionLines:p,disabled:s}),n&&be.cloneElement(n,{className:"min-h-4.5 min-w-4.5 self-center ml-4"})]});export{oo as a,Ie as b,bo as c,De as d,Ei as e,Bi as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as Drawer,e as DrawerClose,g as DrawerContent,k as DrawerDescription,i as DrawerFooter,h as DrawerHeader,f as DrawerOverlay,d as DrawerPortal,a as DrawerSizes,j as DrawerTitle,c as DrawerTrigger}from'../chunk-
|
|
1
|
+
export{b as Drawer,e as DrawerClose,g as DrawerContent,k as DrawerDescription,i as DrawerFooter,h as DrawerHeader,f as DrawerOverlay,d as DrawerPortal,a as DrawerSizes,j as DrawerTitle,c as DrawerTrigger}from'../chunk-SSXC2FWW.mjs';import'../chunk-7NJTMO4L.mjs';import'../chunk-35JUETHD.mjs';import'../chunk-ANNKZIP4.mjs';import'../chunk-T2IU5QUU.mjs';import'../chunk-FSC7SJ6L.mjs';import'../chunk-4HYLZVI5.mjs';import'../chunk-BO6XI5BE.mjs';
|