@nice2dev/ui 1.4.0 → 1.4.2
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 +51 -0
- package/dist/NiceCodeEditor-DhdjnDLV.cjs +289 -0
- package/dist/{NiceDataGrid-BT6iCUgP.cjs → NiceDataGrid-CrKDzMM1.cjs} +1 -1
- package/dist/{NiceForm-Bysp66Ef.cjs → NiceForm-CT9hEXpc.cjs} +1 -1
- package/dist/NiceLoginForm-C2-WgRn0.cjs +1 -0
- package/dist/NiceMention-BZEHqPrf.cjs +432 -0
- package/dist/NiceModuleLifecyclePanel-DKlqKPy2.cjs +1 -0
- package/dist/{NiceSavedQueryPanel-BbznsXFd.cjs → NiceSavedQueryPanel-C5Ab_NWx.cjs} +1 -1
- package/dist/NiceScheduler-BZQAKEVF.cjs +5 -0
- package/dist/{NiceWindow-pgR4c-kQ.cjs → NiceWindow-BklnkBpu.cjs} +1 -1
- package/dist/charts/NiceLinearGauge.mjs +96 -83
- package/dist/charts/NicePolarChart.mjs +47 -47
- package/dist/charts-BzlvCCg9.cjs +768 -0
- package/dist/charts.cjs +1 -1
- package/dist/{core-lazy-CL4ZIxF-.cjs → core-lazy-VTd5zfoZ.cjs} +1 -1
- package/dist/data.cjs +1 -1
- package/dist/display/NiceAvatar.mjs +40 -24
- package/dist/editors/pickers/NiceDateRangeBox.mjs +92 -92
- package/dist/editors/pickers/NiceDateTimePicker.mjs +173 -173
- package/dist/editors/rich/NiceCodeEditor.mjs +645 -584
- package/dist/editors/rich/NiceDocumentEditor.mjs +277 -254
- package/dist/editors.cjs +1 -1
- package/dist/feedback/NiceDrawer.mjs +15 -15
- package/dist/feedback.cjs +1 -1
- package/dist/index.cjs +202 -202
- package/dist/index.d.ts +18 -0
- package/dist/lazy.cjs +1 -1
- package/dist/navigation/NiceNavShell.mjs +646 -593
- package/dist/navigation/NiceSidebarNav.mjs +844 -823
- package/dist/navigation.cjs +1 -1
- package/dist/overlays/NiceWindow.mjs +91 -91
- package/dist/overlays.cjs +1 -1
- package/dist/planning/NiceScheduler.mjs +170 -169
- package/dist/planning/NiceSchedulerViews.mjs +242 -233
- package/dist/style.css +2 -2
- package/dist/utility/intlNames.mjs +26 -16
- package/package.json +4 -4
- package/dist/NiceCodeEditor-D0QZW88r.cjs +0 -268
- package/dist/NiceLoginForm-FGf32sro.cjs +0 -1
- package/dist/NiceMention-sc8W-DwH.cjs +0 -430
- package/dist/NiceModuleLifecyclePanel-DBQPCa_V.cjs +0 -1
- package/dist/NiceScheduler-3Ez0zSQJ.cjs +0 -5
- package/dist/charts-B0tHOpJ7.cjs +0 -768
package/dist/navigation.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./NiceModuleLifecyclePanel-DBQPCa_V.cjs"),e=require("react/jsx-runtime"),i=require("@nice2dev/ui-core"),a=require("react"),z=require("./pickerCommons-CwcCc8Qi.cjs"),K=require("./NicePagination-D7XxeNFz.cjs"),E=[],W=Object.assign(a.forwardRef(({items:p=E,activeKey:f,collapsed:l=!1,width:x=240,collapsedWidth:d=52,onItemClick:y,onCollapseChange:A,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),[k,h]=a.useState(new Set),c=a.useCallback(n=>{h(t=>{const o=new Set(t);return o.has(n)?o.delete(n):o.add(n),o})},[]);if(M==="hidden")return null;const u=(n,t=0)=>{const o=n.children&&n.children.length>0,r=k.has(n.key),N=n.key===f;return e.jsxs("li",{className:"nice-sidebar-menu__item",children:[e.jsxs("button",{className:`nice-sidebar-menu__btn ${N?"nice-sidebar-menu__btn--active":""} ${n.disabled?"nice-sidebar-menu__btn--disabled":""}`,style:{paddingLeft:l?void 0:12+t*16},onClick:()=>o?c(n.key):y?.(n),disabled:n.disabled,title:l?n.text:void 0,type:"button",children:[n.icon&&e.jsx("span",{className:"nice-sidebar-menu__icon",children:n.icon}),!l&&e.jsx("span",{className:"nice-sidebar-menu__label",children:n.text}),!l&&n.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-menu__badge",children:n.badge}),!l&&o&&e.jsx("span",{className:"nice-sidebar-menu__chevron",children:e.jsx(i.NiceIcon,{name:r?"chevron-down":"chevron-right",size:14})})]}),o&&r&&!l&&e.jsx("ul",{className:"nice-sidebar-menu__children",children:n.children.map($=>u($,t+1))})]},n.key)};return e.jsxs("nav",{ref:m,id:j,className:`nice-sidebar-menu nice-sidebar-menu--${_} ${l?"nice-sidebar-menu--collapsed":""} ${R??""}`,style:{...I,width:l?d:x},...C,children:[g&&e.jsx("div",{className:"nice-sidebar-menu__header",children:g}),e.jsx("ul",{className:"nice-sidebar-menu__list",role:"list",children:p.map(n=>u(n))}),b&&e.jsx("div",{className:"nice-sidebar-menu__footer",children:b})]})}),{displayName:"NiceSidebarMenu"}),q=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,brand:x,actions:d,size:y="md",className:A,style:g,id:b,accessMode:_,...R},I)=>{const S=i.useControlId(b),D=i.useNiceAccessMode(_,b),[C,m]=a.useState(null),[j,M]=a.useState(!1),k=a.useRef(null),h=a.useRef(null);i.useRovingFocus(k,{orientation:"horizontal",wrap:!0,typeahead:!0}),i.useRovingFocus(h,{orientation:"vertical",wrap:!0,typeahead:!0}),i.useOverlayFocus(h,{open:C!=null&&!j,modal:!1,onClose:()=>m(null)});const c=n=>{M(!1),m(n)},u=n=>{if(n.key!=="ArrowLeft"&&n.key!=="ArrowRight")return;n.preventDefault();const t=[...k.current?.querySelectorAll(".nice-top-menu__btn")??[]],o=t.findIndex(N=>N.getAttribute("aria-expanded")==="true"),r=t[(o+(n.key==="ArrowRight"?1:-1)+t.length)%t.length];m(null),r?.focus()};return D==="hidden"?null:e.jsxs("nav",{ref:I,id:S,className:`nice-top-menu nice-top-menu--${y} ${A??""}`,style:g,...R,children:[x&&e.jsx("div",{className:"nice-top-menu__brand",children:x}),e.jsx("ul",{className:"nice-top-menu__items",role:"menubar",ref:k,children:p.map(n=>{const t=n.children&&n.children.length>0,o=C===n.key;return e.jsxs("li",{className:"nice-top-menu__item",onMouseEnter:()=>{t&&(M(!0),m(n.key))},onMouseLeave:()=>t&&m(null),children:[e.jsxs("button",{className:`nice-top-menu__btn ${n.key===f?"nice-top-menu__btn--active":""}`,onClick:()=>t?o?m(null):c(n.key):l?.(n),onKeyDown:r=>{const N=r.nativeEvent.niceSource;t&&r.key==="ArrowDown"&&N!=="gamepad"&&(r.preventDefault(),c(n.key))},role:"menuitem","aria-haspopup":t,"aria-expanded":o,disabled:n.disabled,type:"button",children:[n.icon&&e.jsx("span",{children:n.icon}),e.jsx("span",{children:n.text}),t&&e.jsx("span",{className:"nice-top-menu__chevron",children:e.jsx(i.NiceIcon,{name:"chevron-down",size:14})})]}),t&&o&&e.jsx("ul",{className:"nice-top-menu__dropdown",role:"menu",ref:h,onKeyDown:u,children:n.children.map(r=>e.jsx("li",{children:e.jsxs("button",{className:`nice-top-menu__dropdown-btn ${r.key===f?"nice-top-menu__dropdown-btn--active":""}`,onClick:()=>{l?.(r),m(null)},disabled:r.disabled,role:"menuitem",type:"button",children:[r.icon&&e.jsx("span",{children:r.icon}),e.jsx("span",{children:r.text}),r.badge!==void 0&&e.jsx("span",{className:"nice-top-menu__badge",children:r.badge})]})},r.key))})]},n.key)})}),d&&e.jsx("div",{className:"nice-top-menu__actions",children:d})]})}),{displayName:"NiceTopMenu"}),U=[],H=Object.assign(a.forwardRef(({tabs:p=U,activeTab:f,onTabChange:l,onItemClick:x,minimized:d=!1,onMinimizeToggle:y,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=a.useRef(null);i.useRovingFocus(D,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const C=i.useControlId(_),m=i.useNiceAccessMode(R,_),{t:j}=i.useNiceTranslation(),[M,k]=a.useState(void 0),h=f??M??p[0]?.key,c=p.find(n=>n.key===h),u=a.useCallback(n=>{k(n),l?.(n)},[l]);return m==="hidden"?null:e.jsxs("div",{ref:S,id:C,className:`nice-ribbon-menu nice-ribbon-menu--${A} ${d?"nice-ribbon-menu--minimized":""} ${g??""}`,style:b,...I,children:[e.jsxs("div",{className:"nice-ribbon-menu__tabs",ref:D,role:"tablist",children:[p.map(n=>e.jsx("button",{className:`nice-ribbon-menu__tab ${n.key===h?"nice-ribbon-menu__tab--active":""}`,onClick:()=>u(n.key),role:"tab","aria-selected":n.key===h,type:"button",children:n.label},n.key)),e.jsx("button",{className:"nice-ribbon-menu__minimize",onClick:()=>y?.(!d),type:"button","aria-label":d?j("nav.expand","Expand"):j("nav.collapse","Collapse"),children:e.jsx(i.NiceIcon,{name:d?"chevron-down":"chevron-up",size:14})})]}),!d&&c&&e.jsx("div",{className:"nice-ribbon-menu__panel",role:"tabpanel",children:c.groups.map((n,t)=>e.jsxs("div",{className:"nice-ribbon-menu__group",children:[e.jsx("div",{className:"nice-ribbon-menu__group-items",children:n.items.map(o=>e.jsxs("button",{className:"nice-ribbon-menu__item",onClick:()=>x?.(o),disabled:o.disabled,type:"button",children:[o.icon&&e.jsx("span",{className:"nice-ribbon-menu__item-icon",children:o.icon}),e.jsx("span",{className:"nice-ribbon-menu__item-label",children:o.text})]},o.key))}),e.jsx("div",{className:"nice-ribbon-menu__group-label",children:n.label})]},t))})]})}),{displayName:"NiceRibbonMenu"}),V=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,position:x="bottom",autoHide:d=!1,iconSize:y=40,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=i.useControlId(_),C=i.useNiceAccessMode(R,_),[m,j]=a.useState(!1),[M,k]=a.useState(!1),h=!d||m||M;return C==="hidden"?null:e.jsx("div",{ref:S,id:D,className:`nice-dock-menu nice-dock-menu--${x} nice-dock-menu--${A} ${d&&!h?"nice-dock-menu--hidden":""} ${g??""}`,style:b,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),onFocus:()=>k(!0),onBlur:c=>{c.currentTarget.contains(c.relatedTarget)||k(!1)},...I,children:e.jsx("div",{className:"nice-dock-menu__items",children:p.map(c=>e.jsxs("button",{className:`nice-dock-menu__item ${c.key===f?"nice-dock-menu__item--active":""}`,onClick:()=>l?.(c),disabled:c.disabled,title:c.text,"aria-label":c.text,type:"button",style:{width:y,height:y},children:[c.icon?e.jsx("span",{className:"nice-dock-menu__icon",children:c.icon}):e.jsx("span",{children:c.text[0]}),c.badge!==void 0&&e.jsx("span",{className:"nice-dock-menu__badge",children:c.badge})]},c.key))})})}),{displayName:"NiceDockMenu"}),Y=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,open:x,onOpenChange:d,position:y="left",panelWidth:A=280,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),{t:k}=i.useNiceTranslation(),[h,c]=a.useState(!1),u=x??h,n=a.useCallback(v=>{c(v),d?.(v)},[d]),t=a.useCallback(()=>n(!u),[u,n]),o=a.useCallback(v=>{l?.(v),n(!1)},[l,n]),r=a.useRef(null),N=a.useRef(null),$=a.useRef(null);return a.useLayoutEffect(()=>{$.current?.toggleAttribute("inert",!u)},[u]),i.useMenuButton(r,N,{open:u,onOpenChange:n,closeOnFocusOut:!1,closeOnOutsidePress:!1}),M==="hidden"?null:e.jsxs("div",{ref:m,id:j,className:`nice-hamburger-menu nice-hamburger-menu--${_} ${R??""}`,style:I,...C,children:[e.jsx("button",{ref:r,className:"nice-hamburger-menu__trigger",onClick:t,"aria-label":k("nav.menu","Menu"),"aria-haspopup":"menu","aria-expanded":u,type:"button",children:e.jsxs("span",{className:`nice-hamburger-menu__icon ${u?"nice-hamburger-menu__icon--open":""}`,children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}),u&&e.jsx("div",{className:"nice-hamburger-menu__backdrop",onClick:t,"aria-hidden":!0}),e.jsxs("div",{ref:$,className:`nice-hamburger-menu__panel nice-hamburger-menu__panel--${y} ${u?"nice-hamburger-menu__panel--open":""}`,style:{width:A},children:[g&&e.jsx("div",{className:"nice-hamburger-menu__header",children:g}),e.jsx("ul",{className:"nice-hamburger-menu__list",role:"menu",ref:N,children:p.map(v=>e.jsx("li",{children:e.jsxs("button",{className:`nice-hamburger-menu__item ${v.key===f?"nice-hamburger-menu__item--active":""}`,onClick:()=>o(v),disabled:v.disabled,role:"menuitem",type:"button",children:[v.icon&&e.jsx("span",{className:"nice-hamburger-menu__item-icon",children:v.icon}),e.jsx("span",{children:v.text}),v.badge!==void 0&&e.jsx("span",{className:"nice-hamburger-menu__item-badge",children:v.badge})]})},v.key))}),b&&e.jsx("div",{className:"nice-hamburger-menu__footer",children:b})]})]})}),{displayName:"NiceHamburgerMenu"}),J=Object.assign(a.forwardRef(({canGoBack:p=!1,canGoForward:f=!1,onBack:l,onForward:x,onRefresh:d,enableShortcuts:y=!0,showRefresh:A=!0,showStop:g=!0,isLoading:b=!1,onStop:_,size:R="md",variant:I="default",tooltipPosition:S="bottom",backIcon:D,forwardIcon:C,refreshIcon:m,stopIcon:j,className:M,style:k,id:h,accessMode:c,disabled:u,...n},t)=>{const o=i.useControlId(h),r=i.useNiceAccessMode(c,h),{t:N}=i.useNiceTranslation();if(a.useEffect(()=>{if(!y||u)return;const T=w=>{const O=w.altKey,B=w.ctrlKey||w.metaKey;O&&w.key==="ArrowLeft"?(w.preventDefault(),p&&l?.()):O&&w.key==="ArrowRight"?(w.preventDefault(),f&&x?.()):w.key==="F5"||B&&w.key==="r"?(w.preventDefault(),b?_?.():d?.()):w.key==="Escape"&&b&&(w.preventDefault(),_?.())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[y,u,p,f,b,l,x,d,_]),r==="hidden")return null;const $=r==="disabled"||u,v=D??e.jsx(i.NiceIcon,{name:"chevron-left",size:16}),F=C??e.jsx(i.NiceIcon,{name:"chevron-right",size:16}),L=m??e.jsx(i.NiceIcon,{name:"refresh",size:16}),P=j??e.jsx(i.NiceIcon,{name:"close",size:16});return e.jsxs("div",{ref:t,id:o,className:`nice-nav-controls nice-nav-controls--${R} nice-nav-controls--${I}${$?" nice-nav-controls--disabled":""}${M?` ${M}`:""}`,style:k,role:"navigation","aria-label":N("nav.controls","Navigation controls"),...n,children:[e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--back${p?"":" nice-nav-controls__btn--disabled"}`,onClick:l,disabled:$||!p,"aria-label":N("nav.back","Back"),title:`${N("nav.back","Back")} (Alt+←)`,children:v}),e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--forward${f?"":" nice-nav-controls__btn--disabled"}`,onClick:x,disabled:$||!f,"aria-label":N("nav.forward","Forward"),title:`${N("nav.forward","Forward")} (Alt+→)`,children:F}),(A||g&&b)&&(b?e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--stop nice-nav-controls__btn--loading",onClick:_,disabled:$,"aria-label":N("nav.stop","Stop"),title:`${N("nav.stop","Stop")} (Esc)`,children:P}):e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--refresh",onClick:d,disabled:$,"aria-label":N("nav.refresh","Refresh"),title:`${N("nav.refresh","Refresh")} (F5)`,children:L}))]})}),{displayName:"NiceNavigationControls"});exports.DEFAULT_SIDEBAR_PREFS=s.DEFAULT_SIDEBAR_PREFS;exports.DesktopContextMenu=s.DesktopContextMenu;exports.DesktopGrid=s.DesktopGrid;exports.DesktopStartMenu=s.DesktopStartMenu;exports.DesktopSystemTray=s.DesktopSystemTray;exports.DesktopTaskbar=s.DesktopTaskbar;exports.NiceAccordion=s.NiceAccordion;exports.NiceAppLayout=s.NiceAppLayout;exports.NiceAuthButtons=s.NiceAuthButtons;exports.NiceBreadcrumb=s.NiceBreadcrumb;exports.NiceCard=s.NiceCard;exports.NiceConsole=s.NiceConsole;exports.NiceContextMenu=s.NiceContextMenu;exports.NiceDashboardLayout=s.NiceDashboardLayout;exports.NiceDashboardShell=s.NiceDashboardShell;exports.NiceDesktop=s.NiceDesktop;exports.NiceDock=s.NiceDock;exports.NiceDynamicSidebar=s.NiceDynamicSidebar;exports.NiceHybridShell=s.NiceHybridShell;exports.NiceKioskShell=s.NiceKioskShell;exports.NiceMdiWorkspace=s.NiceMdiWorkspace;exports.NiceMenu=s.NiceMenu;exports.NiceMinimalShell=s.NiceMinimalShell;exports.NiceModeSelector=s.NiceModeSelector;exports.NiceModernShell=s.NiceModernShell;exports.NiceModuleLifecyclePanel=s.NiceModuleLifecyclePanel;exports.NiceNavMenu=s.NiceNavMenu;exports.NiceNavbar=s.NiceNavbar;exports.NiceOrganizationProfileForm=s.NiceOrganizationProfileForm;exports.NicePwaShell=s.NicePwaShell;exports.NiceSetupWizard=s.NiceSetupWizard;exports.NiceSidebarNav=s.NiceSidebarNav;exports.NiceSplitter=s.NiceSplitter;exports.NiceUserMenu=s.NiceUserMenu;exports.NiceWizard=s.NiceWizard;exports.SIDEBAR_DEFAULT_FAVORITE_LIST=s.SIDEBAR_DEFAULT_FAVORITE_LIST;exports.SIDEBAR_MODE_META=s.SIDEBAR_MODE_META;exports.findSidebarItemByRoute=s.findSidebarItemByRoute;exports.mapSidebarViews=s.mapSidebarViews;exports.sidebarModeLabel=s.sidebarModeLabel;exports.walkSidebarNav=s.walkSidebarNav;exports.NiceTabs=z.NiceTabs;exports.NicePagination=K.NicePagination;exports.NiceDockMenu=V;exports.NiceHamburgerMenu=Y;exports.NiceNavigationControls=J;exports.NiceRibbonMenu=H;exports.NiceSidebarMenu=W;exports.NiceTopMenu=q;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./NiceModuleLifecyclePanel-DKlqKPy2.cjs"),e=require("react/jsx-runtime"),i=require("@nice2dev/ui-core"),a=require("react"),z=require("./pickerCommons-CwcCc8Qi.cjs"),K=require("./NicePagination-D7XxeNFz.cjs"),E=[],W=Object.assign(a.forwardRef(({items:p=E,activeKey:f,collapsed:l=!1,width:x=240,collapsedWidth:d=52,onItemClick:y,onCollapseChange:A,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),[k,h]=a.useState(new Set),c=a.useCallback(n=>{h(t=>{const o=new Set(t);return o.has(n)?o.delete(n):o.add(n),o})},[]);if(M==="hidden")return null;const u=(n,t=0)=>{const o=n.children&&n.children.length>0,r=k.has(n.key),N=n.key===f;return e.jsxs("li",{className:"nice-sidebar-menu__item",children:[e.jsxs("button",{className:`nice-sidebar-menu__btn ${N?"nice-sidebar-menu__btn--active":""} ${n.disabled?"nice-sidebar-menu__btn--disabled":""}`,style:{paddingLeft:l?void 0:12+t*16},onClick:()=>o?c(n.key):y?.(n),disabled:n.disabled,title:l?n.text:void 0,type:"button",children:[n.icon&&e.jsx("span",{className:"nice-sidebar-menu__icon",children:n.icon}),!l&&e.jsx("span",{className:"nice-sidebar-menu__label",children:n.text}),!l&&n.badge!==void 0&&e.jsx("span",{className:"nice-sidebar-menu__badge",children:n.badge}),!l&&o&&e.jsx("span",{className:"nice-sidebar-menu__chevron",children:e.jsx(i.NiceIcon,{name:r?"chevron-down":"chevron-right",size:14})})]}),o&&r&&!l&&e.jsx("ul",{className:"nice-sidebar-menu__children",children:n.children.map($=>u($,t+1))})]},n.key)};return e.jsxs("nav",{ref:m,id:j,className:`nice-sidebar-menu nice-sidebar-menu--${_} ${l?"nice-sidebar-menu--collapsed":""} ${R??""}`,style:{...I,width:l?d:x},...C,children:[g&&e.jsx("div",{className:"nice-sidebar-menu__header",children:g}),e.jsx("ul",{className:"nice-sidebar-menu__list",role:"list",children:p.map(n=>u(n))}),b&&e.jsx("div",{className:"nice-sidebar-menu__footer",children:b})]})}),{displayName:"NiceSidebarMenu"}),q=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,brand:x,actions:d,size:y="md",className:A,style:g,id:b,accessMode:_,...R},I)=>{const S=i.useControlId(b),D=i.useNiceAccessMode(_,b),[C,m]=a.useState(null),[j,M]=a.useState(!1),k=a.useRef(null),h=a.useRef(null);i.useRovingFocus(k,{orientation:"horizontal",wrap:!0,typeahead:!0}),i.useRovingFocus(h,{orientation:"vertical",wrap:!0,typeahead:!0}),i.useOverlayFocus(h,{open:C!=null&&!j,modal:!1,onClose:()=>m(null)});const c=n=>{M(!1),m(n)},u=n=>{if(n.key!=="ArrowLeft"&&n.key!=="ArrowRight")return;n.preventDefault();const t=[...k.current?.querySelectorAll(".nice-top-menu__btn")??[]],o=t.findIndex(N=>N.getAttribute("aria-expanded")==="true"),r=t[(o+(n.key==="ArrowRight"?1:-1)+t.length)%t.length];m(null),r?.focus()};return D==="hidden"?null:e.jsxs("nav",{ref:I,id:S,className:`nice-top-menu nice-top-menu--${y} ${A??""}`,style:g,...R,children:[x&&e.jsx("div",{className:"nice-top-menu__brand",children:x}),e.jsx("ul",{className:"nice-top-menu__items",role:"menubar",ref:k,children:p.map(n=>{const t=n.children&&n.children.length>0,o=C===n.key;return e.jsxs("li",{className:"nice-top-menu__item",onMouseEnter:()=>{t&&(M(!0),m(n.key))},onMouseLeave:()=>t&&m(null),children:[e.jsxs("button",{className:`nice-top-menu__btn ${n.key===f?"nice-top-menu__btn--active":""}`,onClick:()=>t?o?m(null):c(n.key):l?.(n),onKeyDown:r=>{const N=r.nativeEvent.niceSource;t&&r.key==="ArrowDown"&&N!=="gamepad"&&(r.preventDefault(),c(n.key))},role:"menuitem","aria-haspopup":t,"aria-expanded":o,disabled:n.disabled,type:"button",children:[n.icon&&e.jsx("span",{children:n.icon}),e.jsx("span",{children:n.text}),t&&e.jsx("span",{className:"nice-top-menu__chevron",children:e.jsx(i.NiceIcon,{name:"chevron-down",size:14})})]}),t&&o&&e.jsx("ul",{className:"nice-top-menu__dropdown",role:"menu",ref:h,onKeyDown:u,children:n.children.map(r=>e.jsx("li",{children:e.jsxs("button",{className:`nice-top-menu__dropdown-btn ${r.key===f?"nice-top-menu__dropdown-btn--active":""}`,onClick:()=>{l?.(r),m(null)},disabled:r.disabled,role:"menuitem",type:"button",children:[r.icon&&e.jsx("span",{children:r.icon}),e.jsx("span",{children:r.text}),r.badge!==void 0&&e.jsx("span",{className:"nice-top-menu__badge",children:r.badge})]})},r.key))})]},n.key)})}),d&&e.jsx("div",{className:"nice-top-menu__actions",children:d})]})}),{displayName:"NiceTopMenu"}),U=[],H=Object.assign(a.forwardRef(({tabs:p=U,activeTab:f,onTabChange:l,onItemClick:x,minimized:d=!1,onMinimizeToggle:y,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=a.useRef(null);i.useRovingFocus(D,{orientation:"horizontal",wrap:!0,activateOnMove:!0});const C=i.useControlId(_),m=i.useNiceAccessMode(R,_),{t:j}=i.useNiceTranslation(),[M,k]=a.useState(void 0),h=f??M??p[0]?.key,c=p.find(n=>n.key===h),u=a.useCallback(n=>{k(n),l?.(n)},[l]);return m==="hidden"?null:e.jsxs("div",{ref:S,id:C,className:`nice-ribbon-menu nice-ribbon-menu--${A} ${d?"nice-ribbon-menu--minimized":""} ${g??""}`,style:b,...I,children:[e.jsxs("div",{className:"nice-ribbon-menu__tabs",ref:D,role:"tablist",children:[p.map(n=>e.jsx("button",{className:`nice-ribbon-menu__tab ${n.key===h?"nice-ribbon-menu__tab--active":""}`,onClick:()=>u(n.key),role:"tab","aria-selected":n.key===h,type:"button",children:n.label},n.key)),e.jsx("button",{className:"nice-ribbon-menu__minimize",onClick:()=>y?.(!d),type:"button","aria-label":d?j("nav.expand","Expand"):j("nav.collapse","Collapse"),children:e.jsx(i.NiceIcon,{name:d?"chevron-down":"chevron-up",size:14})})]}),!d&&c&&e.jsx("div",{className:"nice-ribbon-menu__panel",role:"tabpanel",children:c.groups.map((n,t)=>e.jsxs("div",{className:"nice-ribbon-menu__group",children:[e.jsx("div",{className:"nice-ribbon-menu__group-items",children:n.items.map(o=>e.jsxs("button",{className:"nice-ribbon-menu__item",onClick:()=>x?.(o),disabled:o.disabled,type:"button",children:[o.icon&&e.jsx("span",{className:"nice-ribbon-menu__item-icon",children:o.icon}),e.jsx("span",{className:"nice-ribbon-menu__item-label",children:o.text})]},o.key))}),e.jsx("div",{className:"nice-ribbon-menu__group-label",children:n.label})]},t))})]})}),{displayName:"NiceRibbonMenu"}),V=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,position:x="bottom",autoHide:d=!1,iconSize:y=40,size:A="md",className:g,style:b,id:_,accessMode:R,...I},S)=>{const D=i.useControlId(_),C=i.useNiceAccessMode(R,_),[m,j]=a.useState(!1),[M,k]=a.useState(!1),h=!d||m||M;return C==="hidden"?null:e.jsx("div",{ref:S,id:D,className:`nice-dock-menu nice-dock-menu--${x} nice-dock-menu--${A} ${d&&!h?"nice-dock-menu--hidden":""} ${g??""}`,style:b,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),onFocus:()=>k(!0),onBlur:c=>{c.currentTarget.contains(c.relatedTarget)||k(!1)},...I,children:e.jsx("div",{className:"nice-dock-menu__items",children:p.map(c=>e.jsxs("button",{className:`nice-dock-menu__item ${c.key===f?"nice-dock-menu__item--active":""}`,onClick:()=>l?.(c),disabled:c.disabled,title:c.text,"aria-label":c.text,type:"button",style:{width:y,height:y},children:[c.icon?e.jsx("span",{className:"nice-dock-menu__icon",children:c.icon}):e.jsx("span",{children:c.text[0]}),c.badge!==void 0&&e.jsx("span",{className:"nice-dock-menu__badge",children:c.badge})]},c.key))})})}),{displayName:"NiceDockMenu"}),Y=Object.assign(a.forwardRef(({items:p=E,activeKey:f,onItemClick:l,open:x,onOpenChange:d,position:y="left",panelWidth:A=280,header:g,footer:b,size:_="md",className:R,style:I,id:S,accessMode:D,...C},m)=>{const j=i.useControlId(S),M=i.useNiceAccessMode(D,S),{t:k}=i.useNiceTranslation(),[h,c]=a.useState(!1),u=x??h,n=a.useCallback(v=>{c(v),d?.(v)},[d]),t=a.useCallback(()=>n(!u),[u,n]),o=a.useCallback(v=>{l?.(v),n(!1)},[l,n]),r=a.useRef(null),N=a.useRef(null),$=a.useRef(null);return a.useLayoutEffect(()=>{$.current?.toggleAttribute("inert",!u)},[u]),i.useMenuButton(r,N,{open:u,onOpenChange:n,closeOnFocusOut:!1,closeOnOutsidePress:!1}),M==="hidden"?null:e.jsxs("div",{ref:m,id:j,className:`nice-hamburger-menu nice-hamburger-menu--${_} ${R??""}`,style:I,...C,children:[e.jsx("button",{ref:r,className:"nice-hamburger-menu__trigger",onClick:t,"aria-label":k("nav.menu","Menu"),"aria-haspopup":"menu","aria-expanded":u,type:"button",children:e.jsxs("span",{className:`nice-hamburger-menu__icon ${u?"nice-hamburger-menu__icon--open":""}`,children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}),u&&e.jsx("div",{className:"nice-hamburger-menu__backdrop",onClick:t,"aria-hidden":!0}),e.jsxs("div",{ref:$,className:`nice-hamburger-menu__panel nice-hamburger-menu__panel--${y} ${u?"nice-hamburger-menu__panel--open":""}`,style:{width:A},children:[g&&e.jsx("div",{className:"nice-hamburger-menu__header",children:g}),e.jsx("ul",{className:"nice-hamburger-menu__list",role:"menu",ref:N,children:p.map(v=>e.jsx("li",{children:e.jsxs("button",{className:`nice-hamburger-menu__item ${v.key===f?"nice-hamburger-menu__item--active":""}`,onClick:()=>o(v),disabled:v.disabled,role:"menuitem",type:"button",children:[v.icon&&e.jsx("span",{className:"nice-hamburger-menu__item-icon",children:v.icon}),e.jsx("span",{children:v.text}),v.badge!==void 0&&e.jsx("span",{className:"nice-hamburger-menu__item-badge",children:v.badge})]})},v.key))}),b&&e.jsx("div",{className:"nice-hamburger-menu__footer",children:b})]})]})}),{displayName:"NiceHamburgerMenu"}),J=Object.assign(a.forwardRef(({canGoBack:p=!1,canGoForward:f=!1,onBack:l,onForward:x,onRefresh:d,enableShortcuts:y=!0,showRefresh:A=!0,showStop:g=!0,isLoading:b=!1,onStop:_,size:R="md",variant:I="default",tooltipPosition:S="bottom",backIcon:D,forwardIcon:C,refreshIcon:m,stopIcon:j,className:M,style:k,id:h,accessMode:c,disabled:u,...n},t)=>{const o=i.useControlId(h),r=i.useNiceAccessMode(c,h),{t:N}=i.useNiceTranslation();if(a.useEffect(()=>{if(!y||u)return;const T=w=>{const O=w.altKey,B=w.ctrlKey||w.metaKey;O&&w.key==="ArrowLeft"?(w.preventDefault(),p&&l?.()):O&&w.key==="ArrowRight"?(w.preventDefault(),f&&x?.()):w.key==="F5"||B&&w.key==="r"?(w.preventDefault(),b?_?.():d?.()):w.key==="Escape"&&b&&(w.preventDefault(),_?.())};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[y,u,p,f,b,l,x,d,_]),r==="hidden")return null;const $=r==="disabled"||u,v=D??e.jsx(i.NiceIcon,{name:"chevron-left",size:16}),F=C??e.jsx(i.NiceIcon,{name:"chevron-right",size:16}),L=m??e.jsx(i.NiceIcon,{name:"refresh",size:16}),P=j??e.jsx(i.NiceIcon,{name:"close",size:16});return e.jsxs("div",{ref:t,id:o,className:`nice-nav-controls nice-nav-controls--${R} nice-nav-controls--${I}${$?" nice-nav-controls--disabled":""}${M?` ${M}`:""}`,style:k,role:"navigation","aria-label":N("nav.controls","Navigation controls"),...n,children:[e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--back${p?"":" nice-nav-controls__btn--disabled"}`,onClick:l,disabled:$||!p,"aria-label":N("nav.back","Back"),title:`${N("nav.back","Back")} (Alt+←)`,children:v}),e.jsx("button",{type:"button",className:`nice-nav-controls__btn nice-nav-controls__btn--forward${f?"":" nice-nav-controls__btn--disabled"}`,onClick:x,disabled:$||!f,"aria-label":N("nav.forward","Forward"),title:`${N("nav.forward","Forward")} (Alt+→)`,children:F}),(A||g&&b)&&(b?e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--stop nice-nav-controls__btn--loading",onClick:_,disabled:$,"aria-label":N("nav.stop","Stop"),title:`${N("nav.stop","Stop")} (Esc)`,children:P}):e.jsx("button",{type:"button",className:"nice-nav-controls__btn nice-nav-controls__btn--refresh",onClick:d,disabled:$,"aria-label":N("nav.refresh","Refresh"),title:`${N("nav.refresh","Refresh")} (F5)`,children:L}))]})}),{displayName:"NiceNavigationControls"});exports.DEFAULT_SIDEBAR_PREFS=s.DEFAULT_SIDEBAR_PREFS;exports.DesktopContextMenu=s.DesktopContextMenu;exports.DesktopGrid=s.DesktopGrid;exports.DesktopStartMenu=s.DesktopStartMenu;exports.DesktopSystemTray=s.DesktopSystemTray;exports.DesktopTaskbar=s.DesktopTaskbar;exports.NiceAccordion=s.NiceAccordion;exports.NiceAppLayout=s.NiceAppLayout;exports.NiceAuthButtons=s.NiceAuthButtons;exports.NiceBreadcrumb=s.NiceBreadcrumb;exports.NiceCard=s.NiceCard;exports.NiceConsole=s.NiceConsole;exports.NiceContextMenu=s.NiceContextMenu;exports.NiceDashboardLayout=s.NiceDashboardLayout;exports.NiceDashboardShell=s.NiceDashboardShell;exports.NiceDesktop=s.NiceDesktop;exports.NiceDock=s.NiceDock;exports.NiceDynamicSidebar=s.NiceDynamicSidebar;exports.NiceHybridShell=s.NiceHybridShell;exports.NiceKioskShell=s.NiceKioskShell;exports.NiceMdiWorkspace=s.NiceMdiWorkspace;exports.NiceMenu=s.NiceMenu;exports.NiceMinimalShell=s.NiceMinimalShell;exports.NiceModeSelector=s.NiceModeSelector;exports.NiceModernShell=s.NiceModernShell;exports.NiceModuleLifecyclePanel=s.NiceModuleLifecyclePanel;exports.NiceNavMenu=s.NiceNavMenu;exports.NiceNavbar=s.NiceNavbar;exports.NiceOrganizationProfileForm=s.NiceOrganizationProfileForm;exports.NicePwaShell=s.NicePwaShell;exports.NiceSetupWizard=s.NiceSetupWizard;exports.NiceSidebarNav=s.NiceSidebarNav;exports.NiceSplitter=s.NiceSplitter;exports.NiceUserMenu=s.NiceUserMenu;exports.NiceWizard=s.NiceWizard;exports.SIDEBAR_DEFAULT_FAVORITE_LIST=s.SIDEBAR_DEFAULT_FAVORITE_LIST;exports.SIDEBAR_MODE_META=s.SIDEBAR_MODE_META;exports.findSidebarItemByRoute=s.findSidebarItemByRoute;exports.mapSidebarViews=s.mapSidebarViews;exports.sidebarModeLabel=s.sidebarModeLabel;exports.walkSidebarNav=s.walkSidebarNav;exports.NiceTabs=z.NiceTabs;exports.NicePagination=K.NicePagination;exports.NiceDockMenu=V;exports.NiceHamburgerMenu=Y;exports.NiceNavigationControls=J;exports.NiceRibbonMenu=H;exports.NiceSidebarMenu=W;exports.NiceTopMenu=q;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as V, jsx as i, Fragment as
|
|
2
|
-
import { useControlId as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
function
|
|
5
|
-
const S = z <=
|
|
1
|
+
import { jsxs as V, jsx as i, Fragment as cn } from "react/jsx-runtime";
|
|
2
|
+
import { useControlId as dn, useNiceAccessMode as un, useNiceTranslation as ln, NiceIcon as R } from "@nice2dev/ui-core";
|
|
3
|
+
import { forwardRef as an, useRef as j, useState as x, useCallback as l, useEffect as Z } from "react";
|
|
4
|
+
function wn(z, M, C, K, _) {
|
|
5
|
+
const S = z <= _, X = z + _ >= C, b = M <= _, Y = M + _ >= K;
|
|
6
6
|
return b && S ? "top-left" : b && X ? "top-right" : Y && S ? "bottom-left" : Y && X ? "bottom-right" : S ? "left" : X ? "right" : b ? "top" : Y ? "bottom" : "none";
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function hn(z) {
|
|
9
9
|
switch (z) {
|
|
10
10
|
case "left":
|
|
11
11
|
return { left: 0, top: 0, width: "50%", height: "100%" };
|
|
@@ -27,75 +27,75 @@ function an(z) {
|
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
/* @__PURE__ */
|
|
30
|
+
const gn = /* @__PURE__ */ Object.assign(
|
|
31
|
+
/* @__PURE__ */ an(
|
|
32
32
|
({
|
|
33
33
|
windowKey: z,
|
|
34
34
|
title: M,
|
|
35
35
|
icon: C,
|
|
36
36
|
children: K,
|
|
37
|
-
footer:
|
|
37
|
+
footer: _,
|
|
38
38
|
x: S,
|
|
39
39
|
y: X,
|
|
40
40
|
defaultPosition: b,
|
|
41
41
|
width: Y = 480,
|
|
42
|
-
height:
|
|
43
|
-
minWidth:
|
|
44
|
-
minHeight:
|
|
42
|
+
height: he = 360,
|
|
43
|
+
minWidth: me = 200,
|
|
44
|
+
minHeight: fe = 120,
|
|
45
45
|
maxWidth: B,
|
|
46
46
|
maxHeight: ee,
|
|
47
47
|
zIndex: U = 1,
|
|
48
|
-
closable:
|
|
49
|
-
minimizable:
|
|
48
|
+
closable: pe = !0,
|
|
49
|
+
minimizable: ge = !0,
|
|
50
50
|
maximizable: O = !0,
|
|
51
|
-
fullscreenable:
|
|
52
|
-
pinnable:
|
|
51
|
+
fullscreenable: xe = !1,
|
|
52
|
+
pinnable: _e = !1,
|
|
53
53
|
resizable: P = !0,
|
|
54
54
|
draggable: ne = !0,
|
|
55
|
-
snappable:
|
|
56
|
-
snapThreshold:
|
|
57
|
-
minimized:
|
|
58
|
-
maximized:
|
|
59
|
-
fullscreen:
|
|
60
|
-
pinned:
|
|
61
|
-
focused:
|
|
55
|
+
snappable: ye = !0,
|
|
56
|
+
snapThreshold: ve = 20,
|
|
57
|
+
minimized: ze,
|
|
58
|
+
maximized: Me,
|
|
59
|
+
fullscreen: be,
|
|
60
|
+
pinned: Ne,
|
|
61
|
+
focused: Ee,
|
|
62
62
|
onClose: te,
|
|
63
63
|
onMinimize: ie,
|
|
64
64
|
onMaximize: oe,
|
|
65
65
|
onFullscreen: re,
|
|
66
|
-
onPin:
|
|
67
|
-
onFocus:
|
|
68
|
-
onMove:
|
|
69
|
-
onResize:
|
|
70
|
-
onSnap:
|
|
66
|
+
onPin: se,
|
|
67
|
+
onFocus: ce,
|
|
68
|
+
onMove: Ie,
|
|
69
|
+
onResize: Se,
|
|
70
|
+
onSnap: Xe,
|
|
71
71
|
onTitleBarDoubleClick: T,
|
|
72
|
-
size:
|
|
72
|
+
size: Ye = "md",
|
|
73
73
|
statusBar: de,
|
|
74
|
-
titleBarActions:
|
|
75
|
-
className:
|
|
76
|
-
style:
|
|
74
|
+
titleBarActions: Le,
|
|
75
|
+
className: $e,
|
|
76
|
+
style: ke,
|
|
77
77
|
id: ue,
|
|
78
|
-
accessMode:
|
|
79
|
-
...
|
|
80
|
-
},
|
|
81
|
-
const Fe =
|
|
78
|
+
accessMode: Re,
|
|
79
|
+
...Ce
|
|
80
|
+
}, De) => {
|
|
81
|
+
const Fe = dn(ue), We = un(Re, ue), { t: a } = ln(), A = j(null);
|
|
82
82
|
A.current == null && (A.current = `nice-window-${Math.random().toString(36).slice(2, 10)}`);
|
|
83
|
-
const t = z ?? A.current,
|
|
83
|
+
const t = z ?? A.current, He = S ?? b?.x ?? 100, je = X ?? b?.y ?? 100, [D, N] = x({ x: He, y: je }), [F, W] = x({ width: Y, height: he }), [Ke, Ue] = x(!1), [Oe, Pe] = x(!1), [Te, Ae] = x(!1), [qe, Ge] = x(!1), [d, q] = x("none"), Je = ze ?? Ke, c = Me ?? Oe, r = be ?? Te, L = Ne ?? qe, H = Ee ?? !0, y = D.x, v = D.y, w = F.width, h = F.height, m = j(null), s = j(null), n = j(null), [Qe, le] = x(!1), Ve = l(() => {
|
|
84
84
|
te?.(t);
|
|
85
|
-
}, [t, te]),
|
|
86
|
-
|
|
85
|
+
}, [t, te]), Ze = l(() => {
|
|
86
|
+
Ue(!0), ie?.(t);
|
|
87
87
|
}, [t, ie]), G = l(() => {
|
|
88
|
-
const e = !
|
|
89
|
-
|
|
90
|
-
}, [t,
|
|
88
|
+
const e = !c;
|
|
89
|
+
Pe(e), !e && n.current ? (N({ x: n.current.x, y: n.current.y }), W({ width: n.current.w, height: n.current.h }), n.current = null) : e && (n.current = { x: y, y: v, w, h }), q("none"), oe?.(t, e);
|
|
90
|
+
}, [t, c, y, v, w, h, oe]), J = l(() => {
|
|
91
91
|
const e = !r;
|
|
92
|
-
|
|
93
|
-
}, [t, r,
|
|
92
|
+
Ae(e), e ? n.current = { x: y, y: v, w, h } : n.current && (N({ x: n.current.x, y: n.current.y }), W({ width: n.current.w, height: n.current.h }), n.current = null), re?.(t, e);
|
|
93
|
+
}, [t, r, y, v, w, h, re]), Be = l(() => {
|
|
94
94
|
const e = !L;
|
|
95
|
-
|
|
96
|
-
}, [t, L,
|
|
97
|
-
|
|
98
|
-
}, [t,
|
|
95
|
+
Ge(e), se?.(t, e);
|
|
96
|
+
}, [t, L, se]), E = l(() => {
|
|
97
|
+
ce?.(t);
|
|
98
|
+
}, [t, ce]), en = l(() => {
|
|
99
99
|
T ? T(t) : O && G();
|
|
100
100
|
}, [t, O, G, T]);
|
|
101
101
|
Z(() => {
|
|
@@ -103,59 +103,59 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
103
103
|
if (!m.current)
|
|
104
104
|
return;
|
|
105
105
|
const u = f.clientX - m.current.startX + m.current.origX, $ = f.clientY - m.current.startY + m.current.origY;
|
|
106
|
-
N({ x: u, y: $ }),
|
|
106
|
+
N({ x: u, y: $ }), Ie?.(t, { x: u, y: $ });
|
|
107
107
|
}, o = (f) => {
|
|
108
108
|
if (m.current) {
|
|
109
|
-
if (
|
|
110
|
-
const u =
|
|
109
|
+
if (ye) {
|
|
110
|
+
const u = wn(
|
|
111
111
|
f.clientX,
|
|
112
112
|
f.clientY,
|
|
113
113
|
window.innerWidth,
|
|
114
114
|
window.innerHeight,
|
|
115
|
-
|
|
115
|
+
ve
|
|
116
116
|
);
|
|
117
|
-
u !== "none" && (n.current = { x:
|
|
117
|
+
u !== "none" && (n.current = { x: D.x, y: D.y, w, h }, q(u), Xe?.(t, u));
|
|
118
118
|
}
|
|
119
|
-
m.current = null;
|
|
119
|
+
m.current = null, le(!1);
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
return document.addEventListener("mousemove", e), document.addEventListener("mouseup", o), () => {
|
|
123
123
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", o);
|
|
124
124
|
};
|
|
125
125
|
});
|
|
126
|
-
const
|
|
126
|
+
const nn = l(
|
|
127
127
|
(e) => {
|
|
128
|
-
!ne ||
|
|
128
|
+
!ne || c || r || (e.preventDefault(), d !== "none" && (n.current && (N({ x: n.current.x, y: n.current.y }), W({ width: n.current.w, height: n.current.h })), q("none")), E(), m.current = { startX: e.clientX, startY: e.clientY, origX: y, origY: v }, le(!0));
|
|
129
129
|
},
|
|
130
|
-
[ne,
|
|
130
|
+
[ne, c, r, d, y, v, E]
|
|
131
131
|
);
|
|
132
132
|
Z(() => {
|
|
133
133
|
const e = (f) => {
|
|
134
|
-
if (!
|
|
134
|
+
if (!s.current)
|
|
135
135
|
return;
|
|
136
|
-
const u = f.clientX -
|
|
137
|
-
let p =
|
|
138
|
-
if (I.includes("e") && (p =
|
|
139
|
-
const Q =
|
|
136
|
+
const u = f.clientX - s.current.startX, $ = f.clientY - s.current.startY, I = s.current.handle;
|
|
137
|
+
let p = s.current.origW, g = s.current.origH;
|
|
138
|
+
if (I.includes("e") && (p = s.current.origW + u), I.includes("w") && (p = s.current.origW - u), I.includes("s") && (g = s.current.origH + $), I.includes("n") && (g = s.current.origH - $), p = Math.max(me, B ? Math.min(B, p) : p), g = Math.max(fe, ee ? Math.min(ee, g) : g), I.includes("w")) {
|
|
139
|
+
const Q = F.width - p;
|
|
140
140
|
N((k) => ({ ...k, x: k.x + Q }));
|
|
141
141
|
}
|
|
142
142
|
if (I.includes("n")) {
|
|
143
|
-
const Q =
|
|
143
|
+
const Q = F.height - g;
|
|
144
144
|
N((k) => ({ ...k, y: k.y + Q }));
|
|
145
145
|
}
|
|
146
|
-
W({ width: p, height: g }),
|
|
146
|
+
W({ width: p, height: g }), Se?.(t, { width: p, height: g });
|
|
147
147
|
}, o = () => {
|
|
148
|
-
|
|
148
|
+
s.current = null;
|
|
149
149
|
};
|
|
150
150
|
return document.addEventListener("mousemove", e), document.addEventListener("mouseup", o), () => {
|
|
151
151
|
document.removeEventListener("mousemove", e), document.removeEventListener("mouseup", o);
|
|
152
152
|
};
|
|
153
153
|
});
|
|
154
|
-
const
|
|
154
|
+
const tn = l(
|
|
155
155
|
(e, o) => {
|
|
156
|
-
!P ||
|
|
156
|
+
!P || c || r || d !== "none" || (o.preventDefault(), o.stopPropagation(), E(), s.current = { startX: o.clientX, startY: o.clientY, origW: w, origH: h, handle: e });
|
|
157
157
|
},
|
|
158
|
-
[P,
|
|
158
|
+
[P, c, r, d, w, h, E]
|
|
159
159
|
);
|
|
160
160
|
if (Z(() => {
|
|
161
161
|
if (!H)
|
|
@@ -164,9 +164,9 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
164
164
|
o.key === "Escape" && r && J();
|
|
165
165
|
};
|
|
166
166
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
167
|
-
}, [H, r, J]),
|
|
167
|
+
}, [H, r, J]), We === "hidden" || Je)
|
|
168
168
|
return null;
|
|
169
|
-
const
|
|
169
|
+
const ae = d !== "none" ? hn(d) : null, we = c || r, on = r ? { position: "fixed", top: 0, left: 0, width: "100vw", height: "100vh", zIndex: 999999 } : c ? { position: "absolute", top: 0, left: 0, width: "100%", height: "100%", zIndex: U } : ae ? { position: "absolute", ...ae, zIndex: U } : { position: "absolute", top: v, left: y, width: w, height: h, zIndex: U }, rn = ["n", "e", "s", "w", "ne", "se", "sw", "nw"], sn = {
|
|
170
170
|
n: "ns-resize",
|
|
171
171
|
s: "ns-resize",
|
|
172
172
|
e: "ew-resize",
|
|
@@ -181,10 +181,10 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
181
181
|
/* @__PURE__ */ V(
|
|
182
182
|
"div",
|
|
183
183
|
{
|
|
184
|
-
ref:
|
|
184
|
+
ref: De,
|
|
185
185
|
id: Fe,
|
|
186
|
-
className: `nice-window nice-window--${
|
|
187
|
-
style: { ...
|
|
186
|
+
className: `nice-window nice-window--${Ye} ${H ? "nice-window--focused" : ""} ${L ? "nice-window--pinned" : ""} ${we ? "nice-window--maximized" : ""} ${Qe ? "nice-window--dragging" : ""} ${d !== "none" ? `nice-window--snapped-${d}` : ""} ${$e ?? ""}`,
|
|
187
|
+
style: { ...on, ...ke },
|
|
188
188
|
onMouseDown: E,
|
|
189
189
|
onFocus: H ? void 0 : E,
|
|
190
190
|
role: "dialog",
|
|
@@ -192,35 +192,35 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
192
192
|
tabIndex: -1,
|
|
193
193
|
"data-nice-focus-scope": "spatial",
|
|
194
194
|
"data-nice-region": M,
|
|
195
|
-
...
|
|
195
|
+
...Ce,
|
|
196
196
|
children: [
|
|
197
197
|
/* @__PURE__ */ V(
|
|
198
198
|
"div",
|
|
199
199
|
{
|
|
200
200
|
className: "nice-window__titlebar",
|
|
201
|
-
onMouseDown:
|
|
202
|
-
onDoubleClick:
|
|
201
|
+
onMouseDown: nn,
|
|
202
|
+
onDoubleClick: en,
|
|
203
203
|
children: [
|
|
204
204
|
C && /* @__PURE__ */ i("span", { className: "nice-window__icon", children: C }),
|
|
205
205
|
/* @__PURE__ */ i("span", { className: "nice-window__title", children: M }),
|
|
206
206
|
/* @__PURE__ */ V("div", { className: "nice-window__actions", children: [
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
Le,
|
|
208
|
+
_e && /* @__PURE__ */ i(
|
|
209
209
|
"button",
|
|
210
210
|
{
|
|
211
211
|
type: "button",
|
|
212
212
|
className: `nice-window__action nice-window__action--pin ${L ? "nice-window__action--active" : ""}`,
|
|
213
|
-
onClick:
|
|
213
|
+
onClick: Be,
|
|
214
214
|
title: L ? a("window.unpin", "Unpin") : a("window.pin", "Pin"),
|
|
215
215
|
children: /* @__PURE__ */ i(R, { name: "paperclip", size: 14 })
|
|
216
216
|
}
|
|
217
217
|
),
|
|
218
|
-
|
|
218
|
+
ge && /* @__PURE__ */ i(
|
|
219
219
|
"button",
|
|
220
220
|
{
|
|
221
221
|
type: "button",
|
|
222
222
|
className: "nice-window__action nice-window__action--minimize",
|
|
223
|
-
onClick:
|
|
223
|
+
onClick: Ze,
|
|
224
224
|
title: a("window.minimize", "Minimize"),
|
|
225
225
|
children: /* @__PURE__ */ i(R, { name: "minus", size: 14 })
|
|
226
226
|
}
|
|
@@ -231,11 +231,11 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
231
231
|
type: "button",
|
|
232
232
|
className: "nice-window__action nice-window__action--maximize",
|
|
233
233
|
onClick: G,
|
|
234
|
-
title:
|
|
235
|
-
children: /* @__PURE__ */ i(R, { name:
|
|
234
|
+
title: c ? a("window.restore", "Restore") : a("window.maximize", "Maximize"),
|
|
235
|
+
children: /* @__PURE__ */ i(R, { name: c ? "copy" : "window", size: 14 })
|
|
236
236
|
}
|
|
237
237
|
),
|
|
238
|
-
|
|
238
|
+
xe && /* @__PURE__ */ i(
|
|
239
239
|
"button",
|
|
240
240
|
{
|
|
241
241
|
type: "button",
|
|
@@ -245,12 +245,12 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
245
245
|
children: /* @__PURE__ */ i(R, { name: r ? "collapse" : "expand", size: 14 })
|
|
246
246
|
}
|
|
247
247
|
),
|
|
248
|
-
|
|
248
|
+
pe && /* @__PURE__ */ i(
|
|
249
249
|
"button",
|
|
250
250
|
{
|
|
251
251
|
type: "button",
|
|
252
252
|
className: "nice-window__action nice-window__action--close",
|
|
253
|
-
onClick:
|
|
253
|
+
onClick: Ve,
|
|
254
254
|
title: a("window.close", "Close"),
|
|
255
255
|
children: /* @__PURE__ */ i(R, { name: "close", size: 14 })
|
|
256
256
|
}
|
|
@@ -260,14 +260,14 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
260
260
|
}
|
|
261
261
|
),
|
|
262
262
|
/* @__PURE__ */ i("div", { className: "nice-window__body", children: K }),
|
|
263
|
-
|
|
263
|
+
_ && /* @__PURE__ */ i("div", { className: "nice-window__footer", children: _ }),
|
|
264
264
|
de && /* @__PURE__ */ i("div", { className: "nice-window__statusbar", children: de }),
|
|
265
|
-
P && !
|
|
265
|
+
P && !we && d === "none" && /* @__PURE__ */ i(cn, { children: rn.map((e) => /* @__PURE__ */ i(
|
|
266
266
|
"div",
|
|
267
267
|
{
|
|
268
268
|
className: `nice-window__resize nice-window__resize--${e}`,
|
|
269
|
-
style: { cursor:
|
|
270
|
-
onMouseDown: (o) =>
|
|
269
|
+
style: { cursor: sn[e] },
|
|
270
|
+
onMouseDown: (o) => tn(e, o)
|
|
271
271
|
},
|
|
272
272
|
e
|
|
273
273
|
)) })
|
|
@@ -280,5 +280,5 @@ const fn = /* @__PURE__ */ Object.assign(
|
|
|
280
280
|
{ displayName: "NiceWindow" }
|
|
281
281
|
);
|
|
282
282
|
export {
|
|
283
|
-
|
|
283
|
+
gn as NiceWindow
|
|
284
284
|
};
|
package/dist/overlays.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NiceWindow-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./NiceWindow-BklnkBpu.cjs");exports.NiceActionSheet=e.NiceActionSheet;exports.NiceBlockUI=e.NiceBlockUI;exports.NiceBox=e.NiceBox;exports.NiceCommandPaletteProvider=e.NiceCommandPaletteProvider;exports.NiceLoadPanel=e.NiceLoadPanel;exports.NiceModalBody=e.NiceModalBody;exports.NiceModalFooter=e.NiceModalFooter;exports.NiceModalHeader=e.NiceModalHeader;exports.NiceOverlayBottomSheet=e.NiceBottomSheet;exports.NiceOverlayContextMenu=e.NiceContextMenu;exports.NiceOverlayDrawer=e.NiceDrawer;exports.NiceOverlayModal=e.NiceModal;exports.NiceOverlayPopover=e.NicePopover;exports.NicePopover=e.NicePopover$1;exports.NiceResizable=e.NiceResizable;exports.NiceResponsiveBox=e.NiceResponsiveBox;exports.NiceScrollView=e.NiceScrollView;exports.NiceTutorial=e.NiceTutorial;exports.NiceTutorialProvider=e.NiceTutorialProvider;exports.NiceWindow=e.NiceWindow;exports.NiceWindowManager=e.NiceWindowManager;exports.useCommandPalette=e.useCommandPalette;exports.useRegisterCommands=e.useRegisterCommands;
|