@nice2dev/ui 1.0.19 → 1.0.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 +105 -0
- package/dist/NiceErrorBoundary-B9UWIYPz.js +770 -0
- package/dist/NiceErrorBoundary-Bzx-bOeb.cjs +1 -0
- package/dist/NiceErrorBoundary-CFJh1FyM.js +770 -0
- package/dist/NiceErrorBoundary-DvA00DOz.cjs +1 -0
- package/dist/NiceErrorBoundary-XNceAa-3.cjs +1 -0
- package/dist/NiceErrorBoundary-eTwBEuSH.js +770 -0
- package/dist/NiceErrorBoundary-qp4IJ18o.js +770 -0
- package/dist/NiceErrorBoundary-uT48n_F7.cjs +1 -0
- package/dist/NiceForm-B1Okz7SW.cjs +382 -0
- package/dist/NiceForm-BE8vt5k6.js +5383 -0
- package/dist/NiceForm-BXHPoTcH.cjs +382 -0
- package/dist/NiceForm-BzKlOWJa.js +5383 -0
- package/dist/NiceForm-DL7Kxsi2.js +5383 -0
- package/dist/NiceForm-DYPj-XoP.cjs +382 -0
- package/dist/NiceForm-DZ8jwtA8.cjs +382 -0
- package/dist/NiceForm-D_XZxq3a.js +5383 -0
- package/dist/NiceForm.css +1 -1
- package/dist/NiceModal-0Sg2HxIb.cjs +1 -0
- package/dist/NiceModal-BOkmGqPj.cjs +1 -0
- package/dist/NiceModal-BRih_XEH.js +95 -0
- package/dist/NiceModal-C-yKNnig.cjs +1 -0
- package/dist/NiceModal-C4HIsjrn.js +95 -0
- package/dist/NiceModal-DSabJ81z.js +95 -0
- package/dist/NiceModal-DieswZtd.cjs +1 -0
- package/dist/NiceModal-DjN1yXgw.js +95 -0
- package/dist/NiceModuleLifecyclePanel-95lS8pXO.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-C4jlm9tl.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-CEfeJxw_.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel-D4xWUswk.js +6777 -0
- package/dist/NiceModuleLifecyclePanel-L5FNYzF9.js +6781 -0
- package/dist/NiceModuleLifecyclePanel-LdYOMLA6.js +6777 -0
- package/dist/NiceModuleLifecyclePanel-jDzEfvDM.js +6553 -0
- package/dist/NiceModuleLifecyclePanel-sBJLlhJp.cjs +1 -0
- package/dist/NiceModuleLifecyclePanel.css +1 -1
- package/dist/NicePagination-B2TC6MTL.cjs +1 -0
- package/dist/NicePagination-BAywVGwT.js +171 -0
- package/dist/NicePagination-BT8UWXYG.js +171 -0
- package/dist/NicePagination-CJqksuAl.cjs +1 -0
- package/dist/NicePagination-CiWxbXT9.cjs +1 -0
- package/dist/NicePagination-DnnypBiE.js +171 -0
- package/dist/NicePagination-F8NyMfgc.cjs +1 -0
- package/dist/NicePagination-d6vm1ce3.js +171 -0
- package/dist/NicePinCodeInput-BY_tgKaU.cjs +419 -0
- package/dist/NicePinCodeInput-Bo8Ahkae.js +12240 -0
- package/dist/NicePinCodeInput-CpPtHZsK.js +12240 -0
- package/dist/NicePinCodeInput-Cpa01Yfg.cjs +419 -0
- package/dist/NicePinCodeInput-DDK6qqFW.js +12240 -0
- package/dist/NicePinCodeInput-DdXTdocN.js +12240 -0
- package/dist/NicePinCodeInput-JvYd_LB_.cjs +419 -0
- package/dist/NicePinCodeInput-qAO9tRhm.cjs +419 -0
- package/dist/NiceSavedQueryPanel-BOBULytX.js +6455 -0
- package/dist/NiceSavedQueryPanel-CTfC-qwV.cjs +596 -0
- package/dist/NiceSavedQueryPanel-CpcjQZDl.cjs +596 -0
- package/dist/NiceSavedQueryPanel-Dryck7pv.js +6584 -0
- package/dist/NiceSavedQueryPanel-DtgcsEls.js +6584 -0
- package/dist/NiceSavedQueryPanel-DuonbEem.js +6584 -0
- package/dist/NiceSavedQueryPanel-MdKdGYNg.cjs +596 -0
- package/dist/NiceSavedQueryPanel-TUoWkvpW.cjs +596 -0
- package/dist/NiceTabs-BjBtazRn.cjs +1 -0
- package/dist/NiceTabs-C-VQXNIa.cjs +1 -0
- package/dist/NiceTabs-CJ8G2t0-.js +1657 -0
- package/dist/NiceTabs-D91-vW_P.js +1657 -0
- package/dist/NiceTabs-DirTIQjD.cjs +1 -0
- package/dist/NiceTabs-dwNCzbJ2.cjs +1 -0
- package/dist/NiceTabs-nQEYYbsV.js +1657 -0
- package/dist/NiceTabs-v7HfeXIw.js +1657 -0
- package/dist/NiceWindow-BMiF-so6.cjs +1 -0
- package/dist/NiceWindow-C677O__r.js +1418 -0
- package/dist/NiceWindow-CmgJGE4d.js +1418 -0
- package/dist/NiceWindow-CysIgnn3.js +1418 -0
- package/dist/NiceWindow-D6SjpDc4.cjs +1 -0
- package/dist/NiceWindow-DUTRQOaP.js +1418 -0
- package/dist/NiceWindow-D_h01zyu.cjs +1 -0
- package/dist/NiceWindow-fcTJOlYf.cjs +1 -0
- package/dist/charts-8Bqzj1TE.js +4657 -0
- package/dist/charts-CFn-7PzC.cjs +761 -0
- package/dist/charts-CJlMAHJG.cjs +761 -0
- package/dist/charts-CLbJ4Zjq.js +4657 -0
- package/dist/charts-CUMpSAQe.cjs +761 -0
- package/dist/charts-CX4jiyVh.cjs +761 -0
- package/dist/charts-CYpqDxHd.js +4657 -0
- package/dist/charts-P6qura0j.js +4657 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +1 -1
- package/dist/core-BFu5opn6.js +23131 -0
- package/dist/core-BfeyB9A8.cjs +96 -0
- package/dist/core-BgGSTko-.js +22401 -0
- package/dist/core-Bit5kLWQ.cjs +96 -0
- package/dist/core-D0ElqRZA.cjs +96 -0
- package/dist/core-DDJKu5LZ.cjs +96 -0
- package/dist/core-DICON6Z7.js +23129 -0
- package/dist/core-XsWxyBHD.js +22767 -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-WxtREy.js +65040 -0
- package/dist/index-ByDRtfrm.js +65050 -0
- package/dist/index-CQIDqjZp.cjs +5194 -0
- package/dist/index-CXVXf_HY.cjs +5194 -0
- package/dist/index-CtikFbFa.js +64337 -0
- package/dist/index-DnfPyuXA.cjs +5194 -0
- package/dist/index-DxO61OUF.cjs +5194 -0
- package/dist/index-xVJiF843.js +65040 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +294 -5
- package/dist/index.mjs +875 -861
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +3 -3
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +35 -2
- package/dist/navigation.mjs +22 -22
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +2 -2
- package/dist/style.css +3 -3
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),U=require("./core-BfeyB9A8.cjs"),n=require("react"),ut=({visible:t,onClose:i,title:s,items:r,showCancelButton:h=!0,cancelText:m,className:f,style:g})=>{const{t:p}=U.$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:[s&&e.jsx("div",{className:"nice-actionsheet__title",children:s}),e.jsx("div",{className:"nice-actionsheet__items",children:r.map((k,a)=>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]},a))}),h&&e.jsx("button",{className:"nice-actionsheet__cancel",onClick:i,children:m||p("cancel","Cancel")})]})]}):null},mt=({visible:t,onClose:i,targetRef:s,position:r="bottom",title:h,showArrow:m=!0,width:f,children:g,className:p,style:k,displayStyle:a})=>{U.Ss("tooltip",a);const y=n.useRef(null),[P,w]=n.useState({top:0,left:0}),I=n.useCallback(()=>{const x=s.current,D=y.current;if(!x||!D)return;const c=x.getBoundingClientRect(),b=D.getBoundingClientRect();let l=0,C=0;const L=8;switch(r){case"top":l=c.top-b.height-L,C=c.left+(c.width-b.width)/2;break;case"bottom":l=c.bottom+L,C=c.left+(c.width-b.width)/2;break;case"left":l=c.top+(c.height-b.height)/2,C=c.left-b.width-L;break;case"right":l=c.top+(c.height-b.height)/2,C=c.right+L;break}w({top:l+window.scrollY,left:C+window.scrollX})},[s,r]);return n.useEffect(()=>{if(t){requestAnimationFrame(I);const x=D=>{y.current&&!y.current.contains(D.target)&&s.current&&!s.current.contains(D.target)&&i()};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)}},[t,I,i,s]),t?e.jsxs("div",{ref:y,className:`nice-popover nice-popover--${r} ${p||""}`,style:{...k,position:"absolute",top:P.top,left:P.left,width:f},children:[m&&e.jsx("div",{className:`nice-popover__arrow nice-popover__arrow--${r}`}),h&&e.jsx("div",{className:"nice-popover__title",children:h}),e.jsx("div",{className:"nice-popover__content",children:g})]}):null},ht=({visible:t,message:i,container:s,showIndicator:r=!0,shading:h=!0,className:m,style:f})=>{const{t:g}=U.$o();if(!t)return null;const p=!!s?.current,k=e.jsxs("div",{className:`nice-loadpanel ${m||""}`,style:f,children:[h&&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&&s.current){const a=s.current;return a.style.position=a.style.position||"relative",k}return k},ft=({direction:t="row",align:i,justify:s,wrap:r,gap:h,flex:m,children:f,className:g,style:p})=>e.jsx("div",{className:`nice-box ${g||""}`,style:{display:"flex",flexDirection:t,alignItems:i,justifyContent:s,flexWrap:r?"wrap":void 0,gap:h,flex:m,...p},children:f}),pt=({direction:t="row",items:i,gap:s,className:r,style:h})=>e.jsx("div",{className:`nice-responsivebox ${r||""}`,style:{display:"flex",flexDirection:t,gap:s,...h},children:i.map((m,f)=>e.jsx("div",{style:{flex:m.ratio??1,flexBasis:m.baseSize,flexShrink:m.shrink??1},children:m.children},f))}),wt=({width:t=200,height:i=200,minWidth:s=50,minHeight:r=50,maxWidth:h=1/0,maxHeight:m=1/0,handles:f=["right","bottom","bottomRight"],onResize:g,children:p,className:k,style:a})=>{const[y,P]=n.useState({width:t,height:i}),w=n.useRef(null),I=(c,b)=>{b.preventDefault();const l=b.clientX,C=b.clientY,L=y.width,q=y.height,E={n:"top",s:"bottom",e:"right",w:"left",ne:"topRight",se:"bottomRight",sw:"bottomLeft",nw:"topLeft"}[c]??c,o=E==="right"||E==="topRight"||E==="bottomRight",j=E==="left"||E==="topLeft"||E==="bottomLeft",R=E==="bottom"||E==="bottomRight"||E==="bottomLeft",M=E==="top"||E==="topRight"||E==="topLeft",d=u=>{const T=u.clientX-l,S=u.clientY-C;let O=L,B=q;o&&(O=L+T),j&&(O=L-T),R&&(B=q+S),M&&(B=q-S),O=Math.max(s,Math.min(h,O)),B=Math.max(r,Math.min(m,B)),P({width:O,height:B}),g?.({width:O,height:B})},v=()=>{document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",v)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",v)},x=c=>{switch(c){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"}},D=c=>{const b={position:"absolute",zIndex:1},l=8;return c==="right"?{...b,top:0,right:-l/2,width:l,height:"100%",cursor:x(c)}:c==="bottom"?{...b,left:0,bottom:-l/2,width:"100%",height:l,cursor:x(c)}:c==="left"?{...b,top:0,left:-l/2,width:l,height:"100%",cursor:x(c)}:c==="top"?{...b,top:-l/2,left:0,width:"100%",height:l,cursor:x(c)}:c==="bottomRight"?{...b,bottom:-l/2,right:-l/2,width:l*2,height:l*2,cursor:x(c)}:c==="bottomLeft"?{...b,bottom:-l/2,left:-l/2,width:l*2,height:l*2,cursor:x(c)}:c==="topRight"?{...b,top:-l/2,right:-l/2,width:l*2,height:l*2,cursor:x(c)}:c==="topLeft"?{...b,top:-l/2,left:-l/2,width:l*2,height:l*2,cursor:x(c)}:b};return e.jsxs("div",{ref:w,className:`nice-resizable ${k||""}`,style:{...a,width:y.width,height:y.height,position:"relative",overflow:"hidden"},children:[p,f.map(c=>e.jsx("div",{style:D(c),onPointerDown:b=>I(c,b)},c))]})},xt=({direction:t="vertical",showScrollbar:i="onInteraction",width:s,height:r,onScroll:h,children:m,className:f,style:g})=>{const p=t==="horizontal"||t==="both"?"auto":"hidden",k=t==="vertical"||t==="both"?"auto":"hidden",a=i==="never"?"nice-scrollview--hide-sb":i==="always"?"nice-scrollview--show-sb":"";return e.jsx("div",{className:`nice-scrollview ${a} ${f||""}`,style:{...g,width:s,height:r,overflowX:p,overflowY:k},onScroll:h,children:m})};function pe(t,i){if(!t)return{score:1,indices:[]};const s=t.toLowerCase(),r=i.toLowerCase();let h=0;const m=[];let f=0,g=-1;for(let p=0;p<r.length&&h<s.length;p++)r[p]===s[h]&&(m.push(p),g===p-1&&(f+=3),(p===0||/[\s\-_/.]/.test(i[p-1]))&&(f+=5),i[p]===t[h]&&(f+=1),f+=1,g=p,h++);return h<s.length?null:(f-=m[0]*.1,{score:f,indices:m})}function Ee(t,i){if(i.length===0)return[t];const s=[];let r=0;const h=new Set(i);for(let m=0;m<t.length;m++)h.has(m)&&(r<m&&s.push(t.slice(r,m)),s.push(n.createElement("mark",{key:`m-${m}`,className:"nice-command-palette__match"},t[m])),r=m+1);return r<t.length&&s.push(t.slice(r)),s}function _t(t,i){switch(i.type){case"REGISTER":{const s=new Map(t.commands);return s.set(i.command.id,i.command),{...t,commands:s}}case"REGISTER_BATCH":{const s=new Map(t.commands);for(const r of i.commands)s.set(r.id,r);return{...t,commands:s}}case"UNREGISTER":{const s=new Map(t.commands);return s.delete(i.id),{...t,commands:s}}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 s=t.recentIds.filter(r=>r!==i.id);return{...t,recentIds:[i.id,...s].slice(0,i.maxRecent)}}default:return t}}const Se=n.createContext(null);function ze(){const t=n.useContext(Se);if(!t)throw new Error("useCommandPalette must be used within NiceCommandPaletteProvider");return t}const Re=({children:t,commands:i,placeholder:s="Type a command...",maxVisible:r=10,maxRecent:h=5,className:m,emptyText:f="No commands found",closeOnAction:g=!0,onOpen:p,onClose:k})=>{const[a,y]=n.useReducer(_t,{commands:new Map(i?.map(d=>[d.id,d])??[]),isOpen:!1,query:"",selectedIndex:0,recentIds:[]}),P=n.useRef(null),w=n.useRef(null),[I,x]=n.useState(!1),D=n.useCallback(d=>{y({type:"REGISTER",command:d})},[]),c=n.useCallback(d=>{y({type:"UNREGISTER",id:d})},[]),b=n.useCallback(d=>{y({type:"REGISTER_BATCH",commands:d})},[]),l=n.useCallback(()=>{y({type:"OPEN"}),p?.()},[p]),C=n.useCallback(()=>{y({type:"CLOSE"}),k?.()},[k]),L=n.useCallback(()=>{a.isOpen?C():l()},[a.isOpen,C,l]),_=n.useMemo(()=>{const d=Array.from(a.commands.values()).filter(u=>!u.hidden);if(!a.query.trim()){const u=a.recentIds.map(S=>a.commands.get(S)).filter(S=>!!S&&!S.hidden),T=d.filter(S=>!a.recentIds.includes(S.id));return T.sort((S,O)=>S.label.localeCompare(O.label)),[...u,...T].map(S=>({command:S,match:null,isRecent:a.recentIds.includes(S.id)}))}return d.map(u=>{const T=pe(a.query,u.label),S=u.description?pe(a.query,u.description):null,O=u.keywords?.map(z=>pe(a.query,z)).filter(Boolean)[0]??null,B=[T,S,O].filter(Boolean).sort((z,Y)=>(Y?.score??0)-(z?.score??0))[0];return{command:u,match:B,isRecent:!1}}).filter(u=>u.match!==null).sort((u,T)=>(T.match?.score??0)-(u.match?.score??0))},[a.commands,a.query,a.recentIds]).slice(0,r),E=n.useCallback(async d=>{const v=a.commands.get(d);if(!(!v||v.disabled)){x(!0);try{await v.action(),y({type:"ADD_RECENT",id:d,maxRecent:h})}finally{x(!1),g&&C()}}},[a.commands,h,g,C]);n.useEffect(()=>{const d=v=>{(v.metaKey||v.ctrlKey)&&v.key==="k"&&(v.preventDefault(),L()),v.key==="Escape"&&a.isOpen&&(v.preventDefault(),C())};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[L,a.isOpen,C]),n.useEffect(()=>{a.isOpen&&requestAnimationFrame(()=>P.current?.focus())},[a.isOpen]);const o=n.useCallback(d=>{const v=_.length;if(v){if(d.key==="ArrowDown")d.preventDefault(),y({type:"SET_SELECTED",index:(a.selectedIndex+1)%v});else if(d.key==="ArrowUp")d.preventDefault(),y({type:"SET_SELECTED",index:(a.selectedIndex-1+v)%v});else if(d.key==="Enter"){d.preventDefault();const u=_[a.selectedIndex];u&&E(u.command.id)}}},[_,a.selectedIndex,E]);n.useEffect(()=>{if(!w.current)return;w.current.children[a.selectedIndex]?.scrollIntoView({block:"nearest"})},[a.selectedIndex]);const j=n.useMemo(()=>({registerCommand:D,unregisterCommand:c,registerCommands:b,open:l,close:C,toggle:L,isOpen:a.isOpen,executeCommand:E}),[D,c,b,l,C,L,a.isOpen,E]),R=n.useMemo(()=>{const d=new Map;for(const v of _){const u=v.command.category??"General";d.has(u)||d.set(u,[]),d.get(u).push(v)}return d},[_]);let M=0;return e.jsxs(Se.Provider,{value:j,children:[t,a.isOpen&&e.jsx("div",{className:`nice-command-palette__overlay ${m??""}`,onClick:C,children:e.jsxs("div",{className:"nice-command-palette",role:"dialog","aria-label":"Command Palette","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsx("div",{className:"nice-command-palette__input-wrapper",children:e.jsx("input",{ref:P,className:"nice-command-palette__input",type:"text",placeholder:s,value:a.query,onChange:d=>y({type:"SET_QUERY",query:d.target.value}),onKeyDown:o,"aria-label":"Search commands","aria-autocomplete":"list","aria-controls":"nice-command-palette-list","aria-activedescendant":_[a.selectedIndex]?`nice-cmd-${_[a.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(R.entries()).map(([d,v])=>e.jsxs("div",{className:"nice-command-palette__group",children:[e.jsx("div",{className:"nice-command-palette__category",children:d}),v.map(u=>{const T=M++,S=T===a.selectedIndex;return e.jsxs("div",{id:`nice-cmd-${u.command.id}`,className:`nice-command-palette__item ${S?"nice-command-palette__item--selected":""} ${u.command.disabled?"nice-command-palette__item--disabled":""}`,role:"option","aria-selected":S,"aria-disabled":u.command.disabled,onClick:()=>!u.command.disabled&&E(u.command.id),onMouseEnter:()=>y({type:"SET_SELECTED",index:T}),children:[u.command.icon&&e.jsx("span",{className:"nice-command-palette__icon",children:u.command.icon}),e.jsxs("div",{className:"nice-command-palette__label-group",children:[e.jsx("span",{className:"nice-command-palette__label",children:u.match&&a.query?Ee(u.command.label,u.match.indices):u.command.label}),u.command.description&&e.jsx("span",{className:"nice-command-palette__description",children:u.command.description})]}),u.command.shortcut&&e.jsx("kbd",{className:"nice-command-palette__shortcut",children:u.command.shortcut}),u.isRecent&&e.jsx("span",{className:"nice-command-palette__recent-badge",children:"Recent"})]},u.command.id)})]},d))]}),I&&e.jsx("div",{className:"nice-command-palette__executing",children:"Executing..."})]})})]})};Re.displayName="NiceCommandPaletteProvider";function gt(t){const{registerCommands:i,unregisterCommand:s}=ze();n.useEffect(()=>(i(t),()=>{for(const r of t)s(r.id)}),[])}const Me=n.forwardRef(({blocked:t,message:i,children:s,className:r,style:h,id:m},f)=>{const g=U.Hs(m);return e.jsxs("div",{ref:f,id:g,className:`nice-block-ui ${r||""}`,style:{position:"relative",...h},children:[s,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:s,onClose:r,onFocus:h,showTaskbar:m=!0,size:f="md",className:g,style:p,id:k,...a},y)=>{const P=U.Hs(k),{t:w}=U.$o(),[I,x]=n.useState(null),D=n.useRef(null),c=t??[],b=Math.max(1,...c.map(o=>o.zIndex??1)),l=n.useCallback((o,j)=>{const R=c.map(M=>M.key===o?{...M,...j}:M);s?.(R)},[c,s]),C=n.useCallback(o=>{l(o,{zIndex:b+1}),h?.(o)},[l,b,h]),L=n.useCallback(o=>{r?.(o),s?.(c.filter(j=>j.key!==o))},[c,s,r]),q=n.useCallback(o=>{const j=c.find(R=>R.key===o);j&&l(o,{minimized:!j.minimized,maximized:!1})},[c,l]),_=n.useCallback(o=>{const j=c.find(R=>R.key===o);j&&l(o,{maximized:!j.maximized,minimized:!1})},[c,l]);n.useEffect(()=>{if(!I)return;const o=R=>{const M=c.find(d=>d.key===I.key);if(M)if(I.mode==="move")l(I.key,{x:R.clientX-I.offsetX,y:R.clientY-I.offsetY});else{const v=D.current?.getBoundingClientRect(),u=v?.left??0,T=v?.top??0;l(I.key,{width:Math.max(200,R.clientX-u-M.x),height:Math.max(100,R.clientY-T-M.y)})}},j=()=>x(null);return document.addEventListener("mousemove",o),document.addEventListener("mouseup",j),()=>{document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",j)}},[I,c,l]);const E=n.useCallback((o,j,R)=>{j.preventDefault();const M=c.find(d=>d.key===o);M&&(C(o),x({key:o,offsetX:R==="move"?j.clientX-M.x:0,offsetY:R==="move"?j.clientY-M.y:0,mode:R}))},[c,C]);return e.jsxs("div",{ref:o=>{D.current=o,typeof y=="function"?y(o):y&&(y.current=o)},id:P,className:`nice-wm nice-wm--${f} ${g??""}`,style:{...p,position:"relative",overflow:"hidden"},...a,children:[c.map(o=>{if(o.minimized)return null;const j=o.maximized,R=j?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:o.zIndex??1}:{position:"absolute",top:o.y,left:o.x,width:o.width,height:o.height,zIndex:o.zIndex??1};return e.jsxs("div",{className:`nice-wm__window ${j?"nice-wm__window--maximized":""}`,style:R,onMouseDown:()=>C(o.key),role:"dialog","aria-label":o.title,children:[e.jsxs("div",{className:"nice-wm__titlebar",onMouseDown:M=>!j&&E(o.key,M,"move"),children:[o.icon&&e.jsx("span",{className:"nice-wm__icon",children:o.icon}),e.jsx("span",{className:"nice-wm__title",children:o.title}),e.jsxs("div",{className:"nice-wm__controls",children:[(o.minimizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--min",onClick:()=>q(o.key),title:w("wm.minimize","Minimize"),children:"─"}),(o.maximizable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--max",onClick:()=>_(o.key),title:w("wm.maximize","Maximize"),children:j?"❐":"☐"}),(o.closable??!0)&&e.jsx("button",{type:"button",className:"nice-wm__ctrl-btn nice-wm__ctrl-btn--close",onClick:()=>L(o.key),title:w("wm.close","Close"),children:"✕"})]})]}),e.jsx("div",{className:"nice-wm__body",children:o.content}),(o.resizable??!0)&&!j&&e.jsx("div",{className:"nice-wm__resize-handle",onMouseDown:M=>E(o.key,M,"resize")})]},o.key)}),t===void 0&&i,m&&e.jsx("div",{className:"nice-wm__taskbar",role:"toolbar","aria-label":w("wm.taskbar","Taskbar"),children:c.map(o=>e.jsxs("button",{type:"button",className:`nice-wm__taskbar-btn ${o.minimized?"nice-wm__taskbar-btn--minimized":""}`,onClick:()=>{o.minimized&&q(o.key),C(o.key)},children:[o.icon&&e.jsx("span",{className:"nice-wm__taskbar-icon",children:o.icon}),e.jsx("span",{className:"nice-wm__taskbar-label",children:o.title})]},o.key))})]})});Ie.displayName="NiceWindowManager";function bt(t,i){const s=document.querySelector(t);if(!s)return null;const r=s.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,s,r){const m={w:window.innerWidth,h:window.innerHeight+window.scrollY},f={top:{top:t.top-s-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-s/2,left:t.left-i-12},right:{top:t.top+t.height/2-s/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+s<=m.h&&p.left+i<=m.w)return{...p,actualPlacement:g}}return{...f.bottom,actualPlacement:"bottom"}}const ye=({steps:t,active:i,onFinish:s,onSkip:r,onStepChange:h,closeOnEscape:m=!0,closeOnOverlayClick:f=!1,showProgress:g=!0,showSkipButton:p=!0,labels:k,animationDuration:a=300,overlayOpacity:y=.6,zIndex:P=1e4})=>{const[w,I]=n.useState(0),[x,D]=n.useState(null),[c,b]=n.useState({w:340,h:200}),[l,C]=n.useState(!0),L=n.useRef(null),q=n.useRef(-1),_=t[w],E=w===t.length-1,o=w===0,j=k?.next??"Next",R=k?.back??"Back",M=k?.finish??"Finish",d=k?.skip??"Skip",v=k?.stepOf??"of";n.useEffect(()=>{if(L.current){const z=L.current.getBoundingClientRect();b({w:z.width,h:z.height})}},[w,i]),n.useEffect(()=>{if(!i||!_)return;const z=()=>{const Y=bt(_.target,_.highlightPadding??8);D(Y)};if(z(),_.scrollIntoView!==!1){document.querySelector(_.target)?.scrollIntoView({behavior:"smooth",block:"center"});const ce=setTimeout(z,350);return()=>clearTimeout(ce)}},[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=()=>u();return z.addEventListener(_.advanceOn.event,Y),()=>z.removeEventListener(_.advanceOn.event,Y)},[i,_,w]),n.useEffect(()=>{if(!i)return;const z=Y=>{Y.key==="Escape"&&m?r?.():Y.key==="ArrowRight"?u():Y.key==="ArrowLeft"&&T()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i,w,m]),n.useEffect(()=>{C(!0);const z=setTimeout(()=>C(!1),a);return()=>clearTimeout(z)},[w,a]);const u=n.useCallback(()=>{if(E)_?.onLeave?.(),s?.();else{const z=w+1;I(z),h?.(z)}},[w,E,s,h,_]),T=n.useCallback(()=>{if(!o){const z=w-1;I(z),h?.(z)}},[w,o,h]),S=n.useMemo(()=>x?vt(x,c.w,c.h,_?.placement):{top:window.innerHeight/2,left:window.innerWidth/2,actualPlacement:"bottom"},[x,c,_?.placement]);if(!i||!_)return null;const O=Math.max(document.documentElement.scrollWidth,window.innerWidth),B=Math.max(document.documentElement.scrollHeight,window.innerHeight);return e.jsxs("div",{className:"nice-tutorial",style:{zIndex:P},"aria-modal":"true",role:"dialog","aria-label":"Tutorial",children:[e.jsxs("svg",{className:"nice-tutorial__overlay",style:{position:"absolute",top:0,left:0,width:O,height:B,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:l?"nice-tutorial__spotlight--entering":""})]})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`rgba(0,0,0,${y})`,mask:"url(#nice-tutorial-mask)"})]}),x&&e.jsx("div",{className:`nice-tutorial__highlight ${l?"nice-tutorial__highlight--entering":""}`,style:{position:"absolute",top:x.top,left:x.left,width:x.width,height:x.height,transition:`all ${a}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:L,className:`nice-tutorial__tooltip nice-tutorial__tooltip--${S.actualPlacement} ${l?"nice-tutorial__tooltip--entering":""}`,style:{position:"absolute",top:S.top,left:S.left,transition:`all ${a}ms ease`,maxWidth:380,zIndex:P+1},children:[_.showArrow!==!1&&e.jsx("div",{className:`nice-tutorial__arrow nice-tutorial__arrow--${S.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":d,children:"✕"})]}),e.jsx("div",{className:"nice-tutorial__content",dangerouslySetInnerHTML:{__html:U.As(_.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," ",v," ",t.length]})]}),e.jsxs("div",{className:"nice-tutorial__actions",children:[p&&!E&&e.jsx("button",{type:"button",className:"nice-tutorial__btn nice-tutorial__btn--skip",onClick:r,children:d}),!o&&e.jsx("button",{type:"button",className:"nice-tutorial__btn nice-tutorial__btn--back",onClick:T,children:R}),!_.waitForAction&&e.jsx("button",{type:"button",className:"nice-tutorial__btn nice-tutorial__btn--next",onClick:u,children:E?M:j})]})]})]})]})};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,s]=n.useState([]),[r,h]=n.useState(!1),[m,f]=n.useState(0),g=n.useCallback(w=>{s(w),f(0),h(!0)},[]),p=n.useCallback(()=>{h(!1),f(0),s([])},[]),k=n.useCallback(()=>{f(w=>Math.min(w+1,i.length-1))},[i.length]),a=n.useCallback(()=>{f(w=>Math.max(w-1,0))},[]),y=n.useCallback(w=>{f(Math.max(0,Math.min(w,i.length-1)))},[i.length]),P={startTutorial:g,stopTutorial:p,isActive:r,currentStep:m,nextStep:k,prevStep:a,goToStep:y};return e.jsxs(Le.Provider,{value:P,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,s,r,h){const m=t<=h,f=t+h>=s,g=i<=h,p=i+h>=r;return g&&m?"top-left":g&&f?"top-right":p&&m?"bottom-left":p&&f?"bottom-right":m?"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:s,children:r,footer:h,x:m,y:f,defaultPosition:g,width:p=480,height:k=360,minWidth:a=200,minHeight:y=120,maxWidth:P,maxHeight:w,zIndex:I=1,closable:x=!0,minimizable:D=!0,maximizable:c=!0,fullscreenable:b=!1,pinnable:l=!1,resizable:C=!0,draggable:L=!0,snappable:q=!0,snapThreshold:_=20,minimized:E,maximized:o,fullscreen:j,pinned:R,focused:M,onClose:d,onMinimize:v,onMaximize:u,onFullscreen:T,onPin:S,onFocus:O,onMove:B,onResize:z,onSnap:Y,onTitleBarDoubleClick:ce,size:Pe="md",statusBar:Ne,titleBarActions:De,className:Ye,style:Xe,id:ke,accessMode:qe,...Oe},Ae)=>{const Be=U.Hs(ke),We=U.Zs(qe,ke),{t:re}=U.$o(),we=n.useRef(null);we.current==null&&(we.current=`nice-window-${Math.random().toString(36).slice(2,10)}`);const X=t??we.current,He=m??g?.x??100,Fe=f??g?.y??100;if(We==="hidden")return null;const[me,se]=n.useState({x:He,y:Fe}),[he,fe]=n.useState({width:p,height:k}),[Ue,Ke]=n.useState(!1),[Ge,Ve]=n.useState(!1),[Qe,Ze]=n.useState(!1),[Je,et]=n.useState(!1),[K,xe]=n.useState("none"),tt=E??Ue,F=o??Ge,W=j??Qe,ae=R??Je,_e=M??!0,ne=me.x,ie=me.y,V=he.width,Q=he.height,Z=n.useRef(null),H=n.useRef(null),$=n.useRef(null),nt=n.useCallback(()=>{d?.(X)},[X,d]),it=n.useCallback(()=>{Ke(!0),v?.(X)},[X,v]),ge=n.useCallback(()=>{const N=!F;Ve(N),!N&&$.current?(se({x:$.current.x,y:$.current.y}),fe({width:$.current.w,height:$.current.h}),$.current=null):N&&($.current={x:ne,y:ie,w:V,h:Q}),xe("none"),u?.(X,N)},[X,F,ne,ie,V,Q,u]),be=n.useCallback(()=>{const N=!W;Ze(N),N?$.current={x:ne,y:ie,w:V,h:Q}:$.current&&(se({x:$.current.x,y:$.current.y}),fe({width:$.current.w,height:$.current.h}),$.current=null),T?.(X,N)},[X,W,ne,ie,V,Q,T]),st=n.useCallback(()=>{const N=!ae;et(N),S?.(X,N)},[X,ae,S]),le=n.useCallback(()=>{O?.(X)},[X,O]),ot=n.useCallback(()=>{ce?ce(X):c&&ge()},[X,c,ge,ce]);n.useEffect(()=>{const N=J=>{if(!Z.current)return;const G=J.clientX-Z.current.startX+Z.current.origX,de=J.clientY-Z.current.startY+Z.current.origY;se({x:G,y:de}),B?.(X,{x:G,y:de})},A=J=>{if(Z.current){if(q){const G=Nt(J.clientX,J.clientY,window.innerWidth,window.innerHeight,_);G!=="none"&&($.current={x:me.x,y:me.y,w:V,h:Q},xe(G),Y?.(X,G))}Z.current=null}};return document.addEventListener("mousemove",N),document.addEventListener("mouseup",A),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",A)}});const ct=n.useCallback(N=>{!L||F||W||(N.preventDefault(),K!=="none"&&($.current&&(se({x:$.current.x,y:$.current.y}),fe({width:$.current.w,height:$.current.h})),xe("none")),le(),Z.current={startX:N.clientX,startY:N.clientY,origX:ne,origY:ie})},[L,F,W,K,ne,ie,le]);n.useEffect(()=>{const N=J=>{if(!H.current)return;const G=J.clientX-H.current.startX,de=J.clientY-H.current.startY,oe=H.current.handle;let ee=H.current.origW,te=H.current.origH;if(oe.includes("e")&&(ee=H.current.origW+G),oe.includes("w")&&(ee=H.current.origW-G),oe.includes("s")&&(te=H.current.origH+de),oe.includes("n")&&(te=H.current.origH-de),ee=Math.max(a,P?Math.min(P,ee):ee),te=Math.max(y,w?Math.min(w,te):te),oe.includes("w")){const ve=he.width-ee;se(ue=>({...ue,x:ue.x+ve}))}if(oe.includes("n")){const ve=he.height-te;se(ue=>({...ue,y:ue.y+ve}))}fe({width:ee,height:te}),z?.(X,{width:ee,height:te})},A=()=>{H.current=null};return document.addEventListener("mousemove",N),document.addEventListener("mouseup",A),()=>{document.removeEventListener("mousemove",N),document.removeEventListener("mouseup",A)}});const rt=n.useCallback((N,A)=>{!C||F||W||K!=="none"||(A.preventDefault(),A.stopPropagation(),le(),H.current={startX:A.clientX,startY:A.clientY,origW:V,origH:Q,handle:N})},[C,F,W,K,V,Q,le]);if(n.useEffect(()=>{if(!_e)return;const N=A=>{A.key==="Escape"&&W&&be()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[_e,W,be]),tt)return null;const je=K!=="none"?kt(K):null,Ce=F||W,at=W?{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:999999}:F?{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:I}:je?{position:"absolute",...je,zIndex:I}:{position:"absolute",top:ie,left:ne,width:V,height:Q,zIndex:I},lt=["n","e","s","w","ne","se","sw","nw"],dt={n:"ns-resize",s:"ns-resize",e:"ew-resize",w:"ew-resize",ne:"nesw-resize",sw:"nesw-resize",nw:"nwse-resize",se:"nwse-resize"};return e.jsxs("div",{ref:Ae,id:Be,className:`nice-window nice-window--${Pe} ${_e?"nice-window--focused":""} ${ae?"nice-window--pinned":""} ${Ce?"nice-window--maximized":""} ${K!=="none"?`nice-window--snapped-${K}`:""} ${Ye??""}`,style:{...at,...Xe},onMouseDown:le,role:"dialog","aria-label":i,...Oe,children:[e.jsxs("div",{className:"nice-window__titlebar",onMouseDown:ct,onDoubleClick:ot,children:[s&&e.jsx("span",{className:"nice-window__icon",children:s}),e.jsx("span",{className:"nice-window__title",children:i}),e.jsxs("div",{className:"nice-window__actions",children:[De,l&&e.jsx("button",{type:"button",className:`nice-window__action nice-window__action--pin ${ae?"nice-window__action--active":""}`,onClick:st,title:re("window.pin",ae?"Unpin":"Pin"),children:"📌"}),D&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--minimize",onClick:it,title:re("window.minimize","Minimize"),children:"─"}),c&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--maximize",onClick:ge,title:re("window.maximize",F?"Restore":"Maximize"),children:F?"❐":"☐"}),b&&e.jsx("button",{type:"button",className:"nice-window__action nice-window__action--fullscreen",onClick:be,title:re("window.fullscreen",W?"Exit Full Screen":"Full Screen"),children:W?"⇲":"⇱"}),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}),h&&e.jsx("div",{className:"nice-window__footer",children:h}),Ne&&e.jsx("div",{className:"nice-window__statusbar",children:Ne}),C&&!Ce&&K==="none"&&e.jsx(e.Fragment,{children:lt.map(N=>e.jsx("div",{className:`nice-window__resize nice-window__resize--${N}`,style:{cursor:dt[N]},onMouseDown:A=>rt(N,A)},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=ze;exports.useNiceTutorial=yt;exports.useRegisterCommands=gt;
|