@epam/statgpt-ui-components 0.5.0-rc.29 → 0.5.0-rc.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +1 -1
- 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"),p=require("react"),h=require("classnames"),D=require("@tabler/icons-react"),ie=require("tailwind-merge"),oe=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),N=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:a})=>t.jsx("button",{type:"button","aria-label":"button",className:n,title:e,onClick:a,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:a,closeButtonTitle:l,children:c})=>{const i=e?.type,u=i===O.IN_PROGRESS||i===O.INFO,x=()=>u?"alert-in-progress":i===O.SUCCESS?"alert-success":"alert-error",m=u?n:i===O.SUCCESS?s:i===O.ERROR?r:null,f=e?.text;return p.useEffect(()=>{if(!e||u)return;const v=setTimeout(()=>{a?.()},xe);return()=>clearTimeout(v)},[e,u,a]),t.jsx("div",{className:h("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",x()),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}),c??(f&&t.jsx("div",{className:"alert-text whitespace-pre-line break-words",title:f,children:f}))]}),t.jsx(U,{title:l,onClick:a})]})})},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(h(...e))}const Q=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:a,iconAfter:l,iconBefore:c,onClick:i,isSmallButton:u})=>{const x=L([u?"font-semibold":"",l?"mr-2":"",c?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:h("base-button",e,u?"small-button":""),disabled:a||s,"aria-label":"button",onClick:m=>i?.(m),title:r,children:[c,s&&t.jsx(K,{}),r?u?t.jsx("h4",{className:x,children:r}):t.jsx("h3",{className:x,children:r}):null,l]})};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)`),a=l=>{s(l.matches)};return s(r.matches),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),n}function fe(e,n){const s=p.useRef(null);return p.useCallback((...a)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...a)},n)},[e,n])}const pe=24,ge=24,W=1e3,X=24,be=({label:e,onChange:n,value:s,options:r,calendarResolution:a=P.CalendarResolution.DAY,id:l,icon:c,isEndDate:i})=>{const u=p.useRef(null),x=Z();p.useEffect(()=>{const j=u?.current;j&&j.querySelector("input")?.setAttribute("aria-label",e)},[e]);const m={...r,disableMobile:!0,defaultDate:a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},f=(j,C,b)=>{const d=`calendar__${a===P.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(d)},v=(j,C,b)=>{if(a===P.CalendarResolution.MONTH&&j.length>0){const d=r.minDate,o=r.maxDate,g=j[0].getFullYear(),w=b.calendarContainer,S="flatpickr-disabled",y=w.querySelectorAll(".flatpickr-monthSelect-month"),E=w.querySelectorAll(".flatpickr-next-month")[0],R=w.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`,i?(d.style.right=`${window.innerWidth-o.right-(x?X:0)}px`,d.style.left="auto"):d.style.left=`${o.left}px`)},0)};return t.jsxs("div",{className:"calendar relative",ref:u,children:[t.jsx("div",{className:"calendar-title mb-1",children:e}),t.jsx("label",{htmlFor:l,className:"absolute right-[11px] top-[29px] cursor-pointer",children:c||t.jsx(D.IconCalendarEvent,{})}),t.jsx(oe,{defaultValue:(a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:m,onChange:j=>{n(j[0])},onOpen:[v],onReady:[f],id:l})]})},V=({label:e,id:n,checked:s,checkboxIcon:r,onChange:a,disabled:l=!1,className:c,stopPropagation:i=!0})=>{const u=p.useCallback(f=>{i&&f.stopPropagation()},[i]),x=p.useCallback(f=>{i&&f.stopPropagation(),a?.(n,f.target.checked)},[a,n,i]),m=()=>{if(s)return r||t.jsx(D.IconSquareCheckFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:u,className:L("flex min-w-0 items-center py-1 shrink-0",l?"cursor-not-allowed opacity-50":"cursor-pointer",c),children:[t.jsx("span",{className:h("checkbox-button relative flex size-[14px] items-center justify-center"),"aria-hidden":!0,children:m()}),e?t.jsx("p",{className:h("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:l,onChange:x,className:"hidden"})]})},je=({title:e,icon:n,children:s,value:r})=>{const[a,l]=p.useState(!1);return t.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${a?"collapsible-block-open":""}`,children:[t.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>l(!a),children:[t.jsx("div",{className:`${a?"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})]})]}),a&&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 a=n?.toLowerCase()||"",l=e?.toLowerCase()?.split(a)||"";for(let c=0,i=0;c<l?.length;c++){const u=l?.[c],x=u.length;u!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(i,i+x)}),i+=x,c!==l?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(i,i+n.length)}),i+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:h(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},we=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:a,isBaseIconStyles:l=!0})=>t.jsx("button",{type:"button",className:h(l&&"base-icon-button",s),onClick:c=>n?.(c),disabled:r,title:a,"aria-label":"button",children:e}),J=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:a="text",disabled:l,readonly:c,onChange:i,onKeyDown:u,onFocus:x,onBlur:m})=>{const f=h("truncate outline-none shadow-none body-1",r,c?"pointer-events-none":"");return t.jsx("input",{type:a,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:l,className:f,onKeyDown:u,onFocus:x,onBlur:m,onChange:v=>i?.(v.currentTarget.value)})},Ce=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...a})=>t.jsxs("div",{className:h("input w-full flex flex-row",s),children:[e,t.jsx(J,{cssClass:h("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...a}),n]}),ve=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:a})=>{const l=h(a?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:h("base-link",s),title:n,children:[r,t.jsx("span",{className:l,children:n}),a]})},ye=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:h("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:a,onChange:l})=>{const c=p.useCallback(i=>{i.stopPropagation(),l?.(n,i.target.checked)},[l,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:h("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})]}),a&&t.jsx("span",{className:"radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",title:a,children:a}),t.jsx("input",{type:"radio",onChange:c,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:a,children:l,overlayClassName:c,containerClassName:i,dividers:u=!0,closeButtonTitle:x})=>{const{refs:m,context:f}=N.useFloating({open:n!==F.Closed&&!!n,onOpenChange:a}),v=N.useRole(f,{role:"dialog"}),j=N.useDismiss(f,{outsidePress:!0}),{getFloatingProps:C}=N.useInteractions([v,j]),b=p.useCallback(d=>{d?.preventDefault(),d?.stopPropagation(),a()},[a]);return t.jsx(N.FloatingPortal,{id:e,children:n!==F.Closed&&t.jsx(N.FloatingOverlay,{className:h("z-modal flex items-center justify-center bg-blackout p-4",c),children:t.jsx(N.FloatingFocusManager,{context:f,children:t.jsxs("div",{className:h("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%]",u&&"divide-neutrals-400 divide-y",i,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:m.setFloating,...C({onClick(d){d.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:x,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),l.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)),a=A,l=s-r-A;return{y:Math.min(Math.max(e,a),Math.max(a,l))}}},De=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:a,containerClassName:l,openedClassName:c,onOptionSelect:i})=>{const u=p.useId(),[x,m]=p.useState(!1),{refs:f,floatingStyles:v,context:j}=N.useFloating({open:x,onOpenChange:a?void 0:m,placement:"bottom-end",strategy:"fixed",middleware:[N.offset(A),N.flip({padding:A}),N.size({padding:A,apply({availableHeight:g,elements:w}){w.floating.style.maxHeight=`${Math.max(0,g)}px`}}),N.shift({padding:A}),ke],whileElementsMounted:N.autoUpdate}),C=N.useClick(j),b=N.useDismiss(j,{outsidePress:!0}),{getReferenceProps:d,getFloatingProps:o}=N.useInteractions([C,b]);return p.useEffect(()=>{x&&window.dispatchEvent(new CustomEvent(G,{detail:u}))},[u,x]),p.useEffect(()=>{const g=w=>{w instanceof CustomEvent&&w.detail!==u&&m(!1)};return window.addEventListener(G,g),()=>{window.removeEventListener(G,g)}},[u]),p.useEffect(()=>{a&&m(!1)},[a]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:f.setReference,...d({onClick(g){g.stopPropagation()}}),className:h(l,x&&c),children:e}),x&&t.jsx(N.FloatingPortal,{children:t.jsxs("div",{ref:f.setFloating,style:{...v,overflowY:"auto"},className:"dropdown-menu-shadow dropdown-container z-10 flex flex-col rounded bg-white",...o(),children:[s&&s,n&&n.map(g=>t.jsx("div",{onClick:w=>{w.stopPropagation(),i?.(g.key),m(!1)},className:h("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:a})=>t.jsxs("div",{className:h("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:h("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:h("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(W):e?.showingLimit?.(W)})]}),n&&t.jsx("span",{className:h("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:a||"",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:a}){const l=Le(),c=n??l?.icons?.[e],i=l?.classes?.container??Fe,u=l?.classes?.types?.[e]??_e[e],x=L(i,u,r),m=L(Me,l?.classes?.icon),f=L(Te,l?.classes?.content,a);return t.jsxs("div",{"data-type":e,className:x,children:[c?t.jsx("span",{className:m,children:c}):null,s?t.jsx("div",{className:f,children:s}):null]})}const Ye=({title:e,copiedTitle:n,tooltip:s,icon:r,copiedIcon:a,className:l,buttonTextClassName:c,onClick:i})=>{const[u,x]=p.useState(!1),m=p.useRef(null),f=()=>{i(),x(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{x(!1)},1e3)};return p.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),t.jsxs("div",{className:"relative w-fit",children:[t.jsx(Q,{title:u?n:e,isSmallButton:!0,disabled:u,buttonClassName:L(["text-button-tertiary small-icon-button !h-6 !p-0",l]),textClassName:L(["ml-1",c]),onClick:f,iconBefore:u?a:r}),s&&u&&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:a,isChecked:l,isExpanded:c}){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:[a?t.jsx(V,{id:e,checked:!!l,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:h("transition-transform",c?"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(a=>a.id===s)??null:null}function ne(e,n){if(n.length===0)return e;const[s,...r]=n,a=e.find(l=>l.id===s);return a?.items?ne(a.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,...a]=n;return e.map(l=>l.id!==r||!l.items?l:{...l,items:re(l.items,a,s)})}function ze({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:a,onItemClick:l,onToggleExpanded:c,onToggleChecked:i}){const u=!!n.items?.length,x=!!n.isExpanded,m=n.isDisabled?!1:n.draggable??!0,f=n.isDisabled?!1:n.checkable??!0,v=te(e,n.id),{attributes:j,listeners:C,setNodeRef:b,setActivatorNodeRef:d,transform:o,transition:g,isDragging:w}=Y.useSortable({id:v,disabled:!m}),S={transform:ce.CSS.Transform.toString(o),transition:g,opacity:w?.6:void 0},y=!!n.isDisabled,E=y||!f,R=[...e,n.id];return t.jsxs("div",{ref:b,style:S,className:h(["group flex items-stretch overflow-hidden rounded bg-white","select-none",y?"opacity-50":""]),children:[s?t.jsx("div",{className:h(["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:h(["rounded p-1",m?"cursor-grab":"cursor-default","transition-opacity"]),...m?C:{},...m?j:{},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||l?.({itemId:n.id,path:R,nativeEvent:k})},className:h(["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:!f,className:"p-0",stopPropagation:!0,onChange:(k,I)=>i?.({itemId:n.id,path:R,nextChecked:!!I})}):null,t.jsx("span",{className:"body-3 truncate text-neutrals-800",children:a?a(n):n.label})]}),u?t.jsx("button",{type:"button",disabled:y,onClick:k=>{k.stopPropagation(),c?.({itemId:n.id,path:R,nextExpanded:!x})},"aria-label":x?"Collapse":"Expand",className:h(["flex w-8 items-center justify-center rounded",y?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:h("transition-transform duration-150 ease-out",x?"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:a,onToggleChecked:l,onItemClick:c,renderLabel:i}){const u=M.useSensors(M.useSensor(M.PointerSensor,{activationConstraint:{distance:6}})),[x,m]=ue.useState(null),f=C=>{const b=String(C.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})},v=C=>{m(null);const b=C.over;if(!b)return;const d=H(String(C.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 w=g.findIndex(E=>E.id===d.itemId),S=g.findIndex(E=>E.id===o.itemId);if(w===-1||S===-1||w===S)return;const y=re(e,d.parentPath,E=>{const R=E.filter(_=>_.type==="item"),k=Y.arrayMove(R,w,S);let I=0;return E.map(_=>{if(_.type!=="item")return _;const z=k[I];return I+=1,z})});r(y)},j=(C,b=[])=>{const d=C.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:C.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:j(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:i,onItemClick:c,onToggleExpanded:a,onToggleChecked:l}),o.items?.length&&o.isExpanded?t.jsx("div",{className:"pl-7",children:j(o.items,[...b,o.id])}):null]},o.id))})})};return t.jsxs(M.DndContext,{sensors:u,collisionDetection:M.closestCenter,onDragStart:f,onDragEnd:v,children:[t.jsx("div",{className:"flex flex-col",children:j(e)}),t.jsx(M.DragOverlay,{children:x?t.jsx(qe,{id:x.id,label:x.label,hasChildren:x.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:x.isChecked,isExpanded:x.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:a=!0,includeGroupDescendantsOnMatch:l=!0,includeItemDescendantsOnMatch:c=!1,match:i=He}=s;return $(e,r,{expandMatchedBranches:a,includeGroupDescendantsOnMatch:l,includeItemDescendantsOnMatch:c,match:i})??[]}function $(e,n,s){const r=[];for(const a of e){const l=$e(a,n,s);l&&r.push(l)}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 c=e.items?.length?$(e.items,n,s):null;return!r&&!c?null:{...e,items:c??[]}}const a=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return B(e,s.expandMatchedBranches);if(!r&&!a)return null;const l={...e};return a?(l.items=a,s.expandMatchedBranches&&(l.isExpanded=!0)):delete l.items,l}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 ae=(e=>(e.Enter="Enter",e))(ae||{});const le=p.createContext(null);function Ve({children:e,isAgentAvailable:n}){const s=p.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(le.Provider,{value:s,children:e})}function Ke(){const e=p.useContext(le);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=ae;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"),p=require("react"),h=require("classnames"),D=require("@tabler/icons-react"),ie=require("tailwind-merge"),oe=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),N=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:a})=>t.jsx("button",{type:"button","aria-label":"button",className:n,title:e,onClick:a,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:a,closeButtonTitle:l,children:c})=>{const i=e?.type,u=i===O.IN_PROGRESS||i===O.INFO,x=()=>u?"alert-in-progress":i===O.SUCCESS?"alert-success":"alert-error",m=u?n:i===O.SUCCESS?s:i===O.ERROR?r:null,f=e?.text;return p.useEffect(()=>{if(!e||u)return;const v=setTimeout(()=>{a?.()},xe);return()=>clearTimeout(v)},[e,u,a]),t.jsx("div",{className:h("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",x()),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}),c??(f&&t.jsx("div",{className:"alert-text whitespace-pre-line break-words",title:f,children:f}))]}),t.jsx(U,{title:l,onClick:a})]})})},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(h(...e))}const Q=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:a,iconAfter:l,iconBefore:c,onClick:i,isSmallButton:u})=>{const x=L([u?"font-semibold":"",l?"mr-2":"",c?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:h("base-button",e,u?"small-button":""),disabled:a||s,"aria-label":"button",onClick:m=>i?.(m),title:r,children:[c,s&&t.jsx(K,{}),r?u?t.jsx("h4",{className:x,children:r}):t.jsx("h3",{className:x,children:r}):null,l]})};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)`),a=l=>{s(l.matches)};return s(r.matches),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),n}function fe(e,n){const s=p.useRef(null);return p.useCallback((...a)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...a)},n)},[e,n])}const pe=24,ge=24,W=1e3,X=24,be=({label:e,onChange:n,value:s,options:r,calendarResolution:a=P.CalendarResolution.DAY,id:l,icon:c,isEndDate:i})=>{const u=p.useRef(null),x=Z();p.useEffect(()=>{const j=u?.current;j&&j.querySelector("input")?.setAttribute("aria-label",e)},[e]);const m={...r,disableMobile:!0,defaultDate:a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},f=(j,C,b)=>{const d=`calendar__${a===P.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(d)},v=(j,C,b)=>{if(a===P.CalendarResolution.MONTH&&j.length>0){const d=r.minDate,o=r.maxDate,g=j[0].getFullYear(),w=b.calendarContainer,S="flatpickr-disabled",y=w.querySelectorAll(".flatpickr-monthSelect-month"),E=w.querySelectorAll(".flatpickr-next-month")[0],R=w.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`,i?(d.style.right=`${window.innerWidth-o.right-(x?X:0)}px`,d.style.left="auto"):d.style.left=`${o.left}px`)},0)};return t.jsxs("div",{className:"calendar relative",ref:u,children:[t.jsx("div",{className:"calendar-title mb-1",children:e}),t.jsx("label",{htmlFor:l,className:"absolute right-[11px] top-[29px] cursor-pointer",children:c||t.jsx(D.IconCalendarEvent,{})}),t.jsx(oe,{defaultValue:(a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:m,onChange:j=>{n(j[0])},onOpen:[v],onReady:[f],id:l})]})},V=({label:e,id:n,checked:s,checkboxIcon:r,onChange:a,disabled:l=!1,className:c,stopPropagation:i=!0})=>{const u=p.useCallback(f=>{i&&f.stopPropagation()},[i]),x=p.useCallback(f=>{i&&f.stopPropagation(),a?.(n,f.target.checked)},[a,n,i]),m=()=>{if(s)return r||t.jsx(D.IconSquareCheckFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:u,className:L("flex min-w-0 items-center py-1 shrink-0",l?"cursor-not-allowed opacity-50":"cursor-pointer",c),children:[t.jsx("span",{className:h("checkbox-button relative flex size-[14px] items-center justify-center"),"aria-hidden":!0,children:m()}),e?t.jsx("p",{className:h("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:l,onChange:x,className:"hidden"})]})},je=({title:e,icon:n,children:s,value:r})=>{const[a,l]=p.useState(!1);return t.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${a?"collapsible-block-open":""}`,children:[t.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>l(!a),children:[t.jsx("div",{className:`${a?"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})]})]}),a&&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 a=n?.toLowerCase()||"",l=e?.toLowerCase()?.split(a)||"";for(let c=0,i=0;c<l?.length;c++){const u=l?.[c],x=u.length;u!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(i,i+x)}),i+=x,c!==l?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(i,i+n.length)}),i+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:h(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},we=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:a,isBaseIconStyles:l=!0})=>t.jsx("button",{type:"button",className:h(l&&"base-icon-button",s),onClick:c=>n?.(c),disabled:r,title:a,"aria-label":"button",children:e}),J=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:a="text",disabled:l,readonly:c,onChange:i,onKeyDown:u,onFocus:x,onBlur:m})=>{const f=h("truncate outline-none shadow-none body-1",r,c?"pointer-events-none":"");return t.jsx("input",{type:a,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:l,className:f,onKeyDown:u,onFocus:x,onBlur:m,onChange:v=>i?.(v.currentTarget.value)})},Ce=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...a})=>t.jsxs("div",{className:h("input w-full flex flex-row",s),children:[e,t.jsx(J,{cssClass:h("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...a}),n]}),ve=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:a})=>{const l=h(a?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:h("base-link",s),title:n,children:[r,t.jsx("span",{className:l,children:n}),a]})},ye=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:h("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:a,onChange:l})=>{const c=p.useCallback(i=>{i.stopPropagation(),l?.(n,i.target.checked)},[l,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:h("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})]}),a&&t.jsx("span",{className:"radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",title:a,children:a}),t.jsx("input",{type:"radio",onChange:c,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:a,children:l,overlayClassName:c,containerClassName:i,dividers:u=!0,closeButtonTitle:x})=>{const{refs:m,context:f}=N.useFloating({open:n!==F.Closed&&!!n,onOpenChange:a}),v=N.useRole(f,{role:"dialog"}),j=N.useDismiss(f,{outsidePress:!0}),{getFloatingProps:C}=N.useInteractions([v,j]),b=p.useCallback(d=>{d?.preventDefault(),d?.stopPropagation(),a()},[a]);return t.jsx(N.FloatingPortal,{id:e,children:n!==F.Closed&&t.jsx(N.FloatingOverlay,{className:h("z-modal flex items-center justify-center bg-blackout p-4",c),children:t.jsx(N.FloatingFocusManager,{context:f,children:t.jsxs("div",{className:h("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%]",u&&"divide-neutrals-400 divide-y",i,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:m.setFloating,...C({onClick(d){d.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:x,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),l.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)),a=A,l=s-r-A;return{y:Math.min(Math.max(e,a),Math.max(a,l))}}},De=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:a,containerClassName:l,openedClassName:c,onOptionSelect:i})=>{const u=p.useId(),[x,m]=p.useState(!1),{refs:f,floatingStyles:v,context:j}=N.useFloating({open:x,onOpenChange:a?void 0:m,placement:"bottom-end",strategy:"fixed",middleware:[N.offset(A),N.flip({padding:A}),N.size({padding:A,apply({availableHeight:g,elements:w}){w.floating.style.maxHeight=`${Math.max(0,g)}px`}}),N.shift({padding:A}),ke],whileElementsMounted:N.autoUpdate}),C=N.useClick(j),b=N.useDismiss(j,{outsidePress:!0}),{getReferenceProps:d,getFloatingProps:o}=N.useInteractions([C,b]);return p.useEffect(()=>{x&&window.dispatchEvent(new CustomEvent(G,{detail:u}))},[u,x]),p.useEffect(()=>{const g=w=>{w instanceof CustomEvent&&w.detail!==u&&m(!1)};return window.addEventListener(G,g),()=>{window.removeEventListener(G,g)}},[u]),p.useEffect(()=>{a&&m(!1)},[a]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:f.setReference,...d({onClick(g){g.stopPropagation()}}),className:h(l,x&&c),children:e}),x&&t.jsx(N.FloatingPortal,{children:t.jsxs("div",{ref:f.setFloating,style:{...v,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:w=>{w.stopPropagation(),i?.(g.key),m(!1)},className:h("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:a})=>t.jsxs("div",{className:h("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:h("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:h("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(W):e?.showingLimit?.(W)})]}),n&&t.jsx("span",{className:h("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:a||"",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:a}){const l=Le(),c=n??l?.icons?.[e],i=l?.classes?.container??Fe,u=l?.classes?.types?.[e]??_e[e],x=L(i,u,r),m=L(Me,l?.classes?.icon),f=L(Te,l?.classes?.content,a);return t.jsxs("div",{"data-type":e,className:x,children:[c?t.jsx("span",{className:m,children:c}):null,s?t.jsx("div",{className:f,children:s}):null]})}const Ye=({title:e,copiedTitle:n,tooltip:s,icon:r,copiedIcon:a,className:l,buttonTextClassName:c,onClick:i})=>{const[u,x]=p.useState(!1),m=p.useRef(null),f=()=>{i(),x(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{x(!1)},1e3)};return p.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),t.jsxs("div",{className:"relative w-fit",children:[t.jsx(Q,{title:u?n:e,isSmallButton:!0,disabled:u,buttonClassName:L(["text-button-tertiary small-icon-button !h-6 !p-0",l]),textClassName:L(["ml-1",c]),onClick:f,iconBefore:u?a:r}),s&&u&&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:a,isChecked:l,isExpanded:c}){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:[a?t.jsx(V,{id:e,checked:!!l,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:h("transition-transform",c?"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(a=>a.id===s)??null:null}function ne(e,n){if(n.length===0)return e;const[s,...r]=n,a=e.find(l=>l.id===s);return a?.items?ne(a.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,...a]=n;return e.map(l=>l.id!==r||!l.items?l:{...l,items:re(l.items,a,s)})}function ze({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:a,onItemClick:l,onToggleExpanded:c,onToggleChecked:i}){const u=!!n.items?.length,x=!!n.isExpanded,m=n.isDisabled?!1:n.draggable??!0,f=n.isDisabled?!1:n.checkable??!0,v=te(e,n.id),{attributes:j,listeners:C,setNodeRef:b,setActivatorNodeRef:d,transform:o,transition:g,isDragging:w}=Y.useSortable({id:v,disabled:!m}),S={transform:ce.CSS.Transform.toString(o),transition:g,opacity:w?.6:void 0},y=!!n.isDisabled,E=y||!f,R=[...e,n.id];return t.jsxs("div",{ref:b,style:S,className:h(["group flex items-stretch overflow-hidden rounded bg-white","select-none",y?"opacity-50":""]),children:[s?t.jsx("div",{className:h(["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:h(["rounded p-1",m?"cursor-grab":"cursor-default","transition-opacity"]),...m?C:{},...m?j:{},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||l?.({itemId:n.id,path:R,nativeEvent:k})},className:h(["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:!f,className:"p-0",stopPropagation:!0,onChange:(k,I)=>i?.({itemId:n.id,path:R,nextChecked:!!I})}):null,t.jsx("span",{className:"body-3 truncate text-neutrals-800",children:a?a(n):n.label})]}),u?t.jsx("button",{type:"button",disabled:y,onClick:k=>{k.stopPropagation(),c?.({itemId:n.id,path:R,nextExpanded:!x})},"aria-label":x?"Collapse":"Expand",className:h(["flex w-8 items-center justify-center rounded",y?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:h("transition-transform duration-150 ease-out",x?"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:a,onToggleChecked:l,onItemClick:c,renderLabel:i}){const u=M.useSensors(M.useSensor(M.PointerSensor,{activationConstraint:{distance:6}})),[x,m]=ue.useState(null),f=C=>{const b=String(C.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})},v=C=>{m(null);const b=C.over;if(!b)return;const d=H(String(C.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 w=g.findIndex(E=>E.id===d.itemId),S=g.findIndex(E=>E.id===o.itemId);if(w===-1||S===-1||w===S)return;const y=re(e,d.parentPath,E=>{const R=E.filter(_=>_.type==="item"),k=Y.arrayMove(R,w,S);let I=0;return E.map(_=>{if(_.type!=="item")return _;const z=k[I];return I+=1,z})});r(y)},j=(C,b=[])=>{const d=C.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:C.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:j(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:i,onItemClick:c,onToggleExpanded:a,onToggleChecked:l}),o.items?.length&&o.isExpanded?t.jsx("div",{className:"pl-7",children:j(o.items,[...b,o.id])}):null]},o.id))})})};return t.jsxs(M.DndContext,{sensors:u,collisionDetection:M.closestCenter,onDragStart:f,onDragEnd:v,children:[t.jsx("div",{className:"flex flex-col",children:j(e)}),t.jsx(M.DragOverlay,{children:x?t.jsx(qe,{id:x.id,label:x.label,hasChildren:x.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:x.isChecked,isExpanded:x.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:a=!0,includeGroupDescendantsOnMatch:l=!0,includeItemDescendantsOnMatch:c=!1,match:i=He}=s;return $(e,r,{expandMatchedBranches:a,includeGroupDescendantsOnMatch:l,includeItemDescendantsOnMatch:c,match:i})??[]}function $(e,n,s){const r=[];for(const a of e){const l=$e(a,n,s);l&&r.push(l)}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 c=e.items?.length?$(e.items,n,s):null;return!r&&!c?null:{...e,items:c??[]}}const a=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return B(e,s.expandMatchedBranches);if(!r&&!a)return null;const l={...e};return a?(l.items=a,s.expandMatchedBranches&&(l.isExpanded=!0)):delete l.items,l}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 ae=(e=>(e.Enter="Enter",e))(ae||{});const le=p.createContext(null);function Ve({children:e,isAgentAvailable:n}){const s=p.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(le.Provider,{value:s,children:e})}function Ke(){const e=p.useContext(le);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=ae;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;
|
package/index.mjs
CHANGED
|
@@ -670,7 +670,7 @@ const Ve = ({
|
|
|
670
670
|
{
|
|
671
671
|
ref: g.setFloating,
|
|
672
672
|
style: { ...C, overflowY: "auto" },
|
|
673
|
-
className: "dropdown-menu-shadow dropdown-container z-
|
|
673
|
+
className: "dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",
|
|
674
674
|
...o(),
|
|
675
675
|
children: [
|
|
676
676
|
n && n,
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/statgpt-ui-components",
|
|
3
|
-
"version": "0.5.0-rc.
|
|
3
|
+
"version": "0.5.0-rc.30",
|
|
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.5.0-rc.
|
|
8
|
+
"@epam/statgpt-shared-toolkit": "0.5.0-rc.30",
|
|
9
9
|
"@tabler/icons-react": "^3.34.1",
|
|
10
10
|
"@floating-ui/react": "^0.27.14",
|
|
11
11
|
"tailwind-merge": "^3.4.0",
|