@wistia/ui 0.18.1 → 0.18.2-beta.4003271.cf839cf

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.d.mts CHANGED
@@ -4118,6 +4118,7 @@ declare const gradients: {
4118
4118
  };
4119
4119
  type GradientNameType = keyof typeof gradients;
4120
4120
 
4121
+ type AspectRatioType = 'square' | 'wide';
4121
4122
  type Storyboard = {
4122
4123
  __typename?: string;
4123
4124
  aspectRatio: number;
@@ -4160,6 +4161,11 @@ type ThumbnailProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {
4160
4161
  * Example: '180px'
4161
4162
  */
4162
4163
  height?: string;
4164
+ /**
4165
+ * The aspect ratio of the thumbnail container.
4166
+ * 'wide' maps to 16:9 ratio, 'square' maps to 1:1 ratio.
4167
+ */
4168
+ aspectRatio?: AspectRatioType;
4163
4169
  };
4164
4170
  /**
4165
4171
  * A `Thumbnail` is a small, reduced-size version of an image or video used as a preview or representative image.
@@ -4195,6 +4201,11 @@ declare const Thumbnail: react.ForwardRefExoticComponent<Omit<Omit<react.Detaile
4195
4201
  * Example: '180px'
4196
4202
  */
4197
4203
  height?: string;
4204
+ /**
4205
+ * The aspect ratio of the thumbnail container.
4206
+ * 'wide' maps to 16:9 ratio, 'square' maps to 1:1 ratio.
4207
+ */
4208
+ aspectRatio?: AspectRatioType;
4198
4209
  } & react.RefAttributes<HTMLDivElement>>;
4199
4210
 
