@wistia/ui 0.18.13-beta.c18b7ca6.8e50fcb → 0.18.14-beta.3d78b4cc.f1b5721

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.18.13-beta.c18b7ca6.8e50fcb
3
+ * @license @wistia/ui v0.18.14-beta.3d78b4cc.f1b5721
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -7943,9 +7943,19 @@ Icon.displayName = "Icon_UI";
7943
7943
  // src/components/Link/Link.tsx
7944
7944
  var import_react22 = require("react");
7945
7945
  var import_styled_components22 = require("styled-components");
7946
- var import_react_router = require("react-router");
7947
7946
  var import_type_guards14 = require("@wistia/type-guards");
7948
7947
  var import_jsx_runtime207 = require("react/jsx-runtime");
7948
+ var RouterLink = null;
7949
+ var useInRouterContext = () => false;
7950
+ var isRouterEnabled = false;
7951
+ import("react-router").then((module2) => {
7952
+ RouterLink = module2.Link;
7953
+ useInRouterContext = module2.useInRouterContext;
7954
+ isRouterEnabled = true;
7955
+ return module2;
7956
+ }).catch(() => {
7957
+ isRouterEnabled = false;
7958
+ });
7949
7959
  var generateHref = (href, type, disabled) => {
7950
7960
  if (disabled || (0, import_type_guards14.isNil)(href)) {
7951
7961
  return void 0;
@@ -8004,9 +8014,9 @@ var Link = (0, import_react22.forwardRef)(
8004
8014
  role,
8005
8015
  ...props
8006
8016
  }, ref) => {
8007
- const inRouterContext = (0, import_react_router.useInRouterContext)();
8017
+ const isInRouterContext = useInRouterContext();
8008
8018
  const to = generateHref(props.href, type, disabled);
8009
- const shouldUseReactRouterLink = inRouterContext && type !== "external" && !to?.startsWith("http");
8019
+ const shouldUseReactRouterLink = isInRouterContext && isRouterEnabled && type !== "external" && !to?.startsWith("http");
8010
8020
  const handleClick = async (event) => {
8011
8021
  if (disabled) {
8012
8022
  event.preventDefault();
@@ -8055,8 +8065,7 @@ var Link = (0, import_react22.forwardRef)(
8055
8065
  const externalLinkProps = type === "external" ? { target: "_blank", rel: "noopener noreferrer" } : null;
8056
8066
  const routerSpecificProps = shouldUseReactRouterLink ? {
8057
8067
  // TODO: Using 'any' here due to styled-components typing limitations with RouterLink
8058
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
8059
- as: import_react_router.Link,
8068
+ as: RouterLink,
8060
8069
  to: to ?? ""
8061
8070
  } : {
8062
8071
  as: "a",