@wistia/ui 0.14.41-beta.b8671e7e.ecb695f → 0.14.41-beta.ddbacd4d.dab4958

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.14.41-beta.b8671e7e.ecb695f
3
+ * @license @wistia/ui v0.14.41-beta.ddbacd4d.dab4958
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2990,11 +2990,26 @@ var useForceUpdate = () => {
2990
2990
  var import_react11 = require("react");
2991
2991
  var useIsHovered = () => {
2992
2992
  const [isHovered, setIsHovered] = (0, import_react11.useState)(false);
2993
- const onFocus = () => setIsHovered(true);
2994
- const onMouseEnter = () => setIsHovered(true);
2995
- const onMouseMove = () => setIsHovered(true);
2996
- const onBlur = () => setIsHovered(false);
2997
- const onMouseLeave = () => setIsHovered(false);
2993
+ const onFocus = (event) => {
2994
+ if (event.target !== event.currentTarget) return;
2995
+ setIsHovered(true);
2996
+ };
2997
+ const onMouseEnter = (event) => {
2998
+ if (event.target !== event.currentTarget) return;
2999
+ setIsHovered(true);
3000
+ };
3001
+ const onMouseMove = (event) => {
3002
+ if (event.target !== event.currentTarget) return;
3003
+ setIsHovered(true);
3004
+ };
3005
+ const onBlur = (event) => {
3006
+ if (event.target !== event.currentTarget) return;
3007
+ setIsHovered(false);
3008
+ };
3009
+ const onMouseLeave = (event) => {
3010
+ if (event.target !== event.currentTarget) return;
3011
+ setIsHovered(false);
3012
+ };
2998
3013
  const hoverProps = {
2999
3014
  onFocus,
3000
3015
  onMouseEnter,
@@ -7706,7 +7721,7 @@ Icon.displayName = "Icon_UI";
7706
7721
  // src/components/Link/Link.tsx
7707
7722
  var import_react22 = require("react");
7708
7723
  var import_styled_components21 = __toESM(require("styled-components"));
7709
- var import_react_router = require("react-router");
7724
+ var import_react_router_dom = require("react-router-dom");
7710
7725
  var import_type_guards14 = require("@wistia/type-guards");
7711
7726
  var import_jsx_runtime197 = require("react/jsx-runtime");
7712
7727
  var generateHref = (href, type, disabled) => {
@@ -7761,7 +7776,7 @@ var Link = (0, import_react22.forwardRef)(
7761
7776
  role,
7762
7777
  ...props
7763
7778
  }, ref) => {
7764
- const inRouterContext = (0, import_react_router.useInRouterContext)();
7779
+ const inRouterContext = (0, import_react_router_dom.useInRouterContext)();
7765
7780
  const to = generateHref(props.href, type, disabled);
7766
7781
  const shouldUseReactRouterLink = inRouterContext && type !== "external" && !to?.startsWith("http");
7767
7782
  const handleClick = async (event) => {
@@ -7813,7 +7828,7 @@ var Link = (0, import_react22.forwardRef)(
7813
7828
  const routerSpecificProps = shouldUseReactRouterLink ? {
7814
7829
  // TODO: Using 'any' here due to styled-components typing limitations with RouterLink
7815
7830
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
7816
- as: import_react_router.Link,
7831
+ as: import_react_router_dom.Link,
7817
7832
  to: to ?? ""
7818
7833
  } : {
7819
7834
  as: "a",
@@ -17804,6 +17819,40 @@ var StyledThumbnail = import_styled_components126.default.div`
17804
17819
  border-radius: calc(8% * (9 / 16)) / 8%;
17805
17820
  }
17806
17821
  `;
17822
+ var StoryboardRenderer = ({
17823
+ storyboard,
17824
+ width,
17825
+ percent,
17826
+ cursorPosition,
17827
+ isStoryboardReady
17828
+ }) => {
17829
+ const {
17830
+ url,
17831
+ width: sbWidth,
17832
+ height: sbHeight,
17833
+ frameHeight,
17834
+ frameWidth,
17835
+ frameCount,
17836
+ aspectRatio
17837
+ } = storyboard;
17838
+ const targetWidth = (0, import_type_guards73.isString)(width) ? parseInt(width, 10) : Number(width);
17839
+ const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
17840
+ return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
17841
+ ThumbnailStoryboardViewer,
17842
+ {
17843
+ cursorPosition: effectiveCursorPosition,
17844
+ frameCount,
17845
+ frameHeight,
17846
+ frameWidth,
17847
+ percent,
17848
+ storyboardHeight: sbHeight,
17849
+ storyboardUrl: url,
17850
+ storyboardWidth: sbWidth,
17851
+ targetAspectRatio: aspectRatio,
17852
+ targetWidth
17853
+ }
17854
+ );
17855
+ };
17807
17856
  var getRelativeMousePosition = (elem, mouseEvent) => {
17808
17857
  const rect = elem.getBoundingClientRect();
17809
17858
  const relativeLeft = mouseEvent.clientX - rect.left;
@@ -17863,40 +17912,23 @@ var Thumbnail = (0, import_react100.forwardRef)(
17863
17912
  setCursorPosition(null);
17864
17913
  }, [isScrubbable]);
17865
17914
  const shouldRenderStoryboard = (0, import_react100.useMemo)(() => {
17866
- return Boolean(isScrubbable && isMouseOver && isStoryboardReady);
17867
- }, [isScrubbable, isMouseOver, isStoryboardReady]);
17868
- const renderStoryboard = (0, import_react100.useCallback)(() => {
17869
- if (!storyboard || (0, import_type_guards73.isUndefined)(height) || (0, import_type_guards73.isEmptyString)(height)) return null;
17870
- const {
17871
- url,
17872
- width: sbWidth,
17873
- height: sbHeight,
17874
- frameHeight,
17875
- frameWidth,
17876
- frameCount,
17877
- aspectRatio
17878
- } = storyboard;
17879
- const targetWidth = (0, import_type_guards73.isString)(width) ? parseInt(width, 10) : Number(width);
17880
- const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
17881
- return /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
17882
- ThumbnailStoryboardViewer,
17915
+ if ((0, import_type_guards73.isNil)(storyboard) || (0, import_type_guards73.isUndefined)(height) || (0, import_type_guards73.isEmptyString)(height)) {
17916
+ return false;
17917
+ }
17918
+ return isScrubbable && isMouseOver && isStoryboardReady;
17919
+ }, [isScrubbable, isMouseOver, isStoryboardReady, storyboard, height]);
17920
+ let thumbnailContent = null;
17921
+ if (storyboard && shouldRenderStoryboard) {
17922
+ thumbnailContent = /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
17923
+ StoryboardRenderer,
17883
17924
  {
17884
- cursorPosition: effectiveCursorPosition,
17885
- frameCount,
17886
- frameHeight,
17887
- frameWidth,
17925
+ cursorPosition,
17926
+ isStoryboardReady,
17888
17927
  percent,
17889
- storyboardHeight: sbHeight,
17890
- storyboardUrl: url,
17891
- storyboardWidth: sbWidth,
17892
- targetAspectRatio: aspectRatio,
17893
- targetWidth
17928
+ storyboard,
17929
+ width
17894
17930
  }
17895
17931
  );
17896
- }, [storyboard, percent, width, height, cursorPosition, isStoryboardReady]);
17897
- let thumbnailContent = null;
17898
- if (shouldRenderStoryboard) {
17899
- thumbnailContent = renderStoryboard();
17900
17932
  } else if ((0, import_type_guards73.isNotNil)(thumbnailUrl)) {
17901
17933
  thumbnailContent = /* @__PURE__ */ (0, import_jsx_runtime324.jsx)(
17902
17934
  ThumbnailImage,