@nice2dev/ui 1.0.14 → 1.0.15
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/dist/NiceErrorBoundary-CH8SBcSZ.js +762 -0
- package/dist/NiceErrorBoundary-CaVVPLh4.cjs +1 -0
- package/dist/NiceForm-Dbciuo4w.cjs +382 -0
- package/dist/NiceForm-Jf-ufPZz.js +5357 -0
- package/dist/NiceModal-Bf1Q1VNL.cjs +1 -0
- package/dist/NiceModal-DrywdSv3.js +95 -0
- package/dist/NiceModuleLifecyclePanel-CDX38sEx.js +6343 -0
- package/dist/NiceModuleLifecyclePanel-xLrOv8nL.cjs +1 -0
- package/dist/NicePagination-Aj63sKV3.js +171 -0
- package/dist/NicePagination-DNjVutBJ.cjs +1 -0
- package/dist/NicePinCodeInput-B_0RCKQN.cjs +419 -0
- package/dist/NicePinCodeInput-Dffu701_.js +11875 -0
- package/dist/NiceSavedQueryPanel-4l-V9dGK.js +6446 -0
- package/dist/NiceSavedQueryPanel-B5TjD_Sb.cjs +596 -0
- package/dist/NiceTabs-CbKhMxbC.cjs +1 -0
- package/dist/NiceTabs-HXphGn1B.js +1624 -0
- package/dist/NiceWindow-Ceb0mZ_0.js +1409 -0
- package/dist/NiceWindow-DXpnFZ0E.cjs +1 -0
- package/dist/charts-BPJefcE8.js +4645 -0
- package/dist/charts-Dr6QyMiv.cjs +761 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-DJ4NPp2B.js +22316 -0
- package/dist/core-DPY4m7vb.cjs +96 -0
- package/dist/data.cjs +1 -1
- package/dist/data.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.mjs +3 -3
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +2 -2
- package/dist/index-B-9lbtwJ.cjs +5194 -0
- package/dist/index-BNy9Nn0X.js +61422 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +69 -4
- package/dist/index.mjs +892 -890
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +3 -3
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.mjs +13 -13
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +36 -36
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),F=require("./core-DPY4m7vb.cjs"),n=require("react"),ut=({visible:t,onClose:i,title:o,items:r,showCancelButton:m=!0,cancelText:u,className:f,style:g})=>{const{t:p}=F.$o();return t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"nice-actionsheet__overlay",onClick:i}),e.jsxs("div",{className:`nice-actionsheet ${f||""}`,style:g,children:[o&&e.jsx("div",{className:"nice-actionsheet__title",children:o}),e.jsx("div",{className:"nice-actionsheet__items",children:r.map((k,l)=>e.jsxs("button",{className:`nice-actionsheet__item ${k.type==="danger"?"nice-actionsheet__item--danger":""}`,disabled:k.disabled,onClick:()=>{k.onClick?.(),i()},children:[k.icon&&e.jsx("span",{className:"nice-actionsheet__icon",children:k.icon}),k.text]},l))}),m&&e.jsx("button",{className:"nice-actionsheet__cancel",onClick:i,children:u||p("cancel","Cancel")})]})]}):null},mt=({visible:t,onClose:i,targetRef:o,position:r="bottom",title:m,showArrow:u=!0,width:f,children:g,className:p,style:k,displayStyle:l})=>{F.ls("tooltip",l);const v=n.useRef(null),[$,w]=n.useState({top:0,left:0}),M=n.useCallback(()=>{const x=o.current,P=v.current;if(!x||!P)return;const s=x.getBoundingClientRect(),b=P.getBoundingClientRect();let d=0,j=0;const I=8;switch(r){case"top":d=s.top-b.height-I,j=s.left+(s.width-b.width)/2;break;case"bottom":d=s.bottom+I,j=s.left+(s.width-b.width)/2;break;case"left":d=s.top+(s.height-b.height)/2,j=s.left-b.width-I;break;case"right":d=s.top+(s.height-b.height)/2,j=s.right+I;break}w({top:d+window.scrollY,left:j+window.scrollX})},[o,r]);return n.useEffect(()=>{if(t){requestAnimationFrame(M);const x=P=>{v.current&&!v.current.contains(P.target)&&o.current&&!o.current.contains(P.target)&&i()};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)}},[t,M,i,o]),t?e.jsxs("div",{ref:v,className:`nice-popover nice-popover--${r} ${p||""}`,style:{...k,position:"absolute",top:$.top,left:$.left,width:f},children:[u&&e.jsx("div",{className:`nice-popover__arrow nice-popover__arrow--${r}`}),m&&e.jsx("div",{className:"nice-popover__title",children:m}),e.jsx("div",{className:"nice-popover__content",children:g})]}):null},ht=({visible:t,message:i,container:o,showIndicator:r=!0,shading:m=!0,className:u,style:f})=>{const{t:g}=F.$o();if(!t)return null;const p=!!o?.current,k=e.jsxs("div",{className:`nice-loadpanel ${u||""}`,style:f,children:[m&&e.jsx("div",{className:"nice-loadpanel__shade"}),e.jsxs("div",{className:"nice-loadpanel__box",children:[r&&e.jsx("div",{className:"nice-spinner nice-spinner--md"}),e.jsx("span",{className:"nice-loadpanel__text",children:i||g("loading","Loading...")})]})]});if(p&&o.current){const l=o.current;return l.style.position=l.style.position||"relative",k}return k},ft=({direction:t="row",align:i,justify:o,wrap:r,gap:m,flex:u,children:f,className:g,style:p})=>e.jsx("div",{className:`nice-box ${g||""}`,style:{display:"flex",flexDirection:t,alignItems:i,justifyContent:o,flexWrap:r?"wrap":void 0,gap:m,flex:u,...p},children:f}),pt=({direction:t="row",items:i,gap:o,className:r,style:m})=>e.jsx("div",{className:`nice-responsivebox ${r||""}`,style:{display:"flex",flexDirection:t,gap:o,...m},children:i.map((u,f)=>e.jsx("div",{style:{flex:u.ratio??1,flexBasis:u.baseSize,flexShrink:u.shrink??1},children:u.children},f))}),wt=({width:t=200,height:i=200,minWidth:o=50,minHeight:r=50,maxWidth:m=1/0,maxHeight:u=1/0,handles:f=["right","bottom","bottomRight"],onResize:g,children:p,className:k,style:l})=>{const[v,$]=n.useState({width:t,height:i}),w=n.useRef(null),M=(s,b)=>{b.preventDefault();const d=b.clientX,j=b.clientY,I=v.width,q=v.height,_=c=>{const y=c.clientX-d,S=c.clientY-j;let E=I,a=q;(s.includes("right")||s==="right")&&(E=I+y),(s.includes("bottom")||s==="bottom")&&(a=q+S),(s.includes("left")||s==="left")&&(E=I-y),(s.includes("top")||s==="top")&&(a=q-S),E=Math.max(o,Math.min(m,E)),a=Math.max(r,Math.min(u,a)),$({width:E,height:a}),g?.({width:E,height:a})},T=()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",T)};document.addEventListener("pointermove",_),document.addEventListener("pointerup",T)},x=s=>{switch(s){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"}},P=s=>{const b={position:"absolute",zIndex:1},d=8;return s==="right"?{...b,top:0,right:-d/2,width:d,height:"100%",cursor:x(s)}:s==="bottom"?{...b,left:0,bottom:-d/2,width:"100%",height:d,cursor:x(s)}:s==="left"?{...b,top:0,left:-d/2,width:d,height:"100%",cursor:x(s)}:s==="top"?{...b,top:-d/2,left:0,width:"100%",height:d,cursor:x(s)}:s==="bottomRight"?{...b,bottom:-d/2,right:-d/2,width:d*2,height:d*2,cursor:x(s)}:s==="bottomLeft"?{...b,bottom:-d/2,left:-d/2,width:d*2,height:d*2,cursor:x(s)}:s==="topRight"?{...b,top:-d/2,right:-d/2,width:d*2,height:d*2,cursor:x(s)}:s==="topLeft"?{...b,top:-d/2,left:-d/2,width:d*2,height:d*2,cursor:x(s)}:b};return e.jsxs("div",{ref:w,className:`nice-resizable ${k||""}`,style:{...l,width:v.width,height:v.height,position:"relative",overflow:"hidden"},children:[p,f.map(s=>e.jsx("div",{style:P(s),onPointerDown:b=>M(s,b)},s))]})},xt=({direction:t="vertical",showScrollbar:i="onInteraction",width:o,height:r,onScroll:m,children:u,className:f,style:g})=>{const p=t==="horizontal"||t==="both"?"auto":"hidden",k=t==="vertical"||t==="both"?"auto":"hidden",l=i==="never"?"nice-scrollview--hide-sb":i==="always"?"nice-scrollview--show-sb":"";return e.jsx("div",{className:`nice-scrollview ${l} ${f||""}`,style:{...g,width:o,height:r,overflowX:p,overflowY:k},onScroll:m,children:u})};function pe(t,i){if(!t)return{score:1,indices:[]};const o=t.toLowerCase(),r=i.toLowerCase();let m=0;const u=[];let f=0,g=-1;for(let p=0;p<r.length&&m<o.length;p++)r[p]===o[m]&&(u.push(p),g===p-1&&(f+=3),(p===0||/[\s\-_/.]/.test(i[p-1]))&&(f+=5),i[p]===t[m]&&(f+=1),f+=1,g=p,m++);return m<o.length?null:(f-=u[0]*.1,{score:f,indices:u})}function Ee(t,i){if(i.length===0)return[t];const o=[];let r=0;const m=new Set(i);for(let u=0;u<t.length;u++)m.has(u)&&(r<u&&o.push(t.slice(r,u)),o.push(n.createElement("mark",{key:`m-${u}`,className:"nice-command-palette__match"},t[u])),r=u+1);return r<t.length&&o.push(t.slice(r)),o}function _t(t,i){switch(i.type){case"REGISTER":{const o=new Map(t.commands);return o.set(i.command.id,i.command),{...t,commands:o}}case"REGISTER_BATCH":{const o=new Map(t.commands);for(const r of i.commands)o.set(r.id,r);return{...t,commands:o}}case"UNREGISTER":{const o=new Map(t.commands);return o.delete(i.id),{...t,commands:o}}case"OPEN":return{...t,isOpen:!0,query:"",selectedIndex:0};case"CLOSE":return{...t,isOpen:!1,query:"",selectedIndex:0};case"SET_QUERY":return{...t,query:i.query,selectedIndex:0};case"SET_SELECTED":return{...t,selectedIndex:i.index};case"ADD_RECENT":{const o=t.recentIds.filter(r=>r!==i.id);return{...t,recentIds:[i.id,...o].slice(0,i.maxRecent)}}default:return t}}const ze=n.createContext(null);function Se(){const t=n.useContext(ze);if(!t)throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");return t}const Re=({children:t,commands:i,placeholder:o="Type a command...",maxVisible:r=10,maxRecent:m=5,className:u,emptyText:f="No commands found",closeOnAction:g=!0,onOpen:p,onClose:k})=>{const[l,v]=n.useReducer(_t,{commands:new Map(i?.map(a=>[a.id,a])??[]),isOpen:!1,query:"",selectedIndex:0,recentIds:[]}),$=n.useRef(null),w=n.useRef(null),[M,x]=n.useState(!1),P=n.useCallback(a=>{v({type:"REGISTER",command:a})},[]),s=n.useCallback(a=>{v({type:"UNREGISTER",id:a})},[]),b=n.useCallback(a=>{v({type:"REGISTER_BATCH",commands:a})},[]),d=n.useCallback(()=>{v({type:"OPEN"}),p?.()},[p]),j=n.useCallback(()=>{v({type:"CLOSE"}),k?.()},[k]),I=n.useCallback(()=>{l.isOpen?j():d()},[l.isOpen,j,d]),_=n.useMemo(()=>{const a=Array.from(l.commands.values()).filter(h=>!h.hidden);if(!l.query.trim()){const h=l.recentIds.map(R=>l.commands.get(R)).filter(R=>!!R&&!R.hidden),D=a.filter(R=>!l.recentIds.includes(R.id));return D.sort((R,K)=>R.label.localeCompare(K.label)),[...h,...D].map(R=>({command:R,match:null,isRecent:l.recentIds.includes(R.id)}))}return a.map(h=>{const D=pe(l.query,h.label),R=h.description?pe(l.query,h.description):null,K=h.keywords?.map(z=>pe(l.query,z)).filter(Boolean)[0]??null,ce=[D,R,K].filter(Boolean).sort((z,Y)=>(Y?.score??0)-(z?.score??0))[0];return{command:h,match:ce,isRecent:!1}}).filter(h=>h.match!==null).sort((h,D)=>(D.match?.score??0)-(h.match?.score??0))},[l.commands,l.query,l.recentIds]).slice(0,r),T=n.useCallback(async a=>{const C=l.commands.get(a);if(!(!C||C.disabled)){x(!0);try{await C.action(),v({type:"ADD_RECENT",id:a,maxRecent:m})}finally{x(!1),g&&j()}}},[l.commands,m,g,j]);n.useEffect(()=>{const a=C=>{(C.metaKey||C.ctrlKey)&&C.key==="k"&&(C.preventDefault(),I()),C.key==="Escape"&&l.isOpen&&(C.preventDefault(),j())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[I,l.isOpen,j]),n.useEffect(()=>{l.isOpen&&requestAnimationFrame(()=>$.current?.focus())},[l.isOpen]);const c=n.useCallback(a=>{const C=_.length;if(C){if(a.key==="ArrowDown")a.preventDefault(),v({type:"SET_SELECTED",index:(l.selectedIndex+1)%C});else if(a.key==="ArrowUp")a.preventDefault(),v({type:"SET_SELECTED",index:(l.selectedIndex-1+C)%C});else if(a.key==="Enter"){a.preventDefault();const h=_[l.selectedIndex];h&&T(h.command.id)}}},[_,l.selectedIndex,T]);n.useEffect(()=>{if(!w.current)return;w.current.children[l.selectedIndex]?.scrollIntoView({block:"nearest"})},[l.selectedIndex]);const y=n.useMemo(()=>({registerCommand:P,unregisterCommand:s,registerCommands:b,open:d,close:j,toggle:I,isOpen:l.isOpen,executeCommand:T}),[P,s,b,d,j,I,l.isOpen,T]),S=n.useMemo(()=>{const a=new Map;for(const C of _){const h=C.command.category??"General";a.has(h)||a.set(h,[]),a.get(h).push(C)}return a},[_]);let E=0;return e.jsxs(ze.Provider,{value:y,children:[t,l.isOpen&&e.jsx("div",{className:`nice-command-palette__overlay ${u??""}`,onClick:j,children:e.jsxs("div",{className:"nice-command-palette",role:"dialog","aria-label":"Command Palette","aria-modal":"true",onClick:a=>a.stopPropagation(),children:[e.jsx("div",{className:"nice-command-palette__input-wrapper",children:e.jsx("input",{ref:$,className:"nice-command-palette__input",type:"text",placeholder:o,value:l.query,onChange:a=>v({type:"SET_QUERY",query:a.target.value}),onKeyDown:c,"aria-label":"Search commands","aria-autocomplete":"list","aria-controls":"nice-command-palette-list","aria-activedescendant":_[l.selectedIndex]?`nice-cmd-${_[l.selectedIndex].command.id}`:void 0})}),e.jsxs("div",{ref:w,id:"nice-command-palette-list",className:"nice-command-palette__list",role:"listbox",children:[_.length===0&&e.jsx("div",{className:"nice-command-palette__empty",children:f}),Array.from(S.entries()).map(([a,C])=>e.jsxs("div",{className:"nice-command-palette__group",children:[e.jsx("div",{className:"nice-command-palette__category",children:a}),C.map(h=>{const D=E++,R=D===l.selectedIndex;return e.jsxs("div",{id:`nice-cmd-${h.command.id}`,className:`nice-command-palette__item ${R?"nice-command-palette__item--selected":""} ${h.command.disabled?"nice-command-palette__item--disabled":""}`,role:"option","aria-selected":R,"aria-disabled":h.command.disabled,onClick:()=>!h.command.disabled&&T(h.command.id),onMouseEnter:()=>v({type:"SET_SELECTED",index:D}),children:[h.command.icon&&e.jsx("span",{className:"nice-command-palette__icon",children:h.command.icon}),e.jsxs("div",{className:"nice-command-palette__label-group",children:[e.jsx("span",{className:"nice-command-palette__label",children:h.match&&l.query?Ee(h.command.label,h.match.indices):h.command.label}),h.command.description&&e.jsx("span",{className:"nice-command-palette__description",children:h.command.description})]}),h.command.shortcut&&e.jsx("kbd",{className:"nice-command-palette__shortcut",children:h.command.shortcut}),h.isRecent&&e.jsx("span",{className:"nice-command-palette__recent-badge",children:"Recent"})]},h.command.id)})]},a))]}),M&&e.jsx("div",{className:"nice-command-palette__executing",children:"Executing..."})]})})]})};Re.displayName="NiceCommandPaletteProvider";function gt(t){const{registerCommands:i,unregisterCommand:o}=Se();n.useEffect(()=>(i(t),()=>{for(const r of t)o(r.id)}),[])}const Me=n.forwardRef(({blocked:t,message:i,children:o,className:r,style:m,id:u},f)=>{const g=F.ks(u);return e.jsxs("div",{ref:f,id:g,className:`nice-block-ui ${r||""}`,style:{position:"relative",...m},children:[o,t&&e.jsx("div",{className:"nice-block-ui__overlay","aria-busy":"true",role:"alert",children:i&&e.jsx("div",{className:"nice-block-ui__message",children:i})})]})});Me.displayName="NiceBlockUI";const Ie=n.forwardRef(({windows:t,children:i,onChange:o,onClose:r,onFocus:m,showTaskbar:u=!0,size:f="md",className:g,style:p,id:k,...l},v)=>{const $=F.ks(k),{t:w}=F.$o(),[M,x]=n.useState(null),P=n.useRef(null),s=t??[],b=Math.max(1,...s.map(c=>c.zIndex??1)),d=n.useCallback((c,y)=>{const S=s.map(E=>E.key===c?{...E,...y}:E);o?.(S)},[s,o]),j=n.useCallback(c=>{d(c,{zIndex:b+1}),m?.(c)},[d,b,m]),I=n.useCallback(c=>{r?.(c),o?.(s.filter(y=>y.key!==c))},[s,o,r]),q=n.useCallback(c=>{const y=s.find(S=>S.key===c);y&&d(c,{minimized:!y.minimized,maximized:!1})},[s,d]),_=n.useCallback(c=>{const y=s.find(S=>S.key===c);y&&d(c,{maximized:!y.maximized,minimized:!1})},[s,d]);n.useEffect(()=>{if(!M)return;const c=S=>{const E=s.find(a=>a.key===M.key);if(E)if(M.mode==="move")d(M.key,{x:S.clientX-M.offsetX,y:S.clientY-M.offsetY});else{const C=P.current?.getBoundingClientRect(),h=C?.left??0,D=C?.top??0;d(M.key,{width:Math.max(200,S.clientX-h-E.x),height:Math.max(100,S.clientY-D-E.y)})}},y=()=>x(null);return document.addEventListener("mousemove",c),document.addEventListener("mouseup",y),()=>{document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",y)}},[M,s,d]);const T=n.useCallback((c,y,S)=>{y.preventDefault();const E=s.find(a=>a.key===c);E&&(j(c),x({key:c,offsetX:S==="move"?y.clientX-E.x:0,offsetY:S==="move"?y.clientY-E.y:0,mode:S}))},[s,j]);return e.jsxs("div",{ref:c=>{P.current=c,typeof v=="function"?v(c):v&&(v.current=c)},id:$,className:`nice-wm nice-wm--${f} ${g??""}`,style:{...p,position:"relative",overflow:"hidden"},...l,children:[s.map(c=>{if(c.minimized)return null;const y=c.maximized,S=y?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:c.zIndex??1}:{position:"absolute",top:c.y,left:c.x,width:c.width,height:c.height,zIndex:c.zIndex??1};return e.jsxs("div",{className:`nice-wm__window ${y?"nice-wm__window--maximized":""}`,style:S,onMouseDown:()=>j(c.key),role:"dialog","aria-label":c.title,children:[e.jsxs("div",{className:"nice-wm__titlebar",onMouseDown:E=>!y&&T(c.key,E,"move"),children:[c.icon&&e.jsx("span",{className:"nice-wm__icon",children:c.icon}),e.jsx("span",{className:"nice-wm__title",children:c.title}),e.jsxs("div",{className:"nice-wm__controls",children:[(c.minimizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--min",onClick:()=>q(c.key),title:w("wm.minimize","Minimize"),children:"─"}),(c.maximizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--max",onClick:()=>_(c.key),title:w("wm.maximize","Maximize"),children:y?"❐":"☐"}),(c.closable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--close",onClick:()=>I(c.key),title:w("wm.close","Close"),children:"✕"})]})]}),e.jsx("div",{className:"nice-wm__body",children:c.content}),(c.resizable??!0)&&!y&&e.jsx("div",{className:"nice-wm__resize-handle",onMouseDown:E=>T(c.key,E,"resize")})]},c.key)}),t===void 0&&i,u&&e.jsx("div",{className:"nice-wm__taskbar",role:"toolbar","aria-label":w("wm.taskbar","Taskbar"),children:s.map(c=>e.jsxs("button",{type:"button",className:`nice-wm__taskbar-btn ${c.minimized?"nice-wm__taskbar-btn--minimized":""}`,onClick:()=>{c.minimized&&q(c.key),j(c.key)},children:[c.icon&&e.jsx("span",{className:"nice-wm__taskbar-icon",children:c.icon}),e.jsx("span",{className:"nice-wm__taskbar-label",children:c.title})]},c.key))})]})});Ie.displayName="NiceWindowManager";function bt(t,i){const o=document.querySelector(t);if(!o)return null;const r=o.getBoundingClientRect();return{top:r.top-i+window.scrollY,left:r.left-i+window.scrollX,width:r.width+i*2,height:r.height+i*2}}function vt(t,i,o,r){const u={w:window.innerWidth,h:window.innerHeight+window.scrollY},f={top:{top:t.top-o-12,left:t.left+t.width/2-i/2},bottom:{top:t.top+t.height+12,left:t.left+t.width/2-i/2},left:{top:t.top+t.height/2-o/2,left:t.left-i-12},right:{top:t.top+t.height/2-o/2,left:t.left+t.width+12}};if(r&&r!=="auto")return{...f[r],actualPlacement:r};for(const g of["bottom","top","right","left"]){const p=f[g];if(p.top>=0&&p.left>=0&&p.top+o<=u.h&&p.left+i<=u.w)return{...p,actualPlacement:g}}return{...f.bottom,actualPlacement:"bottom"}}const ye=({steps:t,active:i,onFinish:o,onSkip:r,onStepChange:m,closeOnEscape:u=!0,closeOnOverlayClick:f=!1,showProgress:g=!0,showSkipButton:p=!0,labels:k,animationDuration:l=300,overlayOpacity:v=.6,zIndex:$=1e4})=>{const[w,M]=n.useState(0),[x,P]=n.useState(null),[s,b]=n.useState({w:340,h:200}),[d,j]=n.useState(!0),I=n.useRef(null),q=n.useRef(-1),_=t[w],T=w===t.length-1,c=w===0,y=k?.next??"Next",S=k?.back??"Back",E=k?.finish??"Finish",a=k?.skip??"Skip",C=k?.stepOf??"of";n.useEffect(()=>{if(I.current){const z=I.current.getBoundingClientRect();b({w:z.width,h:z.height})}},[w,i]),n.useEffect(()=>{if(!i||!_)return;const z=()=>{const Y=bt(_.target,_.highlightPadding??8);P(Y)};if(z(),_.scrollIntoView!==!1){document.querySelector(_.target)?.scrollIntoView({behavior:"smooth",block:"center"});const oe=setTimeout(z,350);return()=>clearTimeout(oe)}},[i,_,w]),n.useEffect(()=>{!i||!_||q.current!==w&&(q.current>=0&&q.current<t.length&&t[q.current]?.onLeave?.(),_.onEnter?.(),q.current=w)},[i,_,w,t]),n.useEffect(()=>{if(!i||!_?.advanceOn)return;const z=document.querySelector(_.target);if(!z)return;const Y=()=>h();return z.addEventListener(_.advanceOn.event,Y),()=>z.removeEventListener(_.advanceOn.event,Y)},[i,_,w]),n.useEffect(()=>{if(!i)return;const z=Y=>{Y.key==="Escape"&&u?r?.():Y.key==="ArrowRight"?h():Y.key==="ArrowLeft"&&D()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i,w,u]),n.useEffect(()=>{j(!0);const z=setTimeout(()=>j(!1),l);return()=>clearTimeout(z)},[w,l]);const h=n.useCallback(()=>{if(T)_?.onLeave?.(),o?.();else{const z=w+1;M(z),m?.(z)}},[w,T,o,m,_]),D=n.useCallback(()=>{if(!c){const z=w-1;M(z),m?.(z)}},[w,c,m]),R=n.useMemo(()=>x?vt(x,s.w,s.h,_?.placement):{top:window.innerHeight/2,left:window.innerWidth/2,actualPlacement:"bottom"},[x,s,_?.placement]);if(!i||!_)return null;const K=Math.max(document.documentElement.scrollWidth,window.innerWidth),ce=Math.max(document.documentElement.scrollHeight,window.innerHeight);return e.jsxs("div",{className:"nice-tutorial",style:{zIndex:$},"aria-modal":"true",role:"dialog","aria-label":"Tutorial",children:[e.jsxs("svg",{className:"nice-tutorial__overlay",style:{position:"absolute",top:0,left:0,width:K,height:ce,pointerEvents:"auto"},onClick:f?r: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"}),x&&e.jsx("rect",{x:x.left,y:x.top,width:x.width,height:x.height,rx:"8",fill:"black",className:d?"nice-tutorial__spotlight--entering":""})]})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`rgba(0,0,0,${v})`,mask:"url(#nice-tutorial-mask)"})]}),x&&e.jsx("div",{className:`nice-tutorial__highlight ${d?"nice-tutorial__highlight--entering":""}`,style:{position:"absolute",top:x.top,left:x.left,width:x.width,height:x.height,transition:`all ${l}ms ease`}}),_.disableInteraction&&x&&e.jsx("div",{className:"nice-tutorial__blocker",style:{position:"absolute",top:x.top,left:x.left,width:x.width,height:x.height}}),e.jsxs("div",{ref:I,className:`nice-tutorial__tooltip nice-tutorial__tooltip--${R.actualPlacement} ${d?"nice-tutorial__tooltip--entering":""}`,style:{position:"absolute",top:R.top,left:R.left,transition:`all ${l}ms ease`,maxWidth:380,zIndex:$+1},children:[_.showArrow!==!1&&e.jsx("div",{className:`nice-tutorial__arrow nice-tutorial__arrow--${R.actualPlacement}`}),e.jsxs("div",{className:"nice-tutorial__header",children:[e.jsx("h4",{className:"nice-tutorial__title",children:_.title}),p&&e.jsx("button",{type:"button",className:"nice-tutorial__close",onClick:r,"aria-label":a,children:"✕"})]}),e.jsx("div",{className:"nice-tutorial__content",dangerouslySetInnerHTML:{__html:F.gs(_.content)}}),e.jsxs("div",{className:"nice-tutorial__footer",children:[g&&e.jsxs("div",{className:"nice-tutorial__progress",children:[t.map((z,Y)=>e.jsx("span",{className:`nice-tutorial__dot ${Y===w?"nice-tutorial__dot--active":""} ${Y<w?"nice-tutorial__dot--done":""}`},Y)),e.jsxs("span",{className:"nice-tutorial__step-label",children:[w+1," ",C," ",t.length]})]}),e.jsxs("div",{className:"nice-tutorial__actions",children:[p&&!T&&e.jsx("button",{type:"button",className:"nice-tutorial__btn nice-tutorial__btn--skip",onClick:r,children:a}),!c&&e.jsx("button",{type:"button",className:"nice-tutorial__btn nice-tutorial__btn--back",onClick:D,children:S}),!_.waitForAction&&e.jsx("button",{type:"button",className:"nice-tutorial__btn nice-tutorial__btn--next",onClick:h,children:T?E:y})]})]})]})]})};ye.displayName="NiceTutorial";const Le=n.createContext({startTutorial:()=>{},stopTutorial:()=>{},isActive:!1,currentStep:0,nextStep:()=>{},prevStep:()=>{},goToStep:()=>{}});function yt(){return n.useContext(Le)}const Te=({children:t})=>{const[i,o]=n.useState([]),[r,m]=n.useState(!1),[u,f]=n.useState(0),g=n.useCallback(w=>{o(w),f(0),m(!0)},[]),p=n.useCallback(()=>{m(!1),f(0),o([])},[]),k=n.useCallback(()=>{f(w=>Math.min(w+1,i.length-1))},[i.length]),l=n.useCallback(()=>{f(w=>Math.max(w-1,0))},[]),v=n.useCallback(w=>{f(Math.max(0,Math.min(w,i.length-1)))},[i.length]),$={startTutorial:g,stopTutorial:p,isActive:r,currentStep:u,nextStep:k,prevStep:l,goToStep:v};return e.jsxs(Le.Provider,{value:$,children:[t,r&&i.length>0&&e.jsx(ye,{steps:i,active:r,onFinish:p,onSkip:p,onStepChange:f})]})};Te.displayName="NiceTutorialProvider";function Nt(t,i,o,r,m){const u=t<=m,f=t+m>=o,g=i<=m,p=i+m>=r;return g&&u?"top-left":g&&f?"top-right":p&&u?"bottom-left":p&&f?"bottom-right":u?"left":f?"right":g?"top":p?"bottom":"none"}function kt(t){switch(t){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 $e=n.forwardRef(({windowKey:t,title:i,icon:o,children:r,footer:m,x:u,y:f,defaultPosition:g,width:p=480,height:k=360,minWidth:l=200,minHeight:v=120,maxWidth:$,maxHeight:w,zIndex:M=1,closable:x=!0,minimizable:P=!0,maximizable:s=!0,fullscreenable:b=!1,pinnable:d=!1,resizable:j=!0,draggable:I=!0,snappable:q=!0,snapThreshold:_=20,minimized:T,maximized:c,fullscreen:y,pinned:S,focused:E,onClose:a,onMinimize:C,onMaximize:h,onFullscreen:D,onPin:R,onFocus:K,onMove:ce,onResize:z,onSnap:Y,onTitleBarDoubleClick:oe,size:Pe="md",statusBar:Ne,titleBarActions:De,className:Ye,style:Xe,id:ke,accessMode:qe,...Oe},Ae)=>{const Be=F.ks(ke),We=F._s(qe,ke),{t:re}=F.$o(),we=n.useRef(null);we.current==null&&(we.current=`nice-window-${Math.random().toString(36).slice(2,10)}`);const X=t??we.current,Fe=u??g?.x??100,Ue=f??g?.y??100;if(We==="hidden")return null;const[me,ie]=n.useState({x:Fe,y:Ue}),[he,fe]=n.useState({width:p,height:k}),[He,Ke]=n.useState(!1),[Ge,Ve]=n.useState(!1),[Qe,Ze]=n.useState(!1),[Je,et]=n.useState(!1),[U,xe]=n.useState("none"),tt=T??He,W=c??Ge,A=y??Qe,le=S??Je,_e=E??!0,te=me.x,ne=me.y,G=he.width,V=he.height,Q=n.useRef(null),B=n.useRef(null),L=n.useRef(null),nt=n.useCallback(()=>{a?.(X)},[X,a]),it=n.useCallback(()=>{Ke(!0),C?.(X)},[X,C]),ge=n.useCallback(()=>{const N=!W;Ve(N),!N&&L.current?(ie({x:L.current.x,y:L.current.y}),fe({width:L.current.w,height:L.current.h}),L.current=null):N&&(L.current={x:te,y:ne,w:G,h:V}),xe("none"),h?.(X,N)},[X,W,te,ne,G,V,h]),be=n.useCallback(()=>{const N=!A;Ze(N),N?L.current={x:te,y:ne,w:G,h:V}:L.current&&(ie({x:L.current.x,y:L.current.y}),fe({width:L.current.w,height:L.current.h}),L.current=null),D?.(X,N)},[X,A,te,ne,G,V,D]),st=n.useCallback(()=>{const N=!le;et(N),R?.(X,N)},[X,le,R]),ae=n.useCallback(()=>{K?.(X)},[X,K]),ct=n.useCallback(()=>{oe?oe(X):s&&ge()},[X,s,ge,oe]);n.useEffect(()=>{const N=Z=>{if(!Q.current)return;const H=Z.clientX-Q.current.startX+Q.current.origX,de=Z.clientY-Q.current.startY+Q.current.origY;ie({x:H,y:de}),ce?.(X,{x:H,y:de})},O=Z=>{if(Q.current){if(q){const H=Nt(Z.clientX,Z.clientY,window.innerWidth,window.innerHeight,_);H!=="none"&&(L.current={x:me.x,y:me.y,w:G,h:V},xe(H),Y?.(X,H))}Q.current=null}};return document.addEventListener("mousemove",N),document.addEventListener("mouseup",O),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",O)}});const ot=n.useCallback(N=>{!I||W||A||(N.preventDefault(),U!=="none"&&(L.current&&(ie({x:L.current.x,y:L.current.y}),fe({width:L.current.w,height:L.current.h})),xe("none")),ae(),Q.current={startX:N.clientX,startY:N.clientY,origX:te,origY:ne})},[I,W,A,U,te,ne,ae]);n.useEffect(()=>{const N=Z=>{if(!B.current)return;const H=Z.clientX-B.current.startX,de=Z.clientY-B.current.startY,se=B.current.handle;let J=B.current.origW,ee=B.current.origH;if(se.includes("e")&&(J=B.current.origW+H),se.includes("w")&&(J=B.current.origW-H),se.includes("s")&&(ee=B.current.origH+de),se.includes("n")&&(ee=B.current.origH-de),J=Math.max(l,$?Math.min($,J):J),ee=Math.max(v,w?Math.min(w,ee):ee),se.includes("w")){const ve=he.width-J;ie(ue=>({...ue,x:ue.x+ve}))}if(se.includes("n")){const ve=he.height-ee;ie(ue=>({...ue,y:ue.y+ve}))}fe({width:J,height:ee}),z?.(X,{width:J,height:ee})},O=()=>{B.current=null};return document.addEventListener("mousemove",N),document.addEventListener("mouseup",O),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",O)}});const rt=n.useCallback((N,O)=>{!j||W||A||U!=="none"||(O.preventDefault(),O.stopPropagation(),ae(),B.current={startX:O.clientX,startY:O.clientY,origW:G,origH:V,handle:N})},[j,W,A,U,G,V,ae]);if(n.useEffect(()=>{if(!_e)return;const N=O=>{O.key==="Escape"&&A&&be()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[_e,A,be]),tt)return null;const je=U!=="none"?kt(U):null,Ce=W||A,lt=A?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:999999}:W?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:M}:je?{position:"absolute",...je,zIndex:M}:{position:"absolute",top:ne,left:te,width:G,height:V,zIndex:M},at=["n","e","s","w","ne","se","sw","nw"],dt={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"};return e.jsxs("div",{ref:Ae,id:Be,className:`nice-window nice-window--${Pe} ${_e?"nice-window--focused":""} ${le?"nice-window--pinned":""} ${Ce?"nice-window--maximized":""} ${U!=="none"?`nice-window--snapped-${U}`:""} ${Ye??""}`,style:{...lt,...Xe},onMouseDown:ae,role:"dialog","aria-label":i,...Oe,children:[e.jsxs("div",{className:"nice-window__titlebar",onMouseDown:ot,onDoubleClick:ct,children:[o&&e.jsx("span",{className:"nice-window__icon",children:o}),e.jsx("span",{className:"nice-window__title",children:i}),e.jsxs("div",{className:"nice-window__actions",children:[De,d&&e.jsx("button",{type:"button",className:`nice-window__action nice-window__action--pin ${le?"nice-window__action--active":""}`,onClick:st,title:re("window.pin",le?"Unpin":"Pin"),children:"📌"}),P&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--minimize",onClick:it,title:re("window.minimize","Minimize"),children:"─"}),s&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--maximize",onClick:ge,title:re("window.maximize",W?"Restore":"Maximize"),children:W?"❐":"☐"}),b&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--fullscreen",onClick:be,title:re("window.fullscreen",A?"Exit Full Screen":"Full Screen"),children:A?"⇲":"⇱"}),x&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--close",onClick:nt,title:re("window.close","Close"),children:"✕"})]})]}),e.jsx("div",{className:"nice-window__body",children:r}),m&&e.jsx("div",{className:"nice-window__footer",children:m}),Ne&&e.jsx("div",{className:"nice-window__statusbar",children:Ne}),j&&!Ce&&U==="none"&&e.jsx(e.Fragment,{children:at.map(N=>e.jsx("div",{className:`nice-window__resize nice-window__resize--${N}`,style:{cursor:dt[N]},onMouseDown:O=>rt(N,O)},N))})]})});$e.displayName="NiceWindow";exports.NiceActionSheet=ut;exports.NiceBlockUI=Me;exports.NiceBox=ft;exports.NiceCommandPaletteProvider=Re;exports.NiceLoadPanel=ht;exports.NicePopover=mt;exports.NiceResizable=wt;exports.NiceResponsiveBox=pt;exports.NiceScrollView=xt;exports.NiceTutorial=ye;exports.NiceTutorialProvider=Te;exports.NiceWindow=$e;exports.NiceWindowManager=Ie;exports.fuzzyMatch=pe;exports.highlightMatches=Ee;exports.useCommandPalette=Se;exports.useNiceTutorial=yt;exports.useRegisterCommands=gt;
|