@wistia/ui 0.18.1 → 0.18.2-beta.055fa0b4.dbaa6cc

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.18.1
3
+ * @license @wistia/ui v0.18.2-beta.055fa0b4.dbaa6cc
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -17724,7 +17724,7 @@ var StyledThumbnailBadge = import_styled_components123.styled.div`
17724
17724
  align-items: center;
17725
17725
  background-color: rgb(0 0 0 / 50%);
17726
17726
  border-radius: var(--wui-border-radius-01);
17727
- bottom: var(--wui-space-01);
17727
+ bottom: var(--wui-thumbnail-badge-offset);
17728
17728
  color: var(--wui-color-text-on-fill);
17729
17729
  display: flex;
17730
17730
  font-size: var(--wui-typography-body-4-size);
@@ -17732,7 +17732,7 @@ var StyledThumbnailBadge = import_styled_components123.styled.div`
17732
17732
  gap: var(--wui-space-01);
17733
17733
  padding: 0 var(--wui-space-01);
17734
17734
  position: absolute;
17735
- right: var(--wui-space-01);
17735
+ right: var(--wui-thumbnail-badge-offset);
17736
17736
  z-index: 1;
17737
17737
 
17738
17738
  svg {
@@ -18027,6 +18027,14 @@ var ThumbnailStoryboardViewer = ({
18027
18027
 
18028
18028
  // src/components/Thumbnail/Thumbnail.tsx
18029
18029
  var import_jsx_runtime327 = require("react/jsx-runtime");
18030
+ var WIDE_ASPECT_RATIO = 16 / 9;
18031
+ var SQUARE_ASPECT_RATIO = 1;
18032
+ var getAspectRatioValue = (aspectRatio) => {
18033
+ if (aspectRatio === "square") {
18034
+ return SQUARE_ASPECT_RATIO;
18035
+ }
18036
+ return WIDE_ASPECT_RATIO;
18037
+ };
18030
18038
  var WideThumbnailImage = import_styled_components126.styled.img`
18031
18039
  height: 100%;
18032
18040
  object-fit: cover;
@@ -18057,7 +18065,17 @@ var ThumbnailImage = ({ thumbnailImageType, thumbnailUrl }) => {
18057
18065
  }
18058
18066
  );
18059
18067
  };
18068
+ var StyledThumbnailContainer = import_styled_components126.styled.div`
18069
+ container-type: size;
18070
+ aspect-ratio: ${({ $aspectRatio }) => getAspectRatioValue($aspectRatio)};
18071
+ width: ${({ $width }) => $width};
18072
+ display: flex;
18073
+ overflow: hidden;
18074
+ ${({ $isScrubbable }) => $isScrubbable && "cursor: pointer;"}
18075
+ `;
18060
18076
  var StyledThumbnail = import_styled_components126.styled.div`
18077
+ --wui-thumbnail-badge-offset: var(--wui-space-01);
18078
+
18061
18079
  background-image: ${({ $backgroundUrl }) => (0, import_type_guards74.isNotNil)($backgroundUrl) ? `url('${$backgroundUrl}')` : void 0};
18062
18080
  ${({ $backgroundUrl, $gradientBackground }) => (
18063
18081
  // if we don't have $backgroundUrl show a gradient
@@ -18065,16 +18083,14 @@ var StyledThumbnail = import_styled_components126.styled.div`
18065
18083
  )};
18066
18084
  background-position: center center;
18067
18085
  background-size: cover;
18068
- aspect-ratio: 16 / 9;
18069
18086
  display: flex;
18087
+ width: 100%;
18070
18088
  overflow: hidden;
18071
18089
  position: relative;
18072
- width: ${({ $width }) => $width};
18073
- ${({ $isScrubbable }) => $isScrubbable && "cursor: pointer;"}
18090
+ border-radius: clamp(var(--wui-border-radius-01), 8cqh, var(--wui-border-radius-05));
18074
18091
 
18075
- &,
18076
- img {
18077
- border-radius: calc(8% * (9 / 16)) / 8%;
18092
+ @container (min-width: 200px) {
18093
+ --wui-thumbnail-badge-offset: var(--wui-space-02);
18078
18094
  }
18079
18095
  `;
18080
18096
  var StoryboardRenderer = ({
@@ -18082,17 +18098,10 @@ var StoryboardRenderer = ({
18082
18098
  width,
18083
18099
  percent,
18084
18100
  cursorPosition,
18085
- isStoryboardReady
18101
+ isStoryboardReady,
18102
+ aspectRatio
18086
18103
  }) => {
18087
- const {
18088
- url,
18089
- width: sbWidth,
18090
- height: sbHeight,
18091
- frameHeight,
18092
- frameWidth,
18093
- frameCount,
18094
- aspectRatio
18095
- } = storyboard;
18104
+ const { url, width: sbWidth, height: sbHeight, frameHeight, frameWidth, frameCount } = storyboard;
18096
18105
  const targetWidth = (0, import_type_guards74.isString)(width) ? parseInt(width, 10) : Number(width);
18097
18106
  const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
18098
18107
  return /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
@@ -18106,7 +18115,7 @@ var StoryboardRenderer = ({
18106
18115
  storyboardHeight: sbHeight,
18107
18116
  storyboardUrl: url,
18108
18117
  storyboardWidth: sbWidth,
18109
- targetAspectRatio: aspectRatio,
18118
+ targetAspectRatio: getAspectRatioValue(aspectRatio),
18110
18119
  targetWidth
18111
18120
  }
18112
18121
  );
@@ -18129,6 +18138,7 @@ var Thumbnail = (0, import_react100.forwardRef)(
18129
18138
  children,
18130
18139
  storyboard,
18131
18140
  height,
18141
+ aspectRatio = "wide",
18132
18142
  ...props
18133
18143
  }, ref) => {
18134
18144
  const [percent, setPercent] = (0, import_react100.useState)(0);
@@ -18180,6 +18190,7 @@ var Thumbnail = (0, import_react100.forwardRef)(
18180
18190
  thumbnailContent = /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
18181
18191
  StoryboardRenderer,
18182
18192
  {
18193
+ aspectRatio,
18183
18194
  cursorPosition,
18184
18195
  isStoryboardReady,
18185
18196
  percent,
@@ -18198,23 +18209,31 @@ var Thumbnail = (0, import_react100.forwardRef)(
18198
18209
  } else {
18199
18210
  thumbnailContent = null;
18200
18211
  }
18201
- return /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)(
18202
- StyledThumbnail,
18212
+ return /* @__PURE__ */ (0, import_jsx_runtime327.jsx)(
18213
+ StyledThumbnailContainer,
18203
18214
  {
18204
18215
  ref,
18205
- ...props,
18206
- $backgroundUrl: backgroundUrl,
18207
- $gradientBackground: gradientBackground,
18216
+ $aspectRatio: aspectRatio,
18208
18217
  $isScrubbable: isScrubbable,
18209
18218
  $width: width,
18219
+ "data-wui-thumbnail-container": true,
18210
18220
  onBlur: handleMouseOut,
18211
18221
  onMouseMove: handleMouseMove,
18212
18222
  onMouseOut: handleMouseOut,
18213
18223
  role: "presentation",
18214
- children: [
18215
- (0, import_type_guards74.isNotNil)(children) ? children : null,
18216
- thumbnailContent
18217
- ]
18224
+ ...props,
18225
+ children: /* @__PURE__ */ (0, import_jsx_runtime327.jsxs)(
18226
+ StyledThumbnail,
18227
+ {
18228
+ $backgroundUrl: backgroundUrl,
18229
+ $gradientBackground: gradientBackground,
18230
+ "data-testid": "thumbnail-inner",
18231
+ children: [
18232
+ (0, import_type_guards74.isNotNil)(children) ? children : null,
18233
+ thumbnailContent
18234
+ ]
18235
+ }
18236
+ )
18218
18237
  }
18219
18238
  );
18220
18239
  }
@@ -18229,72 +18248,54 @@ var import_jsx_runtime328 = (
18229
18248
  // ThumbnailCollage will fallback to a Thumbnail with a gradient background if no children are provided
18230
18249
  require("react/jsx-runtime")
18231
18250
  );
18251
+ var ThumbnailCollageContainer = import_styled_components127.styled.div`
18252
+ container-type: size;
18253
+ width: 100%;
18254
+ aspect-ratio: 16 / 9;
18255
+ display: flex;
18256
+ `;
18232
18257
  var StyledThumbnailCollage = import_styled_components127.styled.div`
18233
18258
  display: grid;
18234
18259
  gap: var(--wui-space-01);
18235
18260
  width: 100%;
18236
18261
  grid-template-columns: 3fr 2fr;
18237
18262
  grid-template-rows: 1fr 1fr;
18238
- aspect-ratio: 16 / 9;
18239
18263
 
18240
18264
  &:has(:nth-child(1)) {
18241
- --wui-collage-thumbnail-first-border-radius: calc(8% * (9 / 16)) / 8%;
18242
-
18243
18265
  grid-template-areas:
18244
18266
  'a a'
18245
18267
  'a a';
18246
18268
  }
18247
18269
 
18248
18270
  &:has(:nth-child(2)) {
18249
- --wui-collage-thumbnail-first-border-radius: 7.5% / 8%;
18250
- --wui-collage-thumbnail-second-border-radius: 11.5% / 8%;
18251
-
18252
18271
  grid-template-areas:
18253
18272
  'a b'
18254
18273
  'a b';
18255
18274
  }
18256
18275
 
18257
18276
  &:has(:nth-child(3)) {
18258
- --wui-collage-thumbnail-first-border-radius: 7.5% / 8%;
18259
- --wui-collage-thumbnail-second-border-radius: 11.5% / 16%;
18260
- --wui-collage-thumbnail-third-border-radius: 11.5% / 16%;
18261
-
18262
18277
  grid-template-areas:
18263
18278
  'a b'
18264
18279
  'a c';
18265
18280
  }
18266
18281
 
18267
18282
  > :nth-child(1) {
18268
- --wui-collage-thumbnail-border-radius: var(--wui-collage-thumbnail-first-border-radius);
18269
-
18270
18283
  grid-area: a;
18271
18284
  }
18272
18285
 
18273
18286
  > :nth-child(2) {
18274
- --wui-collage-thumbnail-border-radius: var(--wui-collage-thumbnail-second-border-radius);
18275
-
18276
18287
  grid-area: b;
18277
18288
  }
18278
18289
 
18279
18290
  > :nth-child(3) {
18280
- --wui-collage-thumbnail-border-radius: var(--wui-collage-thumbnail-third-border-radius);
18281
-
18282
18291
  grid-area: c;
18283
18292
  }
18284
18293
 
18285
- > * {
18294
+ [data-thumbnail-container] {
18295
+ container-type: unset;
18286
18296
  aspect-ratio: unset;
18287
18297
  height: 100%;
18288
18298
  width: 100%;
18289
- border-radius: var(--wui-collage-thumbnail-border-radius);
18290
-
18291
- img {
18292
- border-radius: var(--wui-collage-thumbnail-border-radius);
18293
- }
18294
-
18295
- > :not(img) {
18296
- display: none;
18297
- }
18298
18299
  }
18299
18300
  `;
18300
18301
  var ThumbnailCollage = ({
@@ -18319,7 +18320,7 @@ var ThumbnailCollage = ({
18319
18320
  "fallback"
18320
18321
  )
18321
18322
  ];
18322
- return /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
18323
+ return /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(ThumbnailCollageContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime328.jsx)(
18323
18324
  StyledThumbnailCollage,
18324
18325
  {
18325
18326
  $gradientBackground: gradientBackground,
@@ -18327,7 +18328,7 @@ var ThumbnailCollage = ({
18327
18328
  ...props,
18328
18329
  children: thumbnails
18329
18330
  }
18330
- );
18331
+ ) });
18331
18332
  };
18332
18333
 
18333
18334
  // src/components/WistiaLogo/WistiaLogo.tsx