karsten-design-system 1.2.67 → 1.2.68
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.
- package/dist/index.js +10 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -486,6 +486,7 @@ function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setO
|
|
|
486
486
|
const [openSidebar, setOpenSidebar] = useState(false);
|
|
487
487
|
const [openUserConfig, setOpenUserConfig] = useState(false);
|
|
488
488
|
const userConfigRef = useRef(null);
|
|
489
|
+
const iconButtonRef = useRef(null);
|
|
489
490
|
useEffect(() => {
|
|
490
491
|
function handleClickOutside(event) {
|
|
491
492
|
if (userConfigRef.current &&
|
|
@@ -507,26 +508,18 @@ function Header({ sidebarItems, sidebarTopItems, username, userConfigItems, setO
|
|
|
507
508
|
useEffect(() => {
|
|
508
509
|
function handleClickOutsideSidebar(event) {
|
|
509
510
|
if (sidebarRef.current &&
|
|
510
|
-
!sidebarRef.current.contains(event.target)
|
|
511
|
+
!sidebarRef.current.contains(event.target) &&
|
|
512
|
+
!(iconButtonRef.current &&
|
|
513
|
+
iconButtonRef.current.contains(event.target))) {
|
|
511
514
|
setOpenSidebar(false);
|
|
512
515
|
}
|
|
513
516
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
// if (openSidebar) {
|
|
521
|
-
// document.addEventListener('mousedown', handleClickOutsideSidebar)
|
|
522
|
-
// } else {
|
|
523
|
-
// document.removeEventListener('mousedown', handleClickOutsideSidebar)
|
|
524
|
-
// }
|
|
525
|
-
// return () => {
|
|
526
|
-
// document.removeEventListener('mousedown', handleClickOutsideSidebar)
|
|
527
|
-
// }
|
|
528
|
-
}, [openSidebar]);
|
|
529
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: "w-100 min-h-16 border-b border-b-light-200 flex flex-row justify-between items-center px-8 shadow-header dark:bg-dark-100 dark:border-b-dark-400", children: [jsxs("div", { className: "flex flex-row items-center gap-4", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenSidebar(!openSidebar), "aria-label": "Abrir menu lateral", children: jsx("i", { className: `${openSidebar ? 'pi pi-list' : 'pi pi-bars'} text-light-950 cursor-pointer hover:text-light-900 text-xl mt-1 }` }) }), jsx(Link$1, { className: "cursor-pointer", to: redirect, "aria-label": "Ir para p\u00E1gina inicial", children: jsx(LogoSmall, {}) }, "logo-link")] }), jsxs("div", { className: "relative flex flex-row gap-4 items-center", children: [isRenderNotifications && (jsx("button", { className: "bg-transparent border-none mt-1", onClick: () => setOpenNotifications(true), "aria-label": "Abrir notifica\u00E7\u00E3o", children: jsx("i", { className: "pi pi-bell text-light-950 cursor-pointer hover:text-light-900" }) })), jsxs("div", { ref: userConfigRef, className: "relative", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenUserConfig(!openUserConfig), "aria-label": "Abrir menu de configura\u00E7\u00F5es do usu\u00E1rio", children: jsxs("p", { className: "text-light-950 hover:text-light-900 font-roboto font-bold cursor-pointer transition-colors duration-200", children: [helloTranslation, ", ", username] }) }), openUserConfig && (jsx("div", { className: `absolute w-100 z-20 p-2 -bottom-1 translate-y-full shadow-container rounded-md bg-light-500 dark:text-light-500 dark:bg-dark-100 dark:border dark:border-dark-500 dark:shadow-dark-400`, children: jsx("ul", { children: userConfigItems.map(({ id, title, onClick, path }) => (jsx("li", { className: "p-2 rounded hover:bg-light-300 dark:bg-dark-100 dark:text-light-500 dark:hover:bg-dark-400", children: jsx("a", { onClick: () => {
|
|
517
|
+
document.addEventListener('mousedown', handleClickOutsideSidebar);
|
|
518
|
+
return () => {
|
|
519
|
+
document.removeEventListener('mousedown', handleClickOutsideSidebar);
|
|
520
|
+
};
|
|
521
|
+
}, []);
|
|
522
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: "w-100 min-h-16 border-b border-b-light-200 flex flex-row justify-between items-center px-8 shadow-header dark:bg-dark-100 dark:border-b-dark-400", children: [jsxs("div", { className: "flex flex-row items-center gap-4", children: [jsx("button", { ref: iconButtonRef, className: "bg-transparent border-none", onClick: () => setOpenSidebar(!openSidebar), "aria-label": "Abrir menu lateral", children: jsx("i", { className: `${openSidebar ? 'pi pi-list' : 'pi pi-bars'} text-light-950 cursor-pointer hover:text-light-900 text-xl mt-1 }` }) }), jsx(Link$1, { className: "cursor-pointer", to: redirect, "aria-label": "Ir para p\u00E1gina inicial", children: jsx(LogoSmall, {}) }, "logo-link")] }), jsxs("div", { className: "relative flex flex-row gap-4 items-center", children: [isRenderNotifications && (jsx("button", { className: "bg-transparent border-none mt-1", onClick: () => setOpenNotifications(true), "aria-label": "Abrir notifica\u00E7\u00E3o", children: jsx("i", { className: "pi pi-bell text-light-950 cursor-pointer hover:text-light-900" }) })), jsxs("div", { ref: userConfigRef, className: "relative", children: [jsx("button", { className: "bg-transparent border-none", onClick: () => setOpenUserConfig(!openUserConfig), "aria-label": "Abrir menu de configura\u00E7\u00F5es do usu\u00E1rio", children: jsxs("p", { className: "text-light-950 hover:text-light-900 font-roboto font-bold cursor-pointer transition-colors duration-200", children: [helloTranslation, ", ", username] }) }), openUserConfig && (jsx("div", { className: `absolute w-100 z-20 p-2 -bottom-1 translate-y-full shadow-container rounded-md bg-light-500 dark:text-light-500 dark:bg-dark-100 dark:border dark:border-dark-500 dark:shadow-dark-400`, children: jsx("ul", { children: userConfigItems.map(({ id, title, onClick, path }) => (jsx("li", { className: "p-2 rounded hover:bg-light-300 dark:bg-dark-100 dark:text-light-500 dark:hover:bg-dark-400", children: jsx("a", { onClick: () => {
|
|
530
523
|
if (onClick)
|
|
531
524
|
onClick();
|
|
532
525
|
setOpenUserConfig(false);
|