@nice2dev/ui 1.4.20 → 1.4.22
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 +90 -0
- package/dist/NiceCodeEditor-CBgbzwjx.cjs +297 -0
- package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
- package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
- package/dist/{NiceMention-DhaTUqvR.cjs → NiceMention-D330ovOt.cjs} +1 -1
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
- package/dist/NiceWindow-DQyf5wat.cjs +1 -0
- package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-CUnBYI-T.cjs} +1 -1
- package/dist/display/NiceDocumentApprovalFlow.mjs +67 -89
- package/dist/display/NiceLeaderboard.mjs +47 -40
- package/dist/display/NiceQuestCard.mjs +93 -76
- package/dist/docs/NiceGantt.doc.json.mjs +9 -9
- package/dist/documentation/utils.mjs +1 -1
- package/dist/editors/rich/NiceCodeEditor.mjs +525 -504
- package/dist/editors.cjs +1 -1
- package/dist/index.cjs +99 -94
- package/dist/index.d.ts +63 -2
- package/dist/index.mjs +778 -776
- package/dist/navigation/NiceMenu.mjs +249 -248
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +6 -0
- package/dist/overlays/NiceResponsiveBox.mjs +51 -24
- package/dist/overlays/NiceTutorial.mjs +136 -127
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.d.ts +25 -2
- package/dist/planning/NiceGantt.mjs +130 -121
- package/dist/planning/NiceStepper.mjs +36 -35
- package/dist/style.css +2 -2
- package/dist/tools/NiceDraggable.mjs +44 -29
- package/dist/tools/NiceGitManager.mjs +5 -0
- package/dist/tools/NiceSortable.mjs +66 -48
- package/dist/tools/NiceSpeechToText.mjs +67 -52
- package/dist/tools/NiceValidationBuilder.mjs +210 -119
- package/dist/tools/NiceViewRegistry.mjs +67 -34
- package/dist/workflow/NiceTaskInbox.mjs +14 -12
- package/package.json +4 -4
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
- package/dist/NiceCodeEditor-DhdjnDLV.cjs +0 -289
- package/dist/NiceGantt-BygumlaY.cjs +0 -1
- package/dist/NiceModuleLifecyclePanel-DAIbzfZd.cjs +0 -1
- package/dist/NiceWindow-BklnkBpu.cjs +0 -1
- package/dist/docs/NiceBottomSheet.doc.json.mjs +0 -32
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),b=require("@nice2dev/ui-core"),t=require("react"),Ie=require("react-dom"),ft=[],ht=({visible:n,onClose:i,title:c,items:o=ft,showCancelButton:d=!0,cancelText:f,size:h="md",disabled:g,readOnly:m,loading:I,error:M,className:y,"data-testid":R,style:p})=>{const{t:N}=b.useNiceTranslation();if(!n)return null;const x=g||I||m;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--${h} ${g?"nice-actionsheet--disabled":""} ${m?"nice-actionsheet--readonly":""} ${I?"nice-actionsheet--loading":""} ${M?"nice-actionsheet--error":""} ${y||""}`,style:p,"data-testid":R,"aria-disabled":g||void 0,"aria-readonly":m||void 0,"aria-busy":I||void 0,children:[M&&e.jsx("div",{className:"nice-actionsheet__error",role:"alert",children:M}),I&&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((l,v)=>e.jsxs("button",{className:`nice-actionsheet__item ${l.type==="danger"?"nice-actionsheet__item--danger":""}`,disabled:l.disabled||x,onClick:()=>{x||(l.onClick?.(),i())},children:[l.icon&&e.jsx("span",{className:"nice-actionsheet__icon",children:l.icon}),l.text]},v))}),d&&e.jsx("button",{className:"nice-actionsheet__cancel",onClick:i,children:f||N("cancel","Cancel")})]})]})},pt=({visible:n,onClose:i,targetRef:c,position:o="bottom",title:d,showArrow:f=!0,width:h,children:g,className:m,"data-testid":I,style:M,displayStyle:y})=>{b.useComponentDisplayClass("tooltip",y);const R=t.useRef(null),[p,N]=t.useState({top:0,left:0}),x=t.useCallback(()=>{const l=c.current,v=R.current;if(!l||!v)return;const a=l.getBoundingClientRect(),T=v.getBoundingClientRect();let u=0,Y=0;const z=8;switch(o){case"top":u=a.top-T.height-z,Y=a.left+(a.width-T.width)/2;break;case"bottom":u=a.bottom+z,Y=a.left+(a.width-T.width)/2;break;case"left":u=a.top+(a.height-T.height)/2,Y=a.left-T.width-z;break;case"right":u=a.top+(a.height-T.height)/2,Y=a.right+z;break}N({top:u+window.scrollY,left:Y+window.scrollX})},[c,o]);return t.useEffect(()=>{if(n){requestAnimationFrame(x);const l=v=>{const a=v.target;(a instanceof Element?a:a?.parentElement??null)?.closest('.nice-select__dropdown, [role="listbox"], [role="option"]')||R.current&&!R.current.contains(a)&&c.current&&!c.current.contains(a)&&i()};return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)}},[n,x,i,c]),b.useOverlayFocus(R,{open:n,modal:!1,onClose:()=>i()}),n?e.jsxs("div",{ref:R,className:`nice-popover nice-popover--${o} ${m||""}`,style:{...M,position:"absolute",top:p.top,left:p.left,width:h},"data-testid":I,role:"dialog","aria-label":d,children:[f&&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:g})]}):null},xt=({visible:n,message:i,container:c,showIndicator:o=!0,shading:d=!0,className:f,"data-testid":h,style:g})=>{const{t:m}=b.useNiceTranslation();if(!n)return null;const I=!!c?.current,M=e.jsxs("div",{className:`nice-loadpanel ${f||""}`,style:g,"data-testid":h,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||m("loading","Loading...")})]})]});if(I&&c.current){const y=c.current;return y.style.position=y.style.position||"relative",M}return M},wt=({direction:n="row",align:i,justify:c,wrap:o,gap:d,flex:f,children:h,className:g,"data-testid":m,style:I})=>e.jsx("div",{"data-testid":m,className:`nice-box ${g||""}`,style:{display:"flex",flexDirection:n,alignItems:i,justifyContent:c,flexWrap:o?"wrap":void 0,gap:d,flex:f,...I},children:h}),gt=[],bt=({direction:n="row",items:i=gt,gap:c,stackBelow:o=480,minItemWidth:d,className:f,"data-testid":h,style:g})=>{const m=t.useRef(null),[I,M]=t.useState(null);t.useEffect(()=>{const p=m.current;if(!p||typeof ResizeObserver>"u")return;const N=new ResizeObserver(([x])=>M(x.contentRect.width));return N.observe(p),()=>N.disconnect()},[]);const y=n==="row"&&o>0&&I!==null&&I<o,R=!y&&n==="row"&&d!=null;return e.jsx("div",{ref:m,"data-testid":h,"data-stacked":y||void 0,className:`nice-responsivebox ${f||""}`,style:{display:"flex",flexDirection:y?"column":n,flexWrap:R?"wrap":void 0,gap:c,...g},children:i.map((p,N)=>e.jsx("div",{style:{flex:y?"0 0 auto":p.ratio??1,flexBasis:y?"auto":p.baseSize??(R?d:void 0),flexShrink:R?0:p.shrink??1,minWidth:R?d:void 0},children:p.children},N))})},_t=({width:n=200,height:i=200,minWidth:c=50,minHeight:o=50,maxWidth:d=1/0,maxHeight:f=1/0,handles:h=["right","bottom","bottomRight"],onResize:g,children:m,className:I,"data-testid":M,style:y})=>{const[R,p]=t.useState({width:n,height:i}),N=t.useRef(null),x=(a,T)=>{T.preventDefault();const u=T.clientX,Y=T.clientY,z=R.width,X=R.height,_={n:"top",s:"bottom",e:"right",w:"left",ne:"topRight",se:"bottomRight",sw:"bottomLeft",nw:"topLeft"}[a]??a,S=_==="right"||_==="topRight"||_==="bottomRight",k=_==="left"||_==="topLeft"||_==="bottomLeft",s=_==="bottom"||_==="bottomRight"||_==="bottomLeft",j=_==="top"||_==="topRight"||_==="topLeft",C=P=>{const A=P.clientX-u,W=P.clientY-Y;let G=z,w=X;S&&(G=z+A),k&&(G=z-A),s&&(w=X+W),j&&(w=X-W),G=Math.max(c,Math.min(d,G)),w=Math.max(o,Math.min(f,w)),p({width:G,height:w}),g?.({width:G,height:w})},E=()=>{document.removeEventListener("pointermove",C),document.removeEventListener("pointerup",E)};document.addEventListener("pointermove",C),document.addEventListener("pointerup",E)},l=a=>{switch(a){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"}},v=a=>{const T={position:"absolute",zIndex:1},u=8;return a==="right"?{...T,top:0,right:-u/2,width:u,height:"100%",cursor:l(a)}:a==="bottom"?{...T,left:0,bottom:-u/2,width:"100%",height:u,cursor:l(a)}:a==="left"?{...T,top:0,left:-u/2,width:u,height:"100%",cursor:l(a)}:a==="top"?{...T,top:-u/2,left:0,width:"100%",height:u,cursor:l(a)}:a==="bottomRight"?{...T,bottom:-u/2,right:-u/2,width:u*2,height:u*2,cursor:l(a)}:a==="bottomLeft"?{...T,bottom:-u/2,left:-u/2,width:u*2,height:u*2,cursor:l(a)}:a==="topRight"?{...T,top:-u/2,right:-u/2,width:u*2,height:u*2,cursor:l(a)}:a==="topLeft"?{...T,top:-u/2,left:-u/2,width:u*2,height:u*2,cursor:l(a)}:T};return e.jsxs("div",{ref:N,"data-testid":M,className:`nice-resizable ${I||""}`,style:{...y,width:R.width,height:R.height,position:"relative",overflow:"hidden"},children:[m,h.map(a=>e.jsx("div",{style:v(a),onPointerDown:T=>x(a,T)},a))]})},vt=({direction:n="vertical",showScrollbar:i="onInteraction",width:c,height:o,onScroll:d,children:f,className:h,"data-testid":g,style:m})=>{const I=n==="horizontal"||n==="both"?"auto":"hidden",M=n==="vertical"||n==="both"?"auto":"hidden",y=i==="never"?"nice-scrollview--hide-sb":i==="always"?"nice-scrollview--show-sb":"";return e.jsx("div",{"data-testid":g,className:`nice-scrollview ${y} ${h||""}`,style:{...m,width:c,height:o,overflowX:I,overflowY:M},onScroll:d,children:f})},yt=[];function Re(){const n=t.useContext(b.NiceThemeContext);return n?.portalTarget?n.portalTarget:typeof document<"u"?document.body:null}const Nt=({open:n,onClose:i,children:c,title:o,size:d="md",closeOnBackdropClick:f=!0,closeOnEscape:h=!0,disableFocusTrap:g=!1,disableBodyScroll:m=!0,zIndex:I=1e3,className:M,style:y})=>{const R=t.useRef(null);b.useOverlayFocus(R,{open:n,modal:!g,onClose:i,closeOnEscape:h});const p=Re();t.useEffect(()=>{if(!m&&n){const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}}},[n,m]);const N=t.useCallback(l=>{f&&l.target===l.currentTarget&&i()},[f,i]);if(!n)return null;const x={sm:"nice-modal--sm",md:"nice-modal--md",lg:"nice-modal--lg",xl:"nice-modal--xl",full:"nice-modal--full"}[d];return Ie.createPortal(e.jsx("div",{className:"nice-modal__overlay",style:{zIndex:I},onClick:N,role:"presentation",children:e.jsx("div",{ref:R,className:`nice-modal ${x} ${M||""}`,role:"dialog","aria-modal":"true","aria-label":o,style:y,tabIndex:-1,children:c})}),p)},kt=({children:n,showClose:i=!0,onClose:c,className:o})=>{const{t:d}=b.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(b.NiceIcon,{name:"close",size:20})})]})},jt=({children:n,className:i})=>e.jsx("div",{className:`nice-modal__body ${i||""}`,children:n}),Ct=({children:n,className:i})=>e.jsx("div",{className:`nice-modal__footer ${i||""}`,children:n}),Et=({open:n,onClose:i,children:c,position:o="right",size:d=320,title:f,closeOnBackdropClick:h=!0,closeOnEscape:g=!0,swipeToClose:m=!0,zIndex:I=1e3,className:M,style:y})=>{const R=t.useRef(null),[p,N]=t.useState(!1),[x,l]=t.useState(0);b.useOverlayFocus(R,{open:n,onClose:i,closeOnEscape:g});const v=Re(),a=t.useCallback(_=>{let S=0;switch(o){case"left":S=Math.min(0,_.deltaX);break;case"right":S=Math.max(0,_.deltaX);break;case"top":S=Math.min(0,_.deltaY);break;case"bottom":S=Math.max(0,_.deltaY);break}l(S)},[o]),T=t.useCallback(_=>{let k=!1;switch(o){case"left":k=_.deltaX<-100;break;case"right":k=_.deltaX>100;break;case"top":k=_.deltaY<-100;break;case"bottom":k=_.deltaY>100;break}k&&(b.triggerHaptic("light"),i()),l(0),N(!1)},[o,i]),{ref:u}=b.usePan({enabled:m&&n,onPanStart:()=>N(!0),onPan:a,onPanEnd:T}),Y=t.useCallback(_=>{h&&_.target===_.currentTarget&&i()},[h,i]);if(!n)return null;const z=o==="left"||o==="right",X=z?{width:typeof d=="number"?`${d}px`:d}:{height:typeof d=="number"?`${d}px`:d},$=()=>{if(p)return z?`translateX(${x}px)`:`translateY(${x}px)`};return Ie.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"presentation",className:`nice-drawer__overlay ${n?"nice-drawer__overlay--visible":""}`,style:{zIndex:I},onClick:Y}),e.jsx("div",{ref:_=>{R.current=_,u.current=_},className:`nice-drawer nice-drawer--${o} ${n?"nice-drawer--open":""} ${M||""}`,style:{...X,zIndex:I+1,transform:$(),transition:p?"none":void 0,...y},role:"dialog","aria-modal":"true","aria-label":f,tabIndex:-1,children:c})]}),v)},It=({open:n,onClose:i,children:c,title:o,showHandle:d=!0,snapPoints:f=[.5,.9],initialSnap:h=0,expandable:g=!0,closeOnBackdropClick:m=!0,closeOnEscape:I=!0,hapticFeedback:M=!0,zIndex:y=1e3,className:R,style:p})=>{const N=t.useRef(null),x=t.useRef(null),[l,v]=t.useState(h),[a,T]=t.useState(!1),[u,Y]=t.useState(0),z=t.useRef(0);t.useEffect(()=>{n&&(v(h),Y(0))},[n,h]),b.useOverlayFocus(N,{open:n,onClose:i,closeOnEscape:I});const X=Re();t.useEffect(()=>{if(n){const C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C}}},[n]);const $=t.useCallback(C=>{const E=C.target.closest(".nice-bottom-sheet__handle"),P=x.current,A=!P||P.scrollTop<=0;!E&&!A||(T(!0),z.current=C.touches[0].clientY)},[]),_=t.useCallback(C=>{if(!a)return;const E=C.touches[0].clientY-z.current;(E>0||l<f.length-1)&&Y(E)},[a,l,f.length]),S=t.useCallback(()=>{if(!a)return;const C=window.innerHeight;f[l]*C;const E=-u,P=C*.15;E>P&&g&&l<f.length-1?(v(l+1),M&&b.triggerHaptic("selection")):E<-P&&(l>0?(v(l-1),M&&b.triggerHaptic("selection")):(M&&b.triggerHaptic("light"),i())),T(!1),Y(0)},[a,u,l,f,g,M,i]),k=t.useCallback(()=>{m&&i()},[m,i]);if(!n)return null;const s=f[l]*100,j=a?u:0;return Ie.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{role:"presentation",className:`nice-bottom-sheet__overlay ${n?"nice-bottom-sheet__overlay--visible":""}`,style:{zIndex:y},onClick:k}),e.jsxs("div",{ref:N,className:`nice-bottom-sheet ${n?"nice-bottom-sheet--open":""} ${R||""}`,style:{zIndex:y+1,height:`${s}vh`,transform:`translateY(${Math.max(0,j)}px)`,transition:a?"none":"transform 0.3s ease-out, height 0.3s ease-out",...p},role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,onTouchStart:$,onTouchMove:_,onTouchEnd:S,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:x,className:"nice-bottom-sheet__content",children:c})]})]}),X)},Rt=({trigger:n,children:i,placement:c="bottom",triggerMode:o="click",open:d,onOpenChange:f,hoverDelay:h=200,offset:g=8,className:m,showArrow:I=!0})=>{const[M,y]=t.useState(!1),R=t.useRef(null),p=t.useRef(null),N=t.useRef(null),x=Re(),l=d!==void 0,v=l?d:M,a=t.useCallback(k=>{l||y(k),f?.(k)},[l,f]);b.useClickOutside(p,()=>{o!=="manual"&&v&&a(!1)});const T=o!=="hover";b.useOverlayFocus(p,{open:v&&T,modal:!1,onClose:()=>a(!1)});const u=t.useCallback(()=>{o==="click"&&a(!v)},[o,v,a]),Y=t.useCallback(()=>{o==="hover"&&(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>a(!0),h))},[o,h,a]),z=t.useCallback(()=>{o==="hover"&&(N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>a(!1),h))},[o,h,a]),X=t.useCallback(k=>{const s=k.relatedTarget;!R.current?.contains(s)&&!p.current?.contains(s)&&z()},[z]),$=t.useCallback(k=>{o==="hover"&&v&&k.key==="Escape"&&(k.preventDefault(),k.stopPropagation(),N.current&&window.clearTimeout(N.current),a(!1))},[o,v,a]),[_,S]=t.useState({top:0,left:0});return t.useEffect(()=>{if(!v||!R.current||!p.current)return;const k=R.current.getBoundingClientRect(),s=p.current.getBoundingClientRect(),j=window.innerWidth,C=window.innerHeight;let E=0,P=0;const[A,W="center"]=c.split("-");switch(A){case"top":E=k.top-s.height-g,P=k.left+(k.width-s.width)/2;break;case"bottom":E=k.bottom+g,P=k.left+(k.width-s.width)/2;break;case"left":E=k.top+(k.height-s.height)/2,P=k.left-s.width-g;break;case"right":E=k.top+(k.height-s.height)/2,P=k.right+g;break}A==="top"||A==="bottom"?(W==="start"&&(P=k.left),W==="end"&&(P=k.right-s.width)):(W==="start"&&(E=k.top),W==="end"&&(E=k.bottom-s.height)),P=Math.max(8,Math.min(j-s.width-8,P)),E=Math.max(8,Math.min(C-s.height-8,E)),S({top:E,left:P})},[v,c,g]),e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:R,className:"nice-popover__trigger",onClick:u,onMouseEnter:Y,onMouseLeave:z,onFocus:Y,onBlur:X,onKeyDown:$,style:{display:"inline-block"},children:n}),v&&Ie.createPortal(e.jsxs("div",{ref:p,className:`nice-popover nice-popover--${c} ${m||""}`,style:{position:"fixed",top:_.top,left:_.left,zIndex:1100},onMouseEnter:Y,onMouseLeave:z,role:T?"dialog":"tooltip",children:[I&&e.jsx("div",{className:"nice-popover__arrow"}),e.jsx("div",{className:"nice-popover__content",children:i})]}),x)]})},Tt=({items:n=yt,children:i,onOpen:c,onClose:o,className:d})=>{const[f,h]=t.useState(!1),[g,m]=t.useState({x:0,y:0}),I=t.useRef(null),M=t.useRef(null),y=Re();b.useClickOutside(I,()=>{f&&(h(!1),o?.())});const R=t.useCallback(l=>{if(l.preventDefault(),l.clientX===0&&l.clientY===0&&l.target instanceof Element){const v=l.target.getBoundingClientRect();m({x:v.left,y:v.bottom})}else m({x:l.clientX,y:l.clientY});h(!0),c?.()},[c]),p=t.useCallback(()=>{h(!1),o?.()},[o]),N=t.useCallback(l=>{!l.disabled&&l.onClick&&(l.onClick(),p())},[p]);b.useOverlayFocus(I,{open:f,modal:!1,onClose:p}),b.useRovingFocus(I,{orientation:"vertical",wrap:!0,typeahead:!0});const x=l=>e.jsx("ul",{className:"nice-context-menu__list",role:"menu",children:l.map(v=>v.divider?e.jsx("li",{className:"nice-context-menu__divider",role:"separator"},v.key):e.jsx("li",{role:"presentation",children:e.jsxs("button",{type:"button",className:`nice-context-menu__item ${v.disabled?"nice-context-menu__item--disabled":""} ${v.danger?"nice-context-menu__item--danger":""}`,role:"menuitem",disabled:v.disabled,onClick:()=>N(v),children:[v.icon&&e.jsx("span",{className:"nice-context-menu__icon",children:v.icon}),e.jsx("span",{className:"nice-context-menu__label",children:v.label})]})},v.key))});return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:M,onContextMenu:R,style:{display:"contents"},children:i}),f&&Ie.createPortal(e.jsx("div",{ref:I,className:`nice-context-menu ${d||""}`,style:{position:"fixed",left:g.x,top:g.y,zIndex:1200},children:x(n)}),y)]})};function Fe(n,i){if(!n)return{score:1,indices:[]};const c=n.toLowerCase(),o=i.toLowerCase();let d=0;const f=[];let h=0,g=-1;for(let m=0;m<o.length&&d<c.length;m++)o[m]===c[d]&&(f.push(m),g===m-1&&(h+=3),(m===0||/[\s\-_/.]/.test(i[m-1]))&&(h+=5),i[m]===n[d]&&(h+=1),h+=1,g=m,d++);return d<c.length?null:(h-=f[0]*.1,{score:h,indices:f})}function Qe(n,i){if(i.length===0)return[n];const c=[];let o=0;const d=new Set(i);for(let f=0;f<n.length;f++)d.has(f)&&(o<f&&c.push(n.slice(o,f)),c.push(t.createElement("mark",{key:`m-${f}`,className:"nice-command-palette__match"},n[f])),o=f+1);return o<n.length&&c.push(n.slice(o)),c}function Mt(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 Ze=t.createContext(null);function Je(){const n=t.useContext(Ze);if(!n)throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");return n}const et=({children:n,commands:i,placeholder:c,maxVisible:o=10,maxRecent:d=5,className:f,emptyText:h,closeOnAction:g=!0,onOpen:m,onClose:I,includeActions:M=!0})=>{const{t:y}=b.useNiceTranslation(),R=b.useNiceActions(),p=y("commandPalette.general","General"),N=Re(),[x,l]=t.useReducer(Mt,{commands:new Map(i?.map(w=>[w.id,w])??[]),isOpen:!1,query:"",selectedIndex:0,recentIds:[]}),v=t.useRef(null),a=t.useRef(null),[T,u]=t.useState(!1),Y=t.useCallback(w=>{l({type:"REGISTER",command:w})},[]),z=t.useCallback(w=>{l({type:"UNREGISTER",id:w})},[]),X=t.useCallback(w=>{l({type:"REGISTER_BATCH",commands:w})},[]),$=t.useCallback(()=>{l({type:"OPEN"}),m?.()},[m]),_=t.useCallback(()=>{l({type:"CLOSE"}),I?.()},[I]),S=t.useCallback(()=>{x.isOpen?_():$()},[x.isOpen,_,$]),k=t.useMemo(()=>{const w=new Map(x.commands);if(M)for(const L of R){const r=`action:${L.id}`;L.palette===!1||w.has(r)||w.set(r,{id:r,label:L.label,description:L.description,category:L.group,shortcut:typeof L.keyboard=="string"?L.keyboard:L.keyboard?.[0],disabled:L.when?!L.when():!1,action:()=>{b.triggerNiceAction(L.id,"keyboard")}})}return w},[x.commands,R,M,x.isOpen]),j=t.useMemo(()=>{const w=Array.from(k.values()).filter(r=>!r.hidden);if(!x.query.trim()){const r=x.recentIds.map(H=>k.get(H)).filter(H=>!!H&&!H.hidden),B=w.filter(H=>!x.recentIds.includes(H.id));return B.sort((H,te)=>H.label.localeCompare(te.label)),[...r,...B].map(H=>({command:H,match:null,isRecent:x.recentIds.includes(H.id)}))}return w.map(r=>{const B=Fe(x.query,r.label),H=r.description?Fe(x.query,r.description):null,te=r.keywords?.map(ne=>Fe(x.query,ne)).filter(Boolean)[0]??null,oe=[B,H,te].filter(Boolean).sort((ne,ie)=>(ie?.score??0)-(ne?.score??0))[0]??null;return{command:r,match:oe,isRecent:!1}}).filter(r=>r.match!==null).sort((r,B)=>(B.match?.score??0)-(r.match?.score??0))},[k,x.query,x.recentIds]).slice(0,o),C=t.useCallback(async w=>{const L=k.get(w);if(!(!L||L.disabled)){u(!0);try{await L.action(),l({type:"ADD_RECENT",id:w,maxRecent:d})}finally{u(!1),g&&_()}}},[k,d,g,_]);b.useIntent("menu",()=>S());const E=t.useRef(null);b.useOverlayFocus(E,{open:x.isOpen,onClose:_,initialFocus:v}),b.useIntent(["navigate","activate"],w=>{const L=j.length;if(w.intent==="activate"){const B=j[x.selectedIndex];return B&&C(B.command.id),!0}if(!L||w.direction!=="up"&&w.direction!=="down")return!1;const r=w.direction==="down"?1:-1;return l({type:"SET_SELECTED",index:(x.selectedIndex+r+L)%L}),!0},{ref:E,enabled:x.isOpen}),b.useInputHints(E,x.isOpen?[{intent:"navigate",label:y("commandPalette.choose","Choose")},{intent:"activate",label:y("commandPalette.run","Run")},{intent:"back",label:y("input.hint.close","Close")}]:[]);const P=t.useCallback(w=>{const L=j.length;if(L){if(w.key==="ArrowDown")w.preventDefault(),l({type:"SET_SELECTED",index:(x.selectedIndex+1)%L});else if(w.key==="ArrowUp")w.preventDefault(),l({type:"SET_SELECTED",index:(x.selectedIndex-1+L)%L});else if(w.key==="Enter"){w.preventDefault();const r=j[x.selectedIndex];r&&C(r.command.id)}}},[j,x.selectedIndex,C]);t.useEffect(()=>{if(!a.current)return;a.current.children[x.selectedIndex]?.scrollIntoView?.({block:"nearest"})},[x.selectedIndex]);const A=t.useMemo(()=>({registerCommand:Y,unregisterCommand:z,registerCommands:X,open:$,close:_,toggle:S,isOpen:x.isOpen,executeCommand:C}),[Y,z,X,$,_,S,x.isOpen,C]),W=t.useMemo(()=>{const w=new Map;for(const L of j){const r=L.command.category??p;w.has(r)||w.set(r,[]),w.get(r).push(L)}return w},[j,p]);let G=0;return e.jsxs(Ze.Provider,{value:A,children:[n,x.isOpen&&Ie.createPortal(e.jsx("div",{className:`nice-command-palette__overlay ${f??""}`,role:"presentation",onClick:w=>{w.stopPropagation(),w.target===w.currentTarget&&_()},children:e.jsxs("div",{ref:E,className:"nice-command-palette",role:"dialog","aria-label":y("commandPalette.title","Command palette"),"aria-modal":"true",children:[e.jsx("div",{className:"nice-command-palette__input-wrapper",children:e.jsx("input",{ref:v,className:"nice-command-palette__input",type:"text",placeholder:c??y("commandPalette.placeholder","Type a command..."),value:x.query,onChange:w=>l({type:"SET_QUERY",query:w.target.value}),onKeyDown:P,"aria-label":y("commandPalette.search","Search commands"),"aria-autocomplete":"list","aria-controls":"nice-command-palette-list","aria-activedescendant":j[x.selectedIndex]?`nice-cmd-${j[x.selectedIndex].command.id}`:void 0})}),e.jsxs("div",{ref:a,id:"nice-command-palette-list",className:"nice-command-palette__list",role:"listbox",children:[j.length===0&&e.jsx("div",{className:"nice-command-palette__empty",children:h??y("commandPalette.empty","No commands found")}),Array.from(W.entries()).map(([w,L])=>e.jsxs("div",{className:"nice-command-palette__group",children:[e.jsx("div",{className:"nice-command-palette__category",children:w}),L.map(r=>{const B=G++,H=B===x.selectedIndex;return e.jsxs("div",{id:`nice-cmd-${r.command.id}`,className:`nice-command-palette__item ${H?"nice-command-palette__item--selected":""} ${r.command.disabled?"nice-command-palette__item--disabled":""}`,role:"option","aria-selected":H,"aria-disabled":r.command.disabled,onClick:()=>!r.command.disabled&&C(r.command.id),onMouseEnter:()=>l({type:"SET_SELECTED",index:B}),children:[r.command.icon&&e.jsx("span",{className:"nice-command-palette__icon",children:r.command.icon}),e.jsxs("div",{className:"nice-command-palette__label-group",children:[e.jsx("span",{className:"nice-command-palette__label",children:r.match&&x.query?Qe(r.command.label,r.match.indices):r.command.label}),r.command.description&&e.jsx("span",{className:"nice-command-palette__description",children:r.command.description})]}),r.command.shortcut&&e.jsx("kbd",{className:"nice-command-palette__shortcut",children:r.command.shortcut}),r.isRecent&&e.jsx("span",{className:"nice-command-palette__recent-badge",children:y("commandPalette.recent","Recent")})]},r.command.id)})]},w))]}),T&&e.jsx("div",{className:"nice-command-palette__executing",children:y("commandPalette.executing","Executing...")})]})}),N)]})};process.env.NODE_ENV!=="production"&&(et.displayName="NiceCommandPaletteProvider");function zt(n){const{registerCommands:i,unregisterCommand:c}=Je();t.useEffect(()=>(i(n),()=>{for(const o of n)c(o.id)}),[])}const St=Object.assign(t.forwardRef(({blocked:n,message:i,spinner:c,blur:o,children:d,className:f,"data-testid":h,style:g,id:m},I)=>{const M=b.useControlId(m);return e.jsxs("div",{ref:I,id:M,className:`nice-block-ui ${f||""}`,style:{position:"relative",...g},"data-testid":h,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"}),$t=Object.assign(t.forwardRef(({windows:n,children:i,onChange:c,onClose:o,onFocus:d,showTaskbar:f=!0,size:h="md",className:g,style:m,id:I,...M},y)=>{const R=b.useControlId(I),{t:p}=b.useNiceTranslation(),[N,x]=t.useState(null),l=t.useRef(null),v=t.useRef(null);b.useRovingFocus(v,{orientation:"horizontal",itemSelector:".nice-wm__taskbar-btn"});const a=t.useRef(null),T=t.useCallback(s=>{const j=[...l.current?.querySelectorAll("[data-wm-key]")??[]].find(C=>C.getAttribute("data-wm-key")===s);return j?((b.focusCandidates(j)[0]??j).focus(),!0):!1},[]);t.useEffect(()=>{const s=a.current;s&&T(s)&&(a.current=null)});const u=t.useMemo(()=>n??[],[n]),Y=Math.max(1,...u.map(s=>s.zIndex??1)),z=t.useCallback((s,j)=>{const C=u.map(E=>E.key===s?{...E,...j}:E);c?.(C)},[u,c]),X=t.useCallback(s=>{z(s,{zIndex:Y+1}),d?.(s)},[z,Y,d]),$=t.useCallback(s=>{o?.(s),c?.(u.filter(j=>j.key!==s))},[u,c,o]),_=t.useCallback(s=>{const j=u.find(C=>C.key===s);j&&z(s,{minimized:!j.minimized,maximized:!1})},[u,z]),S=t.useCallback(s=>{const j=u.find(C=>C.key===s);j&&z(s,{maximized:!j.maximized,minimized:!1})},[u,z]);t.useEffect(()=>{if(!N)return;const s=C=>{const E=u.find(P=>P.key===N.key);if(E)if(N.mode==="move")z(N.key,{x:C.clientX-N.offsetX,y:C.clientY-N.offsetY});else{const A=l.current?.getBoundingClientRect(),W=A?.left??0,G=A?.top??0;z(N.key,{width:Math.max(200,C.clientX-W-E.x),height:Math.max(100,C.clientY-G-E.y)})}},j=()=>x(null);return document.addEventListener("mousemove",s),document.addEventListener("mouseup",j),()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",j)}},[N,u,z]);const k=t.useCallback((s,j,C)=>{j.preventDefault();const E=u.find(P=>P.key===s);E&&(X(s),x({key:s,offsetX:C==="move"?j.clientX-E.x:0,offsetY:C==="move"?j.clientY-E.y:0,mode:C}))},[u,X]);return e.jsxs("div",{ref:s=>{l.current=s,typeof y=="function"?y(s):y&&(y.current=s)},id:R,className:`nice-wm nice-wm--${h} ${g??""}`,style:{...m,position:"relative",overflow:"hidden"},...M,children:[u.map(s=>{if(s.minimized)return null;const j=s.maximized,C=j?{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 ${j?"nice-wm__window--maximized":""}`,style:C,onMouseDown:()=>X(s.key),onFocus:()=>{(s.zIndex??1)<Y&&X(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:E=>!j&&k(s.key,E,"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:()=>_(s.key),title:p("wm.minimize","Minimize"),children:e.jsx(b.NiceIcon,{name:"minus",size:14})}),(s.maximizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--max",onClick:()=>S(s.key),title:p("wm.maximize","Maximize"),children:e.jsx(b.NiceIcon,{name:j?"copy":"window",size:14})}),(s.closable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--close",onClick:()=>$(s.key),title:p("wm.close","Close"),children:e.jsx(b.NiceIcon,{name:"close",size:14})})]})]}),e.jsx("div",{className:"nice-wm__body",children:s.content}),(s.resizable??!0)&&!j&&e.jsx("div",{className:"nice-wm__resize-handle",onMouseDown:E=>k(s.key,E,"resize")})]},s.key)}),n===void 0&&i,f&&e.jsx("div",{ref:v,className:"nice-wm__taskbar",role:"toolbar","aria-label":p("wm.taskbar","Taskbar"),"data-nice-region":p("wm.taskbar","Taskbar"),children:u.map(s=>e.jsxs("button",{type:"button",className:`nice-wm__taskbar-btn ${s.minimized?"nice-wm__taskbar-btn--minimized":""}`,onClick:()=>{s.minimized&&_(s.key),X(s.key),(s.minimized||!T(s.key))&&(a.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 Pt(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 Lt(n,i,c,o){const f={w:window.innerWidth,h:window.innerHeight+window.scrollY},h={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{...h[o],actualPlacement:o};for(const g of["bottom","top","right","left"]){const m=h[g];if(m.top>=0&&m.left>=0&&m.top+c<=f.h&&m.left+i<=f.w)return{...m,actualPlacement:g}}return{...h.bottom,actualPlacement:"bottom"}}function Ot(){return e.jsx(b.NiceIcon,{name:"close",size:16})}function Yt(){return e.jsx(b.NiceIcon,{name:"chevron-left",size:16})}function Dt(){return e.jsx(b.NiceIcon,{name:"chevron-right",size:16})}function Ft(){return e.jsx(b.NiceIcon,{name:"skip-forward",size:16})}function Ht(){return e.jsx(b.NiceIcon,{name:"play",size:16})}function Xt(){return e.jsx(b.NiceIcon,{name:"pause",size:16})}function De(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=[],Ue=({steps:n=Bt,active:i,onFinish:c,onSkip:o,onStepChange:d,closeOnEscape:f=!0,closeOnOverlayClick:h=!1,showProgress:g=!0,showSkipButton:m=!0,showBackButton:I=!0,showCloseButton:M,showProgressBar:y,showSpeedControl:R=!0,labels:p,animationDuration:N=300,overlayOpacity:x=.6,zIndex:l=1e4,buttonsPlacement:v="floating-bottom",buttonsDisplay:a="icon",showAutoplay:T=!0,autoplayInterval:u=5e3,autoplaySpeedRange:Y={min:2e3,max:15e3},onAutoplayChange:z})=>{const{t:X}=b.useNiceTranslation(),[$,_]=t.useState(0),[S,k]=t.useState(null),[s,j]=t.useState({w:340,h:200}),[C,E]=t.useState(!0),[P,A]=t.useState(!1),[W,G]=t.useState(u),w=t.useRef(null),L=t.useRef(-1),r=n[$],B=$===n.length-1,H=$===0,te=p?.next??"Next",oe=p?.back??"Back",ne=p?.finish??"Finish",ie=p?.skip??"Skip",Te=p?.stepOf??"of",Ne=p?.play??"Play",ke=p?.pause??"Pause",$e=p?.speed??"Speed",Pe=p?.close??"Close";t.useEffect(()=>{i&&(_(0),A(!1),G(u))},[i,u]),t.useEffect(()=>{if(w.current){const O=w.current.getBoundingClientRect();j({w:O.width,h:O.height})}},[$,i]),t.useEffect(()=>{if(!i||!r)return;const O=r.highlightPadding??0,q=()=>{const F=Pt(r.target,O);k(F)};if(q(),r.scrollIntoView!==!1){document.querySelector(r.target)?.scrollIntoView({behavior:"smooth",block:"center"});const be=setTimeout(q,350);return()=>clearTimeout(be)}},[i,r,$]),t.useEffect(()=>{!i||!r||L.current!==$&&(L.current>=0&&L.current<n.length&&n[L.current]?.onLeave?.(),r.onEnter?.(),L.current=$)},[i,r,$,n]);const K=t.useCallback(()=>{if(B)r?.onLeave?.(),c?.();else{const O=$+1;_(O),d?.(O)}},[$,B,c,d,r]),ce=t.useCallback(()=>{if(!H){const O=$-1;_(O),d?.(O)}},[$,H,d]),U=t.useCallback(O=>{O!==$&&O>=0&&O<n.length&&(_(O),d?.(O))},[$,n.length,d]);t.useEffect(()=>{if(!i||!r?.advanceOn)return;const O=document.querySelector(r.target);if(!O)return;const q=()=>K();return O.addEventListener(r.advanceOn.event,q),()=>O.removeEventListener(r.advanceOn.event,q)},[i,r,$,K]);const xe=t.useRef(null),ae=!!(i&&r);b.useOverlayFocus(xe,{open:ae,modal:!(r?.waitForAction||r?.advanceOn),onClose:()=>o?.(),closeOnEscape:f,closeHint:ie}),t.useEffect(()=>{const O=xe.current;if(!ae||!O)return;const q=F=>{if(!(F.defaultPrevented||F.target instanceof HTMLInputElement)){if(F.key==="ArrowRight")K();else if(F.key==="ArrowLeft")ce();else if(F.key==="Home"||F.key==="End")U(F.key==="Home"?0:n.length-1);else return;F.preventDefault()}};return O.addEventListener("keydown",q),()=>O.removeEventListener("keydown",q)},[ae,K,ce,U,n.length]);const we=b.useInputEngine(),se=ae?r?.title:void 0;t.useEffect(()=>{se&&$>0&&we?.announce(se)},[we,se,$]);const le=t.useId(),ge=`${le}-content`;b.useIntent(["sectionPrev","sectionNext"],O=>{if(O.intent==="sectionNext"){if(r?.waitForAction)return!1;K()}else ce()},{ref:xe,enabled:ae}),b.useInputHints(xe,ae?[...H?[]:[{intent:"sectionPrev",label:oe}],...r?.waitForAction?[]:[{intent:"sectionNext",label:B?ne:te}]]:[]),t.useEffect(()=>{E(!0);const O=setTimeout(()=>E(!1),N);return()=>clearTimeout(O)},[$,N]),t.useEffect(()=>{if(!i||!P)return;const O=setInterval(()=>{_(q=>{if(q>=n.length-1)return A(!1),z?.(!1),n[q]?.onLeave?.(),c?.(),q;const F=q+1;return d?.(F),F})},Math.max(500,W));return()=>clearInterval(O)},[i,P,W,n,z,c,d]);const Le=t.useCallback(()=>{A(O=>{const q=!O;return z?.(q),q})},[z]),je=t.useMemo(()=>S?Lt(S,s.w,s.h,r?.placement):{top:typeof window<"u"?window.innerHeight/2:0,left:typeof window<"u"?window.innerWidth/2:0,actualPlacement:"bottom"},[S,s,r?.placement]),Me=n.length===0?0:($+1)/n.length*100,Oe=t.useCallback(O=>{const q=T&&n.length>1,F=(y??T)&&n.length>1,be=m&&!B&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--skip nice-tutorial__btn--${a}`,onClick:o,"aria-label":ie,title:ie,children:De(e.jsx(Ft,{}),ie,a)}),Be=I&&!H&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--back nice-tutorial__btn--${a}`,onClick:ce,"aria-label":oe,title:oe,children:De(e.jsx(Yt,{}),oe,a)}),J=!r?.waitForAction&&e.jsx("button",{type:"button",className:`nice-tutorial__btn nice-tutorial__btn--next nice-tutorial__btn--${a}`,onClick:K,"aria-label":B?ne:te,title:B?ne:te,children:De(e.jsx(Dt,{}),B?ne:te,a)}),Q=q&&e.jsx("button",{type:"button",className:["nice-tutorial__btn","nice-tutorial__btn--play",`nice-tutorial__btn--${a}`,P?"nice-tutorial__btn--active":""].filter(Boolean).join(" "),onClick:Le,"aria-label":P?ke:Ne,title:P?ke:Ne,"aria-pressed":P,children:De(P?e.jsx(Xt,{}):e.jsx(Ht,{}),P?ke:Ne,a)});return e.jsxs("div",{className:["nice-tutorial__controls",O?"nice-tutorial__controls--inline":"nice-tutorial__controls--floating-bottom"].join(" "),style:O?void 0:{zIndex:l+2},role:"group","aria-label":X("tutorial.tutorialControls","Tutorial controls"),children:[be,Be,g&&e.jsxs("span",{className:"nice-tutorial__step-label","aria-live":"polite",children:[$+1," ",Te," ",n.length]}),J,F&&e.jsx("div",{className:"nice-tutorial__progress-bar",role:"progressbar","aria-valuenow":Math.round(Me),"aria-valuemin":0,"aria-valuemax":100,"aria-label":`${$+1} ${Te} ${n.length}`,children:e.jsx("div",{className:"nice-tutorial__progress-bar-fill",style:{width:`${Me}%`}})}),Q,q&&R&&e.jsxs("label",{className:"nice-tutorial__speed",children:[e.jsx("input",{type:"range",className:"nice-tutorial__speed-slider",min:Y.min,max:Y.max,step:500,value:Y.min+Y.max-W,onChange:_e=>G(Y.min+Y.max-Number(_e.target.value)),"aria-label":$e}),e.jsxs("span",{className:"nice-tutorial__speed-value",children:[(W/1e3).toFixed(1),"s"]})]})]})},[T,m,g,I,y,R,a,H,B,o,ie,oe,te,ne,Ne,ke,$e,Te,ce,K,r,P,Le,$,n.length,Me,W,Y,l,X]);if(!i||!r)return null;const He=typeof document<"u"?Math.max(document.documentElement.scrollWidth,window.innerWidth):0,Xe=typeof document<"u"?Math.max(document.documentElement.scrollHeight,window.innerHeight):0;return e.jsxs("div",{ref:xe,className:"nice-tutorial",style:{zIndex:l},"aria-modal":r.waitForAction||r.advanceOn?void 0:!0,role:"dialog","aria-label":r.title?void 0:X("tutorial.tutorial","Tutorial"),"aria-labelledby":r.title?le:void 0,"aria-describedby":r.content?ge:void 0,children:[e.jsxs("svg",{className:"nice-tutorial__overlay",style:{position:"absolute",top:0,left:0,width:He,height:Xe,pointerEvents:"auto"},onClick:h?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"}),S&&e.jsx("rect",{x:S.left,y:S.top,width:S.width,height:S.height,rx:"4",fill:"black",className:C?"nice-tutorial__spotlight--entering":""})]})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`rgba(0,0,0,${x})`,mask:"url(#nice-tutorial-mask)"})]}),S&&e.jsx("div",{className:`nice-tutorial__highlight ${C?"nice-tutorial__highlight--entering":""}`,style:{position:"absolute",top:S.top,left:S.left,width:S.width,height:S.height,transition:`all ${N}ms ease`}}),r.disableInteraction&&S&&e.jsx("div",{className:"nice-tutorial__blocker",style:{position:"absolute",top:S.top,left:S.left,width:S.width,height:S.height}}),e.jsxs("div",{ref:w,className:`nice-tutorial__tooltip nice-tutorial__tooltip--${je.actualPlacement} ${C?"nice-tutorial__tooltip--entering":""}`,style:{position:"absolute",top:je.top,left:je.left,transition:`all ${N}ms ease`,maxWidth:380,zIndex:l+1},children:[r.showArrow!==!1&&e.jsx("div",{className:`nice-tutorial__arrow nice-tutorial__arrow--${je.actualPlacement}`}),e.jsxs("div",{className:"nice-tutorial__header",children:[e.jsx("h4",{id:le,className:"nice-tutorial__title",children:r.title}),(M??m)&&e.jsx("button",{type:"button",className:"nice-tutorial__close",onClick:o,"aria-label":Pe,title:Pe,children:e.jsx(Ot,{})})]}),e.jsx("div",{id:ge,className:"nice-tutorial__content",dangerouslySetInnerHTML:{__html:b.sanitizeHtml(r.content)}}),v==="inline"&&Oe(!0)]}),v==="floating-bottom"&&Oe(!1)]})};process.env.NODE_ENV!=="production"&&(Ue.displayName="NiceTutorial");const tt=t.createContext({startTutorial:()=>{},stopTutorial:()=>{},isActive:!1,currentStep:0,nextStep:()=>{},prevStep:()=>{},goToStep:()=>{}});function qt(){return t.useContext(tt)}const nt=({children:n})=>{const[i,c]=t.useState([]),[o,d]=t.useState(!1),[f,h]=t.useState(0),g=t.useCallback(p=>{c(p),h(0),d(!0)},[]),m=t.useCallback(()=>{d(!1),h(0),c([])},[]),I=t.useCallback(()=>{h(p=>Math.min(p+1,i.length-1))},[i.length]),M=t.useCallback(()=>{h(p=>Math.max(p-1,0))},[]),y=t.useCallback(p=>{h(Math.max(0,Math.min(p,i.length-1)))},[i.length]),R={startTutorial:g,stopTutorial:m,isActive:o,currentStep:f,nextStep:I,prevStep:M,goToStep:y};return e.jsxs(tt.Provider,{value:R,children:[n,o&&i.length>0&&e.jsx(Ue,{steps:i,active:o,onFinish:m,onSkip:m,onStepChange:h})]})};process.env.NODE_ENV!=="production"&&(nt.displayName="NiceTutorialProvider");function At(n,i,c,o,d){const f=n<=d,h=n+d>=c,g=i<=d,m=i+d>=o;return g&&f?"top-left":g&&h?"top-right":m&&f?"bottom-left":m&&h?"bottom-right":f?"left":h?"right":g?"top":m?"bottom":"none"}function Wt(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 Ut=Object.assign(t.forwardRef(({windowKey:n,title:i,icon:c,children:o,footer:d,x:f,y:h,defaultPosition:g,width:m=480,height:I=360,minWidth:M=200,minHeight:y=120,maxWidth:R,maxHeight:p,zIndex:N=1,closable:x=!0,minimizable:l=!0,maximizable:v=!0,fullscreenable:a=!1,pinnable:T=!1,resizable:u=!0,draggable:Y=!0,snappable:z=!0,snapThreshold:X=20,minimized:$,maximized:_,fullscreen:S,pinned:k,focused:s,onClose:j,onMinimize:C,onMaximize:E,onFullscreen:P,onPin:A,onFocus:W,onMove:G,onResize:w,onSnap:L,onTitleBarDoubleClick:r,size:B="md",statusBar:H,titleBarActions:te,className:oe,style:ne,id:ie,accessMode:Te,...Ne},ke)=>{const $e=b.useControlId(ie),Pe=b.useNiceAccessMode(Te,ie),{t:K}=b.useNiceTranslation(),ce=t.useRef(null);ce.current==null&&(ce.current=`nice-window-${Math.random().toString(36).slice(2,10)}`);const U=n??ce.current,xe=f??g?.x??100,ae=h??g?.y??100,[we,se]=t.useState({x:xe,y:ae}),[le,ge]=t.useState({width:m,height:I}),[Le,je]=t.useState(!1),[Me,Oe]=t.useState(!1),[He,Xe]=t.useState(!1),[O,q]=t.useState(!1),[F,be]=t.useState("none"),Be=$??Le,J=_??Me,Q=S??He,_e=k??O,Ye=s??!0,ve=we.x,ye=we.y,de=le.width,ue=le.height,me=t.useRef(null),ee=t.useRef(null),V=t.useRef(null),[it,Ve]=t.useState(!1),st=t.useCallback(()=>{j?.(U)},[U,j]),ot=t.useCallback(()=>{je(!0),C?.(U)},[U,C]),qe=t.useCallback(()=>{const D=!J;Oe(D),!D&&V.current?(se({x:V.current.x,y:V.current.y}),ge({width:V.current.w,height:V.current.h}),V.current=null):D&&(V.current={x:ve,y:ye,w:de,h:ue}),be("none"),E?.(U,D)},[U,J,ve,ye,de,ue,E]),Ae=t.useCallback(()=>{const D=!Q;Xe(D),D?V.current={x:ve,y:ye,w:de,h:ue}:V.current&&(se({x:V.current.x,y:V.current.y}),ge({width:V.current.w,height:V.current.h}),V.current=null),P?.(U,D)},[U,Q,ve,ye,de,ue,P]),ct=t.useCallback(()=>{const D=!_e;q(D),A?.(U,D)},[U,_e,A]),Ce=t.useCallback(()=>{W?.(U)},[U,W]),rt=t.useCallback(()=>{r?r(U):v&&qe()},[U,v,qe,r]);t.useEffect(()=>{const D=fe=>{if(!me.current)return;const re=fe.clientX-me.current.startX+me.current.origX,ze=fe.clientY-me.current.startY+me.current.origY;se({x:re,y:ze}),G?.(U,{x:re,y:ze})},Z=fe=>{if(me.current){if(z){const re=At(fe.clientX,fe.clientY,window.innerWidth,window.innerHeight,X);re!=="none"&&(V.current={x:we.x,y:we.y,w:de,h:ue},be(re),L?.(U,re))}me.current=null,Ve(!1)}};return document.addEventListener("mousemove",D),document.addEventListener("mouseup",Z),()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",Z)}});const at=t.useCallback(D=>{!Y||J||Q||(D.preventDefault(),F!=="none"&&(V.current&&(se({x:V.current.x,y:V.current.y}),ge({width:V.current.w,height:V.current.h})),be("none")),Ce(),me.current={startX:D.clientX,startY:D.clientY,origX:ve,origY:ye},Ve(!0))},[Y,J,Q,F,ve,ye,Ce]);t.useEffect(()=>{const D=fe=>{if(!ee.current)return;const re=fe.clientX-ee.current.startX,ze=fe.clientY-ee.current.startY,Ee=ee.current.handle;let he=ee.current.origW,pe=ee.current.origH;if(Ee.includes("e")&&(he=ee.current.origW+re),Ee.includes("w")&&(he=ee.current.origW-re),Ee.includes("s")&&(pe=ee.current.origH+ze),Ee.includes("n")&&(pe=ee.current.origH-ze),he=Math.max(M,R?Math.min(R,he):he),pe=Math.max(y,p?Math.min(p,pe):pe),Ee.includes("w")){const We=le.width-he;se(Se=>({...Se,x:Se.x+We}))}if(Ee.includes("n")){const We=le.height-pe;se(Se=>({...Se,y:Se.y+We}))}ge({width:he,height:pe}),w?.(U,{width:he,height:pe})},Z=()=>{ee.current=null};return document.addEventListener("mousemove",D),document.addEventListener("mouseup",Z),()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",Z)}});const lt=t.useCallback((D,Z)=>{!u||J||Q||F!=="none"||(Z.preventDefault(),Z.stopPropagation(),Ce(),ee.current={startX:Z.clientX,startY:Z.clientY,origW:de,origH:ue,handle:D})},[u,J,Q,F,de,ue,Ce]);if(t.useEffect(()=>{if(!Ye)return;const D=Z=>{Z.key==="Escape"&&Q&&Ae()};return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[Ye,Q,Ae]),Pe==="hidden"||Be)return null;const Ke=F!=="none"?Wt(F):null,Ge=J||Q,dt=Q?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:999999}:J?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:N}:Ke?{position:"absolute",...Ke,zIndex:N}:{position:"absolute",top:ye,left:ve,width:de,height:ue,zIndex:N},ut=["n","e","s","w","ne","se","sw","nw"],mt={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:ke,id:$e,className:`nice-window nice-window--${B} ${Ye?"nice-window--focused":""} ${_e?"nice-window--pinned":""} ${Ge?"nice-window--maximized":""} ${it?"nice-window--dragging":""} ${F!=="none"?`nice-window--snapped-${F}`:""} ${oe??""}`,style:{...dt,...ne},onMouseDown:Ce,onFocus:Ye?void 0:Ce,role:"dialog","aria-label":i,tabIndex:-1,"data-nice-focus-scope":"spatial","data-nice-region":i,...Ne,children:[e.jsxs("div",{className:"nice-window__titlebar",onMouseDown:at,onDoubleClick:rt,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:[te,T&&e.jsx("button",{type:"button",className:`nice-window__action nice-window__action--pin ${_e?"nice-window__action--active":""}`,onClick:ct,title:_e?K("window.unpin","Unpin"):K("window.pin","Pin"),children:e.jsx(b.NiceIcon,{name:"paperclip",size:14})}),l&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--minimize",onClick:ot,title:K("window.minimize","Minimize"),children:e.jsx(b.NiceIcon,{name:"minus",size:14})}),v&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--maximize",onClick:qe,title:J?K("window.restore","Restore"):K("window.maximize","Maximize"),children:e.jsx(b.NiceIcon,{name:J?"copy":"window",size:14})}),a&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--fullscreen",onClick:Ae,title:Q?K("window.exitFullscreen","Exit Full Screen"):K("window.fullscreen","Full Screen"),children:e.jsx(b.NiceIcon,{name:Q?"collapse":"expand",size:14})}),x&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--close",onClick:st,title:K("window.close","Close"),children:e.jsx(b.NiceIcon,{name:"close",size:14})})]})]}),e.jsx("div",{className:"nice-window__body",children:o}),d&&e.jsx("div",{className:"nice-window__footer",children:d}),H&&e.jsx("div",{className:"nice-window__statusbar",children:H}),u&&!Ge&&F==="none"&&e.jsx(e.Fragment,{children:ut.map(D=>e.jsx("div",{className:`nice-window__resize nice-window__resize--${D}`,style:{cursor:mt[D]},onMouseDown:Z=>lt(D,Z)},D))})]})}),{displayName:"NiceWindow"});exports.NiceActionSheet=ht;exports.NiceBlockUI=St;exports.NiceBottomSheet=It;exports.NiceBox=wt;exports.NiceCommandPaletteProvider=et;exports.NiceContextMenu=Tt;exports.NiceDrawer=Et;exports.NiceLoadPanel=xt;exports.NiceModal=Nt;exports.NiceModalBody=jt;exports.NiceModalFooter=Ct;exports.NiceModalHeader=kt;exports.NicePopover=Rt;exports.NicePopover$1=pt;exports.NiceResizable=_t;exports.NiceResponsiveBox=bt;exports.NiceScrollView=vt;exports.NiceTutorial=Ue;exports.NiceTutorialProvider=nt;exports.NiceWindow=Ut;exports.NiceWindowManager=$t;exports.fuzzyMatch=Fe;exports.highlightMatches=Qe;exports.useCommandPalette=Je;exports.useNiceTutorial=qt;exports.useRegisterCommands=zt;
|
|
@@ -1 +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-
|
|
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-CBgbzwjx.cjs")).then(e=>({default:e.NiceCodeEditor}))),{fallback:r.jsx(z,{}),preloadOnHover:!0,displayName:"LazyCodeEditor"}),HtmlEditor:i(d(()=>Promise.resolve().then(()=>require("./NiceHtmlEditor-BEWNA_UI.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-C3Q3r8Yz.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-C3Q3r8Yz.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-C3Q3r8Yz.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-Dff8fuq_.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-Drl4gvw9.cjs")).then(e=>({default:e.NiceGantt}))),{fallback:r.jsx(E,{}),displayName:"LazyGantt"}),PivotGrid:i(d(()=>Promise.resolve().then(()=>require("./NicePivotGrid-BshofJh1.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-Cszjz8NV.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;
|
|
@@ -1,128 +1,106 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceAccessMode as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
approved:
|
|
7
|
-
rejected:
|
|
8
|
-
skipped:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsxs as s, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceAccessMode as F, useNiceTranslation as P, useControlId as E } from "@nice2dev/ui-core";
|
|
3
|
+
import M, { forwardRef as R, useMemo as l } from "react";
|
|
4
|
+
import { NiceStepper as z } from "../planning/NiceStepper.mjs";
|
|
5
|
+
const B = [], H = {
|
|
6
|
+
approved: "completed",
|
|
7
|
+
rejected: "error",
|
|
8
|
+
skipped: "skipped",
|
|
9
|
+
pending: "pending",
|
|
10
|
+
waiting: "pending"
|
|
11
|
+
}, q = /* @__PURE__ */ Object.assign(
|
|
12
|
+
/* @__PURE__ */ R(
|
|
12
13
|
({
|
|
13
14
|
label: d,
|
|
14
15
|
helperText: p,
|
|
15
16
|
error: i,
|
|
16
|
-
disabled:
|
|
17
|
+
disabled: t,
|
|
17
18
|
readOnly: m,
|
|
18
|
-
size:
|
|
19
|
-
id:
|
|
19
|
+
size: j = "md",
|
|
20
|
+
id: u,
|
|
20
21
|
className: f,
|
|
21
22
|
style: x,
|
|
22
|
-
accessMode:
|
|
23
|
-
steps:
|
|
24
|
-
activeStepId:
|
|
25
|
-
canDecide:
|
|
26
|
-
onDecide:
|
|
27
|
-
direction:
|
|
28
|
-
locale:
|
|
29
|
-
},
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const { t:
|
|
33
|
-
() => new Intl.DateTimeFormat(
|
|
23
|
+
accessMode: A,
|
|
24
|
+
steps: v = B,
|
|
25
|
+
activeStepId: o,
|
|
26
|
+
canDecide: T = !1,
|
|
27
|
+
onDecide: y,
|
|
28
|
+
direction: N = "horizontal",
|
|
29
|
+
locale: h = "pl-PL"
|
|
30
|
+
}, C) => {
|
|
31
|
+
const c = F(A, u), S = c === "hidden";
|
|
32
|
+
c === "disabled" && (t = !0), c === "readOnly" && (m = !0);
|
|
33
|
+
const { t: a } = P(), $ = E(u), [_, w] = M.useState(""), g = l(
|
|
34
|
+
() => new Intl.DateTimeFormat(h, {
|
|
34
35
|
dateStyle: "medium",
|
|
35
36
|
timeStyle: "short"
|
|
36
37
|
}),
|
|
37
|
-
[
|
|
38
|
-
),
|
|
39
|
-
|
|
38
|
+
[h]
|
|
39
|
+
), r = l(() => [...v].sort((e, k) => e.order - k.order), [v]), D = l(
|
|
40
|
+
() => r.map((e) => ({
|
|
41
|
+
title: e.approver,
|
|
42
|
+
subtitle: [e.role, e.decidedAt ? g.format(new Date(e.decidedAt)) : void 0].filter(Boolean).join(" · ") || void 0,
|
|
43
|
+
description: e.comment ? `„${e.comment}”` : void 0,
|
|
44
|
+
status: e.id === o ? "active" : H[e.status]
|
|
45
|
+
})),
|
|
46
|
+
[r, o, g]
|
|
47
|
+
), b = (e) => {
|
|
48
|
+
o != null && (y?.(o, e, _ || void 0), w(""));
|
|
40
49
|
};
|
|
41
|
-
return
|
|
50
|
+
return S ? null : /* @__PURE__ */ s(
|
|
42
51
|
"div",
|
|
43
52
|
{
|
|
44
|
-
ref:
|
|
45
|
-
id:
|
|
46
|
-
className: `nice-approval-flow nice-approval-flow--${
|
|
53
|
+
ref: C,
|
|
54
|
+
id: $,
|
|
55
|
+
className: `nice-approval-flow nice-approval-flow--${N} nice-size-${j}${f ? ` ${f}` : ""}${t ? " nice-disabled" : ""}`,
|
|
47
56
|
style: x,
|
|
48
57
|
children: [
|
|
49
|
-
d && /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
),
|
|
62
|
-
/* @__PURE__ */ c(
|
|
63
|
-
"div",
|
|
64
|
-
{
|
|
65
|
-
className: `nice-approval-flow__step${M ? " nice-approval-flow__step--active" : ""}`,
|
|
66
|
-
children: [
|
|
67
|
-
/* @__PURE__ */ o(
|
|
68
|
-
"div",
|
|
69
|
-
{
|
|
70
|
-
className: "nice-approval-flow__step-icon",
|
|
71
|
-
style: { borderColor: l.color, color: l.color },
|
|
72
|
-
children: /* @__PURE__ */ o(I, { name: l.icon, size: "sm", color: l.color })
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
/* @__PURE__ */ c("div", { className: "nice-approval-flow__step-info", children: [
|
|
76
|
-
/* @__PURE__ */ o("span", { className: "nice-approval-flow__step-approver", children: e.approver }),
|
|
77
|
-
e.role && /* @__PURE__ */ o("span", { className: "nice-approval-flow__step-role", children: e.role }),
|
|
78
|
-
e.decidedAt && /* @__PURE__ */ o("span", { className: "nice-approval-flow__step-date", children: z.format(new Date(e.decidedAt)) }),
|
|
79
|
-
e.comment && /* @__PURE__ */ c("span", { className: "nice-approval-flow__step-comment", children: [
|
|
80
|
-
'"',
|
|
81
|
-
e.comment,
|
|
82
|
-
'"'
|
|
83
|
-
] })
|
|
84
|
-
] })
|
|
85
|
-
]
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
] }, e.id);
|
|
89
|
-
}) }),
|
|
90
|
-
j && !m && a != null && /* @__PURE__ */ c("div", { className: "nice-approval-flow__decision", children: [
|
|
91
|
-
/* @__PURE__ */ o(
|
|
58
|
+
d && /* @__PURE__ */ n("div", { className: "nice-approval-flow__label", children: d }),
|
|
59
|
+
/* @__PURE__ */ n(
|
|
60
|
+
z,
|
|
61
|
+
{
|
|
62
|
+
className: "nice-approval-flow__stepper",
|
|
63
|
+
steps: D,
|
|
64
|
+
activeStep: r.findIndex((e) => e.id === o),
|
|
65
|
+
orientation: N
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
T && !m && o != null && /* @__PURE__ */ s("div", { className: "nice-approval-flow__decision", children: [
|
|
69
|
+
/* @__PURE__ */ n(
|
|
92
70
|
"textarea",
|
|
93
71
|
{
|
|
94
72
|
className: "nice-approval-flow__comment",
|
|
95
|
-
value:
|
|
73
|
+
value: _,
|
|
96
74
|
onChange: (e) => w(e.target.value),
|
|
97
|
-
placeholder:
|
|
98
|
-
disabled:
|
|
75
|
+
placeholder: a("addComment", "Add comment…"),
|
|
76
|
+
disabled: t
|
|
99
77
|
}
|
|
100
78
|
),
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ s("div", { className: "nice-approval-flow__decision-actions", children: [
|
|
80
|
+
/* @__PURE__ */ n(
|
|
103
81
|
"button",
|
|
104
82
|
{
|
|
105
83
|
type: "button",
|
|
106
84
|
className: "nice-btn nice-btn--success",
|
|
107
|
-
disabled:
|
|
85
|
+
disabled: t,
|
|
108
86
|
onClick: () => b("approved"),
|
|
109
|
-
children:
|
|
87
|
+
children: a("approve", "Approve")
|
|
110
88
|
}
|
|
111
89
|
),
|
|
112
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ n(
|
|
113
91
|
"button",
|
|
114
92
|
{
|
|
115
93
|
type: "button",
|
|
116
94
|
className: "nice-btn nice-btn--danger",
|
|
117
|
-
disabled:
|
|
95
|
+
disabled: t,
|
|
118
96
|
onClick: () => b("rejected"),
|
|
119
|
-
children:
|
|
97
|
+
children: a("reject", "Reject")
|
|
120
98
|
}
|
|
121
99
|
)
|
|
122
100
|
] })
|
|
123
101
|
] }),
|
|
124
|
-
p && /* @__PURE__ */
|
|
125
|
-
i && typeof i == "string" && /* @__PURE__ */
|
|
102
|
+
p && /* @__PURE__ */ n("span", { className: "nice-helper-text", children: p }),
|
|
103
|
+
i && typeof i == "string" && /* @__PURE__ */ n("span", { className: "nice-error-text", children: i })
|
|
126
104
|
]
|
|
127
105
|
}
|
|
128
106
|
);
|
|
@@ -131,5 +109,5 @@ const G = [], C = {
|
|
|
131
109
|
{ displayName: "NiceDocumentApprovalFlow" }
|
|
132
110
|
);
|
|
133
111
|
export {
|
|
134
|
-
|
|
112
|
+
q as NiceDocumentApprovalFlow
|
|
135
113
|
};
|
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceAccessMode as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { NiceAvatar as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
c
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceAccessMode as w, useNiceTranslation as A, useControlId as T, NiceIcon as d } from "@nice2dev/ui-core";
|
|
3
|
+
import { forwardRef as z, useMemo as L } from "react";
|
|
4
|
+
import { NiceAvatar as M } from "./NiceAvatar.mjs";
|
|
5
|
+
const R = [], S = 6;
|
|
6
|
+
function C(l) {
|
|
7
|
+
let c = 0;
|
|
8
|
+
for (let r = 0; r < l.length; r++)
|
|
9
|
+
c = c * 31 + l.charCodeAt(r) >>> 0;
|
|
10
|
+
return c % S;
|
|
11
|
+
}
|
|
12
|
+
const E = { 1: "#facc15", 2: "#cbd5e1", 3: "#d97706" };
|
|
13
|
+
function I({ delta: l }) {
|
|
14
|
+
return l === 0 ? /* @__PURE__ */ e("span", { className: "nice-lb__delta nice-lb__delta--neutral", children: "—" }) : l > 0 ? /* @__PURE__ */ n("span", { className: "nice-lb__delta nice-lb__delta--up", children: [
|
|
15
|
+
/* @__PURE__ */ e(d, { name: "arrow-up", size: "xs" }),
|
|
16
|
+
l
|
|
17
|
+
] }) : /* @__PURE__ */ n("span", { className: "nice-lb__delta nice-lb__delta--down", children: [
|
|
18
|
+
/* @__PURE__ */ e(d, { name: "arrow-down", size: "xs" }),
|
|
19
|
+
Math.abs(l)
|
|
13
20
|
] });
|
|
14
21
|
}
|
|
15
|
-
function
|
|
16
|
-
const
|
|
17
|
-
return
|
|
22
|
+
function O({ rank: l }) {
|
|
23
|
+
const c = E[l];
|
|
24
|
+
return c ? /* @__PURE__ */ e("span", { className: "nice-lb__rank nice-lb__rank--medal", children: /* @__PURE__ */ e(d, { name: "medal", size: "sm", color: c, title: `#${l}` }) }) : /* @__PURE__ */ n("span", { className: "nice-lb__rank", children: [
|
|
18
25
|
"#",
|
|
19
|
-
|
|
26
|
+
l
|
|
20
27
|
] });
|
|
21
28
|
}
|
|
22
|
-
const
|
|
23
|
-
/* @__PURE__ */
|
|
29
|
+
const D = /* @__PURE__ */ Object.assign(
|
|
30
|
+
/* @__PURE__ */ z(
|
|
24
31
|
({
|
|
25
|
-
entries:
|
|
26
|
-
title:
|
|
27
|
-
statColumns:
|
|
32
|
+
entries: l = R,
|
|
33
|
+
title: c,
|
|
34
|
+
statColumns: r,
|
|
28
35
|
highlightTop: h = 3,
|
|
29
36
|
maxVisible: s,
|
|
30
37
|
showDelta: t = !0,
|
|
@@ -36,48 +43,48 @@ const P = /* @__PURE__ */ Object.assign(
|
|
|
36
43
|
accessMode: f,
|
|
37
44
|
id: m
|
|
38
45
|
}, k) => {
|
|
39
|
-
const
|
|
40
|
-
return
|
|
46
|
+
const v = w(f, m) === "hidden", { t: i } = A(), $ = T(m), g = L(() => s ? l.slice(0, s) : l, [l, s]);
|
|
47
|
+
return v ? null : /* @__PURE__ */ n(
|
|
41
48
|
"div",
|
|
42
49
|
{
|
|
43
50
|
ref: k,
|
|
44
|
-
id:
|
|
51
|
+
id: $,
|
|
45
52
|
className: `nice-leaderboard nice-leaderboard--${N} nice-size-${p}${_ ? ` ${_}` : ""}`,
|
|
46
53
|
style: u,
|
|
47
54
|
children: [
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */ e("th", { className: "nice-lb__th-rank", children:
|
|
52
|
-
/* @__PURE__ */ e("th", { className: "nice-lb__th-name", children:
|
|
53
|
-
/* @__PURE__ */ e("th", { className: "nice-lb__th-score", children:
|
|
54
|
-
t && /* @__PURE__ */ e("th", { className: "nice-lb__th-delta", children:
|
|
55
|
-
|
|
55
|
+
c && /* @__PURE__ */ e("h3", { className: "nice-leaderboard__title", children: c }),
|
|
56
|
+
/* @__PURE__ */ n("table", { className: "nice-leaderboard__table", children: [
|
|
57
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
58
|
+
/* @__PURE__ */ e("th", { className: "nice-lb__th-rank", children: i("leaderboard.rank", "#") }),
|
|
59
|
+
/* @__PURE__ */ e("th", { className: "nice-lb__th-name", children: i("player", "Player") }),
|
|
60
|
+
/* @__PURE__ */ e("th", { className: "nice-lb__th-score", children: i("score", "Score") }),
|
|
61
|
+
t && /* @__PURE__ */ e("th", { className: "nice-lb__th-delta", children: i("leaderboard.change", "Δ") }),
|
|
62
|
+
r?.map((a) => /* @__PURE__ */ e("th", { className: "nice-lb__th-stat", children: a.label }, a.key))
|
|
56
63
|
] }) }),
|
|
57
|
-
/* @__PURE__ */ e("tbody", { children: g.map((a) => /* @__PURE__ */
|
|
64
|
+
/* @__PURE__ */ e("tbody", { children: g.map((a) => /* @__PURE__ */ n(
|
|
58
65
|
"tr",
|
|
59
66
|
{
|
|
60
67
|
className: `nice-lb__row${a.rank <= h ? ` nice-lb__row--top${a.rank}` : ""}${a.isCurrentUser ? " nice-lb__row--current" : ""}`,
|
|
61
68
|
onClick: () => o?.(a),
|
|
62
69
|
style: { cursor: o ? "pointer" : void 0 },
|
|
63
70
|
children: [
|
|
64
|
-
/* @__PURE__ */ e("td", { className: "nice-lb__cell-rank", children: /* @__PURE__ */ e(
|
|
65
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ e("td", { className: "nice-lb__cell-rank", children: /* @__PURE__ */ e(O, { rank: a.rank }) }),
|
|
72
|
+
/* @__PURE__ */ n("td", { className: "nice-lb__cell-name", children: [
|
|
66
73
|
/* @__PURE__ */ e(
|
|
67
|
-
|
|
74
|
+
M,
|
|
68
75
|
{
|
|
69
76
|
src: a.avatarUrl,
|
|
70
77
|
name: a.name,
|
|
71
78
|
size: "sm",
|
|
72
|
-
className: "nice-lb__avatar"
|
|
79
|
+
className: a.avatarUrl ? "nice-lb__avatar" : `nice-lb__avatar nice-lb__avatar--tone-${C(a.name)}`
|
|
73
80
|
}
|
|
74
81
|
),
|
|
75
82
|
/* @__PURE__ */ e("span", { className: "nice-lb__name", children: a.name }),
|
|
76
83
|
a.badge
|
|
77
84
|
] }),
|
|
78
85
|
/* @__PURE__ */ e("td", { className: "nice-lb__cell-score", children: a.score.toLocaleString() }),
|
|
79
|
-
t && /* @__PURE__ */ e("td", { className: "nice-lb__cell-delta", children: /* @__PURE__ */ e(
|
|
80
|
-
|
|
86
|
+
t && /* @__PURE__ */ e("td", { className: "nice-lb__cell-delta", children: /* @__PURE__ */ e(I, { delta: a.delta ?? 0 }) }),
|
|
87
|
+
r?.map((b) => /* @__PURE__ */ e("td", { className: "nice-lb__cell-stat", children: a.stats?.[b.key] ?? "—" }, b.key))
|
|
81
88
|
]
|
|
82
89
|
},
|
|
83
90
|
a.id
|
|
@@ -91,5 +98,5 @@ const P = /* @__PURE__ */ Object.assign(
|
|
|
91
98
|
{ displayName: "NiceLeaderboard" }
|
|
92
99
|
);
|
|
93
100
|
export {
|
|
94
|
-
|
|
101
|
+
D as NiceLeaderboard
|
|
95
102
|
};
|