react-luminus-components 1.2.39 → 1.2.40
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ContainerProps } from '@models/index';
|
|
3
|
-
declare const FullScreenContainer: ({ title, children, sideContent, noPadding, className, }: ContainerProps) => import("react").JSX.Element;
|
|
3
|
+
declare const FullScreenContainer: ({ title, children, sideContent, sideContentWidth, noPadding, className, }: ContainerProps) => import("react").JSX.Element;
|
|
4
4
|
export default FullScreenContainer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ContainerProps } from '@models/index';
|
|
3
|
-
declare const MainContainer: ({ title, children, sideContent, noPadding, className }: ContainerProps) => import("react").JSX.Element;
|
|
3
|
+
declare const MainContainer: ({ title, children, sideContent, sideContentWidth, noPadding, className, }: ContainerProps) => import("react").JSX.Element;
|
|
4
4
|
export default MainContainer;
|
package/dist/layout.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./NoInputContainer-BkFSaMQy.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./NoInputContainer-BkFSaMQy.cjs"),u=require("react");require("react-hook-form");const w=require("./usePermissions-yA39pMjm.cjs"),C=require("./SimpleTooltip-C_iRq-Q0.cjs"),M="_side-menu-item_6vbwa_1",B="_disabled_6vbwa_5",k="_nav-button_6vbwa_9",S="_child_6vbwa_17",P="_text_6vbwa_21",f="_icon_6vbwa_28",g="_collapse-icon_6vbwa_34",I="_collapsed_6vbwa_44",y="_expanded_6vbwa_51",T="_children-container_6vbwa_57",$="_visible_6vbwa_65",H="_children_6vbwa_57",o={"side-menu-item":"_side-menu-item_6vbwa_1",sideMenuItem:M,disabled:B,"nav-button":"_nav-button_6vbwa_9",navButton:k,child:S,text:P,icon:f,"collapse-icon":"_collapse-icon_6vbwa_34",collapseIcon:g,collapsed:I,expanded:y,"children-container":"_children-container_6vbwa_57",childrenContainer:T,visible:$,children:H},L=({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:a,currentPath:l})=>{var v,_;const{LinkComponent:c}=u.useContext(s.LuminusComponentsContext),[p,x]=u.useState(!1),[d]=l.split("?"),h=e.linkTo===d||((v=e.children)==null?void 0:v.some(n=>n.linkTo===d));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:()=>x(!0),onMouseLeave:()=>x(!1),children:[s.jsxRuntimeExports.jsx(L,{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:()=>a(),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(c,{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(c,{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))})})]})},q="_side-menu_n1hvm_1",F="_sidebar-header_n1hvm_13",A="_side-menu-content_n1hvm_18",K="_expand_n1hvm_22",U="_divider_n1hvm_26",j={"side-menu":"_side-menu_n1hvm_1",sideMenu:q,"sidebar-header":"_sidebar-header_n1hvm_13",sidebarHeader:F,"side-menu-content":"_side-menu-content_n1hvm_18",sideMenuContent:A,expand:K,divider:U},z=({headerItem:e,mainItems:t,secondaryItems:i,expanded:a,setExpanded:l,currentPath:c})=>{const[p,x]=u.useState(-1),{checkUserHasPermissions:d}=w.usePermissions(),h=u.useMemo(()=>t.map(n=>{var r;return{...n,notPermitted:!d(n.permissions??[]),children:(r=n.children)==null?void 0:r.map(m=>({...m,notPermitted:!d(m.permissions??[]),disabled:n.disabled||m.disabled}))}}),[t,d]),v=u.useMemo(()=>i.map(n=>{var r;return{...n,notPermitted:!d(n.permissions??[]),children:(r=n.children)==null?void 0:r.map(m=>({...m,notPermitted:!d(m.permissions??[])}))}}),[i,d]),_=n=>{x(n===p?-1:n)};return u.useEffect(()=>{a||x(-1)},[a]),s.jsxRuntimeExports.jsxs("section",{className:s.classNames("luminus-side-menu shadow",j.sideMenu,{[j.expand]:a},{expand:a}),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!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,r)=>s.jsxRuntimeExports.jsx(N,{item:n,menuExpanded:a,collapsed:r===p,onCollapse:()=>_(r),currentPath:c},n.title)),s.jsxRuntimeExports.jsx("hr",{className:s.classNames("divider",j.divider)}),v.map((n,r)=>s.jsxRuntimeExports.jsx(N,{item:n,menuExpanded:a,collapsed:r===p,onCollapse:()=>_(r),currentPath:c},n.title))]})]})},D="_top-bar_1lk80_1",G="_top-bar-brand_1lk80_14",R={"top-bar":"_top-bar_1lk80_1",topBar:D,"top-bar-brand":"_top-bar-brand_1lk80_14",topBarBrand:G},J=({appName:e,leftOffset:t,centerContent:i,rightContent:a})=>{const{LinkComponent:l}=u.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(l,{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:a??null})]})},O="_side-content-bar_17kwd_1",Q={"side-content-bar":"_side-content-bar_17kwd_1",sideContentBar:O},b=({width:e,children:t})=>s.jsxRuntimeExports.jsx("section",{className:s.classNames("luminus-side-content-bar shadow",Q.sideContentBar),style:{width:`${e}px`},children:t}),E=({title:e})=>s.jsxRuntimeExports.jsx("div",{className:"mb-3",children:typeof e=="string"?s.jsxRuntimeExports.jsx(s.Typography,{variant:"h3",children:e}):e}),V=({title:e,children:t,sideContent:i,sideContentWidth:a=250,noPadding:l,className:c})=>s.jsxRuntimeExports.jsxs("div",{className:s.classNames("container-fluid",l?"p-0":"p-3",c),children:[s.jsxRuntimeExports.jsxs("div",{style:{paddingRight:i?`${a}px`:void 0},children:[e?s.jsxRuntimeExports.jsx(E,{title:e}):null,t]}),i&&s.jsxRuntimeExports.jsx(b,{width:250,children:i})]}),W="_full-screen-container_1rm4r_1",X={"full-screen-container":"_full-screen-container_1rm4r_1",fullScreenContainer:W},Y=({title:e,children:t,sideContent:i,sideContentWidth:a=250,noPadding:l,className:c})=>s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.classNames("overflow-hidden luminus-full-screen-container",l?"p-0":"p-3",c,X.fullScreenContainer),style:{width:i?`calc(100% - ${a}px)`:"100%"},children:[e?s.jsxRuntimeExports.jsx(E,{title:e}):null,t]}),i&&s.jsxRuntimeExports.jsx(b,{width:250,children:i})]});exports.FullScreenContainer=Y;exports.MainContainer=V;exports.SideContentBar=b;exports.SideMenu=z;exports.TopBar=J;
|
package/dist/layout.es.js
CHANGED
|
@@ -22,23 +22,23 @@ const T = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6
|
|
|
22
22
|
children: X
|
|
23
23
|
}, q = ({ item: n, menuExpanded: t, children: a }) => n.tooltip && !t ? /* @__PURE__ */ e.jsx(S, { text: n.tooltip, placement: "right", children: a }) : a, w = ({ item: n, menuExpanded: t, collapsed: a, onCollapse: r, currentPath: l }) => {
|
|
24
24
|
var b, h;
|
|
25
|
-
const { LinkComponent:
|
|
25
|
+
const { LinkComponent: c } = B(C), [p, u] = M(!1), [_] = l.split("?"), x = n.linkTo === _ || ((b = n.children) == null ? void 0 : b.some((s) => s.linkTo === _));
|
|
26
26
|
return /* @__PURE__ */ e.jsxs("li", { className: i("luminus-side-menu-item", o.sideMenuItem, {
|
|
27
27
|
[o.expanded]: t
|
|
28
|
-
}, { active: p || x }, { open: a && n.children }, { [o.disabled]: n.disabled || n.notPermitted }, { disabled: n.disabled || n.notPermitted }), onMouseEnter: () =>
|
|
28
|
+
}, { active: p || x }, { open: a && n.children }, { [o.disabled]: n.disabled || n.notPermitted }, { disabled: n.disabled || n.notPermitted }), onMouseEnter: () => u(!0), onMouseLeave: () => u(!1), children: [
|
|
29
29
|
/* @__PURE__ */ e.jsx(q, { 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: () => r(), children: [
|
|
30
30
|
/* @__PURE__ */ e.jsx("div", { className: i("icon", o.icon), children: n.icon }),
|
|
31
31
|
t && /* @__PURE__ */ e.jsx("div", { className: i("text", o.text, "text-nowrap"), children: n.title }),
|
|
32
32
|
t && /* @__PURE__ */ e.jsx("div", { className: i("collapse-icon", o.collapseIcon, {
|
|
33
33
|
[o.collapsed]: a
|
|
34
34
|
}), children: /* @__PURE__ */ e.jsx(I, {}) })
|
|
35
|
-
] }) }) : /* @__PURE__ */ e.jsxs(
|
|
35
|
+
] }) }) : /* @__PURE__ */ e.jsxs(c, { to: n.disabled || n.notPermitted ? "/" : n.linkTo ?? "/", className: i("nav-link", o.navButton), children: [
|
|
36
36
|
/* @__PURE__ */ e.jsx("div", { className: i("icon", o.icon), children: n.icon }),
|
|
37
37
|
t && /* @__PURE__ */ e.jsx("div", { className: i("text", o.text, "text-nowrap"), children: n.title })
|
|
38
38
|
] }) }),
|
|
39
39
|
/* @__PURE__ */ e.jsx("div", { className: i("children-container", o.childrenContainer, {
|
|
40
40
|
[o.visible]: a
|
|
41
|
-
}), children: /* @__PURE__ */ e.jsx("div", { className: i("shadow rounded children", o.children), children: (h = n.children) == null ? void 0 : h.map((s) => /* @__PURE__ */ e.jsx(
|
|
41
|
+
}), children: /* @__PURE__ */ e.jsx("div", { className: i("shadow rounded children", o.children), children: (h = n.children) == null ? void 0 : h.map((s) => /* @__PURE__ */ e.jsx(c, { 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)) }) })
|
|
42
42
|
] });
|
|
43
43
|
}, z = "_side-menu_n1hvm_1", D = "_sidebar-header_n1hvm_13", G = "_side-menu-content_n1hvm_18", J = "_expand_n1hvm_22", Q = "_divider_n1hvm_26", v = {
|
|
44
44
|
"side-menu": "_side-menu_n1hvm_1",
|
|
@@ -49,41 +49,41 @@ const T = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6
|
|
|
49
49
|
sideMenuContent: G,
|
|
50
50
|
expand: J,
|
|
51
51
|
divider: Q
|
|
52
|
-
}, re = ({ headerItem: n, mainItems: t, secondaryItems: a, expanded: r, setExpanded: l, currentPath:
|
|
53
|
-
const [p,
|
|
52
|
+
}, re = ({ headerItem: n, mainItems: t, secondaryItems: a, expanded: r, setExpanded: l, currentPath: c }) => {
|
|
53
|
+
const [p, u] = M(-1), { checkUserHasPermissions: _ } = y(), x = j(() => t.map((s) => {
|
|
54
54
|
var d;
|
|
55
55
|
return {
|
|
56
56
|
...s,
|
|
57
|
-
notPermitted: !
|
|
58
|
-
children: (d = s.children) == null ? void 0 : d.map((
|
|
59
|
-
...
|
|
60
|
-
notPermitted: !
|
|
61
|
-
disabled: s.disabled ||
|
|
57
|
+
notPermitted: !_(s.permissions ?? []),
|
|
58
|
+
children: (d = s.children) == null ? void 0 : d.map((m) => ({
|
|
59
|
+
...m,
|
|
60
|
+
notPermitted: !_(m.permissions ?? []),
|
|
61
|
+
disabled: s.disabled || m.disabled
|
|
62
62
|
}))
|
|
63
63
|
};
|
|
64
|
-
}), [t,
|
|
64
|
+
}), [t, _]), b = j(() => a.map((s) => {
|
|
65
65
|
var d;
|
|
66
66
|
return {
|
|
67
67
|
...s,
|
|
68
|
-
notPermitted: !
|
|
69
|
-
children: (d = s.children) == null ? void 0 : d.map((
|
|
70
|
-
...
|
|
71
|
-
notPermitted: !
|
|
68
|
+
notPermitted: !_(s.permissions ?? []),
|
|
69
|
+
children: (d = s.children) == null ? void 0 : d.map((m) => ({
|
|
70
|
+
...m,
|
|
71
|
+
notPermitted: !_(m.permissions ?? [])
|
|
72
72
|
}))
|
|
73
73
|
};
|
|
74
|
-
}), [a,
|
|
75
|
-
|
|
74
|
+
}), [a, _]), h = (s) => {
|
|
75
|
+
u(s === p ? -1 : s);
|
|
76
76
|
};
|
|
77
77
|
return g(() => {
|
|
78
|
-
r ||
|
|
78
|
+
r || u(-1);
|
|
79
79
|
}, [r]), /* @__PURE__ */ e.jsxs("section", { className: i("luminus-side-menu shadow", v.sideMenu, {
|
|
80
80
|
[v.expand]: r
|
|
81
81
|
}, { expand: r }), onMouseEnter: () => l(!0), onMouseLeave: () => l(!1), children: [
|
|
82
82
|
/* @__PURE__ */ e.jsx("div", { className: i("sidebar-header", v.sidebarHeader), children: n }),
|
|
83
83
|
/* @__PURE__ */ e.jsxs("ul", { className: v.sideMenuContent, children: [
|
|
84
|
-
x.map((s, d) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: r, collapsed: d === p, onCollapse: () => h(d), currentPath:
|
|
84
|
+
x.map((s, d) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: r, collapsed: d === p, onCollapse: () => h(d), currentPath: c }, s.title)),
|
|
85
85
|
/* @__PURE__ */ e.jsx("hr", { className: i("divider", v.divider) }),
|
|
86
|
-
b.map((s, d) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: r, collapsed: d === p, onCollapse: () => h(d), currentPath:
|
|
86
|
+
b.map((s, d) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: r, collapsed: d === p, onCollapse: () => h(d), currentPath: c }, s.title))
|
|
87
87
|
] })
|
|
88
88
|
] });
|
|
89
89
|
}, V = "_top-bar_1lk80_1", Y = "_top-bar-brand_1lk80_14", N = {
|
|
@@ -106,8 +106,8 @@ const T = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6
|
|
|
106
106
|
sideContentBar: Z
|
|
107
107
|
}, k = ({ width: n, children: t }) => /* @__PURE__ */ e.jsx("section", { className: i("luminus-side-content-bar shadow", O.sideContentBar), style: {
|
|
108
108
|
width: `${n}px`
|
|
109
|
-
}, children: t }), f = ({ title: n }) => /* @__PURE__ */ e.jsx("div", { className: "mb-3", children: typeof n == "string" ? /* @__PURE__ */ e.jsx(P, { variant: "h3", children: n }) : n }), le = ({ title: n, children: t, sideContent: a,
|
|
110
|
-
/* @__PURE__ */ e.jsxs("div", { style: { paddingRight: a ?
|
|
109
|
+
}, children: t }), f = ({ title: n }) => /* @__PURE__ */ e.jsx("div", { className: "mb-3", children: typeof n == "string" ? /* @__PURE__ */ e.jsx(P, { variant: "h3", children: n }) : n }), le = ({ title: n, children: t, sideContent: a, sideContentWidth: r = 250, noPadding: l, className: c }) => /* @__PURE__ */ e.jsxs("div", { className: i("container-fluid", l ? "p-0" : "p-3", c), children: [
|
|
110
|
+
/* @__PURE__ */ e.jsxs("div", { style: { paddingRight: a ? `${r}px` : void 0 }, children: [
|
|
111
111
|
n ? /* @__PURE__ */ e.jsx(f, { title: n }) : null,
|
|
112
112
|
t
|
|
113
113
|
] }),
|
|
@@ -115,8 +115,8 @@ const T = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6
|
|
|
115
115
|
] }), ee = "_full-screen-container_1rm4r_1", ne = {
|
|
116
116
|
"full-screen-container": "_full-screen-container_1rm4r_1",
|
|
117
117
|
fullScreenContainer: ee
|
|
118
|
-
}, ce = ({ title: n, children: t, sideContent: a,
|
|
119
|
-
/* @__PURE__ */ e.jsxs("div", { className: i("overflow-hidden luminus-full-screen-container",
|
|
118
|
+
}, ce = ({ title: n, children: t, sideContent: a, sideContentWidth: r = 250, noPadding: l, className: c }) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
119
|
+
/* @__PURE__ */ e.jsxs("div", { className: i("overflow-hidden luminus-full-screen-container", l ? "p-0" : "p-3", c, ne.fullScreenContainer), style: { width: a ? `calc(100% - ${r}px)` : "100%" }, children: [
|
|
120
120
|
n ? /* @__PURE__ */ e.jsx(f, { title: n }) : null,
|
|
121
121
|
t
|
|
122
122
|
] }),
|