@jsenv/navi 0.11.17 → 0.11.19

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.
@@ -11766,6 +11766,7 @@ const LinkPlain = forwardRef((props, ref) => {
11766
11766
  blankTargetIcon,
11767
11767
  anchorIcon,
11768
11768
  icon,
11769
+ pointerDefaultWhenCurrent,
11769
11770
  ...rest
11770
11771
  } = props;
11771
11772
  const innerRef = useRef();
@@ -11775,16 +11776,21 @@ const LinkPlain = forwardRef((props, ref) => {
11775
11776
  useConstraints(innerRef, constraints);
11776
11777
  const shouldDimColor = readOnly || disabled;
11777
11778
  useDimColorWhen(innerRef, shouldDimColor);
11778
- const innerClassName = withPropsClassName("navi_link", className);
11779
- const [remainingProps, innerStyle] = withPropsStyle(rest, {
11780
- layout: true,
11781
- typo: true
11782
- });
11779
+ // subscribe to document url to re-render and re-compute getLinkTargetInfo
11780
+ useDocumentUrl();
11783
11781
  const {
11784
11782
  targetIsSameSite,
11785
11783
  targetIsAnchor,
11786
11784
  targetIsCurrent
11787
11785
  } = getLinkTargetInfo(href);
11786
+ const innerClassName = withPropsClassName("navi_link", className);
11787
+ const [remainingProps, innerStyle] = withPropsStyle(rest, {
11788
+ base: {
11789
+ cursor: pointerDefaultWhenCurrent && targetIsCurrent ? "default" : undefined
11790
+ },
11791
+ layout: true,
11792
+ typo: true
11793
+ });
11788
11794
  const innerTarget = target === undefined ? targetIsSameSite ? "_self" : "_blank" : target;
11789
11795
  const innerRel = rel === undefined ? targetIsSameSite ? undefined : "noopener noreferrer" : rel;
11790
11796
  let innerIcon;
@@ -11977,20 +11983,20 @@ const LinkWithAction = forwardRef((props, ref) => {
11977
11983
  const RouteLink = ({
11978
11984
  route,
11979
11985
  routeParams,
11986
+ active,
11980
11987
  children,
11981
11988
  ...rest
11982
11989
  }) => {
11983
11990
  if (!route) {
11984
- throw new Error("RouteLink: route prop is required");
11991
+ throw new Error("route prop is required");
11985
11992
  }
11986
- const {
11987
- active
11988
- } = useRouteStatus(route);
11993
+ const routeStatus = useRouteStatus(route);
11989
11994
  const url = route.buildUrl(routeParams);
11995
+ const innerActive = active || routeStatus.active;
11990
11996
  return jsx(Link, {
11991
11997
  ...rest,
11992
11998
  href: url,
11993
- active: active ? "" : undefined,
11999
+ active: innerActive,
11994
12000
  children: children
11995
12001
  });
11996
12002
  };