4200
4211
  type ThumbnailCollageProps = {
package/dist/index.d.ts CHANGED
@@ -4118,6 +4118,7 @@ declare const gradients: {
4118
4118
  };
4119
4119
  type GradientNameType = keyof typeof gradients;
4120
4120
 
4121
+ type AspectRatioType = 'square' | 'wide';
4121
4122
  type Storyboard = {
4122
4123
  __typename?: string;
4123
4124
  aspectRatio: number;
@@ -4160,6 +4161,11 @@ type ThumbnailProps = Omit<ComponentPropsWithoutRef<'div'>, 'children'> & {
4160
4161
  * Example: '180px'
4161
4162
  */
4162
4163
  height?: string;
4164
+ /**
4165
+ * The aspect ratio of the thumbnail container.
4166
+ * 'wide' maps to 16:9 ratio, 'square' maps to 1:1 ratio.
4167
+ */
4168
+ aspectRatio?: AspectRatioType;
4163
4169
  };
4164
4170
  /**
4165
4171
  * A `Thumbnail` is a small, reduced-size version of an image or video used as a preview or representative image.
@@ -4195,6 +4201,11 @@ declare const Thumbnail: react.ForwardRefExoticComponent<Omit<Omit<react.Detaile
4195
4201
  * Example: '180px'
4196
4202
  */
4197
4203
  height?: string;
4204
+ /**
4205
+ * The aspect ratio of the thumbnail container.
4206
+ * 'wide' maps to 16:9 ratio, 'square' maps to 1:1 ratio.
4207
+ */
4208
+ aspectRatio?: AspectRatioType;
4198
4209
  } & react.RefAttributes<HTMLDivElement>>;
4199
4210
 
4200
4211
  type ThumbnailCollageProps = {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.18.1
3
+ * @license @wistia/ui v0.18.2-beta.4003271.cf839cf
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -17588,7 +17588,7 @@ var StyledThumbnailBadge = styled104.div`
17588
17588
  align-items: center;
17589
17589
  background-color: rgb(0 0 0 / 50%);
17590
17590
  border-radius: var(--wui-border-radius-01);
17591
- bottom: var(--wui-space-01);
17591
+ bottom: var(--wui-thumbnail-badge-offset);
17592
17592
  color: var(--wui-color-text-on-fill);
17593
17593
  display: flex;
17594
17594
  font-size: var(--wui-typography-body-4-size);
@@ -17596,7 +17596,7 @@ var StyledThumbnailBadge = styled104.div`
17596
17596
  gap: var(--wui-space-01);
17597
17597
  padding: 0 var(--wui-space-01);
17598
17598
  position: absolute;
17599
- right: var(--wui-space-01);
17599
+ right: var(--wui-thumbnail-badge-offset);
17600
17600
  z-index: 1;
17601
17601
 
17602
17602
  svg {
@@ -17891,6 +17891,14 @@ var ThumbnailStoryboardViewer = ({
17891
17891
 
17892
17892
  // src/components/Thumbnail/Thumbnail.tsx
17893
17893
  import { jsx as jsx325, jsxs as jsxs69 } from "react/jsx-runtime";
17894
+ var WIDE_ASPECT_RATIO = 16 / 9;
17895
+ var SQUARE_ASPECT_RATIO = 1;
17896
+ var getAspectRatioValue = (aspectRatio) => {
17897
+ if (aspectRatio === "square") {
17898
+ return SQUARE_ASPECT_RATIO;
17899
+ }
17900
+ return WIDE_ASPECT_RATIO;
17901
+ };
17894
17902
  var WideThumbnailImage = styled106.img`
17895
17903
  height: 100%;
17896
17904
  object-fit: cover;
@@ -17921,7 +17929,15 @@ var ThumbnailImage = ({ thumbnailImageType, thumbnailUrl }) => {
17921
17929
  }
17922
17930
  );
17923
17931
  };
17932
+ var StyledThumbnailContainer = styled106.div`
17933
+ container-type: size;
17934
+ aspect-ratio: ${({ $aspectRatio }) => getAspectRatioValue($aspectRatio)};
17935
+ width: ${({ $width }) => $width};
17936
+ display: flex;
17937
+ overflow: hidden;
17938
+ `;
17924
17939
  var StyledThumbnail = styled106.div`
17940
+ --wui-thumbnail-badge-offset: var(--wui-space-01);
17925
17941
  background-image: ${({ $backgroundUrl }) => isNotNil43($backgroundUrl) ? `url('${$backgroundUrl}')` : void 0};
17926
17942
  ${({ $backgroundUrl, $gradientBackground }) => (
17927
17943
  // if we don't have $backgroundUrl show a gradient
@@ -17929,34 +17945,29 @@ var StyledThumbnail = styled106.div`
17929
17945
  )};
17930
17946
  background-position: center center;
17931
17947
  background-size: cover;
17932
- aspect-ratio: 16 / 9;
17948
+
17933
17949
  display: flex;
17950
+ width: 100%;
17934
17951
  overflow: hidden;
17935
17952
  position: relative;
17936
- width: ${({ $width }) => $width};
17937
- ${({ $isScrubbable }) => $isScrubbable && "cursor: pointer;"}
17953
+ display: flex;
17954
+ border-radius: clamp(var(--wui-border-radius-01), 8cqh, var(--wui-border-radius-05));
17938
17955
 
17939
- &,
17940
- img {
17941
- border-radius: calc(8% * (9 / 16)) / 8%;
17956
+ @container (min-width: 200px) {
17957
+ --wui-thumbnail-badge-offset: var(--wui-space-02);
17942
17958
  }
17959
+
17960
+ ${({ $isScrubbable }) => $isScrubbable && "cursor: pointer;"}
17943
17961
  `;
17944
17962
  var StoryboardRenderer = ({
17945
17963
  storyboard,
17946
17964
  width,
17947
17965
  percent,
17948
17966
  cursorPosition,
17949
- isStoryboardReady
17967
+ isStoryboardReady,
17968
+ aspectRatio
17950
17969
  }) => {
17951
- const {
17952
- url,
17953
- width: sbWidth,
17954
- height: sbHeight,
17955
- frameHeight,
17956
- frameWidth,
17957
- frameCount,
17958
- aspectRatio
17959
- } = storyboard;
17970
+ const { url, width: sbWidth, height: sbHeight, frameHeight, frameWidth, frameCount } = storyboard;
17960
17971
  const targetWidth = isString4(width) ? parseInt(width, 10) : Number(width);
17961
17972
  const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
17962
17973
  return /* @__PURE__ */ jsx325(
@@ -17970,7 +17981,7 @@ var StoryboardRenderer = ({
17970
17981
  storyboardHeight: sbHeight,
17971
17982
  storyboardUrl: url,
17972
17983
  storyboardWidth: sbWidth,
17973
- targetAspectRatio: aspectRatio,
17984
+ targetAspectRatio: getAspectRatioValue(aspectRatio),
17974
17985
  targetWidth
17975
17986
  }
17976
17987
  );
@@ -17993,6 +18004,7 @@ var Thumbnail = forwardRef37(
17993
18004
  children,
17994
18005
  storyboard,
17995
18006
  height,
18007
+ aspectRatio = "wide",
17996
18008
  ...props
17997
18009
  }, ref) => {
17998
18010
  const [percent, setPercent] = useState26(0);
@@ -18044,6 +18056,7 @@ var Thumbnail = forwardRef37(
18044
18056
  thumbnailContent = /* @__PURE__ */ jsx325(
18045
18057
  StoryboardRenderer,
18046
18058
  {
18059
+ aspectRatio,
18047
18060
  cursorPosition,
18048
18061
  isStoryboardReady,
18049
18062
  percent,
@@ -18062,23 +18075,30 @@ var Thumbnail = forwardRef37(
18062
18075
  } else {
18063
18076
  thumbnailContent = null;
18064
18077
  }
18065
- return /* @__PURE__ */ jsxs69(
18066
- StyledThumbnail,
18078
+ return /* @__PURE__ */ jsx325(
18079
+ StyledThumbnailContainer,
18067
18080
  {
18068
18081
  ref,
18069
- ...props,
18070
- $backgroundUrl: backgroundUrl,
18071
- $gradientBackground: gradientBackground,
18072
- $isScrubbable: isScrubbable,
18082
+ $aspectRatio: aspectRatio,
18073
18083
  $width: width,
18074
- onBlur: handleMouseOut,
18075
- onMouseMove: handleMouseMove,
18076
- onMouseOut: handleMouseOut,
18077
- role: "presentation",
18078
- children: [
18079
- isNotNil43(children) ? children : null,
18080
- thumbnailContent
18081
- ]
18084
+ "data-thumbnail-container": true,
18085
+ ...props,
18086
+ children: /* @__PURE__ */ jsxs69(
18087
+ StyledThumbnail,
18088
+ {
18089
+ $backgroundUrl: backgroundUrl,
18090
+ $gradientBackground: gradientBackground,
18091
+ $isScrubbable: isScrubbable,
18092
+ onBlur: handleMouseOut,
18093
+ onMouseMove: handleMouseMove,
18094
+ onMouseOut: handleMouseOut,
18095
+ role: "presentation",
18096
+ children: [
18097
+ isNotNil43(children) ? children : null,
18098
+ thumbnailContent
18099
+ ]
18100
+ }
18101
+ )
18082
18102
  }
18083
18103
  );
18084
18104
  }
@@ -18090,72 +18110,55 @@ import React5 from "react";
18090
18110
  import { styled as styled107 } from "styled-components";
18091
18111
  import { isNonEmptyArray } from "@wistia/type-guards";
18092
18112
  import { jsx as jsx326 } from "react/jsx-runtime";
18113
+ var ThumbnailCollageContainer = styled107.div`
18114
+ container-type: size;
18115
+ width: 100%;
18116
+ aspect-ratio: 16 / 9;
18117
+ display: flex;
18118
+ `;
18093
18119
  var StyledThumbnailCollage = styled107.div`
18094
18120
  display: grid;
18095
18121
  gap: var(--wui-space-01);
18096
18122
  width: 100%;
18097
18123
  grid-template-columns: 3fr 2fr;
18098
18124
  grid-template-rows: 1fr 1fr;
18099
- aspect-ratio: 16 / 9;
18100
18125
 
18101
18126
  &:has(:nth-child(1)) {
18102
- --wui-collage-thumbnail-first-border-radius: calc(8% * (9 / 16)) / 8%;
18103
-
18104
18127
  grid-template-areas:
18105
18128
  'a a'
18106
18129
  'a a';
18107
18130
  }
18108
18131
 
18109
18132
  &:has(:nth-child(2)) {
18110
- --wui-collage-thumbnail-first-border-radius: 7.5% / 8%;
18111
- --wui-collage-thumbnail-second-border-radius: 11.5% / 8%;
18112
-
18113
18133
  grid-template-areas:
18114
18134
  'a b'
18115
18135
  'a b';
18116
18136
  }
18117
18137
 
18118
18138
  &:has(:nth-child(3)) {
18119
- --wui-collage-thumbnail-first-border-radius: 7.5% / 8%;
18120
- --wui-collage-thumbnail-second-border-radius: 11.5% / 16%;
18121
- --wui-collage-thumbnail-third-border-radius: 11.5% / 16%;
18122
-
18123
18139
  grid-template-areas:
18124
18140
  'a b'
18125
18141
  'a c';
18126
18142
  }
18127
18143
 
18128
18144
  > :nth-child(1) {
18129
- --wui-collage-thumbnail-border-radius: var(--wui-collage-thumbnail-first-border-radius);
18130
-
18131
18145
  grid-area: a;
18132
18146
  }
18133
18147
 
18134
18148
  > :nth-child(2) {
18135
- --wui-collage-thumbnail-border-radius: var(--wui-collage-thumbnail-second-border-radius);
18136
-
18137
18149
  grid-area: b;
18138
18150
  }
18139
18151
 
18140
18152
  > :nth-child(3) {
18141
- --wui-collage-thumbnail-border-radius: var(--wui-collage-thumbnail-third-border-radius);
18142
-
18143
18153
  grid-area: c;
18144
18154
  }
18145
18155
 
18146
- > * {
18156
+ [data-thumbnail-container] {
18157
+ //allows for the border radius to be based off the collage's dimensions
18158
+ container-type: unset;
18147
18159
  aspect-ratio: unset;
18148
18160
  height: 100%;
18149
18161
  width: 100%;
18150
- border-radius: var(--wui-collage-thumbnail-border-radius);
18151
-
18152
- img {
18153
- border-radius: var(--wui-collage-thumbnail-border-radius);
18154
- }
18155
-
18156
- > :not(img) {
18157
- display: none;
18158
- }
18159
18162
  }
18160
18163
  `;
18161
18164
  var ThumbnailCollage = ({
@@ -18181,7 +18184,7 @@ var ThumbnailCollage = ({
18181
18184
  "fallback"
18182
18185
  )
18183
18186
  ];
18184
- return /* @__PURE__ */ jsx326(
18187
+ return /* @__PURE__ */ jsx326(ThumbnailCollageContainer, { children: /* @__PURE__ */ jsx326(
18185
18188
  StyledThumbnailCollage,
18186
18189
  {
18187
18190
  $gradientBackground: gradientBackground,
@@ -18189,7 +18192,7 @@ var ThumbnailCollage = ({
18189
18192
  ...props,
18190
18193
  children: thumbnails
18191
18194
  }
18192
- );
18195
+ ) });
18193
18196
  };
18194
18197
 
18195
18198
  // src/components/WistiaLogo/WistiaLogo.tsx