@nice2dev/ui 1.3.8 → 1.3.10
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/CHANGELOG.md +107 -0
- package/dist/NiceColorPicker-BLwYNSXJ.cjs +1 -0
- package/dist/NiceColorPicker-DS59tNkP.js +552 -0
- package/dist/NiceDataGrid-CL2_7fS7.cjs +10 -0
- package/dist/NiceDataGrid-CpJrRN_H.js +2269 -0
- package/dist/NiceForm-BQj-K7p7.cjs +1 -0
- package/dist/NiceForm-HQ4h7hX_.js +5023 -0
- package/dist/NiceGantt-BygumlaY.cjs +1 -0
- package/dist/NiceGantt-DTC7OH-v.js +334 -0
- package/dist/NiceHtmlEditor-BtpuaLln.js +901 -0
- package/dist/NiceHtmlEditor-C1OVtLQ6.cjs +10 -0
- package/dist/NiceMention-CVxxCVtQ.js +11668 -0
- package/dist/NiceMention-Te66Oid1.cjs +430 -0
- package/dist/NiceModuleLifecyclePanel-DCrFyUH8.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-Mt80MdET.js +7441 -0
- package/dist/NicePagination-CKsAP38Q.cjs +1 -0
- package/dist/NicePagination-zOed5QxG.js +202 -0
- package/dist/NicePivotGrid-Clue9FM5.js +1184 -0
- package/dist/NicePivotGrid-Cnkr9WkC.cjs +152 -0
- package/dist/NiceSavedQueryPanel-B8hVgWR2.cjs +587 -0
- package/dist/NiceSavedQueryPanel-BFtY9GOP.js +6002 -0
- package/dist/NiceSavedQueryPanel-NgG58w6i.js +6226 -0
- package/dist/NiceSavedQueryPanel-lTWY2plm.cjs +587 -0
- package/dist/NiceScheduler-BWwqFKEc.js +1712 -0
- package/dist/NiceScheduler-DqWEJU7g.cjs +5 -0
- package/dist/NiceSelect-BNPXs6FQ.cjs +1 -0
- package/dist/NiceSelect-DEruWHan.js +495 -0
- package/dist/NiceTree.doc-AIR9cRQp.js +40 -0
- package/dist/NiceTree.doc-DGrIAx3G.cjs +16 -0
- package/dist/NiceWindow-D3V7A69Q.js +2247 -0
- package/dist/NiceWindow-pgR4c-kQ.cjs +1 -0
- package/dist/core-lazy-Bjdu111n.js +351 -0
- package/dist/core-lazy-Bx_8BOlG.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +189 -14
- package/dist/data.mjs +3 -3
- package/dist/devops-CqhA0rjL.js +9130 -0
- package/dist/devops-cgRBnZVX.cjs +18 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +1 -1
- package/dist/index.cjs +130 -130
- package/dist/index.css +1 -1
- package/dist/index.d.ts +193 -17
- package/dist/index.mjs +14780 -14657
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +15 -15
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +2 -0
- package/dist/navigation.mjs +3 -3
- package/dist/no-code-BQqK8mvU.cjs +331 -0
- package/dist/no-code-Cppb-xz3.js +8320 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +1 -1
- package/dist/pickerCommons-BA3-D5RC.js +663 -0
- package/dist/pickerCommons-KrBqCBDn.cjs +1 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),g=require("@nice2dev/ui-core"),t=require("react"),je=require("react-dom"),ut=[],mt=({visible:n,onClose:i,title:c,items:o=ut,showCancelButton:d=!0,cancelText:m,size:u="md",disabled:x,readOnly:f,loading:N,error:z,className:T,"data-testid":M,style:I})=>{const{t:k}=g.useNiceTranslation();if(!n)return null;const h=x||N||f;return e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"presentation",className:"nice-actionsheet__overlay",onClick:i}),e.jsxs("div",{className:`nice-actionsheet nice-actionsheet--${u} ${x?"nice-actionsheet--disabled":""} ${f?"nice-actionsheet--readonly":""} ${N?"nice-actionsheet--loading":""} ${z?"nice-actionsheet--error":""} ${T||""}`,style:I,"data-testid":M,"aria-disabled":x||void 0,"aria-readonly":f||void 0,"aria-busy":N||void 0,children:[z&&e.jsx("div",{className:"nice-actionsheet__error",role:"alert",children:z}),N&&e.jsx("span",{className:"nice-actionsheet__spinner","aria-hidden":"true",children:e.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),c&&e.jsx("div",{className:"nice-actionsheet__title",children:c}),e.jsx("div",{className:"nice-actionsheet__items",children:o.map((r,w)=>e.jsxs("button",{className:`nice-actionsheet__item ${r.type==="danger"?"nice-actionsheet__item--danger":""}`,disabled:r.disabled||h,onClick:()=>{h||(r.onClick?.(),i())},children:[r.icon&&e.jsx("span",{className:"nice-actionsheet__icon",children:r.icon}),r.text]},w))}),d&&e.jsx("button",{className:"nice-actionsheet__cancel",onClick:i,children:m||k("cancel","Cancel")})]})]})},ft=({visible:n,onClose:i,targetRef:c,position:o="bottom",title:d,showArrow:m=!0,width:u,children:x,className:f,"data-testid":N,style:z,displayStyle:T})=>{g.useComponentDisplayClass("tooltip",T);const M=t.useRef(null),[I,k]=t.useState({top:0,left:0}),h=t.useCallback(()=>{const r=c.current,w=M.current;if(!r||!w)return;const l=r.getBoundingClientRect(),S=w.getBoundingClientRect();let a=0,L=0;const _=8;switch(o){case"top":a=l.top-S.height-_,L=l.left+(l.width-S.width)/2;break;case"bottom":a=l.bottom+_,L=l.left+(l.width-S.width)/2;break;case"left":a=l.top+(l.height-S.height)/2,L=l.left-S.width-_;break;case"right":a=l.top+(l.height-S.height)/2,L=l.right+_;break}k({top:a+window.scrollY,left:L+window.scrollX})},[c,o]);return t.useEffect(()=>{if(n){requestAnimationFrame(h);const r=w=>{const l=w.target;(l instanceof Element?l:l?.parentElement??null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]')||M.current&&!M.current.contains(l)&&c.current&&!c.current.contains(l)&&i()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)}},[n,h,i,c]),g.useOverlayFocus(M,{open:n,modal:!1,onClose:()=>i()}),n?e.jsxs("div",{ref:M,className:`nice-popover nice-popover--${o} ${f||""}`,style:{...z,position:"absolute",top:I.top,left:I.left,width:u},"data-testid":N,role:"dialog","aria-label":d,children:[m&&e.jsx("div",{className:`nice-popover__arrow nice-popover__arrow--${o}`}),d&&e.jsx("div",{className:"nice-popover__title",children:d}),e.jsx("div",{className:"nice-popover__content",children:x})]}):null},ht=({visible:n,message:i,container:c,showIndicator:o=!0,shading:d=!0,className:m,"data-testid":u,style:x})=>{const{t:f}=g.useNiceTranslation();if(!n)return null;const N=!!c?.current,z=e.jsxs("div",{className:`nice-loadpanel ${m||""}`,style:x,"data-testid":u,children:[d&&e.jsx("div",{className:"nice-loadpanel__shade"}),e.jsxs("div",{className:"nice-loadpanel__box",children:[o&&e.jsx("div",{className:"nice-spinner nice-spinner--md"}),e.jsx("span",{className:"nice-loadpanel__text",children:i||f("loading","Loading...")})]})]});if(N&&c.current){const T=c.current;return T.style.position=T.style.position||"relative",z}return z},pt=({direction:n="row",align:i,justify:c,wrap:o,gap:d,flex:m,children:u,className:x,"data-testid":f,style:N})=>e.jsx("div",{"data-testid":f,className:`nice-box ${x||""}`,style:{display:"flex",flexDirection:n,alignItems:i,justifyContent:c,flexWrap:o?"wrap":void 0,gap:d,flex:m,...N},children:u}),xt=[],wt=({direction:n="row",items:i=xt,gap:c,className:o,"data-testid":d,style:m})=>e.jsx("div",{"data-testid":d,className:`nice-responsivebox ${o||""}`,style:{display:"flex",flexDirection:n,gap:c,...m},children:i.map((u,x)=>e.jsx("div",{style:{flex:u.ratio??1,flexBasis:u.baseSize,flexShrink:u.shrink??1},children:u.children},x))}),gt=({width:n=200,height:i=200,minWidth:c=50,minHeight:o=50,maxWidth:d=1/0,maxHeight:m=1/0,handles:u=["right","bottom","bottomRight"],onResize:x,children:f,className:N,"data-testid":z,style:T})=>{const[M,I]=t.useState({width:n,height:i}),k=t.useRef(null),h=(l,S)=>{S.preventDefault();const a=S.clientX,L=S.clientY,_=M.width,B=M.height,j={n:"top",s:"bottom",e:"right",w:"left",ne:"topRight",se:"bottomRight",sw:"bottomLeft",nw:"topLeft"}[l]??l,F=j==="right"||j==="topRight"||j==="bottomRight",C=j==="left"||j==="topLeft"||j==="bottomLeft",s=j==="bottom"||j==="bottomRight"||j==="bottomLeft",y=j==="top"||j==="topRight"||j==="topLeft",E=O=>{const H=O.clientX-a,v=O.clientY-L;let q=_,p=B;F&&(q=_+H),C&&(q=_-H),s&&(p=B+v),y&&(p=B-v),q=Math.max(c,Math.min(d,q)),p=Math.max(o,Math.min(m,p)),I({width:q,height:p}),x?.({width:q,height:p})},R=()=>{document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",R)};document.addEventListener("pointermove",E),document.addEventListener("pointerup",R)},r=l=>{switch(l){case"top":case"bottom":return"ns-resize";case"left":case"right":return"ew-resize";case"topLeft":case"bottomRight":return"nwse-resize";case"topRight":case"bottomLeft":return"nesw-resize";default:return"default"}},w=l=>{const S={position:"absolute",zIndex:1},a=8;return l==="right"?{...S,top:0,right:-a/2,width:a,height:"100%",cursor:r(l)}:l==="bottom"?{...S,left:0,bottom:-a/2,width:"100%",height:a,cursor:r(l)}:l==="left"?{...S,top:0,left:-a/2,width:a,height:"100%",cursor:r(l)}:l==="top"?{...S,top:-a/2,left:0,width:"100%",height:a,cursor:r(l)}:l==="bottomRight"?{...S,bottom:-a/2,right:-a/2,width:a*2,height:a*2,cursor:r(l)}:l==="bottomLeft"?{...S,bottom:-a/2,left:-a/2,width:a*2,height:a*2,cursor:r(l)}:l==="topRight"?{...S,top:-a/2,right:-a/2,width:a*2,height:a*2,cursor:r(l)}:l==="topLeft"?{...S,top:-a/2,left:-a/2,width:a*2,height:a*2,cursor:r(l)}:S};return e.jsxs("div",{ref:k,"data-testid":z,className:`nice-resizable ${N||""}`,style:{...T,width:M.width,height:M.height,position:"relative",overflow:"hidden"},children:[f,u.map(l=>e.jsx("div",{style:w(l),onPointerDown:S=>h(l,S)},l))]})},bt=({direction:n="vertical",showScrollbar:i="onInteraction",width:c,height:o,onScroll:d,children:m,className:u,"data-testid":x,style:f})=>{const N=n==="horizontal"||n==="both"?"auto":"hidden",z=n==="vertical"||n==="both"?"auto":"hidden",T=i==="never"?"nice-scrollview--hide-sb":i==="always"?"nice-scrollview--show-sb":"";return e.jsx("div",{"data-testid":x,className:`nice-scrollview ${T} ${u||""}`,style:{...f,width:c,height:o,overflowX:N,overflowY:z},onScroll:d,children:m})},_t=[];function Ce(){const n=t.useContext(g.NiceThemeContext);return n?.portalTarget?n.portalTarget:typeof document<"u"?document.body:null}const vt=({open:n,onClose:i,children:c,title:o,size:d="md",closeOnBackdropClick:m=!0,closeOnEscape:u=!0,disableFocusTrap:x=!1,disableBodyScroll:f=!0,zIndex:N=1e3,className:z,style:T})=>{const M=t.useRef(null);g.useOverlayFocus(M,{open:n,modal:!x,onClose:i,closeOnEscape:u});const I=Ce();t.useEffect(()=>{if(!f&&n){const r=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=r}}},[n,f]);const k=t.useCallback(r=>{m&&r.target===r.currentTarget&&i()},[m,i]);if(!n)return null;const h={sm:"nice-modal--sm",md:"nice-modal--md",lg:"nice-modal--lg",xl:"nice-modal--xl",full:"nice-modal--full"}[d];return je.createPortal(e.jsx("div",{className:"nice-modal__overlay",style:{zIndex:N},onClick:k,role:"presentation",children:e.jsx("div",{ref:M,className:`nice-modal ${h} ${z||""}`,role:"dialog","aria-modal":"true","aria-label":o,style:T,tabIndex:-1,children:c})}),I)},yt=({children:n,showClose:i=!0,onClose:c,className:o})=>{const{t:d}=g.useNiceTranslation();return e.jsxs("div",{className:`nice-modal__header ${o||""}`,children:[e.jsx("div",{className:"nice-modal__title",children:n}),i&&c&&e.jsx("button",{type:"button",className:"nice-modal__close",onClick:c,"aria-label":d("overlays.close","Close"),children:e.jsx(g.NiceIcon,{name:"close",size:20})})]})},Nt=({children:n,className:i})=>e.jsx("div",{className:`nice-modal__body ${i||""}`,children:n}),kt=({children:n,className:i})=>e.jsx("div",{className:`nice-modal__footer ${i||""}`,children:n}),jt=({open:n,onClose:i,children:c,position:o="right",size:d=320,title:m,closeOnBackdropClick:u=!0,closeOnEscape:x=!0,swipeToClose:f=!0,zIndex:N=1e3,className:z,style:T})=>{const M=t.useRef(null),[I,k]=t.useState(!1),[h,r]=t.useState(0);g.useOverlayFocus(M,{open:n,onClose:i,closeOnEscape:x});const w=Ce(),l=t.useCallback(j=>{let F=0;switch(o){case"left":F=Math.min(0,j.deltaX);break;case"right":F=Math.max(0,j.deltaX);break;case"top":F=Math.min(0,j.deltaY);break;case"bottom":F=Math.max(0,j.deltaY);break}r(F)},[o]),S=t.useCallback(j=>{let C=!1;switch(o){case"left":C=j.deltaX<-100;break;case"right":C=j.deltaX>100;break;case"top":C=j.deltaY<-100;break;case"bottom":C=j.deltaY>100;break}C&&(g.triggerHaptic("light"),i()),r(0),k(!1)},[o,i]),{ref:a}=g.usePan({enabled:f&&n,onPanStart:()=>k(!0),onPan:l,onPanEnd:S}),L=t.useCallback(j=>{u&&j.target===j.currentTarget&&i()},[u,i]);if(!n)return null;const _=o==="left"||o==="right",B=_?{width:typeof d=="number"?`${d}px`:d}:{height:typeof d=="number"?`${d}px`:d},V=()=>{if(I)return _?`translateX(${h}px)`:`translateY(${h}px)`};return je.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"presentation",className:`nice-drawer__overlay ${n?"nice-drawer__overlay--visible":""}`,style:{zIndex:N},onClick:L}),e.jsx("div",{ref:j=>{M.current=j,a.current=j},className:`nice-drawer nice-drawer--${o} ${n?"nice-drawer--open":""} ${z||""}`,style:{...B,zIndex:N+1,transform:V(),transition:I?"none":void 0,...T},role:"dialog","aria-modal":"true","aria-label":m,tabIndex:-1,children:c})]}),w)},Ct=({open:n,onClose:i,children:c,title:o,showHandle:d=!0,snapPoints:m=[.5,.9],initialSnap:u=0,expandable:x=!0,closeOnBackdropClick:f=!0,closeOnEscape:N=!0,hapticFeedback:z=!0,zIndex:T=1e3,className:M,style:I})=>{const k=t.useRef(null),h=t.useRef(null),[r,w]=t.useState(u),[l,S]=t.useState(!1),[a,L]=t.useState(0),_=t.useRef(0);t.useEffect(()=>{n&&(w(u),L(0))},[n,u]),g.useOverlayFocus(k,{open:n,onClose:i,closeOnEscape:N});const B=Ce();t.useEffect(()=>{if(n){const E=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=E}}},[n]);const V=t.useCallback(E=>{const R=E.target.closest(".nice-bottom-sheet__handle"),O=h.current,H=!O||O.scrollTop<=0;!R&&!H||(S(!0),_.current=E.touches[0].clientY)},[]),j=t.useCallback(E=>{if(!l)return;const R=E.touches[0].clientY-_.current;(R>0||r<m.length-1)&&L(R)},[l,r,m.length]),F=t.useCallback(()=>{if(!l)return;const E=window.innerHeight;m[r]*E;const R=-a,O=E*.15;R>O&&x&&r<m.length-1?(w(r+1),z&&g.triggerHaptic("selection")):R<-O&&(r>0?(w(r-1),z&&g.triggerHaptic("selection")):(z&&g.triggerHaptic("light"),i())),S(!1),L(0)},[l,a,r,m,x,z,i]),C=t.useCallback(()=>{f&&i()},[f,i]);if(!n)return null;const s=m[r]*100,y=l?a:0;return je.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"presentation",className:`nice-bottom-sheet__overlay ${n?"nice-bottom-sheet__overlay--visible":""}`,style:{zIndex:T},onClick:C}),e.jsxs("div",{ref:k,className:`nice-bottom-sheet ${n?"nice-bottom-sheet--open":""} ${M||""}`,style:{zIndex:T+1,height:`${s}vh`,transform:`translateY(${Math.max(0,y)}px)`,transition:l?"none":"transform 0.3s ease-out, height 0.3s ease-out",...I},role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,onTouchStart:V,onTouchMove:j,onTouchEnd:F,children:[d&&e.jsx("div",{className:"nice-bottom-sheet__handle","aria-hidden":"true"}),o&&e.jsx("div",{className:"nice-bottom-sheet__title",children:o}),e.jsx("div",{ref:h,className:"nice-bottom-sheet__content",children:c})]})]}),B)},Et=({trigger:n,children:i,placement:c="bottom",triggerMode:o="click",open:d,onOpenChange:m,hoverDelay:u=200,offset:x=8,className:f,showArrow:N=!0})=>{const[z,T]=t.useState(!1),M=t.useRef(null),I=t.useRef(null),k=t.useRef(null),h=Ce(),r=d!==void 0,w=r?d:z,l=t.useCallback(C=>{r||T(C),m?.(C)},[r,m]);g.useClickOutside(I,()=>{o!=="manual"&&w&&l(!1)});const S=o!=="hover";g.useOverlayFocus(I,{open:w&&S,modal:!1,onClose:()=>l(!1)});const a=t.useCallback(()=>{o==="click"&&l(!w)},[o,w,l]),L=t.useCallback(()=>{o==="hover"&&(k.current&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>l(!0),u))},[o,u,l]),_=t.useCallback(()=>{o==="hover"&&(k.current&&window.clearTimeout(k.current),k.current=window.setTimeout(()=>l(!1),u))},[o,u,l]),B=t.useCallback(C=>{const s=C.relatedTarget;!M.current?.contains(s)&&!I.current?.contains(s)&&_()},[_]),V=t.useCallback(C=>{o==="hover"&&w&&C.key==="Escape"&&(C.preventDefault(),C.stopPropagation(),k.current&&window.clearTimeout(k.current),l(!1))},[o,w,l]),[j,F]=t.useState({top:0,left:0});return t.useEffect(()=>{if(!w||!M.current||!I.current)return;const C=M.current.getBoundingClientRect(),s=I.current.getBoundingClientRect(),y=window.innerWidth,E=window.innerHeight;let R=0,O=0;const[H,v="center"]=c.split("-");switch(H){case"top":R=C.top-s.height-x,O=C.left+(C.width-s.width)/2;break;case"bottom":R=C.bottom+x,O=C.left+(C.width-s.width)/2;break;case"left":R=C.top+(C.height-s.height)/2,O=C.left-s.width-x;break;case"right":R=C.top+(C.height-s.height)/2,O=C.right+x;break}H==="top"||H==="bottom"?(v==="start"&&(O=C.left),v==="end"&&(O=C.right-s.width)):(v==="start"&&(R=C.top),v==="end"&&(R=C.bottom-s.height)),O=Math.max(8,Math.min(y-s.width-8,O)),R=Math.max(8,Math.min(E-s.height-8,R)),F({top:R,left:O})},[w,c,x]),e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:M,className:"nice-popover__trigger",onClick:a,onMouseEnter:L,onMouseLeave:_,onFocus:L,onBlur:B,onKeyDown:V,style:{display:"inline-block"},children:n}),w&&je.createPortal(e.jsxs("div",{ref:I,className:`nice-popover nice-popover--${c} ${f||""}`,style:{position:"fixed",top:j.top,left:j.left,zIndex:1100},onMouseEnter:L,onMouseLeave:_,role:S?"dialog":"tooltip",children:[N&&e.jsx("div",{className:"nice-popover__arrow"}),e.jsx("div",{className:"nice-popover__content",children:i})]}),h)]})},It=({items:n=_t,children:i,onOpen:c,onClose:o,className:d})=>{const[m,u]=t.useState(!1),[x,f]=t.useState({x:0,y:0}),N=t.useRef(null),z=t.useRef(null),T=Ce();g.useClickOutside(N,()=>{m&&(u(!1),o?.())});const M=t.useCallback(r=>{if(r.preventDefault(),r.clientX===0&&r.clientY===0&&r.target instanceof Element){const w=r.target.getBoundingClientRect();f({x:w.left,y:w.bottom})}else f({x:r.clientX,y:r.clientY});u(!0),c?.()},[c]),I=t.useCallback(()=>{u(!1),o?.()},[o]),k=t.useCallback(r=>{!r.disabled&&r.onClick&&(r.onClick(),I())},[I]);g.useOverlayFocus(N,{open:m,modal:!1,onClose:I}),g.useRovingFocus(N,{orientation:"vertical",wrap:!0,typeahead:!0});const h=r=>e.jsx("ul",{className:"nice-context-menu__list",role:"menu",children:r.map(w=>w.divider?e.jsx("li",{className:"nice-context-menu__divider",role:"separator"},w.key):e.jsx("li",{role:"presentation",children:e.jsxs("button",{type:"button",className:`nice-context-menu__item ${w.disabled?"nice-context-menu__item--disabled":""} ${w.danger?"nice-context-menu__item--danger":""}`,role:"menuitem",disabled:w.disabled,onClick:()=>k(w),children:[w.icon&&e.jsx("span",{className:"nice-context-menu__icon",children:w.icon}),e.jsx("span",{className:"nice-context-menu__label",children:w.label})]})},w.key))});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:z,onContextMenu:M,style:{display:"contents"},children:i}),m&&je.createPortal(e.jsx("div",{ref:N,className:`nice-context-menu ${d||""}`,style:{position:"fixed",left:x.x,top:x.y,zIndex:1200},children:h(n)}),T)]})};function Oe(n,i){if(!n)return{score:1,indices:[]};const c=n.toLowerCase(),o=i.toLowerCase();let d=0;const m=[];let u=0,x=-1;for(let f=0;f<o.length&&d<c.length;f++)o[f]===c[d]&&(m.push(f),x===f-1&&(u+=3),(f===0||/[\s\-_/.]/.test(i[f-1]))&&(u+=5),i[f]===n[d]&&(u+=1),u+=1,x=f,d++);return d<c.length?null:(u-=m[0]*.1,{score:u,indices:m})}function Ke(n,i){if(i.length===0)return[n];const c=[];let o=0;const d=new Set(i);for(let m=0;m<n.length;m++)d.has(m)&&(o<m&&c.push(n.slice(o,m)),c.push(t.createElement("mark",{key:`m-${m}`,className:"nice-command-palette__match"},n[m])),o=m+1);return o<n.length&&c.push(n.slice(o)),c}function Rt(n,i){switch(i.type){case"REGISTER":{const c=new Map(n.commands);return c.set(i.command.id,i.command),{...n,commands:c}}case"REGISTER_BATCH":{const c=new Map(n.commands);for(const o of i.commands)c.set(o.id,o);return{...n,commands:c}}case"UNREGISTER":{const c=new Map(n.commands);return c.delete(i.id),{...n,commands:c}}case"OPEN":return{...n,isOpen:!0,query:"",selectedIndex:0};case"CLOSE":return{...n,isOpen:!1,query:"",selectedIndex:0};case"SET_QUERY":return{...n,query:i.query,selectedIndex:0};case"SET_SELECTED":return{...n,selectedIndex:i.index};case"ADD_RECENT":{const c=n.recentIds.filter(o=>o!==i.id);return{...n,recentIds:[i.id,...c].slice(0,i.maxRecent)}}default:return n}}const Ge=t.createContext(null);function Qe(){const n=t.useContext(Ge);if(!n)throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");return n}const Ze=({children:n,commands:i,placeholder:c,maxVisible:o=10,maxRecent:d=5,className:m,emptyText:u,closeOnAction:x=!0,onOpen:f,onClose:N,includeActions:z=!0})=>{const{t:T}=g.useNiceTranslation(),M=g.useNiceActions(),I=T("commandPalette.general","General"),k=Ce(),[h,r]=t.useReducer(Rt,{commands:new Map(i?.map(p=>[p.id,p])??[]),isOpen:!1,query:"",selectedIndex:0,recentIds:[]}),w=t.useRef(null),l=t.useRef(null),[S,a]=t.useState(!1),L=t.useCallback(p=>{r({type:"REGISTER",command:p})},[]),_=t.useCallback(p=>{r({type:"UNREGISTER",id:p})},[]),B=t.useCallback(p=>{r({type:"REGISTER_BATCH",commands:p})},[]),V=t.useCallback(()=>{r({type:"OPEN"}),f?.()},[f]),j=t.useCallback(()=>{r({type:"CLOSE"}),N?.()},[N]),F=t.useCallback(()=>{h.isOpen?j():V()},[h.isOpen,j,V]),C=t.useMemo(()=>{const p=new Map(h.commands);if(z)for(const $ of M){const b=`action:${$.id}`;$.palette===!1||p.has(b)||p.set(b,{id:b,label:$.label,description:$.description,category:$.group,shortcut:typeof $.keyboard=="string"?$.keyboard:$.keyboard?.[0],disabled:$.when?!$.when():!1,action:()=>{g.triggerNiceAction($.id,"keyboard")}})}return p},[h.commands,M,z,h.isOpen]),y=t.useMemo(()=>{const p=Array.from(C.values()).filter(b=>!b.hidden);if(!h.query.trim()){const b=h.recentIds.map(D=>C.get(D)).filter(D=>!!D&&!D.hidden),W=p.filter(D=>!h.recentIds.includes(D.id));return W.sort((D,se)=>D.label.localeCompare(se.label)),[...b,...W].map(D=>({command:D,match:null,isRecent:h.recentIds.includes(D.id)}))}return p.map(b=>{const W=Oe(h.query,b.label),D=b.description?Oe(h.query,b.description):null,se=b.keywords?.map(ne=>Oe(h.query,ne)).filter(Boolean)[0]??null,ae=[W,D,se].filter(Boolean).sort((ne,pe)=>(pe?.score??0)-(ne?.score??0))[0]??null;return{command:b,match:ae,isRecent:!1}}).filter(b=>b.match!==null).sort((b,W)=>(W.match?.score??0)-(b.match?.score??0))},[C,h.query,h.recentIds]).slice(0,o),E=t.useCallback(async p=>{const $=C.get(p);if(!(!$||$.disabled)){a(!0);try{await $.action(),r({type:"ADD_RECENT",id:p,maxRecent:d})}finally{a(!1),x&&j()}}},[C,d,x,j]);g.useIntent("menu",()=>F());const R=t.useRef(null);g.useOverlayFocus(R,{open:h.isOpen,onClose:j,initialFocus:w}),g.useIntent(["navigate","activate"],p=>{const $=y.length;if(p.intent==="activate"){const W=y[h.selectedIndex];return W&&E(W.command.id),!0}if(!$||p.direction!=="up"&&p.direction!=="down")return!1;const b=p.direction==="down"?1:-1;return r({type:"SET_SELECTED",index:(h.selectedIndex+b+$)%$}),!0},{ref:R,enabled:h.isOpen}),g.useInputHints(R,h.isOpen?[{intent:"navigate",label:T("commandPalette.choose","Choose")},{intent:"activate",label:T("commandPalette.run","Run")},{intent:"back",label:T("input.hint.close","Close")}]:[]);const O=t.useCallback(p=>{const $=y.length;if($){if(p.key==="ArrowDown")p.preventDefault(),r({type:"SET_SELECTED",index:(h.selectedIndex+1)%$});else if(p.key==="ArrowUp")p.preventDefault(),r({type:"SET_SELECTED",index:(h.selectedIndex-1+$)%$});else if(p.key==="Enter"){p.preventDefault();const b=y[h.selectedIndex];b&&E(b.command.id)}}},[y,h.selectedIndex,E]);t.useEffect(()=>{if(!l.current)return;l.current.children[h.selectedIndex]?.scrollIntoView?.({block:"nearest"})},[h.selectedIndex]);const H=t.useMemo(()=>({registerCommand:L,unregisterCommand:_,registerCommands:B,open:V,close:j,toggle:F,isOpen:h.isOpen,executeCommand:E}),[L,_,B,V,j,F,h.isOpen,E]),v=t.useMemo(()=>{const p=new Map;for(const $ of y){const b=$.command.category??I;p.has(b)||p.set(b,[]),p.get(b).push($)}return p},[y,I]);let q=0;return e.jsxs(Ge.Provider,{value:H,children:[n,h.isOpen&&je.createPortal(e.jsx("div",{className:`nice-command-palette__overlay ${m??""}`,role:"presentation",onClick:p=>{p.stopPropagation(),p.target===p.currentTarget&&j()},children:e.jsxs("div",{ref:R,className:"nice-command-palette",role:"dialog","aria-label":T("commandPalette.title","Command palette"),"aria-modal":"true",children:[e.jsx("div",{className:"nice-command-palette__input-wrapper",children:e.jsx("input",{ref:w,className:"nice-command-palette__input",type:"text",placeholder:c??T("commandPalette.placeholder","Type a command..."),value:h.query,onChange:p=>r({type:"SET_QUERY",query:p.target.value}),onKeyDown:O,"aria-label":T("commandPalette.search","Search commands"),"aria-autocomplete":"list","aria-controls":"nice-command-palette-list","aria-activedescendant":y[h.selectedIndex]?`nice-cmd-${y[h.selectedIndex].command.id}`:void 0})}),e.jsxs("div",{ref:l,id:"nice-command-palette-list",className:"nice-command-palette__list",role:"listbox",children:[y.length===0&&e.jsx("div",{className:"nice-command-palette__empty",children:u??T("commandPalette.empty","No commands found")}),Array.from(v.entries()).map(([p,$])=>e.jsxs("div",{className:"nice-command-palette__group",children:[e.jsx("div",{className:"nice-command-palette__category",children:p}),$.map(b=>{const W=q++,D=W===h.selectedIndex;return e.jsxs("div",{id:`nice-cmd-${b.command.id}`,className:`nice-command-palette__item ${D?"nice-command-palette__item--selected":""} ${b.command.disabled?"nice-command-palette__item--disabled":""}`,role:"option","aria-selected":D,"aria-disabled":b.command.disabled,onClick:()=>!b.command.disabled&&E(b.command.id),onMouseEnter:()=>r({type:"SET_SELECTED",index:W}),children:[b.command.icon&&e.jsx("span",{className:"nice-command-palette__icon",children:b.command.icon}),e.jsxs("div",{className:"nice-command-palette__label-group",children:[e.jsx("span",{className:"nice-command-palette__label",children:b.match&&h.query?Ke(b.command.label,b.match.indices):b.command.label}),b.command.description&&e.jsx("span",{className:"nice-command-palette__description",children:b.command.description})]}),b.command.shortcut&&e.jsx("kbd",{className:"nice-command-palette__shortcut",children:b.command.shortcut}),b.isRecent&&e.jsx("span",{className:"nice-command-palette__recent-badge",children:T("commandPalette.recent","Recent")})]},b.command.id)})]},p))]}),S&&e.jsx("div",{className:"nice-command-palette__executing",children:T("commandPalette.executing","Executing...")})]})}),k)]})};process.env.NODE_ENV!=="production"&&(Ze.displayName="NiceCommandPaletteProvider");function Tt(n){const{registerCommands:i,unregisterCommand:c}=Qe();t.useEffect(()=>(i(n),()=>{for(const o of n)c(o.id)}),[])}const Mt=Object.assign(t.forwardRef(({blocked:n,message:i,spinner:c,blur:o,children:d,className:m,"data-testid":u,style:x,id:f},N)=>{const z=g.useControlId(f);return e.jsxs("div",{ref:N,id:z,className:`nice-block-ui ${m||""}`,style:{position:"relative",...x},"data-testid":u,children:[d,n&&e.jsx("div",{className:`nice-block-ui__overlay${o?" nice-block-ui__overlay--blur":""}`,"aria-busy":"true",role:"alert",children:(c||i)&&e.jsxs("div",{className:"nice-block-ui__content",children:[c&&e.jsx("div",{className:"nice-block-ui__spinner","aria-hidden":"true"}),i&&e.jsx("div",{className:"nice-block-ui__message",children:i})]})})]})}),{displayName:"NiceBlockUI"}),St=Object.assign(t.forwardRef(({windows:n,children:i,onChange:c,onClose:o,onFocus:d,showTaskbar:m=!0,size:u="md",className:x,style:f,id:N,...z},T)=>{const M=g.useControlId(N),{t:I}=g.useNiceTranslation(),[k,h]=t.useState(null),r=t.useRef(null),w=t.useRef(null);g.useRovingFocus(w,{orientation:"horizontal",itemSelector:".nice-wm__taskbar-btn"});const l=t.useRef(null),S=t.useCallback(s=>{const y=[...r.current?.querySelectorAll("[data-wm-key]")??[]].find(E=>E.getAttribute("data-wm-key")===s);return y?((g.focusCandidates(y)[0]??y).focus(),!0):!1},[]);t.useEffect(()=>{const s=l.current;s&&S(s)&&(l.current=null)});const a=t.useMemo(()=>n??[],[n]),L=Math.max(1,...a.map(s=>s.zIndex??1)),_=t.useCallback((s,y)=>{const E=a.map(R=>R.key===s?{...R,...y}:R);c?.(E)},[a,c]),B=t.useCallback(s=>{_(s,{zIndex:L+1}),d?.(s)},[_,L,d]),V=t.useCallback(s=>{o?.(s),c?.(a.filter(y=>y.key!==s))},[a,c,o]),j=t.useCallback(s=>{const y=a.find(E=>E.key===s);y&&_(s,{minimized:!y.minimized,maximized:!1})},[a,_]),F=t.useCallback(s=>{const y=a.find(E=>E.key===s);y&&_(s,{maximized:!y.maximized,minimized:!1})},[a,_]);t.useEffect(()=>{if(!k)return;const s=E=>{const R=a.find(O=>O.key===k.key);if(R)if(k.mode==="move")_(k.key,{x:E.clientX-k.offsetX,y:E.clientY-k.offsetY});else{const H=r.current?.getBoundingClientRect(),v=H?.left??0,q=H?.top??0;_(k.key,{width:Math.max(200,E.clientX-v-R.x),height:Math.max(100,E.clientY-q-R.y)})}},y=()=>h(null);return document.addEventListener("mousemove",s),document.addEventListener("mouseup",y),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",y)}},[k,a,_]);const C=t.useCallback((s,y,E)=>{y.preventDefault();const R=a.find(O=>O.key===s);R&&(B(s),h({key:s,offsetX:E==="move"?y.clientX-R.x:0,offsetY:E==="move"?y.clientY-R.y:0,mode:E}))},[a,B]);return e.jsxs("div",{ref:s=>{r.current=s,typeof T=="function"?T(s):T&&(T.current=s)},id:M,className:`nice-wm nice-wm--${u} ${x??""}`,style:{...f,position:"relative",overflow:"hidden"},...z,children:[a.map(s=>{if(s.minimized)return null;const y=s.maximized,E=y?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:s.zIndex??1}:{position:"absolute",top:s.y,left:s.x,width:s.width,height:s.height,zIndex:s.zIndex??1};return e.jsxs("div",{className:`nice-wm__window ${y?"nice-wm__window--maximized":""}`,style:E,onMouseDown:()=>B(s.key),onFocus:()=>{(s.zIndex??1)<L&&B(s.key)},role:"dialog","aria-label":s.title,tabIndex:-1,"data-wm-key":s.key,"data-nice-focus-scope":"spatial","data-nice-region":s.title,children:[e.jsxs("div",{className:"nice-wm__titlebar",onMouseDown:R=>!y&&C(s.key,R,"move"),children:[s.icon&&e.jsx("span",{className:"nice-wm__icon",children:s.icon}),e.jsx("span",{className:"nice-wm__title",children:s.title}),e.jsxs("div",{className:"nice-wm__controls",children:[(s.minimizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--min",onClick:()=>j(s.key),title:I("wm.minimize","Minimize"),children:e.jsx(g.NiceIcon,{name:"minus",size:14})}),(s.maximizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--max",onClick:()=>F(s.key),title:I("wm.maximize","Maximize"),children:e.jsx(g.NiceIcon,{name:y?"copy":"window",size:14})}),(s.closable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--close",onClick:()=>V(s.key),title:I("wm.close","Close"),children:e.jsx(g.NiceIcon,{name:"close",size:14})})]})]}),e.jsx("div",{className:"nice-wm__body",children:s.content}),(s.resizable??!0)&&!y&&e.jsx("div",{className:"nice-wm__resize-handle",onMouseDown:R=>C(s.key,R,"resize")})]},s.key)}),n===void 0&&i,m&&e.jsx("div",{ref:w,className:"nice-wm__taskbar",role:"toolbar","aria-label":I("wm.taskbar","Taskbar"),"data-nice-region":I("wm.taskbar","Taskbar"),children:a.map(s=>e.jsxs("button",{type:"button",className:`nice-wm__taskbar-btn ${s.minimized?"nice-wm__taskbar-btn--minimized":""}`,onClick:()=>{s.minimized&&j(s.key),B(s.key),(s.minimized||!S(s.key))&&(l.current=s.key)},children:[s.icon&&e.jsx("span",{className:"nice-wm__taskbar-icon",children:s.icon}),e.jsx("span",{className:"nice-wm__taskbar-label",children:s.title})]},s.key))})]})}),{displayName:"NiceWindowManager"});function zt(n,i){const c=document.querySelector(n);if(!c)return null;const o=c.getBoundingClientRect();return{top:o.top-i+window.scrollY,left:o.left-i+window.scrollX,width:o.width+i*2,height:o.height+i*2}}function $t(n,i,c,o){const m={w:window.innerWidth,h:window.innerHeight+window.scrollY},u={top:{top:n.top-c-12,left:n.left+n.width/2-i/2},bottom:{top:n.top+n.height+12,left:n.left+n.width/2-i/2},left:{top:n.top+n.height/2-c/2,left:n.left-i-12},right:{top:n.top+n.height/2-c/2,left:n.left+n.width+12}};if(o&&o!=="auto")return{...u[o],actualPlacement:o};for(const x of["bottom","top","right","left"]){const f=u[x];if(f.top>=0&&f.left>=0&&f.top+c<=m.h&&f.left+i<=m.w)return{...f,actualPlacement:x}}return{...u.bottom,actualPlacement:"bottom"}}function Pt(){return e.jsx(g.NiceIcon,{name:"close",size:16})}function Lt(){return e.jsx(g.NiceIcon,{name:"chevron-left",size:16})}function Ot(){return e.jsx(g.NiceIcon,{name:"chevron-right",size:16})}function Yt(){return e.jsx(g.NiceIcon,{name:"skip-forward",size:16})}function Dt(){return e.jsx(g.NiceIcon,{name:"play",size:16})}function Ft(){return e.jsx(g.NiceIcon,{name:"pause",size:16})}function Le(n,i,c){return c==="text"?e.jsx("span",{className:"nice-tutorial__btn-label",children:i}):c==="icon-text"?e.jsxs(e.Fragment,{children:[n,e.jsx("span",{className:"nice-tutorial__btn-label",children:i})]}):n}const Bt=[],We=({steps:n=Bt,active:i,onFinish:c,onSkip:o,onStepChange:d,closeOnEscape:m=!0,closeOnOverlayClick:u=!1,showProgress:x=!0,showSkipButton:f=!0,labels:N,animationDuration:z=300,overlayOpacity:T=.6,zIndex:M=1e4,buttonsPlacement:I="floating-bottom",buttonsDisplay:k="icon",showAutoplay:h=!0,autoplayInterval:r=5e3,autoplaySpeedRange:w={min:2e3,max:15e3},onAutoplayChange:l})=>{const{t:S}=g.useNiceTranslation(),[a,L]=t.useState(0),[_,B]=t.useState(null),[V,j]=t.useState({w:340,h:200}),[F,C]=t.useState(!0),[s,y]=t.useState(!1),[E,R]=t.useState(r),O=t.useRef(null),H=t.useRef(-1),v=n[a],q=a===n.length-1,p=a===0,$=N?.next??"Next",b=N?.back??"Back",W=N?.finish??"Finish",D=N?.skip??"Skip",se=N?.stepOf??"of",ae=N?.play??"Play",ne=N?.pause??"Pause",pe=N?.speed??"Speed",Se=N?.close??"Close";t.useEffect(()=>{i&&(L(0),y(!1),R(r))},[i,r]),t.useEffect(()=>{if(O.current){const P=O.current.getBoundingClientRect();j({w:P.width,h:P.height})}},[a,i]),t.useEffect(()=>{if(!i||!v)return;const P=v.highlightPadding??0,X=()=>{const K=zt(v.target,P);B(K)};if(X(),v.scrollIntoView!==!1){document.querySelector(v.target)?.scrollIntoView({behavior:"smooth",block:"center"});const Ie=setTimeout(X,350);return()=>clearTimeout(Ie)}},[i,v,a]),t.useEffect(()=>{!i||!v||H.current!==a&&(H.current>=0&&H.current<n.length&&n[H.current]?.onLeave?.(),v.onEnter?.(),H.current=a)},[i,v,a,n]);const oe=t.useCallback(()=>{if(q)v?.onLeave?.(),c?.();else{const P=a+1;L(P),d?.(P)}},[a,q,c,d,v]),xe=t.useCallback(()=>{if(!p){const P=a-1;L(P),d?.(P)}},[a,p,d]),ze=t.useCallback(P=>{P!==a&&P>=0&&P<n.length&&(L(P),d?.(P))},[a,n.length,d]);t.useEffect(()=>{if(!i||!v?.advanceOn)return;const P=document.querySelector(v.target);if(!P)return;const X=()=>oe();return P.addEventListener(v.advanceOn.event,X),()=>P.removeEventListener(v.advanceOn.event,X)},[i,v,a,oe]);const we=t.useRef(null),G=!!(i&&v);g.useOverlayFocus(we,{open:G,modal:!(v?.waitForAction||v?.advanceOn),onClose:()=>o?.(),closeOnEscape:m,closeHint:D}),t.useEffect(()=>{const P=we.current;if(!G||!P)return;const X=K=>{if(!(K.defaultPrevented||K.target instanceof HTMLInputElement)){if(K.key==="ArrowRight")oe();else if(K.key==="ArrowLeft")xe();else if(K.key==="Home"||K.key==="End")ze(K.key==="Home"?0:n.length-1);else return;K.preventDefault()}};return P.addEventListener("keydown",X),()=>P.removeEventListener("keydown",X)},[G,oe,xe,ze,n.length]);const ye=g.useInputEngine(),A=G?v?.title:void 0;t.useEffect(()=>{A&&a>0&&ye?.announce(A)},[ye,A,a]);const Ee=t.useId(),$e=`${Ee}-content`;g.useIntent(["sectionPrev","sectionNext"],P=>{if(P.intent==="sectionNext"){if(v?.waitForAction)return!1;oe()}else xe()},{ref:we,enabled:G}),g.useInputHints(we,G?[...p?[]:[{intent:"sectionPrev",label:b}],...v?.waitForAction?[]:[{intent:"sectionNext",label:q?W:$}]]:[]),t.useEffect(()=>{C(!0);const P=setTimeout(()=>C(!1),z);return()=>clearTimeout(P)},[a,z]),t.useEffect(()=>{if(!i||!s)return;const P=setInterval(()=>{L(X=>{if(X>=n.length-1)return y(!1),l?.(!1),n[X]?.onLeave?.(),c?.(),X;const K=X+1;return d?.(K),K})},Math.max(500,E));return()=>clearInterval(P)},[i,s,E,n,l,c,d]);const ge=t.useCallback(()=>{y(P=>{const X=!P;return l?.(X),X})},[l]),ee=t.useMemo(()=>_?$t(_,V.w,V.h,v?.placement):{top:typeof window<"u"?window.innerHeight/2:0,left:typeof window<"u"?window.innerWidth/2:0,actualPlacement:"bottom"},[_,V,v?.placement]),re=n.length===0?0:(a+1)/n.length*100,be=t.useCallback(P=>{const X=h&&n.length>1,K=f&&!q&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--skip nice-tutorial__btn--${k}`,onClick:o,"aria-label":D,title:D,children:Le(e.jsx(Yt,{}),D,k)}),Ie=!p&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--back nice-tutorial__btn--${k}`,onClick:xe,"aria-label":b,title:b,children:Le(e.jsx(Lt,{}),b,k)}),Fe=!v?.waitForAction&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--next nice-tutorial__btn--${k}`,onClick:oe,"aria-label":q?W:$,title:q?W:$,children:Le(e.jsx(Ot,{}),q?W:$,k)}),Be=X&&e.jsx("button",{type:"button",className:["nice-tutorial__btn","nice-tutorial__btn--play",`nice-tutorial__btn--${k}`,s?"nice-tutorial__btn--active":""].filter(Boolean).join(" "),onClick:ge,"aria-label":s?ne:ae,title:s?ne:ae,"aria-pressed":s,children:Le(s?e.jsx(Ft,{}):e.jsx(Dt,{}),s?ne:ae,k)});return e.jsxs("div",{className:["nice-tutorial__controls",P?"nice-tutorial__controls--inline":"nice-tutorial__controls--floating-bottom"].join(" "),style:P?void 0:{zIndex:M+2},role:"group","aria-label":S("tutorial.tutorialControls","Tutorial controls"),children:[K,Ie,x&&e.jsxs("span",{className:"nice-tutorial__step-label","aria-live":"polite",children:[a+1," ",se," ",n.length]}),Fe,X&&e.jsx("div",{className:"nice-tutorial__progress-bar",role:"progressbar","aria-valuenow":Math.round(re),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${a+1} ${se} ${n.length}`,children:e.jsx("div",{className:"nice-tutorial__progress-bar-fill",style:{width:`${re}%`}})}),Be,X&&e.jsxs("label",{className:"nice-tutorial__speed",children:[e.jsx("input",{type:"range",className:"nice-tutorial__speed-slider",min:w.min,max:w.max,step:500,value:w.min+w.max-E,onChange:te=>R(w.min+w.max-Number(te.target.value)),"aria-label":pe}),e.jsxs("span",{className:"nice-tutorial__speed-value",children:[(E/1e3).toFixed(1),"s"]})]})]})},[h,f,x,k,p,q,o,D,b,$,W,ae,ne,pe,se,xe,oe,v,s,ge,a,n.length,re,E,w,M,S]);if(!i||!v)return null;const Ye=typeof document<"u"?Math.max(document.documentElement.scrollWidth,window.innerWidth):0,De=typeof document<"u"?Math.max(document.documentElement.scrollHeight,window.innerHeight):0;return e.jsxs("div",{ref:we,className:"nice-tutorial",style:{zIndex:M},"aria-modal":v.waitForAction||v.advanceOn?void 0:!0,role:"dialog","aria-label":v.title?void 0:S("tutorial.tutorial","Tutorial"),"aria-labelledby":v.title?Ee:void 0,"aria-describedby":v.content?$e:void 0,children:[e.jsxs("svg",{className:"nice-tutorial__overlay",style:{position:"absolute",top:0,left:0,width:Ye,height:De,pointerEvents:"auto"},onClick:u?o:void 0,children:[e.jsx("defs",{children:e.jsxs("mask",{id:"nice-tutorial-mask",children:[e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"white"}),_&&e.jsx("rect",{x:_.left,y:_.top,width:_.width,height:_.height,rx:"4",fill:"black",className:F?"nice-tutorial__spotlight--entering":""})]})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`rgba(0,0,0,${T})`,mask:"url(#nice-tutorial-mask)"})]}),_&&e.jsx("div",{className:`nice-tutorial__highlight ${F?"nice-tutorial__highlight--entering":""}`,style:{position:"absolute",top:_.top,left:_.left,width:_.width,height:_.height,transition:`all ${z}ms ease`}}),v.disableInteraction&&_&&e.jsx("div",{className:"nice-tutorial__blocker",style:{position:"absolute",top:_.top,left:_.left,width:_.width,height:_.height}}),e.jsxs("div",{ref:O,className:`nice-tutorial__tooltip nice-tutorial__tooltip--${ee.actualPlacement} ${F?"nice-tutorial__tooltip--entering":""}`,style:{position:"absolute",top:ee.top,left:ee.left,transition:`all ${z}ms ease`,maxWidth:380,zIndex:M+1},children:[v.showArrow!==!1&&e.jsx("div",{className:`nice-tutorial__arrow nice-tutorial__arrow--${ee.actualPlacement}`}),e.jsxs("div",{className:"nice-tutorial__header",children:[e.jsx("h4",{id:Ee,className:"nice-tutorial__title",children:v.title}),f&&e.jsx("button",{type:"button",className:"nice-tutorial__close",onClick:o,"aria-label":Se,title:Se,children:e.jsx(Pt,{})})]}),e.jsx("div",{id:$e,className:"nice-tutorial__content",dangerouslySetInnerHTML:{__html:g.sanitizeHtml(v.content)}}),I==="inline"&&be(!0)]}),I==="floating-bottom"&&be(!1)]})};process.env.NODE_ENV!=="production"&&(We.displayName="NiceTutorial");const Je=t.createContext({startTutorial:()=>{},stopTutorial:()=>{},isActive:!1,currentStep:0,nextStep:()=>{},prevStep:()=>{},goToStep:()=>{}});function Ht(){return t.useContext(Je)}const et=({children:n})=>{const[i,c]=t.useState([]),[o,d]=t.useState(!1),[m,u]=t.useState(0),x=t.useCallback(I=>{c(I),u(0),d(!0)},[]),f=t.useCallback(()=>{d(!1),u(0),c([])},[]),N=t.useCallback(()=>{u(I=>Math.min(I+1,i.length-1))},[i.length]),z=t.useCallback(()=>{u(I=>Math.max(I-1,0))},[]),T=t.useCallback(I=>{u(Math.max(0,Math.min(I,i.length-1)))},[i.length]),M={startTutorial:x,stopTutorial:f,isActive:o,currentStep:m,nextStep:N,prevStep:z,goToStep:T};return e.jsxs(Je.Provider,{value:M,children:[n,o&&i.length>0&&e.jsx(We,{steps:i,active:o,onFinish:f,onSkip:f,onStepChange:u})]})};process.env.NODE_ENV!=="production"&&(et.displayName="NiceTutorialProvider");function Xt(n,i,c,o,d){const m=n<=d,u=n+d>=c,x=i<=d,f=i+d>=o;return x&&m?"top-left":x&&u?"top-right":f&&m?"bottom-left":f&&u?"bottom-right":m?"left":u?"right":x?"top":f?"bottom":"none"}function qt(n){switch(n){case"left":return{left:0,top:0,width:"50%",height:"100%"};case"right":return{left:"50%",top:0,width:"50%",height:"100%"};case"top":return{left:0,top:0,width:"100%",height:"50%"};case"bottom":return{left:0,top:"50%",width:"100%",height:"50%"};case"top-left":return{left:0,top:0,width:"50%",height:"50%"};case"top-right":return{left:"50%",top:0,width:"50%",height:"50%"};case"bottom-left":return{left:0,top:"50%",width:"50%",height:"50%"};case"bottom-right":return{left:"50%",top:"50%",width:"50%",height:"50%"};default:return null}}const At=Object.assign(t.forwardRef(({windowKey:n,title:i,icon:c,children:o,footer:d,x:m,y:u,defaultPosition:x,width:f=480,height:N=360,minWidth:z=200,minHeight:T=120,maxWidth:M,maxHeight:I,zIndex:k=1,closable:h=!0,minimizable:r=!0,maximizable:w=!0,fullscreenable:l=!1,pinnable:S=!1,resizable:a=!0,draggable:L=!0,snappable:_=!0,snapThreshold:B=20,minimized:V,maximized:j,fullscreen:F,pinned:C,focused:s,onClose:y,onMinimize:E,onMaximize:R,onFullscreen:O,onPin:H,onFocus:v,onMove:q,onResize:p,onSnap:$,onTitleBarDoubleClick:b,size:W="md",statusBar:D,titleBarActions:se,className:ae,style:ne,id:pe,accessMode:Se,...oe},xe)=>{const ze=g.useControlId(pe),we=g.useNiceAccessMode(Se,pe),{t:G}=g.useNiceTranslation(),ye=t.useRef(null);ye.current==null&&(ye.current=`nice-window-${Math.random().toString(36).slice(2,10)}`);const A=n??ye.current,Ee=m??x?.x??100,$e=u??x?.y??100,[ge,ee]=t.useState({x:Ee,y:$e}),[re,be]=t.useState({width:f,height:N}),[Ye,De]=t.useState(!1),[P,X]=t.useState(!1),[K,Ie]=t.useState(!1),[Fe,Be]=t.useState(!1),[te,He]=t.useState("none"),tt=V??Ye,ie=j??P,Z=F??K,Re=C??Fe,Pe=s??!0,_e=ge.x,ve=ge.y,le=re.width,de=re.height,ue=t.useRef(null),J=t.useRef(null),U=t.useRef(null),nt=t.useCallback(()=>{y?.(A)},[A,y]),it=t.useCallback(()=>{De(!0),E?.(A)},[A,E]),Xe=t.useCallback(()=>{const Y=!ie;X(Y),!Y&&U.current?(ee({x:U.current.x,y:U.current.y}),be({width:U.current.w,height:U.current.h}),U.current=null):Y&&(U.current={x:_e,y:ve,w:le,h:de}),He("none"),R?.(A,Y)},[A,ie,_e,ve,le,de,R]),qe=t.useCallback(()=>{const Y=!Z;Ie(Y),Y?U.current={x:_e,y:ve,w:le,h:de}:U.current&&(ee({x:U.current.x,y:U.current.y}),be({width:U.current.w,height:U.current.h}),U.current=null),O?.(A,Y)},[A,Z,_e,ve,le,de,O]),st=t.useCallback(()=>{const Y=!Re;Be(Y),H?.(A,Y)},[A,Re,H]),Ne=t.useCallback(()=>{v?.(A)},[A,v]),ot=t.useCallback(()=>{b?b(A):w&&Xe()},[A,w,Xe,b]);t.useEffect(()=>{const Y=me=>{if(!ue.current)return;const ce=me.clientX-ue.current.startX+ue.current.origX,Te=me.clientY-ue.current.startY+ue.current.origY;ee({x:ce,y:Te}),q?.(A,{x:ce,y:Te})},Q=me=>{if(ue.current){if(_){const ce=Xt(me.clientX,me.clientY,window.innerWidth,window.innerHeight,B);ce!=="none"&&(U.current={x:ge.x,y:ge.y,w:le,h:de},He(ce),$?.(A,ce))}ue.current=null}};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",Q)}});const ct=t.useCallback(Y=>{!L||ie||Z||(Y.preventDefault(),te!=="none"&&(U.current&&(ee({x:U.current.x,y:U.current.y}),be({width:U.current.w,height:U.current.h})),He("none")),Ne(),ue.current={startX:Y.clientX,startY:Y.clientY,origX:_e,origY:ve})},[L,ie,Z,te,_e,ve,Ne]);t.useEffect(()=>{const Y=me=>{if(!J.current)return;const ce=me.clientX-J.current.startX,Te=me.clientY-J.current.startY,ke=J.current.handle;let fe=J.current.origW,he=J.current.origH;if(ke.includes("e")&&(fe=J.current.origW+ce),ke.includes("w")&&(fe=J.current.origW-ce),ke.includes("s")&&(he=J.current.origH+Te),ke.includes("n")&&(he=J.current.origH-Te),fe=Math.max(z,M?Math.min(M,fe):fe),he=Math.max(T,I?Math.min(I,he):he),ke.includes("w")){const Ae=re.width-fe;ee(Me=>({...Me,x:Me.x+Ae}))}if(ke.includes("n")){const Ae=re.height-he;ee(Me=>({...Me,y:Me.y+Ae}))}be({width:fe,height:he}),p?.(A,{width:fe,height:he})},Q=()=>{J.current=null};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",Q)}});const at=t.useCallback((Y,Q)=>{!a||ie||Z||te!=="none"||(Q.preventDefault(),Q.stopPropagation(),Ne(),J.current={startX:Q.clientX,startY:Q.clientY,origW:le,origH:de,handle:Y})},[a,ie,Z,te,le,de,Ne]);if(t.useEffect(()=>{if(!Pe)return;const Y=Q=>{Q.key==="Escape"&&Z&&qe()};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[Pe,Z,qe]),we==="hidden"||tt)return null;const Ue=te!=="none"?qt(te):null,Ve=ie||Z,rt=Z?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:999999}:ie?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:k}:Ue?{position:"absolute",...Ue,zIndex:k}:{position:"absolute",top:ve,left:_e,width:le,height:de,zIndex:k},lt=["n","e","s","w","ne","se","sw","nw"],dt={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"};return e.jsxs("div",{ref:xe,id:ze,className:`nice-window nice-window--${W} ${Pe?"nice-window--focused":""} ${Re?"nice-window--pinned":""} ${Ve?"nice-window--maximized":""} ${te!=="none"?`nice-window--snapped-${te}`:""} ${ae??""}`,style:{...rt,...ne},onMouseDown:Ne,onFocus:Pe?void 0:Ne,role:"dialog","aria-label":i,tabIndex:-1,"data-nice-focus-scope":"spatial","data-nice-region":i,...oe,children:[e.jsxs("div",{className:"nice-window__titlebar",onMouseDown:ct,onDoubleClick:ot,children:[c&&e.jsx("span",{className:"nice-window__icon",children:c}),e.jsx("span",{className:"nice-window__title",children:i}),e.jsxs("div",{className:"nice-window__actions",children:[se,S&&e.jsx("button",{type:"button",className:`nice-window__action nice-window__action--pin ${Re?"nice-window__action--active":""}`,onClick:st,title:Re?G("window.unpin","Unpin"):G("window.pin","Pin"),children:e.jsx(g.NiceIcon,{name:"paperclip",size:14})}),r&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--minimize",onClick:it,title:G("window.minimize","Minimize"),children:e.jsx(g.NiceIcon,{name:"minus",size:14})}),w&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--maximize",onClick:Xe,title:ie?G("window.restore","Restore"):G("window.maximize","Maximize"),children:e.jsx(g.NiceIcon,{name:ie?"copy":"window",size:14})}),l&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--fullscreen",onClick:qe,title:Z?G("window.exitFullscreen","Exit Full Screen"):G("window.fullscreen","Full Screen"),children:e.jsx(g.NiceIcon,{name:Z?"collapse":"expand",size:14})}),h&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--close",onClick:nt,title:G("window.close","Close"),children:e.jsx(g.NiceIcon,{name:"close",size:14})})]})]}),e.jsx("div",{className:"nice-window__body",children:o}),d&&e.jsx("div",{className:"nice-window__footer",children:d}),D&&e.jsx("div",{className:"nice-window__statusbar",children:D}),a&&!Ve&&te==="none"&&e.jsx(e.Fragment,{children:lt.map(Y=>e.jsx("div",{className:`nice-window__resize nice-window__resize--${Y}`,style:{cursor:dt[Y]},onMouseDown:Q=>at(Y,Q)},Y))})]})}),{displayName:"NiceWindow"});exports.NiceActionSheet=mt;exports.NiceBlockUI=Mt;exports.NiceBottomSheet=Ct;exports.NiceBox=pt;exports.NiceCommandPaletteProvider=Ze;exports.NiceContextMenu=It;exports.NiceDrawer=jt;exports.NiceLoadPanel=ht;exports.NiceModal=vt;exports.NiceModalBody=Nt;exports.NiceModalFooter=kt;exports.NiceModalHeader=yt;exports.NicePopover=Et;exports.NicePopover$1=ft;exports.NiceResizable=gt;exports.NiceResponsiveBox=wt;exports.NiceScrollView=bt;exports.NiceTutorial=We;exports.NiceTutorialProvider=et;exports.NiceWindow=At;exports.NiceWindowManager=St;exports.fuzzyMatch=Oe;exports.highlightMatches=Ke;exports.useCommandPalette=Qe;exports.useNiceTutorial=Ht;exports.useRegisterCommands=Tt;
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { jsxs as T, jsx as t, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as P, NiceIcon as H } from "@nice2dev/ui-core";
|
|
3
|
+
import O, { lazy as A, useRef as z, useState as F, useEffect as y, Suspense as M } from "react";
|
|
4
|
+
const u = ({
|
|
5
|
+
height: e = 200
|
|
6
|
+
}) => /* @__PURE__ */ t(
|
|
7
|
+
"div",
|
|
8
|
+
{
|
|
9
|
+
className: "ntd-lazy-loading",
|
|
10
|
+
style: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
height: e,
|
|
15
|
+
background: "var(--ntd-color-surface, #f5f5f5)",
|
|
16
|
+
borderRadius: "var(--ntd-radius, 8px)",
|
|
17
|
+
animation: "ntd-pulse 1.5s ease-in-out infinite"
|
|
18
|
+
},
|
|
19
|
+
children: /* @__PURE__ */ t(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: "ntd-lazy-loading-spinner",
|
|
23
|
+
style: {
|
|
24
|
+
width: 24,
|
|
25
|
+
height: 24,
|
|
26
|
+
border: "2px solid var(--ntd-color-border, #ddd)",
|
|
27
|
+
borderTopColor: "var(--ntd-color-primary, #6366f1)",
|
|
28
|
+
borderRadius: "50%",
|
|
29
|
+
animation: "ntd-spin 0.8s linear infinite"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
), q = (e, r) => {
|
|
35
|
+
const { t: a } = P();
|
|
36
|
+
return /* @__PURE__ */ T(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: "ntd-lazy-error",
|
|
40
|
+
style: {
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
padding: 24,
|
|
46
|
+
background: "var(--ntd-color-error-bg, #fee2e2)",
|
|
47
|
+
borderRadius: "var(--ntd-radius, 8px)",
|
|
48
|
+
color: "var(--ntd-color-error, #dc2626)"
|
|
49
|
+
},
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ t(H, { name: "error", size: 32 }),
|
|
52
|
+
/* @__PURE__ */ t("p", { style: { margin: "12px 0 8px", fontWeight: 500 }, children: a("lazy.failedToLoadComponent", "Failed to load component") }),
|
|
53
|
+
/* @__PURE__ */ t("p", { style: { margin: 0, fontSize: "0.875em", opacity: 0.8 }, children: e.message }),
|
|
54
|
+
/* @__PURE__ */ t(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
onClick: r,
|
|
58
|
+
style: {
|
|
59
|
+
marginTop: 16,
|
|
60
|
+
padding: "8px 16px",
|
|
61
|
+
border: "none",
|
|
62
|
+
borderRadius: "var(--ntd-radius, 8px)",
|
|
63
|
+
background: "var(--ntd-color-error, #dc2626)",
|
|
64
|
+
color: "var(--nice-color-white, #fff)",
|
|
65
|
+
cursor: "pointer",
|
|
66
|
+
fontSize: "0.875em"
|
|
67
|
+
},
|
|
68
|
+
children: a("lazy.retry", "Retry")
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
class j extends O.Component {
|
|
76
|
+
constructor() {
|
|
77
|
+
super(...arguments), this.state = { error: null }, this.handleRetry = () => {
|
|
78
|
+
this.setState({ error: null });
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
static getDerivedStateFromError(r) {
|
|
82
|
+
return { error: r };
|
|
83
|
+
}
|
|
84
|
+
render() {
|
|
85
|
+
return this.state.error ? this.props.fallback(this.state.error, this.handleRetry) : this.props.children;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function l(e, r = {}) {
|
|
89
|
+
const {
|
|
90
|
+
fallback: a = /* @__PURE__ */ t(u, {}),
|
|
91
|
+
preloadOnMount: o = !1,
|
|
92
|
+
preloadOnHover: p = !1,
|
|
93
|
+
preloadAfterIdle: n,
|
|
94
|
+
minLoadingTime: f = 0,
|
|
95
|
+
ssrFallback: s,
|
|
96
|
+
errorFallback: I = q,
|
|
97
|
+
displayName: x
|
|
98
|
+
} = r;
|
|
99
|
+
let b = null, m = !1;
|
|
100
|
+
const h = async () => {
|
|
101
|
+
if (b)
|
|
102
|
+
return b;
|
|
103
|
+
const v = Date.now();
|
|
104
|
+
b = e();
|
|
105
|
+
const k = await b;
|
|
106
|
+
if (f > 0) {
|
|
107
|
+
const g = Date.now() - v;
|
|
108
|
+
g < f && await new Promise((c) => setTimeout(c, f - g));
|
|
109
|
+
}
|
|
110
|
+
return m = !0, k;
|
|
111
|
+
}, D = A(h), R = (v) => {
|
|
112
|
+
const k = z(null);
|
|
113
|
+
return y(() => {
|
|
114
|
+
o && !m && h();
|
|
115
|
+
}, []), y(() => {
|
|
116
|
+
if (n && !m) {
|
|
117
|
+
const c = "requestIdleCallback" in window ? window.requestIdleCallback(() => h(), {
|
|
118
|
+
timeout: n
|
|
119
|
+
}) : setTimeout(() => h(), n);
|
|
120
|
+
return () => {
|
|
121
|
+
"cancelIdleCallback" in window ? window.cancelIdleCallback(c) : clearTimeout(c);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}, []), y(() => {
|
|
125
|
+
if (!p || m)
|
|
126
|
+
return;
|
|
127
|
+
const c = k.current;
|
|
128
|
+
if (!c)
|
|
129
|
+
return;
|
|
130
|
+
const N = () => {
|
|
131
|
+
m || h();
|
|
132
|
+
};
|
|
133
|
+
return c.addEventListener("mouseenter", N, { once: !0 }), () => c.removeEventListener("mouseenter", N);
|
|
134
|
+
}, []), typeof window > "u" && s ? /* @__PURE__ */ t(V, { children: s }) : /* @__PURE__ */ t("div", { ref: k, className: "ntd-lazy-wrapper", children: /* @__PURE__ */ t(j, { fallback: I, children: /* @__PURE__ */ t(M, { fallback: a, children: /* @__PURE__ */ t(D, { ...v }) }) }) });
|
|
135
|
+
}, G = async () => {
|
|
136
|
+
m || await h();
|
|
137
|
+
}, w = R;
|
|
138
|
+
return w.preload = G, w.displayName = x || "LazyComponent", w;
|
|
139
|
+
}
|
|
140
|
+
function K(e = 0.1, r = "100px") {
|
|
141
|
+
const a = z(null), [o, p] = F(!1);
|
|
142
|
+
return y(() => {
|
|
143
|
+
if (!a.current || o)
|
|
144
|
+
return;
|
|
145
|
+
const n = new IntersectionObserver(
|
|
146
|
+
([f]) => {
|
|
147
|
+
f.isIntersecting && (p(!0), n.disconnect());
|
|
148
|
+
},
|
|
149
|
+
{ threshold: e, rootMargin: r }
|
|
150
|
+
);
|
|
151
|
+
return n.observe(a.current), () => n.disconnect();
|
|
152
|
+
}, [e, r, o]), [a, o];
|
|
153
|
+
}
|
|
154
|
+
function Q(e, r = 2e3) {
|
|
155
|
+
y(() => {
|
|
156
|
+
if ("requestIdleCallback" in window) {
|
|
157
|
+
const a = window.requestIdleCallback(
|
|
158
|
+
() => {
|
|
159
|
+
e.forEach((o) => o());
|
|
160
|
+
},
|
|
161
|
+
{ timeout: r }
|
|
162
|
+
);
|
|
163
|
+
return () => window.cancelIdleCallback(a);
|
|
164
|
+
} else {
|
|
165
|
+
const a = setTimeout(() => {
|
|
166
|
+
e.forEach((o) => o());
|
|
167
|
+
}, r);
|
|
168
|
+
return () => clearTimeout(a);
|
|
169
|
+
}
|
|
170
|
+
}, []);
|
|
171
|
+
}
|
|
172
|
+
function U(e, r) {
|
|
173
|
+
const a = z(/* @__PURE__ */ new Set());
|
|
174
|
+
y(() => {
|
|
175
|
+
const o = document.querySelectorAll("a[href]"), p = (n) => {
|
|
176
|
+
const s = n.currentTarget.getAttribute("href");
|
|
177
|
+
s && e[s] && !a.current.has(s) && (e[s](), a.current.add(s));
|
|
178
|
+
};
|
|
179
|
+
return o.forEach((n) => {
|
|
180
|
+
n.addEventListener("mouseenter", p);
|
|
181
|
+
}), () => {
|
|
182
|
+
o.forEach((n) => {
|
|
183
|
+
n.removeEventListener("mouseenter", p);
|
|
184
|
+
});
|
|
185
|
+
};
|
|
186
|
+
}, [r, e]);
|
|
187
|
+
}
|
|
188
|
+
const C = () => /* @__PURE__ */ t(u, { height: 400 }), L = () => /* @__PURE__ */ t(u, { height: 300 }), S = () => /* @__PURE__ */ t(u, { height: 500 }), E = () => /* @__PURE__ */ t(u, { height: 600 }), i = (e) => e, d = {
|
|
189
|
+
/**
|
|
190
|
+
* Lazy-loaded NiceCodeEditor (Monaco ~2MB)
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* import { LazyComponents } from '@nice2dev/ui';
|
|
195
|
+
*
|
|
196
|
+
* <LazyComponents.CodeEditor
|
|
197
|
+
* value={code}
|
|
198
|
+
* language="typescript"
|
|
199
|
+
* onChange={setCode}
|
|
200
|
+
* />
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
CodeEditor: /* @__PURE__ */ l(
|
|
204
|
+
/* @__PURE__ */ i(
|
|
205
|
+
() => import("./NiceCodeEditor-B5YtKZOe.js").then((e) => ({ default: e.NiceCodeEditor }))
|
|
206
|
+
),
|
|
207
|
+
{
|
|
208
|
+
fallback: /* @__PURE__ */ t(C, {}),
|
|
209
|
+
preloadOnHover: !0,
|
|
210
|
+
displayName: "LazyCodeEditor"
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/**
|
|
214
|
+
* Lazy-loaded NiceHtmlEditor
|
|
215
|
+
*/
|
|
216
|
+
HtmlEditor: /* @__PURE__ */ l(
|
|
217
|
+
/* @__PURE__ */ i(
|
|
218
|
+
() => import("./NiceHtmlEditor-BtpuaLln.js").then((e) => ({ default: e.NiceHtmlEditor }))
|
|
219
|
+
),
|
|
220
|
+
{
|
|
221
|
+
fallback: /* @__PURE__ */ t(C, {}),
|
|
222
|
+
preloadOnHover: !0,
|
|
223
|
+
displayName: "LazyHtmlEditor"
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
/**
|
|
227
|
+
* Lazy-loaded NiceDocumentViewer
|
|
228
|
+
*/
|
|
229
|
+
DocumentViewer: /* @__PURE__ */ l(
|
|
230
|
+
/* @__PURE__ */ i(
|
|
231
|
+
() => import("./NiceDocumentViewer-B9VIVKyw.js").then((e) => ({ default: e.NiceDocumentViewer }))
|
|
232
|
+
),
|
|
233
|
+
{
|
|
234
|
+
fallback: /* @__PURE__ */ t(u, { height: 600 }),
|
|
235
|
+
displayName: "LazyDocumentViewer"
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/**
|
|
239
|
+
* Lazy-loaded NiceChart
|
|
240
|
+
*/
|
|
241
|
+
Chart: /* @__PURE__ */ l(
|
|
242
|
+
/* @__PURE__ */ i(
|
|
243
|
+
() => import("./charts-C3u-VyJj.js").then((e) => e.A).then((e) => ({ default: e.NiceChart }))
|
|
244
|
+
),
|
|
245
|
+
{
|
|
246
|
+
fallback: /* @__PURE__ */ t(L, {}),
|
|
247
|
+
preloadAfterIdle: 3e3,
|
|
248
|
+
displayName: "LazyChart"
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
/**
|
|
252
|
+
* Lazy-loaded NiceVectorMap
|
|
253
|
+
*/
|
|
254
|
+
VectorMap: /* @__PURE__ */ l(
|
|
255
|
+
/* @__PURE__ */ i(
|
|
256
|
+
() => import("./charts-C3u-VyJj.js").then((e) => e.E).then((e) => ({ default: e.NiceVectorMap }))
|
|
257
|
+
),
|
|
258
|
+
{
|
|
259
|
+
fallback: /* @__PURE__ */ t(u, { height: 400 }),
|
|
260
|
+
displayName: "LazyVectorMap"
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
/**
|
|
264
|
+
* Lazy-loaded NiceSankey
|
|
265
|
+
*/
|
|
266
|
+
Sankey: /* @__PURE__ */ l(
|
|
267
|
+
/* @__PURE__ */ i(
|
|
268
|
+
() => import("./charts-C3u-VyJj.js").then((e) => e.B).then((e) => ({ default: e.NiceSankey }))
|
|
269
|
+
),
|
|
270
|
+
{
|
|
271
|
+
fallback: /* @__PURE__ */ t(L, {}),
|
|
272
|
+
displayName: "LazySankey"
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
/**
|
|
276
|
+
* Lazy-loaded NiceScheduler
|
|
277
|
+
*/
|
|
278
|
+
Scheduler: /* @__PURE__ */ l(
|
|
279
|
+
/* @__PURE__ */ i(
|
|
280
|
+
() => import("./NiceScheduler-BWwqFKEc.js").then((e) => e.d).then((e) => ({ default: e.NiceScheduler }))
|
|
281
|
+
),
|
|
282
|
+
{
|
|
283
|
+
fallback: /* @__PURE__ */ t(E, {}),
|
|
284
|
+
displayName: "LazyScheduler"
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/**
|
|
288
|
+
* Lazy-loaded NiceGantt
|
|
289
|
+
*/
|
|
290
|
+
Gantt: /* @__PURE__ */ l(
|
|
291
|
+
/* @__PURE__ */ i(
|
|
292
|
+
() => import("./NiceGantt-DTC7OH-v.js").then((e) => ({ default: e.NiceGantt }))
|
|
293
|
+
),
|
|
294
|
+
{
|
|
295
|
+
fallback: /* @__PURE__ */ t(E, {}),
|
|
296
|
+
displayName: "LazyGantt"
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/**
|
|
300
|
+
* Lazy-loaded NicePivotGrid
|
|
301
|
+
*/
|
|
302
|
+
PivotGrid: /* @__PURE__ */ l(
|
|
303
|
+
/* @__PURE__ */ i(
|
|
304
|
+
() => import("./NicePivotGrid-Clue9FM5.js").then((e) => e.p).then((e) => ({ default: e.NicePivotGrid }))
|
|
305
|
+
),
|
|
306
|
+
{
|
|
307
|
+
fallback: /* @__PURE__ */ t(S, {}),
|
|
308
|
+
displayName: "LazyPivotGrid"
|
|
309
|
+
}
|
|
310
|
+
),
|
|
311
|
+
/**
|
|
312
|
+
* Lazy-loaded NiceDataGrid (for very heavy usage)
|
|
313
|
+
*/
|
|
314
|
+
DataGrid: /* @__PURE__ */ l(
|
|
315
|
+
/* @__PURE__ */ i(
|
|
316
|
+
() => import("./NiceDataGrid-CpJrRN_H.js").then((e) => e.h).then((e) => ({ default: e.NiceDataGrid }))
|
|
317
|
+
),
|
|
318
|
+
{
|
|
319
|
+
fallback: /* @__PURE__ */ t(S, {}),
|
|
320
|
+
preloadAfterIdle: 2e3,
|
|
321
|
+
displayName: "LazyDataGrid"
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
};
|
|
325
|
+
async function X() {
|
|
326
|
+
await Promise.all([
|
|
327
|
+
d.CodeEditor.preload(),
|
|
328
|
+
d.HtmlEditor.preload(),
|
|
329
|
+
d.DocumentViewer.preload(),
|
|
330
|
+
d.Chart.preload(),
|
|
331
|
+
d.VectorMap.preload(),
|
|
332
|
+
d.Sankey.preload(),
|
|
333
|
+
d.Scheduler.preload(),
|
|
334
|
+
d.Gantt.preload(),
|
|
335
|
+
d.PivotGrid.preload()
|
|
336
|
+
]);
|
|
337
|
+
}
|
|
338
|
+
async function Y(e) {
|
|
339
|
+
await Promise.all(e.map((r) => d[r].preload()));
|
|
340
|
+
}
|
|
341
|
+
export {
|
|
342
|
+
q as D,
|
|
343
|
+
d as L,
|
|
344
|
+
u as a,
|
|
345
|
+
Y as b,
|
|
346
|
+
l as c,
|
|
347
|
+
Q as d,
|
|
348
|
+
U as e,
|
|
349
|
+
X as p,
|
|
350
|
+
K as u
|
|
351
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),C=require("@nice2dev/ui-core"),o=require("react"),f=({height:e=200})=>r.jsx("div",{className:"ntd-lazy-loading",style:{display:"flex",alignItems:"center",justifyContent:"center",height:e,background:"var(--ntd-color-surface, #f5f5f5)",borderRadius:"var(--ntd-radius, 8px)",animation:"ntd-pulse 1.5s ease-in-out infinite"},children:r.jsx("div",{className:"ntd-lazy-loading-spinner",style:{width:24,height:24,border:"2px solid var(--ntd-color-border, #ddd)",borderTopColor:"var(--ntd-color-primary, #6366f1)",borderRadius:"50%",animation:"ntd-spin 0.8s linear infinite"}})}),L=(e,t)=>{const{t:a}=C.useNiceTranslation();return r.jsxs("div",{className:"ntd-lazy-error",style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:24,background:"var(--ntd-color-error-bg, #fee2e2)",borderRadius:"var(--ntd-radius, 8px)",color:"var(--ntd-color-error, #dc2626)"},children:[r.jsx(C.NiceIcon,{name:"error",size:32}),r.jsx("p",{style:{margin:"12px 0 8px",fontWeight:500},children:a("lazy.failedToLoadComponent","Failed to load component")}),r.jsx("p",{style:{margin:0,fontSize:"0.875em",opacity:.8},children:e.message}),r.jsx("button",{onClick:t,style:{marginTop:16,padding:"8px 16px",border:"none",borderRadius:"var(--ntd-radius, 8px)",background:"var(--ntd-color-error, #dc2626)",color:"var(--nice-color-white, #fff)",cursor:"pointer",fontSize:"0.875em"},children:a("lazy.retry","Retry")})]})};class D extends o.Component{constructor(){super(...arguments),this.state={error:null},this.handleRetry=()=>{this.setState({error:null})}}static getDerivedStateFromError(t){return{error:t}}render(){return this.state.error?this.props.fallback(this.state.error,this.handleRetry):this.props.children}}function i(e,t={}){const{fallback:a=r.jsx(f,{}),preloadOnMount:l=!1,preloadOnHover:p=!1,preloadAfterIdle:n,minLoadingTime:m=0,ssrFallback:c,errorFallback:S=L,displayName:P}=t;let b=null,h=!1;const y=async()=>{if(b)return b;const x=Date.now();b=e();const v=await b;if(m>0){const w=Date.now()-x;w<m&&await new Promise(u=>setTimeout(u,m-w))}return h=!0,v},I=o.lazy(y),q=x=>{const v=o.useRef(null);return o.useEffect(()=>{l&&!h&&y()},[]),o.useEffect(()=>{if(n&&!h){const u="requestIdleCallback"in window?window.requestIdleCallback(()=>y(),{timeout:n}):setTimeout(()=>y(),n);return()=>{"cancelIdleCallback"in window?window.cancelIdleCallback(u):clearTimeout(u)}}},[]),o.useEffect(()=>{if(!p||h)return;const u=v.current;if(!u)return;const N=()=>{h||y()};return u.addEventListener("mouseenter",N,{once:!0}),()=>u.removeEventListener("mouseenter",N)},[]),typeof window>"u"&&c?r.jsx(r.Fragment,{children:c}):r.jsx("div",{ref:v,className:"ntd-lazy-wrapper",children:r.jsx(D,{fallback:S,children:r.jsx(o.Suspense,{fallback:a,children:r.jsx(I,{...x})})})})},R=async()=>{h||await y()},k=q;return k.preload=R,k.displayName=P||"LazyComponent",k}function G(e=.1,t="100px"){const a=o.useRef(null),[l,p]=o.useState(!1);return o.useEffect(()=>{if(!a.current||l)return;const n=new IntersectionObserver(([m])=>{m.isIntersecting&&(p(!0),n.disconnect())},{threshold:e,rootMargin:t});return n.observe(a.current),()=>n.disconnect()},[e,t,l]),[a,l]}function V(e,t=2e3){o.useEffect(()=>{if("requestIdleCallback"in window){const a=window.requestIdleCallback(()=>{e.forEach(l=>l())},{timeout:t});return()=>window.cancelIdleCallback(a)}else{const a=setTimeout(()=>{e.forEach(l=>l())},t);return()=>clearTimeout(a)}},[])}function T(e,t){const a=o.useRef(new Set);o.useEffect(()=>{const l=document.querySelectorAll("a[href]"),p=n=>{const c=n.currentTarget.getAttribute("href");c&&e[c]&&!a.current.has(c)&&(e[c](),a.current.add(c))};return l.forEach(n=>{n.addEventListener("mouseenter",p)}),()=>{l.forEach(n=>{n.removeEventListener("mouseenter",p)})}},[t,e])}const z=()=>r.jsx(f,{height:400}),g=()=>r.jsx(f,{height:300}),j=()=>r.jsx(f,{height:500}),E=()=>r.jsx(f,{height:600}),d=e=>e,s={CodeEditor:i(d(()=>Promise.resolve().then(()=>require("./NiceCodeEditor-D0QZW88r.cjs")).then(e=>({default:e.NiceCodeEditor}))),{fallback:r.jsx(z,{}),preloadOnHover:!0,displayName:"LazyCodeEditor"}),HtmlEditor:i(d(()=>Promise.resolve().then(()=>require("./NiceHtmlEditor-C1OVtLQ6.cjs")).then(e=>({default:e.NiceHtmlEditor}))),{fallback:r.jsx(z,{}),preloadOnHover:!0,displayName:"LazyHtmlEditor"}),DocumentViewer:i(d(()=>Promise.resolve().then(()=>require("./NiceDocumentViewer-CDXAmPp7.cjs")).then(e=>({default:e.NiceDocumentViewer}))),{fallback:r.jsx(f,{height:600}),displayName:"LazyDocumentViewer"}),Chart:i(d(()=>Promise.resolve().then(()=>require("./charts-B0tHOpJ7.cjs")).then(e=>e.NiceChart$1).then(e=>({default:e.NiceChart}))),{fallback:r.jsx(g,{}),preloadAfterIdle:3e3,displayName:"LazyChart"}),VectorMap:i(d(()=>Promise.resolve().then(()=>require("./charts-B0tHOpJ7.cjs")).then(e=>e.NiceVectorMap$1).then(e=>({default:e.NiceVectorMap}))),{fallback:r.jsx(f,{height:400}),displayName:"LazyVectorMap"}),Sankey:i(d(()=>Promise.resolve().then(()=>require("./charts-B0tHOpJ7.cjs")).then(e=>e.NiceSankey$1).then(e=>({default:e.NiceSankey}))),{fallback:r.jsx(g,{}),displayName:"LazySankey"}),Scheduler:i(d(()=>Promise.resolve().then(()=>require("./NiceScheduler-DqWEJU7g.cjs")).then(e=>e.NiceScheduler$1).then(e=>({default:e.NiceScheduler}))),{fallback:r.jsx(E,{}),displayName:"LazyScheduler"}),Gantt:i(d(()=>Promise.resolve().then(()=>require("./NiceGantt-BygumlaY.cjs")).then(e=>({default:e.NiceGantt}))),{fallback:r.jsx(E,{}),displayName:"LazyGantt"}),PivotGrid:i(d(()=>Promise.resolve().then(()=>require("./NicePivotGrid-Cnkr9WkC.cjs")).then(e=>e.NicePivotGrid$1).then(e=>({default:e.NicePivotGrid}))),{fallback:r.jsx(j,{}),displayName:"LazyPivotGrid"}),DataGrid:i(d(()=>Promise.resolve().then(()=>require("./NiceDataGrid-CL2_7fS7.cjs")).then(e=>e.NiceDataGrid$1).then(e=>({default:e.NiceDataGrid}))),{fallback:r.jsx(j,{}),preloadAfterIdle:2e3,displayName:"LazyDataGrid"})};async function H(){await Promise.all([s.CodeEditor.preload(),s.HtmlEditor.preload(),s.DocumentViewer.preload(),s.Chart.preload(),s.VectorMap.preload(),s.Sankey.preload(),s.Scheduler.preload(),s.Gantt.preload(),s.PivotGrid.preload()])}async function O(e){await Promise.all(e.map(t=>s[t].preload()))}exports.DefaultErrorFallback=L;exports.DefaultLoadingFallback=f;exports.LazyComponents=s;exports.createLazyComponent=i;exports.preloadAllHeavyComponents=H;exports.preloadComponents=O;exports.useLazyOnVisible=G;exports.usePreloadOnIdle=V;exports.usePreloadOnRouteHint=T;
|
package/dist/data.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./NiceDataGrid-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./NiceDataGrid-CL2_7fS7.cjs"),e=require("./NiceSavedQueryPanel-lTWY2plm.cjs"),r=require("./NicePivotGrid-Cnkr9WkC.cjs");exports.NiceDataGrid=i.NiceDataGrid;exports.applyColumnOrder=i.applyColumnOrder;exports.buildColumnGroupSegments=i.buildColumnGroupSegments;exports.buildGridState=i.buildGridState;exports.computeAggregate=i.computeAggregate;exports.escapeCsvField=i.escapeCsvField;exports.formatNumberPattern=i.formatNumberPattern;exports.measureColumnContentWidth=i.measureColumnContentWidth;exports.readStoredGridState=i.readStoredGridState;exports.writeStoredGridState=i.writeStoredGridState;exports.NiceDataGridAI=e.NiceDataGridAI;exports.NiceKanbanBoard=e.NiceKanbanBoard;exports.NiceList=e.NiceList;exports.NiceModuleGrid=e.NiceModuleGrid;exports.NiceReconciliationView=e.NiceReconciliationView;exports.NiceSavedQueryPanel=e.NiceSavedQueryPanel;exports.NiceSpreadsheet=e.NiceSpreadsheet;exports.NiceTable=e.NiceTable;exports.NiceTileView=e.NiceTileView;exports.NiceTreeGrid=e.NiceTreeGrid;exports.NiceTreeList=e.NiceTreeList;exports.NiceTreeView=e.NiceTreeView;exports.NicePivotGrid=r.NicePivotGrid;exports.NicePivotGridFieldChooser=r.NicePivotGridFieldChooser;
|