@epam/statgpt-ui-components 0.6.0-rc.2 → 0.6.0-rc.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.
@@ -3,6 +3,7 @@ interface Props {
3
3
  id: string;
4
4
  label?: string;
5
5
  checked: boolean;
6
+ indeterminate?: boolean;
6
7
  checkboxIcon?: ReactNode;
7
8
  onChange?: (id: string, isChecked?: boolean) => void;
8
9
  disabled?: boolean;
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),p=require("react"),f=require("classnames"),D=require("@tabler/icons-react"),ie=require("tailwind-merge"),oe=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),w=require("@floating-ui/react"),M=require("@dnd-kit/core"),Y=require("@dnd-kit/sortable"),ce=require("@dnd-kit/utilities");function de(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const ue=de(p),U=({title:e,btnClassNames:n,iconWidth:s,iconHeight:r,onClick:l})=>t.jsx("button",{type:"button","aria-label":"button",className:n,title:e,onClick:l,children:t.jsx(D.IconX,{height:r||20,width:s||20})});var O=(e=>(e.INFO="info",e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(O||{});const xe=3e4,me=({alertDetails:e,infoIcon:n,successIcon:s,errorIcon:r,onClose:l,closeButtonTitle:a,children:i})=>{const u=e?.type,x=u===O.IN_PROGRESS||u===O.INFO,c=()=>x?"alert-in-progress":u===O.SUCCESS?"alert-success":"alert-error",m=x?n:u===O.SUCCESS?s:u===O.ERROR?r:null,h=e?.text;return p.useEffect(()=>{if(!e||x)return;const j=setTimeout(()=>{l?.()},xe);return()=>clearTimeout(j)},[e,x,l]),t.jsx("div",{className:f("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",c()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[m&&t.jsx("div",{className:"alert-icon",children:m}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx("h3",{className:"alert-title truncate",children:e?.title}),i??(h&&t.jsx("div",{className:"alert-text whitespace-pre-line break-words",title:h,children:h}))]}),t.jsx(U,{title:a,onClick:l})]})})},K=()=>t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx("div",{className:"loader"})}),he=ie.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function L(...e){return he(f(...e))}const Q=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:l,iconAfter:a,iconBefore:i,onClick:u,isSmallButton:x})=>{const c=L([x?"font-semibold":"",a?"mr-2":"",i?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:f("base-button",e,x?"small-button":""),disabled:l||s,"aria-label":"button",onClick:m=>u?.(m),title:r,children:[i,s&&t.jsx(K,{}),r?x?t.jsx("h4",{className:c,children:r}):t.jsx("h3",{className:c,children:r}):null,a]})};function Z(e=719){const[n,s]=p.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return p.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e}px)`),l=a=>{s(a.matches)};return s(r.matches),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),n}function fe(e,n){const s=p.useRef(null);return p.useCallback((...l)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...l)},n)},[e,n])}const pe=24,ge=24,W=1e3,X=24,be=({label:e,onChange:n,value:s,options:r,calendarResolution:l=P.CalendarResolution.DAY,id:a,icon:i,isEndDate:u})=>{const x=p.useRef(null),c=Z();p.useEffect(()=>{const N=x?.current;N&&N.querySelector("input")?.setAttribute("aria-label",e)},[e]);const m={...r,disableMobile:!0,defaultDate:l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},h=(N,v,b)=>{const d=`calendar__${l===P.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(d)},j=(N,v,b)=>{if(l===P.CalendarResolution.MONTH&&N.length>0){const d=r.minDate,o=r.maxDate,g=N[0].getFullYear(),C=b.calendarContainer,S="flatpickr-disabled",y=C.querySelectorAll(".flatpickr-monthSelect-month"),E=C.querySelectorAll(".flatpickr-next-month")[0],R=C.querySelectorAll(".flatpickr-prev-month")[0];g===o.getFullYear()&&E.classList.add(S),g===d.getFullYear()&&R.classList.add(S),(g===d.getFullYear()||g===o.getFullYear())&&y.forEach(k=>{k.classList.remove(S);const I=new Date(k.getAttribute("aria-label")),_=I.getFullYear()===d.getFullYear()&&I.getMonth()===d.getMonth(),z=I.getFullYear()===o.getFullYear()&&I.getMonth()===o.getMonth();_||z||(I<d||I>o)&&k.classList.add(S)})}setTimeout(()=>{const d=b.calendarContainer,o=b._input?.getBoundingClientRect();d&&(d.style.top=`${o.top-d.offsetHeight-8}px`,d.style.width=`${d.style.width}px`,u?(d.style.right=`${window.innerWidth-o.right-(c?X:0)}px`,d.style.left="auto"):d.style.left=`${o.left}px`)},0)};return t.jsxs("div",{className:"calendar relative",ref:x,children:[t.jsx("div",{className:"calendar-title mb-1",children:e}),t.jsx("label",{htmlFor:a,className:"absolute right-[11px] top-[29px] cursor-pointer",children:i||t.jsx(D.IconCalendarEvent,{})}),t.jsx(oe,{defaultValue:(l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:m,onChange:N=>{n(N[0])},onOpen:[j],onReady:[h],id:a})]})},V=({label:e,id:n,checked:s,checkboxIcon:r,onChange:l,disabled:a=!1,disabledScope:i="full",className:u,stopPropagation:x=!0})=>{const c=p.useCallback(j=>{x&&j.stopPropagation()},[x]),m=p.useCallback(j=>{x&&j.stopPropagation(),l?.(n,j.target.checked)},[l,n,x]),h=()=>{if(s)return r||t.jsx(D.IconSquareCheckFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:c,className:L("flex min-w-0 items-center py-1 shrink-0",a?"cursor-not-allowed":"cursor-pointer",a&&i==="full"&&"opacity-50",u),children:[t.jsx("span",{className:f("checkbox-button relative flex size-[14px] items-center justify-center",a&&i==="icon"&&"opacity-50"),"aria-hidden":!0,children:h()}),e?t.jsx("p",{className:f("checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"),title:e,children:e}):null,t.jsx("input",{id:n,type:"checkbox",checked:s,disabled:a,onChange:m,className:"hidden"})]})},je=({title:e,icon:n,children:s,value:r})=>{const[l,a]=p.useState(!1);return t.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${l?"collapsible-block-open":""}`,children:[t.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>a(!l),children:[t.jsx("div",{className:`${l?"rotate-180":""} transition-transform`,children:n||t.jsx(D.IconChevronDown,{className:"mr-3 size-5"})}),t.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[t.jsx("span",{children:e}),r&&t.jsx("p",{className:"body-1 text-neutrals-800",children:r})]})]}),l&&t.jsx("div",{className:"collapsible-block-content pb-4",children:s})]})},Ne=({text:e,highlightText:n})=>{const s=p.useMemo(()=>{const r=[];if(!n)return[{id:0,text:e,highlight:!1}];const l=n?.toLowerCase()||"",a=e?.toLowerCase()?.split(l)||"";for(let i=0,u=0;i<a?.length;i++){const x=a?.[i],c=x.length;x!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(u,u+c)}),u+=c,i!==a?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(u,u+n.length)}),u+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:f(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},we=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:l,isBaseIconStyles:a=!0})=>t.jsx("button",{type:"button",className:f(a&&"base-icon-button",s),onClick:i=>n?.(i),disabled:r,title:l,"aria-label":"button",children:e}),J=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:l="text",disabled:a,readonly:i,onChange:u,onKeyDown:x,onFocus:c,onBlur:m})=>{const h=f("truncate outline-none shadow-none body-1",r,i?"pointer-events-none":"");return t.jsx("input",{type:l,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:a,className:h,onKeyDown:x,onFocus:c,onBlur:m,onChange:j=>u?.(j.currentTarget.value)})},Ce=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...l})=>t.jsxs("div",{className:f("input w-full flex flex-row",s),children:[e,t.jsx(J,{cssClass:f("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...l}),n]}),ve=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:l})=>{const a=f(l?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:f("base-link",s),title:n,children:[r,t.jsx("span",{className:a,children:n}),l]})},ye=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:f("tag flex items-center justify-center","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"),disabled:s,onClick:()=>r?.(n||e),"aria-label":"button",children:t.jsx("h4",{children:e})}),Ee=({label:e,id:n,checked:s,radioIcon:r,description:l,onChange:a})=>{const i=p.useCallback(u=>{u.stopPropagation(),a?.(n,u.target.checked)},[a,n]);return t.jsxs("label",{className:"flex min-w-0 cursor-pointer flex-col py-[6px]",htmlFor:n,children:[t.jsxs("p",{className:"radio-label flex min-w-0 items-center",children:[t.jsx("span",{className:f("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",s?"radio-button-active":""),children:s&&r}),e&&t.jsx("span",{className:"radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000",title:e,children:e})]}),l&&t.jsx("span",{className:"radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",title:l,children:l}),t.jsx("input",{type:"radio",onChange:i,id:n,checked:s,className:"hidden"})]})};var F=(e=>(e.Closed="Closed",e.Opened="Opened",e))(F||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const Ie=({portalId:e,state:n=F.Opened,heading:s,size:r,onClose:l,children:a,overlayClassName:i,containerClassName:u,dividers:x=!0,closeButtonTitle:c})=>{const{refs:m,context:h}=w.useFloating({open:n!==F.Closed&&!!n,onOpenChange:l}),j=w.useRole(h,{role:"dialog"}),N=w.useDismiss(h,{outsidePress:!0}),{getFloatingProps:v}=w.useInteractions([j,N]),b=p.useCallback(d=>{d?.preventDefault(),d?.stopPropagation(),l()},[l]);return t.jsx(w.FloatingPortal,{id:e,children:n!==F.Closed&&t.jsx(w.FloatingOverlay,{className:f("z-modal flex items-center justify-center bg-blackout p-4",i),children:t.jsx(w.FloatingFocusManager,{context:h,children:t.jsxs("div",{className:f("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",r===q.LG&&"max-w-[65%]",r===q.SM&&"max-w-[30%]",x&&"divide-neutrals-400 divide-y",u,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:m.setFloating,...v({onClick(d){d.stopPropagation()}}),children:[t.jsxs("div",{className:"modal-heading flex flex-row items-center justify-between px-6 py-5 sm:p-0 sm:pb-2",children:[s&&(typeof s=="string"?t.jsx("h2",{className:"modal-heading-title sm:h3 mr-3 min-w-0 flex-1",children:s}):s),t.jsx(U,{title:c,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),a.map(d=>d)]})})})})},Se=e=>e.state===F.Closed?null:t.jsx(Ie,{...e}),G="statgpt-dropdown-open",A=8,ke={name:"keepDropdownWithinViewport",fn({y:e,rects:n}){if(typeof window>"u")return{};const s=document.documentElement.clientHeight||window.innerHeight,r=Math.min(n.floating.height,Math.max(0,s-A*2)),l=A,a=s-r-A;return{y:Math.min(Math.max(e,l),Math.max(l,a))}}},De=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:l,containerClassName:a,openedClassName:i,onOptionSelect:u})=>{const x=p.useId(),[c,m]=p.useState(!1),{refs:h,floatingStyles:j,context:N}=w.useFloating({open:c,onOpenChange:l?void 0:m,placement:"bottom-end",strategy:"fixed",middleware:[w.offset(A),w.flip({padding:A}),w.size({padding:A,apply({availableHeight:g,elements:C}){C.floating.style.maxHeight=`${Math.max(0,g)}px`}}),w.shift({padding:A}),ke],whileElementsMounted:w.autoUpdate}),v=w.useClick(N),b=w.useDismiss(N,{outsidePress:!0}),{getReferenceProps:d,getFloatingProps:o}=w.useInteractions([v,b]);return p.useEffect(()=>{c&&window.dispatchEvent(new CustomEvent(G,{detail:x}))},[x,c]),p.useEffect(()=>{const g=C=>{C instanceof CustomEvent&&C.detail!==x&&m(!1)};return window.addEventListener(G,g),()=>{window.removeEventListener(G,g)}},[x]),p.useEffect(()=>{l&&m(!1)},[l]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:h.setReference,...d({onClick(g){g.stopPropagation()}}),className:f(a,c&&i),children:e}),c&&t.jsx(w.FloatingPortal,{children:t.jsxs("div",{ref:h.setFloating,style:{...j,overflowY:"auto"},className:"dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",...o(),children:[s&&s,n&&n.map(g=>t.jsx("div",{onClick:C=>{C.stopPropagation(),u?.(g.key),m(!1)},className:f("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===g.key&&"bg-hues-100"),children:t.jsxs("div",{className:"dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",title:g.title,children:[g.icon?g.icon:null,t.jsx("p",{children:g?.title})]})},g.key))]})})]})},Re=({limitMessages:e,query:n})=>t.jsxs("div",{className:"flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1",children:[t.jsx("div",{className:"flex gap-x-[4px]",children:t.jsx("div",{className:"flex flex-col",children:t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:"h5 text-primary",children:[e?.excelFormatTitle," "]}),t.jsx("span",{className:"body-3 text-neutrals-800",children:e?.excelFormatText})]})})}),t.jsx("a",{href:n,target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),Oe=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:l})=>t.jsxs("div",{className:f("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",e?.containerClassName),children:[t.jsxs("div",{className:"flex items-center gap-x-2",children:[t.jsx("span",{children:e?.warningIcon}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:f("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:f("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(W):e?.showingLimit?.(W)})]}),n&&t.jsx("span",{className:f("text-neutrals-800 body-3",e?.limitMessageClassName),children:e?.fullLimitMessage})]})]}),s&&t.jsxs("span",{onClick:()=>r?.(),className:"h4 flex cursor-pointer items-center gap-x-[4px] text-primary",children:[e?.editIcon,e?.refineInAdvancedView]}),n&&t.jsx("a",{href:l||"",target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),ee=p.createContext(null);function Ae({value:e,children:n}){const s=p.useMemo(()=>e??{},[e]);return t.jsx(ee.Provider,{value:s,children:n})}function Le(){return p.useContext(ee)}var T=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e.Note="note",e))(T||{});const _e={[T.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[T.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[T.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000",[T.Note]:"border-hues-900 bg-neutrals-200 text-neutrals-1000"},Me="shrink-0",Te="min-w-0 body-2",Fe="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function Pe({type:e,icon:n,children:s,className:r,contentClassName:l}){const a=Le(),i=n??a?.icons?.[e],u=a?.classes?.container??Fe,x=a?.classes?.types?.[e]??_e[e],c=L(u,x,r),m=L(Me,a?.classes?.icon),h=L(Te,a?.classes?.content,l);return t.jsxs("div",{"data-type":e,className:c,children:[i?t.jsx("span",{className:m,children:i}):null,s?t.jsx("div",{className:h,children:s}):null]})}const Ye=({title:e,copiedTitle:n,tooltip:s,hoverTooltip:r,icon:l,copiedIcon:a,className:i,buttonTextClassName:u,onClick:x})=>{const[c,m]=p.useState(!1),h=p.useRef(null),j=()=>{x(),m(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{m(!1)},1e3)};return p.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),t.jsxs("div",{className:"relative w-fit",title:r,children:[t.jsx(Q,{title:c?n:e,isSmallButton:!0,disabled:c,buttonClassName:L(["text-button-tertiary small-icon-button !h-6 !p-0",i]),textClassName:L(["ml-1",u]),onClick:j,iconBefore:c?a:l}),s&&c&&t.jsx("div",{className:"h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow",children:s})]})};function qe({id:e,label:n,hasChildren:s,showDragHandle:r,showCheckbox:l,isChecked:a,isExpanded:i}){return t.jsxs("div",{className:"relative cursor-grabbing rounded bg-neutrals-200 shadow",children:[t.jsx("div",{className:"absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light"}),t.jsxs("div",{className:"flex items-stretch overflow-hidden rounded",children:[r?t.jsx("div",{className:"flex w-6 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:"rounded p-1",children:t.jsx(D.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[l?t.jsx(V,{id:e,checked:!!a,className:"p-0"}):null,t.jsx("span",{className:"body-3 truncate",children:n})]}),s?t.jsx("div",{className:"flex w-8 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:f("transition-transform",i?"rotate-90":"rotate-0"),children:t.jsx(D.IconChevronRight,{size:16})})}):null]})]})}function te(e,n){return`i:${[...e,n].join("/")}`}function H(e){if(!e.startsWith("i:"))return null;const s=e.slice(2).split("/").filter(Boolean);return s.length?{parentPath:s.slice(0,-1),itemId:s[s.length-1]}:null}function Be(e,n,s){const r=se(e,n);return r?r.find(l=>l.id===s)??null:null}function ne(e,n){if(n.length===0)return e;const[s,...r]=n,l=e.find(a=>a.id===s);return l?.items?ne(l.items,r):null}function se(e,n){const s=ne(e,n);return s?s.filter(r=>r.type==="item"):null}function re(e,n,s){if(n.length===0)return s(e);const[r,...l]=n;return e.map(a=>a.id!==r||!a.items?a:{...a,items:re(a.items,l,s)})}function ze({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:l,onItemClick:a,onToggleExpanded:i,onToggleChecked:u}){const x=!!n.items?.length,c=!!n.isExpanded,m=n.isDisabled?!1:n.draggable??!0,h=n.isDisabled?!1:n.checkable??!0,j=te(e,n.id),{attributes:N,listeners:v,setNodeRef:b,setActivatorNodeRef:d,transform:o,transition:g,isDragging:C}=Y.useSortable({id:j,disabled:!m}),S={transform:ce.CSS.Transform.toString(o),transition:g,opacity:C?.6:void 0},y=!!n.isDisabled,E=y||!h,R=[...e,n.id];return t.jsxs("div",{ref:b,style:S,className:f(["group flex items-stretch overflow-hidden rounded bg-white","select-none",y?"opacity-50":""]),children:[s?t.jsx("div",{className:f(["group/drag-handle flex w-6 items-center justify-center rounded",y?"":"hover:bg-neutrals-100 cursor-grab"]),children:t.jsx("span",{ref:d,"aria-hidden":!0,className:f(["rounded p-1",m?"cursor-grab":"cursor-default","transition-opacity"]),...m?v:{},...m?N:{},children:t.jsx(D.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:y,"aria-disabled":E,onClick:k=>{E||a?.({itemId:n.id,path:R,nativeEvent:k})},className:f(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",y?"":"hover:bg-neutrals-100",y?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(V,{id:`draggable-list-${R.join("-")}`,checked:!!n.isChecked,disabled:!h,className:"p-0",stopPropagation:!0,onChange:(k,I)=>u?.({itemId:n.id,path:R,nextChecked:!!I})}):null,t.jsx("span",{className:"body-3 w-full truncate text-neutrals-800",children:l?l(n):n.label})]}),x?t.jsx("button",{type:"button",disabled:y,onClick:k=>{k.stopPropagation(),i?.({itemId:n.id,path:R,nextExpanded:!c})},"aria-label":c?"Collapse":"Expand",className:f(["flex w-8 items-center justify-center rounded",y?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:f("transition-transform duration-150 ease-out",c?"rotate-90":"rotate-0"),children:t.jsx(D.IconChevronRight,{size:16})})}):null]})}function Ge({items:e,showDragHandle:n=!0,showCheckbox:s=!0,onItemsChange:r,onToggleExpanded:l,onToggleChecked:a,onItemClick:i,renderLabel:u}){const x=M.useSensors(M.useSensor(M.PointerSensor,{activationConstraint:{distance:6}})),[c,m]=ue.useState(null),h=v=>{const b=String(v.active.id),d=H(b);if(!d)return;const o=Be(e,d.parentPath,d.itemId);!o||o.type!=="item"||m({id:b,label:o.label,hasChildren:!!o.items?.length,isChecked:o.isChecked,isExpanded:o.isExpanded})},j=v=>{m(null);const b=v.over;if(!b)return;const d=H(String(v.active.id)),o=H(String(b.id));if(!d||!o||d.parentPath.join("/")!==o.parentPath.join("/"))return;const g=se(e,d.parentPath);if(!g)return;const C=g.findIndex(E=>E.id===d.itemId),S=g.findIndex(E=>E.id===o.itemId);if(C===-1||S===-1||C===S)return;const y=re(e,d.parentPath,E=>{const R=E.filter(_=>_.type==="item"),k=Y.arrayMove(R,C,S);let I=0;return E.map(_=>{if(_.type!=="item")return _;const z=k[I];return I+=1,z})});r(y)},N=(v,b=[])=>{const d=v.filter(o=>o.type==="item").map(o=>te(b,o.id));return t.jsx(Y.SortableContext,{items:d,strategy:Y.verticalListSortingStrategy,children:t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:v.map(o=>o.type==="group"?t.jsxs("li",{className:"m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",children:[t.jsxs("div",{className:"h5 flex items-center gap-2 py-1 text-neutrals-1000",children:[t.jsx(D.IconDatabase,{size:12,className:"shrink-0"}),o.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:N(o.items,[...b,o.id])})]},o.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(ze,{parentPath:b,item:o,showDragHandle:n,showCheckbox:s,renderLabel:u,onItemClick:i,onToggleExpanded:l,onToggleChecked:a}),o.items?.length&&o.isExpanded?t.jsx("div",{className:"pl-7",children:N(o.items,[...b,o.id])}):null]},o.id))})})};return t.jsxs(M.DndContext,{sensors:x,collisionDetection:M.closestCenter,onDragStart:h,onDragEnd:j,children:[t.jsx("div",{className:"flex flex-col",children:N(e)}),t.jsx(M.DragOverlay,{children:c?t.jsx(qe,{id:c.id,label:c.label,hasChildren:c.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:c.isChecked,isExpanded:c.isExpanded}):null})]})}const He=(e,n)=>e.label.toLowerCase().includes(n);function We(e,n,s={}){const r=Ue(n);if(!r)return e;const{expandMatchedBranches:l=!0,includeGroupDescendantsOnMatch:a=!0,includeItemDescendantsOnMatch:i=!1,match:u=He}=s;return $(e,r,{expandMatchedBranches:l,includeGroupDescendantsOnMatch:a,includeItemDescendantsOnMatch:i,match:u})??[]}function $(e,n,s){const r=[];for(const l of e){const a=$e(l,n,s);a&&r.push(a)}return r.length?r:null}function $e(e,n,s){const r=s.match(e,n);if(e.type==="group"){if(r&&s.includeGroupDescendantsOnMatch)return B(e,s.expandMatchedBranches);const i=e.items?.length?$(e.items,n,s):null;return!r&&!i?null:{...e,items:i??[]}}const l=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return B(e,s.expandMatchedBranches);if(!r&&!l)return null;const a={...e};return l?(a.items=l,s.expandMatchedBranches&&(a.isExpanded=!0)):delete a.items,a}function B(e,n){return e.type==="group"?{...e,items:e.items.map(s=>B(s,n))}:{...e,isExpanded:n&&e.items?.length?!0:e.isExpanded,items:e.items?.map(s=>B(s,n))}}function Ue(e){return e.trim().toLowerCase()}var le=(e=>(e.Enter="Enter",e))(le||{});const ae=p.createContext(null);function Ve({children:e,isAgentAvailable:n}){const s=p.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(ae.Provider,{value:s,children:e})}function Ke(){const e=p.useContext(ae);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=Ve;exports.Alert=me;exports.AlertType=O;exports.Button=Q;exports.CALENDAR_MOBILE_PADDING=X;exports.Calendar=be;exports.Checkbox=V;exports.CloseButton=U;exports.CollapsibleBlock=je;exports.CopyButton=Ye;exports.DownloadFormatMessage=Re;exports.DraggableList=Ge;exports.Dropdown=De;exports.HighlightText=Ne;exports.IconButton=we;exports.InlineAlert=Pe;exports.InlineAlertProvider=Ae;exports.InlineAlertType=T;exports.Input=J;exports.InputWithIcon=Ce;exports.KeyboardKey=le;exports.Link=ve;exports.Loader=K;exports.PopUpSize=q;exports.PopUpState=F;exports.Popup=Se;exports.Radio=Ee;exports.RequestLimitMessage=Oe;exports.SERIES_LIMIT=W;exports.TREE_NODE_ARROW_SIZE=pe;exports.TREE_NODE_PADDING=ge;exports.Tag=ye;exports.filterDraggableListNodes=We;exports.useAgentAvailability=Ke;exports.useDebounce=fe;exports.useIsMobile=Z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("react"),p=require("classnames"),k=require("@tabler/icons-react"),ie=require("tailwind-merge"),oe=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),C=require("@floating-ui/react"),M=require("@dnd-kit/core"),Y=require("@dnd-kit/sortable"),ce=require("@dnd-kit/utilities");function de(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const ue=de(m),U=({title:e,btnClassNames:n,iconWidth:s,iconHeight:r,onClick:l})=>t.jsx("button",{type:"button","aria-label":"button",className:n,title:e,onClick:l,children:t.jsx(k.IconX,{height:r||20,width:s||20})});var O=(e=>(e.INFO="info",e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(O||{});const xe=3e4,fe=({alertDetails:e,infoIcon:n,successIcon:s,errorIcon:r,onClose:l,closeButtonTitle:a,children:i})=>{const u=e?.type,x=u===O.IN_PROGRESS||u===O.INFO,o=()=>x?"alert-in-progress":u===O.SUCCESS?"alert-success":"alert-error",f=x?n:u===O.SUCCESS?s:u===O.ERROR?r:null,h=e?.text;return m.useEffect(()=>{if(!e||x)return;const w=setTimeout(()=>{l?.()},xe);return()=>clearTimeout(w)},[e,x,l]),t.jsx("div",{className:p("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",o()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[f&&t.jsx("div",{className:"alert-icon",children:f}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx("h3",{className:"alert-title truncate",children:e?.title}),i??(h&&t.jsx("div",{className:"alert-text whitespace-pre-line break-words",title:h,children:h}))]}),t.jsx(U,{title:a,onClick:l})]})})},K=()=>t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx("div",{className:"loader"})}),me=ie.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function L(...e){return me(p(...e))}const Q=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:l,iconAfter:a,iconBefore:i,onClick:u,isSmallButton:x})=>{const o=L([x?"font-semibold":"",a?"mr-2":"",i?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:p("base-button",e,x?"small-button":""),disabled:l||s,"aria-label":"button",onClick:f=>u?.(f),title:r,children:[i,s&&t.jsx(K,{}),r?x?t.jsx("h4",{className:o,children:r}):t.jsx("h3",{className:o,children:r}):null,a]})};function Z(e=719){const[n,s]=m.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return m.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e}px)`),l=a=>{s(a.matches)};return s(r.matches),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),n}function he(e,n){const s=m.useRef(null);return m.useCallback((...l)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...l)},n)},[e,n])}const pe=24,ge=24,W=1e3,X=24,be=({label:e,onChange:n,value:s,options:r,calendarResolution:l=P.CalendarResolution.DAY,id:a,icon:i,isEndDate:u})=>{const x=m.useRef(null),o=Z();m.useEffect(()=>{const j=x?.current;j&&j.querySelector("input")?.setAttribute("aria-label",e)},[e]);const f={...r,disableMobile:!0,defaultDate:l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},h=(j,N,b)=>{const d=`calendar__${l===P.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(d)},w=(j,N,b)=>{if(l===P.CalendarResolution.MONTH&&j.length>0){const d=r.minDate,c=r.maxDate,g=j[0].getFullYear(),v=b.calendarContainer,S="flatpickr-disabled",y=v.querySelectorAll(".flatpickr-monthSelect-month"),E=v.querySelectorAll(".flatpickr-next-month")[0],R=v.querySelectorAll(".flatpickr-prev-month")[0];g===c.getFullYear()&&E.classList.add(S),g===d.getFullYear()&&R.classList.add(S),(g===d.getFullYear()||g===c.getFullYear())&&y.forEach(D=>{D.classList.remove(S);const I=new Date(D.getAttribute("aria-label")),_=I.getFullYear()===d.getFullYear()&&I.getMonth()===d.getMonth(),z=I.getFullYear()===c.getFullYear()&&I.getMonth()===c.getMonth();_||z||(I<d||I>c)&&D.classList.add(S)})}setTimeout(()=>{const d=b.calendarContainer,c=b._input?.getBoundingClientRect();d&&(d.style.top=`${c.top-d.offsetHeight-8}px`,d.style.width=`${d.style.width}px`,u?(d.style.right=`${window.innerWidth-c.right-(o?X:0)}px`,d.style.left="auto"):d.style.left=`${c.left}px`)},0)};return t.jsxs("div",{className:"calendar relative",ref:x,children:[t.jsx("div",{className:"calendar-title mb-1",children:e}),t.jsx("label",{htmlFor:a,className:"absolute right-[11px] top-[29px] cursor-pointer",children:i||t.jsx(k.IconCalendarEvent,{})}),t.jsx(oe,{defaultValue:(l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:f,onChange:j=>{n(j[0])},onOpen:[w],onReady:[h],id:a})]})},V=({label:e,id:n,checked:s,indeterminate:r=!1,checkboxIcon:l,onChange:a,disabled:i=!1,disabledScope:u="full",className:x,stopPropagation:o=!0})=>{const f=m.useRef(null);m.useEffect(()=>{f.current&&(f.current.indeterminate=!s&&r)},[s,r]);const h=m.useCallback(N=>{o&&N.stopPropagation()},[o]),w=m.useCallback(N=>{o&&N.stopPropagation(),a?.(n,N.target.checked)},[a,n,o]),j=()=>{if(s)return l||t.jsx(k.IconSquareCheckFilled,{className:"absolute size-4"});if(r)return t.jsx(k.IconSquareMinusFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:h,className:L("flex min-w-0 items-center py-1 shrink-0",i?"cursor-not-allowed":"cursor-pointer",i&&u==="full"&&"opacity-50",x),children:[t.jsx("span",{className:p("checkbox-button relative flex size-[14px] items-center justify-center",i&&u==="icon"&&"opacity-50"),"aria-hidden":!0,children:j()}),e?t.jsx("p",{className:p("checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"),title:e,children:e}):null,t.jsx("input",{ref:f,id:n,type:"checkbox",checked:s,disabled:i,onChange:w,className:"hidden"})]})},je=({title:e,icon:n,children:s,value:r})=>{const[l,a]=m.useState(!1);return t.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${l?"collapsible-block-open":""}`,children:[t.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>a(!l),children:[t.jsx("div",{className:`${l?"rotate-180":""} transition-transform`,children:n||t.jsx(k.IconChevronDown,{className:"mr-3 size-5"})}),t.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[t.jsx("span",{children:e}),r&&t.jsx("p",{className:"body-1 text-neutrals-800",children:r})]})]}),l&&t.jsx("div",{className:"collapsible-block-content pb-4",children:s})]})},Ne=({text:e,highlightText:n})=>{const s=m.useMemo(()=>{const r=[];if(!n)return[{id:0,text:e,highlight:!1}];const l=n?.toLowerCase()||"",a=e?.toLowerCase()?.split(l)||"";for(let i=0,u=0;i<a?.length;i++){const x=a?.[i],o=x.length;x!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(u,u+o)}),u+=o,i!==a?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(u,u+n.length)}),u+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:p(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},we=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:l,isBaseIconStyles:a=!0})=>t.jsx("button",{type:"button",className:p(a&&"base-icon-button",s),onClick:i=>n?.(i),disabled:r,title:l,"aria-label":"button",children:e}),J=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:l="text",disabled:a,readonly:i,onChange:u,onKeyDown:x,onFocus:o,onBlur:f})=>{const h=p("truncate outline-none shadow-none body-1",r,i?"pointer-events-none":"");return t.jsx("input",{type:l,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:a,className:h,onKeyDown:x,onFocus:o,onBlur:f,onChange:w=>u?.(w.currentTarget.value)})},Ce=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...l})=>t.jsxs("div",{className:p("input w-full flex flex-row",s),children:[e,t.jsx(J,{cssClass:p("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...l}),n]}),ve=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:l})=>{const a=p(l?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:p("base-link",s),title:n,children:[r,t.jsx("span",{className:a,children:n}),l]})},ye=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:p("tag flex items-center justify-center","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"),disabled:s,onClick:()=>r?.(n||e),"aria-label":"button",children:t.jsx("h4",{children:e})}),Ee=({label:e,id:n,checked:s,radioIcon:r,description:l,onChange:a})=>{const i=m.useCallback(u=>{u.stopPropagation(),a?.(n,u.target.checked)},[a,n]);return t.jsxs("label",{className:"flex min-w-0 cursor-pointer flex-col py-[6px]",htmlFor:n,children:[t.jsxs("p",{className:"radio-label flex min-w-0 items-center",children:[t.jsx("span",{className:p("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",s?"radio-button-active":""),children:s&&r}),e&&t.jsx("span",{className:"radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000",title:e,children:e})]}),l&&t.jsx("span",{className:"radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",title:l,children:l}),t.jsx("input",{type:"radio",onChange:i,id:n,checked:s,className:"hidden"})]})};var F=(e=>(e.Closed="Closed",e.Opened="Opened",e))(F||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const Ie=({portalId:e,state:n=F.Opened,heading:s,size:r,onClose:l,children:a,overlayClassName:i,containerClassName:u,dividers:x=!0,closeButtonTitle:o})=>{const{refs:f,context:h}=C.useFloating({open:n!==F.Closed&&!!n,onOpenChange:l}),w=C.useRole(h,{role:"dialog"}),j=C.useDismiss(h,{outsidePress:!0}),{getFloatingProps:N}=C.useInteractions([w,j]),b=m.useCallback(d=>{d?.preventDefault(),d?.stopPropagation(),l()},[l]);return t.jsx(C.FloatingPortal,{id:e,children:n!==F.Closed&&t.jsx(C.FloatingOverlay,{className:p("z-modal flex items-center justify-center bg-blackout p-4",i),children:t.jsx(C.FloatingFocusManager,{context:h,children:t.jsxs("div",{className:p("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",r===q.LG&&"max-w-[65%]",r===q.SM&&"max-w-[30%]",x&&"divide-neutrals-400 divide-y",u,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:f.setFloating,...N({onClick(d){d.stopPropagation()}}),children:[t.jsxs("div",{className:"modal-heading flex flex-row items-center justify-between px-6 py-5 sm:p-0 sm:pb-2",children:[s&&(typeof s=="string"?t.jsx("h2",{className:"modal-heading-title sm:h3 mr-3 min-w-0 flex-1",children:s}):s),t.jsx(U,{title:o,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),a.map(d=>d)]})})})})},Se=e=>e.state===F.Closed?null:t.jsx(Ie,{...e}),G="statgpt-dropdown-open",A=8,De={name:"keepDropdownWithinViewport",fn({y:e,rects:n}){if(typeof window>"u")return{};const s=document.documentElement.clientHeight||window.innerHeight,r=Math.min(n.floating.height,Math.max(0,s-A*2)),l=A,a=s-r-A;return{y:Math.min(Math.max(e,l),Math.max(l,a))}}},ke=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:l,containerClassName:a,openedClassName:i,onOptionSelect:u})=>{const x=m.useId(),[o,f]=m.useState(!1),{refs:h,floatingStyles:w,context:j}=C.useFloating({open:o,onOpenChange:l?void 0:f,placement:"bottom-end",strategy:"fixed",middleware:[C.offset(A),C.flip({padding:A}),C.size({padding:A,apply({availableHeight:g,elements:v}){v.floating.style.maxHeight=`${Math.max(0,g)}px`}}),C.shift({padding:A}),De],whileElementsMounted:C.autoUpdate}),N=C.useClick(j),b=C.useDismiss(j,{outsidePress:!0}),{getReferenceProps:d,getFloatingProps:c}=C.useInteractions([N,b]);return m.useEffect(()=>{o&&window.dispatchEvent(new CustomEvent(G,{detail:x}))},[x,o]),m.useEffect(()=>{const g=v=>{v instanceof CustomEvent&&v.detail!==x&&f(!1)};return window.addEventListener(G,g),()=>{window.removeEventListener(G,g)}},[x]),m.useEffect(()=>{l&&f(!1)},[l]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:h.setReference,...d({onClick(g){g.stopPropagation()}}),className:p(a,o&&i),children:e}),o&&t.jsx(C.FloatingPortal,{children:t.jsxs("div",{ref:h.setFloating,style:{...w,overflowY:"auto"},className:"dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",...c(),children:[s&&s,n&&n.map(g=>t.jsx("div",{onClick:v=>{v.stopPropagation(),u?.(g.key),f(!1)},className:p("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===g.key&&"bg-hues-100"),children:t.jsxs("div",{className:"dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",title:g.title,children:[g.icon?g.icon:null,t.jsx("p",{children:g?.title})]})},g.key))]})})]})},Re=({limitMessages:e,query:n})=>t.jsxs("div",{className:"flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1",children:[t.jsx("div",{className:"flex gap-x-[4px]",children:t.jsx("div",{className:"flex flex-col",children:t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:"h5 text-primary",children:[e?.excelFormatTitle," "]}),t.jsx("span",{className:"body-3 text-neutrals-800",children:e?.excelFormatText})]})})}),t.jsx("a",{href:n,target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),Oe=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:l})=>t.jsxs("div",{className:p("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",e?.containerClassName),children:[t.jsxs("div",{className:"flex items-center gap-x-2",children:[t.jsx("span",{children:e?.warningIcon}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:p("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:p("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(W):e?.showingLimit?.(W)})]}),n&&t.jsx("span",{className:p("text-neutrals-800 body-3",e?.limitMessageClassName),children:e?.fullLimitMessage})]})]}),s&&t.jsxs("span",{onClick:()=>r?.(),className:"h4 flex cursor-pointer items-center gap-x-[4px] text-primary",children:[e?.editIcon,e?.refineInAdvancedView]}),n&&t.jsx("a",{href:l||"",target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),ee=m.createContext(null);function Ae({value:e,children:n}){const s=m.useMemo(()=>e??{},[e]);return t.jsx(ee.Provider,{value:s,children:n})}function Le(){return m.useContext(ee)}var T=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e.Note="note",e))(T||{});const _e={[T.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[T.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[T.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000",[T.Note]:"border-hues-900 bg-neutrals-200 text-neutrals-1000"},Me="shrink-0",Te="min-w-0 body-2",Fe="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function Pe({type:e,icon:n,children:s,className:r,contentClassName:l}){const a=Le(),i=n??a?.icons?.[e],u=a?.classes?.container??Fe,x=a?.classes?.types?.[e]??_e[e],o=L(u,x,r),f=L(Me,a?.classes?.icon),h=L(Te,a?.classes?.content,l);return t.jsxs("div",{"data-type":e,className:o,children:[i?t.jsx("span",{className:f,children:i}):null,s?t.jsx("div",{className:h,children:s}):null]})}const Ye=({title:e,copiedTitle:n,tooltip:s,hoverTooltip:r,icon:l,copiedIcon:a,className:i,buttonTextClassName:u,onClick:x})=>{const[o,f]=m.useState(!1),h=m.useRef(null),w=()=>{x(),f(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{f(!1)},1e3)};return m.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),t.jsxs("div",{className:"relative w-fit",title:r,children:[t.jsx(Q,{title:o?n:e,isSmallButton:!0,disabled:o,buttonClassName:L(["text-button-tertiary small-icon-button !h-6 !p-0",i]),textClassName:L(["ml-1",u]),onClick:w,iconBefore:o?a:l}),s&&o&&t.jsx("div",{className:"h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow",children:s})]})};function qe({id:e,label:n,hasChildren:s,showDragHandle:r,showCheckbox:l,isChecked:a,isExpanded:i}){return t.jsxs("div",{className:"relative cursor-grabbing rounded bg-neutrals-200 shadow",children:[t.jsx("div",{className:"absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light"}),t.jsxs("div",{className:"flex items-stretch overflow-hidden rounded",children:[r?t.jsx("div",{className:"flex w-6 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:"rounded p-1",children:t.jsx(k.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[l?t.jsx(V,{id:e,checked:!!a,className:"p-0"}):null,t.jsx("span",{className:"body-3 truncate",children:n})]}),s?t.jsx("div",{className:"flex w-8 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:p("transition-transform",i?"rotate-90":"rotate-0"),children:t.jsx(k.IconChevronRight,{size:16})})}):null]})]})}function te(e,n){return`i:${[...e,n].join("/")}`}function H(e){if(!e.startsWith("i:"))return null;const s=e.slice(2).split("/").filter(Boolean);return s.length?{parentPath:s.slice(0,-1),itemId:s[s.length-1]}:null}function Be(e,n,s){const r=se(e,n);return r?r.find(l=>l.id===s)??null:null}function ne(e,n){if(n.length===0)return e;const[s,...r]=n,l=e.find(a=>a.id===s);return l?.items?ne(l.items,r):null}function se(e,n){const s=ne(e,n);return s?s.filter(r=>r.type==="item"):null}function re(e,n,s){if(n.length===0)return s(e);const[r,...l]=n;return e.map(a=>a.id!==r||!a.items?a:{...a,items:re(a.items,l,s)})}function ze({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:l,onItemClick:a,onToggleExpanded:i,onToggleChecked:u}){const x=!!n.items?.length,o=!!n.isExpanded,f=n.isDisabled?!1:n.draggable??!0,h=n.isDisabled?!1:n.checkable??!0,w=te(e,n.id),{attributes:j,listeners:N,setNodeRef:b,setActivatorNodeRef:d,transform:c,transition:g,isDragging:v}=Y.useSortable({id:w,disabled:!f}),S={transform:ce.CSS.Transform.toString(c),transition:g,opacity:v?.6:void 0},y=!!n.isDisabled,E=y||!h,R=[...e,n.id];return t.jsxs("div",{ref:b,style:S,className:p(["group flex items-stretch overflow-hidden rounded bg-white","select-none",y?"opacity-50":""]),children:[s?t.jsx("div",{className:p(["group/drag-handle flex w-6 items-center justify-center rounded",y?"":"hover:bg-neutrals-100 cursor-grab"]),children:t.jsx("span",{ref:d,"aria-hidden":!0,className:p(["rounded p-1",f?"cursor-grab":"cursor-default","transition-opacity"]),...f?N:{},...f?j:{},children:t.jsx(k.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:y,"aria-disabled":E,onClick:D=>{E||a?.({itemId:n.id,path:R,nativeEvent:D})},className:p(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",y?"":"hover:bg-neutrals-100",y?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(V,{id:`draggable-list-${R.join("-")}`,checked:!!n.isChecked,disabled:!h,className:"p-0",stopPropagation:!0,onChange:(D,I)=>u?.({itemId:n.id,path:R,nextChecked:!!I})}):null,t.jsx("span",{className:"body-3 w-full truncate text-neutrals-800",children:l?l(n):n.label})]}),x?t.jsx("button",{type:"button",disabled:y,onClick:D=>{D.stopPropagation(),i?.({itemId:n.id,path:R,nextExpanded:!o})},"aria-label":o?"Collapse":"Expand",className:p(["flex w-8 items-center justify-center rounded",y?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:p("transition-transform duration-150 ease-out",o?"rotate-90":"rotate-0"),children:t.jsx(k.IconChevronRight,{size:16})})}):null]})}function Ge({items:e,showDragHandle:n=!0,showCheckbox:s=!0,onItemsChange:r,onToggleExpanded:l,onToggleChecked:a,onItemClick:i,renderLabel:u}){const x=M.useSensors(M.useSensor(M.PointerSensor,{activationConstraint:{distance:6}})),[o,f]=ue.useState(null),h=N=>{const b=String(N.active.id),d=H(b);if(!d)return;const c=Be(e,d.parentPath,d.itemId);!c||c.type!=="item"||f({id:b,label:c.label,hasChildren:!!c.items?.length,isChecked:c.isChecked,isExpanded:c.isExpanded})},w=N=>{f(null);const b=N.over;if(!b)return;const d=H(String(N.active.id)),c=H(String(b.id));if(!d||!c||d.parentPath.join("/")!==c.parentPath.join("/"))return;const g=se(e,d.parentPath);if(!g)return;const v=g.findIndex(E=>E.id===d.itemId),S=g.findIndex(E=>E.id===c.itemId);if(v===-1||S===-1||v===S)return;const y=re(e,d.parentPath,E=>{const R=E.filter(_=>_.type==="item"),D=Y.arrayMove(R,v,S);let I=0;return E.map(_=>{if(_.type!=="item")return _;const z=D[I];return I+=1,z})});r(y)},j=(N,b=[])=>{const d=N.filter(c=>c.type==="item").map(c=>te(b,c.id));return t.jsx(Y.SortableContext,{items:d,strategy:Y.verticalListSortingStrategy,children:t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:N.map(c=>c.type==="group"?t.jsxs("li",{className:"m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",children:[t.jsxs("div",{className:"h5 flex items-center gap-2 py-1 text-neutrals-1000",children:[t.jsx(k.IconDatabase,{size:12,className:"shrink-0"}),c.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:j(c.items,[...b,c.id])})]},c.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(ze,{parentPath:b,item:c,showDragHandle:n,showCheckbox:s,renderLabel:u,onItemClick:i,onToggleExpanded:l,onToggleChecked:a}),c.items?.length&&c.isExpanded?t.jsx("div",{className:"pl-7",children:j(c.items,[...b,c.id])}):null]},c.id))})})};return t.jsxs(M.DndContext,{sensors:x,collisionDetection:M.closestCenter,onDragStart:h,onDragEnd:w,children:[t.jsx("div",{className:"flex flex-col",children:j(e)}),t.jsx(M.DragOverlay,{children:o?t.jsx(qe,{id:o.id,label:o.label,hasChildren:o.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:o.isChecked,isExpanded:o.isExpanded}):null})]})}const He=(e,n)=>e.label.toLowerCase().includes(n);function We(e,n,s={}){const r=Ue(n);if(!r)return e;const{expandMatchedBranches:l=!0,includeGroupDescendantsOnMatch:a=!0,includeItemDescendantsOnMatch:i=!1,match:u=He}=s;return $(e,r,{expandMatchedBranches:l,includeGroupDescendantsOnMatch:a,includeItemDescendantsOnMatch:i,match:u})??[]}function $(e,n,s){const r=[];for(const l of e){const a=$e(l,n,s);a&&r.push(a)}return r.length?r:null}function $e(e,n,s){const r=s.match(e,n);if(e.type==="group"){if(r&&s.includeGroupDescendantsOnMatch)return B(e,s.expandMatchedBranches);const i=e.items?.length?$(e.items,n,s):null;return!r&&!i?null:{...e,items:i??[]}}const l=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return B(e,s.expandMatchedBranches);if(!r&&!l)return null;const a={...e};return l?(a.items=l,s.expandMatchedBranches&&(a.isExpanded=!0)):delete a.items,a}function B(e,n){return e.type==="group"?{...e,items:e.items.map(s=>B(s,n))}:{...e,isExpanded:n&&e.items?.length?!0:e.isExpanded,items:e.items?.map(s=>B(s,n))}}function Ue(e){return e.trim().toLowerCase()}var le=(e=>(e.Enter="Enter",e))(le||{});const ae=m.createContext(null);function Ve({children:e,isAgentAvailable:n}){const s=m.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(ae.Provider,{value:s,children:e})}function Ke(){const e=m.useContext(ae);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=Ve;exports.Alert=fe;exports.AlertType=O;exports.Button=Q;exports.CALENDAR_MOBILE_PADDING=X;exports.Calendar=be;exports.Checkbox=V;exports.CloseButton=U;exports.CollapsibleBlock=je;exports.CopyButton=Ye;exports.DownloadFormatMessage=Re;exports.DraggableList=Ge;exports.Dropdown=ke;exports.HighlightText=Ne;exports.IconButton=we;exports.InlineAlert=Pe;exports.InlineAlertProvider=Ae;exports.InlineAlertType=T;exports.Input=J;exports.InputWithIcon=Ce;exports.KeyboardKey=le;exports.Link=ve;exports.Loader=K;exports.PopUpSize=q;exports.PopUpState=F;exports.Popup=Se;exports.Radio=Ee;exports.RequestLimitMessage=Oe;exports.SERIES_LIMIT=W;exports.TREE_NODE_ARROW_SIZE=pe;exports.TREE_NODE_PADDING=ge;exports.Tag=ye;exports.filterDraggableListNodes=We;exports.useAgentAvailability=Ke;exports.useDebounce=he;exports.useIsMobile=Z;
package/index.mjs CHANGED
@@ -1,15 +1,15 @@
1
- import { jsx as r, jsxs as u, Fragment as q } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as u, Fragment as V } from "react/jsx-runtime";
2
2
  import * as ue from "react";
3
- import { useEffect as O, useState as j, useRef as W, useCallback as P, useMemo as U, useId as me, createContext as Q, useContext as K } from "react";
3
+ import { useEffect as L, useState as j, useRef as z, useCallback as P, useMemo as q, useId as me, createContext as Q, useContext as K } from "react";
4
4
  import g from "classnames";
5
- import { IconX as he, IconCalendarEvent as fe, IconSquareCheckFilled as pe, IconChevronDown as ge, IconGripVertical as X, IconChevronRight as Z, IconDatabase as xe } from "@tabler/icons-react";
6
- import { extendTailwindMerge as be } from "tailwind-merge";
7
- import Ne from "react-flatpickr";
5
+ import { IconX as he, IconCalendarEvent as fe, IconSquareCheckFilled as pe, IconSquareMinusFilled as ge, IconChevronDown as xe, IconGripVertical as X, IconChevronRight as Z, IconDatabase as be } from "@tabler/icons-react";
6
+ import { extendTailwindMerge as Ne } from "tailwind-merge";
7
+ import we from "react-flatpickr";
8
8
  import { CalendarResolution as A } from "@epam/statgpt-shared-toolkit";
9
- import { useFloating as J, useRole as we, useDismiss as ee, useInteractions as te, FloatingPortal as ne, FloatingOverlay as ve, FloatingFocusManager as Ce, autoUpdate as ye, offset as Ee, flip as Ie, size as Se, shift as ke, useClick as De } from "@floating-ui/react";
10
- import { useSensors as Le, useSensor as Oe, PointerSensor as Fe, DndContext as Re, closestCenter as _e, DragOverlay as Ae } from "@dnd-kit/core";
11
- import { useSortable as Me, SortableContext as Te, verticalListSortingStrategy as Pe, arrayMove as Ye } from "@dnd-kit/sortable";
12
- import { CSS as je } from "@dnd-kit/utilities";
9
+ import { useFloating as J, useRole as ve, useDismiss as ee, useInteractions as te, FloatingPortal as ne, FloatingOverlay as Ce, FloatingFocusManager as ye, autoUpdate as Ee, offset as Ie, flip as Se, size as ke, shift as De, useClick as Le } from "@floating-ui/react";
10
+ import { useSensors as Oe, useSensor as Fe, PointerSensor as Re, DndContext as _e, closestCenter as Ae, DragOverlay as Me } from "@dnd-kit/core";
11
+ import { useSortable as Te, SortableContext as Pe, verticalListSortingStrategy as Ye, arrayMove as je } from "@dnd-kit/sortable";
12
+ import { CSS as ze } from "@dnd-kit/utilities";
13
13
  const re = ({
14
14
  title: e,
15
15
  btnClassNames: t,
@@ -28,7 +28,7 @@ const re = ({
28
28
  }
29
29
  );
30
30
  var _ = /* @__PURE__ */ ((e) => (e.INFO = "info", e.ERROR = "error", e.SUCCESS = "success", e.IN_PROGRESS = "in_progress", e))(_ || {});
31
- const ze = 3e4, bt = ({
31
+ const He = 3e4, Nt = ({
32
32
  alertDetails: e,
33
33
  infoIcon: t,
34
34
  successIcon: n,
@@ -37,20 +37,20 @@ const ze = 3e4, bt = ({
37
37
  closeButtonTitle: a,
38
38
  children: i
39
39
  }) => {
40
- const m = e?.type, h = m === _.IN_PROGRESS || m === _.INFO, c = () => h ? "alert-in-progress" : m === _.SUCCESS ? "alert-success" : "alert-error", f = h ? t : m === _.SUCCESS ? n : m === _.ERROR ? s : null, p = e?.text;
41
- return O(() => {
40
+ const m = e?.type, h = m === _.IN_PROGRESS || m === _.INFO, o = () => h ? "alert-in-progress" : m === _.SUCCESS ? "alert-success" : "alert-error", f = h ? t : m === _.SUCCESS ? n : m === _.ERROR ? s : null, p = e?.text;
41
+ return L(() => {
42
42
  if (!e || h)
43
43
  return;
44
- const N = setTimeout(() => {
44
+ const v = setTimeout(() => {
45
45
  l?.();
46
- }, ze);
47
- return () => clearTimeout(N);
46
+ }, He);
47
+ return () => clearTimeout(v);
48
48
  }, [e, h, l]), /* @__PURE__ */ r(
49
49
  "div",
50
50
  {
51
51
  className: g(
52
52
  "alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",
53
- c()
53
+ o()
54
54
  ),
55
55
  children: /* @__PURE__ */ u("div", { className: "alert-content flex items-start", children: [
56
56
  f && /* @__PURE__ */ r("div", { className: "alert-icon", children: f }),
@@ -69,7 +69,7 @@ const ze = 3e4, bt = ({
69
69
  ] })
70
70
  }
71
71
  );
72
- }, He = () => /* @__PURE__ */ r("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ r("div", { className: "loader" }) }), $e = be({
72
+ }, $e = () => /* @__PURE__ */ r("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ r("div", { className: "loader" }) }), Ge = Ne({
73
73
  extend: {
74
74
  classGroups: {
75
75
  typography: [
@@ -87,9 +87,9 @@ const ze = 3e4, bt = ({
87
87
  }
88
88
  });
89
89
  function F(...e) {
90
- return $e(g(...e));
90
+ return Ge(g(...e));
91
91
  }
92
- const Ge = ({
92
+ const Be = ({
93
93
  buttonClassName: e,
94
94
  textClassName: t,
95
95
  isLoading: n = !1,
@@ -100,7 +100,7 @@ const Ge = ({
100
100
  onClick: m,
101
101
  isSmallButton: h
102
102
  }) => {
103
- const c = F([
103
+ const o = F([
104
104
  h ? "font-semibold" : "",
105
105
  a ? "mr-2" : "",
106
106
  i ? "ml-2" : "",
@@ -121,26 +121,26 @@ const Ge = ({
121
121
  title: s,
122
122
  children: [
123
123
  i,
124
- n && /* @__PURE__ */ r(He, {}),
125
- s ? h ? /* @__PURE__ */ r("h4", { className: c, children: s }) : /* @__PURE__ */ r("h3", { className: c, children: s }) : null,
124
+ n && /* @__PURE__ */ r($e, {}),
125
+ s ? h ? /* @__PURE__ */ r("h4", { className: o, children: s }) : /* @__PURE__ */ r("h3", { className: o, children: s }) : null,
126
126
  a
127
127
  ]
128
128
  }
129
129
  );
130
130
  };
131
- function Be(e = 719) {
131
+ function We(e = 719) {
132
132
  const [t, n] = j(
133
133
  () => typeof window < "u" ? window.innerWidth < e : !1
134
134
  );
135
- return O(() => {
135
+ return L(() => {
136
136
  const s = window.matchMedia(`(max-width: ${e}px)`), l = (a) => {
137
137
  n(a.matches);
138
138
  };
139
139
  return n(s.matches), s.addEventListener("change", l), () => s.removeEventListener("change", l);
140
140
  }, [e]), t;
141
141
  }
142
- function Nt(e, t) {
143
- const n = W(null);
142
+ function wt(e, t) {
143
+ const n = z(null);
144
144
  return P(
145
145
  (...l) => {
146
146
  n.current && clearTimeout(n.current), n.current = setTimeout(() => {
@@ -150,7 +150,7 @@ function Nt(e, t) {
150
150
  [e, t]
151
151
  );
152
152
  }
153
- const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
153
+ const vt = 24, Ct = 24, U = 1e3, qe = 24, yt = ({
154
154
  label: e,
155
155
  onChange: t,
156
156
  value: n,
@@ -160,36 +160,36 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
160
160
  icon: i,
161
161
  isEndDate: m
162
162
  }) => {
163
- const h = W(null), c = Be();
164
- O(() => {
165
- const w = h?.current;
166
- w && w.querySelector("input")?.setAttribute("aria-label", e);
163
+ const h = z(null), o = We();
164
+ L(() => {
165
+ const N = h?.current;
166
+ N && N.querySelector("input")?.setAttribute("aria-label", e);
167
167
  }, [e]);
168
168
  const f = {
169
169
  ...s,
170
170
  disableMobile: !0,
171
171
  defaultDate: l === A.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n
172
- }, p = (w, C, b) => {
172
+ }, p = (N, w, b) => {
173
173
  const d = `calendar__${l === A.MONTH ? "month" : "day"}`;
174
174
  b.calendarContainer && b.calendarContainer.classList.add(d);
175
- }, N = (w, C, b) => {
176
- if (l === A.MONTH && w.length > 0) {
177
- const d = s.minDate, o = s.maxDate, x = w[0].getFullYear(), v = b.calendarContainer, S = "flatpickr-disabled", y = v.querySelectorAll(
175
+ }, v = (N, w, b) => {
176
+ if (l === A.MONTH && N.length > 0) {
177
+ const d = s.minDate, c = s.maxDate, x = N[0].getFullYear(), C = b.calendarContainer, S = "flatpickr-disabled", y = C.querySelectorAll(
178
178
  ".flatpickr-monthSelect-month"
179
- ), E = v.querySelectorAll(
179
+ ), E = C.querySelectorAll(
180
180
  ".flatpickr-next-month"
181
- )[0], D = v.querySelectorAll(
181
+ )[0], D = C.querySelectorAll(
182
182
  ".flatpickr-prev-month"
183
183
  )[0];
184
- x === o.getFullYear() && E.classList.add(S), x === d.getFullYear() && D.classList.add(S), (x === d.getFullYear() || x === o.getFullYear()) && y.forEach((k) => {
184
+ x === c.getFullYear() && E.classList.add(S), x === d.getFullYear() && D.classList.add(S), (x === d.getFullYear() || x === c.getFullYear()) && y.forEach((k) => {
185
185
  k.classList.remove(S);
186
- const I = new Date(k.getAttribute("aria-label")), R = I.getFullYear() === d.getFullYear() && I.getMonth() === d.getMonth(), z = I.getFullYear() === o.getFullYear() && I.getMonth() === o.getMonth();
187
- R || z || (I < d || I > o) && k.classList.add(S);
186
+ const I = new Date(k.getAttribute("aria-label")), R = I.getFullYear() === d.getFullYear() && I.getMonth() === d.getMonth(), H = I.getFullYear() === c.getFullYear() && I.getMonth() === c.getMonth();
187
+ R || H || (I < d || I > c) && k.classList.add(S);
188
188
  });
189
189
  }
190
190
  setTimeout(() => {
191
- const d = b.calendarContainer, o = b._input?.getBoundingClientRect();
192
- d && (d.style.top = `${o.top - d.offsetHeight - 8}px`, d.style.width = `${d.style.width}px`, m ? (d.style.right = `${window.innerWidth - o.right - (c ? We : 0)}px`, d.style.left = "auto") : d.style.left = `${o.left}px`);
191
+ const d = b.calendarContainer, c = b._input?.getBoundingClientRect();
192
+ d && (d.style.top = `${c.top - d.offsetHeight - 8}px`, d.style.width = `${d.style.width}px`, m ? (d.style.right = `${window.innerWidth - c.right - (o ? qe : 0)}px`, d.style.left = "auto") : d.style.left = `${c.left}px`);
193
193
  }, 0);
194
194
  };
195
195
  return /* @__PURE__ */ u("div", { className: "calendar relative", ref: h, children: [
@@ -203,14 +203,14 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
203
203
  }
204
204
  ),
205
205
  /* @__PURE__ */ r(
206
- Ne,
206
+ we,
207
207
  {
208
208
  defaultValue: (l === A.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n)?.toDateString(),
209
209
  options: f,
210
- onChange: (w) => {
211
- t(w[0]);
210
+ onChange: (N) => {
211
+ t(N[0]);
212
212
  },
213
- onOpen: [N],
213
+ onOpen: [v],
214
214
  onReady: [p],
215
215
  id: a
216
216
  }
@@ -220,37 +220,44 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
220
220
  label: e,
221
221
  id: t,
222
222
  checked: n,
223
- checkboxIcon: s,
224
- onChange: l,
225
- disabled: a = !1,
226
- disabledScope: i = "full",
227
- className: m,
228
- stopPropagation: h = !0
223
+ indeterminate: s = !1,
224
+ checkboxIcon: l,
225
+ onChange: a,
226
+ disabled: i = !1,
227
+ disabledScope: m = "full",
228
+ className: h,
229
+ stopPropagation: o = !0
229
230
  }) => {
230
- const c = P(
231
- (N) => {
232
- h && N.stopPropagation();
231
+ const f = z(null);
232
+ L(() => {
233
+ f.current && (f.current.indeterminate = !n && s);
234
+ }, [n, s]);
235
+ const p = P(
236
+ (w) => {
237
+ o && w.stopPropagation();
233
238
  },
234
- [h]
235
- ), f = P(
236
- (N) => {
237
- h && N.stopPropagation(), l?.(t, N.target.checked);
239
+ [o]
240
+ ), v = P(
241
+ (w) => {
242
+ o && w.stopPropagation(), a?.(t, w.target.checked);
238
243
  },
239
- [l, t, h]
240
- ), p = () => {
244
+ [a, t, o]
245
+ ), N = () => {
241
246
  if (n)
242
- return s || /* @__PURE__ */ r(pe, { className: "absolute size-4" });
247
+ return l || /* @__PURE__ */ r(pe, { className: "absolute size-4" });
248
+ if (s)
249
+ return /* @__PURE__ */ r(ge, { className: "absolute size-4" });
243
250
  };
244
251
  return /* @__PURE__ */ u(
245
252
  "label",
246
253
  {
247
254
  htmlFor: t,
248
- onClick: c,
255
+ onClick: p,
249
256
  className: F(
250
257
  "flex min-w-0 items-center py-1 shrink-0",
251
- a ? "cursor-not-allowed" : "cursor-pointer",
252
- a && i === "full" && "opacity-50",
253
- m
258
+ i ? "cursor-not-allowed" : "cursor-pointer",
259
+ i && m === "full" && "opacity-50",
260
+ h
254
261
  ),
255
262
  children: [
256
263
  /* @__PURE__ */ r(
@@ -258,10 +265,10 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
258
265
  {
259
266
  className: g(
260
267
  "checkbox-button relative flex size-[14px] items-center justify-center",
261
- a && i === "icon" && "opacity-50"
268
+ i && m === "icon" && "opacity-50"
262
269
  ),
263
270
  "aria-hidden": !0,
264
- children: p()
271
+ children: N()
265
272
  }
266
273
  ),
267
274
  e ? /* @__PURE__ */ r(
@@ -277,18 +284,19 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
277
284
  /* @__PURE__ */ r(
278
285
  "input",
279
286
  {
287
+ ref: f,
280
288
  id: t,
281
289
  type: "checkbox",
282
290
  checked: n,
283
- disabled: a,
284
- onChange: f,
291
+ disabled: i,
292
+ onChange: v,
285
293
  className: "hidden"
286
294
  }
287
295
  )
288
296
  ]
289
297
  }
290
298
  );
291
- }, yt = ({
299
+ }, Et = ({
292
300
  title: e,
293
301
  icon: t,
294
302
  children: n,
@@ -306,7 +314,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
306
314
  className: "collapsible-block-title flex cursor-pointer items-center py-4",
307
315
  onClick: () => a(!l),
308
316
  children: [
309
- /* @__PURE__ */ r("div", { className: `${l ? "rotate-180" : ""} transition-transform`, children: t || /* @__PURE__ */ r(ge, { className: "mr-3 size-5" }) }),
317
+ /* @__PURE__ */ r("div", { className: `${l ? "rotate-180" : ""} transition-transform`, children: t || /* @__PURE__ */ r(xe, { className: "mr-3 size-5" }) }),
310
318
  /* @__PURE__ */ u("div", { className: "flex flex-1 items-center justify-between", children: [
311
319
  /* @__PURE__ */ r("span", { children: e }),
312
320
  s && /* @__PURE__ */ r("p", { className: "body-1 text-neutrals-800", children: s })
@@ -318,22 +326,22 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
318
326
  ]
319
327
  }
320
328
  );
321
- }, Et = ({ text: e, highlightText: t }) => {
322
- const n = U(() => {
329
+ }, It = ({ text: e, highlightText: t }) => {
330
+ const n = q(() => {
323
331
  const s = [];
324
332
  if (!t)
325
333
  return [{ id: 0, text: e, highlight: !1 }];
326
334
  const l = t?.toLowerCase() || "", a = e?.toLowerCase()?.split(l) || "";
327
335
  for (let i = 0, m = 0; i < a?.length; i++) {
328
- const h = a?.[i], c = h.length;
336
+ const h = a?.[i], o = h.length;
329
337
  h !== "" && s.push({
330
338
  id: s.length,
331
339
  highlight: !1,
332
340
  text: e?.substring(
333
341
  m,
334
- m + c
342
+ m + o
335
343
  )
336
- }), m += c, i !== a?.length - 1 && (s.push({
344
+ }), m += o, i !== a?.length - 1 && (s.push({
337
345
  id: s.length,
338
346
  highlight: !0,
339
347
  text: e?.substring(
@@ -344,7 +352,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
344
352
  }
345
353
  return s;
346
354
  }, [t, e]);
347
- return /* @__PURE__ */ r(q, { children: n.map((s) => /* @__PURE__ */ r(
355
+ return /* @__PURE__ */ r(V, { children: n.map((s) => /* @__PURE__ */ r(
348
356
  "span",
349
357
  {
350
358
  className: g(s?.highlight && "bg-highlight"),
@@ -352,7 +360,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
352
360
  },
353
361
  s?.id
354
362
  )) });
355
- }, It = ({
363
+ }, St = ({
356
364
  icon: e,
357
365
  onClick: t,
358
366
  buttonClassName: n,
@@ -383,7 +391,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
383
391
  readonly: i,
384
392
  onChange: m,
385
393
  onKeyDown: h,
386
- onFocus: c,
394
+ onFocus: o,
387
395
  onBlur: f
388
396
  }) => {
389
397
  const p = g(
@@ -403,12 +411,12 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
403
411
  disabled: a,
404
412
  className: p,
405
413
  onKeyDown: h,
406
- onFocus: c,
414
+ onFocus: o,
407
415
  onBlur: f,
408
- onChange: (N) => m?.(N.currentTarget.value)
416
+ onChange: (v) => m?.(v.currentTarget.value)
409
417
  }
410
418
  );
411
- }, St = ({
419
+ }, kt = ({
412
420
  iconBeforeInput: e,
413
421
  iconAfterInput: t,
414
422
  containerClasses: n,
@@ -427,7 +435,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
427
435
  }
428
436
  ),
429
437
  t
430
- ] }), kt = ({
438
+ ] }), Dt = ({
431
439
  url: e,
432
440
  title: t,
433
441
  linkClassName: n = "",
@@ -453,7 +461,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
453
461
  ]
454
462
  }
455
463
  );
456
- }, Dt = ({ title: e, text: t, disabled: n, onClick: s }) => /* @__PURE__ */ r(
464
+ }, Lt = ({ title: e, text: t, disabled: n, onClick: s }) => /* @__PURE__ */ r(
457
465
  "button",
458
466
  {
459
467
  type: "button",
@@ -466,7 +474,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
466
474
  "aria-label": "button",
467
475
  children: /* @__PURE__ */ r("h4", { children: e })
468
476
  }
469
- ), Lt = ({
477
+ ), Ot = ({
470
478
  label: e,
471
479
  id: t,
472
480
  checked: n,
@@ -529,7 +537,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
529
537
  }
530
538
  );
531
539
  };
532
- var T = /* @__PURE__ */ ((e) => (e.Closed = "Closed", e.Opened = "Opened", e))(T || {}), G = /* @__PURE__ */ ((e) => (e.LG = "Large", e.SM = "Small", e))(G || {});
540
+ var T = /* @__PURE__ */ ((e) => (e.Closed = "Closed", e.Opened = "Opened", e))(T || {}), B = /* @__PURE__ */ ((e) => (e.LG = "Large", e.SM = "Small", e))(B || {});
533
541
  const Ve = ({
534
542
  portalId: e,
535
543
  state: t = T.Opened,
@@ -540,37 +548,37 @@ const Ve = ({
540
548
  overlayClassName: i,
541
549
  containerClassName: m,
542
550
  dividers: h = !0,
543
- closeButtonTitle: c
551
+ closeButtonTitle: o
544
552
  }) => {
545
553
  const { refs: f, context: p } = J({
546
554
  open: t !== T.Closed && !!t,
547
555
  onOpenChange: l
548
- }), N = we(p, { role: "dialog" }), w = ee(p, { outsidePress: !0 }), { getFloatingProps: C } = te([N, w]), b = P(
556
+ }), v = ve(p, { role: "dialog" }), N = ee(p, { outsidePress: !0 }), { getFloatingProps: w } = te([v, N]), b = P(
549
557
  (d) => {
550
558
  d?.preventDefault(), d?.stopPropagation(), l();
551
559
  },
552
560
  [l]
553
561
  );
554
562
  return /* @__PURE__ */ r(ne, { id: e, children: t !== T.Closed && /* @__PURE__ */ r(
555
- ve,
563
+ Ce,
556
564
  {
557
565
  className: g(
558
566
  "z-modal flex items-center justify-center bg-blackout p-4",
559
567
  i
560
568
  ),
561
- children: /* @__PURE__ */ r(Ce, { context: p, children: /* @__PURE__ */ u(
569
+ children: /* @__PURE__ */ r(ye, { context: p, children: /* @__PURE__ */ u(
562
570
  "div",
563
571
  {
564
572
  className: g(
565
573
  "relative max-h-full modal rounded bg-white flex flex-col shadow w-full",
566
- s === G.LG && "max-w-[65%]",
567
- s === G.SM && "max-w-[30%]",
574
+ s === B.LG && "max-w-[65%]",
575
+ s === B.SM && "max-w-[30%]",
568
576
  h && "divide-neutrals-400 divide-y",
569
577
  m,
570
578
  "sm:w-full sm:max-w-full sm:px-4 sm:py-6"
571
579
  ),
572
580
  ref: f.setFloating,
573
- ...C({
581
+ ...w({
574
582
  onClick(d) {
575
583
  d.stopPropagation();
576
584
  }
@@ -581,7 +589,7 @@ const Ve = ({
581
589
  /* @__PURE__ */ r(
582
590
  re,
583
591
  {
584
- title: c,
592
+ title: o,
585
593
  onClick: b,
586
594
  btnClassNames: "sm:h-[24px] sm:w-[24px] sm:top-4"
587
595
  }
@@ -593,20 +601,20 @@ const Ve = ({
593
601
  ) })
594
602
  }
595
603
  ) });
596
- }, Ot = (e) => e.state === T.Closed ? null : /* @__PURE__ */ r(Ve, { ...e }), H = "statgpt-dropdown-open", L = 8, qe = {
604
+ }, Ft = (e) => e.state === T.Closed ? null : /* @__PURE__ */ r(Ve, { ...e }), $ = "statgpt-dropdown-open", O = 8, Qe = {
597
605
  name: "keepDropdownWithinViewport",
598
606
  fn({ y: e, rects: t }) {
599
607
  if (typeof window > "u")
600
608
  return {};
601
609
  const n = document.documentElement.clientHeight || window.innerHeight, s = Math.min(
602
610
  t.floating.height,
603
- Math.max(0, n - L * 2)
604
- ), l = L, a = n - s - L;
611
+ Math.max(0, n - O * 2)
612
+ ), l = O, a = n - s - O;
605
613
  return {
606
614
  y: Math.min(Math.max(e, l), Math.max(l, a))
607
615
  };
608
616
  }
609
- }, Ft = ({
617
+ }, Rt = ({
610
618
  triggerButton: e,
611
619
  options: t,
612
620
  content: n,
@@ -616,45 +624,45 @@ const Ve = ({
616
624
  openedClassName: i,
617
625
  onOptionSelect: m
618
626
  }) => {
619
- const h = me(), [c, f] = j(!1), { refs: p, floatingStyles: N, context: w } = J({
620
- open: c,
627
+ const h = me(), [o, f] = j(!1), { refs: p, floatingStyles: v, context: N } = J({
628
+ open: o,
621
629
  onOpenChange: l ? void 0 : f,
622
630
  placement: "bottom-end",
623
631
  strategy: "fixed",
624
632
  middleware: [
625
- Ee(L),
626
- Ie({ padding: L }),
627
- Se({
628
- padding: L,
629
- apply({ availableHeight: x, elements: v }) {
630
- v.floating.style.maxHeight = `${Math.max(
633
+ Ie(O),
634
+ Se({ padding: O }),
635
+ ke({
636
+ padding: O,
637
+ apply({ availableHeight: x, elements: C }) {
638
+ C.floating.style.maxHeight = `${Math.max(
631
639
  0,
632
640
  x
633
641
  )}px`;
634
642
  }
635
643
  }),
636
- ke({ padding: L }),
637
- qe
644
+ De({ padding: O }),
645
+ Qe
638
646
  ],
639
- whileElementsMounted: ye
640
- }), C = De(w), b = ee(w, { outsidePress: !0 }), { getReferenceProps: d, getFloatingProps: o } = te([
641
- C,
647
+ whileElementsMounted: Ee
648
+ }), w = Le(N), b = ee(N, { outsidePress: !0 }), { getReferenceProps: d, getFloatingProps: c } = te([
649
+ w,
642
650
  b
643
651
  ]);
644
- return O(() => {
645
- c && window.dispatchEvent(
646
- new CustomEvent(H, { detail: h })
652
+ return L(() => {
653
+ o && window.dispatchEvent(
654
+ new CustomEvent($, { detail: h })
647
655
  );
648
- }, [h, c]), O(() => {
649
- const x = (v) => {
650
- v instanceof CustomEvent && v.detail !== h && f(!1);
656
+ }, [h, o]), L(() => {
657
+ const x = (C) => {
658
+ C instanceof CustomEvent && C.detail !== h && f(!1);
651
659
  };
652
- return window.addEventListener(H, x), () => {
653
- window.removeEventListener(H, x);
660
+ return window.addEventListener($, x), () => {
661
+ window.removeEventListener($, x);
654
662
  };
655
- }, [h]), O(() => {
663
+ }, [h]), L(() => {
656
664
  l && f(!1);
657
- }, [l]), /* @__PURE__ */ u(q, { children: [
665
+ }, [l]), /* @__PURE__ */ u(V, { children: [
658
666
  /* @__PURE__ */ r(
659
667
  "div",
660
668
  {
@@ -664,24 +672,24 @@ const Ve = ({
664
672
  x.stopPropagation();
665
673
  }
666
674
  }),
667
- className: g(a, c && i),
675
+ className: g(a, o && i),
668
676
  children: e
669
677
  }
670
678
  ),
671
- c && /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ u(
679
+ o && /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ u(
672
680
  "div",
673
681
  {
674
682
  ref: p.setFloating,
675
- style: { ...N, overflowY: "auto" },
683
+ style: { ...v, overflowY: "auto" },
676
684
  className: "dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",
677
- ...o(),
685
+ ...c(),
678
686
  children: [
679
687
  n && n,
680
688
  t && t.map((x) => /* @__PURE__ */ r(
681
689
  "div",
682
690
  {
683
- onClick: (v) => {
684
- v.stopPropagation(), m?.(x.key), f(!1);
691
+ onClick: (C) => {
692
+ C.stopPropagation(), m?.(x.key), f(!1);
685
693
  },
686
694
  className: g(
687
695
  "text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",
@@ -705,7 +713,7 @@ const Ve = ({
705
713
  }
706
714
  ) })
707
715
  ] });
708
- }, Rt = ({ limitMessages: e, query: t }) => /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1", children: [
716
+ }, _t = ({ limitMessages: e, query: t }) => /* @__PURE__ */ u("div", { className: "flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1", children: [
709
717
  /* @__PURE__ */ r("div", { className: "flex gap-x-[4px]", children: /* @__PURE__ */ r("div", { className: "flex flex-col", children: /* @__PURE__ */ u("div", { className: "flex gap-x-[4px]", children: [
710
718
  /* @__PURE__ */ u("span", { className: "h5 text-primary", children: [
711
719
  e?.excelFormatTitle,
@@ -717,7 +725,7 @@ const Ve = ({
717
725
  e?.dataExplorerIcon,
718
726
  e?.dataExplorer
719
727
  ] }) })
720
- ] }), _t = ({
728
+ ] }), At = ({
721
729
  limitMessages: e,
722
730
  isDownload: t,
723
731
  showAdvancedViewButton: n,
@@ -756,7 +764,7 @@ const Ve = ({
756
764
  "text-neutrals-800 body-3",
757
765
  e?.limitMessageClassName
758
766
  ),
759
- children: t ? e?.downloadMessage?.(V) : e?.showingLimit?.(V)
767
+ children: t ? e?.downloadMessage?.(U) : e?.showingLimit?.(U)
760
768
  }
761
769
  )
762
770
  ] }),
@@ -790,41 +798,41 @@ const Ve = ({
790
798
  ]
791
799
  }
792
800
  ), le = Q(null);
793
- function At({
801
+ function Mt({
794
802
  value: e,
795
803
  children: t
796
804
  }) {
797
- const n = U(() => e ?? {}, [e]);
805
+ const n = q(() => e ?? {}, [e]);
798
806
  return /* @__PURE__ */ r(le.Provider, { value: n, children: t });
799
807
  }
800
- function Qe() {
808
+ function Ke() {
801
809
  return K(le);
802
810
  }
803
811
  var M = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Warning = "warning", e.Note = "note", e))(M || {});
804
- const Ke = {
812
+ const Xe = {
805
813
  [M.Info]: "border-neutrals-800 bg-neutrals-300 text-neutrals-1000",
806
814
  [M.Error]: "border-semantic-error bg-semantic-error-light text-neutrals-1000",
807
815
  [M.Warning]: "border-semantic-warning bg-semantic-warning-light text-neutrals-1000",
808
816
  [M.Note]: "border-hues-900 bg-neutrals-200 text-neutrals-1000"
809
- }, Xe = "shrink-0", Ze = "min-w-0 body-2", Je = "flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";
810
- function Mt({
817
+ }, Ze = "shrink-0", Je = "min-w-0 body-2", et = "flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";
818
+ function Tt({
811
819
  type: e,
812
820
  icon: t,
813
821
  children: n,
814
822
  className: s,
815
823
  contentClassName: l
816
824
  }) {
817
- const a = Qe(), i = t ?? a?.icons?.[e], m = a?.classes?.container ?? Je, h = a?.classes?.types?.[e] ?? Ke[e], c = F(m, h, s), f = F(Xe, a?.classes?.icon), p = F(
818
- Ze,
825
+ const a = Ke(), i = t ?? a?.icons?.[e], m = a?.classes?.container ?? et, h = a?.classes?.types?.[e] ?? Xe[e], o = F(m, h, s), f = F(Ze, a?.classes?.icon), p = F(
826
+ Je,
819
827
  a?.classes?.content,
820
828
  l
821
829
  );
822
- return /* @__PURE__ */ u("div", { "data-type": e, className: c, children: [
830
+ return /* @__PURE__ */ u("div", { "data-type": e, className: o, children: [
823
831
  i ? /* @__PURE__ */ r("span", { className: f, children: i }) : null,
824
832
  n ? /* @__PURE__ */ r("div", { className: p, children: n }) : null
825
833
  ] });
826
834
  }
827
- const Tt = ({
835
+ const Pt = ({
828
836
  title: e,
829
837
  copiedTitle: t,
830
838
  tooltip: n,
@@ -835,33 +843,33 @@ const Tt = ({
835
843
  buttonTextClassName: m,
836
844
  onClick: h
837
845
  }) => {
838
- const [c, f] = j(!1), p = W(null), N = () => {
846
+ const [o, f] = j(!1), p = z(null), v = () => {
839
847
  h(), f(!0), p.current && clearTimeout(p.current), p.current = setTimeout(() => {
840
848
  f(!1);
841
849
  }, 1e3);
842
850
  };
843
- return O(() => () => {
851
+ return L(() => () => {
844
852
  p.current && clearTimeout(p.current);
845
853
  }, []), /* @__PURE__ */ u("div", { className: "relative w-fit", title: s, children: [
846
854
  /* @__PURE__ */ r(
847
- Ge,
855
+ Be,
848
856
  {
849
- title: c ? t : e,
857
+ title: o ? t : e,
850
858
  isSmallButton: !0,
851
- disabled: c,
859
+ disabled: o,
852
860
  buttonClassName: F([
853
861
  "text-button-tertiary small-icon-button !h-6 !p-0",
854
862
  i
855
863
  ]),
856
864
  textClassName: F(["ml-1", m]),
857
- onClick: N,
858
- iconBefore: c ? a : l
865
+ onClick: v,
866
+ iconBefore: o ? a : l
859
867
  }
860
868
  ),
861
- n && c && /* @__PURE__ */ r("div", { className: "h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow", children: n })
869
+ n && o && /* @__PURE__ */ r("div", { className: "h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow", children: n })
862
870
  ] });
863
871
  };
864
- function et({
872
+ function tt({
865
873
  id: e,
866
874
  label: t,
867
875
  hasChildren: n,
@@ -895,7 +903,7 @@ function et({
895
903
  function ae(e, t) {
896
904
  return `i:${[...e, t].join("/")}`;
897
905
  }
898
- function $(e) {
906
+ function G(e) {
899
907
  if (!e.startsWith("i:")) return null;
900
908
  const n = e.slice(2).split("/").filter(Boolean);
901
909
  return n.length ? {
@@ -903,7 +911,7 @@ function $(e) {
903
911
  itemId: n[n.length - 1]
904
912
  } : null;
905
913
  }
906
- function tt(e, t, n) {
914
+ function nt(e, t, n) {
907
915
  const s = oe(e, t);
908
916
  return s ? s.find((l) => l.id === n) ?? null : null;
909
917
  }
@@ -927,7 +935,7 @@ function ce(e, t, n) {
927
935
  items: ce(a.items, l, n)
928
936
  });
929
937
  }
930
- function nt({
938
+ function rt({
931
939
  parentPath: e,
932
940
  item: t,
933
941
  showDragHandle: n,
@@ -937,18 +945,18 @@ function nt({
937
945
  onToggleExpanded: i,
938
946
  onToggleChecked: m
939
947
  }) {
940
- const h = !!t.items?.length, c = !!t.isExpanded, f = t.isDisabled ? !1 : t.draggable ?? !0, p = t.isDisabled ? !1 : t.checkable ?? !0, N = ae(e, t.id), {
941
- attributes: w,
942
- listeners: C,
948
+ const h = !!t.items?.length, o = !!t.isExpanded, f = t.isDisabled ? !1 : t.draggable ?? !0, p = t.isDisabled ? !1 : t.checkable ?? !0, v = ae(e, t.id), {
949
+ attributes: N,
950
+ listeners: w,
943
951
  setNodeRef: b,
944
952
  setActivatorNodeRef: d,
945
- transform: o,
953
+ transform: c,
946
954
  transition: x,
947
- isDragging: v
948
- } = Me({ id: N, disabled: !f }), S = {
949
- transform: je.Transform.toString(o),
955
+ isDragging: C
956
+ } = Te({ id: v, disabled: !f }), S = {
957
+ transform: ze.Transform.toString(c),
950
958
  transition: x,
951
- opacity: v ? 0.6 : void 0
959
+ opacity: C ? 0.6 : void 0
952
960
  }, y = !!t.isDisabled, E = y || !p, D = [...e, t.id];
953
961
  return /* @__PURE__ */ u(
954
962
  "div",
@@ -978,8 +986,8 @@ function nt({
978
986
  f ? "cursor-grab" : "cursor-default",
979
987
  "transition-opacity"
980
988
  ]),
981
- ...f ? C : {},
982
989
  ...f ? w : {},
990
+ ...f ? N : {},
983
991
  children: /* @__PURE__ */ r(
984
992
  X,
985
993
  {
@@ -1039,10 +1047,10 @@ function nt({
1039
1047
  k.stopPropagation(), i?.({
1040
1048
  itemId: t.id,
1041
1049
  path: D,
1042
- nextExpanded: !c
1050
+ nextExpanded: !o
1043
1051
  });
1044
1052
  },
1045
- "aria-label": c ? "Collapse" : "Expand",
1053
+ "aria-label": o ? "Collapse" : "Expand",
1046
1054
  className: g([
1047
1055
  "flex w-8 items-center justify-center rounded",
1048
1056
  y ? "" : "hover:bg-neutrals-100",
@@ -1054,7 +1062,7 @@ function nt({
1054
1062
  "aria-hidden": !0,
1055
1063
  className: g(
1056
1064
  "transition-transform duration-150 ease-out",
1057
- c ? "rotate-90" : "rotate-0"
1065
+ o ? "rotate-90" : "rotate-0"
1058
1066
  ),
1059
1067
  children: /* @__PURE__ */ r(Z, { size: 16 })
1060
1068
  }
@@ -1065,7 +1073,7 @@ function nt({
1065
1073
  }
1066
1074
  );
1067
1075
  }
1068
- function Pt({
1076
+ function Yt({
1069
1077
  items: e,
1070
1078
  showDragHandle: t = !0,
1071
1079
  showCheckbox: n = !0,
@@ -1075,67 +1083,67 @@ function Pt({
1075
1083
  onItemClick: i,
1076
1084
  renderLabel: m
1077
1085
  }) {
1078
- const h = Le(
1079
- Oe(Fe, { activationConstraint: { distance: 6 } })
1080
- ), [c, f] = ue.useState(null), p = (C) => {
1081
- const b = String(C.active.id), d = $(b);
1086
+ const h = Oe(
1087
+ Fe(Re, { activationConstraint: { distance: 6 } })
1088
+ ), [o, f] = ue.useState(null), p = (w) => {
1089
+ const b = String(w.active.id), d = G(b);
1082
1090
  if (!d) return;
1083
- const o = tt(e, d.parentPath, d.itemId);
1084
- !o || o.type !== "item" || f({
1091
+ const c = nt(e, d.parentPath, d.itemId);
1092
+ !c || c.type !== "item" || f({
1085
1093
  id: b,
1086
- label: o.label,
1087
- hasChildren: !!o.items?.length,
1088
- isChecked: o.isChecked,
1089
- isExpanded: o.isExpanded
1094
+ label: c.label,
1095
+ hasChildren: !!c.items?.length,
1096
+ isChecked: c.isChecked,
1097
+ isExpanded: c.isExpanded
1090
1098
  });
1091
- }, N = (C) => {
1099
+ }, v = (w) => {
1092
1100
  f(null);
1093
- const b = C.over;
1101
+ const b = w.over;
1094
1102
  if (!b) return;
1095
- const d = $(String(C.active.id)), o = $(String(b.id));
1096
- if (!d || !o || d.parentPath.join("/") !== o.parentPath.join("/")) return;
1103
+ const d = G(String(w.active.id)), c = G(String(b.id));
1104
+ if (!d || !c || d.parentPath.join("/") !== c.parentPath.join("/")) return;
1097
1105
  const x = oe(e, d.parentPath);
1098
1106
  if (!x) return;
1099
- const v = x.findIndex((E) => E.id === d.itemId), S = x.findIndex((E) => E.id === o.itemId);
1100
- if (v === -1 || S === -1 || v === S) return;
1107
+ const C = x.findIndex((E) => E.id === d.itemId), S = x.findIndex((E) => E.id === c.itemId);
1108
+ if (C === -1 || S === -1 || C === S) return;
1101
1109
  const y = ce(e, d.parentPath, (E) => {
1102
1110
  const D = E.filter(
1103
1111
  (R) => R.type === "item"
1104
- ), k = Ye(D, v, S);
1112
+ ), k = je(D, C, S);
1105
1113
  let I = 0;
1106
1114
  return E.map((R) => {
1107
1115
  if (R.type !== "item") return R;
1108
- const z = k[I];
1109
- return I += 1, z;
1116
+ const H = k[I];
1117
+ return I += 1, H;
1110
1118
  });
1111
1119
  });
1112
1120
  s(y);
1113
- }, w = (C, b = []) => {
1114
- const d = C.filter((o) => o.type === "item").map((o) => ae(b, o.id));
1121
+ }, N = (w, b = []) => {
1122
+ const d = w.filter((c) => c.type === "item").map((c) => ae(b, c.id));
1115
1123
  return /* @__PURE__ */ r(
1116
- Te,
1124
+ Pe,
1117
1125
  {
1118
1126
  items: d,
1119
- strategy: Pe,
1120
- children: /* @__PURE__ */ r("ul", { className: "m-0 flex list-none flex-col gap-2 p-0", children: C.map((o) => o.type === "group" ? /* @__PURE__ */ u(
1127
+ strategy: Ye,
1128
+ children: /* @__PURE__ */ r("ul", { className: "m-0 flex list-none flex-col gap-2 p-0", children: w.map((c) => c.type === "group" ? /* @__PURE__ */ u(
1121
1129
  "li",
1122
1130
  {
1123
1131
  className: "m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",
1124
1132
  children: [
1125
1133
  /* @__PURE__ */ u("div", { className: "h5 flex items-center gap-2 py-1 text-neutrals-1000", children: [
1126
- /* @__PURE__ */ r(xe, { size: 12, className: "shrink-0" }),
1127
- o.label
1134
+ /* @__PURE__ */ r(be, { size: 12, className: "shrink-0" }),
1135
+ c.label
1128
1136
  ] }),
1129
- /* @__PURE__ */ r("div", { className: "border-l border-neutrals-600 pl-2", children: w(o.items, [...b, o.id]) })
1137
+ /* @__PURE__ */ r("div", { className: "border-l border-neutrals-600 pl-2", children: N(c.items, [...b, c.id]) })
1130
1138
  ]
1131
1139
  },
1132
- o.id
1140
+ c.id
1133
1141
  ) : /* @__PURE__ */ u("li", { className: "m-0 flex flex-col gap-2 p-0", children: [
1134
1142
  /* @__PURE__ */ r(
1135
- nt,
1143
+ rt,
1136
1144
  {
1137
1145
  parentPath: b,
1138
- item: o,
1146
+ item: c,
1139
1147
  showDragHandle: t,
1140
1148
  showCheckbox: n,
1141
1149
  renderLabel: m,
@@ -1144,74 +1152,74 @@ function Pt({
1144
1152
  onToggleChecked: a
1145
1153
  }
1146
1154
  ),
1147
- o.items?.length && o.isExpanded ? /* @__PURE__ */ r("div", { className: "pl-7", children: w(o.items, [...b, o.id]) }) : null
1148
- ] }, o.id)) })
1155
+ c.items?.length && c.isExpanded ? /* @__PURE__ */ r("div", { className: "pl-7", children: N(c.items, [...b, c.id]) }) : null
1156
+ ] }, c.id)) })
1149
1157
  }
1150
1158
  );
1151
1159
  };
1152
1160
  return /* @__PURE__ */ u(
1153
- Re,
1161
+ _e,
1154
1162
  {
1155
1163
  sensors: h,
1156
- collisionDetection: _e,
1164
+ collisionDetection: Ae,
1157
1165
  onDragStart: p,
1158
- onDragEnd: N,
1166
+ onDragEnd: v,
1159
1167
  children: [
1160
- /* @__PURE__ */ r("div", { className: "flex flex-col", children: w(e) }),
1161
- /* @__PURE__ */ r(Ae, { children: c ? /* @__PURE__ */ r(
1162
- et,
1168
+ /* @__PURE__ */ r("div", { className: "flex flex-col", children: N(e) }),
1169
+ /* @__PURE__ */ r(Me, { children: o ? /* @__PURE__ */ r(
1170
+ tt,
1163
1171
  {
1164
- id: c.id,
1165
- label: c.label,
1166
- hasChildren: c.hasChildren,
1172
+ id: o.id,
1173
+ label: o.label,
1174
+ hasChildren: o.hasChildren,
1167
1175
  showDragHandle: t,
1168
1176
  showCheckbox: n,
1169
- isChecked: c.isChecked,
1170
- isExpanded: c.isExpanded
1177
+ isChecked: o.isChecked,
1178
+ isExpanded: o.isExpanded
1171
1179
  }
1172
1180
  ) : null })
1173
1181
  ]
1174
1182
  }
1175
1183
  );
1176
1184
  }
1177
- const rt = (e, t) => e.label.toLowerCase().includes(t);
1178
- function Yt(e, t, n = {}) {
1179
- const s = lt(t);
1185
+ const st = (e, t) => e.label.toLowerCase().includes(t);
1186
+ function jt(e, t, n = {}) {
1187
+ const s = at(t);
1180
1188
  if (!s)
1181
1189
  return e;
1182
1190
  const {
1183
1191
  expandMatchedBranches: l = !0,
1184
1192
  includeGroupDescendantsOnMatch: a = !0,
1185
1193
  includeItemDescendantsOnMatch: i = !1,
1186
- match: m = rt
1194
+ match: m = st
1187
1195
  } = n;
1188
- return B(e, s, {
1196
+ return W(e, s, {
1189
1197
  expandMatchedBranches: l,
1190
1198
  includeGroupDescendantsOnMatch: a,
1191
1199
  includeItemDescendantsOnMatch: i,
1192
1200
  match: m
1193
1201
  }) ?? [];
1194
1202
  }
1195
- function B(e, t, n) {
1203
+ function W(e, t, n) {
1196
1204
  const s = [];
1197
1205
  for (const l of e) {
1198
- const a = st(l, t, n);
1206
+ const a = lt(l, t, n);
1199
1207
  a && s.push(a);
1200
1208
  }
1201
1209
  return s.length ? s : null;
1202
1210
  }
1203
- function st(e, t, n) {
1211
+ function lt(e, t, n) {
1204
1212
  const s = n.match(e, t);
1205
1213
  if (e.type === "group") {
1206
1214
  if (s && n.includeGroupDescendantsOnMatch)
1207
1215
  return Y(e, n.expandMatchedBranches);
1208
- const i = e.items?.length ? B(e.items, t, n) : null;
1216
+ const i = e.items?.length ? W(e.items, t, n) : null;
1209
1217
  return !s && !i ? null : {
1210
1218
  ...e,
1211
1219
  items: i ?? []
1212
1220
  };
1213
1221
  }
1214
- const l = e.items?.length ? B(e.items, t, n) : null;
1222
+ const l = e.items?.length ? W(e.items, t, n) : null;
1215
1223
  if (s && n.includeItemDescendantsOnMatch)
1216
1224
  return Y(e, n.expandMatchedBranches);
1217
1225
  if (!s && !l)
@@ -1233,19 +1241,19 @@ function Y(e, t) {
1233
1241
  items: e.items?.map((n) => Y(n, t))
1234
1242
  };
1235
1243
  }
1236
- function lt(e) {
1244
+ function at(e) {
1237
1245
  return e.trim().toLowerCase();
1238
1246
  }
1239
- var at = /* @__PURE__ */ ((e) => (e.Enter = "Enter", e))(at || {});
1247
+ var it = /* @__PURE__ */ ((e) => (e.Enter = "Enter", e))(it || {});
1240
1248
  const de = Q(null);
1241
- function jt({
1249
+ function zt({
1242
1250
  children: e,
1243
1251
  isAgentAvailable: t
1244
1252
  }) {
1245
- const n = U(() => ({ isAgentAvailable: t }), [t]);
1253
+ const n = q(() => ({ isAgentAvailable: t }), [t]);
1246
1254
  return /* @__PURE__ */ r(de.Provider, { value: n, children: e });
1247
1255
  }
1248
- function zt() {
1256
+ function Ht() {
1249
1257
  const e = K(de);
1250
1258
  if (!e)
1251
1259
  throw new Error(
@@ -1254,40 +1262,40 @@ function zt() {
1254
1262
  return e;
1255
1263
  }
1256
1264
  export {
1257
- jt as AgentAvailabilityProvider,
1258
- bt as Alert,
1265
+ zt as AgentAvailabilityProvider,
1266
+ Nt as Alert,
1259
1267
  _ as AlertType,
1260
- Ge as Button,
1261
- We as CALENDAR_MOBILE_PADDING,
1262
- Ct as Calendar,
1268
+ Be as Button,
1269
+ qe as CALENDAR_MOBILE_PADDING,
1270
+ yt as Calendar,
1263
1271
  se as Checkbox,
1264
1272
  re as CloseButton,
1265
- yt as CollapsibleBlock,
1266
- Tt as CopyButton,
1267
- Rt as DownloadFormatMessage,
1268
- Pt as DraggableList,
1269
- Ft as Dropdown,
1270
- Et as HighlightText,
1271
- It as IconButton,
1272
- Mt as InlineAlert,
1273
- At as InlineAlertProvider,
1273
+ Et as CollapsibleBlock,
1274
+ Pt as CopyButton,
1275
+ _t as DownloadFormatMessage,
1276
+ Yt as DraggableList,
1277
+ Rt as Dropdown,
1278
+ It as HighlightText,
1279
+ St as IconButton,
1280
+ Tt as InlineAlert,
1281
+ Mt as InlineAlertProvider,
1274
1282
  M as InlineAlertType,
1275
1283
  Ue as Input,
1276
- St as InputWithIcon,
1277
- at as KeyboardKey,
1278
- kt as Link,
1279
- He as Loader,
1280
- G as PopUpSize,
1284
+ kt as InputWithIcon,
1285
+ it as KeyboardKey,
1286
+ Dt as Link,
1287
+ $e as Loader,
1288
+ B as PopUpSize,
1281
1289
  T as PopUpState,
1282
- Ot as Popup,
1283
- Lt as Radio,
1284
- _t as RequestLimitMessage,
1285
- V as SERIES_LIMIT,
1286
- wt as TREE_NODE_ARROW_SIZE,
1287
- vt as TREE_NODE_PADDING,
1288
- Dt as Tag,
1289
- Yt as filterDraggableListNodes,
1290
- zt as useAgentAvailability,
1291
- Nt as useDebounce,
1292
- Be as useIsMobile
1290
+ Ft as Popup,
1291
+ Ot as Radio,
1292
+ At as RequestLimitMessage,
1293
+ U as SERIES_LIMIT,
1294
+ vt as TREE_NODE_ARROW_SIZE,
1295
+ Ct as TREE_NODE_PADDING,
1296
+ Lt as Tag,
1297
+ jt as filterDraggableListNodes,
1298
+ Ht as useAgentAvailability,
1299
+ wt as useDebounce,
1300
+ We as useIsMobile
1293
1301
  };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@epam/statgpt-ui-components",
3
- "version": "0.6.0-rc.2",
3
+ "version": "0.6.0-rc.4",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "react-flatpickr": "^4.0.11",
7
7
  "classnames": "^2.5.1",
8
- "@epam/statgpt-shared-toolkit": "0.6.0-rc.2",
8
+ "@epam/statgpt-shared-toolkit": "0.6.0-rc.4",
9
9
  "@tabler/icons-react": "^3.34.1",
10
10
  "@floating-ui/react": "^0.27.14",
11
11
  "tailwind-merge": "^3.4.0",