react-luminus-components 1.2.4 → 1.2.7

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.
Files changed (52) hide show
  1. package/dist/.vite/manifest.json +67 -51
  2. package/dist/DataKey-BKjUrLwK.js +33 -0
  3. package/dist/DataKey-Bi3twEA-.cjs +1 -0
  4. package/dist/{SimpleTooltip-DxazAlXp.js → SimpleTooltip-CrxvDOBl.js} +1 -1
  5. package/dist/{SimpleTooltip-D6DtiDiF.cjs → SimpleTooltip-DVdVP6Q7.cjs} +1 -1
  6. package/dist/{Typography-ni7LYA_5.cjs → Typography-Dy2nkkxH.cjs} +1 -1
  7. package/dist/{Typography-CHfAgqP5.js → Typography-e-xJ0W5h.js} +1 -1
  8. package/dist/{UserAvatarToggle-B-BYsINz.js → UserAvatarToggle-B3sPIYPV.js} +19 -19
  9. package/dist/{UserAvatarToggle-cPWBMa9z.cjs → UserAvatarToggle-BHyn5qmy.cjs} +42 -42
  10. package/dist/components/HookForm/CustomSelectInput/CustomSelectInput.d.ts +4 -0
  11. package/dist/components/HookForm/index.d.ts +1 -0
  12. package/dist/components/InputContainers/FloatingLabelInput/FloatingLabelInput.d.ts +30 -2
  13. package/dist/components/InputContainers/RowLabelInput/RowLabelInput.d.ts +30 -2
  14. package/dist/components/NewTabs/Tab/Tab.d.ts +9 -0
  15. package/dist/components/NewTabs/TabPanel/TabPanel.d.ts +10 -0
  16. package/dist/components/NewTabs/Tabs/Tabs.d.ts +9 -0
  17. package/dist/components/NewTabs/index.d.ts +3 -0
  18. package/dist/components/common/SimplePicker/SimplePicker.d.ts +3 -2
  19. package/dist/contexts/luminus-components/LuminusComponentsContext.d.ts +2 -1
  20. package/dist/contexts/luminus-components/LuminusComponentsProvider.d.ts +3 -2
  21. package/dist/contexts.cjs.js +1 -1
  22. package/dist/contexts.es.js +57 -55
  23. package/dist/hooks/index.d.ts +2 -0
  24. package/dist/hooks/useKeyPress/useKeyPress.d.ts +2 -0
  25. package/dist/hooks/usePermissions/usePermissions.d.ts +4 -0
  26. package/dist/hooks.cjs.js +1 -1
  27. package/dist/hooks.es.js +45 -42
  28. package/dist/layout/SideMenu/MenuItem/MenuItem.d.ts +2 -2
  29. package/dist/layout/SideMenu/SideMenu.d.ts +1 -1
  30. package/dist/layout.cjs.js +1 -1
  31. package/dist/layout.es.js +112 -89
  32. package/dist/main.cjs.js +1 -1
  33. package/dist/main.d.ts +2 -2
  34. package/dist/main.es.js +1593 -2122
  35. package/dist/models/index.d.ts +2 -0
  36. package/dist/models/prop-types/InputContainerProps.d.ts +2 -0
  37. package/dist/models/prop-types/InputProps/InputBaseProps.d.ts +2 -2
  38. package/dist/models/texts/CustomSelectTexts.d.ts +5 -0
  39. package/dist/models/types/MenuItemType.d.ts +2 -0
  40. package/dist/models/types/MenuItemTypeExtended.d.ts +6 -0
  41. package/dist/style.css +1 -1
  42. package/dist/{useConfirm-CkSyQrSF.js → useConfirm-Dl4SoYM1.js} +1 -1
  43. package/dist/{useConfirm-BC-OkqG0.cjs → useConfirm-JWnS5nMR.cjs} +1 -1
  44. package/dist/useKeyPress-BGQt3G6e.cjs +1 -0
  45. package/dist/useKeyPress-Chkukevp.js +19 -0
  46. package/dist/usePermissions-Dh8dRtOL.js +12 -0
  47. package/dist/usePermissions-DvUaQzJ1.cjs +1 -0
  48. package/package.json +1 -1
  49. package/dist/DataKey-CBMsR50b.cjs +0 -1
  50. package/dist/DataKey-CBV-NBJf.js +0 -37
  51. package/dist/useClickOutside-BjJyGTec.js +0 -14
  52. package/dist/useClickOutside-DsVG12Cs.cjs +0 -1
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import MenuItemType from '@models/types/MenuItemType';
2
+ import { MenuItemType } from '@models/index';
3
3
  type Props = {
4
4
  headerItem: React.ReactNode;
5
5
  mainItems: MenuItemType[];
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./UserAvatarToggle-cPWBMa9z.cjs"),_=require("react"),E=require("./SimpleTooltip-D6DtiDiF.cjs"),b=require("./Typography-ni7LYA_5.cjs"),w="_side-menu-item_ra7qw_1",C="_nav-button_ra7qw_5",B="_child_ra7qw_13",M="_text_ra7qw_17",q="_icon_ra7qw_20",k="_collapse-icon_ra7qw_26",g="_collapsed_ra7qw_36",S="_expanded_ra7qw_43",f="_children-container_ra7qw_49",y="_visible_ra7qw_57",T="_children_ra7qw_49",i={"side-menu-item":"_side-menu-item_ra7qw_1",sideMenuItem:w,"nav-button":"_nav-button_ra7qw_5",navButton:C,child:B,text:M,icon:q,"collapse-icon":"_collapse-icon_ra7qw_26",collapseIcon:k,collapsed:g,expanded:S,"children-container":"_children-container_ra7qw_49",childrenContainer:f,visible:y,children:T},I=({item:e,menuExpanded:n,children:t})=>e.tooltip&&!n?s.jsxRuntimeExports.jsx(E.SimpleTooltip,{text:e.tooltip,placement:"right",children:t}):t,v=({item:e,menuExpanded:n,collapsed:t,onCollapse:o,currentPath:c})=>{var a,h;const{LinkComponent:d}=_.useContext(s.LuminusComponentsContext),[x,l]=_.useState(!1),[u]=c.split("?"),r=e.linkTo===u||((a=e.children)==null?void 0:a.some(m=>m.linkTo===u));return s.jsxRuntimeExports.jsxs("li",{className:s.classNames("luminus-side-menu-item",i.sideMenuItem,{[i.expanded]:n},{active:x||r},{open:t&&e.children}),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[s.jsxRuntimeExports.jsx(I,{item:e,menuExpanded:n,children:e.children?s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs("button",{type:"button",className:s.classNames("nav-link",i.navButton),onClick:()=>o(),children:[s.jsxRuntimeExports.jsx("div",{className:s.classNames("icon",i.icon),children:e.icon}),n&&s.jsxRuntimeExports.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:e.title}),n&&s.jsxRuntimeExports.jsx("div",{className:s.classNames("collapse-icon",i.collapseIcon,{[i.collapsed]:t}),children:s.jsxRuntimeExports.jsx(s.MdOutlineKeyboardArrowRight,{})})]})}):s.jsxRuntimeExports.jsxs(d,{to:e.linkTo??"/",className:s.classNames("nav-link",i.navButton),children:[s.jsxRuntimeExports.jsx("div",{className:s.classNames("icon",i.icon),children:e.icon}),n&&s.jsxRuntimeExports.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:e.title})]})}),s.jsxRuntimeExports.jsx("div",{className:s.classNames("children-container",i.childrenContainer,{[i.visible]:t}),children:s.jsxRuntimeExports.jsx("div",{className:s.classNames("shadow rounded children",i.children),children:(h=e.children)==null?void 0:h.map(m=>s.jsxRuntimeExports.jsx(d,{to:m.linkTo??"/",className:s.classNames("nav-link child rounded",i.navButton,i.child),children:s.jsxRuntimeExports.jsx("div",{className:s.classNames("text",i.text,"text-nowrap"),children:m.title})},m.linkTo))})})]})},$="_side-menu_n1hvm_1",L="_sidebar-header_n1hvm_13",H="_side-menu-content_n1hvm_18",F="_expand_n1hvm_22",A="_divider_n1hvm_26",p={"side-menu":"_side-menu_n1hvm_1",sideMenu:$,"sidebar-header":"_sidebar-header_n1hvm_13",sidebarHeader:L,"side-menu-content":"_side-menu-content_n1hvm_18",sideMenuContent:H,expand:F,divider:A},K=({headerItem:e,mainItems:n,secondaryItems:t,expanded:o,setExpanded:c,currentPath:d})=>{const[x,l]=_.useState(-1),u=r=>{l(r===x?-1:r)};return _.useEffect(()=>{o||l(-1)},[o]),s.jsxRuntimeExports.jsxs("section",{className:s.classNames("luminus-side-menu",p.sideMenu,{[p.expand]:o},{expand:o}),onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[s.jsxRuntimeExports.jsx("div",{className:s.classNames("sidebar-header",p.sidebarHeader),children:e}),s.jsxRuntimeExports.jsxs("ul",{className:p.sideMenuContent,children:[n.map((r,a)=>s.jsxRuntimeExports.jsx(v,{item:r,menuExpanded:o,collapsed:a===x,onCollapse:()=>u(a),currentPath:d},r.title)),s.jsxRuntimeExports.jsx("hr",{className:s.classNames("divider",p.divider)}),t.map((r,a)=>s.jsxRuntimeExports.jsx(v,{item:r,menuExpanded:o,collapsed:a===x,onCollapse:()=>u(a),currentPath:d},r.title))]})]})},P="_top-bar_1lk80_1",U="_top-bar-brand_1lk80_14",N={"top-bar":"_top-bar_1lk80_1",topBar:P,"top-bar-brand":"_top-bar-brand_1lk80_14",topBarBrand:U},z=({appName:e,leftOffset:n,centerContent:t,rightContent:o})=>{const{LinkComponent:c}=_.useContext(s.LuminusComponentsContext);return s.jsxRuntimeExports.jsxs("nav",{className:s.classNames("luminus-top-bar",N.topBar),style:{width:n?`calc(100% - ${n}px)`:void 0,left:n?`${n}px`:void 0},children:[s.jsxRuntimeExports.jsx(c,{to:"/",className:s.classNames("luminus-top-bar-brand",N.topBarBrand),children:e}),t&&s.jsxRuntimeExports.jsx("div",{children:t}),s.jsxRuntimeExports.jsx("div",{className:"d-flex justify-content-end align-items-center gap-2",children:o??null})]})},D="_side-content-bar_17kwd_1",G={"side-content-bar":"_side-content-bar_17kwd_1",sideContentBar:D},j=({width:e,children:n})=>s.jsxRuntimeExports.jsx("section",{className:s.classNames("luminus-side-content-bar",G.sideContentBar),style:{width:`${e}px`},children:n}),R=({title:e})=>s.jsxRuntimeExports.jsx("div",{className:"mb-3",children:typeof e=="string"?s.jsxRuntimeExports.jsx(b.Typography,{variant:"h3",children:e}):e}),J=({title:e,children:n,sideContent:t})=>s.jsxRuntimeExports.jsxs("div",{className:"container-fluid p-3",children:[s.jsxRuntimeExports.jsxs("div",{style:{paddingRight:t?"250px":void 0},children:[e?s.jsxRuntimeExports.jsx(R,{title:e}):null,n]}),t&&s.jsxRuntimeExports.jsx(j,{width:250,children:t})]}),O="_full-screen-container_1rm4r_1",Q={"full-screen-container":"_full-screen-container_1rm4r_1",fullScreenContainer:O},V=({title:e,children:n,sideContent:t})=>s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.classNames("ontainer-fluid p-3 overflow-hidden luminus-full-screen-container",Q.fullScreenContainer),style:{width:t?"calc(100% - 250px)":"100%"},children:[e?s.jsxRuntimeExports.jsx(R,{title:e}):null,n]}),t&&s.jsxRuntimeExports.jsx(j,{width:250,children:t})]});exports.FullScreenContainer=V;exports.MainContainer=J;exports.SideContentBar=j;exports.SideMenu=K;exports.TopBar=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./UserAvatarToggle-BHyn5qmy.cjs"),c=require("react"),w=require("./usePermissions-DvUaQzJ1.cjs"),C=require("./SimpleTooltip-DVdVP6Q7.cjs"),M=require("./Typography-Dy2nkkxH.cjs"),B="_side-menu-item_6vbwa_1",k="_disabled_6vbwa_5",g="_nav-button_6vbwa_9",S="_child_6vbwa_17",f="_text_6vbwa_21",y="_icon_6vbwa_28",P="_collapse-icon_6vbwa_34",T="_collapsed_6vbwa_44",I="_expanded_6vbwa_51",$="_children-container_6vbwa_57",H="_visible_6vbwa_65",L="_children_6vbwa_57",o={"side-menu-item":"_side-menu-item_6vbwa_1",sideMenuItem:B,disabled:k,"nav-button":"_nav-button_6vbwa_9",navButton:g,child:S,text:f,icon:y,"collapse-icon":"_collapse-icon_6vbwa_34",collapseIcon:P,collapsed:T,expanded:I,"children-container":"_children-container_6vbwa_57",childrenContainer:$,visible:H,children:L},q=({item:e,menuExpanded:t,children:i})=>e.tooltip&&!t?s.jsxRuntimeExports.jsx(C.SimpleTooltip,{text:e.tooltip,placement:"right",children:i}):i,N=({item:e,menuExpanded:t,collapsed:i,onCollapse:r,currentPath:d})=>{var v,_;const{LinkComponent:m}=c.useContext(s.LuminusComponentsContext),[p,u]=c.useState(!1),[l]=d.split("?"),h=e.linkTo===l||((v=e.children)==null?void 0:v.some(n=>n.linkTo===l));return s.jsxRuntimeExports.jsxs("li",{className:s.classNames("luminus-side-menu-item",o.sideMenuItem,{[o.expanded]:t},{active:p||h},{open:i&&e.children},{[o.disabled]:e.disabled||e.notPermitted},{disabled:e.disabled||e.notPermitted}),onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),children:[s.jsxRuntimeExports.jsx(q,{item:e,menuExpanded:t,children:e.children?s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs("button",{type:"button",className:s.classNames("nav-link",o.navButton),onClick:()=>r(),children:[s.jsxRuntimeExports.jsx("div",{className:s.classNames("icon",o.icon),children:e.icon}),t&&s.jsxRuntimeExports.jsx("div",{className:s.classNames("text",o.text,"text-nowrap"),children:e.title}),t&&s.jsxRuntimeExports.jsx("div",{className:s.classNames("collapse-icon",o.collapseIcon,{[o.collapsed]:i}),children:s.jsxRuntimeExports.jsx(s.MdOutlineKeyboardArrowRight,{})})]})}):s.jsxRuntimeExports.jsxs(m,{to:e.disabled||e.notPermitted?"/":e.linkTo??"/",className:s.classNames("nav-link",o.navButton),children:[s.jsxRuntimeExports.jsx("div",{className:s.classNames("icon",o.icon),children:e.icon}),t&&s.jsxRuntimeExports.jsx("div",{className:s.classNames("text",o.text,"text-nowrap"),children:e.title})]})}),s.jsxRuntimeExports.jsx("div",{className:s.classNames("children-container",o.childrenContainer,{[o.visible]:i}),children:s.jsxRuntimeExports.jsx("div",{className:s.classNames("shadow rounded children",o.children),children:(_=e.children)==null?void 0:_.map(n=>s.jsxRuntimeExports.jsx(m,{to:n.disabled||n.notPermitted?"/":n.linkTo??"/",className:s.classNames("nav-link child rounded",o.navButton,o.child,{[o.disabled]:n.disabled||n.notPermitted},{disabled:n.disabled||n.notPermitted}),children:s.jsxRuntimeExports.jsx("div",{className:s.classNames("text",o.text,"text-nowrap"),children:n.title})},n.linkTo))})})]})},F="_side-menu_n1hvm_1",A="_sidebar-header_n1hvm_13",U="_side-menu-content_n1hvm_18",K="_expand_n1hvm_22",z="_divider_n1hvm_26",j={"side-menu":"_side-menu_n1hvm_1",sideMenu:F,"sidebar-header":"_sidebar-header_n1hvm_13",sidebarHeader:A,"side-menu-content":"_side-menu-content_n1hvm_18",sideMenuContent:U,expand:K,divider:z},D=({headerItem:e,mainItems:t,secondaryItems:i,expanded:r,setExpanded:d,currentPath:m})=>{const[p,u]=c.useState(-1),{checkUserHasPermissions:l}=w.usePermissions(),h=c.useMemo(()=>t.map(n=>{var a;return{...n,notPermitted:!l(n.permissions??[]),children:(a=n.children)==null?void 0:a.map(x=>({...x,notPermitted:!l(x.permissions??[]),disabled:n.disabled||x.disabled}))}}),[t,l]),v=c.useMemo(()=>i.map(n=>{var a;return{...n,notPermitted:!l(n.permissions??[]),children:(a=n.children)==null?void 0:a.map(x=>({...x,notPermitted:!l(x.permissions??[])}))}}),[i,l]),_=n=>{u(n===p?-1:n)};return c.useEffect(()=>{r||u(-1)},[r]),s.jsxRuntimeExports.jsxs("section",{className:s.classNames("luminus-side-menu shadow",j.sideMenu,{[j.expand]:r},{expand:r}),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[s.jsxRuntimeExports.jsx("div",{className:s.classNames("sidebar-header",j.sidebarHeader),children:e}),s.jsxRuntimeExports.jsxs("ul",{className:j.sideMenuContent,children:[h.map((n,a)=>s.jsxRuntimeExports.jsx(N,{item:n,menuExpanded:r,collapsed:a===p,onCollapse:()=>_(a),currentPath:m},n.title)),s.jsxRuntimeExports.jsx("hr",{className:s.classNames("divider",j.divider)}),v.map((n,a)=>s.jsxRuntimeExports.jsx(N,{item:n,menuExpanded:r,collapsed:a===p,onCollapse:()=>_(a),currentPath:m},n.title))]})]})},G="_top-bar_1lk80_1",J="_top-bar-brand_1lk80_14",R={"top-bar":"_top-bar_1lk80_1",topBar:G,"top-bar-brand":"_top-bar-brand_1lk80_14",topBarBrand:J},O=({appName:e,leftOffset:t,centerContent:i,rightContent:r})=>{const{LinkComponent:d}=c.useContext(s.LuminusComponentsContext);return s.jsxRuntimeExports.jsxs("nav",{className:s.classNames("luminus-top-bar shadow",R.topBar),style:{width:t?`calc(100% - ${t}px)`:void 0,left:t?`${t}px`:void 0},children:[s.jsxRuntimeExports.jsx(d,{to:"/",className:s.classNames("luminus-top-bar-brand",R.topBarBrand),children:e}),i&&s.jsxRuntimeExports.jsx("div",{children:i}),s.jsxRuntimeExports.jsx("div",{className:"d-flex justify-content-end align-items-center gap-2",children:r??null})]})},Q="_side-content-bar_17kwd_1",V={"side-content-bar":"_side-content-bar_17kwd_1",sideContentBar:Q},b=({width:e,children:t})=>s.jsxRuntimeExports.jsx("section",{className:s.classNames("luminus-side-content-bar",V.sideContentBar),style:{width:`${e}px`},children:t}),E=({title:e})=>s.jsxRuntimeExports.jsx("div",{className:"mb-3",children:typeof e=="string"?s.jsxRuntimeExports.jsx(M.Typography,{variant:"h3",children:e}):e}),W=({title:e,children:t,sideContent:i})=>s.jsxRuntimeExports.jsxs("div",{className:"container-fluid p-3",children:[s.jsxRuntimeExports.jsxs("div",{style:{paddingRight:i?"250px":void 0},children:[e?s.jsxRuntimeExports.jsx(E,{title:e}):null,t]}),i&&s.jsxRuntimeExports.jsx(b,{width:250,children:i})]}),X="_full-screen-container_1rm4r_1",Y={"full-screen-container":"_full-screen-container_1rm4r_1",fullScreenContainer:X},Z=({title:e,children:t,sideContent:i})=>s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.classNames("ontainer-fluid p-3 overflow-hidden luminus-full-screen-container",Y.fullScreenContainer),style:{width:i?"calc(100% - 250px)":"100%"},children:[e?s.jsxRuntimeExports.jsx(E,{title:e}):null,t]}),i&&s.jsxRuntimeExports.jsx(b,{width:250,children:i})]});exports.FullScreenContainer=Z;exports.MainContainer=W;exports.SideContentBar=b;exports.SideMenu=D;exports.TopBar=O;
package/dist/layout.es.js CHANGED
@@ -1,108 +1,131 @@
1
- import { L as b, j as n, c as a, M } from "./UserAvatarToggle-B-BYsINz.js";
2
- import { useContext as w, useState as N, useEffect as f } from "react";
3
- import { S as k } from "./SimpleTooltip-DxazAlXp.js";
4
- import { T as q } from "./Typography-CHfAgqP5.js";
5
- const I = "_side-menu-item_ra7qw_1", g = "_nav-button_ra7qw_5", y = "_child_ra7qw_13", T = "_text_ra7qw_17", S = "_icon_ra7qw_20", $ = "_collapse-icon_ra7qw_26", L = "_collapsed_ra7qw_36", H = "_expanded_ra7qw_43", F = "_children-container_ra7qw_49", R = "_visible_ra7qw_57", A = "_children_ra7qw_49", i = {
6
- "side-menu-item": "_side-menu-item_ra7qw_1",
7
- sideMenuItem: I,
8
- "nav-button": "_nav-button_ra7qw_5",
9
- navButton: g,
10
- child: y,
11
- text: T,
12
- icon: S,
13
- "collapse-icon": "_collapse-icon_ra7qw_26",
14
- collapseIcon: $,
15
- collapsed: L,
16
- expanded: H,
17
- "children-container": "_children-container_ra7qw_49",
18
- childrenContainer: F,
19
- visible: R,
20
- children: A
21
- }, E = ({ item: e, menuExpanded: s, children: t }) => e.tooltip && !s ? /* @__PURE__ */ n.jsx(k, { text: e.tooltip, placement: "right", children: t }) : t, v = ({ item: e, menuExpanded: s, collapsed: t, onCollapse: o, currentPath: l }) => {
22
- var c, x;
23
- const { LinkComponent: _ } = w(b), [u, d] = N(!1), [h] = l.split("?"), r = e.linkTo === h || ((c = e.children) == null ? void 0 : c.some((m) => m.linkTo === h));
24
- return /* @__PURE__ */ n.jsxs("li", { className: a("luminus-side-menu-item", i.sideMenuItem, {
25
- [i.expanded]: s
26
- }, { active: u || r }, { open: t && e.children }), onMouseEnter: () => d(!0), onMouseLeave: () => d(!1), children: [
27
- /* @__PURE__ */ n.jsx(E, { item: e, menuExpanded: s, children: e.children ? /* @__PURE__ */ n.jsx(n.Fragment, { children: /* @__PURE__ */ n.jsxs("button", { type: "button", className: a("nav-link", i.navButton), onClick: () => o(), children: [
28
- /* @__PURE__ */ n.jsx("div", { className: a("icon", i.icon), children: e.icon }),
29
- s && /* @__PURE__ */ n.jsx("div", { className: a("text", i.text, "text-nowrap"), children: e.title }),
30
- s && /* @__PURE__ */ n.jsx("div", { className: a("collapse-icon", i.collapseIcon, {
31
- [i.collapsed]: t
32
- }), children: /* @__PURE__ */ n.jsx(M, {}) })
33
- ] }) }) : /* @__PURE__ */ n.jsxs(_, { to: e.linkTo ?? "/", className: a("nav-link", i.navButton), children: [
34
- /* @__PURE__ */ n.jsx("div", { className: a("icon", i.icon), children: e.icon }),
35
- s && /* @__PURE__ */ n.jsx("div", { className: a("text", i.text, "text-nowrap"), children: e.title })
1
+ import { L as C, j as e, c as i, M as I } from "./UserAvatarToggle-B3sPIYPV.js";
2
+ import { useContext as M, useState as B, useMemo as j, useEffect as P } from "react";
3
+ import { u as g } from "./usePermissions-Dh8dRtOL.js";
4
+ import { S as y } from "./SimpleTooltip-CrxvDOBl.js";
5
+ import { T } from "./Typography-e-xJ0W5h.js";
6
+ const S = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6vbwa_9", L = "_child_6vbwa_17", E = "_text_6vbwa_21", F = "_icon_6vbwa_28", R = "_collapse-icon_6vbwa_34", A = "_collapsed_6vbwa_44", K = "_expanded_6vbwa_51", U = "_children-container_6vbwa_57", q = "_visible_6vbwa_65", z = "_children_6vbwa_57", o = {
7
+ "side-menu-item": "_side-menu-item_6vbwa_1",
8
+ sideMenuItem: S,
9
+ disabled: $,
10
+ "nav-button": "_nav-button_6vbwa_9",
11
+ navButton: H,
12
+ child: L,
13
+ text: E,
14
+ icon: F,
15
+ "collapse-icon": "_collapse-icon_6vbwa_34",
16
+ collapseIcon: R,
17
+ collapsed: A,
18
+ expanded: K,
19
+ "children-container": "_children-container_6vbwa_57",
20
+ childrenContainer: U,
21
+ visible: q,
22
+ children: z
23
+ }, D = ({ item: n, menuExpanded: t, children: a }) => n.tooltip && !t ? /* @__PURE__ */ e.jsx(y, { text: n.tooltip, placement: "right", children: a }) : a, w = ({ item: n, menuExpanded: t, collapsed: a, onCollapse: d, currentPath: c }) => {
24
+ var b, v;
25
+ const { LinkComponent: m } = M(C), [p, _] = B(!1), [l] = c.split("?"), x = n.linkTo === l || ((b = n.children) == null ? void 0 : b.some((s) => s.linkTo === l));
26
+ return /* @__PURE__ */ e.jsxs("li", { className: i("luminus-side-menu-item", o.sideMenuItem, {
27
+ [o.expanded]: t
28
+ }, { active: p || x }, { open: a && n.children }, { [o.disabled]: n.disabled || n.notPermitted }, { disabled: n.disabled || n.notPermitted }), onMouseEnter: () => _(!0), onMouseLeave: () => _(!1), children: [
29
+ /* @__PURE__ */ e.jsx(D, { item: n, menuExpanded: t, children: n.children ? /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("button", { type: "button", className: i("nav-link", o.navButton), onClick: () => d(), children: [
30
+ /* @__PURE__ */ e.jsx("div", { className: i("icon", o.icon), children: n.icon }),
31
+ t && /* @__PURE__ */ e.jsx("div", { className: i("text", o.text, "text-nowrap"), children: n.title }),
32
+ t && /* @__PURE__ */ e.jsx("div", { className: i("collapse-icon", o.collapseIcon, {
33
+ [o.collapsed]: a
34
+ }), children: /* @__PURE__ */ e.jsx(I, {}) })
35
+ ] }) }) : /* @__PURE__ */ e.jsxs(m, { to: n.disabled || n.notPermitted ? "/" : n.linkTo ?? "/", className: i("nav-link", o.navButton), children: [
36
+ /* @__PURE__ */ e.jsx("div", { className: i("icon", o.icon), children: n.icon }),
37
+ t && /* @__PURE__ */ e.jsx("div", { className: i("text", o.text, "text-nowrap"), children: n.title })
36
38
  ] }) }),
37
- /* @__PURE__ */ n.jsx("div", { className: a("children-container", i.childrenContainer, {
38
- [i.visible]: t
39
- }), children: /* @__PURE__ */ n.jsx("div", { className: a("shadow rounded children", i.children), children: (x = e.children) == null ? void 0 : x.map((m) => /* @__PURE__ */ n.jsx(_, { to: m.linkTo ?? "/", className: a("nav-link child rounded", i.navButton, i.child), children: /* @__PURE__ */ n.jsx("div", { className: a("text", i.text, "text-nowrap"), children: m.title }) }, m.linkTo)) }) })
39
+ /* @__PURE__ */ e.jsx("div", { className: i("children-container", o.childrenContainer, {
40
+ [o.visible]: a
41
+ }), children: /* @__PURE__ */ e.jsx("div", { className: i("shadow rounded children", o.children), children: (v = n.children) == null ? void 0 : v.map((s) => /* @__PURE__ */ e.jsx(m, { to: s.disabled || s.notPermitted ? "/" : s.linkTo ?? "/", className: i("nav-link child rounded", o.navButton, o.child, { [o.disabled]: s.disabled || s.notPermitted }, { disabled: s.disabled || s.notPermitted }), children: /* @__PURE__ */ e.jsx("div", { className: i("text", o.text, "text-nowrap"), children: s.title }) }, s.linkTo)) }) })
40
42
  ] });
41
- }, K = "_side-menu_n1hvm_1", z = "_sidebar-header_n1hvm_13", D = "_side-menu-content_n1hvm_18", G = "_expand_n1hvm_22", J = "_divider_n1hvm_26", p = {
43
+ }, G = "_side-menu_n1hvm_1", J = "_sidebar-header_n1hvm_13", Q = "_side-menu-content_n1hvm_18", V = "_expand_n1hvm_22", W = "_divider_n1hvm_26", h = {
42
44
  "side-menu": "_side-menu_n1hvm_1",
43
- sideMenu: K,
45
+ sideMenu: G,
44
46
  "sidebar-header": "_sidebar-header_n1hvm_13",
45
- sidebarHeader: z,
47
+ sidebarHeader: J,
46
48
  "side-menu-content": "_side-menu-content_n1hvm_18",
47
- sideMenuContent: D,
48
- expand: G,
49
- divider: J
50
- }, en = ({ headerItem: e, mainItems: s, secondaryItems: t, expanded: o, setExpanded: l, currentPath: _ }) => {
51
- const [u, d] = N(-1), h = (r) => {
52
- d(r === u ? -1 : r);
49
+ sideMenuContent: Q,
50
+ expand: V,
51
+ divider: W
52
+ }, re = ({ headerItem: n, mainItems: t, secondaryItems: a, expanded: d, setExpanded: c, currentPath: m }) => {
53
+ const [p, _] = B(-1), { checkUserHasPermissions: l } = g(), x = j(() => t.map((s) => {
54
+ var r;
55
+ return {
56
+ ...s,
57
+ notPermitted: !l(s.permissions ?? []),
58
+ children: (r = s.children) == null ? void 0 : r.map((u) => ({
59
+ ...u,
60
+ notPermitted: !l(u.permissions ?? []),
61
+ disabled: s.disabled || u.disabled
62
+ }))
63
+ };
64
+ }), [t, l]), b = j(() => a.map((s) => {
65
+ var r;
66
+ return {
67
+ ...s,
68
+ notPermitted: !l(s.permissions ?? []),
69
+ children: (r = s.children) == null ? void 0 : r.map((u) => ({
70
+ ...u,
71
+ notPermitted: !l(u.permissions ?? [])
72
+ }))
73
+ };
74
+ }), [a, l]), v = (s) => {
75
+ _(s === p ? -1 : s);
53
76
  };
54
- return f(() => {
55
- o || d(-1);
56
- }, [o]), /* @__PURE__ */ n.jsxs("section", { className: a("luminus-side-menu", p.sideMenu, {
57
- [p.expand]: o
58
- }, { expand: o }), onMouseEnter: () => l(!0), onMouseLeave: () => l(!1), children: [
59
- /* @__PURE__ */ n.jsx("div", { className: a("sidebar-header", p.sidebarHeader), children: e }),
60
- /* @__PURE__ */ n.jsxs("ul", { className: p.sideMenuContent, children: [
61
- s.map((r, c) => /* @__PURE__ */ n.jsx(v, { item: r, menuExpanded: o, collapsed: c === u, onCollapse: () => h(c), currentPath: _ }, r.title)),
62
- /* @__PURE__ */ n.jsx("hr", { className: a("divider", p.divider) }),
63
- t.map((r, c) => /* @__PURE__ */ n.jsx(v, { item: r, menuExpanded: o, collapsed: c === u, onCollapse: () => h(c), currentPath: _ }, r.title))
77
+ return P(() => {
78
+ d || _(-1);
79
+ }, [d]), /* @__PURE__ */ e.jsxs("section", { className: i("luminus-side-menu shadow", h.sideMenu, {
80
+ [h.expand]: d
81
+ }, { expand: d }), onMouseEnter: () => c(!0), onMouseLeave: () => c(!1), children: [
82
+ /* @__PURE__ */ e.jsx("div", { className: i("sidebar-header", h.sidebarHeader), children: n }),
83
+ /* @__PURE__ */ e.jsxs("ul", { className: h.sideMenuContent, children: [
84
+ x.map((s, r) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: d, collapsed: r === p, onCollapse: () => v(r), currentPath: m }, s.title)),
85
+ /* @__PURE__ */ e.jsx("hr", { className: i("divider", h.divider) }),
86
+ b.map((s, r) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: d, collapsed: r === p, onCollapse: () => v(r), currentPath: m }, s.title))
64
87
  ] })
65
88
  ] });
66
- }, P = "_top-bar_1lk80_1", Q = "_top-bar-brand_1lk80_14", j = {
89
+ }, X = "_top-bar_1lk80_1", Y = "_top-bar-brand_1lk80_14", N = {
67
90
  "top-bar": "_top-bar_1lk80_1",
68
- topBar: P,
91
+ topBar: X,
69
92
  "top-bar-brand": "_top-bar-brand_1lk80_14",
70
- topBarBrand: Q
71
- }, sn = ({ appName: e, leftOffset: s, centerContent: t, rightContent: o }) => {
72
- const { LinkComponent: l } = w(b);
73
- return /* @__PURE__ */ n.jsxs("nav", { className: a("luminus-top-bar", j.topBar), style: {
74
- width: s ? `calc(100% - ${s}px)` : void 0,
75
- left: s ? `${s}px` : void 0
93
+ topBarBrand: Y
94
+ }, de = ({ appName: n, leftOffset: t, centerContent: a, rightContent: d }) => {
95
+ const { LinkComponent: c } = M(C);
96
+ return /* @__PURE__ */ e.jsxs("nav", { className: i("luminus-top-bar shadow", N.topBar), style: {
97
+ width: t ? `calc(100% - ${t}px)` : void 0,
98
+ left: t ? `${t}px` : void 0
76
99
  }, children: [
77
- /* @__PURE__ */ n.jsx(l, { to: "/", className: a("luminus-top-bar-brand", j.topBarBrand), children: e }),
78
- t && /* @__PURE__ */ n.jsx("div", { children: t }),
79
- /* @__PURE__ */ n.jsx("div", { className: "d-flex justify-content-end align-items-center gap-2", children: o ?? null })
100
+ /* @__PURE__ */ e.jsx(c, { to: "/", className: i("luminus-top-bar-brand", N.topBarBrand), children: n }),
101
+ a && /* @__PURE__ */ e.jsx("div", { children: a }),
102
+ /* @__PURE__ */ e.jsx("div", { className: "d-flex justify-content-end align-items-center gap-2", children: d ?? null })
80
103
  ] });
81
- }, U = "_side-content-bar_17kwd_1", V = {
104
+ }, Z = "_side-content-bar_17kwd_1", O = {
82
105
  "side-content-bar": "_side-content-bar_17kwd_1",
83
- sideContentBar: U
84
- }, C = ({ width: e, children: s }) => /* @__PURE__ */ n.jsx("section", { className: a("luminus-side-content-bar", V.sideContentBar), style: {
85
- width: `${e}px`
86
- }, children: s }), B = ({ title: e }) => /* @__PURE__ */ n.jsx("div", { className: "mb-3", children: typeof e == "string" ? /* @__PURE__ */ n.jsx(q, { variant: "h3", children: e }) : e }), tn = ({ title: e, children: s, sideContent: t }) => /* @__PURE__ */ n.jsxs("div", { className: "container-fluid p-3", children: [
87
- /* @__PURE__ */ n.jsxs("div", { style: { paddingRight: t ? "250px" : void 0 }, children: [
88
- e ? /* @__PURE__ */ n.jsx(B, { title: e }) : null,
89
- s
106
+ sideContentBar: Z
107
+ }, f = ({ width: n, children: t }) => /* @__PURE__ */ e.jsx("section", { className: i("luminus-side-content-bar", O.sideContentBar), style: {
108
+ width: `${n}px`
109
+ }, children: t }), k = ({ title: n }) => /* @__PURE__ */ e.jsx("div", { className: "mb-3", children: typeof n == "string" ? /* @__PURE__ */ e.jsx(T, { variant: "h3", children: n }) : n }), le = ({ title: n, children: t, sideContent: a }) => /* @__PURE__ */ e.jsxs("div", { className: "container-fluid p-3", children: [
110
+ /* @__PURE__ */ e.jsxs("div", { style: { paddingRight: a ? "250px" : void 0 }, children: [
111
+ n ? /* @__PURE__ */ e.jsx(k, { title: n }) : null,
112
+ t
90
113
  ] }),
91
- t && /* @__PURE__ */ n.jsx(C, { width: 250, children: t })
92
- ] }), W = "_full-screen-container_1rm4r_1", X = {
114
+ a && /* @__PURE__ */ e.jsx(f, { width: 250, children: a })
115
+ ] }), ee = "_full-screen-container_1rm4r_1", ne = {
93
116
  "full-screen-container": "_full-screen-container_1rm4r_1",
94
- fullScreenContainer: W
95
- }, an = ({ title: e, children: s, sideContent: t }) => /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
96
- /* @__PURE__ */ n.jsxs("div", { className: a("ontainer-fluid p-3 overflow-hidden luminus-full-screen-container", X.fullScreenContainer), style: { width: t ? "calc(100% - 250px)" : "100%" }, children: [
97
- e ? /* @__PURE__ */ n.jsx(B, { title: e }) : null,
98
- s
117
+ fullScreenContainer: ee
118
+ }, ce = ({ title: n, children: t, sideContent: a }) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
119
+ /* @__PURE__ */ e.jsxs("div", { className: i("ontainer-fluid p-3 overflow-hidden luminus-full-screen-container", ne.fullScreenContainer), style: { width: a ? "calc(100% - 250px)" : "100%" }, children: [
120
+ n ? /* @__PURE__ */ e.jsx(k, { title: n }) : null,
121
+ t
99
122
  ] }),
100
- t && /* @__PURE__ */ n.jsx(C, { width: 250, children: t })
123
+ a && /* @__PURE__ */ e.jsx(f, { width: 250, children: a })
101
124
  ] });
102
125
  export {
103
- an as FullScreenContainer,
104
- tn as MainContainer,
105
- C as SideContentBar,
106
- en as SideMenu,
107
- sn as TopBar
126
+ ce as FullScreenContainer,
127
+ le as MainContainer,
128
+ f as SideContentBar,
129
+ re as SideMenu,
130
+ de as TopBar
108
131
  };