@wistia/ui 3.0.0 → 3.0.1
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/CHANGELOG.md +6 -0
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4556](https://github.com/wistia/vhs/pull/4556) [`ae46e8f`](https://github.com/wistia/vhs/commit/ae46e8f530f67ff5a68b082d611c3da6fd295099) Thanks [@wistia-wizard](https://github.com/apps/wistia-wizard)! - Link: a link with a `beforeAction` now calls its `onClick` during the click, instead of after `beforeAction` finishes, and navigates whether or not `onClick` throws. Since 2.13.1, link items in a `Menu` with an absolute `href` and a `beforeAction` stopped navigating: the menu's click handler ran after the `await` and threw, which skipped `window.location.assign`.
|
|
8
|
+
|
|
3
9
|
## 3.0.0
|
|
4
10
|
|
|
5
11
|
### Major Changes
|
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
|
|
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,
|