@nice2dev/ui 1.4.19 → 1.4.21
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 +57 -0
- package/dist/NiceGantt-Drl4gvw9.cjs +1 -0
- package/dist/{NiceGantt.doc-B6YZcJvG.cjs → NiceGantt.doc-DTv0r7bP.cjs} +2 -2
- package/dist/NiceModuleLifecyclePanel-jckyVqqt.cjs +1 -0
- package/dist/NiceWindow-DQyf5wat.cjs +1 -0
- package/dist/{core-lazy-BhQxFuLf.cjs → core-lazy-DirbU7jp.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/index.cjs +94 -94
- package/dist/index.d.ts +58 -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/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/package.json +4 -4
- package/dist/NiceBottomSheet.doc-keq-Fzlz.cjs +0 -8
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),g=require("@nice2dev/ui-core"),t=require("react"),je=require("react-dom"),ft=[],ht=({visible:n,onClose:i,title:c,items:o=ft,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")})]})]})},pt=({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},xt=({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},wt=({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}),gt=[],bt=({direction:n="row",items:i=gt,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))}),_t=({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))]})},vt=({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})},yt=[];function Ce(){const n=t.useContext(g.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: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)},kt=({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})})]})},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: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)},It=({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)},Rt=({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)]})},Tt=({items:n=yt,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 Ge(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 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 Qe=t.createContext(null);function Ze(){const n=t.useContext(Qe);if(!n)throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");return n}const Je=({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(Mt,{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(Qe.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?Ge(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"&&(Je.displayName="NiceCommandPaletteProvider");function St(n){const{registerCommands:i,unregisterCommand:c}=Ze();t.useEffect(()=>(i(n),()=>{for(const o of n)c(o.id)}),[])}const zt=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"}),$t=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 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 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 Ot(){return e.jsx(g.NiceIcon,{name:"close",size:16})}function Yt(){return e.jsx(g.NiceIcon,{name:"chevron-left",size:16})}function Dt(){return e.jsx(g.NiceIcon,{name:"chevron-right",size:16})}function Ft(){return e.jsx(g.NiceIcon,{name:"skip-forward",size:16})}function Bt(){return e.jsx(g.NiceIcon,{name:"play",size:16})}function Ht(){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 Xt=[],We=({steps:n=Xt,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=Pt(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(()=>_?Lt(_,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(Ft,{}),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(Yt,{}),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(Dt,{}),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(Ht,{}):e.jsx(Bt,{}),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(Ot,{})})]}),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 et=t.createContext({startTutorial:()=>{},stopTutorial:()=>{},isActive:!1,currentStep:0,nextStep:()=>{},prevStep:()=>{},goToStep:()=>{}});function qt(){return t.useContext(et)}const tt=({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(et.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"&&(tt.displayName="NiceTutorialProvider");function At(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 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: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"),nt=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),[it,Ue]=t.useState(!1),st=t.useCallback(()=>{y?.(A)},[A,y]),ot=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]),ct=t.useCallback(()=>{const Y=!Re;Be(Y),H?.(A,Y)},[A,Re,H]),Ne=t.useCallback(()=>{v?.(A)},[A,v]),at=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=At(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,Ue(!1)}};return document.addEventListener("mousemove",Y),document.addEventListener("mouseup",Q),()=>{document.removeEventListener("mousemove",Y),document.removeEventListener("mouseup",Q)}});const rt=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},Ue(!0))},[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 lt=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"||nt)return null;const Ve=te!=="none"?Wt(te):null,Ke=ie||Z,dt=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}:Ve?{position:"absolute",...Ve,zIndex:k}:{position:"absolute",top:ve,left:_e,width:le,height:de,zIndex:k},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:xe,id:ze,className:`nice-window nice-window--${W} ${Pe?"nice-window--focused":""} ${Re?"nice-window--pinned":""} ${Ke?"nice-window--maximized":""} ${it?"nice-window--dragging":""} ${te!=="none"?`nice-window--snapped-${te}`:""} ${ae??""}`,style:{...dt,...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:rt,onDoubleClick:at,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:ct,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:ot,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:st,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&&!Ke&&te==="none"&&e.jsx(e.Fragment,{children:ut.map(Y=>e.jsx("div",{className:`nice-window__resize nice-window__resize--${Y}`,style:{cursor:mt[Y]},onMouseDown:Q=>lt(Y,Q)},Y))})]})}),{displayName:"NiceWindow"});exports.NiceActionSheet=ht;exports.NiceBlockUI=zt;exports.NiceBottomSheet=It;exports.NiceBox=wt;exports.NiceCommandPaletteProvider=Je;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=We;exports.NiceTutorialProvider=tt;exports.NiceWindow=Ut;exports.NiceWindowManager=$t;exports.fuzzyMatch=Oe;exports.highlightMatches=Ge;exports.useCommandPalette=Ze;exports.useNiceTutorial=qt;exports.useRegisterCommands=St;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const e = "https://nice2dev.com/schemas/component-doc-v1.json", t = "NiceBottomSheet", n = "Bottom sheet with snap points and drag-to-dismiss.", o = "mobile", a = "1.0.0", i = "stable", s = [{ name: "open", type: "boolean", required: !0, description: "Open state" }, { name: "onOpenChange", type: "(open: boolean) => void", required: !0, description: "Open change callback" }, { name: "children", type: "React.ReactNode", required: !0, description: "Sheet content" }, { name: "snapPoints", type: "number[]", default: "[0.5, 1]", description: "Snap points (0-1)" }, { name: "initialSnap", type: "number", default: "0", description: "Default snap point index" }, { name: "onSnap", type: "(index: number) => void", description: "Snap callback" }, { name: "showHandle", type: "boolean", default: "true", description: "Show drag handle" }], c = [{ title: "Bottom Sheet", description: "Draggable sheet", code: `<NiceBottomSheet
|
|
2
|
-
open={sheetOpen}
|
|
3
|
-
onOpenChange={setSheetOpen}
|
|
4
|
-
snapPoints={[0.3, 0.7, 1]}
|
|
5
|
-
showHandle
|
|
6
|
-
>
|
|
7
|
-
<DetailPanel />
|
|
8
|
-
</NiceBottomSheet>` }], p = { keyboard: ["Tab within sheet", "Escape to close"], aria: ["Dialog role", "Drag handle description"] }, d = ["NiceActionSheet", "NiceDrawer"], r = {
|
|
9
|
-
$schema: e,
|
|
10
|
-
name: t,
|
|
11
|
-
description: n,
|
|
12
|
-
category: o,
|
|
13
|
-
since: a,
|
|
14
|
-
status: i,
|
|
15
|
-
props: s,
|
|
16
|
-
examples: c,
|
|
17
|
-
accessibility: p,
|
|
18
|
-
seeAlso: d
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
e as $schema,
|
|
22
|
-
p as accessibility,
|
|
23
|
-
o as category,
|
|
24
|
-
r as default,
|
|
25
|
-
n as description,
|
|
26
|
-
c as examples,
|
|
27
|
-
t as name,
|
|
28
|
-
s as props,
|
|
29
|
-
d as seeAlso,
|
|
30
|
-
a as since,
|
|
31
|
-
i as status
|
|
32
|
-
};
|