@epam/statgpt-ui-components 0.2.0-rc.40 → 0.2.0-rc.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/index.mjs +514 -522
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),p=require("react"),i=require("classnames"),k=require("@tabler/icons-react"),X=require("react-flatpickr"),_=require("@epam/statgpt-shared-toolkit"),b=require("@floating-ui/react"),J=require("tailwind-merge"),T=()=>e.jsx("div",{className:"flex items-center justify-center h-full",children:e.jsx("div",{className:"loader"})}),Y=({title:n,btnClassNames:r,iconWidth:t,iconHeight:o,onClick:s})=>e.jsx("button",{type:"button","aria-label":"button",className:r,title:n,onClick:s,children:e.jsx(k.IconX,{height:o||20,width:t||20})});var E=(n=>(n.ERROR="error",n.SUCCESS="success",n.IN_PROGRESS="in_progress",n))(E||{});const V=({alertDetails:n,successIcon:r,errorIcon:t,onClose:o,closeButtonTitle:s})=>{const c=()=>(n==null?void 0:n.type)===E.IN_PROGRESS?"alert-in-progress":(n==null?void 0:n.type)===E.SUCCESS?"alert-success":"alert-error";return p.useEffect(()=>{(n==null?void 0:n.type)!==E.IN_PROGRESS&&setTimeout(()=>{o==null||o()},5e3)},[n==null?void 0:n.type,o]),e.jsx("div",{className:i("alert alert-shadow fixed bottom-3 right-3 z-10",c()),children:e.jsxs("div",{className:"alert-content flex items-start",children:[e.jsx("div",{className:"alert-icon",children:(n==null?void 0:n.type)===E.IN_PROGRESS?e.jsx(T,{}):(n==null?void 0:n.type)===E.SUCCESS?r:t}),e.jsxs("div",{className:"flex flex-col gap-2 max-w-[300px]",children:[e.jsx("h3",{className:"truncate",children:n==null?void 0:n.title}),(n==null?void 0:n.text)&&e.jsx("div",{className:"alert-text truncate",title:n==null?void 0:n.text,children:n==null?void 0:n.text})]}),e.jsx(Y,{title:s,onClick:o})]})})},D=({buttonClassName:n,isLoading:r=!1,title:t,disabled:o,iconAfter:s,iconBefore:c,onClick:l,isSmallButton:u})=>{const d=i(u?"font-semibold":"",s?"mr-2":"",c?"ml-2":"");return e.jsxs("button",{type:"button",className:i("base-button",n,u?"small-button":""),disabled:o||r,"aria-label":"button",onClick:h=>l==null?void 0:l(h),title:t,children:[c,r&&e.jsx(T,{}),t?u?e.jsx("h4",{className:d,children:t}):e.jsx("h3",{className:d,children:t}):null,s]})};function q(n=719){const[r,t]=p.useState(()=>typeof window<"u"?window.innerWidth<n:!1);return p.useEffect(()=>{const o=window.matchMedia(`(max-width: ${n}px)`),s=c=>{t(c.matches)};return t(o.matches),o.addEventListener("change",s),()=>o.removeEventListener("change",s)},[n]),r}function M(n,r){const t=p.useRef(null);return p.useCallback((...s)=>{t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{n(...s)},r)},[n,r])}const nn=24,en=24,O=1e3,G=24,rn=({label:n,onChange:r,value:t,options:o,calendarResolution:s=_.CalendarResolution.DAY,id:c,icon:l,isEndDate:u})=>{var v;const d=p.useRef(null),h=q();p.useEffect(()=>{var j;const f=d==null?void 0:d.current;f&&((j=f.querySelector("input"))==null||j.setAttribute("aria-label",n))},[n]);const m={...o,disableMobile:!0,defaultDate:s===_.CalendarResolution.MONTH?new Date(t.getFullYear(),t.getMonth()):t},y=(f,j,x)=>{const a=`calendar__${s===_.CalendarResolution.MONTH?"month":"day"}`;x.calendarContainer&&x.calendarContainer.classList.add(a)},w=(f,j,x)=>{if(s===_.CalendarResolution.MONTH&&f.length>0){const a=o.minDate,N=o.maxDate,C=f[0].getFullYear(),L=x.calendarContainer,I="flatpickr-disabled",W=L.querySelectorAll(".flatpickr-monthSelect-month"),Q=L.querySelectorAll(".flatpickr-next-month")[0],z=L.querySelectorAll(".flatpickr-prev-month")[0];C===N.getFullYear()&&Q.classList.add(I),C===a.getFullYear()&&z.classList.add(I),(C===a.getFullYear()||C===N.getFullYear())&&W.forEach(g=>{g.classList.remove(I);const R=new Date(g.getAttribute("aria-label")),K=R.getFullYear()===a.getFullYear()&&R.getMonth()===a.getMonth(),Z=R.getFullYear()===N.getFullYear()&&R.getMonth()===N.getMonth();K||Z||(R<a||R>N)&&g.classList.add(I)})}setTimeout(()=>{var C;const a=x.calendarContainer,N=(C=x._input)==null?void 0:C.getBoundingClientRect();a&&(a.style.top=`${N.top-a.offsetHeight-8}px`,a.style.width=`${a.style.width}px`,u?(a.style.right=`${window.innerWidth-N.right-(h?G:0)}px`,a.style.left="auto"):a.style.left=`${N.left}px`)},0)};return e.jsxs("div",{className:"relative calendar",ref:d,children:[e.jsx("div",{className:"mb-1 calendar-title",children:n}),e.jsx("label",{htmlFor:c,className:"absolute cursor-pointer right-[11px] top-[29px]",children:l||e.jsx(k.IconCalendarEvent,{})}),e.jsx(X,{defaultValue:(v=s===_.CalendarResolution.MONTH?new Date(t.getFullYear(),t.getMonth()):t)==null?void 0:v.toDateString(),options:m,onChange:f=>{r(f[0])},onOpen:[w],onReady:[y],id:c})]})},tn=({label:n,id:r,checked:t,checkboxIcon:o,onChange:s})=>{const c=p.useCallback(l=>{l.stopPropagation(),s==null||s(r,l.target.checked)},[s,r]);return e.jsxs("label",{className:"flex items-center cursor-pointer min-w-0 py-1",htmlFor:r,children:[e.jsx("span",{className:i("flex justify-center items-center w-4 h-4 mr-2 relative","checkbox-button"),children:t&&o}),n&&e.jsx("p",{className:i("text-neutrals-1000 flex-1 min-w-0 truncate pr-2","checkbox-button-text"),title:n,children:n}),e.jsx("input",{type:"checkbox",onChange:c,id:r,checked:t,className:"hidden"})]})},on=({title:n,icon:r,children:t,value:o})=>{const[s,c]=p.useState(!1);return e.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${s?"collapsible-block-open":""}`,children:[e.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>c(!s),children:[e.jsx("div",{className:`${s?"rotate-180":""} transition-transform`,children:r||e.jsx(k.IconChevronDown,{className:"w-5 h-5 mr-3"})}),e.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[e.jsx("span",{children:n}),o&&e.jsx("p",{className:"body-1 text-neutrals-800",children:o})]})]}),s&&e.jsx("div",{className:"collapsible-block-content pb-4",children:t})]})},cn=({text:n,highlightText:r})=>{const t=p.useMemo(()=>{var l;const o=[];if(!r)return[{id:0,text:n,highlight:!1}];const s=(r==null?void 0:r.toLowerCase())||"",c=((l=n==null?void 0:n.toLowerCase())==null?void 0:l.split(s))||"";for(let u=0,d=0;u<(c==null?void 0:c.length);u++){const h=c==null?void 0:c[u],m=h.length;h!==""&&o.push({id:o.length,highlight:!1,text:n==null?void 0:n.substring(d,d+m)}),d+=m,u!==(c==null?void 0:c.length)-1&&(o.push({id:o.length,highlight:!0,text:n==null?void 0:n.substring(d,d+r.length)}),d+=r.length)}return o},[r,n]);return e.jsx(e.Fragment,{children:t.map(o=>e.jsx("span",{className:i((o==null?void 0:o.highlight)&&"bg-highlight"),children:o==null?void 0:o.text},o==null?void 0:o.id))})},sn=({icon:n,onClick:r,buttonClassName:t,disabled:o,title:s,isBaseIconStyles:c=!0})=>e.jsx("button",{type:"button",className:i(c&&"base-icon-button",t),onClick:l=>r==null?void 0:r(l),disabled:o,title:s,"aria-label":"button",children:n}),$=({value:n,inputId:r,placeholder:t="",cssClass:o="",type:s="text",disabled:c,readonly:l,onChange:u,onKeyDown:d})=>{const h=i("truncate outline-none shadow-none body-1",o,l?"pointer-events-none":"");return e.jsx("input",{type:s,autoComplete:"off",id:r,placeholder:t,value:n||"",title:n?String(n):"",disabled:c,className:h,onKeyDown:d,onChange:m=>u==null?void 0:u(m.currentTarget.value)})},an=({iconBeforeInput:n,iconAfterInput:r,containerClasses:t,cssClass:o,...s})=>e.jsxs("div",{className:i("input w-full flex flex-row",t),children:[n,e.jsx($,{cssClass:i("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",o),...s}),r]}),ln=({url:n,title:r,linkClassName:t="",iconBefore:o,iconAfter:s})=>{const c=i(s?"mr-2":"",o?"ml-2":"");return e.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:i("base-link",t),title:r,children:[o,e.jsx("span",{className:c,children:r}),s]})},un=({title:n,text:r,onClick:t})=>e.jsx("button",{type:"button",className:"tag flex items-center justify-center",onClick:()=>t==null?void 0:t(r||n),"aria-label":"button",children:e.jsx("h4",{children:n})}),dn=({label:n,id:r,checked:t,radioIcon:o,description:s,onChange:c})=>{const l=p.useCallback(u=>{u.stopPropagation(),c==null||c(r,u.target.checked)},[c,r]);return e.jsxs("label",{className:"flex flex-col cursor-pointer min-w-0 py-[6px]",htmlFor:r,children:[e.jsxs("p",{className:"radio-label flex items-center min-w-0",children:[e.jsx("span",{className:i("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",t?"radio-button-active":""),children:t&&o}),n&&e.jsx("span",{className:"radio-title body-1 text-neutrals-1000 flex-1 min-w-0 truncate pr-2",title:n,children:n})]}),s&&e.jsx("span",{className:"radio-description ml-6 text-neutrals-800 body-2 w-auto flex items-center",title:s,children:s}),e.jsx("input",{type:"radio",onChange:l,id:r,checked:t,className:"hidden"})]})};var S=(n=>(n.Closed="Closed",n.Opened="Opened",n))(S||{}),F=(n=>(n.LG="Large",n.SM="Small",n))(F||{});const xn=({portalId:n,state:r=S.Opened,heading:t,size:o,onClose:s,children:c,overlayClassName:l,containerClassName:u,dividers:d=!0,closeButtonTitle:h})=>{const{refs:m,context:y}=b.useFloating({open:r!==S.Closed&&!!r,onOpenChange:s}),w=b.useRole(y,{role:"dialog"}),v=b.useDismiss(y,{outsidePress:!0}),{getFloatingProps:f}=b.useInteractions([w,v]),j=p.useCallback(x=>{x==null||x.preventDefault(),x==null||x.stopPropagation(),s()},[s]);return e.jsx(b.FloatingPortal,{id:n,children:r!==S.Closed&&e.jsx(b.FloatingOverlay,{className:i("z-modal flex items-center justify-center bg-blackout p-4",l),children:e.jsx(b.FloatingFocusManager,{context:y,children:e.jsxs("div",{className:i("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",o===F.LG&&"max-w-[65%]",o===F.SM&&"max-w-[30%]",d&&"divide-neutrals-400 divide-y",u,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:m.setFloating,...f({onClick(x){x.stopPropagation()}}),children:[e.jsxs("div",{className:"flex flex-row justify-between py-3 px-6 items-center mb-2 modal-heading sm:p-0 sm:pb-2",children:[t&&(typeof t=="string"?e.jsx("h2",{className:"flex-1 min-w-0 mr-3 modal-heading-title sm:h3",children:t}):t),e.jsx(Y,{title:h,onClick:j,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),c.map(x=>x)]})})})})},pn=n=>n.state===S.Closed?null:e.jsx(xn,{...n}),hn=({triggerButton:n,options:r,content:t,selectedOption:o,disabled:s,containerClassName:c,openedClassName:l,onOptionSelect:u})=>{const[d,h]=p.useState(!1),{refs:m,floatingStyles:y,context:w}=b.useFloating({open:d,onOpenChange:s?void 0:h,placement:"bottom-end",middleware:[b.offset(8),b.flip(),b.shift()],whileElementsMounted:b.autoUpdate}),v=b.useClick(w),f=b.useDismiss(w,{outsidePress:!0}),{getReferenceProps:j,getFloatingProps:x}=b.useInteractions([v,f]);return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:m.setReference,...j({onClick(a){a.stopPropagation()}}),className:i(c,d&&l),children:n}),d&&e.jsxs("div",{ref:m.setFloating,style:y,className:"flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",...x(),children:[t&&t,r&&r.map(a=>e.jsx("div",{onClick:N=>{N.stopPropagation(),u==null||u(a.key),h(!1)},className:i("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",o===a.key&&"bg-hues-100"),children:e.jsxs("div",{className:"p-2 hover:bg-hues-100 h-full dropdown-item-text flex items-center gap-x-2",title:a.title,children:[a.icon?a.icon:null,e.jsx("p",{children:a==null?void 0:a.title})]})},a.key))]})]})},fn=({limitMessages:n,query:r})=>e.jsxs("div",{className:"bg-hues-100 px-2 py-1 flex justify-between flex-wrap items-center",children:[e.jsx("div",{className:"flex gap-x-[4px]",children:e.jsx("div",{className:"flex flex-col",children:e.jsxs("div",{className:"flex gap-x-[4px]",children:[e.jsxs("span",{className:"text-primary h5",children:[n==null?void 0:n.excelFormatTitle," "]}),e.jsx("span",{className:"text-neutrals-800 body-3",children:n==null?void 0:n.excelFormatText})]})})}),e.jsx("a",{href:r,target:"_blank",children:e.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[n==null?void 0:n.dataExplorerIcon,n==null?void 0:n.dataExplorer]})})]}),bn=({limitMessages:n,isDownload:r,showAdvancedViewButton:t,onAdvancedViewClick:o,query:s})=>{var c,l;return e.jsxs("div",{className:i("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",n==null?void 0:n.containerClassName),children:[e.jsxs("div",{className:"flex gap-x-2 items-center",children:[e.jsx("span",{children:n==null?void 0:n.warningIcon}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex gap-x-[4px]",children:[e.jsxs("span",{className:i("text-primary h5",n==null?void 0:n.largeQueryClassName),children:[n==null?void 0:n.largeQuery,":"," "]}),e.jsx("span",{className:i("text-neutrals-800 body-3",n==null?void 0:n.limitMessageClassName),children:r?(c=n==null?void 0:n.downloadMessage)==null?void 0:c.call(n,O):(l=n==null?void 0:n.showingLimit)==null?void 0:l.call(n,O)})]}),r&&e.jsx("span",{className:i("text-neutrals-800 body-3",n==null?void 0:n.limitMessageClassName),children:n==null?void 0:n.fullLimitMessage})]})]}),t&&e.jsxs("span",{onClick:()=>o==null?void 0:o(),className:"flex gap-x-[4px] h4 cursor-pointer items-center text-primary",children:[n==null?void 0:n.editIcon,n==null?void 0:n.refineInAdvancedView]}),r&&e.jsx("a",{href:s||"",target:"_blank",children:e.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[n==null?void 0:n.dataExplorerIcon,n==null?void 0:n.dataExplorer]})})]})},B=p.createContext(null);function mn({value:n,children:r}){const t=p.useMemo(()=>n??{},[n]);return e.jsx(B.Provider,{value:t,children:r})}function jn(){return p.useContext(B)}var A=(n=>(n.Info="info",n.Error="error",n.Warning="warning",n))(A||{});const Nn=J.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function P(...n){return Nn(i(...n))}const yn={[A.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[A.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[A.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000"},wn="shrink-0",vn="min-w-0 body-2",Cn="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function En({type:n,icon:r,children:t,className:o,contentClassName:s}){var w,v,f,j,x,a;const c=jn(),l=r??((w=c==null?void 0:c.icons)==null?void 0:w[n]),u=((v=c==null?void 0:c.classes)==null?void 0:v.container)??Cn,d=((j=(f=c==null?void 0:c.classes)==null?void 0:f.types)==null?void 0:j[n])??yn[n],h=P(u,d,o),m=P(wn,(x=c==null?void 0:c.classes)==null?void 0:x.icon),y=P(vn,(a=c==null?void 0:c.classes)==null?void 0:a.content,s);return e.jsxs("div",{"data-type":n,className:h,children:[l?e.jsx("span",{className:m,children:l}):null,t?e.jsx("div",{className:y,children:t}):null]})}var H=(n=>(n.Enter="Enter",n))(H||{});const U=p.createContext(null);function Rn({children:n,isAgentAvailable:r}){const t=p.useMemo(()=>({isAgentAvailable:r}),[r]);return e.jsx(U.Provider,{value:t,children:n})}function Sn(){const n=p.useContext(U);if(!n)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return n}exports.AgentAvailabilityProvider=Rn;exports.Alert=V;exports.AlertType=E;exports.Button=D;exports.CALENDAR_MOBILE_PADDING=G;exports.Calendar=rn;exports.Checkbox=tn;exports.CloseButton=Y;exports.CollapsibleBlock=on;exports.DownloadFormatMessage=fn;exports.Dropdown=hn;exports.HighlightText=cn;exports.IconButton=sn;exports.InlineAlert=En;exports.InlineAlertProvider=mn;exports.InlineAlertType=A;exports.Input=$;exports.InputWithIcon=an;exports.KeyboardKey=H;exports.Link=ln;exports.Loader=T;exports.PopUpSize=F;exports.PopUpState=S;exports.Popup=pn;exports.Radio=dn;exports.RequestLimitMessage=bn;exports.SERIES_LIMIT=O;exports.TREE_NODE_ARROW_SIZE=nn;exports.TREE_NODE_PADDING=en;exports.Tag=un;exports.useAgentAvailability=Sn;exports.useDebounce=M;exports.useIsMobile=q;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("react"),d=require("classnames"),O=require("@tabler/icons-react"),V=require("react-flatpickr"),I=require("@epam/statgpt-shared-toolkit"),p=require("@floating-ui/react"),z=require("tailwind-merge"),P=()=>t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"loader"})}),T=({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(O.IconX,{height:r||20,width:s||20})});var N=(e=>(e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(N||{});const K=({alertDetails:e,successIcon:n,errorIcon:s,onClose:r,closeButtonTitle:a})=>{const l=()=>e?.type===N.IN_PROGRESS?"alert-in-progress":e?.type===N.SUCCESS?"alert-success":"alert-error";return x.useEffect(()=>{e?.type!==N.IN_PROGRESS&&setTimeout(()=>{r?.()},5e3)},[e?.type,r]),t.jsx("div",{className:d("alert alert-shadow fixed bottom-3 right-3 z-10",l()),children:t.jsxs("div",{className:"alert-content flex items-start",children:[t.jsx("div",{className:"alert-icon",children:e?.type===N.IN_PROGRESS?t.jsx(P,{}):e?.type===N.SUCCESS?n:s}),t.jsxs("div",{className:"flex flex-col gap-2 max-w-[300px]",children:[t.jsx("h3",{className:"truncate",children:e?.title}),e?.text&&t.jsx("div",{className:"alert-text truncate",title:e?.text,children:e?.text})]}),t.jsx(T,{title:a,onClick:r})]})})},Z=({buttonClassName:e,isLoading:n=!1,title:s,disabled:r,iconAfter:a,iconBefore:l,onClick:c,isSmallButton:i})=>{const m=d(i?"font-semibold":"",a?"mr-2":"",l?"ml-2":"");return t.jsxs("button",{type:"button",className:d("base-button",e,i?"small-button":""),disabled:r||n,"aria-label":"button",onClick:h=>c?.(h),title:s,children:[l,n&&t.jsx(P,{}),s?i?t.jsx("h4",{className:m,children:s}):t.jsx("h3",{className:m,children:s}):null,a]})};function D(e=719){const[n,s]=x.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return x.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 X(e,n){const s=x.useRef(null);return x.useCallback((...a)=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{e(...a)},n)},[e,n])}const J=24,ee=24,L=1e3,M=24,te=({label:e,onChange:n,value:s,options:r,calendarResolution:a=I.CalendarResolution.DAY,id:l,icon:c,isEndDate:i})=>{const m=x.useRef(null),h=D();x.useEffect(()=>{const f=m?.current;f&&f.querySelector("input")?.setAttribute("aria-label",e)},[e]);const g={...r,disableMobile:!0,defaultDate:a===I.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s},j=(f,E,b)=>{const o=`calendar__${a===I.CalendarResolution.MONTH?"month":"day"}`;b.calendarContainer&&b.calendarContainer.classList.add(o)},C=(f,E,b)=>{if(a===I.CalendarResolution.MONTH&&f.length>0){const o=r.minDate,u=r.maxDate,y=f[0].getFullYear(),R=b.calendarContainer,k="flatpickr-disabled",B=R.querySelectorAll(".flatpickr-monthSelect-month"),H=R.querySelectorAll(".flatpickr-next-month")[0],U=R.querySelectorAll(".flatpickr-prev-month")[0];y===u.getFullYear()&&H.classList.add(k),y===o.getFullYear()&&U.classList.add(k),(y===o.getFullYear()||y===u.getFullYear())&&B.forEach(_=>{_.classList.remove(k);const w=new Date(_.getAttribute("aria-label")),W=w.getFullYear()===o.getFullYear()&&w.getMonth()===o.getMonth(),Q=w.getFullYear()===u.getFullYear()&&w.getMonth()===u.getMonth();W||Q||(w<o||w>u)&&_.classList.add(k)})}setTimeout(()=>{const o=b.calendarContainer,u=b._input?.getBoundingClientRect();o&&(o.style.top=`${u.top-o.offsetHeight-8}px`,o.style.width=`${o.style.width}px`,i?(o.style.right=`${window.innerWidth-u.right-(h?M:0)}px`,o.style.left="auto"):o.style.left=`${u.left}px`)},0)};return t.jsxs("div",{className:"relative calendar",ref:m,children:[t.jsx("div",{className:"mb-1 calendar-title",children:e}),t.jsx("label",{htmlFor:l,className:"absolute cursor-pointer right-[11px] top-[29px]",children:c||t.jsx(O.IconCalendarEvent,{})}),t.jsx(V,{defaultValue:(a===I.CalendarResolution.MONTH?new Date(s.getFullYear(),s.getMonth()):s)?.toDateString(),options:g,onChange:f=>{n(f[0])},onOpen:[C],onReady:[j],id:l})]})},ne=({label:e,id:n,checked:s,checkboxIcon:r,onChange:a})=>{const l=x.useCallback(c=>{c.stopPropagation(),a?.(n,c.target.checked)},[a,n]);return t.jsxs("label",{className:"flex items-center cursor-pointer min-w-0 py-1",htmlFor:n,children:[t.jsx("span",{className:d("flex justify-center items-center w-4 h-4 mr-2 relative","checkbox-button"),children:s&&r}),e&&t.jsx("p",{className:d("text-neutrals-1000 flex-1 min-w-0 truncate pr-2","checkbox-button-text"),title:e,children:e}),t.jsx("input",{type:"checkbox",onChange:l,id:n,checked:s,className:"hidden"})]})},se=({title:e,icon:n,children:s,value:r})=>{const[a,l]=x.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(O.IconChevronDown,{className:"w-5 h-5 mr-3"})}),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})]})},re=({text:e,highlightText:n})=>{const s=x.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 m=l?.[c],h=m.length;m!==""&&r.push({id:r.length,highlight:!1,text:e?.substring(i,i+h)}),i+=h,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:d(r?.highlight&&"bg-highlight"),children:r?.text},r?.id))})},ae=({icon:e,onClick:n,buttonClassName:s,disabled:r,title:a,isBaseIconStyles:l=!0})=>t.jsx("button",{type:"button",className:d(l&&"base-icon-button",s),onClick:c=>n?.(c),disabled:r,title:a,"aria-label":"button",children:e}),Y=({value:e,inputId:n,placeholder:s="",cssClass:r="",type:a="text",disabled:l,readonly:c,onChange:i,onKeyDown:m})=>{const h=d("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:h,onKeyDown:m,onChange:g=>i?.(g.currentTarget.value)})},le=({iconBeforeInput:e,iconAfterInput:n,containerClasses:s,cssClass:r,...a})=>t.jsxs("div",{className:d("input w-full flex flex-row",s),children:[e,t.jsx(Y,{cssClass:d("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",r),...a}),n]}),oe=({url:e,title:n,linkClassName:s="",iconBefore:r,iconAfter:a})=>{const l=d(a?"mr-2":"",r?"ml-2":"");return t.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:d("base-link",s),title:n,children:[r,t.jsx("span",{className:l,children:n}),a]})},ce=({title:e,text:n,onClick:s})=>t.jsx("button",{type:"button",className:"tag flex items-center justify-center",onClick:()=>s?.(n||e),"aria-label":"button",children:t.jsx("h4",{children:e})}),ie=({label:e,id:n,checked:s,radioIcon:r,description:a,onChange:l})=>{const c=x.useCallback(i=>{i.stopPropagation(),l?.(n,i.target.checked)},[l,n]);return t.jsxs("label",{className:"flex flex-col cursor-pointer min-w-0 py-[6px]",htmlFor:n,children:[t.jsxs("p",{className:"radio-label flex items-center min-w-0",children:[t.jsx("span",{className:d("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 text-neutrals-1000 flex-1 min-w-0 truncate pr-2",title:e,children:e})]}),a&&t.jsx("span",{className:"radio-description ml-6 text-neutrals-800 body-2 w-auto flex items-center",title:a,children:a}),t.jsx("input",{type:"radio",onChange:c,id:n,checked:s,className:"hidden"})]})};var v=(e=>(e.Closed="Closed",e.Opened="Opened",e))(v||{}),A=(e=>(e.LG="Large",e.SM="Small",e))(A||{});const de=({portalId:e,state:n=v.Opened,heading:s,size:r,onClose:a,children:l,overlayClassName:c,containerClassName:i,dividers:m=!0,closeButtonTitle:h})=>{const{refs:g,context:j}=p.useFloating({open:n!==v.Closed&&!!n,onOpenChange:a}),C=p.useRole(j,{role:"dialog"}),f=p.useDismiss(j,{outsidePress:!0}),{getFloatingProps:E}=p.useInteractions([C,f]),b=x.useCallback(o=>{o?.preventDefault(),o?.stopPropagation(),a()},[a]);return t.jsx(p.FloatingPortal,{id:e,children:n!==v.Closed&&t.jsx(p.FloatingOverlay,{className:d("z-modal flex items-center justify-center bg-blackout p-4",c),children:t.jsx(p.FloatingFocusManager,{context:j,children:t.jsxs("div",{className:d("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",r===A.LG&&"max-w-[65%]",r===A.SM&&"max-w-[30%]",m&&"divide-neutrals-400 divide-y",i,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:g.setFloating,...E({onClick(o){o.stopPropagation()}}),children:[t.jsxs("div",{className:"flex flex-row justify-between py-3 px-6 items-center mb-2 modal-heading sm:p-0 sm:pb-2",children:[s&&(typeof s=="string"?t.jsx("h2",{className:"flex-1 min-w-0 mr-3 modal-heading-title sm:h3",children:s}):s),t.jsx(T,{title:h,onClick:b,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),l.map(o=>o)]})})})})},ue=e=>e.state===v.Closed?null:t.jsx(de,{...e}),xe=({triggerButton:e,options:n,content:s,selectedOption:r,disabled:a,containerClassName:l,openedClassName:c,onOptionSelect:i})=>{const[m,h]=x.useState(!1),{refs:g,floatingStyles:j,context:C}=p.useFloating({open:m,onOpenChange:a?void 0:h,placement:"bottom-end",middleware:[p.offset(8),p.flip(),p.shift()],whileElementsMounted:p.autoUpdate}),f=p.useClick(C),E=p.useDismiss(C,{outsidePress:!0}),{getReferenceProps:b,getFloatingProps:o}=p.useInteractions([f,E]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:g.setReference,...b({onClick(u){u.stopPropagation()}}),className:d(l,m&&c),children:e}),m&&t.jsxs("div",{ref:g.setFloating,style:j,className:"flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",...o(),children:[s&&s,n&&n.map(u=>t.jsx("div",{onClick:y=>{y.stopPropagation(),i?.(u.key),h(!1)},className:d("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",r===u.key&&"bg-hues-100"),children:t.jsxs("div",{className:"p-2 hover:bg-hues-100 h-full dropdown-item-text flex items-center gap-x-2",title:u.title,children:[u.icon?u.icon:null,t.jsx("p",{children:u?.title})]})},u.key))]})]})},me=({limitMessages:e,query:n})=>t.jsxs("div",{className:"bg-hues-100 px-2 py-1 flex justify-between flex-wrap items-center",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:"text-primary h5",children:[e?.excelFormatTitle," "]}),t.jsx("span",{className:"text-neutrals-800 body-3",children:e?.excelFormatText})]})})}),t.jsx("a",{href:n,target:"_blank",children:t.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),he=({limitMessages:e,isDownload:n,showAdvancedViewButton:s,onAdvancedViewClick:r,query:a})=>t.jsxs("div",{className:d("bg-semantic-warning-light px-2 py-1 flex justify-between flex-wrap items-center",e?.containerClassName),children:[t.jsxs("div",{className:"flex gap-x-2 items-center",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:d("text-primary h5",e?.largeQueryClassName),children:[e?.largeQuery,":"," "]}),t.jsx("span",{className:d("text-neutrals-800 body-3",e?.limitMessageClassName),children:n?e?.downloadMessage?.(L):e?.showingLimit?.(L)})]}),n&&t.jsx("span",{className:d("text-neutrals-800 body-3",e?.limitMessageClassName),children:e?.fullLimitMessage})]})]}),s&&t.jsxs("span",{onClick:()=>r?.(),className:"flex gap-x-[4px] h4 cursor-pointer items-center text-primary",children:[e?.editIcon,e?.refineInAdvancedView]}),n&&t.jsx("a",{href:a||"",target:"_blank",children:t.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e?.dataExplorerIcon,e?.dataExplorer]})})]}),q=x.createContext(null);function pe({value:e,children:n}){const s=x.useMemo(()=>e??{},[e]);return t.jsx(q.Provider,{value:s,children:n})}function fe(){return x.useContext(q)}var S=(e=>(e.Info="info",e.Error="error",e.Warning="warning",e))(S||{});const ge=z.extendTailwindMerge({extend:{classGroups:{typography:["h1","h2","h3","h4","h5","body-1","body-2","body-3","caption"]}}});function F(...e){return ge(d(...e))}const be={[S.Info]:"border-neutrals-800 bg-neutrals-300 text-neutrals-1000",[S.Error]:"border-semantic-error bg-semantic-error-light text-neutrals-1000",[S.Warning]:"border-semantic-warning bg-semantic-warning-light text-neutrals-1000"},je="shrink-0",Ne="min-w-0 body-2",Ce="flex items-start gap-2 min-w-0 border-l-2 rounded py-2 px-4 items-center";function ye({type:e,icon:n,children:s,className:r,contentClassName:a}){const l=fe(),c=n??l?.icons?.[e],i=l?.classes?.container??Ce,m=l?.classes?.types?.[e]??be[e],h=F(i,m,r),g=F(je,l?.classes?.icon),j=F(Ne,l?.classes?.content,a);return t.jsxs("div",{"data-type":e,className:h,children:[c?t.jsx("span",{className:g,children:c}):null,s?t.jsx("div",{className:j,children:s}):null]})}var G=(e=>(e.Enter="Enter",e))(G||{});const $=x.createContext(null);function we({children:e,isAgentAvailable:n}){const s=x.useMemo(()=>({isAgentAvailable:n}),[n]);return t.jsx($.Provider,{value:s,children:e})}function ve(){const e=x.useContext($);if(!e)throw new Error("useAgentAvailability must be used within AgentAvailabilityProvider");return e}exports.AgentAvailabilityProvider=we;exports.Alert=K;exports.AlertType=N;exports.Button=Z;exports.CALENDAR_MOBILE_PADDING=M;exports.Calendar=te;exports.Checkbox=ne;exports.CloseButton=T;exports.CollapsibleBlock=se;exports.DownloadFormatMessage=me;exports.Dropdown=xe;exports.HighlightText=re;exports.IconButton=ae;exports.InlineAlert=ye;exports.InlineAlertProvider=pe;exports.InlineAlertType=S;exports.Input=Y;exports.InputWithIcon=le;exports.KeyboardKey=G;exports.Link=oe;exports.Loader=P;exports.PopUpSize=A;exports.PopUpState=v;exports.Popup=ue;exports.Radio=ie;exports.RequestLimitMessage=he;exports.SERIES_LIMIT=L;exports.TREE_NODE_ARROW_SIZE=J;exports.TREE_NODE_PADDING=ee;exports.Tag=ce;exports.useAgentAvailability=ve;exports.useDebounce=X;exports.useIsMobile=D;
|