@pagamio/frontend-commons-lib 0.8.199 → 0.8.201
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.
|
@@ -26,6 +26,10 @@ const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown
|
|
|
26
26
|
// If there's exactly one item, render it as a direct link instead of a dropdown
|
|
27
27
|
if (items?.length === 1 && !forceDropdown) {
|
|
28
28
|
const singleItem = items[0];
|
|
29
|
+
if (!singleItem.href) {
|
|
30
|
+
// If single item has no href, render without link
|
|
31
|
+
return (_jsx(Sidebar.Item, { icon: icon, label: badge && t(badge), className: twMerge('text-gray-600 cursor-default', 'dark:text-gray-400'), children: t(label) }));
|
|
32
|
+
}
|
|
29
33
|
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 &&
|
|
30
34
|
'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) }));
|
|
31
35
|
}
|
|
@@ -39,12 +43,18 @@ const AppSidebarItem = ({ href, target, icon, label, items, badge, forceDropdown
|
|
|
39
43
|
!hasActiveChild(items) &&
|
|
40
44
|
'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'), theme: { list: 'space-y-2 py-2 [&>li>div]:w-full' }, children: items.map((child) => (_jsx(React.Fragment, { children: child.items?.length ? (
|
|
41
45
|
// Recursively render nested items
|
|
42
|
-
_jsx("div", { className: "pl-3", children: _jsx(AppSidebarItem, { ...child }) })) : (
|
|
43
|
-
// Render leaf item
|
|
46
|
+
_jsx("div", { className: "pl-3", children: _jsx(AppSidebarItem, { ...child }) })) : child.href ? (
|
|
47
|
+
// Render leaf item with link
|
|
44
48
|
_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 &&
|
|
45
|
-
'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
|
+
'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) })) : (
|
|
50
|
+
// Render leaf item without link
|
|
51
|
+
_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))) }));
|
|
46
52
|
}
|
|
47
53
|
// Render leaf item
|
|
54
|
+
// If no href, render as a non-link item
|
|
55
|
+
if (!href) {
|
|
56
|
+
return (_jsx(Sidebar.Item, { 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', 'cursor-default'), children: t(label) }));
|
|
57
|
+
}
|
|
48
58
|
return (_jsx(Sidebar.Item, { as: Link, href: 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', isParentActive &&
|
|
49
59
|
'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) }));
|
|
50
60
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface ImageUploaderProps {
|
|
3
|
-
project: 'vas' | 'stocklink' | 'events';
|
|
3
|
+
project: 'vas' | 'stocklink' | 'events' | 'commerce';
|
|
4
4
|
env: 'dev' | 'uat' | 'prod';
|
|
5
5
|
onUploadSuccess?: (url: string) => void;
|
|
6
6
|
onError?: (error: Error) => void;
|
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.201",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|