@pagamio/frontend-commons-lib 0.8.212 → 0.8.213
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.
|
@@ -13,7 +13,7 @@ const AppSidebarMenu = () => {
|
|
|
13
13
|
// Default behavior all items in one ItemGroup
|
|
14
14
|
return (_jsx(Sidebar.Items, { children: _jsx(Sidebar.ItemGroup, { children: pages.map((item) => (_jsx(AppSidebarItem, { ...item }, item.label))) }) }));
|
|
15
15
|
};
|
|
16
|
-
const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown }) => {
|
|
16
|
+
const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown, collapsible = true, showSeparator = false, }) => {
|
|
17
17
|
const { pathname, linkComponent: Link } = useAppSidebarContext();
|
|
18
18
|
const { t } = useTranslation();
|
|
19
19
|
// Check if current path matches this item or any of its descendants
|
|
@@ -38,6 +38,17 @@ const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown
|
|
|
38
38
|
return (_jsx(Sidebar.Item, { as: Link, href: singleItem.href, target: target, icon: icon, label: badge && t(badge), className: twMerge('text-gray-600 hover:text-primary-700 hover:bg-primary-50/70', 'dark:text-gray-400 dark:hover:text-primary-300 dark:hover:bg-primary-900/30', pathname === singleItem.href &&
|
|
39
39
|
'text-primary-700 bg-primary-100/80 hover:bg-primary-100/80 dark:text-primary-300 dark:bg-primary-900/40 dark:hover:bg-primary-900/40'), children: t(label) }));
|
|
40
40
|
}
|
|
41
|
+
// Handle non-collapsible sections - render as section header with always-visible links
|
|
42
|
+
if (items?.length && collapsible === false) {
|
|
43
|
+
return (_jsxs("div", { className: "space-y-1", children: [showSeparator && _jsx("hr", { className: "my-3 border-t border-gray-200 dark:border-gray-700" }), _jsxs("div", { className: twMerge('flex items-center gap-3 px-3 py-2 text-sm font-semibold uppercase tracking-wider', 'text-gray-500 dark:text-gray-400'), children: [icon && React.createElement(icon, { className: 'h-5 w-5' }), _jsx("span", { children: t(label) })] }), _jsx("div", { className: "space-y-1 pl-2", children: items.map((child) => (_jsx(React.Fragment, { children: child.items?.length ? (
|
|
44
|
+
// Recursively render nested items
|
|
45
|
+
_jsx("div", { className: "pl-3", children: _jsx(AppSidebarItem, { ...child }) })) : child.href ? (
|
|
46
|
+
// Render leaf item with link
|
|
47
|
+
_jsx(Sidebar.Item, { as: Link, href: child.href, target: child.target, icon: child.icon, className: twMerge('justify-center [&>*]:font-normal', 'text-gray-600 hover:text-primary-700 hover:bg-primary-50/70', 'dark:text-gray-400 dark:hover:text-primary-300 dark:hover:bg-primary-900/30', pathname === child.href &&
|
|
48
|
+
'text-primary-700 bg-primary-100/80 hover:bg-primary-100/80 dark:text-primary-300 dark:bg-primary-900/40 dark:hover:bg-primary-900/40'), children: t(child.label) })) : (
|
|
49
|
+
// Render leaf item without link
|
|
50
|
+
_jsx(Sidebar.Item, { icon: child.icon, className: twMerge('justify-center [&>*]:font-normal', 'text-gray-600 cursor-default', 'dark:text-gray-400'), children: t(child.label) })) }, child.label))) })] }));
|
|
51
|
+
}
|
|
41
52
|
if (items?.length) {
|
|
42
53
|
const isOpen = isParentActive || hasActiveChild(items);
|
|
43
54
|
return (_jsx(Sidebar.Collapse, { icon: icon, label: t(label), open: isOpen, className: twMerge('text-gray-600 hover:text-primary-700 hover:bg-primary-50/70', 'dark:text-gray-400 dark:hover:text-primary-300 dark:hover:bg-primary-900/30',
|
|
@@ -9,6 +9,16 @@ interface AppSidebarPageItem {
|
|
|
9
9
|
badge?: string;
|
|
10
10
|
roles?: string[];
|
|
11
11
|
forceDropdown?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When false, the section will not be collapsible - it will display as a
|
|
14
|
+
* section header with always-visible links below it. Defaults to true.
|
|
15
|
+
*/
|
|
16
|
+
collapsible?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* When true, displays a horizontal separator line above the section.
|
|
19
|
+
* Useful for visually separating non-collapsible sections. Defaults to false.
|
|
20
|
+
*/
|
|
21
|
+
showSeparator?: boolean;
|
|
12
22
|
}
|
|
13
23
|
/**
|
|
14
24
|
* Props for the AppSidebarContext
|
package/lib/styles.css
CHANGED
|
@@ -978,6 +978,9 @@ input[type="range"]::-ms-fill-lower {
|
|
|
978
978
|
.pointer-events-none {
|
|
979
979
|
pointer-events: none;
|
|
980
980
|
}
|
|
981
|
+
.visible {
|
|
982
|
+
visibility: visible;
|
|
983
|
+
}
|
|
981
984
|
.invisible {
|
|
982
985
|
visibility: hidden;
|
|
983
986
|
}
|
|
@@ -1237,6 +1240,10 @@ input[type="range"]::-ms-fill-lower {
|
|
|
1237
1240
|
margin-top: 0.25rem;
|
|
1238
1241
|
margin-bottom: 0.25rem;
|
|
1239
1242
|
}
|
|
1243
|
+
.my-3 {
|
|
1244
|
+
margin-top: 0.75rem;
|
|
1245
|
+
margin-bottom: 0.75rem;
|
|
1246
|
+
}
|
|
1240
1247
|
.my-4 {
|
|
1241
1248
|
margin-top: 1rem;
|
|
1242
1249
|
margin-bottom: 1rem;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagamio/frontend-commons-lib",
|
|
3
3
|
"description": "Pagamio library for Frontend reusable components like the form engine and table container",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.213",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|