@wistia/ui 0.18.14-beta.3d78b4cc.f1b5721 → 0.18.14
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 +6 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +5 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.18.14
|
|
3
|
+
* @license @wistia/ui v0.18.14
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -7943,19 +7943,9 @@ 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");
|
|
7946
7947
|
var import_type_guards14 = require("@wistia/type-guards");
|
|
7947
7948
|
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
|
-
});
|
|
7959
7949
|
var generateHref = (href, type, disabled) => {
|
|
7960
7950
|
if (disabled || (0, import_type_guards14.isNil)(href)) {
|
|
7961
7951
|
return void 0;
|
|
@@ -8014,9 +8004,9 @@ var Link = (0, import_react22.forwardRef)(
|
|
|
8014
8004
|
role,
|
|
8015
8005
|
...props
|
|
8016
8006
|
}, ref) => {
|
|
8017
|
-
const
|
|
8007
|
+
const inRouterContext = (0, import_react_router.useInRouterContext)();
|
|
8018
8008
|
const to = generateHref(props.href, type, disabled);
|
|
8019
|
-
const shouldUseReactRouterLink =
|
|
8009
|
+
const shouldUseReactRouterLink = inRouterContext && type !== "external" && !to?.startsWith("http");
|
|
8020
8010
|
const handleClick = async (event) => {
|
|
8021
8011
|
if (disabled) {
|
|
8022
8012
|
event.preventDefault();
|
|
@@ -8065,7 +8055,8 @@ var Link = (0, import_react22.forwardRef)(
|
|
|
8065
8055
|
const externalLinkProps = type === "external" ? { target: "_blank", rel: "noopener noreferrer" } : null;
|
|
8066
8056
|
const routerSpecificProps = shouldUseReactRouterLink ? {
|
|
8067
8057
|
// TODO: Using 'any' here due to styled-components typing limitations with RouterLink
|
|
8068
|
-
|
|
8058
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
|
|
8059
|
+
as: import_react_router.Link,
|
|
8069
8060
|
to: to ?? ""
|
|
8070
8061
|
} : {
|
|
8071
8062
|
as: "a",
|