@epam/statgpt-ui-components 0.7.0-dev.20 → 0.7.0-dev.21
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/components/CopyButton/CopyButton.d.ts +1 -1
- package/components/DraggableList/DraggableList.d.ts +1 -1
- package/components/DraggableList/DraggableListOverlay.d.ts +1 -1
- package/components/DraggableList/DraggableListRow.d.ts +1 -1
- package/components/InlineAlert/InlineAlert.d.ts +2 -2
- package/components/InlineAlert/InlineAlertContext.d.ts +1 -1
- package/components/Loader/Loader.d.ts +1 -1
- package/contexts/AgentAvailabilityContext.d.ts +2 -2
- package/index.js +1 -1
- package/index.mjs +895 -1277
- package/package.json +2 -2
- package/LICENSE +0 -21
- /package/{styles-tailwind.scss → src/scss/styles-tailwind.scss} +0 -0
|
@@ -41,5 +41,5 @@ interface CopyButtonProps {
|
|
|
41
41
|
* @param className - Additional classes applied to the button.
|
|
42
42
|
* @param buttonTextClassName - Additional classes for the button text.
|
|
43
43
|
*/
|
|
44
|
-
export declare const CopyButton: ({ title, copiedTitle, tooltip, hoverTooltip, icon, copiedIcon, className, buttonTextClassName, onClick, }: CopyButtonProps) => import("react
|
|
44
|
+
export declare const CopyButton: ({ title, copiedTitle, tooltip, hoverTooltip, icon, copiedIcon, className, buttonTextClassName, onClick, }: CopyButtonProps) => import("react").JSX.Element;
|
|
45
45
|
export {};
|
|
@@ -64,4 +64,4 @@ export interface DraggableListProps {
|
|
|
64
64
|
* @param onItemClick - Called when the main item row is clicked.
|
|
65
65
|
* @param renderLabel - Optional custom renderer for item labels.
|
|
66
66
|
*/
|
|
67
|
-
export declare function DraggableList({ items, showDragHandle, showCheckbox, onItemsChange, onToggleExpanded, onToggleChecked, onItemClick, renderLabel, }: DraggableListProps):
|
|
67
|
+
export declare function DraggableList({ items, showDragHandle, showCheckbox, onItemsChange, onToggleExpanded, onToggleChecked, onItemClick, renderLabel, }: DraggableListProps): React.JSX.Element;
|
|
@@ -9,4 +9,4 @@ export declare function DraggableListRow({ parentPath, item, showDragHandle, sho
|
|
|
9
9
|
onItemClick?: (e: ItemClickEvent) => void;
|
|
10
10
|
onToggleExpanded?: (e: ToggleExpandedEvent) => void;
|
|
11
11
|
onToggleChecked?: (e: ToggleCheckedEvent) => void;
|
|
12
|
-
}): import("react
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
2
|
import { InlineAlertType } from './types';
|
|
3
3
|
export interface InlineAlertProps {
|
|
4
4
|
type: InlineAlertType;
|
|
@@ -52,4 +52,4 @@ export interface InlineAlertProps {
|
|
|
52
52
|
* @param className - Additional classes applied to the root container.
|
|
53
53
|
* @param contentClassName - Additional classes applied to the content wrapper.
|
|
54
54
|
*/
|
|
55
|
-
export declare function InlineAlert({ type, icon, children, className, contentClassName, }: InlineAlertProps):
|
|
55
|
+
export declare function InlineAlert({ type, icon, children, className, contentClassName, }: InlineAlertProps): React.JSX.Element;
|
|
@@ -4,5 +4,5 @@ export interface InlineAlertProviderProps {
|
|
|
4
4
|
value?: InlineAlertConfig;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare function InlineAlertProvider({ value, children, }: InlineAlertProviderProps): import("react
|
|
7
|
+
export declare function InlineAlertProvider({ value, children, }: InlineAlertProviderProps): import("react").JSX.Element;
|
|
8
8
|
export declare function useInlineAlertConfig(): InlineAlertConfig | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const Loader: () => import("react
|
|
1
|
+
export declare const Loader: () => import("react").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
2
|
export interface AgentAvailabilityContextValue {
|
|
3
3
|
isAgentAvailable: boolean;
|
|
4
4
|
}
|
|
5
5
|
export declare function AgentAvailabilityProvider({ children, isAgentAvailable, }: {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
isAgentAvailable: boolean;
|
|
8
|
-
}):
|
|
8
|
+
}): React.JSX.Element;
|
|
9
9
|
export declare function useAgentAvailability(): AgentAvailabilityContextValue;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("react"),p=require("classnames"),k=require("@tabler/icons-react"),ie=require("tailwind-merge"),oe=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),C=require("@floating-ui/react"),M=require("@dnd-kit/core"),Y=require("@dnd-kit/sortable"),ce=require("@dnd-kit/utilities");function de(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const ue=de(m),U=({title:e,btnClassNames:n,iconWidth:s,iconHeight:r,onClick:l})=>t.jsx("button",{type:"button","aria-label":"button",className:n,title:e,onClick:l,children:t.jsx(k.IconX,{height:r||20,width:s||20})});var O=(e=>(e.INFO="info",e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(O||{});const xe=3e4,fe=({alertDetails:e,infoIcon:n,successIcon:s,errorIcon:r,onClose:l,closeButtonTitle:a,children:i})=>{const u=e?.type,x=u===O.IN_PROGRESS||u===O.INFO,o=()=>x?"alert-in-progress":u===O.SUCCESS?"alert-success":"alert-error",f=x?n:u===O.SUCCESS?s:u===O.ERROR?r:null,h=e?.text;return m.useEffect(()=>{if(!e||x)return;const w=setTimeout(()=>{l?.()},xe);return()=>clearTimeout(w)},[e,x,l]),t.jsx("div",{className:p("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",o()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[f&&t.jsx("div",{className:"alert-icon",children:f}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx("h3",{className:"alert-title truncate",children:e?.title}),i??(h&&t.jsx("div",{className:"alert-text whitespace-pre-line break-words",title:h,children:h}))]}),t.jsx(U,{title:a,onClick:l})]})})},K=()=>t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx("div",{className:"loader"})}),me=ie.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function L(...e){return me(p(...e))}const Q=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:l,iconAfter:a,iconBefore:i,onClick:u,isSmallButton:x})=>{const o=L([x?"font-semibold":"",a?"mr-2":"",i?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:p("base-button",e,x?"small-button":""),disabled:l||s,"aria-label":"button",onClick:f=>u?.(f),title:r,children:[i,s&&t.jsx(K,{}),r?x?t.jsx("h4",{className:o,children:r}):t.jsx("h3",{className:o,children:r}):null,a]})};function Z(e=719){const[n,s]=m.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return m.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e}px)`),l=a=>{s(a.matches)};return s(r.matches),r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[e]),n}function he(e,n){const s=m.useRef(null);return m.useCallback((...l)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...l)},n)},[e,n])}const pe=24,ge=24,W=1e3,X=24,be=({label:e,onChange:n,value:s,options:r,calendarResolution:l=P.CalendarResolution.DAY,id:a,icon:i,isEndDate:u})=>{const x=m.useRef(null),o=Z();m.useEffect(()=>{const j=x?.current;j&&j.querySelector("input")?.setAttribute("aria-label",e)},[e]);const f={...r,disableMobile:!0,defaultDate:l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},h=(j,N,b)=>{const d=`calendar__${l===P.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(d)},w=(j,N,b)=>{if(l===P.CalendarResolution.MONTH&&j.length>0){const d=r.minDate,c=r.maxDate,g=j[0].getFullYear(),v=b.calendarContainer,S="flatpickr-disabled",y=v.querySelectorAll(".flatpickr-monthSelect-month"),E=v.querySelectorAll(".flatpickr-next-month")[0],R=v.querySelectorAll(".flatpickr-prev-month")[0];g===c.getFullYear()&&E.classList.add(S),g===d.getFullYear()&&R.classList.add(S),(g===d.getFullYear()||g===c.getFullYear())&&y.forEach(D=>{D.classList.remove(S);const I=new Date(D.getAttribute("aria-label")),_=I.getFullYear()===d.getFullYear()&&I.getMonth()===d.getMonth(),z=I.getFullYear()===c.getFullYear()&&I.getMonth()===c.getMonth();_||z||(I<d||I>c)&&D.classList.add(S)})}setTimeout(()=>{const d=b.calendarContainer,c=b._input?.getBoundingClientRect();d&&(d.style.top=`${c.top-d.offsetHeight-8}px`,d.style.width=`${d.style.width}px`,u?(d.style.right=`${window.innerWidth-c.right-(o?X:0)}px`,d.style.left="auto"):d.style.left=`${c.left}px`)},0)};return t.jsxs("div",{className:"calendar relative",ref:x,children:[t.jsx("div",{className:"calendar-title mb-1",children:e}),t.jsx("label",{htmlFor:a,className:"absolute right-[11px] top-[29px] cursor-pointer",children:i||t.jsx(k.IconCalendarEvent,{})}),t.jsx(oe,{defaultValue:(l===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:f,onChange:j=>{n(j[0])},onOpen:[w],onReady:[h],id:a})]})},V=({label:e,id:n,checked:s,indeterminate:r=!1,checkboxIcon:l,onChange:a,disabled:i=!1,disabledScope:u="full",className:x,stopPropagation:o=!0})=>{const f=m.useRef(null);m.useEffect(()=>{f.current&&(f.current.indeterminate=!s&&r)},[s,r]);const h=m.useCallback(N=>{o&&N.stopPropagation()},[o]),w=m.useCallback(N=>{o&&N.stopPropagation(),a?.(n,N.target.checked)},[a,n,o]),j=()=>{if(s)return l||t.jsx(k.IconSquareCheckFilled,{className:"absolute size-4"});if(r)return t.jsx(k.IconSquareMinusFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:h,className:L("flex min-w-0 items-center py-1 shrink-0",i?"cursor-not-allowed":"cursor-pointer",i&&u==="full"&&"opacity-50",x),children:[t.jsx("span",{className:p("checkbox-button relative flex size-[14px] items-center justify-center",i&&u==="icon"&&"opacity-50"),"aria-hidden":!0,children:j()}),e?t.jsx("p",{className:p("checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"),title:e,children:e}):null,t.jsx("input",{ref:f,id:n,type:"checkbox",checked:s,disabled:i,onChange:w,className:"hidden"})]})},je=({title:e,icon:n,children:s,value:r})=>{const[l,a]=m.useState(!1);return t.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${l?"collapsible-block-open":""}`,children:[t.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>a(!l),children:[t.jsx("div",{className:`${l?"rotate-180":""} transition-transform`,children:n||t.jsx(k.IconChevronDown,{className:"mr-3 size-5"})}),t.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[t.jsx("span",{children:e}),r&&t.jsx("p",{className:"body-1 text-neutrals-800",children:r})]})]}),l&&t.jsx("div",{className:"collapsible-block-content pb-4",children:s})]})},Ne=({text:e,highlightText:n})=>{const s=m.useMemo(()=>{const r=[];if(!n)return[{id:0,text:e,highlight:!1}];const l=n?.toLowerCase()||"",a=e?.toLowerCase()?.split(l)||"";for(let i=0,u=0;i<a?.length;i++){const x=a?.[i],o=x.length;x!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(u,u+o)}),u+=o,i!==a?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(u,u+n.length)}),u+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:p(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},we=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:l,isBaseIconStyles:a=!0})=>t.jsx("button",{type:"button",className:p(a&&"base-icon-button",s),onClick:i=>n?.(i),disabled:r,title:l,"aria-label":"button",children:e}),J=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:l="text",disabled:a,readonly:i,onChange:u,onKeyDown:x,onFocus:o,onBlur:f})=>{const h=p("truncate outline-none shadow-none body-1",r,i?"pointer-events-none":"");return t.jsx("input",{type:l,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:a,className:h,onKeyDown:x,onFocus:o,onBlur:f,onChange:w=>u?.(w.currentTarget.value)})},Ce=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...l})=>t.jsxs("div",{className:p("input w-full flex flex-row",s),children:[e,t.jsx(J,{cssClass:p("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...l}),n]}),ve=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:l})=>{const a=p(l?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:p("base-link",s),title:n,children:[r,t.jsx("span",{className:a,children:n}),l]})},ye=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:p("tag flex items-center justify-center","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"),disabled:s,onClick:()=>r?.(n||e),"aria-label":"button",children:t.jsx("h4",{children:e})}),Ee=({label:e,id:n,checked:s,radioIcon:r,description:l,onChange:a})=>{const i=m.useCallback(u=>{u.stopPropagation(),a?.(n,u.target.checked)},[a,n]);return t.jsxs("label",{className:"flex min-w-0 cursor-pointer flex-col py-[6px]",htmlFor:n,children:[t.jsxs("p",{className:"radio-label flex min-w-0 items-center",children:[t.jsx("span",{className:p("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",s?"radio-button-active":""),children:s&&r}),e&&t.jsx("span",{className:"radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000",title:e,children:e})]}),l&&t.jsx("span",{className:"radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",title:l,children:l}),t.jsx("input",{type:"radio",onChange:i,id:n,checked:s,className:"hidden"})]})};var F=(e=>(e.Closed="Closed",e.Opened="Opened",e))(F||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const Ie=({portalId:e,state:n=F.Opened,heading:s,size:r,onClose:l,children:a,overlayClassName:i,containerClassName:u,dividers:x=!0,closeButtonTitle:o})=>{const{refs:f,context:h}=C.useFloating({open:n!==F.Closed&&!!n,onOpenChange:l}),w=C.useRole(h,{role:"dialog"}),j=C.useDismiss(h,{outsidePress:!0}),{getFloatingProps:N}=C.useInteractions([w,j]),b=m.useCallback(d=>{d?.preventDefault(),d?.stopPropagation(),l()},[l]);return t.jsx(C.FloatingPortal,{id:e,children:n!==F.Closed&&t.jsx(C.FloatingOverlay,{className:p("z-modal flex items-center justify-center bg-blackout p-4",i),children:t.jsx(C.FloatingFocusManager,{context:h,children:t.jsxs("div",{className:p("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",r===q.LG&&"max-w-[65%]",r===q.SM&&"max-w-[30%]",x&&"divide-neutrals-400 divide-y",u,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:f.setFloating,...N({onClick(d){d.stopPropagation()}}),children:[t.jsxs("div",{className:"modal-heading flex flex-row items-center justify-between px-6 py-5 sm:p-0 sm:pb-2",children:[s&&(typeof s=="string"?t.jsx("h2",{className:"modal-heading-title sm:h3 mr-3 min-w-0 flex-1",children:s}):s),t.jsx(U,{title:o,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),a.map(d=>d)]})})})})},Se=e=>e.state===F.Closed?null:t.jsx(Ie,{...e}),G="statgpt-dropdown-open",A=8,De={name:"keepDropdownWithinViewport",fn({y:e,rects:n}){if(typeof window>"u")return{};const s=document.documentElement.clientHeight||window.innerHeight,r=Math.min(n.floating.height,Math.max(0,s-A*2)),l=A,a=s-r-A;return{y:Math.min(Math.max(e,l),Math.max(l,a))}}},ke=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:l,containerClassName:a,openedClassName:i,onOptionSelect:u})=>{const x=m.useId(),[o,f]=m.useState(!1),{refs:h,floatingStyles:w,context:j}=C.useFloating({open:o,onOpenChange:l?void 0:f,placement:"bottom-end",strategy:"fixed",middleware:[C.offset(A),C.flip({padding:A}),C.size({padding:A,apply({availableHeight:g,elements:v}){v.floating.style.maxHeight=`${Math.max(0,g)}px`}}),C.shift({padding:A}),De],whileElementsMounted:C.autoUpdate}),N=C.useClick(j),b=C.useDismiss(j,{outsidePress:!0}),{getReferenceProps:d,getFloatingProps:c}=C.useInteractions([N,b]);return m.useEffect(()=>{o&&window.dispatchEvent(new CustomEvent(G,{detail:x}))},[x,o]),m.useEffect(()=>{const g=v=>{v instanceof CustomEvent&&v.detail!==x&&f(!1)};return window.addEventListener(G,g),()=>{window.removeEventListener(G,g)}},[x]),m.useEffect(()=>{l&&f(!1)},[l]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:h.setReference,...d({onClick(g){g.stopPropagation()}}),className:p(a,o&&i),children:e}),o&&t.jsx(C.FloatingPortal,{children:t.jsxs("div",{ref:h.setFloating,style:{...w,overflowY:"auto"},className:"dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",...c(),children:[s&&s,n&&n.map(g=>t.jsx("div",{onClick:v=>{v.stopPropagation(),u?.(g.key),f(!1)},className:p("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===g.key&&"bg-hues-100"),children:t.jsxs("div",{className:"dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",title:g.title,children:[g.icon?g.icon:null,t.jsx("p",{children:g?.title})]})},g.key))]})})]})},Re=({limitMessages:e,query:n})=>t.jsxs("div",{className:"flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1",children:[t.jsx("div",{className:"flex gap-x-[4px]",children:t.jsx("div",{className:"flex flex-col",children:t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:"h5 text-primary",children:[e?.excelFormatTitle," "]}),t.jsx("span",{className:"body-3 text-neutrals-800",children:e?.excelFormatText})]})})}),t.jsx("a",{href:n,target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),Oe=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:l})=>t.jsxs("div",{className:p("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",e?.containerClassName),children:[t.jsxs("div",{className:"flex items-center gap-x-2",children:[t.jsx("span",{children:e?.warningIcon}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:p("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:p("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(W):e?.showingLimit?.(W)})]}),n&&t.jsx("span",{className:p("text-neutrals-800 body-3",e?.limitMessageClassName),children:e?.fullLimitMessage})]})]}),s&&t.jsxs("span",{onClick:()=>r?.(),className:"h4 flex cursor-pointer items-center gap-x-[4px] text-primary",children:[e?.editIcon,e?.refineInAdvancedView]}),n&&t.jsx("a",{href:l||"",target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),ee=m.createContext(null);function Ae({value:e,children:n}){const s=m.useMemo(()=>e??{},[e]);return t.jsx(ee.Provider,{value:s,children:n})}function Le(){return m.useContext(ee)}var T=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e.Note="note",e))(T||{});const _e={[T.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[T.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[T.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000",[T.Note]:"border-hues-900 bg-neutrals-200 text-neutrals-1000"},Me="shrink-0",Te="min-w-0 body-2",Fe="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function Pe({type:e,icon:n,children:s,className:r,contentClassName:l}){const a=Le(),i=n??a?.icons?.[e],u=a?.classes?.container??Fe,x=a?.classes?.types?.[e]??_e[e],o=L(u,x,r),f=L(Me,a?.classes?.icon),h=L(Te,a?.classes?.content,l);return t.jsxs("div",{"data-type":e,className:o,children:[i?t.jsx("span",{className:f,children:i}):null,s?t.jsx("div",{className:h,children:s}):null]})}const Ye=({title:e,copiedTitle:n,tooltip:s,hoverTooltip:r,icon:l,copiedIcon:a,className:i,buttonTextClassName:u,onClick:x})=>{const[o,f]=m.useState(!1),h=m.useRef(null),w=()=>{x(),f(!0),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{f(!1)},1e3)};return m.useEffect(()=>()=>{h.current&&clearTimeout(h.current)},[]),t.jsxs("div",{className:"relative w-fit",title:r,children:[t.jsx(Q,{title:o?n:e,isSmallButton:!0,disabled:o,buttonClassName:L(["text-button-tertiary small-icon-button !h-6 !p-0",i]),textClassName:L(["ml-1",u]),onClick:w,iconBefore:o?a:l}),s&&o&&t.jsx("div",{className:"h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow",children:s})]})};function qe({id:e,label:n,hasChildren:s,showDragHandle:r,showCheckbox:l,isChecked:a,isExpanded:i}){return t.jsxs("div",{className:"relative cursor-grabbing rounded bg-neutrals-200 shadow",children:[t.jsx("div",{className:"absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light"}),t.jsxs("div",{className:"flex items-stretch overflow-hidden rounded",children:[r?t.jsx("div",{className:"flex w-6 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:"rounded p-1",children:t.jsx(k.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[l?t.jsx(V,{id:e,checked:!!a,className:"p-0"}):null,t.jsx("span",{className:"body-3 truncate",children:n})]}),s?t.jsx("div",{className:"flex w-8 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:p("transition-transform",i?"rotate-90":"rotate-0"),children:t.jsx(k.IconChevronRight,{size:16})})}):null]})]})}function te(e,n){return`i:${[...e,n].join("/")}`}function H(e){if(!e.startsWith("i:"))return null;const s=e.slice(2).split("/").filter(Boolean);return s.length?{parentPath:s.slice(0,-1),itemId:s[s.length-1]}:null}function Be(e,n,s){const r=se(e,n);return r?r.find(l=>l.id===s)??null:null}function ne(e,n){if(n.length===0)return e;const[s,...r]=n,l=e.find(a=>a.id===s);return l?.items?ne(l.items,r):null}function se(e,n){const s=ne(e,n);return s?s.filter(r=>r.type==="item"):null}function re(e,n,s){if(n.length===0)return s(e);const[r,...l]=n;return e.map(a=>a.id!==r||!a.items?a:{...a,items:re(a.items,l,s)})}function ze({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:l,onItemClick:a,onToggleExpanded:i,onToggleChecked:u}){const x=!!n.items?.length,o=!!n.isExpanded,f=n.isDisabled?!1:n.draggable??!0,h=n.isDisabled?!1:n.checkable??!0,w=te(e,n.id),{attributes:j,listeners:N,setNodeRef:b,setActivatorNodeRef:d,transform:c,transition:g,isDragging:v}=Y.useSortable({id:w,disabled:!f}),S={transform:ce.CSS.Transform.toString(c),transition:g,opacity:v?.6:void 0},y=!!n.isDisabled,E=y||!h,R=[...e,n.id];return t.jsxs("div",{ref:b,style:S,className:p(["group flex items-stretch overflow-hidden rounded bg-white","select-none",y?"opacity-50":""]),children:[s?t.jsx("div",{className:p(["group/drag-handle flex w-6 items-center justify-center rounded",y?"":"hover:bg-neutrals-100 cursor-grab"]),children:t.jsx("span",{ref:d,"aria-hidden":!0,className:p(["rounded p-1",f?"cursor-grab":"cursor-default","transition-opacity"]),...f?N:{},...f?j:{},children:t.jsx(k.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:y,"aria-disabled":E,onClick:D=>{E||a?.({itemId:n.id,path:R,nativeEvent:D})},className:p(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",y?"":"hover:bg-neutrals-100",y?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(V,{id:`draggable-list-${R.join("-")}`,checked:!!n.isChecked,disabled:!h,className:"p-0",stopPropagation:!0,onChange:(D,I)=>u?.({itemId:n.id,path:R,nextChecked:!!I})}):null,t.jsx("span",{className:"body-3 w-full truncate text-neutrals-800",children:l?l(n):n.label})]}),x?t.jsx("button",{type:"button",disabled:y,onClick:D=>{D.stopPropagation(),i?.({itemId:n.id,path:R,nextExpanded:!o})},"aria-label":o?"Collapse":"Expand",className:p(["flex w-8 items-center justify-center rounded",y?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:p("transition-transform duration-150 ease-out",o?"rotate-90":"rotate-0"),children:t.jsx(k.IconChevronRight,{size:16})})}):null]})}function Ge({items:e,showDragHandle:n=!0,showCheckbox:s=!0,onItemsChange:r,onToggleExpanded:l,onToggleChecked:a,onItemClick:i,renderLabel:u}){const x=M.useSensors(M.useSensor(M.PointerSensor,{activationConstraint:{distance:6}})),[o,f]=ue.useState(null),h=N=>{const b=String(N.active.id),d=H(b);if(!d)return;const c=Be(e,d.parentPath,d.itemId);!c||c.type!=="item"||f({id:b,label:c.label,hasChildren:!!c.items?.length,isChecked:c.isChecked,isExpanded:c.isExpanded})},w=N=>{f(null);const b=N.over;if(!b)return;const d=H(String(N.active.id)),c=H(String(b.id));if(!d||!c||d.parentPath.join("/")!==c.parentPath.join("/"))return;const g=se(e,d.parentPath);if(!g)return;const v=g.findIndex(E=>E.id===d.itemId),S=g.findIndex(E=>E.id===c.itemId);if(v===-1||S===-1||v===S)return;const y=re(e,d.parentPath,E=>{const R=E.filter(_=>_.type==="item"),D=Y.arrayMove(R,v,S);let I=0;return E.map(_=>{if(_.type!=="item")return _;const z=D[I];return I+=1,z})});r(y)},j=(N,b=[])=>{const d=N.filter(c=>c.type==="item").map(c=>te(b,c.id));return t.jsx(Y.SortableContext,{items:d,strategy:Y.verticalListSortingStrategy,children:t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:N.map(c=>c.type==="group"?t.jsxs("li",{className:"m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",children:[t.jsxs("div",{className:"h5 flex items-center gap-2 py-1 text-neutrals-1000",children:[t.jsx(k.IconDatabase,{size:12,className:"shrink-0"}),c.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:j(c.items,[...b,c.id])})]},c.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(ze,{parentPath:b,item:c,showDragHandle:n,showCheckbox:s,renderLabel:u,onItemClick:i,onToggleExpanded:l,onToggleChecked:a}),c.items?.length&&c.isExpanded?t.jsx("div",{className:"pl-7",children:j(c.items,[...b,c.id])}):null]},c.id))})})};return t.jsxs(M.DndContext,{sensors:x,collisionDetection:M.closestCenter,onDragStart:h,onDragEnd:w,children:[t.jsx("div",{className:"flex flex-col",children:j(e)}),t.jsx(M.DragOverlay,{children:o?t.jsx(qe,{id:o.id,label:o.label,hasChildren:o.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:o.isChecked,isExpanded:o.isExpanded}):null})]})}const He=(e,n)=>e.label.toLowerCase().includes(n);function We(e,n,s={}){const r=Ue(n);if(!r)return e;const{expandMatchedBranches:l=!0,includeGroupDescendantsOnMatch:a=!0,includeItemDescendantsOnMatch:i=!1,match:u=He}=s;return $(e,r,{expandMatchedBranches:l,includeGroupDescendantsOnMatch:a,includeItemDescendantsOnMatch:i,match:u})??[]}function $(e,n,s){const r=[];for(const l of e){const a=$e(l,n,s);a&&r.push(a)}return r.length?r:null}function $e(e,n,s){const r=s.match(e,n);if(e.type==="group"){if(r&&s.includeGroupDescendantsOnMatch)return B(e,s.expandMatchedBranches);const i=e.items?.length?$(e.items,n,s):null;return!r&&!i?null:{...e,items:i??[]}}const l=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return B(e,s.expandMatchedBranches);if(!r&&!l)return null;const a={...e};return l?(a.items=l,s.expandMatchedBranches&&(a.isExpanded=!0)):delete a.items,a}function B(e,n){return e.type==="group"?{...e,items:e.items.map(s=>B(s,n))}:{...e,isExpanded:n&&e.items?.length?!0:e.isExpanded,items:e.items?.map(s=>B(s,n))}}function Ue(e){return e.trim().toLowerCase()}var le=(e=>(e.Enter="Enter",e))(le||{});const ae=m.createContext(null);function Ve({children:e,isAgentAvailable:n}){const s=m.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(ae.Provider,{value:s,children:e})}function Ke(){const e=m.useContext(ae);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=Ve;exports.Alert=fe;exports.AlertType=O;exports.Button=Q;exports.CALENDAR_MOBILE_PADDING=X;exports.Calendar=be;exports.Checkbox=V;exports.CloseButton=U;exports.CollapsibleBlock=je;exports.CopyButton=Ye;exports.DownloadFormatMessage=Re;exports.DraggableList=Ge;exports.Dropdown=ke;exports.HighlightText=Ne;exports.IconButton=we;exports.InlineAlert=Pe;exports.InlineAlertProvider=Ae;exports.InlineAlertType=T;exports.Input=J;exports.InputWithIcon=Ce;exports.KeyboardKey=le;exports.Link=ve;exports.Loader=K;exports.PopUpSize=q;exports.PopUpState=F;exports.Popup=Se;exports.Radio=Ee;exports.RequestLimitMessage=Oe;exports.SERIES_LIMIT=W;exports.TREE_NODE_ARROW_SIZE=pe;exports.TREE_NODE_PADDING=ge;exports.Tag=ye;exports.filterDraggableListNodes=We;exports.useAgentAvailability=Ke;exports.useDebounce=he;exports.useIsMobile=Z;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("react");c=s(c);let l=require("classnames");l=s(l);let u=require("@tabler/icons-react"),d=require("react/jsx-runtime"),f=require("tailwind-merge"),p=require("react-flatpickr");p=s(p);let m=require("@epam/statgpt-shared-toolkit"),h=require("@floating-ui/react"),g=require("@dnd-kit/core"),_=require("@dnd-kit/sortable"),v=require("@dnd-kit/utilities");var y=({title:e,btnClassNames:t,iconWidth:n,iconHeight:r,onClick:i})=>(0,d.jsx)(`button`,{type:`button`,"aria-label":`button`,className:t,title:e,onClick:i,children:(0,d.jsx)(u.IconX,{height:r||20,width:n||20})}),b=function(e){return e.INFO=`info`,e.ERROR=`error`,e.SUCCESS=`success`,e.IN_PROGRESS=`in_progress`,e}({}),x=3e4,S=({alertDetails:e,infoIcon:t,successIcon:n,errorIcon:r,onClose:i,closeButtonTitle:a,children:o})=>{let s=e?.type,u=s===b.IN_PROGRESS||s===b.INFO,f=()=>u?`alert-in-progress`:s===b.SUCCESS?`alert-success`:`alert-error`,p=u?t:s===b.SUCCESS?n:s===b.ERROR?r:null,m=e?.text;return(0,c.useEffect)(()=>{if(!e||u)return;let t=setTimeout(()=>{i?.()},x);return()=>clearTimeout(t)},[e,u,i]),(0,d.jsx)(`div`,{className:(0,l.default)(`alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]`,f()),children:(0,d.jsxs)(`div`,{className:`alert-content flex items-start`,children:[p&&(0,d.jsx)(`div`,{className:`alert-icon`,children:p}),(0,d.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,d.jsx)(`h3`,{className:`alert-title truncate`,children:e?.title}),o??(m&&(0,d.jsx)(`div`,{className:`alert-text whitespace-pre-line break-words`,title:m,children:m}))]}),(0,d.jsx)(y,{title:a,onClick:i})]})})},C=()=>(0,d.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,d.jsx)(`div`,{className:`loader`})}),w=(0,f.extendTailwindMerge)({extend:{classGroups:{typography:[`h1`,`h2`,`h3`,`h4`,`h5`,`body-1`,`body-2`,`body-3`,`caption`]}}});function T(...e){return w((0,l.default)(...e))}var E=({buttonClassName:e,textClassName:t,isLoading:n=!1,title:r,disabled:i,iconAfter:a,iconBefore:o,onClick:s,isSmallButton:c})=>{let u=T([c?`font-semibold`:``,a?`mr-2`:``,o?`ml-2`:``,t]);return(0,d.jsxs)(`button`,{type:`button`,className:(0,l.default)(`base-button`,e,c?`small-button`:``),disabled:i||n,"aria-label":`button`,onClick:e=>s?.(e),title:r,children:[o,n&&(0,d.jsx)(C,{}),r?c?(0,d.jsx)(`h4`,{className:u,children:r}):(0,d.jsx)(`h3`,{className:u,children:r}):null,a]})};function D(e=719){let[t,n]=(0,c.useState)(()=>typeof window<`u`?window.innerWidth<e:!1);return(0,c.useEffect)(()=>{let t=window.matchMedia(`(max-width: ${e}px)`),r=e=>{n(e.matches)};return n(t.matches),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function ee(e,t){let n=(0,c.useRef)(null);return(0,c.useCallback)((...r)=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{e(...r)},t)},[e,t])}var te=24,ne=24,O=1e3,re=24,k=({label:e,onChange:t,value:n,options:r,calendarResolution:i=m.CalendarResolution.DAY,id:a,icon:o,isEndDate:s})=>{let l=(0,c.useRef)(null),f=D();(0,c.useEffect)(()=>{let t=l?.current;t&&t.querySelector(`input`)?.setAttribute(`aria-label`,e)},[e]);let h={...r,disableMobile:!0,defaultDate:i===m.CalendarResolution.MONTH?new Date(n.getFullYear(),n.getMonth()):n};return(0,d.jsxs)(`div`,{className:`calendar relative`,ref:l,children:[(0,d.jsx)(`div`,{className:`calendar-title mb-1`,children:e}),(0,d.jsx)(`label`,{htmlFor:a,className:`absolute right-[11px] top-[29px] cursor-pointer`,children:o||(0,d.jsx)(u.IconCalendarEvent,{})}),(0,d.jsx)(p.default,{defaultValue:(i===m.CalendarResolution.MONTH?new Date(n.getFullYear(),n.getMonth()):n)?.toDateString(),options:h,onChange:e=>{t(e[0])},onOpen:[(e,t,n)=>{if(i===m.CalendarResolution.MONTH&&e.length>0){let t=r.minDate,i=r.maxDate,a=e[0].getFullYear(),o=n.calendarContainer,s=`flatpickr-disabled`,c=o.querySelectorAll(`.flatpickr-monthSelect-month`),l=o.querySelectorAll(`.flatpickr-next-month`)[0],u=o.querySelectorAll(`.flatpickr-prev-month`)[0];a===i.getFullYear()&&l.classList.add(s),a===t.getFullYear()&&u.classList.add(s),(a===t.getFullYear()||a===i.getFullYear())&&c.forEach(e=>{e.classList.remove(s);let n=new Date(e.getAttribute(`aria-label`)),r=n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth(),a=n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth();r||a||(n<t||n>i)&&e.classList.add(s)})}setTimeout(()=>{let e=n.calendarContainer,t=n._input?.getBoundingClientRect();e&&(e.style.top=`${t.top-e.offsetHeight-8}px`,e.style.width=`${e.style.width}px`,s?(e.style.right=`${window.innerWidth-t.right-(f?24:0)}px`,e.style.left=`auto`):e.style.left=`${t.left}px`)},0)}],onReady:[(e,t,n)=>{let r=`calendar__${i===m.CalendarResolution.MONTH?`month`:`day`}`;n.calendarContainer&&n.calendarContainer.classList.add(r)}],id:a})]})},A=({label:e,id:t,checked:n,indeterminate:r=!1,checkboxIcon:i,onChange:a,disabled:o=!1,disabledScope:s=`full`,className:f,stopPropagation:p=!0})=>{let m=(0,c.useRef)(null);(0,c.useEffect)(()=>{m.current&&(m.current.indeterminate=!n&&r)},[n,r]);let h=(0,c.useCallback)(e=>{p&&e.stopPropagation()},[p]),g=(0,c.useCallback)(e=>{p&&e.stopPropagation(),a?.(t,e.target.checked)},[a,t,p]);return(0,d.jsxs)(`label`,{htmlFor:t,onClick:h,className:T(`flex min-w-0 items-center py-1 shrink-0`,o?`cursor-not-allowed`:`cursor-pointer`,o&&s===`full`&&`opacity-50`,f),children:[(0,d.jsx)(`span`,{className:(0,l.default)(`checkbox-button relative flex size-[14px] items-center justify-center`,o&&s===`icon`&&`opacity-50`),"aria-hidden":!0,children:(()=>{if(n)return i||(0,d.jsx)(u.IconSquareCheckFilled,{className:`absolute size-4`});if(r)return(0,d.jsx)(u.IconSquareMinusFilled,{className:`absolute size-4`})})()}),e?(0,d.jsx)(`p`,{className:(0,l.default)(`checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2`),title:e,children:e}):null,(0,d.jsx)(`input`,{ref:m,id:t,type:`checkbox`,checked:n,disabled:o,onChange:g,className:`hidden`})]})},ie=({title:e,icon:t,children:n,value:r})=>{let[i,a]=(0,c.useState)(!1);return(0,d.jsxs)(`div`,{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${i?`collapsible-block-open`:``}`,children:[(0,d.jsxs)(`div`,{className:`collapsible-block-title flex cursor-pointer items-center py-4`,onClick:()=>a(!i),children:[(0,d.jsx)(`div`,{className:`${i?`rotate-180`:``} transition-transform`,children:t||(0,d.jsx)(u.IconChevronDown,{className:`mr-3 size-5`})}),(0,d.jsxs)(`div`,{className:`flex flex-1 items-center justify-between`,children:[(0,d.jsx)(`span`,{children:e}),r&&(0,d.jsx)(`p`,{className:`body-1 text-neutrals-800`,children:r})]})]}),i&&(0,d.jsx)(`div`,{className:`collapsible-block-content pb-4`,children:n})]})},j=({text:e,highlightText:t})=>(0,d.jsx)(d.Fragment,{children:(0,c.useMemo)(()=>{let n=[];if(!t)return[{id:0,text:e,highlight:!1}];let r=t?.toLowerCase()||``,i=e?.toLowerCase()?.split(r)||``;for(let r=0,a=0;r<i?.length;r++){let o=i?.[r],s=o.length;o!==``&&n.push({id:n.length,highlight:!1,text:e?.substring(a,a+s)}),a+=s,r!==i?.length-1&&(n.push({id:n.length,highlight:!0,text:e?.substring(a,a+t.length)}),a+=t.length)}return n},[t,e]).map(e=>(0,d.jsx)(`span`,{className:(0,l.default)(e?.highlight&&`bg-highlight`),children:e?.text},e?.id))}),M=({icon:e,onClick:t,buttonClassName:n,disabled:r,title:i,isBaseIconStyles:a=!0})=>(0,d.jsx)(`button`,{type:`button`,className:(0,l.default)(a&&`base-icon-button`,n),onClick:e=>t?.(e),disabled:r,title:i,"aria-label":`button`,children:e}),N=({value:e,inputId:t,placeholder:n=``,cssClass:r=``,type:i=`text`,disabled:a,readonly:o,onChange:s,onKeyDown:c,onFocus:u,onBlur:f})=>{let p=(0,l.default)(`truncate outline-none shadow-none body-1`,r,o?`pointer-events-none`:``);return(0,d.jsx)(`input`,{type:i,autoComplete:`off`,id:t,placeholder:n,value:e||``,title:e?String(e):``,disabled:a,className:p,onKeyDown:c,onFocus:u,onBlur:f,onChange:e=>s?.(e.currentTarget.value)})},ae=({iconBeforeInput:e,iconAfterInput:t,containerClasses:n,cssClass:r,...i})=>(0,d.jsxs)(`div`,{className:(0,l.default)(`input w-full flex flex-row`,n),children:[e,(0,d.jsx)(N,{cssClass:(0,l.default)(`border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none`,r),...i}),t]}),oe=({url:e,title:t,linkClassName:n=``,iconBefore:r,iconAfter:i})=>{let a=(0,l.default)(i?`mr-2`:``,r?`ml-2`:``);return(0,d.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:(0,l.default)(`base-link`,n),title:t,children:[r,(0,d.jsx)(`span`,{className:a,children:t}),i]})},se=({title:e,text:t,disabled:n,onClick:r})=>(0,d.jsx)(`button`,{type:`button`,className:(0,l.default)(`tag flex items-center justify-center`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100`),disabled:n,onClick:()=>r?.(t||e),"aria-label":`button`,children:(0,d.jsx)(`h4`,{children:e})}),ce=({label:e,id:t,checked:n,radioIcon:r,description:i,onChange:a})=>{let o=(0,c.useCallback)(e=>{e.stopPropagation(),a?.(t,e.target.checked)},[a,t]);return(0,d.jsxs)(`label`,{className:`flex min-w-0 cursor-pointer flex-col py-[6px]`,htmlFor:t,children:[(0,d.jsxs)(`p`,{className:`radio-label flex min-w-0 items-center`,children:[(0,d.jsx)(`span`,{className:(0,l.default)(`flex justify-center items-center w-4 h-4 mr-2 relative`,`radio-button`,n?`radio-button-active`:``),children:n&&r}),e&&(0,d.jsx)(`span`,{className:`radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000`,title:e,children:e})]}),i&&(0,d.jsx)(`span`,{className:`radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800`,title:i,children:i}),(0,d.jsx)(`input`,{type:`radio`,onChange:o,id:t,checked:n,className:`hidden`})]})},P=function(e){return e.Closed=`Closed`,e.Opened=`Opened`,e}({}),F=function(e){return e.LG=`Large`,e.SM=`Small`,e}({}),le=({portalId:e,state:t=P.Opened,heading:n,size:r,onClose:i,children:a,overlayClassName:o,containerClassName:s,dividers:u=!0,closeButtonTitle:f})=>{let{refs:p,context:m}=(0,h.useFloating)({open:t!==P.Closed&&!!t,onOpenChange:i}),{getFloatingProps:g}=(0,h.useInteractions)([(0,h.useRole)(m,{role:`dialog`}),(0,h.useDismiss)(m,{outsidePress:!0})]),_=(0,c.useCallback)(e=>{e?.preventDefault(),e?.stopPropagation(),i()},[i]);return(0,d.jsx)(h.FloatingPortal,{id:e,children:t!==P.Closed&&(0,d.jsx)(h.FloatingOverlay,{className:(0,l.default)(`z-modal flex items-center justify-center bg-blackout p-4`,o),children:(0,d.jsx)(h.FloatingFocusManager,{context:m,children:(0,d.jsxs)(`div`,{className:(0,l.default)(`relative max-h-full modal rounded bg-white flex flex-col shadow w-full`,r===F.LG&&`max-w-[65%]`,r===F.SM&&`max-w-[30%]`,u&&`divide-neutrals-400 divide-y`,s,`sm:w-full sm:max-w-full sm:px-4 sm:py-6`),ref:p.setFloating,...g({onClick(e){e.stopPropagation()}}),children:[(0,d.jsxs)(`div`,{className:`modal-heading flex flex-row items-center justify-between px-6 py-5 sm:p-0 sm:pb-2`,children:[n&&(typeof n==`string`?(0,d.jsx)(`h2`,{className:`modal-heading-title sm:h3 mr-3 min-w-0 flex-1`,children:n}):n),(0,d.jsx)(y,{title:f,onClick:_,btnClassNames:`sm:h-[24px] sm:w-[24px] sm:top-4`})]}),a.map(e=>e)]})})})})},ue=e=>e.state===P.Closed?null:(0,d.jsx)(le,{...e}),I=`statgpt-dropdown-open`,L=8,R={name:`keepDropdownWithinViewport`,fn({y:e,rects:t}){if(typeof window>`u`)return{};let n=document.documentElement.clientHeight||window.innerHeight,r=Math.min(t.floating.height,Math.max(0,n-L*2)),i=L,a=n-r-L;return{y:Math.min(Math.max(e,i),Math.max(i,a))}}},z=({triggerButton:e,options:t,content:n,selectedOption:r,disabled:i,containerClassName:a,openedClassName:o,onOptionSelect:s})=>{let u=(0,c.useId)(),[f,p]=(0,c.useState)(!1),{refs:m,floatingStyles:g,context:_}=(0,h.useFloating)({open:f,onOpenChange:i?void 0:p,placement:`bottom-end`,strategy:`fixed`,middleware:[(0,h.offset)(L),(0,h.flip)({padding:L}),(0,h.size)({padding:L,apply({availableHeight:e,elements:t}){t.floating.style.maxHeight=`${Math.max(0,e)}px`}}),(0,h.shift)({padding:L}),R],whileElementsMounted:h.autoUpdate}),{getReferenceProps:v,getFloatingProps:y}=(0,h.useInteractions)([(0,h.useClick)(_),(0,h.useDismiss)(_,{outsidePress:!0})]);return(0,c.useEffect)(()=>{f&&window.dispatchEvent(new CustomEvent(I,{detail:u}))},[u,f]),(0,c.useEffect)(()=>{let e=e=>{e instanceof CustomEvent&&e.detail!==u&&p(!1)};return window.addEventListener(I,e),()=>{window.removeEventListener(I,e)}},[u]),(0,c.useEffect)(()=>{i&&p(!1)},[i]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{ref:m.setReference,...v({onClick(e){e.stopPropagation()}}),className:(0,l.default)(a,f&&o),children:e}),f&&(0,d.jsx)(h.FloatingPortal,{children:(0,d.jsxs)(`div`,{ref:m.setFloating,style:{...g,overflowY:`auto`},className:`dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white`,...y(),children:[n&&n,t&&t.map(e=>(0,d.jsx)(`div`,{onClick:t=>{t.stopPropagation(),s?.(e.key),p(!1)},className:(0,l.default)(`text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]`,r===e.key&&`bg-hues-100`),children:(0,d.jsxs)(`div`,{className:`dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100`,title:e.title,children:[e.icon?e.icon:null,(0,d.jsx)(`p`,{children:e?.title})]})},e.key))]})})]})},B=({limitMessages:e,query:t})=>(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1`,children:[(0,d.jsx)(`div`,{className:`flex gap-x-[4px]`,children:(0,d.jsx)(`div`,{className:`flex flex-col`,children:(0,d.jsxs)(`div`,{className:`flex gap-x-[4px]`,children:[(0,d.jsxs)(`span`,{className:`h5 text-primary`,children:[e?.excelFormatTitle,` `]}),(0,d.jsx)(`span`,{className:`body-3 text-neutrals-800`,children:e?.excelFormatText})]})})}),(0,d.jsx)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,children:(0,d.jsxs)(`span`,{className:`body-3 flex cursor-pointer items-center gap-x-[4px]`,children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),V=({limitMessages:e,isDownload:t,showAdvancedViewButton:n,onAdvancedViewClick:r,query:i})=>(0,d.jsxs)(`div`,{className:(0,l.default)(`bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center`,e?.containerClassName),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-x-2`,children:[(0,d.jsx)(`span`,{children:e?.warningIcon}),(0,d.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,d.jsxs)(`div`,{className:`flex gap-x-[4px]`,children:[(0,d.jsxs)(`span`,{className:(0,l.default)(`text-primary h5`,e?.largeQueryClassName),children:[e?.largeQuery,`:`,` `]}),(0,d.jsx)(`span`,{className:(0,l.default)(`text-neutrals-800 body-3`,e?.limitMessageClassName),children:t?e?.downloadMessage?.(O):e?.showingLimit?.(O)})]}),t&&(0,d.jsx)(`span`,{className:(0,l.default)(`text-neutrals-800 body-3`,e?.limitMessageClassName),children:e?.fullLimitMessage})]})]}),n&&(0,d.jsxs)(`span`,{onClick:()=>r?.(),className:`h4 flex cursor-pointer items-center gap-x-[4px] text-primary`,children:[e?.editIcon,e?.refineInAdvancedView]}),t&&(0,d.jsx)(`a`,{href:i||``,target:`_blank`,rel:`noreferrer`,children:(0,d.jsxs)(`span`,{className:`body-3 flex cursor-pointer items-center gap-x-[4px]`,children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),H=(0,c.createContext)(null);function U({value:e,children:t}){let n=(0,c.useMemo)(()=>e??{},[e]);return(0,d.jsx)(H.Provider,{value:n,children:t})}function de(){return(0,c.useContext)(H)}var W=function(e){return e.Info=`info`,e.Error=`error`,e.Warning=`warning`,e.Note=`note`,e}({}),fe={[W.Info]:`border-neutrals-800 bg-neutrals-300 text-neutrals-1000`,[W.Error]:`border-semantic-error bg-semantic-error-light text-neutrals-1000`,[W.Warning]:`border-semantic-warning bg-semantic-warning-light text-neutrals-1000`,[W.Note]:`border-hues-900 bg-neutrals-200 text-neutrals-1000`},pe=`shrink-0`,me=`min-w-0 body-2`,he=`flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center`;function ge({type:e,icon:t,children:n,className:r,contentClassName:i}){let a=de(),o=t??a?.icons?.[e],s=T(a?.classes?.container??he,a?.classes?.types?.[e]??fe[e],r),c=T(pe,a?.classes?.icon),l=T(me,a?.classes?.content,i);return(0,d.jsxs)(`div`,{"data-type":e,className:s,children:[o?(0,d.jsx)(`span`,{className:c,children:o}):null,n?(0,d.jsx)(`div`,{className:l,children:n}):null]})}var _e=({title:e,copiedTitle:t,tooltip:n,hoverTooltip:r,icon:i,copiedIcon:a,className:o,buttonTextClassName:s,onClick:l})=>{let[u,f]=(0,c.useState)(!1),p=(0,c.useRef)(null);return(0,c.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),(0,d.jsxs)(`div`,{className:`relative w-fit`,title:r,children:[(0,d.jsx)(E,{title:u?t:e,isSmallButton:!0,disabled:u,buttonClassName:T([`text-button-tertiary small-icon-button !h-6 !p-0`,o]),textClassName:T([`ml-1`,s]),onClick:()=>{l(),f(!0),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{f(!1)},1e3)},iconBefore:u?a:i}),n&&u&&(0,d.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:n})]})};function ve({id:e,label:t,hasChildren:n,showDragHandle:r,showCheckbox:i,isChecked:a,isExpanded:o}){return(0,d.jsxs)(`div`,{className:`relative cursor-grabbing rounded bg-neutrals-200 shadow`,children:[(0,d.jsx)(`div`,{className:`absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light`}),(0,d.jsxs)(`div`,{className:`flex items-stretch overflow-hidden rounded`,children:[r?(0,d.jsx)(`div`,{className:`flex w-6 items-center justify-center`,children:(0,d.jsx)(`span`,{"aria-hidden":!0,className:`rounded p-1`,children:(0,d.jsx)(u.IconGripVertical,{size:16})})}):null,(0,d.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 p-1`,children:[i?(0,d.jsx)(A,{id:e,checked:!!a,className:`p-0`}):null,(0,d.jsx)(`span`,{className:`body-3 truncate`,children:t})]}),n?(0,d.jsx)(`div`,{className:`flex w-8 items-center justify-center`,children:(0,d.jsx)(`span`,{"aria-hidden":!0,className:(0,l.default)(`transition-transform`,o?`rotate-90`:`rotate-0`),children:(0,d.jsx)(u.IconChevronRight,{size:16})})}):null]})]})}function G(e,t){return`i:${[...e,t].join(`/`)}`}function K(e){if(!e.startsWith(`i:`))return null;let t=e.slice(2).split(`/`).filter(Boolean);return t.length?{parentPath:t.slice(0,-1),itemId:t[t.length-1]}:null}function ye(e,t,n){let r=J(e,t);return r?r.find(e=>e.id===n)??null:null}function q(e,t){if(t.length===0)return e;let[n,...r]=t,i=e.find(e=>e.id===n);return i?.items?q(i.items,r):null}function J(e,t){let n=q(e,t);return n?n.filter(e=>e.type===`item`):null}function Y(e,t,n){if(t.length===0)return n(e);let[r,...i]=t;return e.map(e=>e.id!==r||!e.items?e:{...e,items:Y(e.items,i,n)})}function be({parentPath:e,item:t,showDragHandle:n,showCheckbox:r,renderLabel:i,onItemClick:a,onToggleExpanded:o,onToggleChecked:s}){let c=!!t.items?.length,f=!!t.isExpanded,p=t.isDisabled?!1:t.draggable??!0,m=t.isDisabled?!1:t.checkable??!0,{attributes:h,listeners:g,setNodeRef:y,setActivatorNodeRef:b,transform:x,transition:S,isDragging:C}=(0,_.useSortable)({id:G(e,t.id),disabled:!p}),w={transform:v.CSS.Transform.toString(x),transition:S,opacity:C?.6:void 0},T=!!t.isDisabled,E=T||!m,D=[...e,t.id];return(0,d.jsxs)(`div`,{ref:y,style:w,className:(0,l.default)([`group flex items-stretch overflow-hidden rounded bg-white`,`select-none`,T?`opacity-50`:``]),children:[n?(0,d.jsx)(`div`,{className:(0,l.default)([`group/drag-handle flex w-6 items-center justify-center rounded`,T?``:`hover:bg-neutrals-100 cursor-grab`]),children:(0,d.jsx)(`span`,{ref:b,"aria-hidden":!0,className:(0,l.default)([`rounded p-1`,p?`cursor-grab`:`cursor-default`,`transition-opacity`]),...p?g:{},...p?h:{},children:(0,d.jsx)(u.IconGripVertical,{size:16,className:`text-neutrals-800 group-hover/drag-handle:text-primary`})})}):null,(0,d.jsxs)(`button`,{type:`button`,disabled:T,"aria-disabled":E,onClick:e=>{E||a?.({itemId:t.id,path:D,nativeEvent:e})},className:(0,l.default)([`flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded`,T?``:`hover:bg-neutrals-100`,T?``:`hover:text-blue-700`,`focus:outline-none`]),children:[r?(0,d.jsx)(A,{id:`draggable-list-${D.join(`-`)}`,checked:!!t.isChecked,disabled:!m,className:`p-0`,stopPropagation:!0,onChange:(e,n)=>s?.({itemId:t.id,path:D,nextChecked:!!n})}):null,(0,d.jsx)(`span`,{className:`body-3 w-full truncate text-neutrals-800`,children:i?i(t):t.label})]}),c?(0,d.jsx)(`button`,{type:`button`,disabled:T,onClick:e=>{e.stopPropagation(),o?.({itemId:t.id,path:D,nextExpanded:!f})},"aria-label":f?`Collapse`:`Expand`,className:(0,l.default)([`flex w-8 items-center justify-center rounded`,T?``:`hover:bg-neutrals-100`,`focus:outline-none`]),children:(0,d.jsx)(`span`,{"aria-hidden":!0,className:(0,l.default)(`transition-transform duration-150 ease-out`,f?`rotate-90`:`rotate-0`),children:(0,d.jsx)(u.IconChevronRight,{size:16})})}):null]})}function X({items:e,showDragHandle:t=!0,showCheckbox:n=!0,onItemsChange:r,onToggleExpanded:i,onToggleChecked:a,onItemClick:o,renderLabel:s}){let l=(0,g.useSensors)((0,g.useSensor)(g.PointerSensor,{activationConstraint:{distance:6}})),[f,p]=c.useState(null),m=t=>{let n=String(t.active.id),r=K(n);if(!r)return;let i=ye(e,r.parentPath,r.itemId);!i||i.type!==`item`||p({id:n,label:i.label,hasChildren:!!i.items?.length,isChecked:i.isChecked,isExpanded:i.isExpanded})},h=t=>{p(null);let n=t.over;if(!n)return;let i=K(String(t.active.id)),a=K(String(n.id));if(!i||!a||i.parentPath.join(`/`)!==a.parentPath.join(`/`))return;let o=J(e,i.parentPath);if(!o)return;let s=o.findIndex(e=>e.id===i.itemId),c=o.findIndex(e=>e.id===a.itemId);s===-1||c===-1||s===c||r(Y(e,i.parentPath,e=>{let t=(0,_.arrayMove)(e.filter(e=>e.type===`item`),s,c),n=0;return e.map(e=>{if(e.type!==`item`)return e;let r=t[n];return n+=1,r})}))},v=(e,r=[])=>(0,d.jsx)(_.SortableContext,{items:e.filter(e=>e.type===`item`).map(e=>G(r,e.id)),strategy:_.verticalListSortingStrategy,children:(0,d.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.map(e=>e.type===`group`?(0,d.jsxs)(`li`,{className:`m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0`,children:[(0,d.jsxs)(`div`,{className:`h5 flex items-center gap-2 py-1 text-neutrals-1000`,children:[(0,d.jsx)(u.IconDatabase,{size:12,className:`shrink-0`}),e.label]}),(0,d.jsx)(`div`,{className:`border-l border-neutrals-600 pl-2`,children:v(e.items,[...r,e.id])})]},e.id):(0,d.jsxs)(`li`,{className:`m-0 flex flex-col gap-2 p-0`,children:[(0,d.jsx)(be,{parentPath:r,item:e,showDragHandle:t,showCheckbox:n,renderLabel:s,onItemClick:o,onToggleExpanded:i,onToggleChecked:a}),e.items?.length&&e.isExpanded?(0,d.jsx)(`div`,{className:`pl-7`,children:v(e.items,[...r,e.id])}):null]},e.id))})});return(0,d.jsxs)(g.DndContext,{sensors:l,collisionDetection:g.closestCenter,onDragStart:m,onDragEnd:h,children:[(0,d.jsx)(`div`,{className:`flex flex-col`,children:v(e)}),(0,d.jsx)(g.DragOverlay,{children:f?(0,d.jsx)(ve,{id:f.id,label:f.label,hasChildren:f.hasChildren,showDragHandle:t,showCheckbox:n,isChecked:f.isChecked,isExpanded:f.isExpanded}):null})]})}var xe=(e,t)=>e.label.toLowerCase().includes(t);function Se(e,t,n={}){let r=we(t);if(!r)return e;let{expandMatchedBranches:i=!0,includeGroupDescendantsOnMatch:a=!0,includeItemDescendantsOnMatch:o=!1,match:s=xe}=n;return Z(e,r,{expandMatchedBranches:i,includeGroupDescendantsOnMatch:a,includeItemDescendantsOnMatch:o,match:s})??[]}function Z(e,t,n){let r=[];for(let i of e){let e=Ce(i,t,n);e&&r.push(e)}return r.length?r:null}function Ce(e,t,n){let r=n.match(e,t);if(e.type===`group`){if(r&&n.includeGroupDescendantsOnMatch)return Q(e,n.expandMatchedBranches);let i=e.items?.length?Z(e.items,t,n):null;return!r&&!i?null:{...e,items:i??[]}}let i=e.items?.length?Z(e.items,t,n):null;if(r&&n.includeItemDescendantsOnMatch)return Q(e,n.expandMatchedBranches);if(!r&&!i)return null;let a={...e};return i?(a.items=i,n.expandMatchedBranches&&(a.isExpanded=!0)):delete a.items,a}function Q(e,t){return e.type===`group`?{...e,items:e.items.map(e=>Q(e,t))}:{...e,isExpanded:t&&e.items?.length?!0:e.isExpanded,items:e.items?.map(e=>Q(e,t))}}function we(e){return e.trim().toLowerCase()}var Te=function(e){return e.Enter=`Enter`,e}({}),$=(0,c.createContext)(null);function Ee({children:e,isAgentAvailable:t}){let n=(0,c.useMemo)(()=>({isAgentAvailable:t}),[t]);return(0,d.jsx)($.Provider,{value:n,children:e})}function De(){let e=(0,c.useContext)($);if(!e)throw Error(`useAgentAvailability must be used within AgentAvailabilityProvider`);return e}exports.AgentAvailabilityProvider=Ee,exports.Alert=S,exports.AlertType=b,exports.Button=E,exports.CALENDAR_MOBILE_PADDING=re,exports.Calendar=k,exports.Checkbox=A,exports.CloseButton=y,exports.CollapsibleBlock=ie,exports.CopyButton=_e,exports.DownloadFormatMessage=B,exports.DraggableList=X,exports.Dropdown=z,exports.HighlightText=j,exports.IconButton=M,exports.InlineAlert=ge,exports.InlineAlertProvider=U,exports.InlineAlertType=W,exports.Input=N,exports.InputWithIcon=ae,exports.KeyboardKey=Te,exports.Link=oe,exports.Loader=C,exports.PopUpSize=F,exports.PopUpState=P,exports.Popup=ue,exports.Radio=ce,exports.RequestLimitMessage=V,exports.SERIES_LIMIT=O,exports.TREE_NODE_ARROW_SIZE=te,exports.TREE_NODE_PADDING=ne,exports.Tag=se,exports.filterDraggableListNodes=Se,exports.useAgentAvailability=De,exports.useDebounce=ee,exports.useIsMobile=D;
|