sodtrack-web-ui 0.57.5 → 0.57.6
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-6JFWU4UG.mjs +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/list-item-arrow.mjs +1 -1
- package/dist/list-item-button.d.mts +1 -0
- package/dist/list-item-button.d.ts +1 -0
- package/dist/list-item-button.js +1 -1
- package/dist/list-item-button.mjs +1 -1
- package/dist/list-item-checkbox.mjs +1 -1
- package/dist/list-item.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-XNGBZQAU.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$5}from'./chunk-KTRSJBA4.mjs';import {c as c$3}from'./chunk-WS2F7JWJ.mjs';import {a as a$4}from'./chunk-IOSO66TV.mjs';import {a}from'./chunk-QHBCNAWO.mjs';import {c as c$2}from'./chunk-FXWF3IBH.mjs';import {d}from'./chunk-VZKFL2XP.mjs';import {a as a$1}from'./chunk-WGMDH4XX.mjs';import {a as a$3}from'./chunk-BVHU5ZT3.mjs';import {c}from'./chunk-DZLL7IH6.mjs';import {c as c$1,h}from'./chunk-XJSC6PKJ.mjs';import {a as a$2}from'./chunk-2WINTZSS.mjs';import ht,{createContext,useMemo,useCallback,useState,useRef,useEffect,useContext,useId}from'react';import*as At from'@radix-ui/react-portal';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var _t=({title:t,titleLines:a=2,description:e,descriptionLines:r=1,Icon:c,iconAsColumn:n=!0,className:o,...i})=>jsxs("div",{className:a$2("flex gap-2 py-4 pl-4 pr-6",n&&"flex-col items-center gap-1",!n&&!e&&"items-center"),...i,children:[c&&jsx(c,{className:a$2("shrink-0 text-neutral-300"),size:24}),jsxs("div",{className:a$2("flex flex-col gap-1",n&&"text-center"),children:[jsx("p",{className:a$2("leading-[130%] text-neutral-500",!!e&&"font-medium"),style:a?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:a}:void 0,children:t}),e&&jsx("p",{className:"text-sm leading-[130%] text-neutral-500",style:r?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:r}:void 0,children:e})]})]}),it=_t;var Jt=ht.memo(({handleSelect:t,NoResultsIcon:a$3,noResultsLabel:e,noResultsDescription:r,noResultsDescriptionLines:c$1,noResultsAsColumn:n,noResultsButtonOnClick:o,optionDescriptionLines:i,noResultsButtonLabel:s,filteredOptions:d,inputRect:l,inputRef:b,popoverPosition:x,optionsListRef:k,selectedOption:w,options:z,setFilteredOptions:v})=>jsx(At.Root,{asChild:!0,children:jsx("div",{ref:k,className:"pointer-events-auto fixed z-50 hidden w-full",style:l?{width:`${l.width}px`,left:l.left,top:x==="bottom"?`${l.bottom}px`:void 0,bottom:x==="top"?`${window.innerHeight-l.top}px`:void 0}:void 0,children:jsxs(a,{className:"elevation-8 mb-2 flex max-h-[336px] w-full flex-col rounded-lg bg-neutral-50",children:[d.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(it,{title:e,description:r,Icon:a$3,iconAsColumn:n,descriptionLines:c$1}),o&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:m=>{k.current.style.display="none",b.current.value="",v(z),o();},children:s})]})]}),d.map(m=>jsx(Ot,{title:m.label,disabled:m.disabled,description:m.description,descriptionLines:i,onClick:()=>t(m),className:a$2(w?.value===m.value&&"bg-primary-200")},m.key??m.value))]})})})),Mt=Jt;var Qt=336,nr=({options:t,defaultSelectedOption:a,onSelect:e,onClick:r,onInputChange:c,error:n,helperText:o,label:i,placeholder:s,value:d,size:l="md",optionDescriptionLines:b=1,noResultsLabel:x,noResultsIcon:k,noResultsDescription:w,noResultsDescriptionLines:z,noResultsAsColumn:v,noResultsButtonOnClick:m,noResultsButtonLabel:M,className:G,disabled:h})=>{let[p,y]=useState(a??null),R=useRef(null),g=useRef(null),[st,ct]=useState(),[lt,N]=useState([]),[dt,X]=useState("bottom"),[U,Z]=useState(),$=Qt,Y=useCallback(f=>{R.current.style.display="none",g.current.value=f.label,y(f),e?.(f);},[e]),C=useCallback(()=>{if(!g?.current)return;let f=g.current.getBoundingClientRect();ct(f);let O=U?U.height:$,A=window.innerHeight-f.bottom>O,tt=f.top>O;X(A?"bottom":tt?"top":"bottom");},[U?.height]),_=useCallback(()=>{let f=t.filter(O=>O.label.toLowerCase().includes(g?.current?.value.toLowerCase()??""));if(N(f),R?.current){let O=R.current.getBoundingClientRect();Z(O);}},[t]);return useEffect(()=>{N(t);},[t]),useEffect(()=>{if(!d){y(null),g.current&&(g.current.value="");return}(!g.current?.value||p?.value!==d.value)&&(y(d),g.current.value=d.label);},[d]),a$5(R,()=>{R.current.style.display="none",p&&g.current&&(g.current.value=p.label);}),useEffect(()=>{if(g?.current)return C(),g.current.addEventListener("mousedown",C),g.current.addEventListener("input",_),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{g.current?.removeEventListener("mousedown",C),g.current?.removeEventListener("input",_),window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C);}},[C,_]),jsxs("div",{className:a$2("relative",G),children:[jsx(a$4,{ref:g,autoComplete:"off",list:"",selectMode:!0,onChange:f=>{f.target.value||(y(null),e?.(null)),c?.(f);},onClean:()=>{y(null),N(t),e?.(null);},onClick:f=>{R.current.style.display="flex",r?.(f);},onBlur:()=>{p&&g.current&&(g.current.value=p.label);},label:i,helperText:o,placeholder:s,size:l,error:n,disabled:h}),jsx(Mt,{handleSelect:Y,noResultsLabel:x,NoResultsIcon:k,optionDescriptionLines:b,noResultsAsColumn:v,noResultsButtonLabel:M,noResultsButtonOnClick:m,noResultsDescription:w,noResultsDescriptionLines:z,filteredOptions:lt,inputRect:st,inputRef:g,popoverPosition:dt,optionsListRef:R,selectedOption:p,options:t,setFilteredOptions:N})]})};var te=({children:t,title:a,titleLines:e,description:r="",descriptionLines:c,disabled:n=!1,className:o,...i})=>jsxs("div",{className:"flex w-full flex-col gap-1",...i,children:[jsx("p",{className:a$2("break-all text-sm leading-[130%]",!!r&&"font-medium"),style:e?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:e}:void 0,children:a}),r&&jsx("p",{className:a$2("text-xs leading-[130%]",n?"text-neutral-400":"text-neutral-700"),style:c?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:c}:void 0,children:r})]}),F=te;var vr=({children:t,title:a,titleLines:e,description:r="",descriptionLines:c,startIcon:n,badgeContent:o,hasDivider:i=!1,disabled:s=!1,onSelect:d,className:l,...b})=>jsxs(D,{hasDescription:!!r,disabled:s,onClick:d,hasDivider:i,className:a$2(!s&&"cursor-pointer",l),...b,children:[n&&ht.cloneElement(n,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(F,{title:a,titleLines:e,description:r,descriptionLines:c,disabled:s}),jsxs("div",{className:"ml-4 flex gap-2",children:[o&&jsx(a$3,{content:o,size:"lg",variant:"alert",className:a$2("self-center",s&&"bg-neutral-400")}),jsx(h,{className:"h-4.5 w-4.5 self-center"})]})]});var Dt=({children:t,title:a,titleLines:e=1,description:r="",descriptionLines:c,startIcon:n,hasDivider:o=!1,disabled:i=!1,checked:s,onCheckedChange:d,className:l,...b})=>jsxs(D,{hasDescription:!!r,disabled:i,hasDivider:o,...b,className:a$2("pr-6",l),children:[n&&ht.cloneElement(n,{className:"shrink-0 w-4.5 h-4.5 mr-2"}),jsx(F,{title:a,titleLines:e,description:r,descriptionLines:c,disabled:i}),jsx(c$2,{size:"sm",checked:s,onCheckedChange:d,className:"ml-4 self-center",disabled:i})]});var S=336,Tt=createContext({inputRef:null,optionsListRef:null,scrollAreaRef:null,autocompleteId:"",inputRect:void 0,showChips:!1,filteredOptions:[],currentFocus:-1,popoverPosition:"bottom",setFilteredOptions:()=>{},setCurrentFocus:()=>{},setShowChips:()=>{},setPopoverPosition:()=>{},setInputRect:()=>{},optionsListHeight:S,setOptionsListHeight:()=>{},optionsListRect:void 0,setOptionsListRect:()=>{}}),P=()=>{let t=useContext(Tt);if(t===null)throw new Error("useAutocompleteMultipleContext must be used within a AutocompleteMultipleProvider");return t},Ht=({children:t})=>{let a=useRef(null),e=useRef(null),r=useRef(null),c=useId(),[n,o]=useState(),[i,s]=useState(!0),[d,l]=useState([]),[b,x]=useState(-1),[k,w]=useState("bottom"),[z,v]=useState(),[m,M]=useState(S);return jsx(Tt.Provider,{value:{optionsListRef:a,inputRef:e,scrollAreaRef:r,autocompleteId:c,inputRect:n,showChips:i,filteredOptions:d,currentFocus:b,popoverPosition:k,setFilteredOptions:l,setCurrentFocus:x,setShowChips:s,setPopoverPosition:w,setInputRect:o,optionsListHeight:m,optionsListRect:z,setOptionsListRect:v,setOptionsListHeight:M},children:t})};var pe=({option:t,onMountWidth:a,size:e})=>{let r=useRef(null);return useEffect(()=>{r.current&&a?.(r.current.clientWidth);},[]),jsx(d,{type:"fill",variant:"standard",ref:r,className:"flex-shrink-0",size:e==="md"?"xs":"sm",hasCloseIcon:!1,children:t.label})},Nt=pe;var ue=150,be=ht.memo(({selectedOptions:t,error:a,onCleanSelectedOptions:e,disabled:r,size:c})=>{let{autocompleteId:n,inputRect:o,inputRef:i,optionsListRef:s}=P(),d=ht.useRef(null),[l,b]=ht.useState(new Map),x=useMemo(()=>{if(!o?.width)return [];let w=0,z=o.width-ue,v=0;for(let m=0;m<t.length&&(v+=l.get(m)??0,!(v>z));m++)w++;return t.slice(0,w)},[o?.width,t,l]),k=useCallback(()=>{r||(i?.current?.focus(),s.current.style.display="flex");},[r]);return jsxs("div",{onClick:k,className:a$2("absolute top-0 z-30 flex w-full cursor-pointer flex-nowrap items-center gap-2 pl-3 pr-12",r&&"cursor-not-allowed"),style:{maxWidth:o?.width?o?.width:void 0,height:o?.height?o?.height:void 0},children:[jsx("div",{className:"flex flex-1 gap-1 overflow-hidden",ref:d,children:x.map((w,z)=>jsx(Nt,{option:w,onMountWidth:v=>b(m=>new Map(m).set(z,v)),size:c},`chip-input-${n}-${w.value}`))}),t.length>x.length&&jsx("span",{className:"text-base",children:"..."}),t.length>0&&!a&&jsx(a$3,{content:String(t.length),size:c}),a&&t.length>0&&jsx(c$1,{className:"h-6 w-6 text-error-700",onClick:w=>{w.stopPropagation(),e();}})]})}),Xt=be;var fe=ht.memo(({option:t,index:a,onPressOption:e,isSelected:r,optionDescriptionLines:c})=>{let{currentFocus:n,inputRef:o}=P();return jsx(Dt,{title:t.label,checked:r,disabled:t.disabled,className:n===a?"bg-primary-200":void 0,onMouseDown:i=>{t.disabled||(o?.current?.value&&i.preventDefault(),e?.(t,i));},description:t.description,descriptionLines:c})}),vt=fe;var Le=ht.memo(({selectedOptions:t,handleSelect:a$2,NoResultsIcon:e,noResultsLabel:r,noResultsDescription:c$1,noResultsDescriptionLines:n,noResultsAsColumn:o,noResultsButtonOnClick:i,optionDescriptionLines:s,noResultsButtonLabel:d})=>{let{popoverPosition:l,scrollAreaRef:b,optionsListRef:x,filteredOptions:k,inputRect:w,autocompleteId:z,inputRef:v,optionsListHeight:m}=P(),M=useCallback(h=>t.some(p=>p.value===h.value),[t]),G=useMemo(()=>t.filter(h=>h.label.toLowerCase().includes(v?.current?.value.toLowerCase()??"")),[t,v?.current?.value]);return jsx(At.Root,{asChild:!0,children:jsx("div",{ref:x,className:"pointer-events-auto fixed z-50 hidden w-full",style:w?{width:`${w.width}px`,left:w.left,top:l==="bottom"?`${w.bottom}px`:void 0,bottom:l==="top"?`${window.innerHeight-w.top}px`:void 0}:void 0,children:jsxs(a,{className:"elevation-8 mb-2 flex w-full flex-col rounded-lg bg-neutral-50",style:{maxHeight:m+"px"},ref:b,children:[k.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(it,{title:r,description:c$1,Icon:e,iconAsColumn:o,descriptionLines:n}),i&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:h=>{x.current.style.display="none",v.current.value="",i();},children:d})]})]}),G.map((h,p)=>jsx(vt,{option:h,index:p,onPressOption:y=>a$2(y),isSelected:M(h),optionDescriptionLines:s},`autocomplete-option-${z}-${h.key??h.value}`)),k.map((h,p)=>!t.some(y=>y.value===h.value)&&jsx(vt,{option:h,index:p,onPressOption:y=>a$2(y),isSelected:M(h),optionDescriptionLines:s},`autocomplete-option-${z}-${h.key??h.value}`))]})})})}),Bt=Le;var Ae=ht.memo(({selectedOptions:t,onSelect:a,error:e,helperText:r,label:c,placeholder:n,options:o,onInputChange:i,size:s,disabled:d})=>{let{setCurrentFocus:l,setFilteredOptions:b,optionsListRef:x,inputRef:k}=P();return jsx(a$4,{ref:k,autoComplete:"off",list:"",disabled:d,selectMode:!0,onChange:w=>{l(-1),i?.(w.target.value);},onClean:()=>{l(-1),b(o),a?.(null,t);},onClick:()=>{d||(x.current.style.display="flex");},error:e,helperText:r,label:c,placeholder:n,fixedTopLabel:t.length>0,size:s})}),Wt=Ae;var jt=({options:t,defaultSelectedOptions:a,onSelect:e,error:r,helperText:c,label:n,placeholder:o,noResultsLabel:i,noResultsIcon:s,noResultsDescription:d,noResultsDescriptionLines:l,noResultsAsColumn:b,noResultsButtonOnClick:x,noResultsButtonLabel:k,className:w,onInputChange:z,value:v,loading:m,size:M="md",optionDescriptionLines:G=1,disabled:h})=>{let{inputRef:p,optionsListRef:y,setFilteredOptions:R,setShowChips:g,setInputRect:st,setPopoverPosition:ct,setCurrentFocus:lt,showChips:N,setOptionsListRect:dt,optionsListRect:X,setOptionsListHeight:U}=P(),Z=useRef(!1),[$,Y]=useState(a??[]),C=useCallback(L=>{Y(I=>{let E,q=I.findIndex($t=>$t.value===L.value);return q===-1?(E=I.concat(L),e?.(L,E),E):(E=I.toSpliced(q,1),e?.(L,E),E)});},[e]),_=useCallback(()=>{Y([]),R(t),e?.(null,[]);},[]),f=useCallback(()=>{g(!1);},[]),O=useCallback(()=>{g(!0);},[]),A=useCallback(()=>{if(!p?.current)return;let L=p.current.getBoundingClientRect();st(L);let I=X?X.height>S?S:X.height:S,E=window.innerHeight-L.bottom>I,q=L.top>I;ct(E?"bottom":q?"top":"bottom"),U(q?S:window.innerHeight-L.bottom>S?S:window.innerHeight-L.bottom);},[X?.height]),tt=useCallback(()=>{let L=t.filter(I=>I.label.toLowerCase().includes(p?.current?.value.toLowerCase()??""));if(R(L),y?.current){let I=y.current.getBoundingClientRect();dt(I);}},[t,y?.current]);return useEffect(()=>{R(t);},[t]),a$5(y,()=>{y.current.style.display="none",lt(-1);}),useEffect(()=>{if(p?.current)return A(),p.current.addEventListener("mousedown",A),p.current.addEventListener("input",tt),p.current.addEventListener("focusin",f),p.current.addEventListener("focusout",O),window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{p.current?.removeEventListener("mousedown",A),p.current?.removeEventListener("input",A),p.current?.removeEventListener("focusout",O),p.current?.removeEventListener("focusin",f),window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A);}},[A,O,f,tt]),useEffect(()=>{v&&(Y(v),g(!0));},[v]),useEffect(()=>{m||a&&a.length&&!Z.current&&(Y(a),Z.current=!0,g(!0));},[a,m]),jsxs("div",{className:a$2("relative",w),children:[jsx(Wt,{selectedOptions:$,onSelect:e,error:r,helperText:c,label:n,placeholder:o,handleSelect:C,options:t,onInputChange:z,size:M,disabled:h}),N&&jsx(Xt,{selectedOptions:$,disabled:h,error:r,onCleanSelectedOptions:_,size:M}),jsx(Bt,{handleSelect:C,selectedOptions:$,noResultsLabel:i,NoResultsIcon:s,optionDescriptionLines:G,noResultsAsColumn:b,noResultsButtonLabel:k,noResultsButtonOnClick:x,noResultsDescription:d,noResultsDescriptionLines:l})]})};var Ea=t=>jsx(Ht,{children:jsx(jt,{...t})});var Wa=({children:t,title:a,titleLines:e=1,description:r,descriptionLines:c$1=1,StartIcon:n,hasDivider:o=!1,disabled:i=!1,actionButton:s,isSelected:d=!1,className:l,...b})=>jsxs(D,{hasDescription:!!r,disabled:i,hasDivider:o,isSelected:d,...b,className:l,children:[n&&jsx(n,{className:"mr-2 h-4.5 w-4.5 shrink-0 flex-grow-0"}),jsx(F,{title:a,titleLines:e,description:r,descriptionLines:c$1,disabled:i}),s&&jsx(Fragment,{children:s.isIcon?jsx(c$3,{...s,className:"ml-4 self-center",variant:"ghost",size:"sm",disabled:i??s.disabled}):jsx(c,{...s,className:"ml-4 self-center",size:"sm",variant:"ghost",disabled:i??s.disabled})})]});var Fe=({children:t,hasDescription:a=!1,disabled:e=!1,hasDivider:r=!1,className:c,isSelected:n,onClick:o,...i})=>jsxs(Fragment,{children:[jsx("div",{className:a$2("flex flex-row px-3 py-4 text-neutral-900 transition-colors",a?"py-3":"py-[0.875rem]",e?"cursor-not-allowed text-neutral-400":"hover:bg-primary-100 focus:bg-primary-200",n&&"bg-primary-200",c),onClick:s=>{e||o?.(s);},...i,children:t}),r&&jsx(a$1,{})]}),D=Fe;var Ot=({children:t,title:a,titleLines:e,description:r="",descriptionLines:c,startIcon:n,endIcon:o,hasDivider:i=!1,disabled:s=!1,isSelected:d=!1,className:l,...b})=>jsxs(D,{hasDescription:!!r,disabled:s,hasDivider:i,className:l,isSelected:d,...b,children:[n&&ht.cloneElement(n,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(F,{title:a,titleLines:e,description:r,descriptionLines:c,disabled:s}),o&&ht.cloneElement(o,{className:"min-h-4.5 min-w-4.5 self-center ml-4"})]});export{nr as a,Ot as b,vr as c,Dt as d,Ea as e,Wa as f};
|