@epam/statgpt-ui-components 0.4.0-rc.21 → 0.4.0-rc.23
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 +120 -117
- 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"),k=require("@tabler/icons-react"),le=require("tailwind-merge"),ae=require("react-flatpickr"),T=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(k.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=T.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===T.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},g=(b,j,p)=>{const c=`calendar__${l===T.CalendarResolution.MONTH?"month":"day"}`;p.calendarContainer&&p.calendarContainer.classList.add(c)},y=(b,j,p)=>{if(l===T.CalendarResolution.MONTH&&b.length>0){const c=r.minDate,i=r.maxDate,v=b[0].getFullYear(),I=p.calendarContainer,E="flatpickr-disabled",w=I.querySelectorAll(".flatpickr-monthSelect-month"),C=I.querySelectorAll(".flatpickr-next-month")[0],R=I.querySelectorAll(".flatpickr-prev-month")[0];v===i.getFullYear()&&C.classList.add(E),v===c.getFullYear()&&R.classList.add(E),(v===c.getFullYear()||v===i.getFullYear())&&w.forEach(D=>{D.classList.remove(E);const S=new Date(D.getAttribute("aria-label")),_=S.getFullYear()===c.getFullYear()&&S.getMonth()===c.getMonth(),B=S.getFullYear()===i.getFullYear()&&S.getMonth()===i.getMonth();_||B||(S<c||S>i)&&D.classList.add(E)})}setTimeout(()=>{const c=p.calendarContainer,i=p._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(k.IconCalendarEvent,{})}),t.jsx(ae,{defaultValue:(l===T.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:h,onChange:b=>{n(b[0])},onOpen:[y],onReady:[g],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(g=>{d&&g.stopPropagation()},[d]),u=f.useCallback(g=>{d&&g.stopPropagation(),l?.(n,g.target.checked)},[l,n,d]),h=()=>{if(s)return r||t.jsx(k.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(k.IconChevronDown,{className:"mr-3 size-5"})}),t.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[t.jsx("span",{children:e}),r&&t.jsx("p",{className:"body-1 text-neutrals-800",children:r})]})]}),l&&t.jsx("div",{className:"collapsible-block-content pb-4",children:s})]})},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 g=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:g,onKeyDown:x,onFocus:u,onBlur:h,onChange:y=>d?.(y.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 P=(e=>(e.Closed="Closed",e.Opened="Opened",e))(P||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const ve=({portalId:e,state:n=P.Opened,heading:s,size:r,onClose:l,children:a,overlayClassName:o,containerClassName:d,dividers:x=!0,closeButtonTitle:u})=>{const{refs:h,context:g}=N.useFloating({open:n!==P.Closed&&!!n,onOpenChange:l}),y=N.useRole(g,{role:"dialog"}),b=N.useDismiss(g,{outsidePress:!0}),{getFloatingProps:j}=N.useInteractions([y,b]),p=f.useCallback(c=>{c?.preventDefault(),c?.stopPropagation(),l()},[l]);return t.jsx(N.FloatingPortal,{id:e,children:n!==P.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:g,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:p,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),a.map(c=>c)]})})})})},we=e=>e.state===P.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:g,context:y}=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(y),j=N.useDismiss(y,{outsidePress:!0}),{getReferenceProps:p,getFloatingProps:c}=N.useInteractions([b,j]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:h.setReference,...p({onClick(i){i.stopPropagation()}}),className:m(a,x&&o),children:e}),x&&t.jsxs("div",{ref:h.setFloating,style:g,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:v=>{v.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),g=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:g,children:s}):null]})}const Pe=({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),g=()=>{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:g,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 Te({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(k.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[l?t.jsx(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(k.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,g=n.isDisabled?!1:n.checkable??!0,y=J(e,n.id),{attributes:b,listeners:j,setNodeRef:p,setActivatorNodeRef:c,transform:i,transition:v,isDragging:I}=M.useSortable({id:y,disabled:!h}),E={transform:ie.CSS.Transform.toString(i),transition:v,opacity:I?.6:void 0},w=!!n.isDisabled,C=[...e,n.id];return t.jsxs("div",{ref:p,style:E,className:m(["group flex items-stretch overflow-hidden rounded bg-white","select-none",w?"opacity-50":""]),children:[s?t.jsx("div",{className:m(["group/drag-handle flex w-6 items-center justify-center rounded",w?"":"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(k.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:w,onClick:R=>a?.({itemId:n.id,path:C,nativeEvent:R}),className:m(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",w?"":"hover:bg-neutrals-100",w?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(H,{id:`draggable-list-${C.join("-")}`,checked:!!n.isChecked,disabled:!g,className:"p-0",stopPropagation:!0,onChange:(R,D)=>d?.({itemId:n.id,path:C,nextChecked:!!D})}):null,t.jsx("span",{className:"body-3 truncate text-neutrals-800",children:l?l(n):n.label})]}),x?t.jsx("button",{type:"button",disabled:w,onClick:R=>{R.stopPropagation(),o?.({itemId:n.id,path:C,nextExpanded:!u})},"aria-label":u?"Collapse":"Expand",className:m(["flex w-8 items-center justify-center rounded",w?"":"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(k.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),g=j=>{const p=String(j.active.id),c=G(p);if(!c)return;const i=Fe(e,c.parentPath,c.itemId);!i||i.type!=="item"||h({id:p,label:i.label,hasChildren:!!i.items?.length,isChecked:i.isChecked,isExpanded:i.isExpanded})},y=j=>{h(null);const p=j.over;if(!p)return;const c=G(String(j.active.id)),i=G(String(p.id));if(!c||!i||c.parentPath.join("/")!==i.parentPath.join("/"))return;const v=te(e,c.parentPath);if(!v)return;const I=v.findIndex(C=>C.id===c.itemId),E=v.findIndex(C=>C.id===i.itemId);if(I===-1||E===-1||I===E)return;const w=ne(e,c.parentPath,C=>{const R=C.filter(_=>_.type==="item"),D=M.arrayMove(R,I,E);let S=0;return C.map(_=>{if(_.type!=="item")return _;const B=D[S];return S+=1,B})});r(w)},b=(j,p=[])=>{const c=j.filter(i=>i.type==="item").map(i=>J(p,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(k.IconDatabase,{size:12,className:"shrink-0"}),i.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:b(i.items,[...p,i.id])})]},i.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(Me,{parentPath:p,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,[...p,i.id])}):null]},i.id))})})};return t.jsxs(L.DndContext,{sensors:x,collisionDetection:L.closestCenter,onDragStart:g,onDragEnd:y,children:[t.jsx("div",{className:"flex flex-col",children:b(e)}),t.jsx(L.DragOverlay,{children:u?t.jsx(Te,{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=Pe;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=P;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",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
|
@@ -7,9 +7,9 @@ import { extendTailwindMerge as pe } from "tailwind-merge";
|
|
|
7
7
|
import ge from "react-flatpickr";
|
|
8
8
|
import { CalendarResolution as O } from "@epam/statgpt-shared-toolkit";
|
|
9
9
|
import { useFloating as X, useRole as xe, useDismiss as Z, useInteractions as J, FloatingPortal as be, FloatingOverlay as Ne, FloatingFocusManager as Ce, autoUpdate as ve, offset as ye, flip as we, shift as Ee, useClick as Se } from "@floating-ui/react";
|
|
10
|
-
import { useSensors as Ie, useSensor as ke, PointerSensor as De, DndContext as
|
|
11
|
-
import { useSortable as Oe, SortableContext as Ae, verticalListSortingStrategy as _e, arrayMove as
|
|
12
|
-
import { CSS as
|
|
10
|
+
import { useSensors as Ie, useSensor as ke, PointerSensor as De, DndContext as Re, closestCenter as Le, DragOverlay as Fe } from "@dnd-kit/core";
|
|
11
|
+
import { useSortable as Oe, SortableContext as Ae, verticalListSortingStrategy as _e, arrayMove as Te } from "@dnd-kit/sortable";
|
|
12
|
+
import { CSS as Pe } from "@dnd-kit/utilities";
|
|
13
13
|
const ee = () => /* @__PURE__ */ r("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ r("div", { className: "loader" }) }), te = ({
|
|
14
14
|
title: e,
|
|
15
15
|
btnClassNames: t,
|
|
@@ -74,7 +74,7 @@ const mt = ({
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
function
|
|
77
|
+
function R(...e) {
|
|
78
78
|
return Me(f(...e));
|
|
79
79
|
}
|
|
80
80
|
const je = ({
|
|
@@ -88,7 +88,7 @@ const je = ({
|
|
|
88
88
|
onClick: u,
|
|
89
89
|
isSmallButton: h
|
|
90
90
|
}) => {
|
|
91
|
-
const m =
|
|
91
|
+
const m = R([
|
|
92
92
|
h ? "font-semibold" : "",
|
|
93
93
|
a ? "mr-2" : "",
|
|
94
94
|
d ? "ml-2" : "",
|
|
@@ -157,26 +157,26 @@ const ft = 24, pt = 24, q = 1e3, Ge = 24, gt = ({
|
|
|
157
157
|
...s,
|
|
158
158
|
disableMobile: !0,
|
|
159
159
|
defaultDate: l === O.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n
|
|
160
|
-
},
|
|
160
|
+
}, g = (b, N, x) => {
|
|
161
161
|
const c = `calendar__${l === O.MONTH ? "month" : "day"}`;
|
|
162
|
-
|
|
163
|
-
},
|
|
162
|
+
x.calendarContainer && x.calendarContainer.classList.add(c);
|
|
163
|
+
}, C = (b, N, x) => {
|
|
164
164
|
if (l === O.MONTH && b.length > 0) {
|
|
165
|
-
const c = s.minDate, i = s.maxDate,
|
|
165
|
+
const c = s.minDate, i = s.maxDate, v = b[0].getFullYear(), k = x.calendarContainer, S = "flatpickr-disabled", y = k.querySelectorAll(
|
|
166
166
|
".flatpickr-monthSelect-month"
|
|
167
|
-
),
|
|
167
|
+
), w = k.querySelectorAll(
|
|
168
168
|
".flatpickr-next-month"
|
|
169
|
-
)[0],
|
|
169
|
+
)[0], D = k.querySelectorAll(
|
|
170
170
|
".flatpickr-prev-month"
|
|
171
171
|
)[0];
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
|
|
172
|
+
v === i.getFullYear() && w.classList.add(S), v === c.getFullYear() && D.classList.add(S), (v === c.getFullYear() || v === i.getFullYear()) && y.forEach((I) => {
|
|
173
|
+
I.classList.remove(S);
|
|
174
|
+
const E = new Date(I.getAttribute("aria-label")), L = E.getFullYear() === c.getFullYear() && E.getMonth() === c.getMonth(), Y = E.getFullYear() === i.getFullYear() && E.getMonth() === i.getMonth();
|
|
175
|
+
L || Y || (E < c || E > i) && I.classList.add(S);
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
setTimeout(() => {
|
|
179
|
-
const c =
|
|
179
|
+
const c = x.calendarContainer, i = x._input?.getBoundingClientRect();
|
|
180
180
|
c && (c.style.top = `${i.top - c.offsetHeight - 8}px`, c.style.width = `${c.style.width}px`, u ? (c.style.right = `${window.innerWidth - i.right - (m ? Ge : 0)}px`, c.style.left = "auto") : c.style.left = `${i.left}px`);
|
|
181
181
|
}, 0);
|
|
182
182
|
};
|
|
@@ -198,8 +198,8 @@ const ft = 24, pt = 24, q = 1e3, Ge = 24, gt = ({
|
|
|
198
198
|
onChange: (b) => {
|
|
199
199
|
t(b[0]);
|
|
200
200
|
},
|
|
201
|
-
onOpen: [
|
|
202
|
-
onReady: [
|
|
201
|
+
onOpen: [C],
|
|
202
|
+
onReady: [g],
|
|
203
203
|
id: a
|
|
204
204
|
}
|
|
205
205
|
)
|
|
@@ -215,13 +215,13 @@ const ft = 24, pt = 24, q = 1e3, Ge = 24, gt = ({
|
|
|
215
215
|
stopPropagation: u = !0
|
|
216
216
|
}) => {
|
|
217
217
|
const h = _(
|
|
218
|
-
(
|
|
219
|
-
u &&
|
|
218
|
+
(g) => {
|
|
219
|
+
u && g.stopPropagation();
|
|
220
220
|
},
|
|
221
221
|
[u]
|
|
222
222
|
), m = _(
|
|
223
|
-
(
|
|
224
|
-
u &&
|
|
223
|
+
(g) => {
|
|
224
|
+
u && g.stopPropagation(), l?.(t, g.target.checked);
|
|
225
225
|
},
|
|
226
226
|
[l, t, u]
|
|
227
227
|
), p = () => {
|
|
@@ -233,7 +233,7 @@ const ft = 24, pt = 24, q = 1e3, Ge = 24, gt = ({
|
|
|
233
233
|
{
|
|
234
234
|
htmlFor: t,
|
|
235
235
|
onClick: h,
|
|
236
|
-
className:
|
|
236
|
+
className: R(
|
|
237
237
|
"flex min-w-0 items-center py-1",
|
|
238
238
|
a ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
239
239
|
d
|
|
@@ -371,7 +371,7 @@ const ft = 24, pt = 24, q = 1e3, Ge = 24, gt = ({
|
|
|
371
371
|
onFocus: m,
|
|
372
372
|
onBlur: p
|
|
373
373
|
}) => {
|
|
374
|
-
const
|
|
374
|
+
const g = f(
|
|
375
375
|
"truncate outline-none shadow-none body-1",
|
|
376
376
|
s,
|
|
377
377
|
d ? "pointer-events-none" : ""
|
|
@@ -386,11 +386,11 @@ const ft = 24, pt = 24, q = 1e3, Ge = 24, gt = ({
|
|
|
386
386
|
value: e || "",
|
|
387
387
|
title: e ? String(e) : "",
|
|
388
388
|
disabled: a,
|
|
389
|
-
className:
|
|
389
|
+
className: g,
|
|
390
390
|
onKeyDown: h,
|
|
391
391
|
onFocus: m,
|
|
392
392
|
onBlur: p,
|
|
393
|
-
onChange: (
|
|
393
|
+
onChange: (C) => u?.(C.currentTarget.value)
|
|
394
394
|
}
|
|
395
395
|
);
|
|
396
396
|
}, Ct = ({
|
|
@@ -527,10 +527,10 @@ const $e = ({
|
|
|
527
527
|
dividers: h = !0,
|
|
528
528
|
closeButtonTitle: m
|
|
529
529
|
}) => {
|
|
530
|
-
const { refs: p, context:
|
|
530
|
+
const { refs: p, context: g } = X({
|
|
531
531
|
open: t !== A.Closed && !!t,
|
|
532
532
|
onOpenChange: l
|
|
533
|
-
}),
|
|
533
|
+
}), C = xe(g, { role: "dialog" }), b = Z(g, { outsidePress: !0 }), { getFloatingProps: N } = J([C, b]), x = _(
|
|
534
534
|
(c) => {
|
|
535
535
|
c?.preventDefault(), c?.stopPropagation(), l();
|
|
536
536
|
},
|
|
@@ -543,7 +543,7 @@ const $e = ({
|
|
|
543
543
|
"z-modal flex items-center justify-center bg-blackout p-4",
|
|
544
544
|
d
|
|
545
545
|
),
|
|
546
|
-
children: /* @__PURE__ */ r(Ce, { context:
|
|
546
|
+
children: /* @__PURE__ */ r(Ce, { context: g, children: /* @__PURE__ */ o(
|
|
547
547
|
"div",
|
|
548
548
|
{
|
|
549
549
|
className: f(
|
|
@@ -567,7 +567,7 @@ const $e = ({
|
|
|
567
567
|
te,
|
|
568
568
|
{
|
|
569
569
|
title: m,
|
|
570
|
-
onClick:
|
|
570
|
+
onClick: x,
|
|
571
571
|
btnClassNames: "sm:h-[24px] sm:w-[24px] sm:top-4"
|
|
572
572
|
}
|
|
573
573
|
)
|
|
@@ -588,13 +588,13 @@ const $e = ({
|
|
|
588
588
|
openedClassName: d,
|
|
589
589
|
onOptionSelect: u
|
|
590
590
|
}) => {
|
|
591
|
-
const [h, m] = j(!1), { refs: p, floatingStyles:
|
|
591
|
+
const [h, m] = j(!1), { refs: p, floatingStyles: g, context: C } = X({
|
|
592
592
|
open: h,
|
|
593
593
|
onOpenChange: l ? void 0 : m,
|
|
594
594
|
placement: "bottom-end",
|
|
595
595
|
middleware: [ye(8), we(), Ee()],
|
|
596
596
|
whileElementsMounted: ve
|
|
597
|
-
}), b = Se(
|
|
597
|
+
}), b = Se(C), N = Z(C, { outsidePress: !0 }), { getReferenceProps: x, getFloatingProps: c } = J([
|
|
598
598
|
b,
|
|
599
599
|
N
|
|
600
600
|
]);
|
|
@@ -603,7 +603,7 @@ const $e = ({
|
|
|
603
603
|
"div",
|
|
604
604
|
{
|
|
605
605
|
ref: p.setReference,
|
|
606
|
-
...
|
|
606
|
+
...x({
|
|
607
607
|
onClick(i) {
|
|
608
608
|
i.stopPropagation();
|
|
609
609
|
}
|
|
@@ -616,7 +616,7 @@ const $e = ({
|
|
|
616
616
|
"div",
|
|
617
617
|
{
|
|
618
618
|
ref: p.setFloating,
|
|
619
|
-
style:
|
|
619
|
+
style: g,
|
|
620
620
|
className: "dropdown-menu-shadow dropdown-container z-10 flex flex-col rounded bg-white",
|
|
621
621
|
...c(),
|
|
622
622
|
children: [
|
|
@@ -624,8 +624,8 @@ const $e = ({
|
|
|
624
624
|
t && t.map((i) => /* @__PURE__ */ r(
|
|
625
625
|
"div",
|
|
626
626
|
{
|
|
627
|
-
onClick: (
|
|
628
|
-
|
|
627
|
+
onClick: (v) => {
|
|
628
|
+
v.stopPropagation(), u?.(i.key), m(!1);
|
|
629
629
|
},
|
|
630
630
|
className: f(
|
|
631
631
|
"text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",
|
|
@@ -744,30 +744,30 @@ function Dt({
|
|
|
744
744
|
function Be() {
|
|
745
745
|
return V(re);
|
|
746
746
|
}
|
|
747
|
-
var
|
|
747
|
+
var T = /* @__PURE__ */ ((e) => (e.Info = "info", e.Error = "error", e.Warning = "warning", e))(T || {});
|
|
748
748
|
const We = {
|
|
749
|
-
[
|
|
750
|
-
[
|
|
751
|
-
[
|
|
749
|
+
[T.Info]: "border-neutrals-800 bg-neutrals-300 text-neutrals-1000",
|
|
750
|
+
[T.Error]: "border-semantic-error bg-semantic-error-light text-neutrals-1000",
|
|
751
|
+
[T.Warning]: "border-semantic-warning bg-semantic-warning-light text-neutrals-1000"
|
|
752
752
|
}, qe = "shrink-0", He = "min-w-0 body-2", Ue = "flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";
|
|
753
|
-
function
|
|
753
|
+
function Rt({
|
|
754
754
|
type: e,
|
|
755
755
|
icon: t,
|
|
756
756
|
children: n,
|
|
757
757
|
className: s,
|
|
758
758
|
contentClassName: l
|
|
759
759
|
}) {
|
|
760
|
-
const a = Be(), d = t ?? a?.icons?.[e], u = a?.classes?.container ?? Ue, h = a?.classes?.types?.[e] ?? We[e], m =
|
|
760
|
+
const a = Be(), d = t ?? a?.icons?.[e], u = a?.classes?.container ?? Ue, h = a?.classes?.types?.[e] ?? We[e], m = R(u, h, s), p = R(qe, a?.classes?.icon), g = R(
|
|
761
761
|
He,
|
|
762
762
|
a?.classes?.content,
|
|
763
763
|
l
|
|
764
764
|
);
|
|
765
765
|
return /* @__PURE__ */ o("div", { "data-type": e, className: m, children: [
|
|
766
766
|
d ? /* @__PURE__ */ r("span", { className: p, children: d }) : null,
|
|
767
|
-
n ? /* @__PURE__ */ r("div", { className:
|
|
767
|
+
n ? /* @__PURE__ */ r("div", { className: g, children: n }) : null
|
|
768
768
|
] });
|
|
769
769
|
}
|
|
770
|
-
const
|
|
770
|
+
const Lt = ({
|
|
771
771
|
title: e,
|
|
772
772
|
copiedTitle: t,
|
|
773
773
|
tooltip: n,
|
|
@@ -777,7 +777,7 @@ const Rt = ({
|
|
|
777
777
|
buttonTextClassName: d,
|
|
778
778
|
onClick: u
|
|
779
779
|
}) => {
|
|
780
|
-
const [h, m] = j(!1), p = B(null),
|
|
780
|
+
const [h, m] = j(!1), p = B(null), g = () => {
|
|
781
781
|
u(), m(!0), p.current && clearTimeout(p.current), p.current = setTimeout(() => {
|
|
782
782
|
m(!1);
|
|
783
783
|
}, 1e3);
|
|
@@ -791,12 +791,12 @@ const Rt = ({
|
|
|
791
791
|
title: h ? t : e,
|
|
792
792
|
isSmallButton: !0,
|
|
793
793
|
disabled: h,
|
|
794
|
-
buttonClassName:
|
|
794
|
+
buttonClassName: R([
|
|
795
795
|
"text-button-tertiary small-icon-button !h-6 !p-0",
|
|
796
796
|
a
|
|
797
797
|
]),
|
|
798
|
-
textClassName:
|
|
799
|
-
onClick:
|
|
798
|
+
textClassName: R(["ml-1", d]),
|
|
799
|
+
onClick: g,
|
|
800
800
|
iconBefore: h ? l : s
|
|
801
801
|
}
|
|
802
802
|
),
|
|
@@ -879,28 +879,28 @@ function Ke({
|
|
|
879
879
|
onToggleExpanded: d,
|
|
880
880
|
onToggleChecked: u
|
|
881
881
|
}) {
|
|
882
|
-
const h = !!t.items?.length, m = !!t.isExpanded, p = t.isDisabled ? !1 : t.draggable ?? !0,
|
|
882
|
+
const h = !!t.items?.length, m = !!t.isExpanded, p = t.isDisabled ? !1 : t.draggable ?? !0, g = t.isDisabled ? !1 : t.checkable ?? !0, C = se(e, t.id), {
|
|
883
883
|
attributes: b,
|
|
884
884
|
listeners: N,
|
|
885
|
-
setNodeRef:
|
|
885
|
+
setNodeRef: x,
|
|
886
886
|
setActivatorNodeRef: c,
|
|
887
887
|
transform: i,
|
|
888
|
-
transition:
|
|
889
|
-
isDragging:
|
|
890
|
-
} = Oe({ id:
|
|
891
|
-
transform:
|
|
892
|
-
transition:
|
|
893
|
-
opacity:
|
|
894
|
-
},
|
|
888
|
+
transition: v,
|
|
889
|
+
isDragging: k
|
|
890
|
+
} = Oe({ id: C, disabled: !p }), S = {
|
|
891
|
+
transform: Pe.Transform.toString(i),
|
|
892
|
+
transition: v,
|
|
893
|
+
opacity: k ? 0.6 : void 0
|
|
894
|
+
}, y = !!t.isDisabled, w = y || !g, D = [...e, t.id];
|
|
895
895
|
return /* @__PURE__ */ o(
|
|
896
896
|
"div",
|
|
897
897
|
{
|
|
898
|
-
ref:
|
|
899
|
-
style:
|
|
898
|
+
ref: x,
|
|
899
|
+
style: S,
|
|
900
900
|
className: f([
|
|
901
901
|
"group flex items-stretch overflow-hidden rounded bg-white",
|
|
902
902
|
"select-none",
|
|
903
|
-
|
|
903
|
+
y ? "opacity-50" : ""
|
|
904
904
|
]),
|
|
905
905
|
children: [
|
|
906
906
|
n ? /* @__PURE__ */ r(
|
|
@@ -908,7 +908,7 @@ function Ke({
|
|
|
908
908
|
{
|
|
909
909
|
className: f([
|
|
910
910
|
"group/drag-handle flex w-6 items-center justify-center rounded",
|
|
911
|
-
|
|
911
|
+
y ? "" : "hover:bg-neutrals-100 cursor-grab"
|
|
912
912
|
]),
|
|
913
913
|
children: /* @__PURE__ */ r(
|
|
914
914
|
"span",
|
|
@@ -937,31 +937,34 @@ function Ke({
|
|
|
937
937
|
"button",
|
|
938
938
|
{
|
|
939
939
|
type: "button",
|
|
940
|
-
disabled:
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
940
|
+
disabled: y,
|
|
941
|
+
"aria-disabled": w,
|
|
942
|
+
onClick: (I) => {
|
|
943
|
+
w || a?.({
|
|
944
|
+
itemId: t.id,
|
|
945
|
+
path: D,
|
|
946
|
+
nativeEvent: I
|
|
947
|
+
});
|
|
948
|
+
},
|
|
946
949
|
className: f([
|
|
947
950
|
"flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",
|
|
948
|
-
|
|
949
|
-
|
|
951
|
+
y ? "" : "hover:bg-neutrals-100",
|
|
952
|
+
y ? "" : "hover:text-blue-700",
|
|
950
953
|
"focus:outline-none"
|
|
951
954
|
]),
|
|
952
955
|
children: [
|
|
953
956
|
s ? /* @__PURE__ */ r(
|
|
954
957
|
ne,
|
|
955
958
|
{
|
|
956
|
-
id: `draggable-list-${
|
|
959
|
+
id: `draggable-list-${D.join("-")}`,
|
|
957
960
|
checked: !!t.isChecked,
|
|
958
|
-
disabled: !
|
|
961
|
+
disabled: !g,
|
|
959
962
|
className: "p-0",
|
|
960
963
|
stopPropagation: !0,
|
|
961
|
-
onChange: (
|
|
964
|
+
onChange: (I, E) => u?.({
|
|
962
965
|
itemId: t.id,
|
|
963
|
-
path:
|
|
964
|
-
nextChecked: !!
|
|
966
|
+
path: D,
|
|
967
|
+
nextChecked: !!E
|
|
965
968
|
})
|
|
966
969
|
}
|
|
967
970
|
) : null,
|
|
@@ -973,18 +976,18 @@ function Ke({
|
|
|
973
976
|
"button",
|
|
974
977
|
{
|
|
975
978
|
type: "button",
|
|
976
|
-
disabled:
|
|
977
|
-
onClick: (
|
|
978
|
-
|
|
979
|
+
disabled: y,
|
|
980
|
+
onClick: (I) => {
|
|
981
|
+
I.stopPropagation(), d?.({
|
|
979
982
|
itemId: t.id,
|
|
980
|
-
path:
|
|
983
|
+
path: D,
|
|
981
984
|
nextExpanded: !m
|
|
982
985
|
});
|
|
983
986
|
},
|
|
984
987
|
"aria-label": m ? "Collapse" : "Expand",
|
|
985
988
|
className: f([
|
|
986
989
|
"flex w-8 items-center justify-center rounded",
|
|
987
|
-
|
|
990
|
+
y ? "" : "hover:bg-neutrals-100",
|
|
988
991
|
"focus:outline-none"
|
|
989
992
|
]),
|
|
990
993
|
children: /* @__PURE__ */ r(
|
|
@@ -1016,41 +1019,41 @@ function Ft({
|
|
|
1016
1019
|
}) {
|
|
1017
1020
|
const h = Ie(
|
|
1018
1021
|
ke(De, { activationConstraint: { distance: 6 } })
|
|
1019
|
-
), [m, p] = oe.useState(null),
|
|
1020
|
-
const
|
|
1022
|
+
), [m, p] = oe.useState(null), g = (N) => {
|
|
1023
|
+
const x = String(N.active.id), c = G(x);
|
|
1021
1024
|
if (!c) return;
|
|
1022
1025
|
const i = Qe(e, c.parentPath, c.itemId);
|
|
1023
1026
|
!i || i.type !== "item" || p({
|
|
1024
|
-
id:
|
|
1027
|
+
id: x,
|
|
1025
1028
|
label: i.label,
|
|
1026
1029
|
hasChildren: !!i.items?.length,
|
|
1027
1030
|
isChecked: i.isChecked,
|
|
1028
1031
|
isExpanded: i.isExpanded
|
|
1029
1032
|
});
|
|
1030
|
-
},
|
|
1033
|
+
}, C = (N) => {
|
|
1031
1034
|
p(null);
|
|
1032
|
-
const
|
|
1033
|
-
if (!
|
|
1034
|
-
const c = G(String(N.active.id)), i = G(String(
|
|
1035
|
+
const x = N.over;
|
|
1036
|
+
if (!x) return;
|
|
1037
|
+
const c = G(String(N.active.id)), i = G(String(x.id));
|
|
1035
1038
|
if (!c || !i || c.parentPath.join("/") !== i.parentPath.join("/")) return;
|
|
1036
|
-
const
|
|
1037
|
-
if (!
|
|
1038
|
-
const
|
|
1039
|
-
if (
|
|
1040
|
-
const
|
|
1041
|
-
const
|
|
1042
|
-
(
|
|
1043
|
-
),
|
|
1044
|
-
let
|
|
1045
|
-
return
|
|
1046
|
-
if (
|
|
1047
|
-
const Y =
|
|
1048
|
-
return
|
|
1039
|
+
const v = ae(e, c.parentPath);
|
|
1040
|
+
if (!v) return;
|
|
1041
|
+
const k = v.findIndex((w) => w.id === c.itemId), S = v.findIndex((w) => w.id === i.itemId);
|
|
1042
|
+
if (k === -1 || S === -1 || k === S) return;
|
|
1043
|
+
const y = ie(e, c.parentPath, (w) => {
|
|
1044
|
+
const D = w.filter(
|
|
1045
|
+
(L) => L.type === "item"
|
|
1046
|
+
), I = Te(D, k, S);
|
|
1047
|
+
let E = 0;
|
|
1048
|
+
return w.map((L) => {
|
|
1049
|
+
if (L.type !== "item") return L;
|
|
1050
|
+
const Y = I[E];
|
|
1051
|
+
return E += 1, Y;
|
|
1049
1052
|
});
|
|
1050
1053
|
});
|
|
1051
|
-
s(
|
|
1052
|
-
}, b = (N,
|
|
1053
|
-
const c = N.filter((i) => i.type === "item").map((i) => se(
|
|
1054
|
+
s(y);
|
|
1055
|
+
}, b = (N, x = []) => {
|
|
1056
|
+
const c = N.filter((i) => i.type === "item").map((i) => se(x, i.id));
|
|
1054
1057
|
return /* @__PURE__ */ r(
|
|
1055
1058
|
Ae,
|
|
1056
1059
|
{
|
|
@@ -1065,7 +1068,7 @@ function Ft({
|
|
|
1065
1068
|
/* @__PURE__ */ r(fe, { size: 12, className: "shrink-0" }),
|
|
1066
1069
|
i.label
|
|
1067
1070
|
] }),
|
|
1068
|
-
/* @__PURE__ */ r("div", { className: "border-l border-neutrals-600 pl-2", children: b(i.items, [...
|
|
1071
|
+
/* @__PURE__ */ r("div", { className: "border-l border-neutrals-600 pl-2", children: b(i.items, [...x, i.id]) })
|
|
1069
1072
|
]
|
|
1070
1073
|
},
|
|
1071
1074
|
i.id
|
|
@@ -1073,7 +1076,7 @@ function Ft({
|
|
|
1073
1076
|
/* @__PURE__ */ r(
|
|
1074
1077
|
Ke,
|
|
1075
1078
|
{
|
|
1076
|
-
parentPath:
|
|
1079
|
+
parentPath: x,
|
|
1077
1080
|
item: i,
|
|
1078
1081
|
showDragHandle: t,
|
|
1079
1082
|
showCheckbox: n,
|
|
@@ -1083,18 +1086,18 @@ function Ft({
|
|
|
1083
1086
|
onToggleChecked: a
|
|
1084
1087
|
}
|
|
1085
1088
|
),
|
|
1086
|
-
i.items?.length && i.isExpanded ? /* @__PURE__ */ r("div", { className: "pl-7", children: b(i.items, [...
|
|
1089
|
+
i.items?.length && i.isExpanded ? /* @__PURE__ */ r("div", { className: "pl-7", children: b(i.items, [...x, i.id]) }) : null
|
|
1087
1090
|
] }, i.id)) })
|
|
1088
1091
|
}
|
|
1089
1092
|
);
|
|
1090
1093
|
};
|
|
1091
1094
|
return /* @__PURE__ */ o(
|
|
1092
|
-
|
|
1095
|
+
Re,
|
|
1093
1096
|
{
|
|
1094
1097
|
sensors: h,
|
|
1095
|
-
collisionDetection:
|
|
1096
|
-
onDragStart:
|
|
1097
|
-
onDragEnd:
|
|
1098
|
+
collisionDetection: Le,
|
|
1099
|
+
onDragStart: g,
|
|
1100
|
+
onDragEnd: C,
|
|
1098
1101
|
children: [
|
|
1099
1102
|
/* @__PURE__ */ r("div", { className: "flex flex-col", children: b(e) }),
|
|
1100
1103
|
/* @__PURE__ */ r(Fe, { children: m ? /* @__PURE__ */ r(
|
|
@@ -1143,7 +1146,7 @@ function Ze(e, t, n) {
|
|
|
1143
1146
|
const s = n.match(e, t);
|
|
1144
1147
|
if (e.type === "group") {
|
|
1145
1148
|
if (s && n.includeGroupDescendantsOnMatch)
|
|
1146
|
-
return
|
|
1149
|
+
return P(e, n.expandMatchedBranches);
|
|
1147
1150
|
const d = e.items?.length ? $(e.items, t, n) : null;
|
|
1148
1151
|
return !s && !d ? null : {
|
|
1149
1152
|
...e,
|
|
@@ -1152,7 +1155,7 @@ function Ze(e, t, n) {
|
|
|
1152
1155
|
}
|
|
1153
1156
|
const l = e.items?.length ? $(e.items, t, n) : null;
|
|
1154
1157
|
if (s && n.includeItemDescendantsOnMatch)
|
|
1155
|
-
return
|
|
1158
|
+
return P(e, n.expandMatchedBranches);
|
|
1156
1159
|
if (!s && !l)
|
|
1157
1160
|
return null;
|
|
1158
1161
|
const a = {
|
|
@@ -1160,16 +1163,16 @@ function Ze(e, t, n) {
|
|
|
1160
1163
|
};
|
|
1161
1164
|
return l ? (a.items = l, n.expandMatchedBranches && (a.isExpanded = !0)) : delete a.items, a;
|
|
1162
1165
|
}
|
|
1163
|
-
function
|
|
1166
|
+
function P(e, t) {
|
|
1164
1167
|
return e.type === "group" ? {
|
|
1165
1168
|
...e,
|
|
1166
1169
|
items: e.items.map(
|
|
1167
|
-
(n) =>
|
|
1170
|
+
(n) => P(n, t)
|
|
1168
1171
|
)
|
|
1169
1172
|
} : {
|
|
1170
1173
|
...e,
|
|
1171
1174
|
isExpanded: t && e.items?.length ? !0 : e.isExpanded,
|
|
1172
|
-
items: e.items?.map((n) =>
|
|
1175
|
+
items: e.items?.map((n) => P(n, t))
|
|
1173
1176
|
};
|
|
1174
1177
|
}
|
|
1175
1178
|
function Je(e) {
|
|
@@ -1202,15 +1205,15 @@ export {
|
|
|
1202
1205
|
ne as Checkbox,
|
|
1203
1206
|
te as CloseButton,
|
|
1204
1207
|
xt as CollapsibleBlock,
|
|
1205
|
-
|
|
1208
|
+
Lt as CopyButton,
|
|
1206
1209
|
It as DownloadFormatMessage,
|
|
1207
1210
|
Ft as DraggableList,
|
|
1208
1211
|
St as Dropdown,
|
|
1209
1212
|
bt as HighlightText,
|
|
1210
1213
|
Nt as IconButton,
|
|
1211
|
-
|
|
1214
|
+
Rt as InlineAlert,
|
|
1212
1215
|
Dt as InlineAlertProvider,
|
|
1213
|
-
|
|
1216
|
+
T as InlineAlertType,
|
|
1214
1217
|
ze as Input,
|
|
1215
1218
|
Ct as InputWithIcon,
|
|
1216
1219
|
et as KeyboardKey,
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/statgpt-ui-components",
|
|
3
|
-
"version": "0.4.0-rc.
|
|
3
|
+
"version": "0.4.0-rc.23",
|
|
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.
|
|
8
|
+
"@epam/statgpt-shared-toolkit": "0.4.0-rc.23",
|
|
9
9
|
"@tabler/icons-react": "^3.34.1",
|
|
10
10
|
"@floating-ui/react": "^0.27.14",
|
|
11
11
|
"tailwind-merge": "^3.4.0",
|