sodtrack-web-ui 0.57.2 → 0.57.4
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-6FW654CF.mjs +1 -0
- package/dist/{chunk-ZV7ZHTB4.mjs → chunk-RYJJ3ZR2.mjs} +1 -1
- package/dist/chunk-XNGBZQAU.mjs +1 -0
- package/dist/common.css +4 -0
- package/dist/data-table.js +1 -1
- package/dist/data-table.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/list-item-arrow.css +1 -1
- package/dist/list-item-arrow.mjs +1 -1
- package/dist/list-item-button.css +1 -1
- package/dist/list-item-button.mjs +1 -1
- package/dist/list-item-checkbox.css +1 -1
- package/dist/list-item-checkbox.mjs +1 -1
- package/dist/list-item.css +1 -1
- package/dist/list-item.mjs +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-CVM45EM4.mjs +0 -1
- package/dist/chunk-JMR5RBBN.mjs +0 -1
package/dist/chunk-JMR5RBBN.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a as a$5}from'./chunk-KTRSJBA4.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 bt,{createContext,useMemo,useCallback,useState,useRef,useEffect,useContext,useId}from'react';import*as Lt from'@radix-ui/react-portal';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var Ut=({title:t,titleLines:a=2,description:e,descriptionLines:r=1,Icon:s,iconAsColumn:i=!0,className:o,...n})=>jsxs("div",{className:a$2("flex gap-2 py-4 pl-4 pr-6",i&&"flex-col items-center gap-1",!i&&!e&&"items-center"),...n,children:[s&&jsx(s,{className:a$2("shrink-0 text-neutral-300"),size:24}),jsxs("div",{className:a$2("flex flex-col gap-1",i&&"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})]})]}),ot=Ut;var _t=bt.memo(({handleSelect:t,NoResultsIcon:a$3,noResultsLabel:e,noResultsDescription:r,noResultsDescriptionLines:s,noResultsAsColumn:i,noResultsButtonOnClick:o,optionDescriptionLines:n,noResultsButtonLabel:c$1,filteredOptions:d,inputRect:l,inputRef:h,popoverPosition:x,optionsListRef:k,selectedOption:w,options:z,setFilteredOptions:v})=>jsx(Lt.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(ot,{title:e,description:r,Icon:a$3,iconAsColumn:i,descriptionLines:s}),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",h.current.value="",v(z),o();},children:c$1})]})]}),d.map(m=>jsx(Mt,{title:m.label,disabled:m.disabled,description:m.description,descriptionLines:n,onClick:()=>t(m),className:a$2(w?.value===m.value&&"bg-primary-200")},m.key??m.value))]})})})),Ct=_t;var Jt=336,rr=({options:t,defaultSelectedOption:a,onSelect:e,onClick:r,onInputChange:s,error:i,helperText:o,label:n,placeholder:c,value:d,size:l="md",optionDescriptionLines:h=1,noResultsLabel:x,noResultsIcon:k,noResultsDescription:w,noResultsDescriptionLines:z,noResultsAsColumn:v,noResultsButtonOnClick:m,noResultsButtonLabel:A,className:V,disabled:b})=>{let[p,y]=useState(a??null),L=useRef(null),g=useRef(null),[nt,st]=useState(),[ct,T]=useState([]),[lt,H]=useState("bottom"),[G,K]=useState(),U=Jt,X=useCallback(f=>{L.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();st(f);let O=G?G.height:U,M=window.innerHeight-f.bottom>O,Q=f.top>O;H(M?"bottom":Q?"top":"bottom");},[G?.height]),$=useCallback(()=>{let f=t.filter(O=>O.label.toLowerCase().includes(g?.current?.value.toLowerCase()??""));if(T(f),L?.current){let O=L.current.getBoundingClientRect();K(O);}},[t]);return useEffect(()=>{T(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(L,()=>{L.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",V),children:[jsx(a$4,{ref:g,autoComplete:"off",list:"",selectMode:!0,onChange:f=>{f.target.value||(y(null),e?.(null)),s?.(f);},onClean:()=>{y(null),T(t),e?.(null);},onClick:f=>{L.current.style.display="flex",r?.(f);},onBlur:()=>{p&&g.current&&(g.current.value=p.label);},label:n,helperText:o,placeholder:c,size:l,error:i,disabled:b}),jsx(Ct,{handleSelect:X,noResultsLabel:x,NoResultsIcon:k,optionDescriptionLines:h,noResultsAsColumn:v,noResultsButtonLabel:A,noResultsButtonOnClick:m,noResultsDescription:w,noResultsDescriptionLines:z,filteredOptions:ct,inputRect:nt,inputRef:g,popoverPosition:lt,optionsListRef:L,selectedOption:p,options:t,setFilteredOptions:T})]})};var Qt=({children:t,title:a,titleLines:e,description:r="",descriptionLines:s,disabled:i=!1,className:o,...n})=>jsxs("div",{className:"flex w-full flex-col gap-1",...n,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%]",i?"text-neutral-400":"text-neutral-700"),style:s?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:s}:void 0,children:r})]}),B=Qt;var mr=({children:t,title:a,titleLines:e,description:r="",descriptionLines:s,startIcon:i,badgeContent:o,hasDivider:n=!1,disabled:c=!1,onSelect:d,className:l,...h$1})=>jsxs(W,{hasDescription:!!r,disabled:c,onClick:d,hasDivider:n,className:a$2(!c&&"cursor-pointer",l),...h$1,children:[i&&bt.cloneElement(i,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(B,{title:a,titleLines:e,description:r,descriptionLines:s,disabled:c}),jsxs("div",{className:"ml-4 flex gap-2",children:[o&&jsx(a$3,{content:o,size:"lg",variant:"alert",className:a$2("self-center",c&&"bg-neutral-400")}),jsx(h,{className:"h-4.5 w-4.5 self-center"})]})]});var St=({children:t,title:a,titleLines:e=1,description:r="",descriptionLines:s,startIcon:i,hasDivider:o=!1,disabled:n=!1,checked:c,onCheckedChange:d,className:l,...h})=>jsxs(W,{hasDescription:!!r,disabled:n,hasDivider:o,...h,className:a$2("pr-6",l),children:[i&&bt.cloneElement(i,{className:"shrink-0 w-4.5 h-4.5 mr-2"}),jsx(B,{title:a,titleLines:e,description:r,descriptionLines:s,disabled:n}),jsx(c$2,{size:"sm",checked:c,onCheckedChange:d,className:"ml-4 self-center",disabled:n})]});var E=336,Ft=createContext({inputRef:null,optionsListRef:null,scrollAreaRef:null,autocompleteId:"",inputRect:void 0,showChips:!1,filteredOptions:[],currentFocus:-1,popoverPosition:"bottom",setFilteredOptions:()=>{},setCurrentFocus:()=>{},setShowChips:()=>{},setPopoverPosition:()=>{},setInputRect:()=>{},optionsListHeight:E,setOptionsListHeight:()=>{},optionsListRect:void 0,setOptionsListRect:()=>{}}),I=()=>{let t=useContext(Ft);if(t===null)throw new Error("useAutocompleteMultipleContext must be used within a AutocompleteMultipleProvider");return t},Dt=({children:t})=>{let a=useRef(null),e=useRef(null),r=useRef(null),s=useId(),[i,o]=useState(),[n,c]=useState(!0),[d,l]=useState([]),[h,x]=useState(-1),[k,w]=useState("bottom"),[z,v]=useState(),[m,A]=useState(E);return jsx(Ft.Provider,{value:{optionsListRef:a,inputRef:e,scrollAreaRef:r,autocompleteId:s,inputRect:i,showChips:n,filteredOptions:d,currentFocus:h,popoverPosition:k,setFilteredOptions:l,setCurrentFocus:x,setShowChips:c,setPopoverPosition:w,setInputRect:o,optionsListHeight:m,optionsListRect:z,setOptionsListRect:v,setOptionsListHeight:A},children:t})};var le=({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})},Tt=le;var we=150,me=bt.memo(({selectedOptions:t,error:a,onCleanSelectedOptions:e,disabled:r,size:s})=>{let{autocompleteId:i,inputRect:o,inputRef:n,optionsListRef:c}=I(),d=bt.useRef(null),[l,h]=bt.useState(new Map),x=useMemo(()=>{if(!o?.width)return [];let w=0,z=o.width-we,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||(n?.current?.focus(),c.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(Tt,{option:w,onMountWidth:v=>h(m=>new Map(m).set(z,v)),size:s},`chip-input-${i}-${w.value}`))}),t.length>x.length&&jsx("span",{className:"text-base",children:"..."}),t.length>0&&!a&&jsx(a$3,{content:String(t.length),size:s}),a&&t.length>0&&jsx(c$1,{className:"h-6 w-6 text-error-700",onClick:w=>{w.stopPropagation(),e();}})]})}),Ht=me;var he=bt.memo(({option:t,index:a,onPressOption:e,isSelected:r,optionDescriptionLines:s})=>{let{currentFocus:i,inputRef:o}=I();return jsx(St,{title:t.label,checked:r,disabled:t.disabled,className:i===a?"bg-primary-200":void 0,onMouseDown:n=>{t.disabled||(o?.current?.value&&n.preventDefault(),e?.(t,n));},description:t.description,descriptionLines:s})}),ht=he;var ke=bt.memo(({selectedOptions:t,handleSelect:a$2,NoResultsIcon:e,noResultsLabel:r,noResultsDescription:s,noResultsDescriptionLines:i,noResultsAsColumn:o,noResultsButtonOnClick:n,optionDescriptionLines:c$1,noResultsButtonLabel:d})=>{let{popoverPosition:l,scrollAreaRef:h,optionsListRef:x,filteredOptions:k,inputRect:w,autocompleteId:z,inputRef:v,optionsListHeight:m}=I(),A=useCallback(b=>t.some(p=>p.value===b.value),[t]),V=useMemo(()=>t.filter(b=>b.label.toLowerCase().includes(v?.current?.value.toLowerCase()??"")),[t,v?.current?.value]);return jsx(Lt.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:h,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(ot,{title:r,description:s,Icon:e,iconAsColumn:o,descriptionLines:i}),n&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:b=>{x.current.style.display="none",v.current.value="",n();},children:d})]})]}),V.map((b,p)=>jsx(ht,{option:b,index:p,onPressOption:y=>a$2(y),isSelected:A(b),optionDescriptionLines:c$1},`autocomplete-option-${z}-${b.key??b.value}`)),k.map((b,p)=>!t.some(y=>y.value===b.value)&&jsx(ht,{option:b,index:p,onPressOption:y=>a$2(y),isSelected:A(b),optionDescriptionLines:c$1},`autocomplete-option-${z}-${b.key??b.value}`))]})})})}),Yt=ke;var Le=bt.memo(({selectedOptions:t,onSelect:a,error:e,helperText:r,label:s,placeholder:i,options:o,onInputChange:n,size:c,disabled:d})=>{let{setCurrentFocus:l,setFilteredOptions:h,optionsListRef:x,inputRef:k}=I();return jsx(a$4,{ref:k,autoComplete:"off",list:"",disabled:d,selectMode:!0,onChange:w=>{l(-1),n?.(w.target.value);},onClean:()=>{l(-1),h(o),a?.(null,t);},onClick:()=>{d||(x.current.style.display="flex");},error:e,helperText:r,label:s,placeholder:i,fixedTopLabel:t.length>0,size:c})}),Nt=Le;var Bt=({options:t,defaultSelectedOptions:a,onSelect:e,error:r,helperText:s,label:i,placeholder:o,noResultsLabel:n,noResultsIcon:c,noResultsDescription:d,noResultsDescriptionLines:l,noResultsAsColumn:h,noResultsButtonOnClick:x,noResultsButtonLabel:k,className:w,onInputChange:z,value:v,loading:m,size:A="md",optionDescriptionLines:V=1,disabled:b})=>{let{inputRef:p,optionsListRef:y,setFilteredOptions:L,setShowChips:g,setInputRect:nt,setPopoverPosition:st,setCurrentFocus:ct,showChips:T,setOptionsListRect:lt,optionsListRect:H,setOptionsListHeight:G}=I(),K=useRef(!1),[U,X]=useState(a??[]),C=useCallback(R=>{X(P=>{let S,_=P.findIndex(Gt=>Gt.value===R.value);return _===-1?(S=P.concat(R),e?.(R,S),S):(S=P.toSpliced(_,1),e?.(R,S),S)});},[e]),$=useCallback(()=>{X([]),L(t),e?.(null,[]);},[]),f=useCallback(()=>{g(!1);},[]),O=useCallback(()=>{g(!0);},[]),M=useCallback(()=>{if(!p?.current)return;let R=p.current.getBoundingClientRect();nt(R);let P=H?H.height>E?E:H.height:E,S=window.innerHeight-R.bottom>P,_=R.top>P;st(S?"bottom":_?"top":"bottom"),G(_?E:window.innerHeight-R.bottom>E?E:window.innerHeight-R.bottom);},[H?.height]),Q=useCallback(()=>{let R=t.filter(P=>P.label.toLowerCase().includes(p?.current?.value.toLowerCase()??""));if(L(R),y?.current){let P=y.current.getBoundingClientRect();lt(P);}},[t,y?.current]);return useEffect(()=>{L(t);},[t]),a$5(y,()=>{y.current.style.display="none",ct(-1);}),useEffect(()=>{if(p?.current)return M(),p.current.addEventListener("mousedown",M),p.current.addEventListener("input",Q),p.current.addEventListener("focusin",f),p.current.addEventListener("focusout",O),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{p.current?.removeEventListener("mousedown",M),p.current?.removeEventListener("input",M),p.current?.removeEventListener("focusout",O),p.current?.removeEventListener("focusin",f),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M);}},[M,O,f,Q]),useEffect(()=>{v&&(X(v),g(!0));},[v]),useEffect(()=>{m||a&&a.length&&!K.current&&(X(a),K.current=!0,g(!0));},[a,m]),jsxs("div",{className:a$2("relative",w),children:[jsx(Nt,{selectedOptions:U,onSelect:e,error:r,helperText:s,label:i,placeholder:o,handleSelect:C,options:t,onInputChange:z,size:A,disabled:b}),T&&jsx(Ht,{selectedOptions:U,disabled:b,error:r,onCleanSelectedOptions:$,size:A}),jsx(Yt,{handleSelect:C,selectedOptions:U,noResultsLabel:n,NoResultsIcon:c,optionDescriptionLines:V,noResultsAsColumn:h,noResultsButtonLabel:k,noResultsButtonOnClick:x,noResultsDescription:d,noResultsDescriptionLines:l})]})};var Oa=t=>jsx(Dt,{children:jsx(Bt,{...t})});var Pe=({children:t,hasDescription:a=!1,disabled:e=!1,hasDivider:r=!1,className:s,isSelected:i,onClick:o,...n})=>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",i&&"bg-primary-200",s),onClick:c=>{e||o?.(c);},...n,children:t}),r&&jsx(a$1,{})]}),W=Pe;var Mt=({children:t,title:a,titleLines:e,description:r="",descriptionLines:s,startIcon:i,endIcon:o,hasDivider:n=!1,disabled:c=!1,isSelected:d=!1,className:l,...h})=>jsxs(W,{hasDescription:!!r,disabled:c,hasDivider:n,className:l,isSelected:d,...h,children:[i&&bt.cloneElement(i,{className:"shrink-0 mr-2 h-4.5 w-4.5"}),jsx(B,{title:a,titleLines:e,description:r,descriptionLines:s,disabled:c}),o&&bt.cloneElement(o,{className:"min-h-4.5 min-w-4.5 self-center ml-4"})]});export{rr as a,W as b,B as c,Mt as d,mr as e,St as f,Oa as g};
|