react-luminus-components 1.2.26 → 1.2.28
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 }: ContainerProps) => import("react").JSX.Element;
|
|
3
|
+
declare const FullScreenContainer: ({ title, children, sideContent, 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 }: ContainerProps) => import("react").JSX.Element;
|
|
3
|
+
declare const MainContainer: ({ title, children, sideContent, 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("./UserAvatarToggle-BKpAJdnv.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./UserAvatarToggle-BKpAJdnv.cjs"),d=require("react"),w=require("./usePermissions-COxTbL_u.cjs"),C=require("./SimpleTooltip-BRhpcft2.cjs"),M=require("./Typography-tgs5dV12.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:a,currentPath:l})=>{var v,_;const{LinkComponent:m}=d.useContext(s.LuminusComponentsContext),[p,u]=d.useState(!1),[c]=l.split("?"),h=e.linkTo===c||((v=e.children)==null?void 0:v.some(n=>n.linkTo===c));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:()=>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(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:a,setExpanded:l,currentPath:m})=>{const[p,u]=d.useState(-1),{checkUserHasPermissions:c}=w.usePermissions(),h=d.useMemo(()=>t.map(n=>{var r;return{...n,notPermitted:!c(n.permissions??[]),children:(r=n.children)==null?void 0:r.map(x=>({...x,notPermitted:!c(x.permissions??[]),disabled:n.disabled||x.disabled}))}}),[t,c]),v=d.useMemo(()=>i.map(n=>{var r;return{...n,notPermitted:!c(n.permissions??[]),children:(r=n.children)==null?void 0:r.map(x=>({...x,notPermitted:!c(x.permissions??[])}))}}),[i,c]),_=n=>{u(n===p?-1:n)};return d.useEffect(()=>{a||u(-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:m},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: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:a})=>{const{LinkComponent:l}=d.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})]})},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 shadow",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,noPadding:a,className:l})=>s.jsxRuntimeExports.jsxs("div",{className:s.classNames("container-fluid",a?"p-0":"p-3",l),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,noPadding:a,className:l})=>s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs("div",{className:s.classNames("container-fluid overflow-hidden luminus-full-screen-container",a?"p-0":"p-3",l,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
|
@@ -20,13 +20,13 @@ const S = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6
|
|
|
20
20
|
childrenContainer: U,
|
|
21
21
|
visible: q,
|
|
22
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:
|
|
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: r, currentPath: l }) => {
|
|
24
24
|
var b, h;
|
|
25
|
-
const { LinkComponent: m } = M(C), [p, _] = B(!1), [
|
|
25
|
+
const { LinkComponent: m } = M(C), [p, _] = B(!1), [c] = l.split("?"), x = n.linkTo === c || ((b = n.children) == null ? void 0 : b.some((s) => s.linkTo === c));
|
|
26
26
|
return /* @__PURE__ */ e.jsxs("li", { className: i("luminus-side-menu-item", o.sideMenuItem, {
|
|
27
27
|
[o.expanded]: t
|
|
28
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: () =>
|
|
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: () => 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, {
|
|
@@ -49,41 +49,41 @@ const S = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6
|
|
|
49
49
|
sideMenuContent: Q,
|
|
50
50
|
expand: V,
|
|
51
51
|
divider: W
|
|
52
|
-
}, re = ({ headerItem: n, mainItems: t, secondaryItems: a, expanded:
|
|
53
|
-
const [p, _] = B(-1), { checkUserHasPermissions:
|
|
54
|
-
var
|
|
52
|
+
}, re = ({ headerItem: n, mainItems: t, secondaryItems: a, expanded: r, setExpanded: l, currentPath: m }) => {
|
|
53
|
+
const [p, _] = B(-1), { checkUserHasPermissions: c } = g(), x = j(() => t.map((s) => {
|
|
54
|
+
var d;
|
|
55
55
|
return {
|
|
56
56
|
...s,
|
|
57
|
-
notPermitted: !
|
|
58
|
-
children: (
|
|
57
|
+
notPermitted: !c(s.permissions ?? []),
|
|
58
|
+
children: (d = s.children) == null ? void 0 : d.map((u) => ({
|
|
59
59
|
...u,
|
|
60
|
-
notPermitted: !
|
|
60
|
+
notPermitted: !c(u.permissions ?? []),
|
|
61
61
|
disabled: s.disabled || u.disabled
|
|
62
62
|
}))
|
|
63
63
|
};
|
|
64
|
-
}), [t,
|
|
65
|
-
var
|
|
64
|
+
}), [t, c]), b = j(() => a.map((s) => {
|
|
65
|
+
var d;
|
|
66
66
|
return {
|
|
67
67
|
...s,
|
|
68
|
-
notPermitted: !
|
|
69
|
-
children: (
|
|
68
|
+
notPermitted: !c(s.permissions ?? []),
|
|
69
|
+
children: (d = s.children) == null ? void 0 : d.map((u) => ({
|
|
70
70
|
...u,
|
|
71
|
-
notPermitted: !
|
|
71
|
+
notPermitted: !c(u.permissions ?? [])
|
|
72
72
|
}))
|
|
73
73
|
};
|
|
74
|
-
}), [a,
|
|
74
|
+
}), [a, c]), h = (s) => {
|
|
75
75
|
_(s === p ? -1 : s);
|
|
76
76
|
};
|
|
77
77
|
return P(() => {
|
|
78
|
-
|
|
79
|
-
}, [
|
|
80
|
-
[v.expand]:
|
|
81
|
-
}, { expand:
|
|
78
|
+
r || _(-1);
|
|
79
|
+
}, [r]), /* @__PURE__ */ e.jsxs("section", { className: i("luminus-side-menu shadow", v.sideMenu, {
|
|
80
|
+
[v.expand]: r
|
|
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,
|
|
84
|
+
x.map((s, d) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: r, collapsed: d === p, onCollapse: () => h(d), currentPath: m }, s.title)),
|
|
85
85
|
/* @__PURE__ */ e.jsx("hr", { className: i("divider", v.divider) }),
|
|
86
|
-
b.map((s,
|
|
86
|
+
b.map((s, d) => /* @__PURE__ */ e.jsx(w, { item: s, menuExpanded: r, collapsed: d === p, onCollapse: () => h(d), currentPath: m }, s.title))
|
|
87
87
|
] })
|
|
88
88
|
] });
|
|
89
89
|
}, X = "_top-bar_1lk80_1", Y = "_top-bar-brand_1lk80_14", N = {
|
|
@@ -91,22 +91,22 @@ const S = "_side-menu-item_6vbwa_1", $ = "_disabled_6vbwa_5", H = "_nav-button_6
|
|
|
91
91
|
topBar: X,
|
|
92
92
|
"top-bar-brand": "_top-bar-brand_1lk80_14",
|
|
93
93
|
topBarBrand: Y
|
|
94
|
-
}, de = ({ appName: n, leftOffset: t, centerContent: a, rightContent:
|
|
95
|
-
const { LinkComponent:
|
|
94
|
+
}, de = ({ appName: n, leftOffset: t, centerContent: a, rightContent: r }) => {
|
|
95
|
+
const { LinkComponent: l } = M(C);
|
|
96
96
|
return /* @__PURE__ */ e.jsxs("nav", { className: i("luminus-top-bar shadow", N.topBar), style: {
|
|
97
97
|
width: t ? `calc(100% - ${t}px)` : void 0,
|
|
98
98
|
left: t ? `${t}px` : void 0
|
|
99
99
|
}, children: [
|
|
100
|
-
/* @__PURE__ */ e.jsx(
|
|
100
|
+
/* @__PURE__ */ e.jsx(l, { to: "/", className: i("luminus-top-bar-brand", N.topBarBrand), children: n }),
|
|
101
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:
|
|
102
|
+
/* @__PURE__ */ e.jsx("div", { className: "d-flex justify-content-end align-items-center gap-2", children: r ?? null })
|
|
103
103
|
] });
|
|
104
104
|
}, Z = "_side-content-bar_17kwd_1", O = {
|
|
105
105
|
"side-content-bar": "_side-content-bar_17kwd_1",
|
|
106
106
|
sideContentBar: Z
|
|
107
107
|
}, f = ({ 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 }), 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: [
|
|
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, noPadding: r, className: l }) => /* @__PURE__ */ e.jsxs("div", { className: i("container-fluid", r ? "p-0" : "p-3", l), children: [
|
|
110
110
|
/* @__PURE__ */ e.jsxs("div", { style: { paddingRight: a ? "250px" : void 0 }, children: [
|
|
111
111
|
n ? /* @__PURE__ */ e.jsx(k, { title: n }) : null,
|
|
112
112
|
t
|
|
@@ -115,8 +115,8 @@ const S = "_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 }) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
119
|
-
/* @__PURE__ */ e.jsxs("div", { className: i("
|
|
118
|
+
}, ce = ({ title: n, children: t, sideContent: a, noPadding: r, className: l }) => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
119
|
+
/* @__PURE__ */ e.jsxs("div", { className: i("container-fluid overflow-hidden luminus-full-screen-container", r ? "p-0" : "p-3", l, ne.fullScreenContainer), style: { width: a ? "calc(100% - 250px)" : "100%" }, children: [
|
|
120
120
|
n ? /* @__PURE__ */ e.jsx(k, { title: n }) : null,
|
|
121
121
|
t
|
|
122
122
|
] }),
|