@epam/statgpt-ui-components 0.1.0-rc.2 → 0.1.0-rc.4
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/Calendar/Calendar.d.ts +1 -1
- package/index.js +1 -1
- package/index.mjs +104 -105
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OptionsType } from 'react-flatpickr';
|
|
2
2
|
import { FC, ReactNode } from 'react';
|
|
3
|
-
import { CalendarResolution } from '../../../../shared-toolkit/src/
|
|
3
|
+
import { CalendarResolution } from '../../../../shared-toolkit/src/index';
|
|
4
4
|
interface Props {
|
|
5
5
|
onChange: (date: Date) => void;
|
|
6
6
|
value: Date;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),x=require("react"),d=require("classnames"),O=require("@tabler/icons-react"),G=require("react-flatpickr"),h=require("@floating-ui/react"),_=()=>s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"loader"})}),M=({title:e,btnClassNames:t,iconWidth:r,iconHeight:n,onClick:c})=>s.jsx("button",{type:"button","aria-label":"button",className:t,title:e,onClick:c,children:s.jsx(O.IconX,{height:n||20,width:r||20})});var y=(e=>(e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(y||{});const H=({alertDetails:e,successIcon:t,errorIcon:r,onClose:n,closeButtonTitle:c})=>{const o=()=>(e==null?void 0:e.type)===y.IN_PROGRESS?"alert-in-progress":(e==null?void 0:e.type)===y.SUCCESS?"alert-success":"alert-error";return x.useEffect(()=>{(e==null?void 0:e.type)!==y.IN_PROGRESS&&setTimeout(()=>{n==null||n()},5e3)},[e==null?void 0:e.type,n]),s.jsx("div",{className:d("alert alert-shadow fixed bottom-3 right-3 z-10",o()),children:s.jsxs("div",{className:"alert-content flex items-start",children:[s.jsx("div",{className:"alert-icon",children:(e==null?void 0:e.type)===y.IN_PROGRESS?s.jsx(_,{}):(e==null?void 0:e.type)===y.SUCCESS?t:r}),s.jsxs("div",{className:"flex flex-col gap-2 max-w-[300px]",children:[s.jsx("h3",{className:"truncate",children:e==null?void 0:e.title}),(e==null?void 0:e.text)&&s.jsx("div",{className:"alert-text truncate",title:e==null?void 0:e.text,children:e==null?void 0:e.text})]}),s.jsx(M,{title:c,onClick:n})]})})},W=({buttonClassName:e,isLoading:t=!1,title:r,disabled:n,iconAfter:c,iconBefore:o,onClick:l,isSmallButton:a})=>{const i=d(a?"font-semibold":"",c?"mr-2":"",o?"ml-2":"");return s.jsxs("button",{type:"button",className:d("base-button",e,a?"small-button":""),disabled:n||t,"aria-label":"button",onClick:p=>l==null?void 0:l(p),title:r,children:[o,t&&s.jsx(_,{}),r?a?s.jsx("h4",{className:i,children:r}):s.jsx("h3",{className:i,children:r}):null,c]})};var E=(e=>(e.MONTH="month",e.DAY="day",e))(E||{});const $=({label:e,onChange:t,value:r,options:n,calendarResolution:c=E.DAY,id:o,icon:l})=>{var j;const a=x.useRef(null);x.useEffect(()=>{var N;const f=a==null?void 0:a.current;f&&((N=f.querySelector("input"))==null||N.setAttribute("aria-label",e))},[e]);const i={...n,defaultDate:c===E.MONTH?new Date(r.getFullYear(),r.getMonth()):r},p=(f,N,w)=>{const g=`calendar__${c===E.MONTH?"month":"day"}`;w.calendarContainer&&w.calendarContainer.classList.add(g)},b=(f,N,w)=>{if(c===E.MONTH&&f.length>0){const g=n.minDate,u=n.maxDate,m=f[0].getFullYear(),C=w.calendarContainer,F="flatpickr-disabled",Y=C.querySelectorAll(".flatpickr-monthSelect-month"),A=C.querySelectorAll(".flatpickr-next-month")[0],I=C.querySelectorAll(".flatpickr-prev-month")[0];m===u.getFullYear()&&A.classList.add(F),m===g.getFullYear()&&I.classList.add(F),(m===g.getFullYear()||m===u.getFullYear())&&Y.forEach(k=>{k.classList.remove(F);const v=new Date(k.getAttribute("aria-label")),q=v.getFullYear()===g.getFullYear()&&v.getMonth()===g.getMonth(),T=v.getFullYear()===u.getFullYear()&&v.getMonth()===u.getMonth();q||T||(v<g||v>u)&&k.classList.add(F)})}};return s.jsxs("div",{className:"relative calendar",ref:a,children:[s.jsx("div",{className:"mb-1 calendar-title",children:e}),s.jsx("label",{htmlFor:o,className:"absolute cursor-pointer right-[11px] top-[29px]",children:l||s.jsx(O.IconCalendarEvent,{})}),s.jsx(G,{defaultValue:(j=c===E.MONTH?new Date(r.getFullYear(),r.getMonth()):r)==null?void 0:j.toDateString(),options:i,onChange:f=>{t(f[0])},onOpen:[b],onReady:[p],id:o})]})},B=({label:e,id:t,checked:r,checkboxIcon:n,onChange:c})=>{const o=x.useCallback(l=>{l.stopPropagation(),c==null||c(t,l.target.checked)},[c,t]);return s.jsxs("label",{className:"flex items-center cursor-pointer min-w-0 py-1",htmlFor:t,children:[s.jsx("span",{className:d("flex justify-center items-center w-4 h-4 mr-2 relative","checkbox-button"),children:r&&n}),e&&s.jsx("p",{className:d("text-neutrals-1000 flex-1 min-w-0 truncate pr-2","checkbox-button-text"),title:e,children:e}),s.jsx("input",{type:"checkbox",onChange:o,id:t,checked:r,className:"hidden"})]})},U=({title:e,icon:t,children:r,value:n})=>{const[c,o]=x.useState(!1);return s.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${c?"collapsible-block-open":""}`,children:[s.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>o(!c),children:[s.jsx("div",{className:`${c?"rotate-180":""} transition-transform`,children:t||s.jsx(O.IconChevronDown,{className:"w-5 h-5 mr-3"})}),s.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[s.jsx("span",{children:e}),n&&s.jsx("p",{className:"body-1 text-neutrals-800",children:n})]})]}),c&&s.jsx("div",{className:"collapsible-block-content pb-4",children:r})]})},z=({text:e,highlightText:t})=>{const r=x.useMemo(()=>{var l;const n=[];if(!t)return[{id:0,text:e,highlight:!1}];const c=(t==null?void 0:t.toLowerCase())||"",o=((l=e==null?void 0:e.toLowerCase())==null?void 0:l.split(c))||"";for(let a=0,i=0;a<(o==null?void 0:o.length);a++){const p=o==null?void 0:o[a],b=p.length;p!==""&&n.push({id:n.length,highlight:!1,text:e==null?void 0:e.substring(i,i+b)}),i+=b,a!==(o==null?void 0:o.length)-1&&(n.push({id:n.length,highlight:!0,text:e==null?void 0:e.substring(i,i+t.length)}),i+=t.length)}return n},[t,e]);return s.jsx(s.Fragment,{children:r.map(n=>s.jsx("span",{className:d((n==null?void 0:n.highlight)&&"bg-highlight"),children:n==null?void 0:n.text},n==null?void 0:n.id))})},K=({icon:e,onClick:t,buttonClassName:r,disabled:n,title:c,isBaseIconStyles:o=!0})=>s.jsx("button",{type:"button",className:d(o&&"base-icon-button",r),onClick:l=>t==null?void 0:t(l),disabled:n,title:c,"aria-label":"button",children:e}),P=({value:e,inputId:t,placeholder:r="",cssClass:n="",type:c="text",disabled:o,readonly:l,onChange:a,onKeyDown:i})=>{const p=d("truncate outline-none shadow-none body-1",n,l?"pointer-events-none":"");return s.jsx("input",{type:c,autoComplete:"off",id:t,placeholder:r,value:e||"",title:e?String(e):"",disabled:o,className:p,onKeyDown:i,onChange:b=>a==null?void 0:a(b.currentTarget.value)})},V=({iconBeforeInput:e,iconAfterInput:t,containerClasses:r,cssClass:n,...c})=>s.jsxs("div",{className:d("input w-full flex flex-row",r),children:[e,s.jsx(P,{cssClass:d("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",n),...c}),t]}),Z=({url:e,title:t,linkClassName:r="",iconBefore:n,iconAfter:c})=>{const o=d(c?"mr-2":"",n?"ml-2":"");return s.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:d("base-link",r),title:t,children:[n,s.jsx("span",{className:o,children:t}),c]})},Q=({title:e,text:t,onClick:r})=>s.jsx("button",{type:"button",className:"tag flex items-center justify-center",onClick:()=>r==null?void 0:r(t||e),"aria-label":"button",children:s.jsx("h4",{children:e})}),X=({label:e,id:t,checked:r,radioIcon:n,description:c,onChange:o})=>{const l=x.useCallback(a=>{a.stopPropagation(),o==null||o(t,a.target.checked)},[o,t]);return s.jsxs("label",{className:"flex flex-col cursor-pointer min-w-0 py-[6px]",htmlFor:t,children:[s.jsxs("p",{className:"radio-label flex items-center min-w-0",children:[s.jsx("span",{className:d("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",r?"radio-button-active":""),children:r&&n}),e&&s.jsx("span",{className:"radio-title body-1 text-neutrals-1000 flex-1 min-w-0 truncate pr-2",title:e,children:e})]}),c&&s.jsx("span",{className:"radio-description ml-6 text-neutrals-800 body-2 w-auto flex items-center",title:c,children:c}),s.jsx("input",{type:"radio",onChange:l,id:t,checked:r,className:"hidden"})]})};var S=(e=>(e.Closed="Closed",e.Opened="Opened",e))(S||{}),R=(e=>(e.LG="Large",e.SM="Small",e))(R||{});const J=({portalId:e,state:t=S.Opened,heading:r,size:n,onClose:c,children:o,overlayClassName:l,containerClassName:a,dividers:i=!0,closeButtonTitle:p})=>{const{refs:b,context:j}=h.useFloating({open:t!==S.Closed&&!!t,onOpenChange:c}),f=h.useRole(j,{role:"dialog"}),N=h.useDismiss(j,{outsidePress:!0}),{getFloatingProps:w}=h.useInteractions([f,N]),g=x.useCallback(u=>{u==null||u.preventDefault(),u==null||u.stopPropagation(),c()},[c]);return s.jsx(h.FloatingPortal,{id:e,children:t!==S.Closed&&s.jsx(h.FloatingOverlay,{className:d("z-[52] flex items-center justify-center bg-blackout p-4",l),children:s.jsx(h.FloatingFocusManager,{context:j,children:s.jsxs("div",{className:d("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",n===R.LG&&"max-w-[65%]",n===R.SM&&"max-w-[30%]",i&&"divide-neutrals-400 divide-y",a,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:b.setFloating,...w({onClick(u){u.stopPropagation()}}),children:[s.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:[r&&(typeof r=="string"?s.jsx("h2",{className:"flex-1 min-w-0 mr-3 modal-heading-title sm:h3",children:r}):r),s.jsx(M,{title:p,onClick:g,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),o.map(u=>u)]})})})})},D=e=>e.state===S.Closed?null:s.jsx(J,{...e}),ee=({triggerButton:e,options:t,content:r,selectedOption:n,disabled:c,containerClassName:o,openedClassName:l,onOptionSelect:a})=>{const[i,p]=x.useState(!1),{refs:b,floatingStyles:j,context:f}=h.useFloating({open:i,onOpenChange:c?void 0:p,placement:"bottom-end",middleware:[h.offset(8),h.flip(),h.shift()],whileElementsMounted:h.autoUpdate}),N=h.useClick(f),w=h.useDismiss(f,{outsidePress:!0}),{getReferenceProps:g,getFloatingProps:u}=h.useInteractions([N,w]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:b.setReference,...g({onClick(m){m.stopPropagation()}}),className:d(o,i&&l),children:e}),i&&s.jsxs("div",{ref:b.setFloating,style:j,className:"flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",...u(),children:[r&&r,t&&t.map(m=>s.jsx("div",{onClick:C=>{C.stopPropagation(),a==null||a(m.key),p(!1)},className:d("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",n===m.key&&"bg-hues-100"),children:s.jsxs("div",{className:"p-2 hover:bg-hues-100 h-full dropdown-item-text flex items-center gap-x-2",title:m.title,children:[m.icon?m.icon:null,s.jsx("p",{children:m==null?void 0:m.title})]})},m.key))]})]})},se=24,ne=24;function te(e=719){const[t,r]=x.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return x.useEffect(()=>{const n=window.matchMedia(`(max-width: ${e}px)`),c=o=>{r(o.matches)};return r(n.matches),n.addEventListener("change",c),()=>n.removeEventListener("change",c)},[e]),t}function re(e,t){const r=x.useRef(null);return x.useCallback((...c)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...c)},t)},[e,t])}var L=(e=>(e.Enter="Enter",e))(L||{});exports.Alert=H;exports.AlertType=y;exports.Button=W;exports.Calendar=$;exports.Checkbox=B;exports.CloseButton=M;exports.CollapsibleBlock=U;exports.Dropdown=ee;exports.HighlightText=z;exports.IconButton=K;exports.Input=P;exports.InputWithIcon=V;exports.KeyboardKey=L;exports.Link=Z;exports.Loader=_;exports.PopUpSize=R;exports.PopUpState=S;exports.Popup=D;exports.Radio=X;exports.TREE_NODE_ARROW_SIZE=se;exports.TREE_NODE_PADDING=ne;exports.Tag=Q;exports.useDebounce=re;exports.useIsMobile=te;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),x=require("react"),d=require("classnames"),O=require("@tabler/icons-react"),G=require("react-flatpickr"),R=require("@epam/statgpt-shared-toolkit"),h=require("@floating-ui/react"),_=()=>s.jsx("div",{className:"flex items-center justify-center h-full",children:s.jsx("div",{className:"loader"})}),P=({title:e,btnClassNames:t,iconWidth:r,iconHeight:n,onClick:c})=>s.jsx("button",{type:"button","aria-label":"button",className:t,title:e,onClick:c,children:s.jsx(O.IconX,{height:n||20,width:r||20})});var y=(e=>(e.ERROR="error",e.SUCCESS="success",e.IN_PROGRESS="in_progress",e))(y||{});const H=({alertDetails:e,successIcon:t,errorIcon:r,onClose:n,closeButtonTitle:c})=>{const o=()=>(e==null?void 0:e.type)===y.IN_PROGRESS?"alert-in-progress":(e==null?void 0:e.type)===y.SUCCESS?"alert-success":"alert-error";return x.useEffect(()=>{(e==null?void 0:e.type)!==y.IN_PROGRESS&&setTimeout(()=>{n==null||n()},5e3)},[e==null?void 0:e.type,n]),s.jsx("div",{className:d("alert alert-shadow fixed bottom-3 right-3 z-10",o()),children:s.jsxs("div",{className:"alert-content flex items-start",children:[s.jsx("div",{className:"alert-icon",children:(e==null?void 0:e.type)===y.IN_PROGRESS?s.jsx(_,{}):(e==null?void 0:e.type)===y.SUCCESS?t:r}),s.jsxs("div",{className:"flex flex-col gap-2 max-w-[300px]",children:[s.jsx("h3",{className:"truncate",children:e==null?void 0:e.title}),(e==null?void 0:e.text)&&s.jsx("div",{className:"alert-text truncate",title:e==null?void 0:e.text,children:e==null?void 0:e.text})]}),s.jsx(P,{title:c,onClick:n})]})})},W=({buttonClassName:e,isLoading:t=!1,title:r,disabled:n,iconAfter:c,iconBefore:o,onClick:l,isSmallButton:a})=>{const i=d(a?"font-semibold":"",c?"mr-2":"",o?"ml-2":"");return s.jsxs("button",{type:"button",className:d("base-button",e,a?"small-button":""),disabled:n||t,"aria-label":"button",onClick:p=>l==null?void 0:l(p),title:r,children:[o,t&&s.jsx(_,{}),r?a?s.jsx("h4",{className:i,children:r}):s.jsx("h3",{className:i,children:r}):null,c]})},$=({label:e,onChange:t,value:r,options:n,calendarResolution:c=R.CalendarResolution.DAY,id:o,icon:l})=>{var j;const a=x.useRef(null);x.useEffect(()=>{var N;const f=a==null?void 0:a.current;f&&((N=f.querySelector("input"))==null||N.setAttribute("aria-label",e))},[e]);const i={...n,defaultDate:c===R.CalendarResolution.MONTH?new Date(r.getFullYear(),r.getMonth()):r},p=(f,N,w)=>{const g=`calendar__${c===R.CalendarResolution.MONTH?"month":"day"}`;w.calendarContainer&&w.calendarContainer.classList.add(g)},b=(f,N,w)=>{if(c===R.CalendarResolution.MONTH&&f.length>0){const g=n.minDate,u=n.maxDate,m=f[0].getFullYear(),C=w.calendarContainer,S="flatpickr-disabled",Y=C.querySelectorAll(".flatpickr-monthSelect-month"),q=C.querySelectorAll(".flatpickr-next-month")[0],I=C.querySelectorAll(".flatpickr-prev-month")[0];m===u.getFullYear()&&q.classList.add(S),m===g.getFullYear()&&I.classList.add(S),(m===g.getFullYear()||m===u.getFullYear())&&Y.forEach(k=>{k.classList.remove(S);const v=new Date(k.getAttribute("aria-label")),A=v.getFullYear()===g.getFullYear()&&v.getMonth()===g.getMonth(),T=v.getFullYear()===u.getFullYear()&&v.getMonth()===u.getMonth();A||T||(v<g||v>u)&&k.classList.add(S)})}};return s.jsxs("div",{className:"relative calendar",ref:a,children:[s.jsx("div",{className:"mb-1 calendar-title",children:e}),s.jsx("label",{htmlFor:o,className:"absolute cursor-pointer right-[11px] top-[29px]",children:l||s.jsx(O.IconCalendarEvent,{})}),s.jsx(G,{defaultValue:(j=c===R.CalendarResolution.MONTH?new Date(r.getFullYear(),r.getMonth()):r)==null?void 0:j.toDateString(),options:i,onChange:f=>{t(f[0])},onOpen:[b],onReady:[p],id:o})]})},B=({label:e,id:t,checked:r,checkboxIcon:n,onChange:c})=>{const o=x.useCallback(l=>{l.stopPropagation(),c==null||c(t,l.target.checked)},[c,t]);return s.jsxs("label",{className:"flex items-center cursor-pointer min-w-0 py-1",htmlFor:t,children:[s.jsx("span",{className:d("flex justify-center items-center w-4 h-4 mr-2 relative","checkbox-button"),children:r&&n}),e&&s.jsx("p",{className:d("text-neutrals-1000 flex-1 min-w-0 truncate pr-2","checkbox-button-text"),title:e,children:e}),s.jsx("input",{type:"checkbox",onChange:o,id:t,checked:r,className:"hidden"})]})},U=({title:e,icon:t,children:r,value:n})=>{const[c,o]=x.useState(!1);return s.jsxs("div",{className:`collapsible-block flex flex-col border-t-2 border-neutrals-600 ${c?"collapsible-block-open":""}`,children:[s.jsxs("div",{className:"collapsible-block-title flex cursor-pointer items-center py-4",onClick:()=>o(!c),children:[s.jsx("div",{className:`${c?"rotate-180":""} transition-transform`,children:t||s.jsx(O.IconChevronDown,{className:"w-5 h-5 mr-3"})}),s.jsxs("div",{className:"flex flex-1 items-center justify-between",children:[s.jsx("span",{children:e}),n&&s.jsx("p",{className:"body-1 text-neutrals-800",children:n})]})]}),c&&s.jsx("div",{className:"collapsible-block-content pb-4",children:r})]})},z=({text:e,highlightText:t})=>{const r=x.useMemo(()=>{var l;const n=[];if(!t)return[{id:0,text:e,highlight:!1}];const c=(t==null?void 0:t.toLowerCase())||"",o=((l=e==null?void 0:e.toLowerCase())==null?void 0:l.split(c))||"";for(let a=0,i=0;a<(o==null?void 0:o.length);a++){const p=o==null?void 0:o[a],b=p.length;p!==""&&n.push({id:n.length,highlight:!1,text:e==null?void 0:e.substring(i,i+b)}),i+=b,a!==(o==null?void 0:o.length)-1&&(n.push({id:n.length,highlight:!0,text:e==null?void 0:e.substring(i,i+t.length)}),i+=t.length)}return n},[t,e]);return s.jsx(s.Fragment,{children:r.map(n=>s.jsx("span",{className:d((n==null?void 0:n.highlight)&&"bg-highlight"),children:n==null?void 0:n.text},n==null?void 0:n.id))})},K=({icon:e,onClick:t,buttonClassName:r,disabled:n,title:c,isBaseIconStyles:o=!0})=>s.jsx("button",{type:"button",className:d(o&&"base-icon-button",r),onClick:l=>t==null?void 0:t(l),disabled:n,title:c,"aria-label":"button",children:e}),M=({value:e,inputId:t,placeholder:r="",cssClass:n="",type:c="text",disabled:o,readonly:l,onChange:a,onKeyDown:i})=>{const p=d("truncate outline-none shadow-none body-1",n,l?"pointer-events-none":"");return s.jsx("input",{type:c,autoComplete:"off",id:t,placeholder:r,value:e||"",title:e?String(e):"",disabled:o,className:p,onKeyDown:i,onChange:b=>a==null?void 0:a(b.currentTarget.value)})},V=({iconBeforeInput:e,iconAfterInput:t,containerClasses:r,cssClass:n,...c})=>s.jsxs("div",{className:d("input w-full flex flex-row",r),children:[e,s.jsx(M,{cssClass:d("border-0 bg-transparent p-0 h-full shadow-none flex-1 min-w-0 rounded-none",n),...c}),t]}),Z=({url:e,title:t,linkClassName:r="",iconBefore:n,iconAfter:c})=>{const o=d(c?"mr-2":"",n?"ml-2":"");return s.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:d("base-link",r),title:t,children:[n,s.jsx("span",{className:o,children:t}),c]})},Q=({title:e,text:t,onClick:r})=>s.jsx("button",{type:"button",className:"tag flex items-center justify-center",onClick:()=>r==null?void 0:r(t||e),"aria-label":"button",children:s.jsx("h4",{children:e})}),X=({label:e,id:t,checked:r,radioIcon:n,description:c,onChange:o})=>{const l=x.useCallback(a=>{a.stopPropagation(),o==null||o(t,a.target.checked)},[o,t]);return s.jsxs("label",{className:"flex flex-col cursor-pointer min-w-0 py-[6px]",htmlFor:t,children:[s.jsxs("p",{className:"radio-label flex items-center min-w-0",children:[s.jsx("span",{className:d("flex justify-center items-center w-4 h-4 mr-2 relative","radio-button",r?"radio-button-active":""),children:r&&n}),e&&s.jsx("span",{className:"radio-title body-1 text-neutrals-1000 flex-1 min-w-0 truncate pr-2",title:e,children:e})]}),c&&s.jsx("span",{className:"radio-description ml-6 text-neutrals-800 body-2 w-auto flex items-center",title:c,children:c}),s.jsx("input",{type:"radio",onChange:l,id:t,checked:r,className:"hidden"})]})};var E=(e=>(e.Closed="Closed",e.Opened="Opened",e))(E||{}),F=(e=>(e.LG="Large",e.SM="Small",e))(F||{});const J=({portalId:e,state:t=E.Opened,heading:r,size:n,onClose:c,children:o,overlayClassName:l,containerClassName:a,dividers:i=!0,closeButtonTitle:p})=>{const{refs:b,context:j}=h.useFloating({open:t!==E.Closed&&!!t,onOpenChange:c}),f=h.useRole(j,{role:"dialog"}),N=h.useDismiss(j,{outsidePress:!0}),{getFloatingProps:w}=h.useInteractions([f,N]),g=x.useCallback(u=>{u==null||u.preventDefault(),u==null||u.stopPropagation(),c()},[c]);return s.jsx(h.FloatingPortal,{id:e,children:t!==E.Closed&&s.jsx(h.FloatingOverlay,{className:d("z-[52] flex items-center justify-center bg-blackout p-4",l),children:s.jsx(h.FloatingFocusManager,{context:j,children:s.jsxs("div",{className:d("relative max-h-full modal rounded bg-white flex flex-col shadow w-full",n===F.LG&&"max-w-[65%]",n===F.SM&&"max-w-[30%]",i&&"divide-neutrals-400 divide-y",a,"sm:w-full sm:max-w-full sm:px-4 sm:py-6"),ref:b.setFloating,...w({onClick(u){u.stopPropagation()}}),children:[s.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:[r&&(typeof r=="string"?s.jsx("h2",{className:"flex-1 min-w-0 mr-3 modal-heading-title sm:h3",children:r}):r),s.jsx(P,{title:p,onClick:g,btnClassNames:"sm:h-[24px] sm:w-[24px] sm:top-4"})]}),o.map(u=>u)]})})})})},D=e=>e.state===E.Closed?null:s.jsx(J,{...e}),ee=({triggerButton:e,options:t,content:r,selectedOption:n,disabled:c,containerClassName:o,openedClassName:l,onOptionSelect:a})=>{const[i,p]=x.useState(!1),{refs:b,floatingStyles:j,context:f}=h.useFloating({open:i,onOpenChange:c?void 0:p,placement:"bottom-end",middleware:[h.offset(8),h.flip(),h.shift()],whileElementsMounted:h.autoUpdate}),N=h.useClick(f),w=h.useDismiss(f,{outsidePress:!0}),{getReferenceProps:g,getFloatingProps:u}=h.useInteractions([N,w]);return s.jsxs(s.Fragment,{children:[s.jsx("div",{ref:b.setReference,...g({onClick(m){m.stopPropagation()}}),className:d(o,i&&l),children:e}),i&&s.jsxs("div",{ref:b.setFloating,style:j,className:"flex flex-col z-10 dropdown-menu-shadow bg-white dropdown-container rounded",...u(),children:[r&&r,t&&t.map(m=>s.jsx("div",{onClick:C=>{C.stopPropagation(),a==null||a(m.key),p(!1)},className:d("text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",n===m.key&&"bg-hues-100"),children:s.jsxs("div",{className:"p-2 hover:bg-hues-100 h-full dropdown-item-text flex items-center gap-x-2",title:m.title,children:[m.icon?m.icon:null,s.jsx("p",{children:m==null?void 0:m.title})]})},m.key))]})]})},se=24,ne=24;function te(e=719){const[t,r]=x.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return x.useEffect(()=>{const n=window.matchMedia(`(max-width: ${e}px)`),c=o=>{r(o.matches)};return r(n.matches),n.addEventListener("change",c),()=>n.removeEventListener("change",c)},[e]),t}function re(e,t){const r=x.useRef(null);return x.useCallback((...c)=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e(...c)},t)},[e,t])}var L=(e=>(e.Enter="Enter",e))(L||{});exports.Alert=H;exports.AlertType=y;exports.Button=W;exports.Calendar=$;exports.Checkbox=B;exports.CloseButton=P;exports.CollapsibleBlock=U;exports.Dropdown=ee;exports.HighlightText=z;exports.IconButton=K;exports.Input=M;exports.InputWithIcon=V;exports.KeyboardKey=L;exports.Link=Z;exports.Loader=_;exports.PopUpSize=F;exports.PopUpState=E;exports.Popup=D;exports.Radio=X;exports.TREE_NODE_ARROW_SIZE=se;exports.TREE_NODE_PADDING=ne;exports.Tag=Q;exports.useDebounce=re;exports.useIsMobile=te;
|
package/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as c, jsxs as u, Fragment as P } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect as
|
|
2
|
+
import { useEffect as O, useRef as L, useCallback as R, useState as _, useMemo as U } from "react";
|
|
3
3
|
import m from "classnames";
|
|
4
4
|
import { IconX as V, IconCalendarEvent as z, IconChevronDown as Q } from "@tabler/icons-react";
|
|
5
5
|
import X from "react-flatpickr";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import { CalendarResolution as F } from "@epam/statgpt-shared-toolkit";
|
|
7
|
+
import { useFloating as Y, useRole as Z, useDismiss as j, useInteractions as G, FloatingPortal as B, FloatingOverlay as J, FloatingFocusManager as K, autoUpdate as D, offset as ee, flip as ne, shift as re, useClick as te } from "@floating-ui/react";
|
|
8
|
+
const A = () => /* @__PURE__ */ c("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "loader" }) }), H = ({
|
|
8
9
|
title: e,
|
|
9
10
|
btnClassNames: r,
|
|
10
11
|
iconWidth: t,
|
|
@@ -22,7 +23,7 @@ const G = () => /* @__PURE__ */ c("div", { className: "flex items-center justify
|
|
|
22
23
|
}
|
|
23
24
|
);
|
|
24
25
|
var x = /* @__PURE__ */ ((e) => (e.ERROR = "error", e.SUCCESS = "success", e.IN_PROGRESS = "in_progress", e))(x || {});
|
|
25
|
-
const
|
|
26
|
+
const fe = ({
|
|
26
27
|
alertDetails: e,
|
|
27
28
|
successIcon: r,
|
|
28
29
|
errorIcon: t,
|
|
@@ -30,7 +31,7 @@ const he = ({
|
|
|
30
31
|
closeButtonTitle: s
|
|
31
32
|
}) => {
|
|
32
33
|
const o = () => (e == null ? void 0 : e.type) === x.IN_PROGRESS ? "alert-in-progress" : (e == null ? void 0 : e.type) === x.SUCCESS ? "alert-success" : "alert-error";
|
|
33
|
-
return
|
|
34
|
+
return O(() => {
|
|
34
35
|
(e == null ? void 0 : e.type) !== x.IN_PROGRESS && setTimeout(() => {
|
|
35
36
|
n == null || n();
|
|
36
37
|
}, 5e3);
|
|
@@ -42,7 +43,7 @@ const he = ({
|
|
|
42
43
|
o()
|
|
43
44
|
),
|
|
44
45
|
children: /* @__PURE__ */ u("div", { className: "alert-content flex items-start", children: [
|
|
45
|
-
/* @__PURE__ */ c("div", { className: "alert-icon", children: (e == null ? void 0 : e.type) === x.IN_PROGRESS ? /* @__PURE__ */ c(
|
|
46
|
+
/* @__PURE__ */ c("div", { className: "alert-icon", children: (e == null ? void 0 : e.type) === x.IN_PROGRESS ? /* @__PURE__ */ c(A, {}) : (e == null ? void 0 : e.type) === x.SUCCESS ? r : t }),
|
|
46
47
|
/* @__PURE__ */ u("div", { className: "flex flex-col gap-2 max-w-[300px]", children: [
|
|
47
48
|
/* @__PURE__ */ c("h3", { className: "truncate", children: e == null ? void 0 : e.title }),
|
|
48
49
|
(e == null ? void 0 : e.text) && /* @__PURE__ */ c("div", { className: "alert-text truncate", title: e == null ? void 0 : e.text, children: e == null ? void 0 : e.text })
|
|
@@ -51,18 +52,18 @@ const he = ({
|
|
|
51
52
|
] })
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
|
-
},
|
|
55
|
+
}, pe = ({
|
|
55
56
|
buttonClassName: e,
|
|
56
57
|
isLoading: r = !1,
|
|
57
58
|
title: t,
|
|
58
59
|
disabled: n,
|
|
59
60
|
iconAfter: s,
|
|
60
61
|
iconBefore: o,
|
|
61
|
-
onClick:
|
|
62
|
-
isSmallButton:
|
|
62
|
+
onClick: a,
|
|
63
|
+
isSmallButton: l
|
|
63
64
|
}) => {
|
|
64
65
|
const i = m(
|
|
65
|
-
|
|
66
|
+
l ? "font-semibold" : "",
|
|
66
67
|
s ? "mr-2" : "",
|
|
67
68
|
o ? "ml-2" : ""
|
|
68
69
|
);
|
|
@@ -73,74 +74,72 @@ const he = ({
|
|
|
73
74
|
className: m(
|
|
74
75
|
"base-button",
|
|
75
76
|
e,
|
|
76
|
-
|
|
77
|
+
l ? "small-button" : ""
|
|
77
78
|
),
|
|
78
79
|
disabled: n || r,
|
|
79
80
|
"aria-label": "button",
|
|
80
|
-
onClick: (f) =>
|
|
81
|
+
onClick: (f) => a == null ? void 0 : a(f),
|
|
81
82
|
title: t,
|
|
82
83
|
children: [
|
|
83
84
|
o,
|
|
84
|
-
r && /* @__PURE__ */ c(
|
|
85
|
-
t ?
|
|
85
|
+
r && /* @__PURE__ */ c(A, {}),
|
|
86
|
+
t ? l ? /* @__PURE__ */ c("h4", { className: i, children: t }) : /* @__PURE__ */ c("h3", { className: i, children: t }) : null,
|
|
86
87
|
s
|
|
87
88
|
]
|
|
88
89
|
}
|
|
89
90
|
);
|
|
90
|
-
}
|
|
91
|
-
var E = /* @__PURE__ */ ((e) => (e.MONTH = "month", e.DAY = "day", e))(E || {});
|
|
92
|
-
const pe = ({
|
|
91
|
+
}, be = ({
|
|
93
92
|
label: e,
|
|
94
93
|
onChange: r,
|
|
95
94
|
value: t,
|
|
96
95
|
options: n,
|
|
97
|
-
calendarResolution: s =
|
|
96
|
+
calendarResolution: s = F.DAY,
|
|
98
97
|
id: o,
|
|
99
|
-
icon:
|
|
98
|
+
icon: a
|
|
100
99
|
}) => {
|
|
101
100
|
var N;
|
|
102
|
-
const
|
|
103
|
-
|
|
101
|
+
const l = L(null);
|
|
102
|
+
O(() => {
|
|
104
103
|
var w;
|
|
105
|
-
const p =
|
|
104
|
+
const p = l == null ? void 0 : l.current;
|
|
106
105
|
p && ((w = p.querySelector("input")) == null || w.setAttribute("aria-label", e));
|
|
107
106
|
}, [e]);
|
|
108
107
|
const i = {
|
|
109
108
|
...n,
|
|
110
|
-
defaultDate: s ===
|
|
109
|
+
defaultDate: s === F.MONTH ? new Date(t.getFullYear(), t.getMonth()) : t
|
|
111
110
|
}, f = (p, w, y) => {
|
|
112
|
-
const g = `calendar__${s ===
|
|
111
|
+
const g = `calendar__${s === F.MONTH ? "month" : "day"}`;
|
|
113
112
|
y.calendarContainer && y.calendarContainer.classList.add(g);
|
|
114
113
|
}, b = (p, w, y) => {
|
|
115
|
-
if (s ===
|
|
116
|
-
const g = n.minDate, d = n.maxDate, h = p[0].getFullYear(),
|
|
114
|
+
if (s === F.MONTH && p.length > 0) {
|
|
115
|
+
const g = n.minDate, d = n.maxDate, h = p[0].getFullYear(), E = y.calendarContainer, S = "flatpickr-disabled", q = E.querySelectorAll(
|
|
117
116
|
".flatpickr-monthSelect-month"
|
|
118
|
-
), $ =
|
|
117
|
+
), $ = E.querySelectorAll(
|
|
119
118
|
".flatpickr-next-month"
|
|
120
|
-
)[0], I =
|
|
119
|
+
)[0], I = E.querySelectorAll(
|
|
121
120
|
".flatpickr-prev-month"
|
|
122
121
|
)[0];
|
|
123
|
-
h === d.getFullYear() && $.classList.add(
|
|
124
|
-
|
|
125
|
-
const v = new Date(
|
|
126
|
-
|
|
122
|
+
h === d.getFullYear() && $.classList.add(S), h === g.getFullYear() && I.classList.add(S), (h === g.getFullYear() || h === d.getFullYear()) && q.forEach((k) => {
|
|
123
|
+
k.classList.remove(S);
|
|
124
|
+
const v = new Date(k.getAttribute("aria-label")), W = v.getFullYear() === g.getFullYear() && v.getMonth() === g.getMonth(), T = v.getFullYear() === d.getFullYear() && v.getMonth() === d.getMonth();
|
|
125
|
+
W || T || (v < g || v > d) && k.classList.add(S);
|
|
127
126
|
});
|
|
128
127
|
}
|
|
129
128
|
};
|
|
130
|
-
return /* @__PURE__ */ u("div", { className: "relative calendar", ref:
|
|
129
|
+
return /* @__PURE__ */ u("div", { className: "relative calendar", ref: l, children: [
|
|
131
130
|
/* @__PURE__ */ c("div", { className: "mb-1 calendar-title", children: e }),
|
|
132
131
|
/* @__PURE__ */ c(
|
|
133
132
|
"label",
|
|
134
133
|
{
|
|
135
134
|
htmlFor: o,
|
|
136
135
|
className: "absolute cursor-pointer right-[11px] top-[29px]",
|
|
137
|
-
children:
|
|
136
|
+
children: a || /* @__PURE__ */ c(z, {})
|
|
138
137
|
}
|
|
139
138
|
),
|
|
140
139
|
/* @__PURE__ */ c(
|
|
141
140
|
X,
|
|
142
141
|
{
|
|
143
|
-
defaultValue: (N = s ===
|
|
142
|
+
defaultValue: (N = s === F.MONTH ? new Date(t.getFullYear(), t.getMonth()) : t) == null ? void 0 : N.toDateString(),
|
|
144
143
|
options: i,
|
|
145
144
|
onChange: (p) => {
|
|
146
145
|
r(p[0]);
|
|
@@ -151,16 +150,16 @@ const pe = ({
|
|
|
151
150
|
}
|
|
152
151
|
)
|
|
153
152
|
] });
|
|
154
|
-
},
|
|
153
|
+
}, ge = ({
|
|
155
154
|
label: e,
|
|
156
155
|
id: r,
|
|
157
156
|
checked: t,
|
|
158
157
|
checkboxIcon: n,
|
|
159
158
|
onChange: s
|
|
160
159
|
}) => {
|
|
161
|
-
const o =
|
|
162
|
-
(
|
|
163
|
-
|
|
160
|
+
const o = R(
|
|
161
|
+
(a) => {
|
|
162
|
+
a.stopPropagation(), s == null || s(r, a.target.checked);
|
|
164
163
|
},
|
|
165
164
|
[s, r]
|
|
166
165
|
);
|
|
@@ -204,7 +203,7 @@ const pe = ({
|
|
|
204
203
|
]
|
|
205
204
|
}
|
|
206
205
|
);
|
|
207
|
-
},
|
|
206
|
+
}, Ne = ({
|
|
208
207
|
title: e,
|
|
209
208
|
icon: r,
|
|
210
209
|
children: t,
|
|
@@ -234,15 +233,15 @@ const pe = ({
|
|
|
234
233
|
]
|
|
235
234
|
}
|
|
236
235
|
);
|
|
237
|
-
},
|
|
236
|
+
}, we = ({ text: e, highlightText: r }) => {
|
|
238
237
|
const t = U(() => {
|
|
239
|
-
var
|
|
238
|
+
var a;
|
|
240
239
|
const n = [];
|
|
241
240
|
if (!r)
|
|
242
241
|
return [{ id: 0, text: e, highlight: !1 }];
|
|
243
|
-
const s = (r == null ? void 0 : r.toLowerCase()) || "", o = ((
|
|
244
|
-
for (let
|
|
245
|
-
const f = o == null ? void 0 : o[
|
|
242
|
+
const s = (r == null ? void 0 : r.toLowerCase()) || "", o = ((a = e == null ? void 0 : e.toLowerCase()) == null ? void 0 : a.split(s)) || "";
|
|
243
|
+
for (let l = 0, i = 0; l < (o == null ? void 0 : o.length); l++) {
|
|
244
|
+
const f = o == null ? void 0 : o[l], b = f.length;
|
|
246
245
|
f !== "" && n.push({
|
|
247
246
|
id: n.length,
|
|
248
247
|
highlight: !1,
|
|
@@ -250,7 +249,7 @@ const pe = ({
|
|
|
250
249
|
i,
|
|
251
250
|
i + b
|
|
252
251
|
)
|
|
253
|
-
}), i += b,
|
|
252
|
+
}), i += b, l !== (o == null ? void 0 : o.length) - 1 && (n.push({
|
|
254
253
|
id: n.length,
|
|
255
254
|
highlight: !0,
|
|
256
255
|
text: e == null ? void 0 : e.substring(
|
|
@@ -269,7 +268,7 @@ const pe = ({
|
|
|
269
268
|
},
|
|
270
269
|
n == null ? void 0 : n.id
|
|
271
270
|
)) });
|
|
272
|
-
},
|
|
271
|
+
}, ye = ({
|
|
273
272
|
icon: e,
|
|
274
273
|
onClick: r,
|
|
275
274
|
buttonClassName: t,
|
|
@@ -284,7 +283,7 @@ const pe = ({
|
|
|
284
283
|
o && "base-icon-button",
|
|
285
284
|
t
|
|
286
285
|
),
|
|
287
|
-
onClick: (
|
|
286
|
+
onClick: (a) => r == null ? void 0 : r(a),
|
|
288
287
|
disabled: n,
|
|
289
288
|
title: s,
|
|
290
289
|
"aria-label": "button",
|
|
@@ -297,14 +296,14 @@ const pe = ({
|
|
|
297
296
|
cssClass: n = "",
|
|
298
297
|
type: s = "text",
|
|
299
298
|
disabled: o,
|
|
300
|
-
readonly:
|
|
301
|
-
onChange:
|
|
299
|
+
readonly: a,
|
|
300
|
+
onChange: l,
|
|
302
301
|
onKeyDown: i
|
|
303
302
|
}) => {
|
|
304
303
|
const f = m(
|
|
305
304
|
"truncate outline-none shadow-none body-1",
|
|
306
305
|
n,
|
|
307
|
-
|
|
306
|
+
a ? "pointer-events-none" : ""
|
|
308
307
|
);
|
|
309
308
|
return /* @__PURE__ */ c(
|
|
310
309
|
"input",
|
|
@@ -318,10 +317,10 @@ const pe = ({
|
|
|
318
317
|
disabled: o,
|
|
319
318
|
className: f,
|
|
320
319
|
onKeyDown: i,
|
|
321
|
-
onChange: (b) =>
|
|
320
|
+
onChange: (b) => l == null ? void 0 : l(b.currentTarget.value)
|
|
322
321
|
}
|
|
323
322
|
);
|
|
324
|
-
},
|
|
323
|
+
}, ve = ({
|
|
325
324
|
iconBeforeInput: e,
|
|
326
325
|
iconAfterInput: r,
|
|
327
326
|
containerClasses: t,
|
|
@@ -340,7 +339,7 @@ const pe = ({
|
|
|
340
339
|
}
|
|
341
340
|
),
|
|
342
341
|
r
|
|
343
|
-
] }),
|
|
342
|
+
] }), xe = ({
|
|
344
343
|
url: e,
|
|
345
344
|
title: r,
|
|
346
345
|
linkClassName: t = "",
|
|
@@ -366,7 +365,7 @@ const pe = ({
|
|
|
366
365
|
]
|
|
367
366
|
}
|
|
368
367
|
);
|
|
369
|
-
},
|
|
368
|
+
}, Ee = ({ title: e, text: r, onClick: t }) => /* @__PURE__ */ c(
|
|
370
369
|
"button",
|
|
371
370
|
{
|
|
372
371
|
type: "button",
|
|
@@ -375,7 +374,7 @@ const pe = ({
|
|
|
375
374
|
"aria-label": "button",
|
|
376
375
|
children: /* @__PURE__ */ c("h4", { children: e })
|
|
377
376
|
}
|
|
378
|
-
),
|
|
377
|
+
), Fe = ({
|
|
379
378
|
label: e,
|
|
380
379
|
id: r,
|
|
381
380
|
checked: t,
|
|
@@ -383,9 +382,9 @@ const pe = ({
|
|
|
383
382
|
description: s,
|
|
384
383
|
onChange: o
|
|
385
384
|
}) => {
|
|
386
|
-
const
|
|
387
|
-
(
|
|
388
|
-
|
|
385
|
+
const a = R(
|
|
386
|
+
(l) => {
|
|
387
|
+
l.stopPropagation(), o == null || o(r, l.target.checked);
|
|
389
388
|
},
|
|
390
389
|
[o, r]
|
|
391
390
|
);
|
|
@@ -428,7 +427,7 @@ const pe = ({
|
|
|
428
427
|
"input",
|
|
429
428
|
{
|
|
430
429
|
type: "radio",
|
|
431
|
-
onChange:
|
|
430
|
+
onChange: a,
|
|
432
431
|
id: r,
|
|
433
432
|
checked: t,
|
|
434
433
|
className: "hidden"
|
|
@@ -438,44 +437,44 @@ const pe = ({
|
|
|
438
437
|
}
|
|
439
438
|
);
|
|
440
439
|
};
|
|
441
|
-
var
|
|
440
|
+
var C = /* @__PURE__ */ ((e) => (e.Closed = "Closed", e.Opened = "Opened", e))(C || {}), M = /* @__PURE__ */ ((e) => (e.LG = "Large", e.SM = "Small", e))(M || {});
|
|
442
441
|
const ce = ({
|
|
443
442
|
portalId: e,
|
|
444
|
-
state: r =
|
|
443
|
+
state: r = C.Opened,
|
|
445
444
|
heading: t,
|
|
446
445
|
size: n,
|
|
447
446
|
onClose: s,
|
|
448
447
|
children: o,
|
|
449
|
-
overlayClassName:
|
|
450
|
-
containerClassName:
|
|
448
|
+
overlayClassName: a,
|
|
449
|
+
containerClassName: l,
|
|
451
450
|
dividers: i = !0,
|
|
452
451
|
closeButtonTitle: f
|
|
453
452
|
}) => {
|
|
454
|
-
const { refs: b, context: N } =
|
|
455
|
-
open: r !==
|
|
453
|
+
const { refs: b, context: N } = Y({
|
|
454
|
+
open: r !== C.Closed && !!r,
|
|
456
455
|
onOpenChange: s
|
|
457
|
-
}), p = Z(N, { role: "dialog" }), w = j(N, { outsidePress: !0 }), { getFloatingProps: y } =
|
|
456
|
+
}), p = Z(N, { role: "dialog" }), w = j(N, { outsidePress: !0 }), { getFloatingProps: y } = G([p, w]), g = R(
|
|
458
457
|
(d) => {
|
|
459
458
|
d == null || d.preventDefault(), d == null || d.stopPropagation(), s();
|
|
460
459
|
},
|
|
461
460
|
[s]
|
|
462
461
|
);
|
|
463
|
-
return /* @__PURE__ */ c(B, { id: e, children: r !==
|
|
462
|
+
return /* @__PURE__ */ c(B, { id: e, children: r !== C.Closed && /* @__PURE__ */ c(
|
|
464
463
|
J,
|
|
465
464
|
{
|
|
466
465
|
className: m(
|
|
467
466
|
"z-[52] flex items-center justify-center bg-blackout p-4",
|
|
468
|
-
|
|
467
|
+
a
|
|
469
468
|
),
|
|
470
469
|
children: /* @__PURE__ */ c(K, { context: N, children: /* @__PURE__ */ u(
|
|
471
470
|
"div",
|
|
472
471
|
{
|
|
473
472
|
className: m(
|
|
474
473
|
"relative max-h-full modal rounded bg-white flex flex-col shadow w-full",
|
|
475
|
-
n ===
|
|
476
|
-
n ===
|
|
474
|
+
n === M.LG && "max-w-[65%]",
|
|
475
|
+
n === M.SM && "max-w-[30%]",
|
|
477
476
|
i && "divide-neutrals-400 divide-y",
|
|
478
|
-
|
|
477
|
+
l,
|
|
479
478
|
"sm:w-full sm:max-w-full sm:px-4 sm:py-6"
|
|
480
479
|
),
|
|
481
480
|
ref: b.setFloating,
|
|
@@ -502,23 +501,23 @@ const ce = ({
|
|
|
502
501
|
) })
|
|
503
502
|
}
|
|
504
503
|
) });
|
|
505
|
-
},
|
|
504
|
+
}, Ce = (e) => e.state === C.Closed ? null : /* @__PURE__ */ c(ce, { ...e }), Se = ({
|
|
506
505
|
triggerButton: e,
|
|
507
506
|
options: r,
|
|
508
507
|
content: t,
|
|
509
508
|
selectedOption: n,
|
|
510
509
|
disabled: s,
|
|
511
510
|
containerClassName: o,
|
|
512
|
-
openedClassName:
|
|
513
|
-
onOptionSelect:
|
|
511
|
+
openedClassName: a,
|
|
512
|
+
onOptionSelect: l
|
|
514
513
|
}) => {
|
|
515
|
-
const [i, f] = _(!1), { refs: b, floatingStyles: N, context: p } =
|
|
514
|
+
const [i, f] = _(!1), { refs: b, floatingStyles: N, context: p } = Y({
|
|
516
515
|
open: i,
|
|
517
516
|
onOpenChange: s ? void 0 : f,
|
|
518
517
|
placement: "bottom-end",
|
|
519
518
|
middleware: [ee(8), ne(), re()],
|
|
520
519
|
whileElementsMounted: D
|
|
521
|
-
}), w = te(p), y = j(p, { outsidePress: !0 }), { getReferenceProps: g, getFloatingProps: d } =
|
|
520
|
+
}), w = te(p), y = j(p, { outsidePress: !0 }), { getReferenceProps: g, getFloatingProps: d } = G([
|
|
522
521
|
w,
|
|
523
522
|
y
|
|
524
523
|
]);
|
|
@@ -532,7 +531,7 @@ const ce = ({
|
|
|
532
531
|
h.stopPropagation();
|
|
533
532
|
}
|
|
534
533
|
}),
|
|
535
|
-
className: m(o, i &&
|
|
534
|
+
className: m(o, i && a),
|
|
536
535
|
children: e
|
|
537
536
|
}
|
|
538
537
|
),
|
|
@@ -548,8 +547,8 @@ const ce = ({
|
|
|
548
547
|
r && r.map((h) => /* @__PURE__ */ c(
|
|
549
548
|
"div",
|
|
550
549
|
{
|
|
551
|
-
onClick: (
|
|
552
|
-
|
|
550
|
+
onClick: (E) => {
|
|
551
|
+
E.stopPropagation(), l == null || l(h.key), f(!1);
|
|
553
552
|
},
|
|
554
553
|
className: m(
|
|
555
554
|
"text-neutrals-900 body-3 cursor-pointer dropdown-item min-w-[200px]",
|
|
@@ -573,21 +572,21 @@ const ce = ({
|
|
|
573
572
|
}
|
|
574
573
|
)
|
|
575
574
|
] });
|
|
576
|
-
},
|
|
577
|
-
function
|
|
575
|
+
}, Re = 24, ke = 24;
|
|
576
|
+
function Me(e = 719) {
|
|
578
577
|
const [r, t] = _(
|
|
579
578
|
() => typeof window < "u" ? window.innerWidth < e : !1
|
|
580
579
|
);
|
|
581
|
-
return
|
|
580
|
+
return O(() => {
|
|
582
581
|
const n = window.matchMedia(`(max-width: ${e}px)`), s = (o) => {
|
|
583
582
|
t(o.matches);
|
|
584
583
|
};
|
|
585
584
|
return t(n.matches), n.addEventListener("change", s), () => n.removeEventListener("change", s);
|
|
586
585
|
}, [e]), r;
|
|
587
586
|
}
|
|
588
|
-
function
|
|
589
|
-
const t =
|
|
590
|
-
return
|
|
587
|
+
function Oe(e, r) {
|
|
588
|
+
const t = L(null);
|
|
589
|
+
return R(
|
|
591
590
|
(...s) => {
|
|
592
591
|
t.current && clearTimeout(t.current), t.current = setTimeout(() => {
|
|
593
592
|
e(...s);
|
|
@@ -598,28 +597,28 @@ function ke(e, r) {
|
|
|
598
597
|
}
|
|
599
598
|
var oe = /* @__PURE__ */ ((e) => (e.Enter = "Enter", e))(oe || {});
|
|
600
599
|
export {
|
|
601
|
-
|
|
600
|
+
fe as Alert,
|
|
602
601
|
x as AlertType,
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
602
|
+
pe as Button,
|
|
603
|
+
be as Calendar,
|
|
604
|
+
ge as Checkbox,
|
|
606
605
|
H as CloseButton,
|
|
607
|
-
|
|
606
|
+
Ne as CollapsibleBlock,
|
|
608
607
|
Se as Dropdown,
|
|
609
|
-
|
|
610
|
-
|
|
608
|
+
we as HighlightText,
|
|
609
|
+
ye as IconButton,
|
|
611
610
|
se as Input,
|
|
612
|
-
|
|
611
|
+
ve as InputWithIcon,
|
|
613
612
|
oe as KeyboardKey,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
613
|
+
xe as Link,
|
|
614
|
+
A as Loader,
|
|
615
|
+
M as PopUpSize,
|
|
616
|
+
C as PopUpState,
|
|
617
|
+
Ce as Popup,
|
|
618
|
+
Fe as Radio,
|
|
619
|
+
Re as TREE_NODE_ARROW_SIZE,
|
|
620
|
+
ke as TREE_NODE_PADDING,
|
|
621
|
+
Ee as Tag,
|
|
622
|
+
Oe as useDebounce,
|
|
623
|
+
Me as useIsMobile
|
|
625
624
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/statgpt-ui-components",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"react-flatpickr": "^4.0.11",
|
|
7
7
|
"react": "19.1.0",
|
|
8
8
|
"classnames": "^2.5.1",
|
|
9
|
-
"@epam/statgpt-shared-toolkit": "0.1.0-rc.
|
|
9
|
+
"@epam/statgpt-shared-toolkit": "0.1.0-rc.4",
|
|
10
10
|
"@tabler/icons-react": "^3.34.1",
|
|
11
11
|
"@floating-ui/react": "^0.27.14"
|
|
12
12
|
},
|