@syscore/ui-library 1.7.1 → 1.7.2
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/client/components/ui/navigation.tsx +14 -7
- package/client/global.css +2 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +10 -6
- package/package.json +1 -1
|
@@ -367,13 +367,14 @@ const NavigationTray = React.forwardRef<HTMLDivElement, NavigationTrayProps>(
|
|
|
367
367
|
children,
|
|
368
368
|
_index,
|
|
369
369
|
_renderTriggerOnly,
|
|
370
|
+
|
|
370
371
|
...props
|
|
371
372
|
},
|
|
372
373
|
ref,
|
|
373
374
|
) => {
|
|
374
|
-
const { light, activeIndex, setActiveIndex, setIsOpen } = useNavigation();
|
|
375
|
+
const { light, activeIndex, setActiveIndex, setIsOpen, isOpen } = useNavigation();
|
|
375
376
|
const isActive = activeIndex === _index;
|
|
376
|
-
|
|
377
|
+
|
|
377
378
|
const handleMouseEnter = () => {
|
|
378
379
|
setIsOpen(true);
|
|
379
380
|
setActiveIndex(_index ?? null);
|
|
@@ -417,7 +418,7 @@ const NavigationTray = React.forwardRef<HTMLDivElement, NavigationTrayProps>(
|
|
|
417
418
|
|
|
418
419
|
// Render the tray content
|
|
419
420
|
return (
|
|
420
|
-
<div ref={ref} className={cn("navigation-tray", className)} {...props}>
|
|
421
|
+
<div ref={ref} className={cn("navigation-tray", className)} {...props} data-open={isOpen}>
|
|
421
422
|
<h2
|
|
422
423
|
className="heading-xsmall navigation-tray__title"
|
|
423
424
|
style={{
|
|
@@ -506,10 +507,16 @@ interface NavigationLinkProps extends React.ComponentPropsWithoutRef<"a"> {
|
|
|
506
507
|
}
|
|
507
508
|
|
|
508
509
|
const NavigationLink = React.forwardRef<HTMLAnchorElement, NavigationLinkProps>(
|
|
509
|
-
({ className, asChild, sub, bullet, badge, children, ...props }, ref) => {
|
|
510
|
+
({ className, asChild, sub, bullet, badge, children, onClick, ...props }, ref) => {
|
|
510
511
|
const { light } = useNavigation();
|
|
511
512
|
const Comp = asChild ? Slot : "a";
|
|
512
513
|
|
|
514
|
+
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
515
|
+
// Prevent navigation from closing when clicking on links
|
|
516
|
+
e.stopPropagation();
|
|
517
|
+
onClick?.(e);
|
|
518
|
+
};
|
|
519
|
+
|
|
513
520
|
const isSubItem = sub || bullet;
|
|
514
521
|
const baseClassName = isSubItem
|
|
515
522
|
? cn(
|
|
@@ -533,7 +540,7 @@ const NavigationLink = React.forwardRef<HTMLAnchorElement, NavigationLinkProps>(
|
|
|
533
540
|
<li>
|
|
534
541
|
<div className="navigation-link__container">
|
|
535
542
|
{bulletElement}
|
|
536
|
-
<Comp ref={ref} className={cn(baseClassName, className)} {...props}>
|
|
543
|
+
<Comp ref={ref} className={cn(baseClassName, className)} onClick={handleClick} {...props}>
|
|
537
544
|
{children}
|
|
538
545
|
</Comp>
|
|
539
546
|
</div>
|
|
@@ -554,7 +561,7 @@ const NavigationLink = React.forwardRef<HTMLAnchorElement, NavigationLinkProps>(
|
|
|
554
561
|
return (
|
|
555
562
|
<li>
|
|
556
563
|
<span className="navigation-link__badge-wrapper">
|
|
557
|
-
<Comp ref={ref} className={cn(baseClassName, className)} {...props}>
|
|
564
|
+
<Comp ref={ref} className={cn(baseClassName, className)} onClick={handleClick} {...props}>
|
|
558
565
|
{children}
|
|
559
566
|
</Comp>
|
|
560
567
|
<span className="overline-small navigation-link__badge">
|
|
@@ -567,7 +574,7 @@ const NavigationLink = React.forwardRef<HTMLAnchorElement, NavigationLinkProps>(
|
|
|
567
574
|
|
|
568
575
|
return (
|
|
569
576
|
<li>
|
|
570
|
-
<Comp ref={ref} className={linkClassName} {...props}>
|
|
577
|
+
<Comp ref={ref} className={linkClassName} onClick={handleClick} {...props}>
|
|
571
578
|
{children}
|
|
572
579
|
</Comp>
|
|
573
580
|
</li>
|
package/client/global.css
CHANGED
|
@@ -7175,6 +7175,7 @@ body {
|
|
|
7175
7175
|
.navigation-tray__content {
|
|
7176
7176
|
display: flex;
|
|
7177
7177
|
gap: 5rem;
|
|
7178
|
+
pointer-events: auto;
|
|
7178
7179
|
}
|
|
7179
7180
|
|
|
7180
7181
|
.navigation-column {
|
|
@@ -7204,6 +7205,7 @@ body {
|
|
|
7204
7205
|
.navigation-link {
|
|
7205
7206
|
display: block;
|
|
7206
7207
|
font-weight: 500;
|
|
7208
|
+
pointer-events: auto;
|
|
7207
7209
|
}
|
|
7208
7210
|
|
|
7209
7211
|
.navigation-link--light {
|