@epam/statgpt-ui-components 0.5.0-rc.30 → 0.5.0-rc.32
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 +3 -1
- package/index.js +1 -1
- package/index.mjs +211 -210
- package/package.json +2 -2
|
@@ -4,6 +4,7 @@ interface CopyButtonProps {
|
|
|
4
4
|
title?: string;
|
|
5
5
|
copiedTitle?: string;
|
|
6
6
|
tooltip?: string;
|
|
7
|
+
hoverTooltip?: string;
|
|
7
8
|
icon?: ReactNode;
|
|
8
9
|
copiedIcon?: ReactNode;
|
|
9
10
|
className?: string;
|
|
@@ -34,10 +35,11 @@ interface CopyButtonProps {
|
|
|
34
35
|
* @param title - Title shown in the default state.
|
|
35
36
|
* @param copiedTitle - Title shown while in the copied state.
|
|
36
37
|
* @param tooltip - Optional tooltip displayed during the copied state.
|
|
38
|
+
* @param hoverTooltip - Optional native browser tooltip shown on hover (via the HTML `title` attribute).
|
|
37
39
|
* @param icon - Icon shown in the default state.
|
|
38
40
|
* @param copiedIcon - Icon shown in the copied state.
|
|
39
41
|
* @param className - Additional classes applied to the button.
|
|
40
42
|
* @param buttonTextClassName - Additional classes for the button text.
|
|
41
43
|
*/
|
|
42
|
-
export declare const CopyButton: ({ title, copiedTitle, tooltip, icon, copiedIcon, className, buttonTextClassName, onClick, }: CopyButtonProps) => import("react").JSX.Element;
|
|
44
|
+
export declare const CopyButton: ({ title, copiedTitle, tooltip, hoverTooltip, icon, copiedIcon, className, buttonTextClassName, onClick, }: CopyButtonProps) => import("react").JSX.Element;
|
|
43
45
|
export {};
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),p=require("react"),h=require("classnames"),D=require("@tabler/icons-react"),ie=require("tailwind-merge"),oe=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),N=require("@floating-ui/react"),M=require("@dnd-kit/core"),Y=require("@dnd-kit/sortable"),ce=require("@dnd-kit/utilities");function de(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const ue=de(p),U=({title:e,btnClassNames:n,iconWidth:s,iconHeight:r,onClick:a})=>t.jsx("button",{type:"button","aria-label":"button",className:n,title:e,onClick:a,children:t.jsx(D.IconX,{height:r||20,width:s||20})});var O=(e=>(e.INFO="info",e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(O||{});const xe=3e4,me=({alertDetails:e,infoIcon:n,successIcon:s,errorIcon:r,onClose:a,closeButtonTitle:l,children:c})=>{const i=e?.type,u=i===O.IN_PROGRESS||i===O.INFO,x=()=>u?"alert-in-progress":i===O.SUCCESS?"alert-success":"alert-error",m=u?n:i===O.SUCCESS?s:i===O.ERROR?r:null,f=e?.text;return p.useEffect(()=>{if(!e||u)return;const v=setTimeout(()=>{a?.()},xe);return()=>clearTimeout(v)},[e,u,a]),t.jsx("div",{className:h("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",x()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[m&&t.jsx("div",{className:"alert-icon",children:m}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx("h3",{className:"alert-title truncate",children:e?.title}),c??(f&&t.jsx("div",{className:"alert-text whitespace-pre-line break-words",title:f,children:f}))]}),t.jsx(U,{title:l,onClick:a})]})})},K=()=>t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx("div",{className:"loader"})}),he=ie.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function L(...e){return he(h(...e))}const Q=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:a,iconAfter:l,iconBefore:c,onClick:i,isSmallButton:u})=>{const x=L([u?"font-semibold":"",l?"mr-2":"",c?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:h("base-button",e,u?"small-button":""),disabled:a||s,"aria-label":"button",onClick:m=>i?.(m),title:r,children:[c,s&&t.jsx(K,{}),r?u?t.jsx("h4",{className:x,children:r}):t.jsx("h3",{className:x,children:r}):null,l]})};function Z(e=719){const[n,s]=p.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return p.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e}px)`),a=l=>{s(l.matches)};return s(r.matches),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),n}function fe(e,n){const s=p.useRef(null);return p.useCallback((...a)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...a)},n)},[e,n])}const pe=24,ge=24,W=1e3,X=24,be=({label:e,onChange:n,value:s,options:r,calendarResolution:a=P.CalendarResolution.DAY,id:l,icon:c,isEndDate:i})=>{const u=p.useRef(null),x=Z();p.useEffect(()=>{const j=u?.current;j&&j.querySelector("input")?.setAttribute("aria-label",e)},[e]);const m={...r,disableMobile:!0,defaultDate:a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},f=(j,C,b)=>{const d=`calendar__${a===P.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(d)},v=(j,C,b)=>{if(a===P.CalendarResolution.MONTH&&j.length>0){const d=r.minDate,o=r.maxDate,g=j[0].getFullYear(),w=b.calendarContainer,S="flatpickr-disabled",y=w.querySelectorAll(".flatpickr-monthSelect-month"),E=w.querySelectorAll(".flatpickr-next-month")[0],R=w.querySelectorAll(".flatpickr-prev-month")[0];g===o.getFullYear()&&E.classList.add(S),g===d.getFullYear()&&R.classList.add(S),(g===d.getFullYear()||g===o.getFullYear())&&y.forEach(k=>{k.classList.remove(S);const I=new Date(k.getAttribute("aria-label")),_=I.getFullYear()===d.getFullYear()&&I.getMonth()===d.getMonth(),z=I.getFullYear()===o.getFullYear()&&I.getMonth()===o.getMonth();_||z||(I<d||I>o)&&k.classList.add(S)})}setTimeout(()=>{const d=b.calendarContainer,o=b._input?.getBoundingClientRect();d&&(d.style.top=`${o.top-d.offsetHeight-8}px`,d.style.width=`${d.style.width}px`,i?(d.style.right=`${window.innerWidth-o.right-(x?X:0)}px`,d.style.left="auto"):d.style.left=`${o.left}px`)},0)};return t.jsxs("div",{className:"calendar relative",ref:u,children:[t.jsx("div",{className:"calendar-title mb-1",children:e}),t.jsx("label",{htmlFor:l,className:"absolute right-[11px] top-[29px] cursor-pointer",children:c||t.jsx(D.IconCalendarEvent,{})}),t.jsx(oe,{defaultValue:(a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:m,onChange:j=>{n(j[0])},onOpen:[v],onReady:[f],id:l})]})},V=({label:e,id:n,checked:s,checkboxIcon:r,onChange:a,disabled:l=!1,className:c,stopPropagation:i=!0})=>{const u=p.useCallback(f=>{i&&f.stopPropagation()},[i]),x=p.useCallback(f=>{i&&f.stopPropagation(),a?.(n,f.target.checked)},[a,n,i]),m=()=>{if(s)return r||t.jsx(D.IconSquareCheckFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:u,className:L("flex min-w-0 items-center py-1 shrink-0",l?"cursor-not-allowed opacity-50":"cursor-pointer",c),children:[t.jsx("span",{className:h("checkbox-button relative flex size-[14px] items-center justify-center"),"aria-hidden":!0,children:m()}),e?t.jsx("p",{className:h("checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"),title:e,children:e}):null,t.jsx("input",{id:n,type:"checkbox",checked:s,disabled:l,onChange:x,className:"hidden"})]})},je=({title:e,icon:n,children:s,value:r})=>{const[a,l]=p.useState(!1);return t.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${a?"collapsible-block-open":""}`,children:[t.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>l(!a),children:[t.jsx("div",{className:`${a?"rotate-180":""} transition-transform`,children:n||t.jsx(D.IconChevronDown,{className:"mr-3 size-5"})}),t.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[t.jsx("span",{children:e}),r&&t.jsx("p",{className:"body-1 text-neutrals-800",children:r})]})]}),a&&t.jsx("div",{className:"collapsible-block-content pb-4",children:s})]})},Ne=({text:e,highlightText:n})=>{const s=p.useMemo(()=>{const r=[];if(!n)return[{id:0,text:e,highlight:!1}];const a=n?.toLowerCase()||"",l=e?.toLowerCase()?.split(a)||"";for(let c=0,i=0;c<l?.length;c++){const u=l?.[c],x=u.length;u!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(i,i+x)}),i+=x,c!==l?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(i,i+n.length)}),i+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:h(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},we=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:a,isBaseIconStyles:l=!0})=>t.jsx("button",{type:"button",className:h(l&&"base-icon-button",s),onClick:c=>n?.(c),disabled:r,title:a,"aria-label":"button",children:e}),J=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:a="text",disabled:l,readonly:c,onChange:i,onKeyDown:u,onFocus:x,onBlur:m})=>{const f=h("truncate outline-none shadow-none body-1",r,c?"pointer-events-none":"");return t.jsx("input",{type:a,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:l,className:f,onKeyDown:u,onFocus:x,onBlur:m,onChange:v=>i?.(v.currentTarget.value)})},Ce=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...a})=>t.jsxs("div",{className:h("input w-full flex flex-row",s),children:[e,t.jsx(J,{cssClass:h("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...a}),n]}),ve=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:a})=>{const l=h(a?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:h("base-link",s),title:n,children:[r,t.jsx("span",{className:l,children:n}),a]})},ye=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:h("tag flex items-center justify-center","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"),disabled:s,onClick:()=>r?.(n||e),"aria-label":"button",children:t.jsx("h4",{children:e})}),Ee=({label:e,id:n,checked:s,radioIcon:r,description:a,onChange:l})=>{const c=p.useCallback(i=>{i.stopPropagation(),l?.(n,i.target.checked)},[l,n]);return t.jsxs("label",{className:"flex min-w-0 cursor-pointer flex-col py-[6px]",htmlFor:n,children:[t.jsxs("p",{className:"radio-label flex min-w-0 items-center",children:[t.jsx("span",{className:h("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",s?"radio-button-active":""),children:s&&r}),e&&t.jsx("span",{className:"radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000",title:e,children:e})]}),a&&t.jsx("span",{className:"radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",title:a,children:a}),t.jsx("input",{type:"radio",onChange:c,id:n,checked:s,className:"hidden"})]})};var F=(e=>(e.Closed="Closed",e.Opened="Opened",e))(F||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const Ie=({portalId:e,state:n=F.Opened,heading:s,size:r,onClose:a,children:l,overlayClassName:c,containerClassName:i,dividers:u=!0,closeButtonTitle:x})=>{const{refs:m,context:f}=N.useFloating({open:n!==F.Closed&&!!n,onOpenChange:a}),v=N.useRole(f,{role:"dialog"}),j=N.useDismiss(f,{outsidePress:!0}),{getFloatingProps:C}=N.useInteractions([v,j]),b=p.useCallback(d=>{d?.preventDefault(),d?.stopPropagation(),a()},[a]);return t.jsx(N.FloatingPortal,{id:e,children:n!==F.Closed&&t.jsx(N.FloatingOverlay,{className:h("z-modal flex items-center justify-center bg-blackout p-4",c),children:t.jsx(N.FloatingFocusManager,{context:f,children:t.jsxs("div",{className:h("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",r===q.LG&&"max-w-[65%]",r===q.SM&&"max-w-[30%]",u&&"divide-neutrals-400 divide-y",i,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:m.setFloating,...C({onClick(d){d.stopPropagation()}}),children:[t.jsxs("div",{className:"modal-heading mb-2 flex flex-row items-center justify-between px-6 py-3 sm:p-0 sm:pb-2",children:[s&&(typeof s=="string"?t.jsx("h2",{className:"modal-heading-title sm:h3 mr-3 min-w-0 flex-1",children:s}):s),t.jsx(U,{title:x,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),l.map(d=>d)]})})})})},Se=e=>e.state===F.Closed?null:t.jsx(Ie,{...e}),G="statgpt-dropdown-open",A=8,ke={name:"keepDropdownWithinViewport",fn({y:e,rects:n}){if(typeof window>"u")return{};const s=document.documentElement.clientHeight||window.innerHeight,r=Math.min(n.floating.height,Math.max(0,s-A*2)),a=A,l=s-r-A;return{y:Math.min(Math.max(e,a),Math.max(a,l))}}},De=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:a,containerClassName:l,openedClassName:c,onOptionSelect:i})=>{const u=p.useId(),[x,m]=p.useState(!1),{refs:f,floatingStyles:v,context:j}=N.useFloating({open:x,onOpenChange:a?void 0:m,placement:"bottom-end",strategy:"fixed",middleware:[N.offset(A),N.flip({padding:A}),N.size({padding:A,apply({availableHeight:g,elements:w}){w.floating.style.maxHeight=`${Math.max(0,g)}px`}}),N.shift({padding:A}),ke],whileElementsMounted:N.autoUpdate}),C=N.useClick(j),b=N.useDismiss(j,{outsidePress:!0}),{getReferenceProps:d,getFloatingProps:o}=N.useInteractions([C,b]);return p.useEffect(()=>{x&&window.dispatchEvent(new CustomEvent(G,{detail:u}))},[u,x]),p.useEffect(()=>{const g=w=>{w instanceof CustomEvent&&w.detail!==u&&m(!1)};return window.addEventListener(G,g),()=>{window.removeEventListener(G,g)}},[u]),p.useEffect(()=>{a&&m(!1)},[a]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:f.setReference,...d({onClick(g){g.stopPropagation()}}),className:h(l,x&&c),children:e}),x&&t.jsx(N.FloatingPortal,{children:t.jsxs("div",{ref:f.setFloating,style:{...v,overflowY:"auto"},className:"dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",...o(),children:[s&&s,n&&n.map(g=>t.jsx("div",{onClick:w=>{w.stopPropagation(),i?.(g.key),m(!1)},className:h("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===g.key&&"bg-hues-100"),children:t.jsxs("div",{className:"dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",title:g.title,children:[g.icon?g.icon:null,t.jsx("p",{children:g?.title})]})},g.key))]})})]})},Re=({limitMessages:e,query:n})=>t.jsxs("div",{className:"flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1",children:[t.jsx("div",{className:"flex gap-x-[4px]",children:t.jsx("div",{className:"flex flex-col",children:t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:"h5 text-primary",children:[e?.excelFormatTitle," "]}),t.jsx("span",{className:"body-3 text-neutrals-800",children:e?.excelFormatText})]})})}),t.jsx("a",{href:n,target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),Oe=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:a})=>t.jsxs("div",{className:h("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",e?.containerClassName),children:[t.jsxs("div",{className:"flex items-center gap-x-2",children:[t.jsx("span",{children:e?.warningIcon}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:h("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:h("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(W):e?.showingLimit?.(W)})]}),n&&t.jsx("span",{className:h("text-neutrals-800 body-3",e?.limitMessageClassName),children:e?.fullLimitMessage})]})]}),s&&t.jsxs("span",{onClick:()=>r?.(),className:"h4 flex cursor-pointer items-center gap-x-[4px] text-primary",children:[e?.editIcon,e?.refineInAdvancedView]}),n&&t.jsx("a",{href:a||"",target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),ee=p.createContext(null);function Ae({value:e,children:n}){const s=p.useMemo(()=>e??{},[e]);return t.jsx(ee.Provider,{value:s,children:n})}function Le(){return p.useContext(ee)}var T=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e.Note="note",e))(T||{});const _e={[T.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[T.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[T.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000",[T.Note]:"border-hues-900 bg-neutrals-200 text-neutrals-1000"},Me="shrink-0",Te="min-w-0 body-2",Fe="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function Pe({type:e,icon:n,children:s,className:r,contentClassName:a}){const l=Le(),c=n??l?.icons?.[e],i=l?.classes?.container??Fe,u=l?.classes?.types?.[e]??_e[e],x=L(i,u,r),m=L(Me,l?.classes?.icon),f=L(Te,l?.classes?.content,a);return t.jsxs("div",{"data-type":e,className:x,children:[c?t.jsx("span",{className:m,children:c}):null,s?t.jsx("div",{className:f,children:s}):null]})}const Ye=({title:e,copiedTitle:n,tooltip:s,icon:r,copiedIcon:a,className:l,buttonTextClassName:c,onClick:i})=>{const[u,x]=p.useState(!1),m=p.useRef(null),f=()=>{i(),x(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{x(!1)},1e3)};return p.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),t.jsxs("div",{className:"relative w-fit",children:[t.jsx(Q,{title:u?n:e,isSmallButton:!0,disabled:u,buttonClassName:L(["text-button-tertiary small-icon-button !h-6 !p-0",l]),textClassName:L(["ml-1",c]),onClick:f,iconBefore:u?a:r}),s&&u&&t.jsx("div",{className:"h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow",children:s})]})};function qe({id:e,label:n,hasChildren:s,showDragHandle:r,showCheckbox:a,isChecked:l,isExpanded:c}){return t.jsxs("div",{className:"relative cursor-grabbing rounded bg-neutrals-200 shadow",children:[t.jsx("div",{className:"absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light"}),t.jsxs("div",{className:"flex items-stretch overflow-hidden rounded",children:[r?t.jsx("div",{className:"flex w-6 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:"rounded p-1",children:t.jsx(D.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[a?t.jsx(V,{id:e,checked:!!l,className:"p-0"}):null,t.jsx("span",{className:"body-3 truncate",children:n})]}),s?t.jsx("div",{className:"flex w-8 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:h("transition-transform",c?"rotate-90":"rotate-0"),children:t.jsx(D.IconChevronRight,{size:16})})}):null]})]})}function te(e,n){return`i:${[...e,n].join("/")}`}function H(e){if(!e.startsWith("i:"))return null;const s=e.slice(2).split("/").filter(Boolean);return s.length?{parentPath:s.slice(0,-1),itemId:s[s.length-1]}:null}function Be(e,n,s){const r=se(e,n);return r?r.find(a=>a.id===s)??null:null}function ne(e,n){if(n.length===0)return e;const[s,...r]=n,a=e.find(l=>l.id===s);return a?.items?ne(a.items,r):null}function se(e,n){const s=ne(e,n);return s?s.filter(r=>r.type==="item"):null}function re(e,n,s){if(n.length===0)return s(e);const[r,...a]=n;return e.map(l=>l.id!==r||!l.items?l:{...l,items:re(l.items,a,s)})}function ze({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:a,onItemClick:l,onToggleExpanded:c,onToggleChecked:i}){const u=!!n.items?.length,x=!!n.isExpanded,m=n.isDisabled?!1:n.draggable??!0,f=n.isDisabled?!1:n.checkable??!0,v=te(e,n.id),{attributes:j,listeners:C,setNodeRef:b,setActivatorNodeRef:d,transform:o,transition:g,isDragging:w}=Y.useSortable({id:v,disabled:!m}),S={transform:ce.CSS.Transform.toString(o),transition:g,opacity:w?.6:void 0},y=!!n.isDisabled,E=y||!f,R=[...e,n.id];return t.jsxs("div",{ref:b,style:S,className:h(["group flex items-stretch overflow-hidden rounded bg-white","select-none",y?"opacity-50":""]),children:[s?t.jsx("div",{className:h(["group/drag-handle flex w-6 items-center justify-center rounded",y?"":"hover:bg-neutrals-100 cursor-grab"]),children:t.jsx("span",{ref:d,"aria-hidden":!0,className:h(["rounded p-1",m?"cursor-grab":"cursor-default","transition-opacity"]),...m?C:{},...m?j:{},children:t.jsx(D.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:y,"aria-disabled":E,onClick:k=>{E||l?.({itemId:n.id,path:R,nativeEvent:k})},className:h(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",y?"":"hover:bg-neutrals-100",y?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(V,{id:`draggable-list-${R.join("-")}`,checked:!!n.isChecked,disabled:!f,className:"p-0",stopPropagation:!0,onChange:(k,I)=>i?.({itemId:n.id,path:R,nextChecked:!!I})}):null,t.jsx("span",{className:"body-3 truncate text-neutrals-800",children:a?a(n):n.label})]}),u?t.jsx("button",{type:"button",disabled:y,onClick:k=>{k.stopPropagation(),c?.({itemId:n.id,path:R,nextExpanded:!x})},"aria-label":x?"Collapse":"Expand",className:h(["flex w-8 items-center justify-center rounded",y?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:h("transition-transform duration-150 ease-out",x?"rotate-90":"rotate-0"),children:t.jsx(D.IconChevronRight,{size:16})})}):null]})}function Ge({items:e,showDragHandle:n=!0,showCheckbox:s=!0,onItemsChange:r,onToggleExpanded:a,onToggleChecked:l,onItemClick:c,renderLabel:i}){const u=M.useSensors(M.useSensor(M.PointerSensor,{activationConstraint:{distance:6}})),[x,m]=ue.useState(null),f=C=>{const b=String(C.active.id),d=H(b);if(!d)return;const o=Be(e,d.parentPath,d.itemId);!o||o.type!=="item"||m({id:b,label:o.label,hasChildren:!!o.items?.length,isChecked:o.isChecked,isExpanded:o.isExpanded})},v=C=>{m(null);const b=C.over;if(!b)return;const d=H(String(C.active.id)),o=H(String(b.id));if(!d||!o||d.parentPath.join("/")!==o.parentPath.join("/"))return;const g=se(e,d.parentPath);if(!g)return;const w=g.findIndex(E=>E.id===d.itemId),S=g.findIndex(E=>E.id===o.itemId);if(w===-1||S===-1||w===S)return;const y=re(e,d.parentPath,E=>{const R=E.filter(_=>_.type==="item"),k=Y.arrayMove(R,w,S);let I=0;return E.map(_=>{if(_.type!=="item")return _;const z=k[I];return I+=1,z})});r(y)},j=(C,b=[])=>{const d=C.filter(o=>o.type==="item").map(o=>te(b,o.id));return t.jsx(Y.SortableContext,{items:d,strategy:Y.verticalListSortingStrategy,children:t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:C.map(o=>o.type==="group"?t.jsxs("li",{className:"m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",children:[t.jsxs("div",{className:"h5 flex items-center gap-2 py-1 text-neutrals-1000",children:[t.jsx(D.IconDatabase,{size:12,className:"shrink-0"}),o.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:j(o.items,[...b,o.id])})]},o.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(ze,{parentPath:b,item:o,showDragHandle:n,showCheckbox:s,renderLabel:i,onItemClick:c,onToggleExpanded:a,onToggleChecked:l}),o.items?.length&&o.isExpanded?t.jsx("div",{className:"pl-7",children:j(o.items,[...b,o.id])}):null]},o.id))})})};return t.jsxs(M.DndContext,{sensors:u,collisionDetection:M.closestCenter,onDragStart:f,onDragEnd:v,children:[t.jsx("div",{className:"flex flex-col",children:j(e)}),t.jsx(M.DragOverlay,{children:x?t.jsx(qe,{id:x.id,label:x.label,hasChildren:x.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:x.isChecked,isExpanded:x.isExpanded}):null})]})}const He=(e,n)=>e.label.toLowerCase().includes(n);function We(e,n,s={}){const r=Ue(n);if(!r)return e;const{expandMatchedBranches:a=!0,includeGroupDescendantsOnMatch:l=!0,includeItemDescendantsOnMatch:c=!1,match:i=He}=s;return $(e,r,{expandMatchedBranches:a,includeGroupDescendantsOnMatch:l,includeItemDescendantsOnMatch:c,match:i})??[]}function $(e,n,s){const r=[];for(const a of e){const l=$e(a,n,s);l&&r.push(l)}return r.length?r:null}function $e(e,n,s){const r=s.match(e,n);if(e.type==="group"){if(r&&s.includeGroupDescendantsOnMatch)return B(e,s.expandMatchedBranches);const c=e.items?.length?$(e.items,n,s):null;return!r&&!c?null:{...e,items:c??[]}}const a=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return B(e,s.expandMatchedBranches);if(!r&&!a)return null;const l={...e};return a?(l.items=a,s.expandMatchedBranches&&(l.isExpanded=!0)):delete l.items,l}function B(e,n){return e.type==="group"?{...e,items:e.items.map(s=>B(s,n))}:{...e,isExpanded:n&&e.items?.length?!0:e.isExpanded,items:e.items?.map(s=>B(s,n))}}function Ue(e){return e.trim().toLowerCase()}var ae=(e=>(e.Enter="Enter",e))(ae||{});const le=p.createContext(null);function Ve({children:e,isAgentAvailable:n}){const s=p.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(le.Provider,{value:s,children:e})}function Ke(){const e=p.useContext(le);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=Ve;exports.Alert=me;exports.AlertType=O;exports.Button=Q;exports.CALENDAR_MOBILE_PADDING=X;exports.Calendar=be;exports.Checkbox=V;exports.CloseButton=U;exports.CollapsibleBlock=je;exports.CopyButton=Ye;exports.DownloadFormatMessage=Re;exports.DraggableList=Ge;exports.Dropdown=De;exports.HighlightText=Ne;exports.IconButton=we;exports.InlineAlert=Pe;exports.InlineAlertProvider=Ae;exports.InlineAlertType=T;exports.Input=J;exports.InputWithIcon=Ce;exports.KeyboardKey=ae;exports.Link=ve;exports.Loader=K;exports.PopUpSize=q;exports.PopUpState=F;exports.Popup=Se;exports.Radio=Ee;exports.RequestLimitMessage=Oe;exports.SERIES_LIMIT=W;exports.TREE_NODE_ARROW_SIZE=pe;exports.TREE_NODE_PADDING=ge;exports.Tag=ye;exports.filterDraggableListNodes=We;exports.useAgentAvailability=Ke;exports.useDebounce=fe;exports.useIsMobile=Z;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),p=require("react"),f=require("classnames"),D=require("@tabler/icons-react"),ie=require("tailwind-merge"),oe=require("react-flatpickr"),P=require("@epam/statgpt-shared-toolkit"),N=require("@floating-ui/react"),M=require("@dnd-kit/core"),Y=require("@dnd-kit/sortable"),ce=require("@dnd-kit/utilities");function de(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return n.default=e,Object.freeze(n)}const ue=de(p),U=({title:e,btnClassNames:n,iconWidth:s,iconHeight:r,onClick:a})=>t.jsx("button",{type:"button","aria-label":"button",className:n,title:e,onClick:a,children:t.jsx(D.IconX,{height:r||20,width:s||20})});var O=(e=>(e.INFO="info",e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(O||{});const xe=3e4,me=({alertDetails:e,infoIcon:n,successIcon:s,errorIcon:r,onClose:a,closeButtonTitle:l,children:c})=>{const i=e?.type,x=i===O.IN_PROGRESS||i===O.INFO,d=()=>x?"alert-in-progress":i===O.SUCCESS?"alert-success":"alert-error",h=x?n:i===O.SUCCESS?s:i===O.ERROR?r:null,m=e?.text;return p.useEffect(()=>{if(!e||x)return;const C=setTimeout(()=>{a?.()},xe);return()=>clearTimeout(C)},[e,x,a]),t.jsx("div",{className:f("alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",d()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[h&&t.jsx("div",{className:"alert-icon",children:h}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx("h3",{className:"alert-title truncate",children:e?.title}),c??(m&&t.jsx("div",{className:"alert-text whitespace-pre-line break-words",title:m,children:m}))]}),t.jsx(U,{title:l,onClick:a})]})})},K=()=>t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx("div",{className:"loader"})}),he=ie.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function L(...e){return he(f(...e))}const Q=({buttonClassName:e,textClassName:n,isLoading:s=!1,title:r,disabled:a,iconAfter:l,iconBefore:c,onClick:i,isSmallButton:x})=>{const d=L([x?"font-semibold":"",l?"mr-2":"",c?"ml-2":"",n]);return t.jsxs("button",{type:"button",className:f("base-button",e,x?"small-button":""),disabled:a||s,"aria-label":"button",onClick:h=>i?.(h),title:r,children:[c,s&&t.jsx(K,{}),r?x?t.jsx("h4",{className:d,children:r}):t.jsx("h3",{className:d,children:r}):null,l]})};function Z(e=719){const[n,s]=p.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return p.useEffect(()=>{const r=window.matchMedia(`(max-width: ${e}px)`),a=l=>{s(l.matches)};return s(r.matches),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[e]),n}function fe(e,n){const s=p.useRef(null);return p.useCallback((...a)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...a)},n)},[e,n])}const pe=24,ge=24,W=1e3,X=24,be=({label:e,onChange:n,value:s,options:r,calendarResolution:a=P.CalendarResolution.DAY,id:l,icon:c,isEndDate:i})=>{const x=p.useRef(null),d=Z();p.useEffect(()=>{const j=x?.current;j&&j.querySelector("input")?.setAttribute("aria-label",e)},[e]);const h={...r,disableMobile:!0,defaultDate:a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},m=(j,v,b)=>{const u=`calendar__${a===P.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(u)},C=(j,v,b)=>{if(a===P.CalendarResolution.MONTH&&j.length>0){const u=r.minDate,o=r.maxDate,g=j[0].getFullYear(),w=b.calendarContainer,S="flatpickr-disabled",y=w.querySelectorAll(".flatpickr-monthSelect-month"),E=w.querySelectorAll(".flatpickr-next-month")[0],R=w.querySelectorAll(".flatpickr-prev-month")[0];g===o.getFullYear()&&E.classList.add(S),g===u.getFullYear()&&R.classList.add(S),(g===u.getFullYear()||g===o.getFullYear())&&y.forEach(k=>{k.classList.remove(S);const I=new Date(k.getAttribute("aria-label")),_=I.getFullYear()===u.getFullYear()&&I.getMonth()===u.getMonth(),z=I.getFullYear()===o.getFullYear()&&I.getMonth()===o.getMonth();_||z||(I<u||I>o)&&k.classList.add(S)})}setTimeout(()=>{const u=b.calendarContainer,o=b._input?.getBoundingClientRect();u&&(u.style.top=`${o.top-u.offsetHeight-8}px`,u.style.width=`${u.style.width}px`,i?(u.style.right=`${window.innerWidth-o.right-(d?X:0)}px`,u.style.left="auto"):u.style.left=`${o.left}px`)},0)};return t.jsxs("div",{className:"calendar relative",ref:x,children:[t.jsx("div",{className:"calendar-title mb-1",children:e}),t.jsx("label",{htmlFor:l,className:"absolute right-[11px] top-[29px] cursor-pointer",children:c||t.jsx(D.IconCalendarEvent,{})}),t.jsx(oe,{defaultValue:(a===P.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:h,onChange:j=>{n(j[0])},onOpen:[C],onReady:[m],id:l})]})},V=({label:e,id:n,checked:s,checkboxIcon:r,onChange:a,disabled:l=!1,className:c,stopPropagation:i=!0})=>{const x=p.useCallback(m=>{i&&m.stopPropagation()},[i]),d=p.useCallback(m=>{i&&m.stopPropagation(),a?.(n,m.target.checked)},[a,n,i]),h=()=>{if(s)return r||t.jsx(D.IconSquareCheckFilled,{className:"absolute size-4"})};return t.jsxs("label",{htmlFor:n,onClick:x,className:L("flex min-w-0 items-center py-1 shrink-0",l?"cursor-not-allowed opacity-50":"cursor-pointer",c),children:[t.jsx("span",{className:f("checkbox-button relative flex size-[14px] items-center justify-center"),"aria-hidden":!0,children:h()}),e?t.jsx("p",{className:f("checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"),title:e,children:e}):null,t.jsx("input",{id:n,type:"checkbox",checked:s,disabled:l,onChange:d,className:"hidden"})]})},je=({title:e,icon:n,children:s,value:r})=>{const[a,l]=p.useState(!1);return t.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${a?"collapsible-block-open":""}`,children:[t.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>l(!a),children:[t.jsx("div",{className:`${a?"rotate-180":""} transition-transform`,children:n||t.jsx(D.IconChevronDown,{className:"mr-3 size-5"})}),t.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[t.jsx("span",{children:e}),r&&t.jsx("p",{className:"body-1 text-neutrals-800",children:r})]})]}),a&&t.jsx("div",{className:"collapsible-block-content pb-4",children:s})]})},Ne=({text:e,highlightText:n})=>{const s=p.useMemo(()=>{const r=[];if(!n)return[{id:0,text:e,highlight:!1}];const a=n?.toLowerCase()||"",l=e?.toLowerCase()?.split(a)||"";for(let c=0,i=0;c<l?.length;c++){const x=l?.[c],d=x.length;x!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(i,i+d)}),i+=d,c!==l?.length-1&&(r.push({id:r.length,highlight:!0,text:e?.substring(i,i+n.length)}),i+=n.length)}return r},[n,e]);return t.jsx(t.Fragment,{children:s.map(r=>t.jsx("span",{className:f(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},we=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:a,isBaseIconStyles:l=!0})=>t.jsx("button",{type:"button",className:f(l&&"base-icon-button",s),onClick:c=>n?.(c),disabled:r,title:a,"aria-label":"button",children:e}),J=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:a="text",disabled:l,readonly:c,onChange:i,onKeyDown:x,onFocus:d,onBlur:h})=>{const m=f("truncate outline-none shadow-none body-1",r,c?"pointer-events-none":"");return t.jsx("input",{type:a,autoComplete:"off",id:n,placeholder:s,value:e||"",title:e?String(e):"",disabled:l,className:m,onKeyDown:x,onFocus:d,onBlur:h,onChange:C=>i?.(C.currentTarget.value)})},Ce=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...a})=>t.jsxs("div",{className:f("input w-full flex flex-row",s),children:[e,t.jsx(J,{cssClass:f("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...a}),n]}),ve=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:a})=>{const l=f(a?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:f("base-link",s),title:n,children:[r,t.jsx("span",{className:l,children:n}),a]})},ye=({title:e,text:n,disabled:s,onClick:r})=>t.jsx("button",{type:"button",className:f("tag flex items-center justify-center","disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"),disabled:s,onClick:()=>r?.(n||e),"aria-label":"button",children:t.jsx("h4",{children:e})}),Ee=({label:e,id:n,checked:s,radioIcon:r,description:a,onChange:l})=>{const c=p.useCallback(i=>{i.stopPropagation(),l?.(n,i.target.checked)},[l,n]);return t.jsxs("label",{className:"flex min-w-0 cursor-pointer flex-col py-[6px]",htmlFor:n,children:[t.jsxs("p",{className:"radio-label flex min-w-0 items-center",children:[t.jsx("span",{className:f("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",s?"radio-button-active":""),children:s&&r}),e&&t.jsx("span",{className:"radio-title body-1 min-w-0 flex-1 truncate pr-2 text-neutrals-1000",title:e,children:e})]}),a&&t.jsx("span",{className:"radio-description body-2 ml-6 flex w-auto items-center text-neutrals-800",title:a,children:a}),t.jsx("input",{type:"radio",onChange:c,id:n,checked:s,className:"hidden"})]})};var F=(e=>(e.Closed="Closed",e.Opened="Opened",e))(F||{}),q=(e=>(e.LG="Large",e.SM="Small",e))(q||{});const Ie=({portalId:e,state:n=F.Opened,heading:s,size:r,onClose:a,children:l,overlayClassName:c,containerClassName:i,dividers:x=!0,closeButtonTitle:d})=>{const{refs:h,context:m}=N.useFloating({open:n!==F.Closed&&!!n,onOpenChange:a}),C=N.useRole(m,{role:"dialog"}),j=N.useDismiss(m,{outsidePress:!0}),{getFloatingProps:v}=N.useInteractions([C,j]),b=p.useCallback(u=>{u?.preventDefault(),u?.stopPropagation(),a()},[a]);return t.jsx(N.FloatingPortal,{id:e,children:n!==F.Closed&&t.jsx(N.FloatingOverlay,{className:f("z-modal flex items-center justify-center bg-blackout p-4",c),children:t.jsx(N.FloatingFocusManager,{context:m,children:t.jsxs("div",{className:f("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",r===q.LG&&"max-w-[65%]",r===q.SM&&"max-w-[30%]",x&&"divide-neutrals-400 divide-y",i,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:h.setFloating,...v({onClick(u){u.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:d,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),l.map(u=>u)]})})})})},Se=e=>e.state===F.Closed?null:t.jsx(Ie,{...e}),G="statgpt-dropdown-open",A=8,ke={name:"keepDropdownWithinViewport",fn({y:e,rects:n}){if(typeof window>"u")return{};const s=document.documentElement.clientHeight||window.innerHeight,r=Math.min(n.floating.height,Math.max(0,s-A*2)),a=A,l=s-r-A;return{y:Math.min(Math.max(e,a),Math.max(a,l))}}},De=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:a,containerClassName:l,openedClassName:c,onOptionSelect:i})=>{const x=p.useId(),[d,h]=p.useState(!1),{refs:m,floatingStyles:C,context:j}=N.useFloating({open:d,onOpenChange:a?void 0:h,placement:"bottom-end",strategy:"fixed",middleware:[N.offset(A),N.flip({padding:A}),N.size({padding:A,apply({availableHeight:g,elements:w}){w.floating.style.maxHeight=`${Math.max(0,g)}px`}}),N.shift({padding:A}),ke],whileElementsMounted:N.autoUpdate}),v=N.useClick(j),b=N.useDismiss(j,{outsidePress:!0}),{getReferenceProps:u,getFloatingProps:o}=N.useInteractions([v,b]);return p.useEffect(()=>{d&&window.dispatchEvent(new CustomEvent(G,{detail:x}))},[x,d]),p.useEffect(()=>{const g=w=>{w instanceof CustomEvent&&w.detail!==x&&h(!1)};return window.addEventListener(G,g),()=>{window.removeEventListener(G,g)}},[x]),p.useEffect(()=>{a&&h(!1)},[a]),t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:m.setReference,...u({onClick(g){g.stopPropagation()}}),className:f(l,d&&c),children:e}),d&&t.jsx(N.FloatingPortal,{children:t.jsxs("div",{ref:m.setFloating,style:{...C,overflowY:"auto"},className:"dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",...o(),children:[s&&s,n&&n.map(g=>t.jsx("div",{onClick:w=>{w.stopPropagation(),i?.(g.key),h(!1)},className:f("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===g.key&&"bg-hues-100"),children:t.jsxs("div",{className:"dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",title:g.title,children:[g.icon?g.icon:null,t.jsx("p",{children:g?.title})]})},g.key))]})})]})},Re=({limitMessages:e,query:n})=>t.jsxs("div",{className:"flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1",children:[t.jsx("div",{className:"flex gap-x-[4px]",children:t.jsx("div",{className:"flex flex-col",children:t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:"h5 text-primary",children:[e?.excelFormatTitle," "]}),t.jsx("span",{className:"body-3 text-neutrals-800",children:e?.excelFormatText})]})})}),t.jsx("a",{href:n,target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),Oe=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:a})=>t.jsxs("div",{className:f("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",e?.containerClassName),children:[t.jsxs("div",{className:"flex items-center gap-x-2",children:[t.jsx("span",{children:e?.warningIcon}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex gap-x-[4px]",children:[t.jsxs("span",{className:f("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:f("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(W):e?.showingLimit?.(W)})]}),n&&t.jsx("span",{className:f("text-neutrals-800 body-3",e?.limitMessageClassName),children:e?.fullLimitMessage})]})]}),s&&t.jsxs("span",{onClick:()=>r?.(),className:"h4 flex cursor-pointer items-center gap-x-[4px] text-primary",children:[e?.editIcon,e?.refineInAdvancedView]}),n&&t.jsx("a",{href:a||"",target:"_blank",rel:"noreferrer",children:t.jsxs("span",{className:"body-3 flex cursor-pointer items-center gap-x-[4px]",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),ee=p.createContext(null);function Ae({value:e,children:n}){const s=p.useMemo(()=>e??{},[e]);return t.jsx(ee.Provider,{value:s,children:n})}function Le(){return p.useContext(ee)}var T=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e.Note="note",e))(T||{});const _e={[T.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[T.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[T.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000",[T.Note]:"border-hues-900 bg-neutrals-200 text-neutrals-1000"},Me="shrink-0",Te="min-w-0 body-2",Fe="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function Pe({type:e,icon:n,children:s,className:r,contentClassName:a}){const l=Le(),c=n??l?.icons?.[e],i=l?.classes?.container??Fe,x=l?.classes?.types?.[e]??_e[e],d=L(i,x,r),h=L(Me,l?.classes?.icon),m=L(Te,l?.classes?.content,a);return t.jsxs("div",{"data-type":e,className:d,children:[c?t.jsx("span",{className:h,children:c}):null,s?t.jsx("div",{className:m,children:s}):null]})}const Ye=({title:e,copiedTitle:n,tooltip:s,hoverTooltip:r,icon:a,copiedIcon:l,className:c,buttonTextClassName:i,onClick:x})=>{const[d,h]=p.useState(!1),m=p.useRef(null),C=()=>{x(),h(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{h(!1)},1e3)};return p.useEffect(()=>()=>{m.current&&clearTimeout(m.current)},[]),t.jsxs("div",{className:"relative w-fit",title:r,children:[t.jsx(Q,{title:d?n:e,isSmallButton:!0,disabled:d,buttonClassName:L(["text-button-tertiary small-icon-button !h-6 !p-0",c]),textClassName:L(["ml-1",i]),onClick:C,iconBefore:d?l:a}),s&&d&&t.jsx("div",{className:"h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow",children:s})]})};function qe({id:e,label:n,hasChildren:s,showDragHandle:r,showCheckbox:a,isChecked:l,isExpanded:c}){return t.jsxs("div",{className:"relative cursor-grabbing rounded bg-neutrals-200 shadow",children:[t.jsx("div",{className:"absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light"}),t.jsxs("div",{className:"flex items-stretch overflow-hidden rounded",children:[r?t.jsx("div",{className:"flex w-6 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:"rounded p-1",children:t.jsx(D.IconGripVertical,{size:16})})}):null,t.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 p-1",children:[a?t.jsx(V,{id:e,checked:!!l,className:"p-0"}):null,t.jsx("span",{className:"body-3 truncate",children:n})]}),s?t.jsx("div",{className:"flex w-8 items-center justify-center",children:t.jsx("span",{"aria-hidden":!0,className:f("transition-transform",c?"rotate-90":"rotate-0"),children:t.jsx(D.IconChevronRight,{size:16})})}):null]})]})}function te(e,n){return`i:${[...e,n].join("/")}`}function H(e){if(!e.startsWith("i:"))return null;const s=e.slice(2).split("/").filter(Boolean);return s.length?{parentPath:s.slice(0,-1),itemId:s[s.length-1]}:null}function Be(e,n,s){const r=se(e,n);return r?r.find(a=>a.id===s)??null:null}function ne(e,n){if(n.length===0)return e;const[s,...r]=n,a=e.find(l=>l.id===s);return a?.items?ne(a.items,r):null}function se(e,n){const s=ne(e,n);return s?s.filter(r=>r.type==="item"):null}function re(e,n,s){if(n.length===0)return s(e);const[r,...a]=n;return e.map(l=>l.id!==r||!l.items?l:{...l,items:re(l.items,a,s)})}function ze({parentPath:e,item:n,showDragHandle:s,showCheckbox:r,renderLabel:a,onItemClick:l,onToggleExpanded:c,onToggleChecked:i}){const x=!!n.items?.length,d=!!n.isExpanded,h=n.isDisabled?!1:n.draggable??!0,m=n.isDisabled?!1:n.checkable??!0,C=te(e,n.id),{attributes:j,listeners:v,setNodeRef:b,setActivatorNodeRef:u,transform:o,transition:g,isDragging:w}=Y.useSortable({id:C,disabled:!h}),S={transform:ce.CSS.Transform.toString(o),transition:g,opacity:w?.6:void 0},y=!!n.isDisabled,E=y||!m,R=[...e,n.id];return t.jsxs("div",{ref:b,style:S,className:f(["group flex items-stretch overflow-hidden rounded bg-white","select-none",y?"opacity-50":""]),children:[s?t.jsx("div",{className:f(["group/drag-handle flex w-6 items-center justify-center rounded",y?"":"hover:bg-neutrals-100 cursor-grab"]),children:t.jsx("span",{ref:u,"aria-hidden":!0,className:f(["rounded p-1",h?"cursor-grab":"cursor-default","transition-opacity"]),...h?v:{},...h?j:{},children:t.jsx(D.IconGripVertical,{size:16,className:"text-neutrals-800 group-hover/drag-handle:text-primary"})})}):null,t.jsxs("button",{type:"button",disabled:y,"aria-disabled":E,onClick:k=>{E||l?.({itemId:n.id,path:R,nativeEvent:k})},className:f(["flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",y?"":"hover:bg-neutrals-100",y?"":"hover:text-blue-700","focus:outline-none"]),children:[r?t.jsx(V,{id:`draggable-list-${R.join("-")}`,checked:!!n.isChecked,disabled:!m,className:"p-0",stopPropagation:!0,onChange:(k,I)=>i?.({itemId:n.id,path:R,nextChecked:!!I})}):null,t.jsx("span",{className:"body-3 truncate text-neutrals-800",children:a?a(n):n.label})]}),x?t.jsx("button",{type:"button",disabled:y,onClick:k=>{k.stopPropagation(),c?.({itemId:n.id,path:R,nextExpanded:!d})},"aria-label":d?"Collapse":"Expand",className:f(["flex w-8 items-center justify-center rounded",y?"":"hover:bg-neutrals-100","focus:outline-none"]),children:t.jsx("span",{"aria-hidden":!0,className:f("transition-transform duration-150 ease-out",d?"rotate-90":"rotate-0"),children:t.jsx(D.IconChevronRight,{size:16})})}):null]})}function Ge({items:e,showDragHandle:n=!0,showCheckbox:s=!0,onItemsChange:r,onToggleExpanded:a,onToggleChecked:l,onItemClick:c,renderLabel:i}){const x=M.useSensors(M.useSensor(M.PointerSensor,{activationConstraint:{distance:6}})),[d,h]=ue.useState(null),m=v=>{const b=String(v.active.id),u=H(b);if(!u)return;const o=Be(e,u.parentPath,u.itemId);!o||o.type!=="item"||h({id:b,label:o.label,hasChildren:!!o.items?.length,isChecked:o.isChecked,isExpanded:o.isExpanded})},C=v=>{h(null);const b=v.over;if(!b)return;const u=H(String(v.active.id)),o=H(String(b.id));if(!u||!o||u.parentPath.join("/")!==o.parentPath.join("/"))return;const g=se(e,u.parentPath);if(!g)return;const w=g.findIndex(E=>E.id===u.itemId),S=g.findIndex(E=>E.id===o.itemId);if(w===-1||S===-1||w===S)return;const y=re(e,u.parentPath,E=>{const R=E.filter(_=>_.type==="item"),k=Y.arrayMove(R,w,S);let I=0;return E.map(_=>{if(_.type!=="item")return _;const z=k[I];return I+=1,z})});r(y)},j=(v,b=[])=>{const u=v.filter(o=>o.type==="item").map(o=>te(b,o.id));return t.jsx(Y.SortableContext,{items:u,strategy:Y.verticalListSortingStrategy,children:t.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:v.map(o=>o.type==="group"?t.jsxs("li",{className:"m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",children:[t.jsxs("div",{className:"h5 flex items-center gap-2 py-1 text-neutrals-1000",children:[t.jsx(D.IconDatabase,{size:12,className:"shrink-0"}),o.label]}),t.jsx("div",{className:"border-l border-neutrals-600 pl-2",children:j(o.items,[...b,o.id])})]},o.id):t.jsxs("li",{className:"m-0 flex flex-col gap-2 p-0",children:[t.jsx(ze,{parentPath:b,item:o,showDragHandle:n,showCheckbox:s,renderLabel:i,onItemClick:c,onToggleExpanded:a,onToggleChecked:l}),o.items?.length&&o.isExpanded?t.jsx("div",{className:"pl-7",children:j(o.items,[...b,o.id])}):null]},o.id))})})};return t.jsxs(M.DndContext,{sensors:x,collisionDetection:M.closestCenter,onDragStart:m,onDragEnd:C,children:[t.jsx("div",{className:"flex flex-col",children:j(e)}),t.jsx(M.DragOverlay,{children:d?t.jsx(qe,{id:d.id,label:d.label,hasChildren:d.hasChildren,showDragHandle:n,showCheckbox:s,isChecked:d.isChecked,isExpanded:d.isExpanded}):null})]})}const He=(e,n)=>e.label.toLowerCase().includes(n);function We(e,n,s={}){const r=Ue(n);if(!r)return e;const{expandMatchedBranches:a=!0,includeGroupDescendantsOnMatch:l=!0,includeItemDescendantsOnMatch:c=!1,match:i=He}=s;return $(e,r,{expandMatchedBranches:a,includeGroupDescendantsOnMatch:l,includeItemDescendantsOnMatch:c,match:i})??[]}function $(e,n,s){const r=[];for(const a of e){const l=$e(a,n,s);l&&r.push(l)}return r.length?r:null}function $e(e,n,s){const r=s.match(e,n);if(e.type==="group"){if(r&&s.includeGroupDescendantsOnMatch)return B(e,s.expandMatchedBranches);const c=e.items?.length?$(e.items,n,s):null;return!r&&!c?null:{...e,items:c??[]}}const a=e.items?.length?$(e.items,n,s):null;if(r&&s.includeItemDescendantsOnMatch)return B(e,s.expandMatchedBranches);if(!r&&!a)return null;const l={...e};return a?(l.items=a,s.expandMatchedBranches&&(l.isExpanded=!0)):delete l.items,l}function B(e,n){return e.type==="group"?{...e,items:e.items.map(s=>B(s,n))}:{...e,isExpanded:n&&e.items?.length?!0:e.isExpanded,items:e.items?.map(s=>B(s,n))}}function Ue(e){return e.trim().toLowerCase()}var ae=(e=>(e.Enter="Enter",e))(ae||{});const le=p.createContext(null);function Ve({children:e,isAgentAvailable:n}){const s=p.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx(le.Provider,{value:s,children:e})}function Ke(){const e=p.useContext(le);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=Ve;exports.Alert=me;exports.AlertType=O;exports.Button=Q;exports.CALENDAR_MOBILE_PADDING=X;exports.Calendar=be;exports.Checkbox=V;exports.CloseButton=U;exports.CollapsibleBlock=je;exports.CopyButton=Ye;exports.DownloadFormatMessage=Re;exports.DraggableList=Ge;exports.Dropdown=De;exports.HighlightText=Ne;exports.IconButton=we;exports.InlineAlert=Pe;exports.InlineAlertProvider=Ae;exports.InlineAlertType=T;exports.Input=J;exports.InputWithIcon=Ce;exports.KeyboardKey=ae;exports.Link=ve;exports.Loader=K;exports.PopUpSize=q;exports.PopUpState=F;exports.Popup=Se;exports.Radio=Ee;exports.RequestLimitMessage=Oe;exports.SERIES_LIMIT=W;exports.TREE_NODE_ARROW_SIZE=pe;exports.TREE_NODE_PADDING=ge;exports.Tag=ye;exports.filterDraggableListNodes=We;exports.useAgentAvailability=Ke;exports.useDebounce=fe;exports.useIsMobile=Z;
|
package/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as m, Fragment as q } from "react/jsx-runtime";
|
|
2
2
|
import * as ue from "react";
|
|
3
3
|
import { useEffect as O, useState as j, useRef as W, useCallback as P, useMemo as U, useId as me, createContext as Q, useContext as K } from "react";
|
|
4
|
-
import
|
|
4
|
+
import g from "classnames";
|
|
5
5
|
import { IconX as he, IconCalendarEvent as fe, IconSquareCheckFilled as pe, IconChevronDown as ge, IconGripVertical as X, IconChevronRight as Z, IconDatabase as xe } from "@tabler/icons-react";
|
|
6
6
|
import { extendTailwindMerge as be } from "tailwind-merge";
|
|
7
7
|
import Ne from "react-flatpickr";
|
|
@@ -37,31 +37,31 @@ const ze = 3e4, bt = ({
|
|
|
37
37
|
closeButtonTitle: a,
|
|
38
38
|
children: c
|
|
39
39
|
}) => {
|
|
40
|
-
const i = e?.type,
|
|
40
|
+
const i = e?.type, h = i === _.IN_PROGRESS || i === _.INFO, d = () => h ? "alert-in-progress" : i === _.SUCCESS ? "alert-success" : "alert-error", p = h ? t : i === _.SUCCESS ? n : i === _.ERROR ? s : null, f = e?.text;
|
|
41
41
|
return O(() => {
|
|
42
|
-
if (!e ||
|
|
42
|
+
if (!e || h)
|
|
43
43
|
return;
|
|
44
|
-
const
|
|
44
|
+
const v = setTimeout(() => {
|
|
45
45
|
l?.();
|
|
46
46
|
}, ze);
|
|
47
|
-
return () => clearTimeout(
|
|
48
|
-
}, [e,
|
|
47
|
+
return () => clearTimeout(v);
|
|
48
|
+
}, [e, h, l]), /* @__PURE__ */ r(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
51
|
-
className:
|
|
51
|
+
className: g(
|
|
52
52
|
"alert alert-shadow fixed bottom-3 right-3 z-10 w-[min(380px,calc(100vw-24px))] max-w-[calc(100vw-24px)]",
|
|
53
|
-
|
|
53
|
+
d()
|
|
54
54
|
),
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ m("div", { className: "alert-content flex items-start", children: [
|
|
56
|
+
p && /* @__PURE__ */ r("div", { className: "alert-icon", children: p }),
|
|
57
|
+
/* @__PURE__ */ m("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
58
58
|
/* @__PURE__ */ r("h3", { className: "alert-title truncate", children: e?.title }),
|
|
59
|
-
c ?? (
|
|
59
|
+
c ?? (f && /* @__PURE__ */ r(
|
|
60
60
|
"div",
|
|
61
61
|
{
|
|
62
62
|
className: "alert-text whitespace-pre-line break-words",
|
|
63
|
-
title:
|
|
64
|
-
children:
|
|
63
|
+
title: f,
|
|
64
|
+
children: f
|
|
65
65
|
}
|
|
66
66
|
))
|
|
67
67
|
] }),
|
|
@@ -87,7 +87,7 @@ const ze = 3e4, bt = ({
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
function F(...e) {
|
|
90
|
-
return $e(
|
|
90
|
+
return $e(g(...e));
|
|
91
91
|
}
|
|
92
92
|
const Ge = ({
|
|
93
93
|
buttonClassName: e,
|
|
@@ -98,31 +98,31 @@ const Ge = ({
|
|
|
98
98
|
iconAfter: a,
|
|
99
99
|
iconBefore: c,
|
|
100
100
|
onClick: i,
|
|
101
|
-
isSmallButton:
|
|
101
|
+
isSmallButton: h
|
|
102
102
|
}) => {
|
|
103
|
-
const
|
|
104
|
-
|
|
103
|
+
const d = F([
|
|
104
|
+
h ? "font-semibold" : "",
|
|
105
105
|
a ? "mr-2" : "",
|
|
106
106
|
c ? "ml-2" : "",
|
|
107
107
|
t
|
|
108
108
|
]);
|
|
109
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ m(
|
|
110
110
|
"button",
|
|
111
111
|
{
|
|
112
112
|
type: "button",
|
|
113
|
-
className:
|
|
113
|
+
className: g(
|
|
114
114
|
"base-button",
|
|
115
115
|
e,
|
|
116
|
-
|
|
116
|
+
h ? "small-button" : ""
|
|
117
117
|
),
|
|
118
118
|
disabled: l || n,
|
|
119
119
|
"aria-label": "button",
|
|
120
|
-
onClick: (
|
|
120
|
+
onClick: (p) => i?.(p),
|
|
121
121
|
title: s,
|
|
122
122
|
children: [
|
|
123
123
|
c,
|
|
124
124
|
n && /* @__PURE__ */ r(He, {}),
|
|
125
|
-
s ?
|
|
125
|
+
s ? h ? /* @__PURE__ */ r("h4", { className: d, children: s }) : /* @__PURE__ */ r("h3", { className: d, children: s }) : null,
|
|
126
126
|
a
|
|
127
127
|
]
|
|
128
128
|
}
|
|
@@ -160,39 +160,39 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
160
160
|
icon: c,
|
|
161
161
|
isEndDate: i
|
|
162
162
|
}) => {
|
|
163
|
-
const
|
|
163
|
+
const h = W(null), d = Be();
|
|
164
164
|
O(() => {
|
|
165
|
-
const N =
|
|
165
|
+
const N = h?.current;
|
|
166
166
|
N && N.querySelector("input")?.setAttribute("aria-label", e);
|
|
167
167
|
}, [e]);
|
|
168
|
-
const
|
|
168
|
+
const p = {
|
|
169
169
|
...s,
|
|
170
170
|
disableMobile: !0,
|
|
171
171
|
defaultDate: l === A.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n
|
|
172
|
-
},
|
|
173
|
-
const
|
|
174
|
-
b.calendarContainer && b.calendarContainer.classList.add(
|
|
175
|
-
},
|
|
172
|
+
}, f = (N, C, b) => {
|
|
173
|
+
const u = `calendar__${l === A.MONTH ? "month" : "day"}`;
|
|
174
|
+
b.calendarContainer && b.calendarContainer.classList.add(u);
|
|
175
|
+
}, v = (N, C, b) => {
|
|
176
176
|
if (l === A.MONTH && N.length > 0) {
|
|
177
|
-
const
|
|
177
|
+
const u = s.minDate, o = s.maxDate, x = N[0].getFullYear(), w = b.calendarContainer, S = "flatpickr-disabled", y = w.querySelectorAll(
|
|
178
178
|
".flatpickr-monthSelect-month"
|
|
179
179
|
), E = w.querySelectorAll(
|
|
180
180
|
".flatpickr-next-month"
|
|
181
181
|
)[0], D = w.querySelectorAll(
|
|
182
182
|
".flatpickr-prev-month"
|
|
183
183
|
)[0];
|
|
184
|
-
x === o.getFullYear() && E.classList.add(S), x ===
|
|
184
|
+
x === o.getFullYear() && E.classList.add(S), x === u.getFullYear() && D.classList.add(S), (x === u.getFullYear() || x === o.getFullYear()) && y.forEach((k) => {
|
|
185
185
|
k.classList.remove(S);
|
|
186
|
-
const I = new Date(k.getAttribute("aria-label")), R = I.getFullYear() ===
|
|
187
|
-
R || z || (I <
|
|
186
|
+
const I = new Date(k.getAttribute("aria-label")), R = I.getFullYear() === u.getFullYear() && I.getMonth() === u.getMonth(), z = I.getFullYear() === o.getFullYear() && I.getMonth() === o.getMonth();
|
|
187
|
+
R || z || (I < u || I > o) && k.classList.add(S);
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
setTimeout(() => {
|
|
191
|
-
const
|
|
192
|
-
|
|
191
|
+
const u = b.calendarContainer, o = b._input?.getBoundingClientRect();
|
|
192
|
+
u && (u.style.top = `${o.top - u.offsetHeight - 8}px`, u.style.width = `${u.style.width}px`, i ? (u.style.right = `${window.innerWidth - o.right - (d ? We : 0)}px`, u.style.left = "auto") : u.style.left = `${o.left}px`);
|
|
193
193
|
}, 0);
|
|
194
194
|
};
|
|
195
|
-
return /* @__PURE__ */
|
|
195
|
+
return /* @__PURE__ */ m("div", { className: "calendar relative", ref: h, children: [
|
|
196
196
|
/* @__PURE__ */ r("div", { className: "calendar-title mb-1", children: e }),
|
|
197
197
|
/* @__PURE__ */ r(
|
|
198
198
|
"label",
|
|
@@ -206,12 +206,12 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
206
206
|
Ne,
|
|
207
207
|
{
|
|
208
208
|
defaultValue: (l === A.MONTH ? new Date(n.getFullYear(), n.getMonth()) : n)?.toDateString(),
|
|
209
|
-
options:
|
|
209
|
+
options: p,
|
|
210
210
|
onChange: (N) => {
|
|
211
211
|
t(N[0]);
|
|
212
212
|
},
|
|
213
|
-
onOpen: [
|
|
214
|
-
onReady: [
|
|
213
|
+
onOpen: [v],
|
|
214
|
+
onReady: [f],
|
|
215
215
|
id: a
|
|
216
216
|
}
|
|
217
217
|
)
|
|
@@ -226,25 +226,25 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
226
226
|
className: c,
|
|
227
227
|
stopPropagation: i = !0
|
|
228
228
|
}) => {
|
|
229
|
-
const
|
|
230
|
-
(
|
|
231
|
-
i &&
|
|
229
|
+
const h = P(
|
|
230
|
+
(f) => {
|
|
231
|
+
i && f.stopPropagation();
|
|
232
232
|
},
|
|
233
233
|
[i]
|
|
234
|
-
),
|
|
235
|
-
(
|
|
236
|
-
i &&
|
|
234
|
+
), d = P(
|
|
235
|
+
(f) => {
|
|
236
|
+
i && f.stopPropagation(), l?.(t, f.target.checked);
|
|
237
237
|
},
|
|
238
238
|
[l, t, i]
|
|
239
|
-
),
|
|
239
|
+
), p = () => {
|
|
240
240
|
if (n)
|
|
241
241
|
return s || /* @__PURE__ */ r(pe, { className: "absolute size-4" });
|
|
242
242
|
};
|
|
243
|
-
return /* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ m(
|
|
244
244
|
"label",
|
|
245
245
|
{
|
|
246
246
|
htmlFor: t,
|
|
247
|
-
onClick:
|
|
247
|
+
onClick: h,
|
|
248
248
|
className: F(
|
|
249
249
|
"flex min-w-0 items-center py-1 shrink-0",
|
|
250
250
|
a ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
@@ -254,17 +254,17 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
254
254
|
/* @__PURE__ */ r(
|
|
255
255
|
"span",
|
|
256
256
|
{
|
|
257
|
-
className:
|
|
257
|
+
className: g(
|
|
258
258
|
"checkbox-button relative flex size-[14px] items-center justify-center"
|
|
259
259
|
),
|
|
260
260
|
"aria-hidden": !0,
|
|
261
|
-
children:
|
|
261
|
+
children: p()
|
|
262
262
|
}
|
|
263
263
|
),
|
|
264
264
|
e ? /* @__PURE__ */ r(
|
|
265
265
|
"p",
|
|
266
266
|
{
|
|
267
|
-
className:
|
|
267
|
+
className: g(
|
|
268
268
|
"checkbox-button-text text-neutrals-1000 min-w-0 ml-2 flex-1 truncate pr-2"
|
|
269
269
|
),
|
|
270
270
|
title: e,
|
|
@@ -278,7 +278,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
278
278
|
type: "checkbox",
|
|
279
279
|
checked: n,
|
|
280
280
|
disabled: a,
|
|
281
|
-
onChange:
|
|
281
|
+
onChange: d,
|
|
282
282
|
className: "hidden"
|
|
283
283
|
}
|
|
284
284
|
)
|
|
@@ -292,19 +292,19 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
292
292
|
value: s
|
|
293
293
|
}) => {
|
|
294
294
|
const [l, a] = j(!1);
|
|
295
|
-
return /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ m(
|
|
296
296
|
"div",
|
|
297
297
|
{
|
|
298
298
|
className: `collapsible-block flex flex-col border-t-2 border-neutrals-600 ${l ? "collapsible-block-open" : ""}`,
|
|
299
299
|
children: [
|
|
300
|
-
/* @__PURE__ */
|
|
300
|
+
/* @__PURE__ */ m(
|
|
301
301
|
"div",
|
|
302
302
|
{
|
|
303
303
|
className: "collapsible-block-title flex cursor-pointer items-center py-4",
|
|
304
304
|
onClick: () => a(!l),
|
|
305
305
|
children: [
|
|
306
306
|
/* @__PURE__ */ r("div", { className: `${l ? "rotate-180" : ""} transition-transform`, children: t || /* @__PURE__ */ r(ge, { className: "mr-3 size-5" }) }),
|
|
307
|
-
/* @__PURE__ */
|
|
307
|
+
/* @__PURE__ */ m("div", { className: "flex flex-1 items-center justify-between", children: [
|
|
308
308
|
/* @__PURE__ */ r("span", { children: e }),
|
|
309
309
|
s && /* @__PURE__ */ r("p", { className: "body-1 text-neutrals-800", children: s })
|
|
310
310
|
] })
|
|
@@ -322,15 +322,15 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
322
322
|
return [{ id: 0, text: e, highlight: !1 }];
|
|
323
323
|
const l = t?.toLowerCase() || "", a = e?.toLowerCase()?.split(l) || "";
|
|
324
324
|
for (let c = 0, i = 0; c < a?.length; c++) {
|
|
325
|
-
const
|
|
326
|
-
|
|
325
|
+
const h = a?.[c], d = h.length;
|
|
326
|
+
h !== "" && s.push({
|
|
327
327
|
id: s.length,
|
|
328
328
|
highlight: !1,
|
|
329
329
|
text: e?.substring(
|
|
330
330
|
i,
|
|
331
|
-
i +
|
|
331
|
+
i + d
|
|
332
332
|
)
|
|
333
|
-
}), i +=
|
|
333
|
+
}), i += d, c !== a?.length - 1 && (s.push({
|
|
334
334
|
id: s.length,
|
|
335
335
|
highlight: !0,
|
|
336
336
|
text: e?.substring(
|
|
@@ -344,7 +344,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
344
344
|
return /* @__PURE__ */ r(q, { children: n.map((s) => /* @__PURE__ */ r(
|
|
345
345
|
"span",
|
|
346
346
|
{
|
|
347
|
-
className:
|
|
347
|
+
className: g(s?.highlight && "bg-highlight"),
|
|
348
348
|
children: s?.text
|
|
349
349
|
},
|
|
350
350
|
s?.id
|
|
@@ -360,7 +360,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
360
360
|
"button",
|
|
361
361
|
{
|
|
362
362
|
type: "button",
|
|
363
|
-
className:
|
|
363
|
+
className: g(
|
|
364
364
|
a && "base-icon-button",
|
|
365
365
|
n
|
|
366
366
|
),
|
|
@@ -379,11 +379,11 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
379
379
|
disabled: a,
|
|
380
380
|
readonly: c,
|
|
381
381
|
onChange: i,
|
|
382
|
-
onKeyDown:
|
|
383
|
-
onFocus:
|
|
384
|
-
onBlur:
|
|
382
|
+
onKeyDown: h,
|
|
383
|
+
onFocus: d,
|
|
384
|
+
onBlur: p
|
|
385
385
|
}) => {
|
|
386
|
-
const
|
|
386
|
+
const f = g(
|
|
387
387
|
"truncate outline-none shadow-none body-1",
|
|
388
388
|
s,
|
|
389
389
|
c ? "pointer-events-none" : ""
|
|
@@ -398,11 +398,11 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
398
398
|
value: e || "",
|
|
399
399
|
title: e ? String(e) : "",
|
|
400
400
|
disabled: a,
|
|
401
|
-
className:
|
|
402
|
-
onKeyDown:
|
|
403
|
-
onFocus:
|
|
404
|
-
onBlur:
|
|
405
|
-
onChange: (
|
|
401
|
+
className: f,
|
|
402
|
+
onKeyDown: h,
|
|
403
|
+
onFocus: d,
|
|
404
|
+
onBlur: p,
|
|
405
|
+
onChange: (v) => i?.(v.currentTarget.value)
|
|
406
406
|
}
|
|
407
407
|
);
|
|
408
408
|
}, St = ({
|
|
@@ -411,12 +411,12 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
411
411
|
containerClasses: n,
|
|
412
412
|
cssClass: s,
|
|
413
413
|
...l
|
|
414
|
-
}) => /* @__PURE__ */
|
|
414
|
+
}) => /* @__PURE__ */ m("div", { className: g("input w-full flex flex-row", n), children: [
|
|
415
415
|
e,
|
|
416
416
|
/* @__PURE__ */ r(
|
|
417
417
|
Ue,
|
|
418
418
|
{
|
|
419
|
-
cssClass:
|
|
419
|
+
cssClass: g(
|
|
420
420
|
"border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",
|
|
421
421
|
s
|
|
422
422
|
),
|
|
@@ -431,17 +431,17 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
431
431
|
iconBefore: s,
|
|
432
432
|
iconAfter: l
|
|
433
433
|
}) => {
|
|
434
|
-
const a =
|
|
434
|
+
const a = g(
|
|
435
435
|
l ? "mr-2" : "",
|
|
436
436
|
s ? "ml-2" : ""
|
|
437
437
|
);
|
|
438
|
-
return /* @__PURE__ */
|
|
438
|
+
return /* @__PURE__ */ m(
|
|
439
439
|
"a",
|
|
440
440
|
{
|
|
441
441
|
href: e,
|
|
442
442
|
target: "_blank",
|
|
443
443
|
rel: "noopener noreferrer",
|
|
444
|
-
className:
|
|
444
|
+
className: g("base-link", n),
|
|
445
445
|
title: t,
|
|
446
446
|
children: [
|
|
447
447
|
s,
|
|
@@ -454,7 +454,7 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
454
454
|
"button",
|
|
455
455
|
{
|
|
456
456
|
type: "button",
|
|
457
|
-
className:
|
|
457
|
+
className: g(
|
|
458
458
|
"tag flex items-center justify-center",
|
|
459
459
|
"disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-neutrals-100"
|
|
460
460
|
),
|
|
@@ -477,17 +477,17 @@ const wt = 24, vt = 24, V = 1e3, We = 24, Ct = ({
|
|
|
477
477
|
},
|
|
478
478
|
[a, t]
|
|
479
479
|
);
|
|
480
|
-
return /* @__PURE__ */
|
|
480
|
+
return /* @__PURE__ */ m(
|
|
481
481
|
"label",
|
|
482
482
|
{
|
|
483
483
|
className: "flex min-w-0 cursor-pointer flex-col py-[6px]",
|
|
484
484
|
htmlFor: t,
|
|
485
485
|
children: [
|
|
486
|
-
/* @__PURE__ */
|
|
486
|
+
/* @__PURE__ */ m("p", { className: "radio-label flex min-w-0 items-center", children: [
|
|
487
487
|
/* @__PURE__ */ r(
|
|
488
488
|
"span",
|
|
489
489
|
{
|
|
490
|
-
className:
|
|
490
|
+
className: g(
|
|
491
491
|
"flex justify-center items-center w-4 h-4 mr-2 relative",
|
|
492
492
|
"radio-button",
|
|
493
493
|
n ? "radio-button-active" : ""
|
|
@@ -536,55 +536,55 @@ const Ve = ({
|
|
|
536
536
|
children: a,
|
|
537
537
|
overlayClassName: c,
|
|
538
538
|
containerClassName: i,
|
|
539
|
-
dividers:
|
|
540
|
-
closeButtonTitle:
|
|
539
|
+
dividers: h = !0,
|
|
540
|
+
closeButtonTitle: d
|
|
541
541
|
}) => {
|
|
542
|
-
const { refs:
|
|
542
|
+
const { refs: p, context: f } = J({
|
|
543
543
|
open: t !== T.Closed && !!t,
|
|
544
544
|
onOpenChange: l
|
|
545
|
-
}),
|
|
546
|
-
(
|
|
547
|
-
|
|
545
|
+
}), v = we(f, { role: "dialog" }), N = ee(f, { outsidePress: !0 }), { getFloatingProps: C } = te([v, N]), b = P(
|
|
546
|
+
(u) => {
|
|
547
|
+
u?.preventDefault(), u?.stopPropagation(), l();
|
|
548
548
|
},
|
|
549
549
|
[l]
|
|
550
550
|
);
|
|
551
551
|
return /* @__PURE__ */ r(ne, { id: e, children: t !== T.Closed && /* @__PURE__ */ r(
|
|
552
552
|
ve,
|
|
553
553
|
{
|
|
554
|
-
className:
|
|
554
|
+
className: g(
|
|
555
555
|
"z-modal flex items-center justify-center bg-blackout p-4",
|
|
556
556
|
c
|
|
557
557
|
),
|
|
558
|
-
children: /* @__PURE__ */ r(Ce, { context:
|
|
558
|
+
children: /* @__PURE__ */ r(Ce, { context: f, children: /* @__PURE__ */ m(
|
|
559
559
|
"div",
|
|
560
560
|
{
|
|
561
|
-
className:
|
|
561
|
+
className: g(
|
|
562
562
|
"relative max-h-full modal rounded bg-white flex flex-col shadow w-full",
|
|
563
563
|
s === G.LG && "max-w-[65%]",
|
|
564
564
|
s === G.SM && "max-w-[30%]",
|
|
565
|
-
|
|
565
|
+
h && "divide-neutrals-400 divide-y",
|
|
566
566
|
i,
|
|
567
567
|
"sm:w-full sm:max-w-full sm:px-4 sm:py-6"
|
|
568
568
|
),
|
|
569
|
-
ref:
|
|
570
|
-
...
|
|
571
|
-
onClick(
|
|
572
|
-
|
|
569
|
+
ref: p.setFloating,
|
|
570
|
+
...C({
|
|
571
|
+
onClick(u) {
|
|
572
|
+
u.stopPropagation();
|
|
573
573
|
}
|
|
574
574
|
}),
|
|
575
575
|
children: [
|
|
576
|
-
/* @__PURE__ */
|
|
576
|
+
/* @__PURE__ */ m("div", { className: "modal-heading mb-2 flex flex-row items-center justify-between px-6 py-3 sm:p-0 sm:pb-2", children: [
|
|
577
577
|
n && (typeof n == "string" ? /* @__PURE__ */ r("h2", { className: "modal-heading-title sm:h3 mr-3 min-w-0 flex-1", children: n }) : n),
|
|
578
578
|
/* @__PURE__ */ r(
|
|
579
579
|
re,
|
|
580
580
|
{
|
|
581
|
-
title:
|
|
581
|
+
title: d,
|
|
582
582
|
onClick: b,
|
|
583
583
|
btnClassNames: "sm:h-[24px] sm:w-[24px] sm:top-4"
|
|
584
584
|
}
|
|
585
585
|
)
|
|
586
586
|
] }),
|
|
587
|
-
a.map((
|
|
587
|
+
a.map((u) => u)
|
|
588
588
|
]
|
|
589
589
|
}
|
|
590
590
|
) })
|
|
@@ -613,9 +613,9 @@ const Ve = ({
|
|
|
613
613
|
openedClassName: c,
|
|
614
614
|
onOptionSelect: i
|
|
615
615
|
}) => {
|
|
616
|
-
const
|
|
617
|
-
open:
|
|
618
|
-
onOpenChange: l ? void 0 :
|
|
616
|
+
const h = me(), [d, p] = j(!1), { refs: f, floatingStyles: v, context: N } = J({
|
|
617
|
+
open: d,
|
|
618
|
+
onOpenChange: l ? void 0 : p,
|
|
619
619
|
placement: "bottom-end",
|
|
620
620
|
strategy: "fixed",
|
|
621
621
|
middleware: [
|
|
@@ -634,42 +634,42 @@ const Ve = ({
|
|
|
634
634
|
qe
|
|
635
635
|
],
|
|
636
636
|
whileElementsMounted: ye
|
|
637
|
-
}),
|
|
638
|
-
|
|
637
|
+
}), C = De(N), b = ee(N, { outsidePress: !0 }), { getReferenceProps: u, getFloatingProps: o } = te([
|
|
638
|
+
C,
|
|
639
639
|
b
|
|
640
640
|
]);
|
|
641
641
|
return O(() => {
|
|
642
|
-
|
|
643
|
-
new CustomEvent(H, { detail:
|
|
642
|
+
d && window.dispatchEvent(
|
|
643
|
+
new CustomEvent(H, { detail: h })
|
|
644
644
|
);
|
|
645
|
-
}, [
|
|
645
|
+
}, [h, d]), O(() => {
|
|
646
646
|
const x = (w) => {
|
|
647
|
-
w instanceof CustomEvent && w.detail !==
|
|
647
|
+
w instanceof CustomEvent && w.detail !== h && p(!1);
|
|
648
648
|
};
|
|
649
649
|
return window.addEventListener(H, x), () => {
|
|
650
650
|
window.removeEventListener(H, x);
|
|
651
651
|
};
|
|
652
|
-
}, [
|
|
653
|
-
l &&
|
|
654
|
-
}, [l]), /* @__PURE__ */
|
|
652
|
+
}, [h]), O(() => {
|
|
653
|
+
l && p(!1);
|
|
654
|
+
}, [l]), /* @__PURE__ */ m(q, { children: [
|
|
655
655
|
/* @__PURE__ */ r(
|
|
656
656
|
"div",
|
|
657
657
|
{
|
|
658
|
-
ref:
|
|
659
|
-
...
|
|
658
|
+
ref: f.setReference,
|
|
659
|
+
...u({
|
|
660
660
|
onClick(x) {
|
|
661
661
|
x.stopPropagation();
|
|
662
662
|
}
|
|
663
663
|
}),
|
|
664
|
-
className:
|
|
664
|
+
className: g(a, d && c),
|
|
665
665
|
children: e
|
|
666
666
|
}
|
|
667
667
|
),
|
|
668
|
-
|
|
668
|
+
d && /* @__PURE__ */ r(ne, { children: /* @__PURE__ */ m(
|
|
669
669
|
"div",
|
|
670
670
|
{
|
|
671
|
-
ref:
|
|
672
|
-
style: { ...
|
|
671
|
+
ref: f.setFloating,
|
|
672
|
+
style: { ...v, overflowY: "auto" },
|
|
673
673
|
className: "dropdown-menu-shadow dropdown-container z-dropdown flex flex-col rounded bg-white",
|
|
674
674
|
...o(),
|
|
675
675
|
children: [
|
|
@@ -678,13 +678,13 @@ const Ve = ({
|
|
|
678
678
|
"div",
|
|
679
679
|
{
|
|
680
680
|
onClick: (w) => {
|
|
681
|
-
w.stopPropagation(), i?.(x.key),
|
|
681
|
+
w.stopPropagation(), i?.(x.key), p(!1);
|
|
682
682
|
},
|
|
683
|
-
className:
|
|
683
|
+
className: g(
|
|
684
684
|
"text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",
|
|
685
685
|
s === x.key && "bg-hues-100"
|
|
686
686
|
),
|
|
687
|
-
children: /* @__PURE__ */
|
|
687
|
+
children: /* @__PURE__ */ m(
|
|
688
688
|
"div",
|
|
689
689
|
{
|
|
690
690
|
className: "dropdown-item-text flex h-full items-center gap-x-2 p-2 hover:bg-hues-100",
|
|
@@ -702,15 +702,15 @@ const Ve = ({
|
|
|
702
702
|
}
|
|
703
703
|
) })
|
|
704
704
|
] });
|
|
705
|
-
}, Rt = ({ limitMessages: e, query: t }) => /* @__PURE__ */
|
|
706
|
-
/* @__PURE__ */ r("div", { className: "flex gap-x-[4px]", children: /* @__PURE__ */ r("div", { className: "flex flex-col", children: /* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
705
|
+
}, Rt = ({ limitMessages: e, query: t }) => /* @__PURE__ */ m("div", { className: "flex flex-wrap items-center justify-between bg-hues-100 px-2 py-1", children: [
|
|
706
|
+
/* @__PURE__ */ r("div", { className: "flex gap-x-[4px]", children: /* @__PURE__ */ r("div", { className: "flex flex-col", children: /* @__PURE__ */ m("div", { className: "flex gap-x-[4px]", children: [
|
|
707
|
+
/* @__PURE__ */ m("span", { className: "h5 text-primary", children: [
|
|
708
708
|
e?.excelFormatTitle,
|
|
709
709
|
" "
|
|
710
710
|
] }),
|
|
711
711
|
/* @__PURE__ */ r("span", { className: "body-3 text-neutrals-800", children: e?.excelFormatText })
|
|
712
712
|
] }) }) }),
|
|
713
|
-
/* @__PURE__ */ r("a", { href: t, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */
|
|
713
|
+
/* @__PURE__ */ r("a", { href: t, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ m("span", { className: "body-3 flex cursor-pointer items-center gap-x-[4px]", children: [
|
|
714
714
|
e?.dataExplorerIcon,
|
|
715
715
|
e?.dataExplorer
|
|
716
716
|
] }) })
|
|
@@ -720,22 +720,22 @@ const Ve = ({
|
|
|
720
720
|
showAdvancedViewButton: n,
|
|
721
721
|
onAdvancedViewClick: s,
|
|
722
722
|
query: l
|
|
723
|
-
}) => /* @__PURE__ */
|
|
723
|
+
}) => /* @__PURE__ */ m(
|
|
724
724
|
"div",
|
|
725
725
|
{
|
|
726
|
-
className:
|
|
726
|
+
className: g(
|
|
727
727
|
"bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",
|
|
728
728
|
e?.containerClassName
|
|
729
729
|
),
|
|
730
730
|
children: [
|
|
731
|
-
/* @__PURE__ */
|
|
731
|
+
/* @__PURE__ */ m("div", { className: "flex items-center gap-x-2", children: [
|
|
732
732
|
/* @__PURE__ */ r("span", { children: e?.warningIcon }),
|
|
733
|
-
/* @__PURE__ */
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ m("div", { className: "flex flex-col gap-1", children: [
|
|
734
|
+
/* @__PURE__ */ m("div", { className: "flex gap-x-[4px]", children: [
|
|
735
|
+
/* @__PURE__ */ m(
|
|
736
736
|
"span",
|
|
737
737
|
{
|
|
738
|
-
className:
|
|
738
|
+
className: g(
|
|
739
739
|
"text-primary h5",
|
|
740
740
|
e?.largeQueryClassName
|
|
741
741
|
),
|
|
@@ -749,7 +749,7 @@ const Ve = ({
|
|
|
749
749
|
/* @__PURE__ */ r(
|
|
750
750
|
"span",
|
|
751
751
|
{
|
|
752
|
-
className:
|
|
752
|
+
className: g(
|
|
753
753
|
"text-neutrals-800 body-3",
|
|
754
754
|
e?.limitMessageClassName
|
|
755
755
|
),
|
|
@@ -760,7 +760,7 @@ const Ve = ({
|
|
|
760
760
|
t && /* @__PURE__ */ r(
|
|
761
761
|
"span",
|
|
762
762
|
{
|
|
763
|
-
className:
|
|
763
|
+
className: g(
|
|
764
764
|
"text-neutrals-800 body-3",
|
|
765
765
|
e?.limitMessageClassName
|
|
766
766
|
),
|
|
@@ -769,7 +769,7 @@ const Ve = ({
|
|
|
769
769
|
)
|
|
770
770
|
] })
|
|
771
771
|
] }),
|
|
772
|
-
n && /* @__PURE__ */
|
|
772
|
+
n && /* @__PURE__ */ m(
|
|
773
773
|
"span",
|
|
774
774
|
{
|
|
775
775
|
onClick: () => s?.(),
|
|
@@ -780,7 +780,7 @@ const Ve = ({
|
|
|
780
780
|
]
|
|
781
781
|
}
|
|
782
782
|
),
|
|
783
|
-
t && /* @__PURE__ */ r("a", { href: l || "", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */
|
|
783
|
+
t && /* @__PURE__ */ r("a", { href: l || "", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ m("span", { className: "body-3 flex cursor-pointer items-center gap-x-[4px]", children: [
|
|
784
784
|
e?.dataExplorerIcon,
|
|
785
785
|
e?.dataExplorer
|
|
786
786
|
] }) })
|
|
@@ -811,50 +811,51 @@ function Mt({
|
|
|
811
811
|
className: s,
|
|
812
812
|
contentClassName: l
|
|
813
813
|
}) {
|
|
814
|
-
const a = Qe(), c = t ?? a?.icons?.[e], i = a?.classes?.container ?? Je,
|
|
814
|
+
const a = Qe(), c = t ?? a?.icons?.[e], i = a?.classes?.container ?? Je, h = a?.classes?.types?.[e] ?? Ke[e], d = F(i, h, s), p = F(Xe, a?.classes?.icon), f = F(
|
|
815
815
|
Ze,
|
|
816
816
|
a?.classes?.content,
|
|
817
817
|
l
|
|
818
818
|
);
|
|
819
|
-
return /* @__PURE__ */
|
|
820
|
-
c ? /* @__PURE__ */ r("span", { className:
|
|
821
|
-
n ? /* @__PURE__ */ r("div", { className:
|
|
819
|
+
return /* @__PURE__ */ m("div", { "data-type": e, className: d, children: [
|
|
820
|
+
c ? /* @__PURE__ */ r("span", { className: p, children: c }) : null,
|
|
821
|
+
n ? /* @__PURE__ */ r("div", { className: f, children: n }) : null
|
|
822
822
|
] });
|
|
823
823
|
}
|
|
824
824
|
const Tt = ({
|
|
825
825
|
title: e,
|
|
826
826
|
copiedTitle: t,
|
|
827
827
|
tooltip: n,
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
828
|
+
hoverTooltip: s,
|
|
829
|
+
icon: l,
|
|
830
|
+
copiedIcon: a,
|
|
831
|
+
className: c,
|
|
832
|
+
buttonTextClassName: i,
|
|
833
|
+
onClick: h
|
|
833
834
|
}) => {
|
|
834
|
-
const [
|
|
835
|
-
|
|
836
|
-
|
|
835
|
+
const [d, p] = j(!1), f = W(null), v = () => {
|
|
836
|
+
h(), p(!0), f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
837
|
+
p(!1);
|
|
837
838
|
}, 1e3);
|
|
838
839
|
};
|
|
839
840
|
return O(() => () => {
|
|
840
841
|
f.current && clearTimeout(f.current);
|
|
841
|
-
}, []), /* @__PURE__ */
|
|
842
|
+
}, []), /* @__PURE__ */ m("div", { className: "relative w-fit", title: s, children: [
|
|
842
843
|
/* @__PURE__ */ r(
|
|
843
844
|
Ge,
|
|
844
845
|
{
|
|
845
|
-
title:
|
|
846
|
+
title: d ? t : e,
|
|
846
847
|
isSmallButton: !0,
|
|
847
|
-
disabled:
|
|
848
|
+
disabled: d,
|
|
848
849
|
buttonClassName: F([
|
|
849
850
|
"text-button-tertiary small-icon-button !h-6 !p-0",
|
|
850
|
-
|
|
851
|
+
c
|
|
851
852
|
]),
|
|
852
|
-
textClassName: F(["ml-1",
|
|
853
|
-
onClick:
|
|
854
|
-
iconBefore:
|
|
853
|
+
textClassName: F(["ml-1", i]),
|
|
854
|
+
onClick: v,
|
|
855
|
+
iconBefore: d ? a : l
|
|
855
856
|
}
|
|
856
857
|
),
|
|
857
|
-
n &&
|
|
858
|
+
n && d && /* @__PURE__ */ r("div", { className: "h4 absolute left-1/2 top-full z-50 mt-1 -translate-x-1/2 whitespace-nowrap rounded border border-neutrals-400 bg-white px-3 py-4 text-neutrals-900 shadow", children: n })
|
|
858
859
|
] });
|
|
859
860
|
};
|
|
860
861
|
function et({
|
|
@@ -866,11 +867,11 @@ function et({
|
|
|
866
867
|
isChecked: a,
|
|
867
868
|
isExpanded: c
|
|
868
869
|
}) {
|
|
869
|
-
return /* @__PURE__ */
|
|
870
|
+
return /* @__PURE__ */ m("div", { className: "relative cursor-grabbing rounded bg-neutrals-200 shadow", children: [
|
|
870
871
|
/* @__PURE__ */ r("div", { className: "absolute -left-[0.5px] top-0.5 h-5 w-0.5 rounded-full bg-gradients-light" }),
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ m("div", { className: "flex items-stretch overflow-hidden rounded", children: [
|
|
872
873
|
s ? /* @__PURE__ */ r("div", { className: "flex w-6 items-center justify-center", children: /* @__PURE__ */ r("span", { "aria-hidden": !0, className: "rounded p-1", children: /* @__PURE__ */ r(X, { size: 16 }) }) }) : null,
|
|
873
|
-
/* @__PURE__ */
|
|
874
|
+
/* @__PURE__ */ m("div", { className: "flex min-w-0 flex-1 items-center gap-2 p-1", children: [
|
|
874
875
|
l ? /* @__PURE__ */ r(se, { id: e, checked: !!a, className: "p-0" }) : null,
|
|
875
876
|
/* @__PURE__ */ r("span", { className: "body-3 truncate", children: t })
|
|
876
877
|
] }),
|
|
@@ -878,7 +879,7 @@ function et({
|
|
|
878
879
|
"span",
|
|
879
880
|
{
|
|
880
881
|
"aria-hidden": !0,
|
|
881
|
-
className:
|
|
882
|
+
className: g(
|
|
882
883
|
"transition-transform",
|
|
883
884
|
c ? "rotate-90" : "rotate-0"
|
|
884
885
|
),
|
|
@@ -933,25 +934,25 @@ function nt({
|
|
|
933
934
|
onToggleExpanded: c,
|
|
934
935
|
onToggleChecked: i
|
|
935
936
|
}) {
|
|
936
|
-
const
|
|
937
|
+
const h = !!t.items?.length, d = !!t.isExpanded, p = t.isDisabled ? !1 : t.draggable ?? !0, f = t.isDisabled ? !1 : t.checkable ?? !0, v = ae(e, t.id), {
|
|
937
938
|
attributes: N,
|
|
938
|
-
listeners:
|
|
939
|
+
listeners: C,
|
|
939
940
|
setNodeRef: b,
|
|
940
|
-
setActivatorNodeRef:
|
|
941
|
+
setActivatorNodeRef: u,
|
|
941
942
|
transform: o,
|
|
942
943
|
transition: x,
|
|
943
944
|
isDragging: w
|
|
944
|
-
} = Me({ id:
|
|
945
|
+
} = Me({ id: v, disabled: !p }), S = {
|
|
945
946
|
transform: je.Transform.toString(o),
|
|
946
947
|
transition: x,
|
|
947
948
|
opacity: w ? 0.6 : void 0
|
|
948
|
-
}, y = !!t.isDisabled, E = y || !
|
|
949
|
-
return /* @__PURE__ */
|
|
949
|
+
}, y = !!t.isDisabled, E = y || !f, D = [...e, t.id];
|
|
950
|
+
return /* @__PURE__ */ m(
|
|
950
951
|
"div",
|
|
951
952
|
{
|
|
952
953
|
ref: b,
|
|
953
954
|
style: S,
|
|
954
|
-
className:
|
|
955
|
+
className: g([
|
|
955
956
|
"group flex items-stretch overflow-hidden rounded bg-white",
|
|
956
957
|
"select-none",
|
|
957
958
|
y ? "opacity-50" : ""
|
|
@@ -960,22 +961,22 @@ function nt({
|
|
|
960
961
|
n ? /* @__PURE__ */ r(
|
|
961
962
|
"div",
|
|
962
963
|
{
|
|
963
|
-
className:
|
|
964
|
+
className: g([
|
|
964
965
|
"group/drag-handle flex w-6 items-center justify-center rounded",
|
|
965
966
|
y ? "" : "hover:bg-neutrals-100 cursor-grab"
|
|
966
967
|
]),
|
|
967
968
|
children: /* @__PURE__ */ r(
|
|
968
969
|
"span",
|
|
969
970
|
{
|
|
970
|
-
ref:
|
|
971
|
+
ref: u,
|
|
971
972
|
"aria-hidden": !0,
|
|
972
|
-
className:
|
|
973
|
+
className: g([
|
|
973
974
|
"rounded p-1",
|
|
974
|
-
|
|
975
|
+
p ? "cursor-grab" : "cursor-default",
|
|
975
976
|
"transition-opacity"
|
|
976
977
|
]),
|
|
977
|
-
...
|
|
978
|
-
...
|
|
978
|
+
...p ? C : {},
|
|
979
|
+
...p ? N : {},
|
|
979
980
|
children: /* @__PURE__ */ r(
|
|
980
981
|
X,
|
|
981
982
|
{
|
|
@@ -987,7 +988,7 @@ function nt({
|
|
|
987
988
|
)
|
|
988
989
|
}
|
|
989
990
|
) : null,
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
+
/* @__PURE__ */ m(
|
|
991
992
|
"button",
|
|
992
993
|
{
|
|
993
994
|
type: "button",
|
|
@@ -1000,7 +1001,7 @@ function nt({
|
|
|
1000
1001
|
nativeEvent: k
|
|
1001
1002
|
});
|
|
1002
1003
|
},
|
|
1003
|
-
className:
|
|
1004
|
+
className: g([
|
|
1004
1005
|
"flex min-w-0 flex-1 items-center gap-2 p-1 text-left rounded",
|
|
1005
1006
|
y ? "" : "hover:bg-neutrals-100",
|
|
1006
1007
|
y ? "" : "hover:text-blue-700",
|
|
@@ -1012,7 +1013,7 @@ function nt({
|
|
|
1012
1013
|
{
|
|
1013
1014
|
id: `draggable-list-${D.join("-")}`,
|
|
1014
1015
|
checked: !!t.isChecked,
|
|
1015
|
-
disabled: !
|
|
1016
|
+
disabled: !f,
|
|
1016
1017
|
className: "p-0",
|
|
1017
1018
|
stopPropagation: !0,
|
|
1018
1019
|
onChange: (k, I) => i?.({
|
|
@@ -1026,7 +1027,7 @@ function nt({
|
|
|
1026
1027
|
]
|
|
1027
1028
|
}
|
|
1028
1029
|
),
|
|
1029
|
-
|
|
1030
|
+
h ? /* @__PURE__ */ r(
|
|
1030
1031
|
"button",
|
|
1031
1032
|
{
|
|
1032
1033
|
type: "button",
|
|
@@ -1035,11 +1036,11 @@ function nt({
|
|
|
1035
1036
|
k.stopPropagation(), c?.({
|
|
1036
1037
|
itemId: t.id,
|
|
1037
1038
|
path: D,
|
|
1038
|
-
nextExpanded: !
|
|
1039
|
+
nextExpanded: !d
|
|
1039
1040
|
});
|
|
1040
1041
|
},
|
|
1041
|
-
"aria-label":
|
|
1042
|
-
className:
|
|
1042
|
+
"aria-label": d ? "Collapse" : "Expand",
|
|
1043
|
+
className: g([
|
|
1043
1044
|
"flex w-8 items-center justify-center rounded",
|
|
1044
1045
|
y ? "" : "hover:bg-neutrals-100",
|
|
1045
1046
|
"focus:outline-none"
|
|
@@ -1048,9 +1049,9 @@ function nt({
|
|
|
1048
1049
|
"span",
|
|
1049
1050
|
{
|
|
1050
1051
|
"aria-hidden": !0,
|
|
1051
|
-
className:
|
|
1052
|
+
className: g(
|
|
1052
1053
|
"transition-transform duration-150 ease-out",
|
|
1053
|
-
|
|
1054
|
+
d ? "rotate-90" : "rotate-0"
|
|
1054
1055
|
),
|
|
1055
1056
|
children: /* @__PURE__ */ r(Z, { size: 16 })
|
|
1056
1057
|
}
|
|
@@ -1071,30 +1072,30 @@ function Pt({
|
|
|
1071
1072
|
onItemClick: c,
|
|
1072
1073
|
renderLabel: i
|
|
1073
1074
|
}) {
|
|
1074
|
-
const
|
|
1075
|
+
const h = Le(
|
|
1075
1076
|
Oe(Fe, { activationConstraint: { distance: 6 } })
|
|
1076
|
-
), [
|
|
1077
|
-
const b = String(
|
|
1078
|
-
if (!
|
|
1079
|
-
const o = tt(e,
|
|
1080
|
-
!o || o.type !== "item" ||
|
|
1077
|
+
), [d, p] = ue.useState(null), f = (C) => {
|
|
1078
|
+
const b = String(C.active.id), u = $(b);
|
|
1079
|
+
if (!u) return;
|
|
1080
|
+
const o = tt(e, u.parentPath, u.itemId);
|
|
1081
|
+
!o || o.type !== "item" || p({
|
|
1081
1082
|
id: b,
|
|
1082
1083
|
label: o.label,
|
|
1083
1084
|
hasChildren: !!o.items?.length,
|
|
1084
1085
|
isChecked: o.isChecked,
|
|
1085
1086
|
isExpanded: o.isExpanded
|
|
1086
1087
|
});
|
|
1087
|
-
},
|
|
1088
|
-
|
|
1089
|
-
const b =
|
|
1088
|
+
}, v = (C) => {
|
|
1089
|
+
p(null);
|
|
1090
|
+
const b = C.over;
|
|
1090
1091
|
if (!b) return;
|
|
1091
|
-
const
|
|
1092
|
-
if (!
|
|
1093
|
-
const x = oe(e,
|
|
1092
|
+
const u = $(String(C.active.id)), o = $(String(b.id));
|
|
1093
|
+
if (!u || !o || u.parentPath.join("/") !== o.parentPath.join("/")) return;
|
|
1094
|
+
const x = oe(e, u.parentPath);
|
|
1094
1095
|
if (!x) return;
|
|
1095
|
-
const w = x.findIndex((E) => E.id ===
|
|
1096
|
+
const w = x.findIndex((E) => E.id === u.itemId), S = x.findIndex((E) => E.id === o.itemId);
|
|
1096
1097
|
if (w === -1 || S === -1 || w === S) return;
|
|
1097
|
-
const y = ce(e,
|
|
1098
|
+
const y = ce(e, u.parentPath, (E) => {
|
|
1098
1099
|
const D = E.filter(
|
|
1099
1100
|
(R) => R.type === "item"
|
|
1100
1101
|
), k = Ye(D, w, S);
|
|
@@ -1106,19 +1107,19 @@ function Pt({
|
|
|
1106
1107
|
});
|
|
1107
1108
|
});
|
|
1108
1109
|
s(y);
|
|
1109
|
-
}, N = (
|
|
1110
|
-
const
|
|
1110
|
+
}, N = (C, b = []) => {
|
|
1111
|
+
const u = C.filter((o) => o.type === "item").map((o) => ae(b, o.id));
|
|
1111
1112
|
return /* @__PURE__ */ r(
|
|
1112
1113
|
Te,
|
|
1113
1114
|
{
|
|
1114
|
-
items:
|
|
1115
|
+
items: u,
|
|
1115
1116
|
strategy: Pe,
|
|
1116
|
-
children: /* @__PURE__ */ r("ul", { className: "m-0 flex list-none flex-col gap-2 p-0", children:
|
|
1117
|
+
children: /* @__PURE__ */ r("ul", { className: "m-0 flex list-none flex-col gap-2 p-0", children: C.map((o) => o.type === "group" ? /* @__PURE__ */ m(
|
|
1117
1118
|
"li",
|
|
1118
1119
|
{
|
|
1119
1120
|
className: "m-0 mt-2 flex flex-col gap-2 p-0 first:mt-0",
|
|
1120
1121
|
children: [
|
|
1121
|
-
/* @__PURE__ */
|
|
1122
|
+
/* @__PURE__ */ m("div", { className: "h5 flex items-center gap-2 py-1 text-neutrals-1000", children: [
|
|
1122
1123
|
/* @__PURE__ */ r(xe, { size: 12, className: "shrink-0" }),
|
|
1123
1124
|
o.label
|
|
1124
1125
|
] }),
|
|
@@ -1126,7 +1127,7 @@ function Pt({
|
|
|
1126
1127
|
]
|
|
1127
1128
|
},
|
|
1128
1129
|
o.id
|
|
1129
|
-
) : /* @__PURE__ */
|
|
1130
|
+
) : /* @__PURE__ */ m("li", { className: "m-0 flex flex-col gap-2 p-0", children: [
|
|
1130
1131
|
/* @__PURE__ */ r(
|
|
1131
1132
|
nt,
|
|
1132
1133
|
{
|
|
@@ -1145,25 +1146,25 @@ function Pt({
|
|
|
1145
1146
|
}
|
|
1146
1147
|
);
|
|
1147
1148
|
};
|
|
1148
|
-
return /* @__PURE__ */
|
|
1149
|
+
return /* @__PURE__ */ m(
|
|
1149
1150
|
Re,
|
|
1150
1151
|
{
|
|
1151
|
-
sensors:
|
|
1152
|
+
sensors: h,
|
|
1152
1153
|
collisionDetection: _e,
|
|
1153
|
-
onDragStart:
|
|
1154
|
-
onDragEnd:
|
|
1154
|
+
onDragStart: f,
|
|
1155
|
+
onDragEnd: v,
|
|
1155
1156
|
children: [
|
|
1156
1157
|
/* @__PURE__ */ r("div", { className: "flex flex-col", children: N(e) }),
|
|
1157
|
-
/* @__PURE__ */ r(Ae, { children:
|
|
1158
|
+
/* @__PURE__ */ r(Ae, { children: d ? /* @__PURE__ */ r(
|
|
1158
1159
|
et,
|
|
1159
1160
|
{
|
|
1160
|
-
id:
|
|
1161
|
-
label:
|
|
1162
|
-
hasChildren:
|
|
1161
|
+
id: d.id,
|
|
1162
|
+
label: d.label,
|
|
1163
|
+
hasChildren: d.hasChildren,
|
|
1163
1164
|
showDragHandle: t,
|
|
1164
1165
|
showCheckbox: n,
|
|
1165
|
-
isChecked:
|
|
1166
|
-
isExpanded:
|
|
1166
|
+
isChecked: d.isChecked,
|
|
1167
|
+
isExpanded: d.isExpanded
|
|
1167
1168
|
}
|
|
1168
1169
|
) : null })
|
|
1169
1170
|
]
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/statgpt-ui-components",
|
|
3
|
-
"version": "0.5.0-rc.
|
|
3
|
+
"version": "0.5.0-rc.32",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"react-flatpickr": "^4.0.11",
|
|
7
7
|
"classnames": "^2.5.1",
|
|
8
|
-
"@epam/statgpt-shared-toolkit": "0.5.0-rc.
|
|
8
|
+
"@epam/statgpt-shared-toolkit": "0.5.0-rc.32",
|
|
9
9
|
"@tabler/icons-react": "^3.34.1",
|
|
10
10
|
"@floating-ui/react": "^0.27.14",
|
|
11
11
|
"tailwind-merge": "^3.4.0",
|