@wistia/ui 3.0.0 → 3.0.1-beta.bae54e90.55facac
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 +18 -13
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/CHANGELOG.md +0 -2550
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v3.0.
|
|
3
|
+
* @license @wistia/ui v3.0.1-beta.bae54e90.55facac
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -5854,19 +5854,24 @@ const Link = ({ beforeAction, children, type, disabled = false, colorScheme = "i
|
|
|
5854
5854
|
const to = generateHref(props.href, type, disabled);
|
|
5855
5855
|
const shouldUseReactRouterLink = inRouterContext && type !== "external" && !to?.startsWith("http");
|
|
5856
5856
|
const hasIcons = isNotNil(leftIcon) || isNotNil(rightIcon);
|
|
5857
|
-
const
|
|
5858
|
-
|
|
5859
|
-
|
|
5857
|
+
const runBeforeAction = async (action) => {
|
|
5858
|
+
try {
|
|
5859
|
+
await action();
|
|
5860
|
+
} catch (error) {
|
|
5861
|
+
console.error(error);
|
|
5862
|
+
}
|
|
5863
|
+
if (!shouldUseReactRouterLink && isNotNil(to)) window.location.assign(to);
|
|
5864
|
+
};
|
|
5865
|
+
const handleClick = (event) => {
|
|
5866
|
+
if (disabled) {
|
|
5867
|
+
event.preventDefault();
|
|
5868
|
+
return;
|
|
5869
|
+
}
|
|
5870
|
+
if (beforeAction) {
|
|
5860
5871
|
if (!shouldUseReactRouterLink) event.preventDefault();
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
console.error(error);
|
|
5865
|
-
} finally {
|
|
5866
|
-
if (isFunction(props.onClick)) props.onClick(event);
|
|
5867
|
-
if (!shouldUseReactRouterLink && isNotNil(to)) window.location.assign(to);
|
|
5868
|
-
}
|
|
5869
|
-
} else if (isFunction(props.onClick)) props.onClick(event);
|
|
5872
|
+
runBeforeAction(beforeAction);
|
|
5873
|
+
}
|
|
5874
|
+
if (isFunction(props.onClick)) props.onClick(event);
|
|
5870
5875
|
};
|
|
5871
5876
|
const commonProps = {
|
|
5872
5877
|
$colorScheme: colorScheme,
|