@nice2dev/ui 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -0
- package/README.md +17 -16
- package/dist/NiceCodeEditor-BfkH1bsZ.cjs +260 -0
- package/dist/NiceCodeEditor-CduGYggj.js +1179 -0
- package/dist/NiceColorPicker-CdUnhM-A.cjs +1 -0
- package/dist/NiceColorPicker-DpXwnDwL.js +598 -0
- package/dist/NiceConfirmDialog-B7aNRL2K.cjs +1 -0
- package/dist/NiceConfirmDialog-BdhWenrO.js +81 -0
- package/dist/NiceDataGrid-CVYEo_nv.cjs +10 -0
- package/dist/NiceDataGrid-D-rm4lu8.js +2217 -0
- package/dist/NiceDocumentViewer-BgcgLWJ3.cjs +180 -0
- package/dist/NiceDocumentViewer-sukmGhRx.js +672 -0
- package/dist/NiceForm-DVc0Xoly.js +4819 -0
- package/dist/NiceForm-qD_RKPYz.cjs +1 -0
- package/dist/NiceGantt-4UBd4uJ8.cjs +1 -0
- package/dist/NiceGantt-B_1lwEsp.js +328 -0
- package/dist/NiceHtmlEditor-Bce9Vwe1.cjs +10 -0
- package/dist/NiceHtmlEditor-CGRgcu2h.js +848 -0
- package/dist/NiceLoginForm-BTuQ0eKk.cjs +1 -0
- package/dist/NiceLoginForm-o1A-TBcp.js +736 -0
- package/dist/NiceMention-Dds9GQzk.cjs +430 -0
- package/dist/NiceMention-DlLXWddO.js +11268 -0
- package/dist/NiceModal-Dr1e3nQZ.cjs +1 -0
- package/dist/NiceModal-sihGCfDy.js +95 -0
- package/dist/NiceModuleLifecyclePanel-Du7G3-RG.js +7053 -0
- package/dist/NiceModuleLifecyclePanel-js1p7LIY.cjs +1 -0
- package/dist/NicePagination-D44waj9o.cjs +1 -0
- package/dist/NicePagination-DdxH8KMG.js +179 -0
- package/dist/NicePivotGrid-B2YHP3Z6.js +1183 -0
- package/dist/NicePivotGrid-BtVUWiud.cjs +152 -0
- package/dist/NiceSavedQueryPanel-C0A-eoYN.js +5142 -0
- package/dist/NiceSavedQueryPanel-ZrilZRtf.cjs +586 -0
- package/dist/NiceScheduler-KSzaUQxC.js +1693 -0
- package/dist/NiceScheduler-O3AwmdGG.cjs +5 -0
- package/dist/NiceSelect-BCbWtu1v.js +433 -0
- package/dist/NiceSelect-BqtiQbfD.cjs +1 -0
- package/dist/NiceWindow-BU1Ce7gS.js +1623 -0
- package/dist/NiceWindow-jjdE6vGy.cjs +1 -0
- package/dist/charts-C44vJber.cjs +768 -0
- package/dist/charts-XVlDwU0y.js +4732 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.mjs +8 -8
- package/dist/core-BxiH7vkV.cjs +1 -0
- package/dist/core-DMV6_SEE.js +795 -0
- package/dist/data-branching-oEH04O3i.js +6273 -0
- package/dist/data-branching-wmsbLNfa.cjs +1 -0
- package/dist/data-branching.cjs +1 -1
- package/dist/data-branching.mjs +1 -1
- package/dist/data.cjs +1 -1
- package/dist/data.d.ts +2 -2
- package/dist/data.mjs +3 -3
- package/dist/devops-Bt6EsfPa.cjs +17 -0
- package/dist/devops-CnZQ1rU5.js +8312 -0
- package/dist/devops.cjs +1 -1
- package/dist/devops.mjs +1 -1
- package/dist/editors.cjs +1 -1
- package/dist/editors.d.ts +2 -1
- package/dist/editors.mjs +7 -7
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.mjs +3 -3
- package/dist/index.cjs +142 -142
- package/dist/index.d.ts +45 -26
- package/dist/index.mjs +7480 -7459
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.mjs +24 -24
- package/dist/navigation.cjs +1 -1
- package/dist/navigation.d.ts +4 -4
- package/dist/navigation.mjs +69 -69
- package/dist/no-code-4GtIBr6f.js +7503 -0
- package/dist/no-code-Bdwh1vyS.cjs +332 -0
- package/dist/no-code.cjs +1 -1
- package/dist/no-code.mjs +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.mjs +102 -102
- package/dist/pickerCommons-31hyz1gs.js +1122 -0
- package/dist/pickerCommons-BifIkPdk.cjs +1 -0
- package/package.json +4 -4
package/dist/no-code.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./no-code-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./no-code-Bdwh1vyS.cjs");exports.NiceAPIFlow=e.NiceAPIFlow;exports.NiceCodePreview=e.NiceCodePreview;exports.NiceCodeTemplate=e.NiceCodeTemplate;exports.NiceComponentDesigner=e.NiceComponentDesigner;exports.NiceDataMapper=e.NiceDataMapper;exports.NiceEventOrchestrator=e.NiceEventOrchestrator;exports.NiceLowCodeStudio=e.NiceLowCodeStudio;exports.NicePageBuilder=e.NicePageBuilder;exports.NiceStateDesigner=e.NiceStateDesigner;exports.NiceTestBuilder=e.NiceTestBuilder;
|
package/dist/no-code.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as i, a as s, b as c, c as o, d as r, e as t, f as N, g as d, h as n, i as p } from "./no-code-
|
|
1
|
+
import { N as i, a as s, b as c, c as o, d as r, e as t, f as N, g as d, h as n, i as p } from "./no-code-4GtIBr6f.js";
|
|
2
2
|
export {
|
|
3
3
|
i as NiceAPIFlow,
|
|
4
4
|
s as NiceCodePreview,
|
package/dist/overlays.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./NiceWindow-BdNhCvNf.cjs"),r=require("react/jsx-runtime"),M=require("./charts-BtGltdoA.cjs"),e=require("react"),B=require("react-dom");function Y(){const t=e.useContext(M.ur);return t?.portalTarget?t.portalTarget:typeof document<"u"?document.body:null}const W=({open:t,onClose:c,children:v,title:o,size:g="md",closeOnBackdropClick:l=!0,closeOnEscape:d=!0,disableFocusTrap:u=!1,disableBodyScroll:j=!0,zIndex:_=1e3,className:p,style:E})=>{const w=e.useRef(null);M.Ec(w,t&&!u);const y=Y();e.useEffect(()=>{if(!j&&t){const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}}},[t,j]),e.useEffect(()=>{if(!d||!t)return;const n=x=>{x.key==="Escape"&&(x.preventDefault(),c())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[d,t,c]);const f=e.useCallback(n=>{l&&n.target===n.currentTarget&&c()},[l,c]);if(!t)return null;const s={sm:"nice-modal--sm",md:"nice-modal--md",lg:"nice-modal--lg",xl:"nice-modal--xl",full:"nice-modal--full"}[g];return B.createPortal(r.jsx("div",{className:"nice-modal__overlay",style:{zIndex:_},onClick:f,role:"presentation",children:r.jsx("div",{ref:w,className:`nice-modal ${s} ${p||""}`,role:"dialog","aria-modal":"true","aria-label":o,style:E,tabIndex:-1,children:v})}),y)},O=({children:t,showClose:c=!0,onClose:v,className:o})=>r.jsxs("div",{className:`nice-modal__header ${o||""}`,children:[r.jsx("div",{className:"nice-modal__title",children:t}),c&&v&&r.jsx("button",{type:"button",className:"nice-modal__close",onClick:v,"aria-label":"Close",children:r.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{d:"M4 4l12 12M4 16L16 4"})})})]}),X=({children:t,className:c})=>r.jsx("div",{className:`nice-modal__body ${c||""}`,children:t}),q=({children:t,className:c})=>r.jsx("div",{className:`nice-modal__footer ${c||""}`,children:t}),z=({open:t,onClose:c,children:v,position:o="right",size:g=320,title:l,closeOnBackdropClick:d=!0,closeOnEscape:u=!0,swipeToClose:j=!0,zIndex:_=1e3,className:p,style:E})=>{const w=e.useRef(null),[y,f]=e.useState(!1),[s,n]=e.useState(0);M.Ec(w,t);const x=Y();e.useEffect(()=>{if(!u||!t)return;const a=k=>{k.key==="Escape"&&(k.preventDefault(),c())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[u,t,c]);const h=e.useCallback(a=>{let k=0;switch(o){case"left":k=Math.min(0,a.deltaX);break;case"right":k=Math.max(0,a.deltaX);break;case"top":k=Math.min(0,a.deltaY);break;case"bottom":k=Math.max(0,a.deltaY);break}n(k)},[o]),D=e.useCallback(a=>{let C=!1;switch(o){case"left":C=a.deltaX<-100;break;case"right":C=a.deltaX>100;break;case"top":C=a.deltaY<-100;break;case"bottom":C=a.deltaY>100;break}C&&(M.ga("light"),c()),n(0),f(!1)},[o,c]),{ref:P}=M.Jc({enabled:j&&t,onPanStart:()=>f(!0),onPan:h,onPanEnd:D}),$=e.useCallback(a=>{d&&a.target===a.currentTarget&&c()},[d,c]);if(!t)return null;const S=o==="left"||o==="right",L=S?{width:typeof g=="number"?`${g}px`:g}:{height:typeof g=="number"?`${g}px`:g},i=()=>{if(y)return S?`translateX(${s}px)`:`translateY(${s}px)`};return B.createPortal(r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`nice-drawer__overlay ${t?"nice-drawer__overlay--visible":""}`,style:{zIndex:_},onClick:$}),r.jsx("div",{ref:a=>{w.current=a,P.current=a},className:`nice-drawer nice-drawer--${o} ${t?"nice-drawer--open":""} ${p||""}`,style:{...L,zIndex:_+1,transform:i(),transition:y?"none":void 0,...E},role:"dialog","aria-modal":"true","aria-label":l,tabIndex:-1,children:v})]}),x)},K=({open:t,onClose:c,children:v,title:o,showHandle:g=!0,snapPoints:l=[.5,.9],initialSnap:d=0,expandable:u=!0,closeOnBackdropClick:j=!0,closeOnEscape:_=!0,hapticFeedback:p=!0,zIndex:E=1e3,className:w,style:y})=>{const f=e.useRef(null),s=e.useRef(null),[n,x]=e.useState(d),[h,D]=e.useState(!1),[P,$]=e.useState(0),S=e.useRef(0);e.useEffect(()=>{t&&(x(d),$(0))},[t,d]),M.Ec(f,t);const L=Y();e.useEffect(()=>{if(!_||!t)return;const m=b=>{b.key==="Escape"&&(b.preventDefault(),c())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[_,t,c]),e.useEffect(()=>{if(t){const m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=m}}},[t]);const i=e.useCallback(m=>{const b=m.target.closest(".nice-bottom-sheet__handle"),I=s.current,H=!I||I.scrollTop<=0;!b&&!H||(D(!0),S.current=m.touches[0].clientY)},[]),a=e.useCallback(m=>{if(!h)return;const b=m.touches[0].clientY-S.current;(b>0||n<l.length-1)&&$(b)},[h,n,l.length]),k=e.useCallback(()=>{if(!h)return;const m=window.innerHeight;l[n]*m;const b=-P,I=m*.15;b>I&&u&&n<l.length-1?(x(n+1),p&&M.ga("selection")):b<-I&&(n>0?(x(n-1),p&&M.ga("selection")):(p&&M.ga("light"),c())),D(!1),$(0)},[h,P,n,l,u,p,c]),C=e.useCallback(()=>{j&&c()},[j,c]);if(!t)return null;const R=l[n]*100,T=h?P:0;return B.createPortal(r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`nice-bottom-sheet__overlay ${t?"nice-bottom-sheet__overlay--visible":""}`,style:{zIndex:E},onClick:C}),r.jsxs("div",{ref:f,className:`nice-bottom-sheet ${t?"nice-bottom-sheet--open":""} ${w||""}`,style:{zIndex:E+1,height:`${R}vh`,transform:`translateY(${Math.max(0,T)}px)`,transition:h?"none":"transform 0.3s ease-out, height 0.3s ease-out",...y},role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,onTouchStart:i,onTouchMove:a,onTouchEnd:k,children:[g&&r.jsx("div",{className:"nice-bottom-sheet__handle","aria-hidden":"true"}),o&&r.jsx("div",{className:"nice-bottom-sheet__title",children:o}),r.jsx("div",{ref:s,className:"nice-bottom-sheet__content",children:v})]})]}),L)},F=({trigger:t,children:c,placement:v="bottom",triggerMode:o="click",open:g,onOpenChange:l,hoverDelay:d=200,offset:u=8,className:j,showArrow:_=!0})=>{const[p,E]=e.useState(!1),w=e.useRef(null),y=e.useRef(null),f=e.useRef(null),s=Y(),n=g!==void 0,x=n?g:p,h=e.useCallback(i=>{n||E(i),l?.(i)},[n,l]);M.zc(y,()=>{o!=="manual"&&x&&h(!1)});const D=e.useCallback(()=>{o==="click"&&h(!x)},[o,x,h]),P=e.useCallback(()=>{o==="hover"&&(f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>h(!0),d))},[o,d,h]),$=e.useCallback(()=>{o==="hover"&&(f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>h(!1),d))},[o,d,h]),[S,L]=e.useState({top:0,left:0});return e.useEffect(()=>{if(!x||!w.current||!y.current)return;const i=w.current.getBoundingClientRect(),a=y.current.getBoundingClientRect(),k=window.innerWidth,C=window.innerHeight;let R=0,T=0;const[m,b="center"]=v.split("-");switch(m){case"top":R=i.top-a.height-u,T=i.left+(i.width-a.width)/2;break;case"bottom":R=i.bottom+u,T=i.left+(i.width-a.width)/2;break;case"left":R=i.top+(i.height-a.height)/2,T=i.left-a.width-u;break;case"right":R=i.top+(i.height-a.height)/2,T=i.right+u;break}m==="top"||m==="bottom"?(b==="start"&&(T=i.left),b==="end"&&(T=i.right-a.width)):(b==="start"&&(R=i.top),b==="end"&&(R=i.bottom-a.height)),T=Math.max(8,Math.min(k-a.width-8,T)),R=Math.max(8,Math.min(C-a.height-8,R)),L({top:R,left:T})},[x,v,u]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:w,className:"nice-popover__trigger",onClick:D,onMouseEnter:P,onMouseLeave:$,style:{display:"inline-block"},children:t}),x&&B.createPortal(r.jsxs("div",{ref:y,className:`nice-popover nice-popover--${v} ${j||""}`,style:{position:"fixed",top:S.top,left:S.left,zIndex:1100},onMouseEnter:P,onMouseLeave:$,role:"tooltip",children:[_&&r.jsx("div",{className:"nice-popover__arrow"}),r.jsx("div",{className:"nice-popover__content",children:c})]}),s)]})},A=({items:t,children:c,onOpen:v,onClose:o,className:g})=>{const[l,d]=e.useState(!1),[u,j]=e.useState({x:0,y:0}),_=e.useRef(null),p=e.useRef(null),E=Y();M.zc(_,()=>{l&&(d(!1),o?.())});const w=e.useCallback(s=>{s.preventDefault(),j({x:s.clientX,y:s.clientY}),d(!0),v?.()},[v]),y=e.useCallback(s=>{!s.disabled&&s.onClick&&(s.onClick(),d(!1),o?.())},[o]);e.useEffect(()=>{if(!l)return;const s=n=>{n.key==="Escape"&&(d(!1),o?.())};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[l,o]);const f=s=>r.jsx("ul",{className:"nice-context-menu__list",role:"menu",children:s.map(n=>n.divider?r.jsx("li",{className:"nice-context-menu__divider",role:"separator"},n.key):r.jsx("li",{role:"presentation",children:r.jsxs("button",{type:"button",className:`nice-context-menu__item ${n.disabled?"nice-context-menu__item--disabled":""} ${n.danger?"nice-context-menu__item--danger":""}`,role:"menuitem",disabled:n.disabled,onClick:()=>y(n),children:[n.icon&&r.jsx("span",{className:"nice-context-menu__icon",children:n.icon}),r.jsx("span",{className:"nice-context-menu__label",children:n.label})]})},n.key))});return r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:p,onContextMenu:w,style:{display:"contents"},children:c}),l&&B.createPortal(r.jsx("div",{ref:_,className:`nice-context-menu ${g||""}`,style:{position:"fixed",left:u.x,top:u.y,zIndex:1200},role:"menu",children:f(t)}),E)]})};exports.NiceActionSheet=N.NiceActionSheet;exports.NiceBlockUI=N.NiceBlockUI;exports.NiceBox=N.NiceBox;exports.NiceCommandPaletteProvider=N.NiceCommandPaletteProvider;exports.NiceLoadPanel=N.NiceLoadPanel;exports.NicePopover=N.NicePopover;exports.NiceResizable=N.NiceResizable;exports.NiceResponsiveBox=N.NiceResponsiveBox;exports.NiceScrollView=N.NiceScrollView;exports.NiceTutorial=N.NiceTutorial;exports.NiceTutorialProvider=N.NiceTutorialProvider;exports.NiceWindow=N.NiceWindow;exports.NiceWindowManager=N.NiceWindowManager;exports.useCommandPalette=N.useCommandPalette;exports.useRegisterCommands=N.useRegisterCommands;exports.NiceBottomSheet=K;exports.NiceContextMenu=A;exports.NiceDrawer=z;exports.NiceModal=W;exports.NiceModalBody=X;exports.NiceModalFooter=q;exports.NiceModalHeader=O;exports.NiceOverlayPopover=F;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./NiceWindow-jjdE6vGy.cjs"),r=require("react/jsx-runtime"),M=require("@nice2dev/ui-core"),e=require("react"),I=require("react-dom");function B(){const t=e.useContext(M.NiceThemeContext);return t?.portalTarget?t.portalTarget:typeof document<"u"?document.body:null}const O=({open:t,onClose:i,children:v,title:o,size:g="md",closeOnBackdropClick:l=!0,closeOnEscape:d=!0,disableFocusTrap:u=!1,disableBodyScroll:T=!0,zIndex:p=1e3,className:_,style:C})=>{const w=e.useRef(null);M.useFocusTrap(w,t&&!u);const y=B();e.useEffect(()=>{if(!T&&t){const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}}},[t,T]),e.useEffect(()=>{if(!d||!t)return;const n=x=>{x.key==="Escape"&&(x.preventDefault(),i())};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[d,t,i]);const f=e.useCallback(n=>{l&&n.target===n.currentTarget&&i()},[l,i]);if(!t)return null;const c={sm:"nice-modal--sm",md:"nice-modal--md",lg:"nice-modal--lg",xl:"nice-modal--xl",full:"nice-modal--full"}[g];return I.createPortal(r.jsx("div",{className:"nice-modal__overlay",style:{zIndex:p},onClick:f,role:"presentation",children:r.jsx("div",{ref:w,className:`nice-modal ${c} ${_||""}`,role:"dialog","aria-modal":"true","aria-label":o,style:C,tabIndex:-1,children:v})}),y)},W=({children:t,showClose:i=!0,onClose:v,className:o})=>r.jsxs("div",{className:`nice-modal__header ${o||""}`,children:[r.jsx("div",{className:"nice-modal__title",children:t}),i&&v&&r.jsx("button",{type:"button",className:"nice-modal__close",onClick:v,"aria-label":"Close",children:r.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.jsx("path",{d:"M4 4l12 12M4 16L16 4"})})})]}),F=({children:t,className:i})=>r.jsx("div",{className:`nice-modal__body ${i||""}`,children:t}),X=({children:t,className:i})=>r.jsx("div",{className:`nice-modal__footer ${i||""}`,children:t}),q=({open:t,onClose:i,children:v,position:o="right",size:g=320,title:l,closeOnBackdropClick:d=!0,closeOnEscape:u=!0,swipeToClose:T=!0,zIndex:p=1e3,className:_,style:C})=>{const w=e.useRef(null),[y,f]=e.useState(!1),[c,n]=e.useState(0);M.useFocusTrap(w,t);const x=B();e.useEffect(()=>{if(!u||!t)return;const a=k=>{k.key==="Escape"&&(k.preventDefault(),i())};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[u,t,i]);const h=e.useCallback(a=>{let k=0;switch(o){case"left":k=Math.min(0,a.deltaX);break;case"right":k=Math.max(0,a.deltaX);break;case"top":k=Math.min(0,a.deltaY);break;case"bottom":k=Math.max(0,a.deltaY);break}n(k)},[o]),D=e.useCallback(a=>{let P=!1;switch(o){case"left":P=a.deltaX<-100;break;case"right":P=a.deltaX>100;break;case"top":P=a.deltaY<-100;break;case"bottom":P=a.deltaY>100;break}P&&(M.triggerHaptic("light"),i()),n(0),f(!1)},[o,i]),{ref:E}=M.usePan({enabled:T&&t,onPanStart:()=>f(!0),onPan:h,onPanEnd:D}),$=e.useCallback(a=>{d&&a.target===a.currentTarget&&i()},[d,i]);if(!t)return null;const S=o==="left"||o==="right",L=S?{width:typeof g=="number"?`${g}px`:g}:{height:typeof g=="number"?`${g}px`:g},s=()=>{if(y)return S?`translateX(${c}px)`:`translateY(${c}px)`};return I.createPortal(r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`nice-drawer__overlay ${t?"nice-drawer__overlay--visible":""}`,style:{zIndex:p},onClick:$}),r.jsx("div",{ref:a=>{w.current=a,E.current=a},className:`nice-drawer nice-drawer--${o} ${t?"nice-drawer--open":""} ${_||""}`,style:{...L,zIndex:p+1,transform:s(),transition:y?"none":void 0,...C},role:"dialog","aria-modal":"true","aria-label":l,tabIndex:-1,children:v})]}),x)},K=({open:t,onClose:i,children:v,title:o,showHandle:g=!0,snapPoints:l=[.5,.9],initialSnap:d=0,expandable:u=!0,closeOnBackdropClick:T=!0,closeOnEscape:p=!0,hapticFeedback:_=!0,zIndex:C=1e3,className:w,style:y})=>{const f=e.useRef(null),c=e.useRef(null),[n,x]=e.useState(d),[h,D]=e.useState(!1),[E,$]=e.useState(0),S=e.useRef(0);e.useEffect(()=>{t&&(x(d),$(0))},[t,d]),M.useFocusTrap(f,t);const L=B();e.useEffect(()=>{if(!p||!t)return;const m=b=>{b.key==="Escape"&&(b.preventDefault(),i())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[p,t,i]),e.useEffect(()=>{if(t){const m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=m}}},[t]);const s=e.useCallback(m=>{const b=m.target.closest(".nice-bottom-sheet__handle"),H=c.current,Y=!H||H.scrollTop<=0;!b&&!Y||(D(!0),S.current=m.touches[0].clientY)},[]),a=e.useCallback(m=>{if(!h)return;const b=m.touches[0].clientY-S.current;(b>0||n<l.length-1)&&$(b)},[h,n,l.length]),k=e.useCallback(()=>{if(!h)return;const m=window.innerHeight;l[n]*m;const b=-E,H=m*.15;b>H&&u&&n<l.length-1?(x(n+1),_&&M.triggerHaptic("selection")):b<-H&&(n>0?(x(n-1),_&&M.triggerHaptic("selection")):(_&&M.triggerHaptic("light"),i())),D(!1),$(0)},[h,E,n,l,u,_,i]),P=e.useCallback(()=>{T&&i()},[T,i]);if(!t)return null;const j=l[n]*100,R=h?E:0;return I.createPortal(r.jsxs(r.Fragment,{children:[r.jsx("div",{className:`nice-bottom-sheet__overlay ${t?"nice-bottom-sheet__overlay--visible":""}`,style:{zIndex:C},onClick:P}),r.jsxs("div",{ref:f,className:`nice-bottom-sheet ${t?"nice-bottom-sheet--open":""} ${w||""}`,style:{zIndex:C+1,height:`${j}vh`,transform:`translateY(${Math.max(0,R)}px)`,transition:h?"none":"transform 0.3s ease-out, height 0.3s ease-out",...y},role:"dialog","aria-modal":"true","aria-label":o,tabIndex:-1,onTouchStart:s,onTouchMove:a,onTouchEnd:k,children:[g&&r.jsx("div",{className:"nice-bottom-sheet__handle","aria-hidden":"true"}),o&&r.jsx("div",{className:"nice-bottom-sheet__title",children:o}),r.jsx("div",{ref:c,className:"nice-bottom-sheet__content",children:v})]})]}),L)},z=({trigger:t,children:i,placement:v="bottom",triggerMode:o="click",open:g,onOpenChange:l,hoverDelay:d=200,offset:u=8,className:T,showArrow:p=!0})=>{const[_,C]=e.useState(!1),w=e.useRef(null),y=e.useRef(null),f=e.useRef(null),c=B(),n=g!==void 0,x=n?g:_,h=e.useCallback(s=>{n||C(s),l?.(s)},[n,l]);M.useClickOutside(y,()=>{o!=="manual"&&x&&h(!1)});const D=e.useCallback(()=>{o==="click"&&h(!x)},[o,x,h]),E=e.useCallback(()=>{o==="hover"&&(f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>h(!0),d))},[o,d,h]),$=e.useCallback(()=>{o==="hover"&&(f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(()=>h(!1),d))},[o,d,h]),[S,L]=e.useState({top:0,left:0});return e.useEffect(()=>{if(!x||!w.current||!y.current)return;const s=w.current.getBoundingClientRect(),a=y.current.getBoundingClientRect(),k=window.innerWidth,P=window.innerHeight;let j=0,R=0;const[m,b="center"]=v.split("-");switch(m){case"top":j=s.top-a.height-u,R=s.left+(s.width-a.width)/2;break;case"bottom":j=s.bottom+u,R=s.left+(s.width-a.width)/2;break;case"left":j=s.top+(s.height-a.height)/2,R=s.left-a.width-u;break;case"right":j=s.top+(s.height-a.height)/2,R=s.right+u;break}m==="top"||m==="bottom"?(b==="start"&&(R=s.left),b==="end"&&(R=s.right-a.width)):(b==="start"&&(j=s.top),b==="end"&&(j=s.bottom-a.height)),R=Math.max(8,Math.min(k-a.width-8,R)),j=Math.max(8,Math.min(P-a.height-8,j)),L({top:j,left:R})},[x,v,u]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:w,className:"nice-popover__trigger",onClick:D,onMouseEnter:E,onMouseLeave:$,style:{display:"inline-block"},children:t}),x&&I.createPortal(r.jsxs("div",{ref:y,className:`nice-popover nice-popover--${v} ${T||""}`,style:{position:"fixed",top:S.top,left:S.left,zIndex:1100},onMouseEnter:E,onMouseLeave:$,role:"tooltip",children:[p&&r.jsx("div",{className:"nice-popover__arrow"}),r.jsx("div",{className:"nice-popover__content",children:i})]}),c)]})},A=({items:t,children:i,onOpen:v,onClose:o,className:g})=>{const[l,d]=e.useState(!1),[u,T]=e.useState({x:0,y:0}),p=e.useRef(null),_=e.useRef(null),C=B();M.useClickOutside(p,()=>{l&&(d(!1),o?.())});const w=e.useCallback(c=>{c.preventDefault(),T({x:c.clientX,y:c.clientY}),d(!0),v?.()},[v]),y=e.useCallback(c=>{!c.disabled&&c.onClick&&(c.onClick(),d(!1),o?.())},[o]);e.useEffect(()=>{if(!l)return;const c=n=>{n.key==="Escape"&&(d(!1),o?.())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[l,o]);const f=c=>r.jsx("ul",{className:"nice-context-menu__list",role:"menu",children:c.map(n=>n.divider?r.jsx("li",{className:"nice-context-menu__divider",role:"separator"},n.key):r.jsx("li",{role:"presentation",children:r.jsxs("button",{type:"button",className:`nice-context-menu__item ${n.disabled?"nice-context-menu__item--disabled":""} ${n.danger?"nice-context-menu__item--danger":""}`,role:"menuitem",disabled:n.disabled,onClick:()=>y(n),children:[n.icon&&r.jsx("span",{className:"nice-context-menu__icon",children:n.icon}),r.jsx("span",{className:"nice-context-menu__label",children:n.label})]})},n.key))});return r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:_,onContextMenu:w,style:{display:"contents"},children:i}),l&&I.createPortal(r.jsx("div",{ref:p,className:`nice-context-menu ${g||""}`,style:{position:"fixed",left:u.x,top:u.y,zIndex:1200},role:"menu",children:f(t)}),C)]})};exports.NiceActionSheet=N.NiceActionSheet;exports.NiceBlockUI=N.NiceBlockUI;exports.NiceBox=N.NiceBox;exports.NiceCommandPaletteProvider=N.NiceCommandPaletteProvider;exports.NiceLoadPanel=N.NiceLoadPanel;exports.NicePopover=N.NicePopover;exports.NiceResizable=N.NiceResizable;exports.NiceResponsiveBox=N.NiceResponsiveBox;exports.NiceScrollView=N.NiceScrollView;exports.NiceTutorial=N.NiceTutorial;exports.NiceTutorialProvider=N.NiceTutorialProvider;exports.NiceWindow=N.NiceWindow;exports.NiceWindowManager=N.NiceWindowManager;exports.useCommandPalette=N.useCommandPalette;exports.useRegisterCommands=N.useRegisterCommands;exports.NiceBottomSheet=K;exports.NiceContextMenu=A;exports.NiceDrawer=q;exports.NiceModal=O;exports.NiceModalBody=F;exports.NiceModalFooter=X;exports.NiceModalHeader=W;exports.NiceOverlayPopover=z;
|
package/dist/overlays.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { N as se, a as de, b as ue, c as he, d as
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import {
|
|
4
|
-
import { useRef as E, useState as
|
|
1
|
+
import { N as se, a as de, b as ue, c as he, d as me, e as fe, f as ve, g as ge, h as we, i as be, j as ye, k as pe, l as Ne, u as _e, m as ke } from "./NiceWindow-BU1Ce7gS.js";
|
|
2
|
+
import { jsxs as C, Fragment as K, jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { useFocusTrap as j, triggerHaptic as W, useClickOutside as z, usePan as U, NiceThemeContext as V } from "@nice2dev/ui-core";
|
|
4
|
+
import { useRef as E, useState as P, useEffect as Y, useCallback as b, useContext as q } from "react";
|
|
5
5
|
import { createPortal as X } from "react-dom";
|
|
6
|
-
function
|
|
7
|
-
const e = V
|
|
6
|
+
function O() {
|
|
7
|
+
const e = q(V);
|
|
8
8
|
return e?.portalTarget ? e.portalTarget : typeof document < "u" ? document.body : null;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const Z = ({
|
|
11
11
|
open: e,
|
|
12
12
|
onClose: o,
|
|
13
|
-
children:
|
|
13
|
+
children: f,
|
|
14
14
|
title: r,
|
|
15
15
|
size: v = "md",
|
|
16
16
|
closeOnBackdropClick: l = !0,
|
|
17
17
|
closeOnEscape: s = !0,
|
|
18
18
|
disableFocusTrap: d = !1,
|
|
19
19
|
disableBodyScroll: x = !0,
|
|
20
|
-
zIndex:
|
|
20
|
+
zIndex: _ = 1e3,
|
|
21
21
|
className: k,
|
|
22
22
|
style: M
|
|
23
23
|
}) => {
|
|
24
24
|
const y = E(null);
|
|
25
25
|
j(y, e && !d);
|
|
26
|
-
const p =
|
|
26
|
+
const p = O();
|
|
27
27
|
Y(() => {
|
|
28
28
|
if (!x && e) {
|
|
29
29
|
const t = document.body.style.overflow;
|
|
@@ -59,7 +59,7 @@ const F = ({
|
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
className: "nice-modal__overlay",
|
|
62
|
-
style: { zIndex:
|
|
62
|
+
style: { zIndex: _ },
|
|
63
63
|
onClick: u,
|
|
64
64
|
role: "presentation",
|
|
65
65
|
children: /* @__PURE__ */ a(
|
|
@@ -72,7 +72,7 @@ const F = ({
|
|
|
72
72
|
"aria-label": r,
|
|
73
73
|
style: M,
|
|
74
74
|
tabIndex: -1,
|
|
75
|
-
children:
|
|
75
|
+
children: f
|
|
76
76
|
}
|
|
77
77
|
)
|
|
78
78
|
}
|
|
@@ -82,11 +82,11 @@ const F = ({
|
|
|
82
82
|
}, ee = ({
|
|
83
83
|
children: e,
|
|
84
84
|
showClose: o = !0,
|
|
85
|
-
onClose:
|
|
85
|
+
onClose: f,
|
|
86
86
|
className: r
|
|
87
|
-
}) => /* @__PURE__ */
|
|
87
|
+
}) => /* @__PURE__ */ C("div", { className: `nice-modal__header ${r || ""}`, children: [
|
|
88
88
|
/* @__PURE__ */ a("div", { className: "nice-modal__title", children: e }),
|
|
89
|
-
o &&
|
|
89
|
+
o && f && /* @__PURE__ */ a("button", { type: "button", className: "nice-modal__close", onClick: f, "aria-label": "Close", children: /* @__PURE__ */ a(
|
|
90
90
|
"svg",
|
|
91
91
|
{
|
|
92
92
|
width: "20",
|
|
@@ -101,49 +101,49 @@ const F = ({
|
|
|
101
101
|
] }), te = ({ children: e, className: o }) => /* @__PURE__ */ a("div", { className: `nice-modal__body ${o || ""}`, children: e }), ne = ({ children: e, className: o }) => /* @__PURE__ */ a("div", { className: `nice-modal__footer ${o || ""}`, children: e }), re = ({
|
|
102
102
|
open: e,
|
|
103
103
|
onClose: o,
|
|
104
|
-
children:
|
|
104
|
+
children: f,
|
|
105
105
|
position: r = "right",
|
|
106
106
|
size: v = 320,
|
|
107
107
|
title: l,
|
|
108
108
|
closeOnBackdropClick: s = !0,
|
|
109
109
|
closeOnEscape: d = !0,
|
|
110
110
|
swipeToClose: x = !0,
|
|
111
|
-
zIndex:
|
|
111
|
+
zIndex: _ = 1e3,
|
|
112
112
|
className: k,
|
|
113
113
|
style: M
|
|
114
114
|
}) => {
|
|
115
|
-
const y = E(null), [p, u] =
|
|
115
|
+
const y = E(null), [p, u] = P(!1), [c, t] = P(0);
|
|
116
116
|
j(y, e);
|
|
117
|
-
const g =
|
|
117
|
+
const g = O();
|
|
118
118
|
Y(() => {
|
|
119
119
|
if (!d || !e)
|
|
120
120
|
return;
|
|
121
|
-
const n = (
|
|
122
|
-
|
|
121
|
+
const n = (N) => {
|
|
122
|
+
N.key === "Escape" && (N.preventDefault(), o());
|
|
123
123
|
};
|
|
124
124
|
return document.addEventListener("keydown", n), () => document.removeEventListener("keydown", n);
|
|
125
125
|
}, [d, e, o]);
|
|
126
126
|
const h = b(
|
|
127
127
|
(n) => {
|
|
128
|
-
let
|
|
128
|
+
let N = 0;
|
|
129
129
|
switch (r) {
|
|
130
130
|
case "left":
|
|
131
|
-
|
|
131
|
+
N = Math.min(0, n.deltaX);
|
|
132
132
|
break;
|
|
133
133
|
case "right":
|
|
134
|
-
|
|
134
|
+
N = Math.max(0, n.deltaX);
|
|
135
135
|
break;
|
|
136
136
|
case "top":
|
|
137
|
-
|
|
137
|
+
N = Math.min(0, n.deltaY);
|
|
138
138
|
break;
|
|
139
139
|
case "bottom":
|
|
140
|
-
|
|
140
|
+
N = Math.max(0, n.deltaY);
|
|
141
141
|
break;
|
|
142
142
|
}
|
|
143
|
-
t(
|
|
143
|
+
t(N);
|
|
144
144
|
},
|
|
145
145
|
[r]
|
|
146
|
-
),
|
|
146
|
+
), H = b(
|
|
147
147
|
(n) => {
|
|
148
148
|
let R = !1;
|
|
149
149
|
switch (r) {
|
|
@@ -160,15 +160,15 @@ const F = ({
|
|
|
160
160
|
R = n.deltaY > 100;
|
|
161
161
|
break;
|
|
162
162
|
}
|
|
163
|
-
R && (
|
|
163
|
+
R && (W("light"), o()), t(0), u(!1);
|
|
164
164
|
},
|
|
165
165
|
[r, o]
|
|
166
|
-
), { ref:
|
|
166
|
+
), { ref: D } = U({
|
|
167
167
|
enabled: x && e,
|
|
168
168
|
onPanStart: () => u(!0),
|
|
169
169
|
onPan: h,
|
|
170
|
-
onPanEnd:
|
|
171
|
-
}),
|
|
170
|
+
onPanEnd: H
|
|
171
|
+
}), L = b(
|
|
172
172
|
(n) => {
|
|
173
173
|
s && n.target === n.currentTarget && o();
|
|
174
174
|
},
|
|
@@ -176,30 +176,30 @@ const F = ({
|
|
|
176
176
|
);
|
|
177
177
|
if (!e)
|
|
178
178
|
return null;
|
|
179
|
-
const I = r === "left" || r === "right",
|
|
179
|
+
const I = r === "left" || r === "right", S = I ? { width: typeof v == "number" ? `${v}px` : v } : { height: typeof v == "number" ? `${v}px` : v }, i = () => {
|
|
180
180
|
if (p)
|
|
181
181
|
return I ? `translateX(${c}px)` : `translateY(${c}px)`;
|
|
182
182
|
};
|
|
183
183
|
return X(
|
|
184
|
-
/* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ C(K, { children: [
|
|
185
185
|
/* @__PURE__ */ a(
|
|
186
186
|
"div",
|
|
187
187
|
{
|
|
188
188
|
className: `nice-drawer__overlay ${e ? "nice-drawer__overlay--visible" : ""}`,
|
|
189
|
-
style: { zIndex:
|
|
190
|
-
onClick:
|
|
189
|
+
style: { zIndex: _ },
|
|
190
|
+
onClick: L
|
|
191
191
|
}
|
|
192
192
|
),
|
|
193
193
|
/* @__PURE__ */ a(
|
|
194
194
|
"div",
|
|
195
195
|
{
|
|
196
196
|
ref: (n) => {
|
|
197
|
-
y.current = n,
|
|
197
|
+
y.current = n, D.current = n;
|
|
198
198
|
},
|
|
199
199
|
className: `nice-drawer nice-drawer--${r} ${e ? "nice-drawer--open" : ""} ${k || ""}`,
|
|
200
200
|
style: {
|
|
201
|
-
...
|
|
202
|
-
zIndex:
|
|
201
|
+
...S,
|
|
202
|
+
zIndex: _ + 1,
|
|
203
203
|
transform: i(),
|
|
204
204
|
transition: p ? "none" : void 0,
|
|
205
205
|
...M
|
|
@@ -208,7 +208,7 @@ const F = ({
|
|
|
208
208
|
"aria-modal": "true",
|
|
209
209
|
"aria-label": l,
|
|
210
210
|
tabIndex: -1,
|
|
211
|
-
children:
|
|
211
|
+
children: f
|
|
212
212
|
}
|
|
213
213
|
)
|
|
214
214
|
] }),
|
|
@@ -217,65 +217,65 @@ const F = ({
|
|
|
217
217
|
}, oe = ({
|
|
218
218
|
open: e,
|
|
219
219
|
onClose: o,
|
|
220
|
-
children:
|
|
220
|
+
children: f,
|
|
221
221
|
title: r,
|
|
222
222
|
showHandle: v = !0,
|
|
223
223
|
snapPoints: l = [0.5, 0.9],
|
|
224
224
|
initialSnap: s = 0,
|
|
225
225
|
expandable: d = !0,
|
|
226
226
|
closeOnBackdropClick: x = !0,
|
|
227
|
-
closeOnEscape:
|
|
227
|
+
closeOnEscape: _ = !0,
|
|
228
228
|
hapticFeedback: k = !0,
|
|
229
229
|
zIndex: M = 1e3,
|
|
230
230
|
className: y,
|
|
231
231
|
style: p
|
|
232
232
|
}) => {
|
|
233
|
-
const u = E(null), c = E(null), [t, g] =
|
|
233
|
+
const u = E(null), c = E(null), [t, g] = P(s), [h, H] = P(!1), [D, L] = P(0), I = E(0);
|
|
234
234
|
Y(() => {
|
|
235
|
-
e && (g(s),
|
|
235
|
+
e && (g(s), L(0));
|
|
236
236
|
}, [e, s]), j(u, e);
|
|
237
|
-
const
|
|
237
|
+
const S = O();
|
|
238
238
|
Y(() => {
|
|
239
|
-
if (!
|
|
239
|
+
if (!_ || !e)
|
|
240
240
|
return;
|
|
241
|
-
const
|
|
241
|
+
const m = (w) => {
|
|
242
242
|
w.key === "Escape" && (w.preventDefault(), o());
|
|
243
243
|
};
|
|
244
|
-
return document.addEventListener("keydown",
|
|
245
|
-
}, [
|
|
244
|
+
return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
|
|
245
|
+
}, [_, e, o]), Y(() => {
|
|
246
246
|
if (e) {
|
|
247
|
-
const
|
|
247
|
+
const m = document.body.style.overflow;
|
|
248
248
|
return document.body.style.overflow = "hidden", () => {
|
|
249
|
-
document.body.style.overflow =
|
|
249
|
+
document.body.style.overflow = m;
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
}, [e]);
|
|
253
|
-
const i = b((
|
|
254
|
-
const w =
|
|
255
|
-
!w && !
|
|
253
|
+
const i = b((m) => {
|
|
254
|
+
const w = m.target.closest(".nice-bottom-sheet__handle"), B = c.current, A = !B || B.scrollTop <= 0;
|
|
255
|
+
!w && !A || (H(!0), I.current = m.touches[0].clientY);
|
|
256
256
|
}, []), n = b(
|
|
257
|
-
(
|
|
257
|
+
(m) => {
|
|
258
258
|
if (!h)
|
|
259
259
|
return;
|
|
260
|
-
const w =
|
|
261
|
-
(w > 0 || t < l.length - 1) &&
|
|
260
|
+
const w = m.touches[0].clientY - I.current;
|
|
261
|
+
(w > 0 || t < l.length - 1) && L(w);
|
|
262
262
|
},
|
|
263
263
|
[h, t, l.length]
|
|
264
|
-
),
|
|
264
|
+
), N = b(() => {
|
|
265
265
|
if (!h)
|
|
266
266
|
return;
|
|
267
|
-
const
|
|
268
|
-
l[t] *
|
|
269
|
-
const w = -
|
|
270
|
-
w >
|
|
271
|
-
}, [h,
|
|
267
|
+
const m = window.innerHeight;
|
|
268
|
+
l[t] * m;
|
|
269
|
+
const w = -D, B = m * 0.15;
|
|
270
|
+
w > B && d && t < l.length - 1 ? (g(t + 1), k && W("selection")) : w < -B && (t > 0 ? (g(t - 1), k && W("selection")) : (k && W("light"), o())), H(!1), L(0);
|
|
271
|
+
}, [h, D, t, l, d, k, o]), R = b(() => {
|
|
272
272
|
x && o();
|
|
273
273
|
}, [x, o]);
|
|
274
274
|
if (!e)
|
|
275
275
|
return null;
|
|
276
|
-
const T = l[t] * 100, $ = h ?
|
|
276
|
+
const T = l[t] * 100, $ = h ? D : 0;
|
|
277
277
|
return X(
|
|
278
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ C(K, { children: [
|
|
279
279
|
/* @__PURE__ */ a(
|
|
280
280
|
"div",
|
|
281
281
|
{
|
|
@@ -284,7 +284,7 @@ const F = ({
|
|
|
284
284
|
onClick: R
|
|
285
285
|
}
|
|
286
286
|
),
|
|
287
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ C(
|
|
288
288
|
"div",
|
|
289
289
|
{
|
|
290
290
|
ref: u,
|
|
@@ -302,30 +302,30 @@ const F = ({
|
|
|
302
302
|
tabIndex: -1,
|
|
303
303
|
onTouchStart: i,
|
|
304
304
|
onTouchMove: n,
|
|
305
|
-
onTouchEnd:
|
|
305
|
+
onTouchEnd: N,
|
|
306
306
|
children: [
|
|
307
307
|
v && /* @__PURE__ */ a("div", { className: "nice-bottom-sheet__handle", "aria-hidden": "true" }),
|
|
308
308
|
r && /* @__PURE__ */ a("div", { className: "nice-bottom-sheet__title", children: r }),
|
|
309
|
-
/* @__PURE__ */ a("div", { ref: c, className: "nice-bottom-sheet__content", children:
|
|
309
|
+
/* @__PURE__ */ a("div", { ref: c, className: "nice-bottom-sheet__content", children: f })
|
|
310
310
|
]
|
|
311
311
|
}
|
|
312
312
|
)
|
|
313
313
|
] }),
|
|
314
|
-
|
|
314
|
+
S
|
|
315
315
|
);
|
|
316
316
|
}, ae = ({
|
|
317
317
|
trigger: e,
|
|
318
318
|
children: o,
|
|
319
|
-
placement:
|
|
319
|
+
placement: f = "bottom",
|
|
320
320
|
triggerMode: r = "click",
|
|
321
321
|
open: v,
|
|
322
322
|
onOpenChange: l,
|
|
323
323
|
hoverDelay: s = 200,
|
|
324
324
|
offset: d = 8,
|
|
325
325
|
className: x,
|
|
326
|
-
showArrow:
|
|
326
|
+
showArrow: _ = !0
|
|
327
327
|
}) => {
|
|
328
|
-
const [k, M] =
|
|
328
|
+
const [k, M] = P(!1), y = E(null), p = E(null), u = E(null), c = O(), t = v !== void 0, g = t ? v : k, h = b(
|
|
329
329
|
(i) => {
|
|
330
330
|
t || M(i), l?.(i);
|
|
331
331
|
},
|
|
@@ -334,20 +334,20 @@ const F = ({
|
|
|
334
334
|
z(p, () => {
|
|
335
335
|
r !== "manual" && g && h(!1);
|
|
336
336
|
});
|
|
337
|
-
const
|
|
337
|
+
const H = b(() => {
|
|
338
338
|
r === "click" && h(!g);
|
|
339
|
-
}, [r, g, h]),
|
|
339
|
+
}, [r, g, h]), D = b(() => {
|
|
340
340
|
r === "hover" && (u.current && window.clearTimeout(u.current), u.current = window.setTimeout(() => h(!0), s));
|
|
341
|
-
}, [r, s, h]),
|
|
341
|
+
}, [r, s, h]), L = b(() => {
|
|
342
342
|
r === "hover" && (u.current && window.clearTimeout(u.current), u.current = window.setTimeout(() => h(!1), s));
|
|
343
|
-
}, [r, s, h]), [I,
|
|
343
|
+
}, [r, s, h]), [I, S] = P({ top: 0, left: 0 });
|
|
344
344
|
return Y(() => {
|
|
345
345
|
if (!g || !y.current || !p.current)
|
|
346
346
|
return;
|
|
347
|
-
const i = y.current.getBoundingClientRect(), n = p.current.getBoundingClientRect(),
|
|
347
|
+
const i = y.current.getBoundingClientRect(), n = p.current.getBoundingClientRect(), N = window.innerWidth, R = window.innerHeight;
|
|
348
348
|
let T = 0, $ = 0;
|
|
349
|
-
const [
|
|
350
|
-
switch (
|
|
349
|
+
const [m, w = "center"] = f.split("-");
|
|
350
|
+
switch (m) {
|
|
351
351
|
case "top":
|
|
352
352
|
T = i.top - n.height - d, $ = i.left + (i.width - n.width) / 2;
|
|
353
353
|
break;
|
|
@@ -361,37 +361,37 @@ const F = ({
|
|
|
361
361
|
T = i.top + (i.height - n.height) / 2, $ = i.right + d;
|
|
362
362
|
break;
|
|
363
363
|
}
|
|
364
|
-
|
|
365
|
-
}, [g,
|
|
364
|
+
m === "top" || m === "bottom" ? (w === "start" && ($ = i.left), w === "end" && ($ = i.right - n.width)) : (w === "start" && (T = i.top), w === "end" && (T = i.bottom - n.height)), $ = Math.max(8, Math.min(N - n.width - 8, $)), T = Math.max(8, Math.min(R - n.height - 8, T)), S({ top: T, left: $ });
|
|
365
|
+
}, [g, f, d]), /* @__PURE__ */ C(K, { children: [
|
|
366
366
|
/* @__PURE__ */ a(
|
|
367
367
|
"div",
|
|
368
368
|
{
|
|
369
369
|
ref: y,
|
|
370
370
|
className: "nice-popover__trigger",
|
|
371
|
-
onClick:
|
|
372
|
-
onMouseEnter:
|
|
373
|
-
onMouseLeave:
|
|
371
|
+
onClick: H,
|
|
372
|
+
onMouseEnter: D,
|
|
373
|
+
onMouseLeave: L,
|
|
374
374
|
style: { display: "inline-block" },
|
|
375
375
|
children: e
|
|
376
376
|
}
|
|
377
377
|
),
|
|
378
378
|
g && X(
|
|
379
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ C(
|
|
380
380
|
"div",
|
|
381
381
|
{
|
|
382
382
|
ref: p,
|
|
383
|
-
className: `nice-popover nice-popover--${
|
|
383
|
+
className: `nice-popover nice-popover--${f} ${x || ""}`,
|
|
384
384
|
style: {
|
|
385
385
|
position: "fixed",
|
|
386
386
|
top: I.top,
|
|
387
387
|
left: I.left,
|
|
388
388
|
zIndex: 1100
|
|
389
389
|
},
|
|
390
|
-
onMouseEnter:
|
|
391
|
-
onMouseLeave:
|
|
390
|
+
onMouseEnter: D,
|
|
391
|
+
onMouseLeave: L,
|
|
392
392
|
role: "tooltip",
|
|
393
393
|
children: [
|
|
394
|
-
|
|
394
|
+
_ && /* @__PURE__ */ a("div", { className: "nice-popover__arrow" }),
|
|
395
395
|
/* @__PURE__ */ a("div", { className: "nice-popover__content", children: o })
|
|
396
396
|
]
|
|
397
397
|
}
|
|
@@ -402,19 +402,19 @@ const F = ({
|
|
|
402
402
|
}, ie = ({
|
|
403
403
|
items: e,
|
|
404
404
|
children: o,
|
|
405
|
-
onOpen:
|
|
405
|
+
onOpen: f,
|
|
406
406
|
onClose: r,
|
|
407
407
|
className: v
|
|
408
408
|
}) => {
|
|
409
|
-
const [l, s] =
|
|
410
|
-
z(
|
|
409
|
+
const [l, s] = P(!1), [d, x] = P({ x: 0, y: 0 }), _ = E(null), k = E(null), M = O();
|
|
410
|
+
z(_, () => {
|
|
411
411
|
l && (s(!1), r?.());
|
|
412
412
|
});
|
|
413
413
|
const y = b(
|
|
414
414
|
(c) => {
|
|
415
|
-
c.preventDefault(), x({ x: c.clientX, y: c.clientY }), s(!0),
|
|
415
|
+
c.preventDefault(), x({ x: c.clientX, y: c.clientY }), s(!0), f?.();
|
|
416
416
|
},
|
|
417
|
-
[
|
|
417
|
+
[f]
|
|
418
418
|
), p = b(
|
|
419
419
|
(c) => {
|
|
420
420
|
!c.disabled && c.onClick && (c.onClick(), s(!1), r?.());
|
|
@@ -429,7 +429,7 @@ const F = ({
|
|
|
429
429
|
};
|
|
430
430
|
return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
|
|
431
431
|
}, [l, r]);
|
|
432
|
-
const u = (c) => /* @__PURE__ */ a("ul", { className: "nice-context-menu__list", role: "menu", children: c.map((t) => t.divider ? /* @__PURE__ */ a("li", { className: "nice-context-menu__divider", role: "separator" }, t.key) : /* @__PURE__ */ a("li", { role: "presentation", children: /* @__PURE__ */
|
|
432
|
+
const u = (c) => /* @__PURE__ */ a("ul", { className: "nice-context-menu__list", role: "menu", children: c.map((t) => t.divider ? /* @__PURE__ */ a("li", { className: "nice-context-menu__divider", role: "separator" }, t.key) : /* @__PURE__ */ a("li", { role: "presentation", children: /* @__PURE__ */ C(
|
|
433
433
|
"button",
|
|
434
434
|
{
|
|
435
435
|
type: "button",
|
|
@@ -443,13 +443,13 @@ const F = ({
|
|
|
443
443
|
]
|
|
444
444
|
}
|
|
445
445
|
) }, t.key)) });
|
|
446
|
-
return /* @__PURE__ */
|
|
446
|
+
return /* @__PURE__ */ C(K, { children: [
|
|
447
447
|
/* @__PURE__ */ a("div", { ref: k, onContextMenu: y, style: { display: "contents" }, children: o }),
|
|
448
448
|
l && X(
|
|
449
449
|
/* @__PURE__ */ a(
|
|
450
450
|
"div",
|
|
451
451
|
{
|
|
452
|
-
ref:
|
|
452
|
+
ref: _,
|
|
453
453
|
className: `nice-context-menu ${v || ""}`,
|
|
454
454
|
style: {
|
|
455
455
|
position: "fixed",
|
|
@@ -473,20 +473,20 @@ export {
|
|
|
473
473
|
he as NiceCommandPaletteProvider,
|
|
474
474
|
ie as NiceContextMenu,
|
|
475
475
|
re as NiceDrawer,
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
me as NiceLoadPanel,
|
|
477
|
+
Z as NiceModal,
|
|
478
478
|
te as NiceModalBody,
|
|
479
479
|
ne as NiceModalFooter,
|
|
480
480
|
ee as NiceModalHeader,
|
|
481
481
|
ae as NiceOverlayPopover,
|
|
482
|
-
|
|
482
|
+
fe as NicePopover,
|
|
483
483
|
ve as NiceResizable,
|
|
484
484
|
ge as NiceResponsiveBox,
|
|
485
485
|
we as NiceScrollView,
|
|
486
486
|
be as NiceTutorial,
|
|
487
487
|
ye as NiceTutorialProvider,
|
|
488
488
|
pe as NiceWindow,
|
|
489
|
-
|
|
490
|
-
|
|
489
|
+
Ne as NiceWindowManager,
|
|
490
|
+
_e as useCommandPalette,
|
|
491
491
|
ke as useRegisterCommands
|
|
492
492
|
};
|