@epam/statgpt-ui-components 0.2.0-rc.15 → 0.2.0-rc.17
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/constants/calendar.d.ts +1 -0
- package/constants/index.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +150 -148
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CALENDAR_MOBILE_PADDING = 24;
|
package/constants/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),i=require("react"),p=require("classnames"),O=require("@tabler/icons-react"),W=require("react-flatpickr"),C=require("@epam/statgpt-shared-toolkit"),h=require("@floating-ui/react"),I=()=>n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"loader"})}),P=({title:e,btnClassNames:r,iconWidth:c,iconHeight:t,onClick:o})=>n.jsx("button",{type:"button","aria-label":"button",className:r,title:e,onClick:o,children:n.jsx(O.IconX,{height:t||20,width:c||20})});var E=(e=>(e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(E||{});const B=({alertDetails:e,successIcon:r,errorIcon:c,onClose:t,closeButtonTitle:o})=>{const s=()=>(e==null?void 0:e.type)===E.IN_PROGRESS?"alert-in-progress":(e==null?void 0:e.type)===E.SUCCESS?"alert-success":"alert-error";return i.useEffect(()=>{(e==null?void 0:e.type)!==E.IN_PROGRESS&&setTimeout(()=>{t==null||t()},5e3)},[e==null?void 0:e.type,t]),n.jsx("div",{className:p("alert alert-shadow fixed bottom-3 right-3 z-10",s()),children:n.jsxs("div",{className:"alert-content flex items-start",children:[n.jsx("div",{className:"alert-icon",children:(e==null?void 0:e.type)===E.IN_PROGRESS?n.jsx(I,{}):(e==null?void 0:e.type)===E.SUCCESS?r:c}),n.jsxs("div",{className:"flex flex-col gap-2 max-w-[300px]",children:[n.jsx("h3",{className:"truncate",children:e==null?void 0:e.title}),(e==null?void 0:e.text)&&n.jsx("div",{className:"alert-text truncate",title:e==null?void 0:e.text,children:e==null?void 0:e.text})]}),n.jsx(P,{title:o,onClick:t})]})})},U=({buttonClassName:e,isLoading:r=!1,title:c,disabled:t,iconAfter:o,iconBefore:s,onClick:l,isSmallButton:d})=>{const u=p(d?"font-semibold":"",o?"mr-2":"",s?"ml-2":"");return n.jsxs("button",{type:"button",className:p("base-button",e,d?"small-button":""),disabled:t||r,"aria-label":"button",onClick:f=>l==null?void 0:l(f),title:c,children:[s,r&&n.jsx(I,{}),c?d?n.jsx("h4",{className:u,children:c}):n.jsx("h3",{className:u,children:c}):null,o]})},z=({label:e,onChange:r,value:c,options:t,calendarResolution:o=C.CalendarResolution.DAY,id:s,icon:l,isEndDate:d})=>{var v;const u=i.useRef(null);i.useEffect(()=>{var y;const b=u==null?void 0:u.current;b&&((y=b.querySelector("input"))==null||y.setAttribute("aria-label",e))},[e]);const f={...t,disableMobile:!0,defaultDate:o===C.CalendarResolution.MONTH?new Date(c.getFullYear(),c.getMonth()):c},m=(b,y,j)=>{const a=`calendar__${o===C.CalendarResolution.MONTH?"month":"day"}`;j.calendarContainer&&j.calendarContainer.classList.add(a)},w=(b,y,j)=>{if(o===C.CalendarResolution.MONTH&&b.length>0){const a=t.minDate,x=t.maxDate,N=b[0].getFullYear(),_=j.calendarContainer,g="flatpickr-disabled",q=_.querySelectorAll(".flatpickr-monthSelect-month"),$=_.querySelectorAll(".flatpickr-next-month")[0],G=_.querySelectorAll(".flatpickr-prev-month")[0];N===x.getFullYear()&&$.classList.add(g),N===a.getFullYear()&&G.classList.add(g),(N===a.getFullYear()||N===x.getFullYear())&&q.forEach(k=>{k.classList.remove(g);const R=new Date(k.getAttribute("aria-label")),H=R.getFullYear()===a.getFullYear()&&R.getMonth()===a.getMonth(),A=R.getFullYear()===x.getFullYear()&&R.getMonth()===x.getMonth();H||A||(R<a||R>x)&&k.classList.add(g)})}setTimeout(()=>{var N;const a=j.calendarContainer,x=(N=j._input)==null?void 0:N.getBoundingClientRect();a&&(a.style.top=`${x.top-a.offsetHeight-8}px`,a.style.width=`${a.style.width}px`,d?(a.style.right=`${window.innerWidth-x.right}px`,a.style.left="auto"):a.style.left=`${x.left}px`)},0)};return n.jsxs("div",{className:"relative calendar",ref:u,children:[n.jsx("div",{className:"mb-1 calendar-title",children:e}),n.jsx("label",{htmlFor:s,className:"absolute cursor-pointer right-[11px] top-[29px]",children:l||n.jsx(O.IconCalendarEvent,{})}),n.jsx(W,{defaultValue:(v=o===C.CalendarResolution.MONTH?new Date(c.getFullYear(),c.getMonth()):c)==null?void 0:v.toDateString(),options:f,onChange:b=>{r(b[0])},onOpen:[w],onReady:[m],id:s})]})},K=({label:e,id:r,checked:c,checkboxIcon:t,onChange:o})=>{const s=i.useCallback(l=>{l.stopPropagation(),o==null||o(r,l.target.checked)},[o,r]);return n.jsxs("label",{className:"flex items-center cursor-pointer min-w-0 py-1",htmlFor:r,children:[n.jsx("span",{className:p("flex justify-center items-center w-4 h-4 mr-2 relative","checkbox-button"),children:c&&t}),e&&n.jsx("p",{className:p("text-neutrals-1000 flex-1 min-w-0 truncate pr-2","checkbox-button-text"),title:e,children:e}),n.jsx("input",{type:"checkbox",onChange:s,id:r,checked:c,className:"hidden"})]})},Q=({title:e,icon:r,children:c,value:t})=>{const[o,s]=i.useState(!1);return n.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${o?"collapsible-block-open":""}`,children:[n.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>s(!o),children:[n.jsx("div",{className:`${o?"rotate-180":""} transition-transform`,children:r||n.jsx(O.IconChevronDown,{className:"w-5 h-5 mr-3"})}),n.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[n.jsx("span",{children:e}),t&&n.jsx("p",{className:"body-1 text-neutrals-800",children:t})]})]}),o&&n.jsx("div",{className:"collapsible-block-content pb-4",children:c})]})},Z=({text:e,highlightText:r})=>{const c=i.useMemo(()=>{var l;const t=[];if(!r)return[{id:0,text:e,highlight:!1}];const o=(r==null?void 0:r.toLowerCase())||"",s=((l=e==null?void 0:e.toLowerCase())==null?void 0:l.split(o))||"";for(let d=0,u=0;d<(s==null?void 0:s.length);d++){const f=s==null?void 0:s[d],m=f.length;f!==""&&t.push({id:t.length,highlight:!1,text:e==null?void 0:e.substring(u,u+m)}),u+=m,d!==(s==null?void 0:s.length)-1&&(t.push({id:t.length,highlight:!0,text:e==null?void 0:e.substring(u,u+r.length)}),u+=r.length)}return t},[r,e]);return n.jsx(n.Fragment,{children:c.map(t=>n.jsx("span",{className:p((t==null?void 0:t.highlight)&&"bg-highlight"),children:t==null?void 0:t.text},t==null?void 0:t.id))})},X=({icon:e,onClick:r,buttonClassName:c,disabled:t,title:o,isBaseIconStyles:s=!0})=>n.jsx("button",{type:"button",className:p(s&&"base-icon-button",c),onClick:l=>r==null?void 0:r(l),disabled:t,title:o,"aria-label":"button",children:e}),Y=({value:e,inputId:r,placeholder:c="",cssClass:t="",type:o="text",disabled:s,readonly:l,onChange:d,onKeyDown:u})=>{const f=p("truncate outline-none shadow-none body-1",t,l?"pointer-events-none":"");return n.jsx("input",{type:o,autoComplete:"off",id:r,placeholder:c,value:e||"",title:e?String(e):"",disabled:s,className:f,onKeyDown:u,onChange:m=>d==null?void 0:d(m.currentTarget.value)})},J=({iconBeforeInput:e,iconAfterInput:r,containerClasses:c,cssClass:t,...o})=>n.jsxs("div",{className:p("input w-full flex flex-row",c),children:[e,n.jsx(Y,{cssClass:p("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",t),...o}),r]}),V=({url:e,title:r,linkClassName:c="",iconBefore:t,iconAfter:o})=>{const s=p(o?"mr-2":"",t?"ml-2":"");return n.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:p("base-link",c),title:r,children:[t,n.jsx("span",{className:s,children:r}),o]})},D=({title:e,text:r,onClick:c})=>n.jsx("button",{type:"button",className:"tag flex items-center justify-center",onClick:()=>c==null?void 0:c(r||e),"aria-label":"button",children:n.jsx("h4",{children:e})}),M=({label:e,id:r,checked:c,radioIcon:t,description:o,onChange:s})=>{const l=i.useCallback(d=>{d.stopPropagation(),s==null||s(r,d.target.checked)},[s,r]);return n.jsxs("label",{className:"flex flex-col cursor-pointer min-w-0 py-[6px]",htmlFor:r,children:[n.jsxs("p",{className:"radio-label flex items-center min-w-0",children:[n.jsx("span",{className:p("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",c?"radio-button-active":""),children:c&&t}),e&&n.jsx("span",{className:"radio-title body-1 text-neutrals-1000 flex-1 min-w-0 truncate pr-2",title:e,children:e})]}),o&&n.jsx("span",{className:"radio-description ml-6 text-neutrals-800 body-2 w-auto flex items-center",title:o,children:o}),n.jsx("input",{type:"radio",onChange:l,id:r,checked:c,className:"hidden"})]})};var S=(e=>(e.Closed="Closed",e.Opened="Opened",e))(S||{}),F=(e=>(e.LG="Large",e.SM="Small",e))(F||{});const ee=({portalId:e,state:r=S.Opened,heading:c,size:t,onClose:o,children:s,overlayClassName:l,containerClassName:d,dividers:u=!0,closeButtonTitle:f})=>{const{refs:m,context:w}=h.useFloating({open:r!==S.Closed&&!!r,onOpenChange:o}),v=h.useRole(w,{role:"dialog"}),b=h.useDismiss(w,{outsidePress:!0}),{getFloatingProps:y}=h.useInteractions([v,b]),j=i.useCallback(a=>{a==null||a.preventDefault(),a==null||a.stopPropagation(),o()},[o]);return n.jsx(h.FloatingPortal,{id:e,children:r!==S.Closed&&n.jsx(h.FloatingOverlay,{className:p("z-modal flex items-center justify-center bg-blackout p-4",l),children:n.jsx(h.FloatingFocusManager,{context:w,children:n.jsxs("div",{className:p("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",t===F.LG&&"max-w-[65%]",t===F.SM&&"max-w-[30%]",u&&"divide-neutrals-400 divide-y",d,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:m.setFloating,...y({onClick(a){a.stopPropagation()}}),children:[n.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:[c&&(typeof c=="string"?n.jsx("h2",{className:"flex-1 min-w-0 mr-3 modal-heading-title sm:h3",children:c}):c),n.jsx(P,{title:f,onClick:j,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),s.map(a=>a)]})})})})},ne=e=>e.state===S.Closed?null:n.jsx(ee,{...e}),re=({triggerButton:e,options:r,content:c,selectedOption:t,disabled:o,containerClassName:s,openedClassName:l,onOptionSelect:d})=>{const[u,f]=i.useState(!1),{refs:m,floatingStyles:w,context:v}=h.useFloating({open:u,onOpenChange:o?void 0:f,placement:"bottom-end",middleware:[h.offset(8),h.flip(),h.shift()],whileElementsMounted:h.autoUpdate}),b=h.useClick(v),y=h.useDismiss(v,{outsidePress:!0}),{getReferenceProps:j,getFloatingProps:a}=h.useInteractions([b,y]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:m.setReference,...j({onClick(x){x.stopPropagation()}}),className:p(s,u&&l),children:e}),u&&n.jsxs("div",{ref:m.setFloating,style:w,className:"flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",...a(),children:[c&&c,r&&r.map(x=>n.jsx("div",{onClick:N=>{N.stopPropagation(),d==null||d(x.key),f(!1)},className:p("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",t===x.key&&"bg-hues-100"),children:n.jsxs("div",{className:"p-2 hover:bg-hues-100 h-full dropdown-item-text flex items-center gap-x-2",title:x.title,children:[x.icon?x.icon:null,n.jsx("p",{children:x==null?void 0:x.title})]})},x.key))]})]})},te=({limitMessages:e,query:r})=>n.jsxs("div",{className:"bg-hues-100 px-2 py-1 flex justify-between flex-wrap items-center",children:[n.jsx("div",{className:"flex gap-x-[4px]",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("div",{className:"flex gap-x-[4px]",children:[n.jsxs("span",{className:"text-primary h5",children:[e==null?void 0:e.excelFormatTitle," "]}),n.jsx("span",{className:"text-neutrals-800 body-3",children:e==null?void 0:e.excelFormatText})]})})}),n.jsx("a",{href:r,target:"_blank",children:n.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e==null?void 0:e.dataExplorerIcon,e==null?void 0:e.dataExplorer]})})]}),L=1e3,ce=({limitMessages:e,isDownload:r,showAdvancedViewButton:c,onAdvancedViewClick:t,query:o})=>{var s,l;return n.jsxs("div",{className:"bg-accent-300 px-2 py-1 flex justify-between flex-wrap items-center",children:[n.jsxs("div",{className:"flex gap-x-[4px]",children:[n.jsx("span",{children:e==null?void 0:e.warningIcon}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"flex gap-x-[4px]",children:[n.jsxs("span",{className:"text-primary h5",children:[e==null?void 0:e.largeQuery,":"," "]}),n.jsx("span",{className:"text-neutrals-800 body-3",children:r?(s=e==null?void 0:e.downloadMessage)==null?void 0:s.call(e,L):(l=e==null?void 0:e.showingLimit)==null?void 0:l.call(e,L)})]}),r&&n.jsx("span",{className:"text-neutrals-800 body-3",children:e==null?void 0:e.fullLimitMessage})]})]}),c&&n.jsxs("span",{onClick:()=>t==null?void 0:t(),className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e==null?void 0:e.editIcon,e==null?void 0:e.refineInAdvancedView]}),r&&n.jsx("a",{href:o||"",target:"_blank",children:n.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e==null?void 0:e.dataExplorerIcon,e==null?void 0:e.dataExplorer]})})]})},oe=24,se=24;function ae(e=719){const[r,c]=i.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return i.useEffect(()=>{const t=window.matchMedia(`(max-width: ${e}px)`),o=s=>{c(s.matches)};return c(t.matches),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[e]),r}function le(e,r){const c=i.useRef(null);return i.useCallback((...o)=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{e(...o)},r)},[e,r])}var T=(e=>(e.Enter="Enter",e))(T||{});exports.Alert=B;exports.AlertType=E;exports.Button=U;exports.Calendar=z;exports.Checkbox=K;exports.CloseButton=P;exports.CollapsibleBlock=Q;exports.DownloadFormatMessage=te;exports.Dropdown=re;exports.HighlightText=Z;exports.IconButton=X;exports.Input=Y;exports.InputWithIcon=J;exports.KeyboardKey=T;exports.Link=V;exports.Loader=I;exports.PopUpSize=F;exports.PopUpState=S;exports.Popup=ne;exports.Radio=M;exports.RequestLimitMessage=ce;exports.SERIES_LIMIT=L;exports.TREE_NODE_ARROW_SIZE=oe;exports.TREE_NODE_PADDING=se;exports.Tag=D;exports.useDebounce=le;exports.useIsMobile=ae;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),f=require("react"),p=require("classnames"),O=require("@tabler/icons-react"),z=require("react-flatpickr"),_=require("@epam/statgpt-shared-toolkit"),h=require("@floating-ui/react"),P=()=>n.jsx("div",{className:"flex items-center justify-center h-full",children:n.jsx("div",{className:"loader"})}),Y=({title:e,btnClassNames:r,iconWidth:c,iconHeight:t,onClick:o})=>n.jsx("button",{type:"button","aria-label":"button",className:r,title:e,onClick:o,children:n.jsx(O.IconX,{height:t||20,width:c||20})});var E=(e=>(e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(E||{});const K=({alertDetails:e,successIcon:r,errorIcon:c,onClose:t,closeButtonTitle:o})=>{const s=()=>(e==null?void 0:e.type)===E.IN_PROGRESS?"alert-in-progress":(e==null?void 0:e.type)===E.SUCCESS?"alert-success":"alert-error";return f.useEffect(()=>{(e==null?void 0:e.type)!==E.IN_PROGRESS&&setTimeout(()=>{t==null||t()},5e3)},[e==null?void 0:e.type,t]),n.jsx("div",{className:p("alert alert-shadow fixed bottom-3 right-3 z-10",s()),children:n.jsxs("div",{className:"alert-content flex items-start",children:[n.jsx("div",{className:"alert-icon",children:(e==null?void 0:e.type)===E.IN_PROGRESS?n.jsx(P,{}):(e==null?void 0:e.type)===E.SUCCESS?r:c}),n.jsxs("div",{className:"flex flex-col gap-2 max-w-[300px]",children:[n.jsx("h3",{className:"truncate",children:e==null?void 0:e.title}),(e==null?void 0:e.text)&&n.jsx("div",{className:"alert-text truncate",title:e==null?void 0:e.text,children:e==null?void 0:e.text})]}),n.jsx(Y,{title:o,onClick:t})]})})},Q=({buttonClassName:e,isLoading:r=!1,title:c,disabled:t,iconAfter:o,iconBefore:s,onClick:l,isSmallButton:d})=>{const u=p(d?"font-semibold":"",o?"mr-2":"",s?"ml-2":"");return n.jsxs("button",{type:"button",className:p("base-button",e,d?"small-button":""),disabled:t||r,"aria-label":"button",onClick:i=>l==null?void 0:l(i),title:c,children:[s,r&&n.jsx(P,{}),c?d?n.jsx("h4",{className:u,children:c}):n.jsx("h3",{className:u,children:c}):null,o]})};function T(e=719){const[r,c]=f.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return f.useEffect(()=>{const t=window.matchMedia(`(max-width: ${e}px)`),o=s=>{c(s.matches)};return c(t.matches),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[e]),r}function Z(e,r){const c=f.useRef(null);return f.useCallback((...o)=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{e(...o)},r)},[e,r])}const X=24,J=24,k=1e3,q=24,V=({label:e,onChange:r,value:c,options:t,calendarResolution:o=_.CalendarResolution.DAY,id:s,icon:l,isEndDate:d})=>{var R;const u=f.useRef(null),i=T();f.useEffect(()=>{var N;const b=u==null?void 0:u.current;b&&((N=b.querySelector("input"))==null||N.setAttribute("aria-label",e))},[e]);const m={...t,disableMobile:!0,defaultDate:o===_.CalendarResolution.MONTH?new Date(c.getFullYear(),c.getMonth()):c},y=(b,N,x)=>{const a=`calendar__${o===_.CalendarResolution.MONTH?"month":"day"}`;x.calendarContainer&&x.calendarContainer.classList.add(a)},v=(b,N,x)=>{if(o===_.CalendarResolution.MONTH&&b.length>0){const a=t.minDate,j=t.maxDate,w=b[0].getFullYear(),L=x.calendarContainer,g="flatpickr-disabled",$=L.querySelectorAll(".flatpickr-monthSelect-month"),H=L.querySelectorAll(".flatpickr-next-month")[0],B=L.querySelectorAll(".flatpickr-prev-month")[0];w===j.getFullYear()&&H.classList.add(g),w===a.getFullYear()&&B.classList.add(g),(w===a.getFullYear()||w===j.getFullYear())&&$.forEach(I=>{I.classList.remove(g);const C=new Date(I.getAttribute("aria-label")),W=C.getFullYear()===a.getFullYear()&&C.getMonth()===a.getMonth(),U=C.getFullYear()===j.getFullYear()&&C.getMonth()===j.getMonth();W||U||(C<a||C>j)&&I.classList.add(g)})}setTimeout(()=>{var w;const a=x.calendarContainer,j=(w=x._input)==null?void 0:w.getBoundingClientRect();a&&(a.style.top=`${j.top-a.offsetHeight-8}px`,a.style.width=`${a.style.width}px`,d?(a.style.right=`${window.innerWidth-j.right-(i?q:0)}px`,a.style.left="auto"):a.style.left=`${j.left}px`)},0)};return n.jsxs("div",{className:"relative calendar",ref:u,children:[n.jsx("div",{className:"mb-1 calendar-title",children:e}),n.jsx("label",{htmlFor:s,className:"absolute cursor-pointer right-[11px] top-[29px]",children:l||n.jsx(O.IconCalendarEvent,{})}),n.jsx(z,{defaultValue:(R=o===_.CalendarResolution.MONTH?new Date(c.getFullYear(),c.getMonth()):c)==null?void 0:R.toDateString(),options:m,onChange:b=>{r(b[0])},onOpen:[v],onReady:[y],id:s})]})},D=({label:e,id:r,checked:c,checkboxIcon:t,onChange:o})=>{const s=f.useCallback(l=>{l.stopPropagation(),o==null||o(r,l.target.checked)},[o,r]);return n.jsxs("label",{className:"flex items-center cursor-pointer min-w-0 py-1",htmlFor:r,children:[n.jsx("span",{className:p("flex justify-center items-center w-4 h-4 mr-2 relative","checkbox-button"),children:c&&t}),e&&n.jsx("p",{className:p("text-neutrals-1000 flex-1 min-w-0 truncate pr-2","checkbox-button-text"),title:e,children:e}),n.jsx("input",{type:"checkbox",onChange:s,id:r,checked:c,className:"hidden"})]})},M=({title:e,icon:r,children:c,value:t})=>{const[o,s]=f.useState(!1);return n.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${o?"collapsible-block-open":""}`,children:[n.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>s(!o),children:[n.jsx("div",{className:`${o?"rotate-180":""} transition-transform`,children:r||n.jsx(O.IconChevronDown,{className:"w-5 h-5 mr-3"})}),n.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[n.jsx("span",{children:e}),t&&n.jsx("p",{className:"body-1 text-neutrals-800",children:t})]})]}),o&&n.jsx("div",{className:"collapsible-block-content pb-4",children:c})]})},ee=({text:e,highlightText:r})=>{const c=f.useMemo(()=>{var l;const t=[];if(!r)return[{id:0,text:e,highlight:!1}];const o=(r==null?void 0:r.toLowerCase())||"",s=((l=e==null?void 0:e.toLowerCase())==null?void 0:l.split(o))||"";for(let d=0,u=0;d<(s==null?void 0:s.length);d++){const i=s==null?void 0:s[d],m=i.length;i!==""&&t.push({id:t.length,highlight:!1,text:e==null?void 0:e.substring(u,u+m)}),u+=m,d!==(s==null?void 0:s.length)-1&&(t.push({id:t.length,highlight:!0,text:e==null?void 0:e.substring(u,u+r.length)}),u+=r.length)}return t},[r,e]);return n.jsx(n.Fragment,{children:c.map(t=>n.jsx("span",{className:p((t==null?void 0:t.highlight)&&"bg-highlight"),children:t==null?void 0:t.text},t==null?void 0:t.id))})},ne=({icon:e,onClick:r,buttonClassName:c,disabled:t,title:o,isBaseIconStyles:s=!0})=>n.jsx("button",{type:"button",className:p(s&&"base-icon-button",c),onClick:l=>r==null?void 0:r(l),disabled:t,title:o,"aria-label":"button",children:e}),A=({value:e,inputId:r,placeholder:c="",cssClass:t="",type:o="text",disabled:s,readonly:l,onChange:d,onKeyDown:u})=>{const i=p("truncate outline-none shadow-none body-1",t,l?"pointer-events-none":"");return n.jsx("input",{type:o,autoComplete:"off",id:r,placeholder:c,value:e||"",title:e?String(e):"",disabled:s,className:i,onKeyDown:u,onChange:m=>d==null?void 0:d(m.currentTarget.value)})},re=({iconBeforeInput:e,iconAfterInput:r,containerClasses:c,cssClass:t,...o})=>n.jsxs("div",{className:p("input w-full flex flex-row",c),children:[e,n.jsx(A,{cssClass:p("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",t),...o}),r]}),te=({url:e,title:r,linkClassName:c="",iconBefore:t,iconAfter:o})=>{const s=p(o?"mr-2":"",t?"ml-2":"");return n.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:p("base-link",c),title:r,children:[t,n.jsx("span",{className:s,children:r}),o]})},ce=({title:e,text:r,onClick:c})=>n.jsx("button",{type:"button",className:"tag flex items-center justify-center",onClick:()=>c==null?void 0:c(r||e),"aria-label":"button",children:n.jsx("h4",{children:e})}),oe=({label:e,id:r,checked:c,radioIcon:t,description:o,onChange:s})=>{const l=f.useCallback(d=>{d.stopPropagation(),s==null||s(r,d.target.checked)},[s,r]);return n.jsxs("label",{className:"flex flex-col cursor-pointer min-w-0 py-[6px]",htmlFor:r,children:[n.jsxs("p",{className:"radio-label flex items-center min-w-0",children:[n.jsx("span",{className:p("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",c?"radio-button-active":""),children:c&&t}),e&&n.jsx("span",{className:"radio-title body-1 text-neutrals-1000 flex-1 min-w-0 truncate pr-2",title:e,children:e})]}),o&&n.jsx("span",{className:"radio-description ml-6 text-neutrals-800 body-2 w-auto flex items-center",title:o,children:o}),n.jsx("input",{type:"radio",onChange:l,id:r,checked:c,className:"hidden"})]})};var S=(e=>(e.Closed="Closed",e.Opened="Opened",e))(S||{}),F=(e=>(e.LG="Large",e.SM="Small",e))(F||{});const se=({portalId:e,state:r=S.Opened,heading:c,size:t,onClose:o,children:s,overlayClassName:l,containerClassName:d,dividers:u=!0,closeButtonTitle:i})=>{const{refs:m,context:y}=h.useFloating({open:r!==S.Closed&&!!r,onOpenChange:o}),v=h.useRole(y,{role:"dialog"}),R=h.useDismiss(y,{outsidePress:!0}),{getFloatingProps:b}=h.useInteractions([v,R]),N=f.useCallback(x=>{x==null||x.preventDefault(),x==null||x.stopPropagation(),o()},[o]);return n.jsx(h.FloatingPortal,{id:e,children:r!==S.Closed&&n.jsx(h.FloatingOverlay,{className:p("z-modal flex items-center justify-center bg-blackout p-4",l),children:n.jsx(h.FloatingFocusManager,{context:y,children:n.jsxs("div",{className:p("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",t===F.LG&&"max-w-[65%]",t===F.SM&&"max-w-[30%]",u&&"divide-neutrals-400 divide-y",d,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:m.setFloating,...b({onClick(x){x.stopPropagation()}}),children:[n.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:[c&&(typeof c=="string"?n.jsx("h2",{className:"flex-1 min-w-0 mr-3 modal-heading-title sm:h3",children:c}):c),n.jsx(Y,{title:i,onClick:N,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),s.map(x=>x)]})})})})},ae=e=>e.state===S.Closed?null:n.jsx(se,{...e}),le=({triggerButton:e,options:r,content:c,selectedOption:t,disabled:o,containerClassName:s,openedClassName:l,onOptionSelect:d})=>{const[u,i]=f.useState(!1),{refs:m,floatingStyles:y,context:v}=h.useFloating({open:u,onOpenChange:o?void 0:i,placement:"bottom-end",middleware:[h.offset(8),h.flip(),h.shift()],whileElementsMounted:h.autoUpdate}),R=h.useClick(v),b=h.useDismiss(v,{outsidePress:!0}),{getReferenceProps:N,getFloatingProps:x}=h.useInteractions([R,b]);return n.jsxs(n.Fragment,{children:[n.jsx("div",{ref:m.setReference,...N({onClick(a){a.stopPropagation()}}),className:p(s,u&&l),children:e}),u&&n.jsxs("div",{ref:m.setFloating,style:y,className:"flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",...x(),children:[c&&c,r&&r.map(a=>n.jsx("div",{onClick:j=>{j.stopPropagation(),d==null||d(a.key),i(!1)},className:p("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",t===a.key&&"bg-hues-100"),children:n.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,n.jsx("p",{children:a==null?void 0:a.title})]})},a.key))]})]})},de=({limitMessages:e,query:r})=>n.jsxs("div",{className:"bg-hues-100 px-2 py-1 flex justify-between flex-wrap items-center",children:[n.jsx("div",{className:"flex gap-x-[4px]",children:n.jsx("div",{className:"flex flex-col",children:n.jsxs("div",{className:"flex gap-x-[4px]",children:[n.jsxs("span",{className:"text-primary h5",children:[e==null?void 0:e.excelFormatTitle," "]}),n.jsx("span",{className:"text-neutrals-800 body-3",children:e==null?void 0:e.excelFormatText})]})})}),n.jsx("a",{href:r,target:"_blank",children:n.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e==null?void 0:e.dataExplorerIcon,e==null?void 0:e.dataExplorer]})})]}),ue=({limitMessages:e,isDownload:r,showAdvancedViewButton:c,onAdvancedViewClick:t,query:o})=>{var s,l;return n.jsxs("div",{className:"bg-accent-300 px-2 py-1 flex justify-between flex-wrap items-center",children:[n.jsxs("div",{className:"flex gap-x-[4px]",children:[n.jsx("span",{children:e==null?void 0:e.warningIcon}),n.jsxs("div",{className:"flex flex-col",children:[n.jsxs("div",{className:"flex gap-x-[4px]",children:[n.jsxs("span",{className:"text-primary h5",children:[e==null?void 0:e.largeQuery,":"," "]}),n.jsx("span",{className:"text-neutrals-800 body-3",children:r?(s=e==null?void 0:e.downloadMessage)==null?void 0:s.call(e,k):(l=e==null?void 0:e.showingLimit)==null?void 0:l.call(e,k)})]}),r&&n.jsx("span",{className:"text-neutrals-800 body-3",children:e==null?void 0:e.fullLimitMessage})]})]}),c&&n.jsxs("span",{onClick:()=>t==null?void 0:t(),className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e==null?void 0:e.editIcon,e==null?void 0:e.refineInAdvancedView]}),r&&n.jsx("a",{href:o||"",target:"_blank",children:n.jsxs("span",{className:"flex gap-x-[4px] body-3 cursor-pointer items-center",children:[e==null?void 0:e.dataExplorerIcon,e==null?void 0:e.dataExplorer]})})]})};var G=(e=>(e.Enter="Enter",e))(G||{});exports.Alert=K;exports.AlertType=E;exports.Button=Q;exports.CALENDAR_MOBILE_PADDING=q;exports.Calendar=V;exports.Checkbox=D;exports.CloseButton=Y;exports.CollapsibleBlock=M;exports.DownloadFormatMessage=de;exports.Dropdown=le;exports.HighlightText=ee;exports.IconButton=ne;exports.Input=A;exports.InputWithIcon=re;exports.KeyboardKey=G;exports.Link=te;exports.Loader=P;exports.PopUpSize=F;exports.PopUpState=S;exports.Popup=ae;exports.Radio=oe;exports.RequestLimitMessage=ue;exports.SERIES_LIMIT=k;exports.TREE_NODE_ARROW_SIZE=X;exports.TREE_NODE_PADDING=J;exports.Tag=ce;exports.useDebounce=Z;exports.useIsMobile=T;
|
package/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as c, jsxs as d, Fragment as j } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as P, useState as Y, useRef as G, useCallback as g, useMemo as X } from "react";
|
|
3
3
|
import f from "classnames";
|
|
4
|
-
import { IconX as
|
|
5
|
-
import
|
|
6
|
-
import { CalendarResolution as
|
|
7
|
-
import { useFloating as $, useRole as
|
|
4
|
+
import { IconX as Z, IconCalendarEvent as J, IconChevronDown as K } from "@tabler/icons-react";
|
|
5
|
+
import V from "react-flatpickr";
|
|
6
|
+
import { CalendarResolution as S } from "@epam/statgpt-shared-toolkit";
|
|
7
|
+
import { useFloating as $, useRole as D, useDismiss as H, useInteractions as A, FloatingPortal as M, FloatingOverlay as nn, FloatingFocusManager as en, autoUpdate as rn, offset as tn, flip as cn, shift as on, useClick as an } from "@floating-ui/react";
|
|
8
8
|
const T = () => /* @__PURE__ */ c("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "loader" }) }), q = ({
|
|
9
9
|
title: n,
|
|
10
10
|
btnClassNames: e,
|
|
@@ -19,20 +19,20 @@ const T = () => /* @__PURE__ */ c("div", { className: "flex items-center justify
|
|
|
19
19
|
className: e,
|
|
20
20
|
title: n,
|
|
21
21
|
onClick: o,
|
|
22
|
-
children: /* @__PURE__ */ c(
|
|
22
|
+
children: /* @__PURE__ */ c(Z, { height: r || 20, width: t || 20 })
|
|
23
23
|
}
|
|
24
24
|
);
|
|
25
|
-
var
|
|
26
|
-
const
|
|
25
|
+
var R = /* @__PURE__ */ ((n) => (n.ERROR = "error", n.SUCCESS = "success", n.IN_PROGRESS = "in_progress", n))(R || {});
|
|
26
|
+
const wn = ({
|
|
27
27
|
alertDetails: n,
|
|
28
28
|
successIcon: e,
|
|
29
29
|
errorIcon: t,
|
|
30
30
|
onClose: r,
|
|
31
31
|
closeButtonTitle: o
|
|
32
32
|
}) => {
|
|
33
|
-
const a = () => (n == null ? void 0 : n.type) ===
|
|
34
|
-
return
|
|
35
|
-
(n == null ? void 0 : n.type) !==
|
|
33
|
+
const a = () => (n == null ? void 0 : n.type) === R.IN_PROGRESS ? "alert-in-progress" : (n == null ? void 0 : n.type) === R.SUCCESS ? "alert-success" : "alert-error";
|
|
34
|
+
return P(() => {
|
|
35
|
+
(n == null ? void 0 : n.type) !== R.IN_PROGRESS && setTimeout(() => {
|
|
36
36
|
r == null || r();
|
|
37
37
|
}, 5e3);
|
|
38
38
|
}, [n == null ? void 0 : n.type, r]), /* @__PURE__ */ c(
|
|
@@ -43,7 +43,7 @@ const xn = ({
|
|
|
43
43
|
a()
|
|
44
44
|
),
|
|
45
45
|
children: /* @__PURE__ */ d("div", { className: "alert-content flex items-start", children: [
|
|
46
|
-
/* @__PURE__ */ c("div", { className: "alert-icon", children: (n == null ? void 0 : n.type) ===
|
|
46
|
+
/* @__PURE__ */ c("div", { className: "alert-icon", children: (n == null ? void 0 : n.type) === R.IN_PROGRESS ? /* @__PURE__ */ c(T, {}) : (n == null ? void 0 : n.type) === R.SUCCESS ? e : t }),
|
|
47
47
|
/* @__PURE__ */ d("div", { className: "flex flex-col gap-2 max-w-[300px]", children: [
|
|
48
48
|
/* @__PURE__ */ c("h3", { className: "truncate", children: n == null ? void 0 : n.title }),
|
|
49
49
|
(n == null ? void 0 : n.text) && /* @__PURE__ */ c("div", { className: "alert-text truncate", title: n == null ? void 0 : n.text, children: n == null ? void 0 : n.text })
|
|
@@ -52,7 +52,7 @@ const xn = ({
|
|
|
52
52
|
] })
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
|
-
},
|
|
55
|
+
}, vn = ({
|
|
56
56
|
buttonClassName: n,
|
|
57
57
|
isLoading: e = !1,
|
|
58
58
|
title: t,
|
|
@@ -88,49 +88,72 @@ const xn = ({
|
|
|
88
88
|
]
|
|
89
89
|
}
|
|
90
90
|
);
|
|
91
|
-
}
|
|
91
|
+
};
|
|
92
|
+
function ln(n = 719) {
|
|
93
|
+
const [e, t] = Y(
|
|
94
|
+
() => typeof window < "u" ? window.innerWidth < n : !1
|
|
95
|
+
);
|
|
96
|
+
return P(() => {
|
|
97
|
+
const r = window.matchMedia(`(max-width: ${n}px)`), o = (a) => {
|
|
98
|
+
t(a.matches);
|
|
99
|
+
};
|
|
100
|
+
return t(r.matches), r.addEventListener("change", o), () => r.removeEventListener("change", o);
|
|
101
|
+
}, [n]), e;
|
|
102
|
+
}
|
|
103
|
+
function En(n, e) {
|
|
104
|
+
const t = G(null);
|
|
105
|
+
return g(
|
|
106
|
+
(...o) => {
|
|
107
|
+
t.current && clearTimeout(t.current), t.current = setTimeout(() => {
|
|
108
|
+
n(...o);
|
|
109
|
+
}, e);
|
|
110
|
+
},
|
|
111
|
+
[n, e]
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
const Fn = 24, Rn = 24, I = 1e3, dn = 24, Sn = ({
|
|
92
115
|
label: n,
|
|
93
116
|
onChange: e,
|
|
94
117
|
value: t,
|
|
95
118
|
options: r,
|
|
96
|
-
calendarResolution: o =
|
|
119
|
+
calendarResolution: o = S.DAY,
|
|
97
120
|
id: a,
|
|
98
121
|
icon: u,
|
|
99
122
|
isEndDate: s
|
|
100
123
|
}) => {
|
|
101
|
-
var
|
|
102
|
-
const p =
|
|
103
|
-
|
|
104
|
-
var
|
|
124
|
+
var E;
|
|
125
|
+
const p = G(null), i = ln();
|
|
126
|
+
P(() => {
|
|
127
|
+
var N;
|
|
105
128
|
const m = p == null ? void 0 : p.current;
|
|
106
|
-
m && ((
|
|
129
|
+
m && ((N = m.querySelector("input")) == null || N.setAttribute("aria-label", n));
|
|
107
130
|
}, [n]);
|
|
108
|
-
const
|
|
131
|
+
const b = {
|
|
109
132
|
...r,
|
|
110
133
|
disableMobile: !0,
|
|
111
|
-
defaultDate: o ===
|
|
112
|
-
},
|
|
113
|
-
const l = `calendar__${o ===
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
if (o ===
|
|
117
|
-
const l = r.minDate,
|
|
134
|
+
defaultDate: o === S.MONTH ? new Date(t.getFullYear(), t.getMonth()) : t
|
|
135
|
+
}, y = (m, N, h) => {
|
|
136
|
+
const l = `calendar__${o === S.MONTH ? "month" : "day"}`;
|
|
137
|
+
h.calendarContainer && h.calendarContainer.classList.add(l);
|
|
138
|
+
}, v = (m, N, h) => {
|
|
139
|
+
if (o === S.MONTH && m.length > 0) {
|
|
140
|
+
const l = r.minDate, x = r.maxDate, w = m[0].getFullYear(), L = h.calendarContainer, C = "flatpickr-disabled", W = L.querySelectorAll(
|
|
118
141
|
".flatpickr-monthSelect-month"
|
|
119
|
-
),
|
|
142
|
+
), B = L.querySelectorAll(
|
|
120
143
|
".flatpickr-next-month"
|
|
121
|
-
)[0], Q =
|
|
144
|
+
)[0], Q = L.querySelectorAll(
|
|
122
145
|
".flatpickr-prev-month"
|
|
123
146
|
)[0];
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
U || z || (
|
|
147
|
+
w === x.getFullYear() && B.classList.add(C), w === l.getFullYear() && Q.classList.add(C), (w === l.getFullYear() || w === x.getFullYear()) && W.forEach((O) => {
|
|
148
|
+
O.classList.remove(C);
|
|
149
|
+
const F = new Date(O.getAttribute("aria-label")), U = F.getFullYear() === l.getFullYear() && F.getMonth() === l.getMonth(), z = F.getFullYear() === x.getFullYear() && F.getMonth() === x.getMonth();
|
|
150
|
+
U || z || (F < l || F > x) && O.classList.add(C);
|
|
128
151
|
});
|
|
129
152
|
}
|
|
130
153
|
setTimeout(() => {
|
|
131
|
-
var
|
|
132
|
-
const l =
|
|
133
|
-
l && (l.style.top = `${
|
|
154
|
+
var w;
|
|
155
|
+
const l = h.calendarContainer, x = (w = h._input) == null ? void 0 : w.getBoundingClientRect();
|
|
156
|
+
l && (l.style.top = `${x.top - l.offsetHeight - 8}px`, l.style.width = `${l.style.width}px`, s ? (l.style.right = `${window.innerWidth - x.right - (i ? dn : 0)}px`, l.style.left = "auto") : l.style.left = `${x.left}px`);
|
|
134
157
|
}, 0);
|
|
135
158
|
};
|
|
136
159
|
return /* @__PURE__ */ d("div", { className: "relative calendar", ref: p, children: [
|
|
@@ -140,31 +163,31 @@ const xn = ({
|
|
|
140
163
|
{
|
|
141
164
|
htmlFor: a,
|
|
142
165
|
className: "absolute cursor-pointer right-[11px] top-[29px]",
|
|
143
|
-
children: u || /* @__PURE__ */ c(
|
|
166
|
+
children: u || /* @__PURE__ */ c(J, {})
|
|
144
167
|
}
|
|
145
168
|
),
|
|
146
169
|
/* @__PURE__ */ c(
|
|
147
|
-
|
|
170
|
+
V,
|
|
148
171
|
{
|
|
149
|
-
defaultValue: (
|
|
150
|
-
options:
|
|
172
|
+
defaultValue: (E = o === S.MONTH ? new Date(t.getFullYear(), t.getMonth()) : t) == null ? void 0 : E.toDateString(),
|
|
173
|
+
options: b,
|
|
151
174
|
onChange: (m) => {
|
|
152
175
|
e(m[0]);
|
|
153
176
|
},
|
|
154
|
-
onOpen: [
|
|
155
|
-
onReady: [
|
|
177
|
+
onOpen: [v],
|
|
178
|
+
onReady: [y],
|
|
156
179
|
id: a
|
|
157
180
|
}
|
|
158
181
|
)
|
|
159
182
|
] });
|
|
160
|
-
},
|
|
183
|
+
}, _n = ({
|
|
161
184
|
label: n,
|
|
162
185
|
id: e,
|
|
163
186
|
checked: t,
|
|
164
187
|
checkboxIcon: r,
|
|
165
188
|
onChange: o
|
|
166
189
|
}) => {
|
|
167
|
-
const a =
|
|
190
|
+
const a = g(
|
|
168
191
|
(u) => {
|
|
169
192
|
u.stopPropagation(), o == null || o(e, u.target.checked);
|
|
170
193
|
},
|
|
@@ -210,13 +233,13 @@ const xn = ({
|
|
|
210
233
|
]
|
|
211
234
|
}
|
|
212
235
|
);
|
|
213
|
-
},
|
|
236
|
+
}, Cn = ({
|
|
214
237
|
title: n,
|
|
215
238
|
icon: e,
|
|
216
239
|
children: t,
|
|
217
240
|
value: r
|
|
218
241
|
}) => {
|
|
219
|
-
const [o, a] =
|
|
242
|
+
const [o, a] = Y(!1);
|
|
220
243
|
return /* @__PURE__ */ d(
|
|
221
244
|
"div",
|
|
222
245
|
{
|
|
@@ -228,7 +251,7 @@ const xn = ({
|
|
|
228
251
|
className: "collapsible-block-title flex cursor-pointer items-center py-4",
|
|
229
252
|
onClick: () => a(!o),
|
|
230
253
|
children: [
|
|
231
|
-
/* @__PURE__ */ c("div", { className: `${o ? "rotate-180" : ""} transition-transform`, children: e || /* @__PURE__ */ c(
|
|
254
|
+
/* @__PURE__ */ c("div", { className: `${o ? "rotate-180" : ""} transition-transform`, children: e || /* @__PURE__ */ c(K, { className: "w-5 h-5 mr-3" }) }),
|
|
232
255
|
/* @__PURE__ */ d("div", { className: "flex flex-1 items-center justify-between", children: [
|
|
233
256
|
/* @__PURE__ */ c("span", { children: n }),
|
|
234
257
|
r && /* @__PURE__ */ c("p", { className: "body-1 text-neutrals-800", children: r })
|
|
@@ -240,8 +263,8 @@ const xn = ({
|
|
|
240
263
|
]
|
|
241
264
|
}
|
|
242
265
|
);
|
|
243
|
-
},
|
|
244
|
-
const t =
|
|
266
|
+
}, gn = ({ text: n, highlightText: e }) => {
|
|
267
|
+
const t = X(() => {
|
|
245
268
|
var u;
|
|
246
269
|
const r = [];
|
|
247
270
|
if (!e)
|
|
@@ -275,7 +298,7 @@ const xn = ({
|
|
|
275
298
|
},
|
|
276
299
|
r == null ? void 0 : r.id
|
|
277
300
|
)) });
|
|
278
|
-
},
|
|
301
|
+
}, Ln = ({
|
|
279
302
|
icon: n,
|
|
280
303
|
onClick: e,
|
|
281
304
|
buttonClassName: t,
|
|
@@ -296,7 +319,7 @@ const xn = ({
|
|
|
296
319
|
"aria-label": "button",
|
|
297
320
|
children: n
|
|
298
321
|
}
|
|
299
|
-
),
|
|
322
|
+
), un = ({
|
|
300
323
|
value: n,
|
|
301
324
|
inputId: e,
|
|
302
325
|
placeholder: t = "",
|
|
@@ -327,7 +350,7 @@ const xn = ({
|
|
|
327
350
|
onChange: (b) => s == null ? void 0 : s(b.currentTarget.value)
|
|
328
351
|
}
|
|
329
352
|
);
|
|
330
|
-
},
|
|
353
|
+
}, On = ({
|
|
331
354
|
iconBeforeInput: n,
|
|
332
355
|
iconAfterInput: e,
|
|
333
356
|
containerClasses: t,
|
|
@@ -336,7 +359,7 @@ const xn = ({
|
|
|
336
359
|
}) => /* @__PURE__ */ d("div", { className: f("input w-full flex flex-row", t), children: [
|
|
337
360
|
n,
|
|
338
361
|
/* @__PURE__ */ c(
|
|
339
|
-
|
|
362
|
+
un,
|
|
340
363
|
{
|
|
341
364
|
cssClass: f(
|
|
342
365
|
"border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",
|
|
@@ -346,7 +369,7 @@ const xn = ({
|
|
|
346
369
|
}
|
|
347
370
|
),
|
|
348
371
|
e
|
|
349
|
-
] }),
|
|
372
|
+
] }), kn = ({
|
|
350
373
|
url: n,
|
|
351
374
|
title: e,
|
|
352
375
|
linkClassName: t = "",
|
|
@@ -372,7 +395,7 @@ const xn = ({
|
|
|
372
395
|
]
|
|
373
396
|
}
|
|
374
397
|
);
|
|
375
|
-
},
|
|
398
|
+
}, Pn = ({ title: n, text: e, onClick: t }) => /* @__PURE__ */ c(
|
|
376
399
|
"button",
|
|
377
400
|
{
|
|
378
401
|
type: "button",
|
|
@@ -381,7 +404,7 @@ const xn = ({
|
|
|
381
404
|
"aria-label": "button",
|
|
382
405
|
children: /* @__PURE__ */ c("h4", { children: n })
|
|
383
406
|
}
|
|
384
|
-
),
|
|
407
|
+
), Yn = ({
|
|
385
408
|
label: n,
|
|
386
409
|
id: e,
|
|
387
410
|
checked: t,
|
|
@@ -389,7 +412,7 @@ const xn = ({
|
|
|
389
412
|
description: o,
|
|
390
413
|
onChange: a
|
|
391
414
|
}) => {
|
|
392
|
-
const u =
|
|
415
|
+
const u = g(
|
|
393
416
|
(s) => {
|
|
394
417
|
s.stopPropagation(), a == null || a(e, s.target.checked);
|
|
395
418
|
},
|
|
@@ -444,10 +467,10 @@ const xn = ({
|
|
|
444
467
|
}
|
|
445
468
|
);
|
|
446
469
|
};
|
|
447
|
-
var
|
|
448
|
-
const
|
|
470
|
+
var _ = /* @__PURE__ */ ((n) => (n.Closed = "Closed", n.Opened = "Opened", n))(_ || {}), k = /* @__PURE__ */ ((n) => (n.LG = "Large", n.SM = "Small", n))(k || {});
|
|
471
|
+
const sn = ({
|
|
449
472
|
portalId: n,
|
|
450
|
-
state: e =
|
|
473
|
+
state: e = _.Opened,
|
|
451
474
|
heading: t,
|
|
452
475
|
size: r,
|
|
453
476
|
onClose: o,
|
|
@@ -457,37 +480,37 @@ const ln = ({
|
|
|
457
480
|
dividers: p = !0,
|
|
458
481
|
closeButtonTitle: i
|
|
459
482
|
}) => {
|
|
460
|
-
const { refs: b, context:
|
|
461
|
-
open: e !==
|
|
483
|
+
const { refs: b, context: y } = $({
|
|
484
|
+
open: e !== _.Closed && !!e,
|
|
462
485
|
onOpenChange: o
|
|
463
|
-
}), v =
|
|
464
|
-
(
|
|
465
|
-
|
|
486
|
+
}), v = D(y, { role: "dialog" }), E = H(y, { outsidePress: !0 }), { getFloatingProps: m } = A([v, E]), N = g(
|
|
487
|
+
(h) => {
|
|
488
|
+
h == null || h.preventDefault(), h == null || h.stopPropagation(), o();
|
|
466
489
|
},
|
|
467
490
|
[o]
|
|
468
491
|
);
|
|
469
|
-
return /* @__PURE__ */ c(
|
|
470
|
-
|
|
492
|
+
return /* @__PURE__ */ c(M, { id: n, children: e !== _.Closed && /* @__PURE__ */ c(
|
|
493
|
+
nn,
|
|
471
494
|
{
|
|
472
495
|
className: f(
|
|
473
496
|
"z-modal flex items-center justify-center bg-blackout p-4",
|
|
474
497
|
u
|
|
475
498
|
),
|
|
476
|
-
children: /* @__PURE__ */ c(
|
|
499
|
+
children: /* @__PURE__ */ c(en, { context: y, children: /* @__PURE__ */ d(
|
|
477
500
|
"div",
|
|
478
501
|
{
|
|
479
502
|
className: f(
|
|
480
503
|
"relative max-h-full modal rounded bg-white flex flex-col shadow w-full",
|
|
481
|
-
r ===
|
|
482
|
-
r ===
|
|
504
|
+
r === k.LG && "max-w-[65%]",
|
|
505
|
+
r === k.SM && "max-w-[30%]",
|
|
483
506
|
p && "divide-neutrals-400 divide-y",
|
|
484
507
|
s,
|
|
485
508
|
"sm:w-full sm:max-w-full sm:px-4 sm:py-6"
|
|
486
509
|
),
|
|
487
510
|
ref: b.setFloating,
|
|
488
|
-
...
|
|
489
|
-
onClick(
|
|
490
|
-
|
|
511
|
+
...m({
|
|
512
|
+
onClick(h) {
|
|
513
|
+
h.stopPropagation();
|
|
491
514
|
}
|
|
492
515
|
}),
|
|
493
516
|
children: [
|
|
@@ -497,18 +520,18 @@ const ln = ({
|
|
|
497
520
|
q,
|
|
498
521
|
{
|
|
499
522
|
title: i,
|
|
500
|
-
onClick:
|
|
523
|
+
onClick: N,
|
|
501
524
|
btnClassNames: "sm:h-[24px] sm:w-[24px] sm:top-4"
|
|
502
525
|
}
|
|
503
526
|
)
|
|
504
527
|
] }),
|
|
505
|
-
a.map((
|
|
528
|
+
a.map((h) => h)
|
|
506
529
|
]
|
|
507
530
|
}
|
|
508
531
|
) })
|
|
509
532
|
}
|
|
510
533
|
) });
|
|
511
|
-
},
|
|
534
|
+
}, In = (n) => n.state === _.Closed ? null : /* @__PURE__ */ c(sn, { ...n }), jn = ({
|
|
512
535
|
triggerButton: n,
|
|
513
536
|
options: e,
|
|
514
537
|
content: t,
|
|
@@ -518,24 +541,24 @@ const ln = ({
|
|
|
518
541
|
openedClassName: u,
|
|
519
542
|
onOptionSelect: s
|
|
520
543
|
}) => {
|
|
521
|
-
const [p, i] =
|
|
544
|
+
const [p, i] = Y(!1), { refs: b, floatingStyles: y, context: v } = $({
|
|
522
545
|
open: p,
|
|
523
546
|
onOpenChange: o ? void 0 : i,
|
|
524
547
|
placement: "bottom-end",
|
|
525
|
-
middleware: [
|
|
526
|
-
whileElementsMounted:
|
|
527
|
-
}),
|
|
528
|
-
|
|
529
|
-
|
|
548
|
+
middleware: [tn(8), cn(), on()],
|
|
549
|
+
whileElementsMounted: rn
|
|
550
|
+
}), E = an(v), m = H(v, { outsidePress: !0 }), { getReferenceProps: N, getFloatingProps: h } = A([
|
|
551
|
+
E,
|
|
552
|
+
m
|
|
530
553
|
]);
|
|
531
554
|
return /* @__PURE__ */ d(j, { children: [
|
|
532
555
|
/* @__PURE__ */ c(
|
|
533
556
|
"div",
|
|
534
557
|
{
|
|
535
558
|
ref: b.setReference,
|
|
536
|
-
...
|
|
537
|
-
onClick(
|
|
538
|
-
|
|
559
|
+
...N({
|
|
560
|
+
onClick(l) {
|
|
561
|
+
l.stopPropagation();
|
|
539
562
|
}
|
|
540
563
|
}),
|
|
541
564
|
className: f(a, p && u),
|
|
@@ -546,40 +569,40 @@ const ln = ({
|
|
|
546
569
|
"div",
|
|
547
570
|
{
|
|
548
571
|
ref: b.setFloating,
|
|
549
|
-
style:
|
|
572
|
+
style: y,
|
|
550
573
|
className: "flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",
|
|
551
|
-
...
|
|
574
|
+
...h(),
|
|
552
575
|
children: [
|
|
553
576
|
t && t,
|
|
554
|
-
e && e.map((
|
|
577
|
+
e && e.map((l) => /* @__PURE__ */ c(
|
|
555
578
|
"div",
|
|
556
579
|
{
|
|
557
|
-
onClick: (
|
|
558
|
-
|
|
580
|
+
onClick: (x) => {
|
|
581
|
+
x.stopPropagation(), s == null || s(l.key), i(!1);
|
|
559
582
|
},
|
|
560
583
|
className: f(
|
|
561
584
|
"text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",
|
|
562
|
-
r ===
|
|
585
|
+
r === l.key && "bg-hues-100"
|
|
563
586
|
),
|
|
564
587
|
children: /* @__PURE__ */ d(
|
|
565
588
|
"div",
|
|
566
589
|
{
|
|
567
590
|
className: "p-2 hover:bg-hues-100 h-full dropdown-item-text flex items-center gap-x-2",
|
|
568
|
-
title:
|
|
591
|
+
title: l.title,
|
|
569
592
|
children: [
|
|
570
|
-
|
|
571
|
-
/* @__PURE__ */ c("p", { children:
|
|
593
|
+
l.icon ? l.icon : null,
|
|
594
|
+
/* @__PURE__ */ c("p", { children: l == null ? void 0 : l.title })
|
|
572
595
|
]
|
|
573
596
|
}
|
|
574
597
|
)
|
|
575
598
|
},
|
|
576
|
-
|
|
599
|
+
l.key
|
|
577
600
|
))
|
|
578
601
|
]
|
|
579
602
|
}
|
|
580
603
|
)
|
|
581
604
|
] });
|
|
582
|
-
},
|
|
605
|
+
}, Gn = ({ limitMessages: n, query: e }) => /* @__PURE__ */ d("div", { className: "bg-hues-100 px-2 py-1 flex justify-between flex-wrap items-center", children: [
|
|
583
606
|
/* @__PURE__ */ c("div", { className: "flex gap-x-[4px]", children: /* @__PURE__ */ c("div", { className: "flex flex-col", children: /* @__PURE__ */ d("div", { className: "flex gap-x-[4px]", children: [
|
|
584
607
|
/* @__PURE__ */ d("span", { className: "text-primary h5", children: [
|
|
585
608
|
n == null ? void 0 : n.excelFormatTitle,
|
|
@@ -591,7 +614,7 @@ const ln = ({
|
|
|
591
614
|
n == null ? void 0 : n.dataExplorerIcon,
|
|
592
615
|
n == null ? void 0 : n.dataExplorer
|
|
593
616
|
] }) })
|
|
594
|
-
] }),
|
|
617
|
+
] }), $n = ({
|
|
595
618
|
limitMessages: n,
|
|
596
619
|
isDownload: e,
|
|
597
620
|
showAdvancedViewButton: t,
|
|
@@ -609,7 +632,7 @@ const ln = ({
|
|
|
609
632
|
":",
|
|
610
633
|
" "
|
|
611
634
|
] }),
|
|
612
|
-
/* @__PURE__ */ c("span", { className: "text-neutrals-800 body-3", children: e ? (a = n == null ? void 0 : n.downloadMessage) == null ? void 0 : a.call(n,
|
|
635
|
+
/* @__PURE__ */ c("span", { className: "text-neutrals-800 body-3", children: e ? (a = n == null ? void 0 : n.downloadMessage) == null ? void 0 : a.call(n, I) : (u = n == null ? void 0 : n.showingLimit) == null ? void 0 : u.call(n, I) })
|
|
613
636
|
] }),
|
|
614
637
|
e && /* @__PURE__ */ c("span", { className: "text-neutrals-800 body-3", children: n == null ? void 0 : n.fullLimitMessage })
|
|
615
638
|
] })
|
|
@@ -630,56 +653,35 @@ const ln = ({
|
|
|
630
653
|
n == null ? void 0 : n.dataExplorer
|
|
631
654
|
] }) })
|
|
632
655
|
] });
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
const [e, t] = P(
|
|
636
|
-
() => typeof window < "u" ? window.innerWidth < n : !1
|
|
637
|
-
);
|
|
638
|
-
return k(() => {
|
|
639
|
-
const r = window.matchMedia(`(max-width: ${n}px)`), o = (a) => {
|
|
640
|
-
t(a.matches);
|
|
641
|
-
};
|
|
642
|
-
return t(r.matches), r.addEventListener("change", o), () => r.removeEventListener("change", o);
|
|
643
|
-
}, [n]), e;
|
|
644
|
-
}
|
|
645
|
-
function In(n, e) {
|
|
646
|
-
const t = I(null);
|
|
647
|
-
return _(
|
|
648
|
-
(...o) => {
|
|
649
|
-
t.current && clearTimeout(t.current), t.current = setTimeout(() => {
|
|
650
|
-
n(...o);
|
|
651
|
-
}, e);
|
|
652
|
-
},
|
|
653
|
-
[n, e]
|
|
654
|
-
);
|
|
655
|
-
}
|
|
656
|
-
var dn = /* @__PURE__ */ ((n) => (n.Enter = "Enter", n))(dn || {});
|
|
656
|
+
};
|
|
657
|
+
var pn = /* @__PURE__ */ ((n) => (n.Enter = "Enter", n))(pn || {});
|
|
657
658
|
export {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
659
|
+
wn as Alert,
|
|
660
|
+
R as AlertType,
|
|
661
|
+
vn as Button,
|
|
662
|
+
dn as CALENDAR_MOBILE_PADDING,
|
|
663
|
+
Sn as Calendar,
|
|
664
|
+
_n as Checkbox,
|
|
663
665
|
q as CloseButton,
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
666
|
+
Cn as CollapsibleBlock,
|
|
667
|
+
Gn as DownloadFormatMessage,
|
|
668
|
+
jn as Dropdown,
|
|
669
|
+
gn as HighlightText,
|
|
670
|
+
Ln as IconButton,
|
|
671
|
+
un as Input,
|
|
672
|
+
On as InputWithIcon,
|
|
673
|
+
pn as KeyboardKey,
|
|
674
|
+
kn as Link,
|
|
673
675
|
T as Loader,
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
676
|
+
k as PopUpSize,
|
|
677
|
+
_ as PopUpState,
|
|
678
|
+
In as Popup,
|
|
679
|
+
Yn as Radio,
|
|
680
|
+
$n as RequestLimitMessage,
|
|
681
|
+
I as SERIES_LIMIT,
|
|
682
|
+
Fn as TREE_NODE_ARROW_SIZE,
|
|
683
|
+
Rn as TREE_NODE_PADDING,
|
|
684
|
+
Pn as Tag,
|
|
685
|
+
En as useDebounce,
|
|
686
|
+
ln as useIsMobile
|
|
685
687
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/statgpt-ui-components",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.17",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"react-flatpickr": "^4.0.11",
|
|
7
7
|
"react": "^19.2.1",
|
|
8
8
|
"classnames": "^2.5.1",
|
|
9
|
-
"@epam/statgpt-shared-toolkit": "0.2.0-rc.
|
|
9
|
+
"@epam/statgpt-shared-toolkit": "0.2.0-rc.17",
|
|
10
10
|
"@tabler/icons-react": "^3.34.1",
|
|
11
11
|
"@floating-ui/react": "^0.27.14"
|
|
12
12
|
},
|