sodtrack-web-ui 0.55.0 → 0.55.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sodtrack-web-ui",
3
- "version": "0.55.0",
3
+ "version": "0.55.2",
4
4
  "description": "UI components for Sodtrack Web",
5
5
  "exports": {
6
6
  "./dist/index.css": "./dist/index.css",
@@ -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 {b}from'./chunk-5I7W67E3.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 Gt=({title:t,titleLines:o=2,description:r,descriptionLines:e=1,Icon:s,iconAsColumn:i=!0,className:a,...n})=>jsxs("div",{className:a$2("flex gap-2 py-4 pl-4 pr-6",i&&"flex-col items-center gap-1",!i&&!r&&"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",!!r&&"font-medium"),style:o?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:o}:void 0,children:t}),r&&jsx("p",{className:"text-sm leading-[130%] text-neutral-500",style:e?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:e}:void 0,children:r})]})]}),at=Gt;var _t=bt.memo(({handleSelect:t,NoResultsIcon:o,noResultsLabel:r,noResultsDescription:e,noResultsDescriptionLines:s,noResultsAsColumn:i,noResultsButtonOnClick:a$3,optionDescriptionLines:n,noResultsButtonLabel:w,filteredOptions:l,inputRect:p,inputRef:f,popoverPosition:x,optionsListRef:k,selectedOption:m,options:z,setFilteredOptions:h})=>jsx(Lt.Root,{asChild:!0,children:jsx("div",{ref:k,className:"pointer-events-auto fixed z-50 hidden w-full",style:p?{width:`${p.width}px`,left:p.left,top:x==="bottom"?`${p.bottom}px`:void 0,bottom:x==="top"?`${window.innerHeight-p.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:[l.length===0&&jsxs("div",{className:"elevation-8 max-h-88 flex flex-1 flex-col justify-center rounded-lg bg-neutral-50",children:[jsx(at,{title:r,description:e,Icon:o,iconAsColumn:i,descriptionLines:s}),a$3&&jsxs(Fragment,{children:[jsx(a$1,{}),jsx(c,{variant:"ghost",className:"my-3 w-fit self-center",onClick:u=>{k.current.style.display="none",f.current.value="",h(z),a$3();},children:w})]})]}),l.map(u=>jsx(Mt,{title:u.label,disabled:u.disabled,description:u.description,descriptionLines:n,onClick:()=>t(u),className:a$2(m?.value===u.value&&"bg-primary-200")},u.key??u.value))]})})})),Ct=_t;var qt=336,rr=({options:t,defaultSelectedOption:o,onSelect:r,onClick:e,onInputChange:s,error:i,helperText:a,label:n,placeholder:w,value:l,size:p="md",optionDescriptionLines:f=1,noResultsLabel:x,noResultsIcon:k,noResultsDescription:m,noResultsDescriptionLines:z,noResultsAsColumn:h,noResultsButtonOnClick:u,noResultsButtonLabel:A,className:V,disabled:b})=>{let[d,y]=useState(o??null),L=useRef(null),g=useRef(null),[nt,st]=useState(),[ct,T]=useState([]),[lt,H]=useState("bottom"),[G,K]=useState(),U=qt,N=useCallback(v=>{L.current.style.display="none",g.current.value=v.label,y(v),r?.(v);},[r]),C=useCallback(()=>{if(!g?.current)return;let v=g.current.getBoundingClientRect();st(v);let O=G?G.height:U,M=window.innerHeight-v.bottom>O,Q=v.top>O;H(M?"bottom":Q?"top":"bottom");},[G?.height]),_=useCallback(()=>{let v=t.filter(O=>O.label.toLowerCase().includes(g?.current?.value.toLowerCase()??""));if(T(v),L?.current){let O=L.current.getBoundingClientRect();K(O);}},[t]);return useEffect(()=>{T(t);},[t]),useEffect(()=>{if(!l){y(null),g.current&&(g.current.value="");return}(!g.current?.value||d?.value!==l.value)&&(y(l),g.current.value=l.label);},[l]),a$5(L,()=>{L.current.style.display="none",d&&g.current&&(g.current.value=d.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:v=>{v.target.value||(y(null),r?.(null)),s?.(v);},onClean:()=>{y(null),T(t),r?.(null);},onClick:v=>{L.current.style.display="flex",e?.(v);},onBlur:()=>{d&&g.current&&(g.current.value=d.label);},label:n,helperText:a,placeholder:w,size:p,error:i,disabled:b}),jsx(Ct,{handleSelect:N,noResultsLabel:x,NoResultsIcon:k,optionDescriptionLines:f,noResultsAsColumn:h,noResultsButtonLabel:A,noResultsButtonOnClick:u,noResultsDescription:m,noResultsDescriptionLines:z,filteredOptions:ct,inputRect:nt,inputRef:g,popoverPosition:lt,optionsListRef:L,selectedOption:d,options:t,setFilteredOptions:T})]})};var Kt=({children:t,title:o,titleLines:r,description:e="",descriptionLines:s,disabled:i=!1,className:a,...n})=>jsxs("div",{className:"flex w-full flex-col",...n,children:[jsx("p",{className:a$2("break-all",!!e&&"font-medium"),style:r?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:r}:void 0,children:o}),e&&jsx("p",{className:a$2("text-sm",i?"text-neutral-400":"text-neutral-700"),style:s?{overflow:"hidden",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:s}:void 0,children:e})]}),Y=Kt;var mr=({children:t,title:o,titleLines:r,description:e="",descriptionLines:s,startIcon:i,badgeContent:a,hasDivider:n=!1,disabled:w=!1,onSelect:l,className:p,...f})=>jsxs(W,{hasDescription:!!e,disabled:w,onClick:l,hasDivider:n,className:a$2(!w&&"cursor-pointer",p),...f,children:[i&&bt.cloneElement(i,{className:a$2(e?"mt-[0.4rem]":"self-center","shrink-0"),size:18}),jsx(Y,{title:o,titleLines:r,description:e,descriptionLines:s,disabled:w}),jsxs("div",{className:"flex gap-2",children:[a&&jsx(a$3,{content:a,size:"lg",variant:"alert",className:a$2("self-center",w&&"bg-neutral-400")}),jsx(h,{className:"h-4.5 w-4.5 self-center"})]})]});var St=({children:t,title:o,titleLines:r=1,description:e="",descriptionLines:s,startIcon:i,hasDivider:a=!1,disabled:n=!1,checked:w,onCheckedChange:l,className:p,...f})=>jsxs(W,{hasDescription:!!e,disabled:n,hasDivider:a,...f,className:a$2("pr-6",p),children:[i&&bt.cloneElement(i,{className:a$2(e?"mt-[0.4rem]":"self-center","shrink-0"),size:18}),jsx(Y,{title:o,titleLines:r,description:e,descriptionLines:s,disabled:n}),jsx(b,{size:"sm",checked:w,onCheckedChange:l,className:"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 o=useRef(null),r=useRef(null),e=useRef(null),s=useId(),[i,a]=useState(),[n,w]=useState(!0),[l,p]=useState([]),[f,x]=useState(-1),[k,m]=useState("bottom"),[z,h]=useState(),[u,A]=useState(E);return jsx(Ft.Provider,{value:{optionsListRef:o,inputRef:r,scrollAreaRef:e,autocompleteId:s,inputRect:i,showChips:n,filteredOptions:l,currentFocus:f,popoverPosition:k,setFilteredOptions:p,setCurrentFocus:x,setShowChips:w,setPopoverPosition:m,setInputRect:a,optionsListHeight:u,optionsListRect:z,setOptionsListRect:h,setOptionsListHeight:A},children:t})};var ce=({option:t,onMountWidth:o,size:r})=>{let e=useRef(null);return useEffect(()=>{e.current&&o?.(e.current.clientWidth);},[]),jsx(d,{type:"fill",variant:"standard",ref:e,className:"flex-shrink-0",size:r==="md"?"xs":"sm",hasCloseIcon:!1,children:t.label})},Tt=ce;var ge=150,we=bt.memo(({selectedOptions:t,error:o,onCleanSelectedOptions:r,disabled:e,size:s})=>{let{autocompleteId:i,inputRect:a,inputRef:n,optionsListRef:w}=I(),l=bt.useRef(null),[p,f]=bt.useState(new Map),x=useMemo(()=>{if(!a?.width)return [];let m=0,z=a.width-ge,h=0;for(let u=0;u<t.length&&(h+=p.get(u)??0,!(h>z));u++)m++;return t.slice(0,m)},[a?.width,t,p]),k=useCallback(()=>{e||(n?.current?.focus(),w.current.style.display="flex");},[e]);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",e&&"cursor-not-allowed"),style:{maxWidth:a?.width?a?.width:void 0,height:a?.height?a?.height:void 0},children:[jsx("div",{className:"flex flex-1 gap-1 overflow-hidden",ref:l,children:x.map((m,z)=>jsx(Tt,{option:m,onMountWidth:h=>f(u=>new Map(u).set(z,h)),size:s},`chip-input-${i}-${m.value}`))}),t.length>x.length&&jsx("span",{className:"text-base",children:"..."}),t.length>0&&!o&&jsx(a$3,{content:String(t.length),size:s}),o&&t.length>0&&jsx(c$1,{className:"h-6 w-6 text-error-700",onClick:m=>{m.stopPropagation(),r();}})]})}),Ht=we;var be=bt.memo(({option:t,index:o,onPressOption:r,isSelected:e,optionDescriptionLines:s})=>{let{currentFocus:i,inputRef:a}=I();return jsx(St,{title:t.label,checked:e,disabled:t.disabled,className:i===o?"bg-primary-200":void 0,onMouseDown:n=>{t.disabled||(a?.current?.value&&n.preventDefault(),r?.(t,n));},description:t.description,descriptionLines:s})}),ht=be;var xe=bt.memo(({selectedOptions:t,handleSelect:o,NoResultsIcon:r,noResultsLabel:e,noResultsDescription:s,noResultsDescriptionLines:i,noResultsAsColumn:a$2,noResultsButtonOnClick:n,optionDescriptionLines:w,noResultsButtonLabel:l})=>{let{popoverPosition:p,scrollAreaRef:f,optionsListRef:x,filteredOptions:k,inputRect:m,autocompleteId:z,inputRef:h,optionsListHeight:u}=I(),A=useCallback(b=>t.some(d=>d.value===b.value),[t]),V=useMemo(()=>t.filter(b=>b.label.toLowerCase().includes(h?.current?.value.toLowerCase()??"")),[t,h?.current?.value]);return jsx(Lt.Root,{asChild:!0,children:jsx("div",{ref:x,className:"pointer-events-auto fixed z-50 hidden w-full",style:m?{width:`${m.width}px`,left:m.left,top:p==="bottom"?`${m.bottom}px`:void 0,bottom:p==="top"?`${window.innerHeight-m.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:u+"px"},ref:f,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(at,{title:e,description:s,Icon:r,iconAsColumn:a$2,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",h.current.value="",n();},children:l})]})]}),V.map((b,d)=>jsx(ht,{option:b,index:d,onPressOption:y=>o(y),isSelected:A(b),optionDescriptionLines:w},`autocomplete-option-${z}-${b.key??b.value}`)),k.map((b,d)=>!t.some(y=>y.value===b.value)&&jsx(ht,{option:b,index:d,onPressOption:y=>o(y),isSelected:A(b),optionDescriptionLines:w},`autocomplete-option-${z}-${b.key??b.value}`))]})})})}),Xt=xe;var Re=bt.memo(({selectedOptions:t,onSelect:o,error:r,helperText:e,label:s,placeholder:i,options:a,onInputChange:n,size:w,disabled:l})=>{let{setCurrentFocus:p,setFilteredOptions:f,optionsListRef:x,inputRef:k}=I();return jsx(a$4,{ref:k,autoComplete:"off",list:"",disabled:l,selectMode:!0,onChange:m=>{p(-1),n?.(m.target.value);},onClean:()=>{p(-1),f(a),o?.(null,t);},onClick:()=>{l||(x.current.style.display="flex");},error:r,helperText:e,label:s,placeholder:i,fixedTopLabel:t.length>0,size:w})}),Bt=Re;var Yt=({options:t,defaultSelectedOptions:o,onSelect:r,error:e,helperText:s,label:i,placeholder:a,noResultsLabel:n,noResultsIcon:w,noResultsDescription:l,noResultsDescriptionLines:p,noResultsAsColumn:f,noResultsButtonOnClick:x,noResultsButtonLabel:k,className:m,onInputChange:z,value:h,loading:u,size:A="md",optionDescriptionLines:V=1,disabled:b})=>{let{inputRef:d,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,N]=useState(o??[]),C=useCallback(R=>{N(P=>{let S,$=P.findIndex(Vt=>Vt.value===R.value);return $===-1?(S=P.concat(R),r?.(R,S),S):(S=P.toSpliced($,1),r?.(R,S),S)});},[r]),_=useCallback(()=>{N([]),L(t),r?.(null,[]);},[]),v=useCallback(()=>{g(!1);},[]),O=useCallback(()=>{g(!0);},[]),M=useCallback(()=>{if(!d?.current)return;let R=d.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(d?.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(d?.current)return M(),d.current.addEventListener("mousedown",M),d.current.addEventListener("input",Q),d.current.addEventListener("focusin",v),d.current.addEventListener("focusout",O),window.addEventListener("scroll",M,!0),window.addEventListener("resize",M),()=>{d.current?.removeEventListener("mousedown",M),d.current?.removeEventListener("input",M),d.current?.removeEventListener("focusout",O),d.current?.removeEventListener("focusin",v),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M);}},[M,O,v,Q]),useEffect(()=>{h&&(N(h),g(!0));},[h]),useEffect(()=>{u||o&&o.length&&!K.current&&(N(o),K.current=!0,g(!0));},[o,u]),jsxs("div",{className:a$2("relative",m),children:[jsx(Bt,{selectedOptions:U,onSelect:r,error:e,helperText:s,label:i,placeholder:a,handleSelect:C,options:t,onInputChange:z,size:A,disabled:b}),T&&jsx(Ht,{selectedOptions:U,disabled:b,error:e,onCleanSelectedOptions:_,size:A}),jsx(Xt,{handleSelect:C,selectedOptions:U,noResultsLabel:n,NoResultsIcon:w,optionDescriptionLines:V,noResultsAsColumn:f,noResultsButtonLabel:k,noResultsButtonOnClick:x,noResultsDescription:l,noResultsDescriptionLines:p})]})};var Oo=t=>jsx(Dt,{children:jsx(Yt,{...t})});var Oe=({children:t,hasDescription:o=!1,disabled:r=!1,hasDivider:e=!1,className:s,onClick:i,...a})=>jsxs(Fragment,{children:[jsx("div",{className:a$2("line-height-[120%] flex flex-row gap-4 pl-4 pr-3",o?"py-3":"py-[0.875rem]",r?"text-neutral-400":"hover:bg-primary-100 focus:bg-primary-200",s),onClick:n=>{r||i?.(n);},...a,children:t}),e&&jsx(a$1,{})]}),W=Oe;var Mt=({children:t,title:o,titleLines:r,description:e="",descriptionLines:s,startIcon:i,hasDivider:a=!1,disabled:n=!1,className:w,...l})=>jsxs(W,{hasDescription:!!e,disabled:n,hasDivider:a,className:w,...l,children:[i&&bt.cloneElement(i,{className:a$2(e?"mt-[0.4rem]":"self-center","shrink-0"),size:18}),jsx(Y,{title:o,titleLines:r,description:e,descriptionLines:s,disabled:n})]});export{rr as a,Mt as b,mr as c,St as d,Oo as e};
@@ -1 +0,0 @@
1
- import {j,k}from'./chunk-XJSC6PKJ.mjs';import {a}from'./chunk-2WINTZSS.mjs';import {CheckboxRoot,CheckboxControl,CheckboxIndicator,CheckboxLabel,CheckboxHiddenInput}from'@ark-ui/react';import {useCallback}from'react';import {jsxs,jsx}from'react/jsx-runtime';var N=["sm","md"],P=[!0,"indeterminate",!1],R=({className:b,label:r,size:n="md",disabled:e=!1,onCheckedChange:o,...h})=>{let m=useCallback(p=>{o?.(p.checked);},[o]);return jsxs(CheckboxRoot,{"data-size":n,className:"group flex w-fit data-[disabled]:cursor-not-allowed data-[size=md]:gap-2.5 data-[size=sm]:gap-2",disabled:e,onCheckedChange:m,...h,children:[jsxs(CheckboxControl,{className:a("relative flex items-center justify-center rounded-sm ring-1 ring-inset ring-neutral-900 transition-all after:absolute after:rounded-full group-data-[size=md]:mt-0.125 group-data-[size=sm]:mt-0.25","group-data-[size=sm]:h-4 group-data-[size=sm]:w-4 after:group-data-[size=sm]:h-6 after:group-data-[size=sm]:w-6","group-data-[size=md]:h-5 group-data-[size=md]:w-5 after:group-data-[size=md]:-left-1.5 after:group-data-[size=md]:-top-1.5 after:group-data-[size=md]:h-8 after:group-data-[size=md]:w-8",!e&&"after:group-hover:bg-transparent-primary-20 group-hover:data-[state=unchecked]:ring-primary-600",!e&&"group-active:data-[state=checked]:bg-primary-700 group-active:data-[state=indeterminate]:bg-primary-700 group-active:data-[state=unchecked]:ring-primary-700",!e&&"data-[state=checked]:bg-primary-500 data-[state=checked]:ring-0 group-hover:data-[state=checked]:bg-primary-600",!e&&"data-[state=indeterminate]:bg-primary-500 data-[state=indeterminate]:ring-0 group-hover:data-[state=indeterminate]:bg-primary-600",e&&"data-[state=checked]:data-[disabled]:bg-neutral-500 data-[state=checked]:data-[disabled]:ring-0",e&&"data-[state=unchecked]:data-[disabled]:ring-neutral-500",e&&"data-[state=indeterminate]:data-[disabled]:ring-neutral-500"),children:[jsx(CheckboxIndicator,{children:jsx(j,{className:a("text-neutral-50","group-data-[size=md]:h-4.5 group-data-[size=md]:w-4.5","group-data-[size=sm]:h-4 group-data-[size=sm]:w-4")})}),jsx(CheckboxIndicator,{indeterminate:!0,children:jsx(k,{className:a("text-neutral-50","group-data-[size=md]:h-4.5 group-data-[size=md]:w-4.5","group-data-[size=sm]:h-4 group-data-[size=sm]:w-4")})})]}),r&&jsx(CheckboxLabel,{className:a("font-inter !leading-[130%]","group-data-[size=md]:text-base","group-data-[size=sm]:text-sm",!e&&"text-neutral-900",e&&"text-neutral-500"),children:r}),jsx(CheckboxHiddenInput,{})]})};export{N as a,P as b,R as c};
@@ -1 +0,0 @@
1
- import {r,m}from'./chunk-XJSC6PKJ.mjs';import {a}from'./chunk-2WINTZSS.mjs';import {RatingGroup}from'@ark-ui/react/rating-group';import {jsx,jsxs}from'react/jsx-runtime';var d=["md","sm"],x=({size:n="sm",count:c=5,...r$1})=>jsx(RatingGroup.Root,{count:c,...r$1,children:jsxs(RatingGroup.Control,{className:"flex gap-1",children:[jsx(RatingGroup.Context,{children:({items:l})=>l.map(a$1=>jsx(RatingGroup.Item,{index:a$1,className:"outline-0",children:jsx(RatingGroup.ItemContext,{children:({half:R,highlighted:e})=>{let s=a("transition-colors",!r$1.readOnly&&!r$1.disabled&&"cursor-pointer",n==="md"&&"size-6",n==="sm"&&"h-4.5 w-4.5");return R?jsx(r,{fill:"#FFCB00",color:"#FFCB00",className:s}):jsx(m,{fill:e?"#FFCB00":"transparent",color:e?"#FFCB00":"#7E8A86",className:s})}})},a$1))}),jsx(RatingGroup.HiddenInput,{})]})});export{d as a,x as b};