@epam/statgpt-ui-components 0.4.0-rc.24 → 0.4.0-rc.26

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.
Files changed (3) hide show
  1. package/index.js +1 -1
  2. package/index.mjs +1 -1
  3. package/package.json +2 -2
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("react"),m=require("classnames"),R=require("@tabler/icons-react"),le=require("tailwind-merge"),ae=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),N=require("@floating-ui/react"),L=require("@dnd-kit/core"),M=require("@dnd-kit/sortable"),ie=require("@dnd-kit/utilities");function ce(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 oe=ce(f),W=()=>t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx("div",{className:"loader"})}),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(R.IconX,{height:r||20,width:s||20})});var A=(e=>(e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(A||{});const de=({alertDetails:e,successIcon:n,errorIcon:s,onClose:r,closeButtonTitle:l})=>{const a=()=>e?.type===A.IN_PROGRESS?"alert-in-progress":e?.type===A.SUCCESS?"alert-success":"alert-error";return f.useEffect(()=>{e?.type!==A.IN_PROGRESS&&setTimeout(()=>{r?.()},5e3)},[e?.type,r]),t.jsx("div",{className:m("alert alert-shadow fixed bottom-3 right-3 z-10",a()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[t.jsx("div",{className:"alert-icon",children:e?.type===A.IN_PROGRESS?t.jsx(W,{}):e?.type===A.SUCCESS?n:s}),t.jsxs("div",{className:"flex max-w-[300px] flex-col gap-2",children:[t.jsx("h3",{className:"truncate",children:e?.title}),e?.text&&t.jsx("div",{className:"alert-text truncate",title:e?.text,children:e?.text})]}),t.jsx(U,{title:l,onClick:r})]})})},ue=le.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function O(...e){return ue(m(...e))}const V=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:l,iconAfter:a,iconBefore:o,onClick:d,isSmallButton:x})=>{const u=O([x?"font-semibold":"",a?"mr-2":"",o?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:m("base-button",e,x?"small-button":""),disabled:l||s,"aria-label":"button",onClick:h=>d?.(h),title:r,children:[o,s&&t.jsx(W,{}),r?x?t.jsx("h4",{className:u,children:r}):t.jsx("h3",{className:u,children:r}):null,a]})};function K(e=719){const[n,s]=f.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return f.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 xe(e,n){const s=f.useRef(null);return f.useCallback((...l)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...l)},n)},[e,n])}const me=24,he=24,z=1e3,Q=24,fe=({label:e,onChange:n,value:s,options:r,calendarResolution:l=P.CalendarResolution.DAY,id:a,icon:o,isEndDate:d})=>{const x=f.useRef(null),u=K();f.useEffect(()=>{const b=x?.current;b&&b.querySelector("input")?.setAttribute("aria-label",e)},[e]);const h={...r,disableMobile:!0,defaultDate:l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},p=(b,j,g)=>{const c=`calendar__${l===P.CalendarResolution.MONTH?"month":"day"}`;g.calendarContainer&&g.calendarContainer.classList.add(c)},C=(b,j,g)=>{if(l===P.CalendarResolution.MONTH&&b.length>0){const c=r.minDate,i=r.maxDate,y=b[0].getFullYear(),k=g.calendarContainer,I="flatpickr-disabled",v=k.querySelectorAll(".flatpickr-monthSelect-month"),w=k.querySelectorAll(".flatpickr-next-month")[0],D=k.querySelectorAll(".flatpickr-prev-month")[0];y===i.getFullYear()&&w.classList.add(I),y===c.getFullYear()&&D.classList.add(I),(y===c.getFullYear()||y===i.getFullYear())&&v.forEach(S=>{S.classList.remove(I);const E=new Date(S.getAttribute("aria-label")),_=E.getFullYear()===c.getFullYear()&&E.getMonth()===c.getMonth(),B=E.getFullYear()===i.getFullYear()&&E.getMonth()===i.getMonth();_||B||(E<c||E>i)&&S.classList.add(I)})}setTimeout(()=>{const c=g.calendarContainer,i=g._input?.getBoundingClientRect();c&&(c.style.top=`${i.top-c.offsetHeight-8}px`,c.style.width=`${c.style.width}px`,d?(c.style.right=`${window.innerWidth-i.right-(u?Q:0)}px`,c.style.left="auto"):c.style.left=`${i.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:o||t.jsx(R.IconCalendarEvent,{})}),t.jsx(ae,{defaultValue:(l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:h,onChange:b=>{n(b[0])},onOpen:[C],onReady:[p],id:a})]})},H=({label:e,id:n,checked:s,checkboxIcon:r,onChange:l,disabled:a=!1,className:o,stopPropagation:d=!0})=>{const x=f.useCallback(p=>{d&&p.stopPropagation()},[d]),u=f.useCallback(p=>{d&&p.stopPropagation(),l?.(n,p.target.checked)},[l,n,d]),h=()=>{if(s)return r||t.jsx(R.IconSquareCheckFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:x,className:O("flex min-w-0 items-center py-1",a?"cursor-not-allowed opacity-50":"cursor-pointer",o),children:[t.jsx("span",{className:m("checkbox-button relative flex size-[14px] items-center justify-center"),"aria-hidden":!0,children:h()}),e?t.jsx("p",{className:m("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:u,className:"hidden"})]})},pe=({title:e,icon:n,children:s,value:r})=>{const[l,a]=f.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(R.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})]})},ge=({text:e,highlightText:n})=>{const s=f.useMemo(()=>{const r=[];if(!n)return[{id:0,text:e,highlight:!1}];const l=n?.toLowerCase()||"",a=e?.toLowerCase()?.split(l)||"";for(let o=0,d=0;o<a?.length;o++){const x=a?.[o],u=x.length;x!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(d,d+u)}),d+=u,o!==a?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(d,d+n.length)}),d+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:m(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},be=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:l,isBaseIconStyles:a=!0})=>t.jsx("button",{type:"button",className:m(a&&"base-icon-button",s),onClick:o=>n?.(o),disabled:r,title:l,"aria-label":"button",children:e}),Z=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:l="text",disabled:a,readonly:o,onChange:d,onKeyDown:x,onFocus:u,onBlur:h})=>{const p=m("truncate outline-none shadow-none body-1",r,o?"pointer-events-none":"");return t.jsx("input",{type:l,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:a,className:p,onKeyDown:x,onFocus:u,onBlur:h,onChange:C=>d?.(C.currentTarget.value)})},je=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...l})=>t.jsxs("div",{className:m("input w-full flex flex-row",s),children:[e,t.jsx(Z,{cssClass:m("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...l}),n]}),Ne=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:l})=>{const a=m(l?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:m("base-link",s),title:n,children:[r,t.jsx("span",{className:a,children:n}),l]})},Ce=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:m("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})}),ye=({label:e,id:n,checked:s,radioIcon:r,description:l,onChange:a})=>{const o=f.useCallback(d=>{d.stopPropagation(),a?.(n,d.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:m("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:o,id:n,checked:s,className:"hidden"})]})};var T=(e=>(e.Closed="Closed",e.Opened="Opened",e))(T||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const ve=({portalId:e,state:n=T.Opened,heading:s,size:r,onClose:l,children:a,overlayClassName:o,containerClassName:d,dividers:x=!0,closeButtonTitle:u})=>{const{refs:h,context:p}=N.useFloating({open:n!==T.Closed&&!!n,onOpenChange:l}),C=N.useRole(p,{role:"dialog"}),b=N.useDismiss(p,{outsidePress:!0}),{getFloatingProps:j}=N.useInteractions([C,b]),g=f.useCallback(c=>{c?.preventDefault(),c?.stopPropagation(),l()},[l]);return t.jsx(N.FloatingPortal,{id:e,children:n!==T.Closed&&t.jsx(N.FloatingOverlay,{className:m("z-modal flex items-center justify-center bg-blackout p-4",o),children:t.jsx(N.FloatingFocusManager,{context:p,children:t.jsxs("div",{className:m("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",d,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:h.setFloating,...j({onClick(c){c.stopPropagation()}}),children:[t.jsxs("div",{className:"modal-heading mb-2 flex flex-row items-center justify-between px-6 py-3 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:u,onClick:g,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),a.map(c=>c)]})})})})},we=e=>e.state===T.Closed?null:t.jsx(ve,{...e}),Ee=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:l,containerClassName:a,openedClassName:o,onOptionSelect:d})=>{const[x,u]=f.useState(!1),{refs:h,floatingStyles:p,context:C}=N.useFloating({open:x,onOpenChange:l?void 0:u,placement:"bottom-end",middleware:[N.offset(8),N.flip(),N.shift()],whileElementsMounted:N.autoUpdate}),b=N.useClick(C),j=N.useDismiss(C,{outsidePress:!0}),{getReferenceProps:g,getFloatingProps:c}=N.useInteractions([b,j]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:h.setReference,...g({onClick(i){i.stopPropagation()}}),className:m(a,x&&o),children:e}),x&&t.jsxs("div",{ref:h.setFloating,style:p,className:"dropdown-menu-shadow dropdown-container z-10 flex flex-col rounded bg-white",...c(),children:[s&&s,n&&n.map(i=>t.jsx("div",{onClick:y=>{y.stopPropagation(),d?.(i.key),u(!1)},className:m("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===i.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:i.title,children:[i.icon?i.icon:null,t.jsx("p",{children:i?.title})]})},i.key))]})]})},Ie=({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]})})]}),Se=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:l})=>t.jsxs("div",{className:m("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:m("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:m("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(z):e?.showingLimit?.(z)})]}),n&&t.jsx("span",{className:m("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]})})]}),X=f.createContext(null);function ke({value:e,children:n}){const s=f.useMemo(()=>e??{},[e]);return t.jsx(X.Provider,{value:s,children:n})}function Re(){return f.useContext(X)}var F=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e))(F||{});const De={[F.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[F.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[F.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000"},Ae="shrink-0",Oe="min-w-0 body-2",_e="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function Le({type:e,icon:n,children:s,className:r,contentClassName:l}){const a=Re(),o=n??a?.icons?.[e],d=a?.classes?.container??_e,x=a?.classes?.types?.[e]??De[e],u=O(d,x,r),h=O(Ae,a?.classes?.icon),p=O(Oe,a?.classes?.content,l);return t.jsxs("div",{"data-type":e,className:u,children:[o?t.jsx("span",{className:h,children:o}):null,s?t.jsx("div",{className:p,children:s}):null]})}const Te=({title:e,copiedTitle:n,tooltip:s,icon:r,copiedIcon:l,className:a,buttonTextClassName:o,onClick:d})=>{const[x,u]=f.useState(!1),h=f.useRef(null),p=()=>{d(),u(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u(!1)},1e3)};return f.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),t.jsxs("div",{className:"relative w-fit",children:[t.jsx(V,{title:x?n:e,isSmallButton:!0,disabled:x,buttonClassName:O(["text-button-tertiary small-icon-button !h-6 !p-0",a]),textClassName:O(["ml-1",o]),onClick:p,iconBefore:x?l:r}),s&&x&&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 Pe({id:e,label:n,hasChildren:s,showDragHandle:r,showCheckbox:l,isChecked:a,isExpanded:o}){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(R.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[l?t.jsx(H,{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:m("transition-transform",o?"rotate-90":"rotate-0"),children:t.jsx(R.IconChevronRight,{size:16})})}):null]})]})}function J(e,n){return`i:${[...e,n].join("/")}`}function G(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 Fe(e,n,s){const r=te(e,n);return r?r.find(l=>l.id===s)??null:null}function ee(e,n){if(n.length===0)return e;const[s,...r]=n,l=e.find(a=>a.id===s);return l?.items?ee(l.items,r):null}function te(e,n){const s=ee(e,n);return s?s.filter(r=>r.type==="item"):null}function ne(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:ne(a.items,l,s)})}function Me({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:l,onItemClick:a,onToggleExpanded:o,onToggleChecked:d}){const x=!!n.items?.length,u=!!n.isExpanded,h=n.isDisabled?!1:n.draggable??!0,p=n.isDisabled?!1:n.checkable??!0,C=J(e,n.id),{attributes:b,listeners:j,setNodeRef:g,setActivatorNodeRef:c,transform:i,transition:y,isDragging:k}=M.useSortable({id:C,disabled:!h}),I={transform:ie.CSS.Transform.toString(i),transition:y,opacity:k?.6:void 0},v=!!n.isDisabled,w=v||!p,D=[...e,n.id];return t.jsxs("div",{ref:g,style:I,className:m(["group flex items-stretch overflow-hidden rounded bg-white","select-none",v?"opacity-50":""]),children:[s?t.jsx("div",{className:m(["group/drag-handle flex w-6 items-center justify-center rounded",v?"":"hover:bg-neutrals-100 cursor-grab"]),children:t.jsx("span",{ref:c,"aria-hidden":!0,className:m(["rounded p-1",h?"cursor-grab":"cursor-default","transition-opacity"]),...h?j:{},...h?b:{},children:t.jsx(R.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:v,"aria-disabled":w,onClick:S=>{w||a?.({itemId:n.id,path:D,nativeEvent:S})},className:m(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",v?"":"hover:bg-neutrals-100",v?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(H,{id:`draggable-list-${D.join("-")}`,checked:!!n.isChecked,disabled:!p,className:"p-0",stopPropagation:!0,onChange:(S,E)=>d?.({itemId:n.id,path:D,nextChecked:!!E})}):null,t.jsx("span",{className:"body-3 truncate text-neutrals-800",children:l?l(n):n.label})]}),x?t.jsx("button",{type:"button",disabled:v,onClick:S=>{S.stopPropagation(),o?.({itemId:n.id,path:D,nextExpanded:!u})},"aria-label":u?"Collapse":"Expand",className:m(["flex w-8 items-center justify-center rounded",v?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:m("transition-transform duration-150 ease-out",u?"rotate-90":"rotate-0"),children:t.jsx(R.IconChevronRight,{size:16})})}):null]})}function qe({items:e,showDragHandle:n=!0,showCheckbox:s=!0,onItemsChange:r,onToggleExpanded:l,onToggleChecked:a,onItemClick:o,renderLabel:d}){const x=L.useSensors(L.useSensor(L.PointerSensor,{activationConstraint:{distance:6}})),[u,h]=oe.useState(null),p=j=>{const g=String(j.active.id),c=G(g);if(!c)return;const i=Fe(e,c.parentPath,c.itemId);!i||i.type!=="item"||h({id:g,label:i.label,hasChildren:!!i.items?.length,isChecked:i.isChecked,isExpanded:i.isExpanded})},C=j=>{h(null);const g=j.over;if(!g)return;const c=G(String(j.active.id)),i=G(String(g.id));if(!c||!i||c.parentPath.join("/")!==i.parentPath.join("/"))return;const y=te(e,c.parentPath);if(!y)return;const k=y.findIndex(w=>w.id===c.itemId),I=y.findIndex(w=>w.id===i.itemId);if(k===-1||I===-1||k===I)return;const v=ne(e,c.parentPath,w=>{const D=w.filter(_=>_.type==="item"),S=M.arrayMove(D,k,I);let E=0;return w.map(_=>{if(_.type!=="item")return _;const B=S[E];return E+=1,B})});r(v)},b=(j,g=[])=>{const c=j.filter(i=>i.type==="item").map(i=>J(g,i.id));return t.jsx(M.SortableContext,{items:c,strategy:M.verticalListSortingStrategy,children:t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:j.map(i=>i.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(R.IconDatabase,{size:12,className:"shrink-0"}),i.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:b(i.items,[...g,i.id])})]},i.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(Me,{parentPath:g,item:i,showDragHandle:n,showCheckbox:s,renderLabel:d,onItemClick:o,onToggleExpanded:l,onToggleChecked:a}),i.items?.length&&i.isExpanded?t.jsx("div",{className:"pl-7",children:b(i.items,[...g,i.id])}):null]},i.id))})})};return t.jsxs(L.DndContext,{sensors:x,collisionDetection:L.closestCenter,onDragStart:p,onDragEnd:C,children:[t.jsx("div",{className:"flex flex-col",children:b(e)}),t.jsx(L.DragOverlay,{children:u?t.jsx(Pe,{id:u.id,label:u.label,hasChildren:u.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:u.isChecked,isExpanded:u.isExpanded}):null})]})}const Ye=(e,n)=>e.label.toLowerCase().includes(n);function Be(e,n,s={}){const r=ze(n);if(!r)return e;const{expandMatchedBranches:l=!0,includeGroupDescendantsOnMatch:a=!0,includeItemDescendantsOnMatch:o=!1,match:d=Ye}=s;return $(e,r,{expandMatchedBranches:l,includeGroupDescendantsOnMatch:a,includeItemDescendantsOnMatch:o,match:d})??[]}function $(e,n,s){const r=[];for(const l of e){const a=Ge(l,n,s);a&&r.push(a)}return r.length?r:null}function Ge(e,n,s){const r=s.match(e,n);if(e.type==="group"){if(r&&s.includeGroupDescendantsOnMatch)return Y(e,s.expandMatchedBranches);const o=e.items?.length?$(e.items,n,s):null;return!r&&!o?null:{...e,items:o??[]}}const l=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return Y(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 Y(e,n){return e.type==="group"?{...e,items:e.items.map(s=>Y(s,n))}:{...e,isExpanded:n&&e.items?.length?!0:e.isExpanded,items:e.items?.map(s=>Y(s,n))}}function ze(e){return e.trim().toLowerCase()}var se=(e=>(e.Enter="Enter",e))(se||{});const re=f.createContext(null);function $e({children:e,isAgentAvailable:n}){const s=f.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(re.Provider,{value:s,children:e})}function We(){const e=f.useContext(re);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=$e;exports.Alert=de;exports.AlertType=A;exports.Button=V;exports.CALENDAR_MOBILE_PADDING=Q;exports.Calendar=fe;exports.Checkbox=H;exports.CloseButton=U;exports.CollapsibleBlock=pe;exports.CopyButton=Te;exports.DownloadFormatMessage=Ie;exports.DraggableList=qe;exports.Dropdown=Ee;exports.HighlightText=ge;exports.IconButton=be;exports.InlineAlert=Le;exports.InlineAlertProvider=ke;exports.InlineAlertType=F;exports.Input=Z;exports.InputWithIcon=je;exports.KeyboardKey=se;exports.Link=Ne;exports.Loader=W;exports.PopUpSize=q;exports.PopUpState=T;exports.Popup=we;exports.Radio=ye;exports.RequestLimitMessage=Se;exports.SERIES_LIMIT=z;exports.TREE_NODE_ARROW_SIZE=me;exports.TREE_NODE_PADDING=he;exports.Tag=Ce;exports.filterDraggableListNodes=Be;exports.useAgentAvailability=We;exports.useDebounce=xe;exports.useIsMobile=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),f=require("react"),m=require("classnames"),R=require("@tabler/icons-react"),le=require("tailwind-merge"),ae=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),N=require("@floating-ui/react"),L=require("@dnd-kit/core"),M=require("@dnd-kit/sortable"),ie=require("@dnd-kit/utilities");function ce(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 oe=ce(f),W=()=>t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx("div",{className:"loader"})}),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(R.IconX,{height:r||20,width:s||20})});var A=(e=>(e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(A||{});const de=({alertDetails:e,successIcon:n,errorIcon:s,onClose:r,closeButtonTitle:l})=>{const a=()=>e?.type===A.IN_PROGRESS?"alert-in-progress":e?.type===A.SUCCESS?"alert-success":"alert-error";return f.useEffect(()=>{e?.type!==A.IN_PROGRESS&&setTimeout(()=>{r?.()},5e3)},[e?.type,r]),t.jsx("div",{className:m("alert alert-shadow fixed bottom-3 right-3 z-10",a()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[t.jsx("div",{className:"alert-icon",children:e?.type===A.IN_PROGRESS?t.jsx(W,{}):e?.type===A.SUCCESS?n:s}),t.jsxs("div",{className:"flex max-w-[300px] flex-col gap-2",children:[t.jsx("h3",{className:"truncate",children:e?.title}),e?.text&&t.jsx("div",{className:"alert-text truncate",title:e?.text,children:e?.text})]}),t.jsx(U,{title:l,onClick:r})]})})},ue=le.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function O(...e){return ue(m(...e))}const V=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:l,iconAfter:a,iconBefore:o,onClick:d,isSmallButton:x})=>{const u=O([x?"font-semibold":"",a?"mr-2":"",o?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:m("base-button",e,x?"small-button":""),disabled:l||s,"aria-label":"button",onClick:h=>d?.(h),title:r,children:[o,s&&t.jsx(W,{}),r?x?t.jsx("h4",{className:u,children:r}):t.jsx("h3",{className:u,children:r}):null,a]})};function K(e=719){const[n,s]=f.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return f.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 xe(e,n){const s=f.useRef(null);return f.useCallback((...l)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...l)},n)},[e,n])}const me=24,he=24,z=1e3,Q=24,fe=({label:e,onChange:n,value:s,options:r,calendarResolution:l=P.CalendarResolution.DAY,id:a,icon:o,isEndDate:d})=>{const x=f.useRef(null),u=K();f.useEffect(()=>{const b=x?.current;b&&b.querySelector("input")?.setAttribute("aria-label",e)},[e]);const h={...r,disableMobile:!0,defaultDate:l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},p=(b,j,g)=>{const c=`calendar__${l===P.CalendarResolution.MONTH?"month":"day"}`;g.calendarContainer&&g.calendarContainer.classList.add(c)},C=(b,j,g)=>{if(l===P.CalendarResolution.MONTH&&b.length>0){const c=r.minDate,i=r.maxDate,y=b[0].getFullYear(),k=g.calendarContainer,I="flatpickr-disabled",v=k.querySelectorAll(".flatpickr-monthSelect-month"),w=k.querySelectorAll(".flatpickr-next-month")[0],D=k.querySelectorAll(".flatpickr-prev-month")[0];y===i.getFullYear()&&w.classList.add(I),y===c.getFullYear()&&D.classList.add(I),(y===c.getFullYear()||y===i.getFullYear())&&v.forEach(S=>{S.classList.remove(I);const E=new Date(S.getAttribute("aria-label")),_=E.getFullYear()===c.getFullYear()&&E.getMonth()===c.getMonth(),B=E.getFullYear()===i.getFullYear()&&E.getMonth()===i.getMonth();_||B||(E<c||E>i)&&S.classList.add(I)})}setTimeout(()=>{const c=g.calendarContainer,i=g._input?.getBoundingClientRect();c&&(c.style.top=`${i.top-c.offsetHeight-8}px`,c.style.width=`${c.style.width}px`,d?(c.style.right=`${window.innerWidth-i.right-(u?Q:0)}px`,c.style.left="auto"):c.style.left=`${i.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:o||t.jsx(R.IconCalendarEvent,{})}),t.jsx(ae,{defaultValue:(l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:h,onChange:b=>{n(b[0])},onOpen:[C],onReady:[p],id:a})]})},H=({label:e,id:n,checked:s,checkboxIcon:r,onChange:l,disabled:a=!1,className:o,stopPropagation:d=!0})=>{const x=f.useCallback(p=>{d&&p.stopPropagation()},[d]),u=f.useCallback(p=>{d&&p.stopPropagation(),l?.(n,p.target.checked)},[l,n,d]),h=()=>{if(s)return r||t.jsx(R.IconSquareCheckFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:x,className:O("flex min-w-0 items-center py-1 shrink-0",a?"cursor-not-allowed opacity-50":"cursor-pointer",o),children:[t.jsx("span",{className:m("checkbox-button relative flex size-[14px] items-center justify-center"),"aria-hidden":!0,children:h()}),e?t.jsx("p",{className:m("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:u,className:"hidden"})]})},pe=({title:e,icon:n,children:s,value:r})=>{const[l,a]=f.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(R.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})]})},ge=({text:e,highlightText:n})=>{const s=f.useMemo(()=>{const r=[];if(!n)return[{id:0,text:e,highlight:!1}];const l=n?.toLowerCase()||"",a=e?.toLowerCase()?.split(l)||"";for(let o=0,d=0;o<a?.length;o++){const x=a?.[o],u=x.length;x!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(d,d+u)}),d+=u,o!==a?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(d,d+n.length)}),d+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:m(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},be=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:l,isBaseIconStyles:a=!0})=>t.jsx("button",{type:"button",className:m(a&&"base-icon-button",s),onClick:o=>n?.(o),disabled:r,title:l,"aria-label":"button",children:e}),Z=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:l="text",disabled:a,readonly:o,onChange:d,onKeyDown:x,onFocus:u,onBlur:h})=>{const p=m("truncate outline-none shadow-none body-1",r,o?"pointer-events-none":"");return t.jsx("input",{type:l,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:a,className:p,onKeyDown:x,onFocus:u,onBlur:h,onChange:C=>d?.(C.currentTarget.value)})},je=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...l})=>t.jsxs("div",{className:m("input w-full flex flex-row",s),children:[e,t.jsx(Z,{cssClass:m("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...l}),n]}),Ne=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:l})=>{const a=m(l?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:m("base-link",s),title:n,children:[r,t.jsx("span",{className:a,children:n}),l]})},Ce=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:m("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})}),ye=({label:e,id:n,checked:s,radioIcon:r,description:l,onChange:a})=>{const o=f.useCallback(d=>{d.stopPropagation(),a?.(n,d.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:m("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:o,id:n,checked:s,className:"hidden"})]})};var T=(e=>(e.Closed="Closed",e.Opened="Opened",e))(T||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const ve=({portalId:e,state:n=T.Opened,heading:s,size:r,onClose:l,children:a,overlayClassName:o,containerClassName:d,dividers:x=!0,closeButtonTitle:u})=>{const{refs:h,context:p}=N.useFloating({open:n!==T.Closed&&!!n,onOpenChange:l}),C=N.useRole(p,{role:"dialog"}),b=N.useDismiss(p,{outsidePress:!0}),{getFloatingProps:j}=N.useInteractions([C,b]),g=f.useCallback(c=>{c?.preventDefault(),c?.stopPropagation(),l()},[l]);return t.jsx(N.FloatingPortal,{id:e,children:n!==T.Closed&&t.jsx(N.FloatingOverlay,{className:m("z-modal flex items-center justify-center bg-blackout p-4",o),children:t.jsx(N.FloatingFocusManager,{context:p,children:t.jsxs("div",{className:m("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",d,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:h.setFloating,...j({onClick(c){c.stopPropagation()}}),children:[t.jsxs("div",{className:"modal-heading mb-2 flex flex-row items-center justify-between px-6 py-3 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:u,onClick:g,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),a.map(c=>c)]})})})})},we=e=>e.state===T.Closed?null:t.jsx(ve,{...e}),Ee=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:l,containerClassName:a,openedClassName:o,onOptionSelect:d})=>{const[x,u]=f.useState(!1),{refs:h,floatingStyles:p,context:C}=N.useFloating({open:x,onOpenChange:l?void 0:u,placement:"bottom-end",middleware:[N.offset(8),N.flip(),N.shift()],whileElementsMounted:N.autoUpdate}),b=N.useClick(C),j=N.useDismiss(C,{outsidePress:!0}),{getReferenceProps:g,getFloatingProps:c}=N.useInteractions([b,j]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:h.setReference,...g({onClick(i){i.stopPropagation()}}),className:m(a,x&&o),children:e}),x&&t.jsxs("div",{ref:h.setFloating,style:p,className:"dropdown-menu-shadow dropdown-container z-10 flex flex-col rounded bg-white",...c(),children:[s&&s,n&&n.map(i=>t.jsx("div",{onClick:y=>{y.stopPropagation(),d?.(i.key),u(!1)},className:m("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===i.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:i.title,children:[i.icon?i.icon:null,t.jsx("p",{children:i?.title})]})},i.key))]})]})},Ie=({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]})})]}),Se=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:l})=>t.jsxs("div",{className:m("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:m("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:m("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(z):e?.showingLimit?.(z)})]}),n&&t.jsx("span",{className:m("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]})})]}),X=f.createContext(null);function ke({value:e,children:n}){const s=f.useMemo(()=>e??{},[e]);return t.jsx(X.Provider,{value:s,children:n})}function Re(){return f.useContext(X)}var F=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e))(F||{});const De={[F.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[F.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[F.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000"},Ae="shrink-0",Oe="min-w-0 body-2",_e="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function Le({type:e,icon:n,children:s,className:r,contentClassName:l}){const a=Re(),o=n??a?.icons?.[e],d=a?.classes?.container??_e,x=a?.classes?.types?.[e]??De[e],u=O(d,x,r),h=O(Ae,a?.classes?.icon),p=O(Oe,a?.classes?.content,l);return t.jsxs("div",{"data-type":e,className:u,children:[o?t.jsx("span",{className:h,children:o}):null,s?t.jsx("div",{className:p,children:s}):null]})}const Te=({title:e,copiedTitle:n,tooltip:s,icon:r,copiedIcon:l,className:a,buttonTextClassName:o,onClick:d})=>{const[x,u]=f.useState(!1),h=f.useRef(null),p=()=>{d(),u(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{u(!1)},1e3)};return f.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),t.jsxs("div",{className:"relative w-fit",children:[t.jsx(V,{title:x?n:e,isSmallButton:!0,disabled:x,buttonClassName:O(["text-button-tertiary small-icon-button !h-6 !p-0",a]),textClassName:O(["ml-1",o]),onClick:p,iconBefore:x?l:r}),s&&x&&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 Pe({id:e,label:n,hasChildren:s,showDragHandle:r,showCheckbox:l,isChecked:a,isExpanded:o}){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(R.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[l?t.jsx(H,{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:m("transition-transform",o?"rotate-90":"rotate-0"),children:t.jsx(R.IconChevronRight,{size:16})})}):null]})]})}function J(e,n){return`i:${[...e,n].join("/")}`}function G(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 Fe(e,n,s){const r=te(e,n);return r?r.find(l=>l.id===s)??null:null}function ee(e,n){if(n.length===0)return e;const[s,...r]=n,l=e.find(a=>a.id===s);return l?.items?ee(l.items,r):null}function te(e,n){const s=ee(e,n);return s?s.filter(r=>r.type==="item"):null}function ne(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:ne(a.items,l,s)})}function Me({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:l,onItemClick:a,onToggleExpanded:o,onToggleChecked:d}){const x=!!n.items?.length,u=!!n.isExpanded,h=n.isDisabled?!1:n.draggable??!0,p=n.isDisabled?!1:n.checkable??!0,C=J(e,n.id),{attributes:b,listeners:j,setNodeRef:g,setActivatorNodeRef:c,transform:i,transition:y,isDragging:k}=M.useSortable({id:C,disabled:!h}),I={transform:ie.CSS.Transform.toString(i),transition:y,opacity:k?.6:void 0},v=!!n.isDisabled,w=v||!p,D=[...e,n.id];return t.jsxs("div",{ref:g,style:I,className:m(["group flex items-stretch overflow-hidden rounded bg-white","select-none",v?"opacity-50":""]),children:[s?t.jsx("div",{className:m(["group/drag-handle flex w-6 items-center justify-center rounded",v?"":"hover:bg-neutrals-100 cursor-grab"]),children:t.jsx("span",{ref:c,"aria-hidden":!0,className:m(["rounded p-1",h?"cursor-grab":"cursor-default","transition-opacity"]),...h?j:{},...h?b:{},children:t.jsx(R.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:v,"aria-disabled":w,onClick:S=>{w||a?.({itemId:n.id,path:D,nativeEvent:S})},className:m(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",v?"":"hover:bg-neutrals-100",v?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(H,{id:`draggable-list-${D.join("-")}`,checked:!!n.isChecked,disabled:!p,className:"p-0",stopPropagation:!0,onChange:(S,E)=>d?.({itemId:n.id,path:D,nextChecked:!!E})}):null,t.jsx("span",{className:"body-3 truncate text-neutrals-800",children:l?l(n):n.label})]}),x?t.jsx("button",{type:"button",disabled:v,onClick:S=>{S.stopPropagation(),o?.({itemId:n.id,path:D,nextExpanded:!u})},"aria-label":u?"Collapse":"Expand",className:m(["flex w-8 items-center justify-center rounded",v?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:m("transition-transform duration-150 ease-out",u?"rotate-90":"rotate-0"),children:t.jsx(R.IconChevronRight,{size:16})})}):null]})}function qe({items:e,showDragHandle:n=!0,showCheckbox:s=!0,onItemsChange:r,onToggleExpanded:l,onToggleChecked:a,onItemClick:o,renderLabel:d}){const x=L.useSensors(L.useSensor(L.PointerSensor,{activationConstraint:{distance:6}})),[u,h]=oe.useState(null),p=j=>{const g=String(j.active.id),c=G(g);if(!c)return;const i=Fe(e,c.parentPath,c.itemId);!i||i.type!=="item"||h({id:g,label:i.label,hasChildren:!!i.items?.length,isChecked:i.isChecked,isExpanded:i.isExpanded})},C=j=>{h(null);const g=j.over;if(!g)return;const c=G(String(j.active.id)),i=G(String(g.id));if(!c||!i||c.parentPath.join("/")!==i.parentPath.join("/"))return;const y=te(e,c.parentPath);if(!y)return;const k=y.findIndex(w=>w.id===c.itemId),I=y.findIndex(w=>w.id===i.itemId);if(k===-1||I===-1||k===I)return;const v=ne(e,c.parentPath,w=>{const D=w.filter(_=>_.type==="item"),S=M.arrayMove(D,k,I);let E=0;return w.map(_=>{if(_.type!=="item")return _;const B=S[E];return E+=1,B})});r(v)},b=(j,g=[])=>{const c=j.filter(i=>i.type==="item").map(i=>J(g,i.id));return t.jsx(M.SortableContext,{items:c,strategy:M.verticalListSortingStrategy,children:t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:j.map(i=>i.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(R.IconDatabase,{size:12,className:"shrink-0"}),i.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:b(i.items,[...g,i.id])})]},i.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(Me,{parentPath:g,item:i,showDragHandle:n,showCheckbox:s,renderLabel:d,onItemClick:o,onToggleExpanded:l,onToggleChecked:a}),i.items?.length&&i.isExpanded?t.jsx("div",{className:"pl-7",children:b(i.items,[...g,i.id])}):null]},i.id))})})};return t.jsxs(L.DndContext,{sensors:x,collisionDetection:L.closestCenter,onDragStart:p,onDragEnd:C,children:[t.jsx("div",{className:"flex flex-col",children:b(e)}),t.jsx(L.DragOverlay,{children:u?t.jsx(Pe,{id:u.id,label:u.label,hasChildren:u.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:u.isChecked,isExpanded:u.isExpanded}):null})]})}const Ye=(e,n)=>e.label.toLowerCase().includes(n);function Be(e,n,s={}){const r=ze(n);if(!r)return e;const{expandMatchedBranches:l=!0,includeGroupDescendantsOnMatch:a=!0,includeItemDescendantsOnMatch:o=!1,match:d=Ye}=s;return $(e,r,{expandMatchedBranches:l,includeGroupDescendantsOnMatch:a,includeItemDescendantsOnMatch:o,match:d})??[]}function $(e,n,s){const r=[];for(const l of e){const a=Ge(l,n,s);a&&r.push(a)}return r.length?r:null}function Ge(e,n,s){const r=s.match(e,n);if(e.type==="group"){if(r&&s.includeGroupDescendantsOnMatch)return Y(e,s.expandMatchedBranches);const o=e.items?.length?$(e.items,n,s):null;return!r&&!o?null:{...e,items:o??[]}}const l=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return Y(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 Y(e,n){return e.type==="group"?{...e,items:e.items.map(s=>Y(s,n))}:{...e,isExpanded:n&&e.items?.length?!0:e.isExpanded,items:e.items?.map(s=>Y(s,n))}}function ze(e){return e.trim().toLowerCase()}var se=(e=>(e.Enter="Enter",e))(se||{});const re=f.createContext(null);function $e({children:e,isAgentAvailable:n}){const s=f.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(re.Provider,{value:s,children:e})}function We(){const e=f.useContext(re);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=$e;exports.Alert=de;exports.AlertType=A;exports.Button=V;exports.CALENDAR_MOBILE_PADDING=Q;exports.Calendar=fe;exports.Checkbox=H;exports.CloseButton=U;exports.CollapsibleBlock=pe;exports.CopyButton=Te;exports.DownloadFormatMessage=Ie;exports.DraggableList=qe;exports.Dropdown=Ee;exports.HighlightText=ge;exports.IconButton=be;exports.InlineAlert=Le;exports.InlineAlertProvider=ke;exports.InlineAlertType=F;exports.Input=Z;exports.InputWithIcon=je;exports.KeyboardKey=se;exports.Link=Ne;exports.Loader=W;exports.PopUpSize=q;exports.PopUpState=T;exports.Popup=we;exports.Radio=ye;exports.RequestLimitMessage=Se;exports.SERIES_LIMIT=z;exports.TREE_NODE_ARROW_SIZE=me;exports.TREE_NODE_PADDING=he;exports.Tag=Ce;exports.filterDraggableListNodes=Be;exports.useAgentAvailability=We;exports.useDebounce=xe;exports.useIsMobile=K;
package/index.mjs CHANGED
@@ -234,7 +234,7 @@ const ft = 24, pt = 24, q = 1e3, Ge = 24, gt = ({
234
234
  htmlFor: t,
235
235
  onClick: h,
236
236
  className: R(
237
- "flex min-w-0 items-center py-1",
237
+ "flex min-w-0 items-center py-1 shrink-0",
238
238
  a ? "cursor-not-allowed opacity-50" : "cursor-pointer",
239
239
  d
240
240
  ),
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@epam/statgpt-ui-components",
3
- "version": "0.4.0-rc.24",
3
+ "version": "0.4.0-rc.26",
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.4.0-rc.24",
8
+ "@epam/statgpt-shared-toolkit": "0.4.0-rc.26",
9
9
  "@tabler/icons-react": "^3.34.1",
10
10
  "@floating-ui/react": "^0.27.14",
11
11
  "tailwind-merge": "^3.4.0",