@wistia/ui 0.9.3 → 0.9.4-beta.01ba1d3d.5954492

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.9.3
3
+ * @license @wistia/ui v0.9.4-beta.01ba1d3d.5954492
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -11875,7 +11875,7 @@ var StyledSegmentedControlItem = (0, import_styled_components73.default)(import_
11875
11875
  ${segmentedControlItemStyles}
11876
11876
  `;
11877
11877
  var SegmentedControlItem = (0, import_react60.forwardRef)(
11878
- ({ disabled, icon, label, "aria-label": ariaLabel, value }, forwardedRef) => {
11878
+ ({ disabled, icon, label, "aria-label": ariaLabel, value, ...otherProps }, forwardedRef) => {
11879
11879
  const selectedValue = useSegmentedControlValue();
11880
11880
  const { setSelectedItemMeasurements } = useSelectedItemStyle();
11881
11881
  const buttonRef = (0, import_react60.useRef)(null);
@@ -11916,6 +11916,7 @@ var SegmentedControlItem = (0, import_react60.forwardRef)(
11916
11916
  StyledSegmentedControlItem,
11917
11917
  {
11918
11918
  ref: combinedRef,
11919
+ ...otherProps,
11919
11920
  $hasLabel: (0, import_type_guards47.isNotNil)(label),
11920
11921
  "aria-label": (0, import_type_guards47.isNotNil)(label) ? void 0 : ariaLabel,
11921
11922
  disabled,
@@ -12885,8 +12886,8 @@ ThumbnailBadge.displayName = "ThumbnailBadge";
12885
12886
 
12886
12887
  // src/components/Thumbnail/Thumbnail.tsx
12887
12888
  var import_react72 = require("react");
12888
- var import_styled_components92 = __toESM(require("styled-components"));
12889
- var import_type_guards55 = require("@wistia/type-guards");
12889
+ var import_styled_components93 = __toESM(require("styled-components"));
12890
+ var import_type_guards56 = require("@wistia/type-guards");
12890
12891
 
12891
12892
  // src/private/helpers/getBackgroundGradient/getBackgroundGradient.ts
12892
12893
  var import_type_guards54 = require("@wistia/type-guards");
@@ -13021,7 +13022,17 @@ var getBackgroundGradient = (gradientName = void 0) => {
13021
13022
  };
13022
13023
 
13023
13024
  // src/components/Thumbnail/ThumbnailStoryboardViewer.tsx
13025
+ var import_styled_components92 = __toESM(require("styled-components"));
13026
+ var import_type_guards55 = require("@wistia/type-guards");
13024
13027
  var import_jsx_runtime272 = require("react/jsx-runtime");
13028
+ var ScrubLine = import_styled_components92.default.div`
13029
+ position: absolute;
13030
+ top: 0;
13031
+ height: 100%;
13032
+ width: 2px;
13033
+ background-color: var(--wui-color-bg-fill);
13034
+ z-index: 1;
13035
+ `;
13025
13036
  var getScaledDimensions = (originalAspectRatio, targetAspectRatio, viewerWidth, viewerHeight) => {
13026
13037
  let scaledHeight = viewerHeight;
13027
13038
  let scaledWidth = viewerWidth;
@@ -13061,7 +13072,7 @@ var ThumbnailStoryboardViewer = ({
13061
13072
  targetAspectRatio,
13062
13073
  scaleFactor = 1,
13063
13074
  framesPerRow = 10,
13064
- shouldLoadStoryboard = true,
13075
+ cursorPosition,
13065
13076
  ...props
13066
13077
  }) => {
13067
13078
  const originalAspectRatio = frameWidth / frameHeight;
@@ -13097,7 +13108,9 @@ var ThumbnailStoryboardViewer = ({
13097
13108
  storyboardHeight * scaleFactorFromAspectRatioFit * scaleFactor
13098
13109
  );
13099
13110
  const backgroundSize = `${scaledStoryboardWidth}px ${scaledStoryboardHeight}px`;
13100
- const backgroundImage = shouldLoadStoryboard ? `url(${storyboardUrl})` : "";
13111
+ const backgroundImage = `url(${storyboardUrl})`;
13112
+ const showScrubLine = (0, import_type_guards55.isNotNil)(cursorPosition);
13113
+ const scrubLinePosition = (0, import_type_guards55.isNotNil)(cursorPosition) ? `${cursorPosition - 1}px` : "0";
13101
13114
  const viewerStyles = {
13102
13115
  position: "relative",
13103
13116
  overflow: "hidden",
@@ -13114,24 +13127,34 @@ var ThumbnailStoryboardViewer = ({
13114
13127
  backgroundPosition,
13115
13128
  backgroundSize
13116
13129
  };
13117
- return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
13130
+ return /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
13118
13131
  "div",
13119
13132
  {
13120
13133
  ...props,
13121
13134
  style: viewerStyles,
13122
- children: /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { style: storyboardStyles })
13135
+ children: [
13136
+ /* @__PURE__ */ (0, import_jsx_runtime272.jsx)("div", { style: storyboardStyles }),
13137
+ showScrubLine ? /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(
13138
+ ScrubLine,
13139
+ {
13140
+ style: {
13141
+ left: scrubLinePosition
13142
+ }
13143
+ }
13144
+ ) : null
13145
+ ]
13123
13146
  }
13124
13147
  );
13125
13148
  };
13126
13149
 
13127
13150
  // src/components/Thumbnail/Thumbnail.tsx
13128
13151
  var import_jsx_runtime273 = require("react/jsx-runtime");
13129
- var WideThumbnailImage = import_styled_components92.default.img`
13152
+ var WideThumbnailImage = import_styled_components93.default.img`
13130
13153
  height: 100%;
13131
13154
  object-fit: cover;
13132
13155
  width: 100%;
13133
13156
  `;
13134
- var SquareThumbnailImage = import_styled_components92.default.img`
13157
+ var SquareThumbnailImage = import_styled_components93.default.img`
13135
13158
  backdrop-filter: blur(8px);
13136
13159
  object-fit: contain;
13137
13160
  width: 100%;
@@ -13156,11 +13179,11 @@ var ThumbnailImage = ({ thumbnailImageType, thumbnailUrl }) => {
13156
13179
  }
13157
13180
  );
13158
13181
  };
13159
- var StyledThumbnail = import_styled_components92.default.div`
13160
- background-image: ${({ $backgroundUrl }) => (0, import_type_guards55.isNotNil)($backgroundUrl) ? `url('${$backgroundUrl}')` : void 0};
13182
+ var StyledThumbnail = import_styled_components93.default.div`
13183
+ background-image: ${({ $backgroundUrl }) => (0, import_type_guards56.isNotNil)($backgroundUrl) ? `url('${$backgroundUrl}')` : void 0};
13161
13184
  ${({ $backgroundUrl, $gradientBackground }) => (
13162
13185
  // if we don't have $backgroundUrl show a gradient
13163
- (0, import_type_guards55.isNil)($backgroundUrl) ? getBackgroundGradient($gradientBackground) : void 0
13186
+ (0, import_type_guards56.isNil)($backgroundUrl) ? getBackgroundGradient($gradientBackground) : void 0
13164
13187
  )};
13165
13188
  background-position: center center;
13166
13189
  background-size: cover;
@@ -13169,7 +13192,7 @@ var StyledThumbnail = import_styled_components92.default.div`
13169
13192
  overflow: hidden;
13170
13193
  position: relative;
13171
13194
  width: ${({ $width }) => $width};
13172
- ${({ $isScrubbable }) => $isScrubbable && "cursor: ew-resize;"}
13195
+ ${({ $isScrubbable }) => $isScrubbable && "cursor: pointer;"}
13173
13196
 
13174
13197
  &,
13175
13198
  img {
@@ -13200,11 +13223,12 @@ var Thumbnail = (0, import_react72.forwardRef)(
13200
13223
  const [isMouseOver, setIsMouseOver] = (0, import_react72.useState)(false);
13201
13224
  const [isStoryboardReady, setIsStoryboardReady] = (0, import_react72.useState)(false);
13202
13225
  const storyboardElementRef = (0, import_react72.useRef)(null);
13226
+ const [cursorPosition, setCursorPosition] = (0, import_react72.useState)(null);
13203
13227
  const backgroundUrl = (0, import_react72.useMemo)(
13204
- () => thumbnailImageType === "square" && (0, import_type_guards55.isNotNil)(thumbnailUrl) ? thumbnailUrl : void 0,
13228
+ () => thumbnailImageType === "square" && (0, import_type_guards56.isNotNil)(thumbnailUrl) ? thumbnailUrl : void 0,
13205
13229
  [thumbnailImageType, thumbnailUrl]
13206
13230
  );
13207
- const isScrubbable = (0, import_type_guards55.isNotNil)(storyboard);
13231
+ const isScrubbable = (0, import_type_guards56.isNotNil)(storyboard);
13208
13232
  const trackStoryboardLoadStatus = (0, import_react72.useCallback)(() => {
13209
13233
  if (storyboardElementRef.current || !storyboard) {
13210
13234
  return storyboardElementRef.current;
@@ -13223,6 +13247,7 @@ var Thumbnail = (0, import_react72.forwardRef)(
13223
13247
  const newPercent = relMousePos.left / elem.clientWidth;
13224
13248
  trackStoryboardLoadStatus();
13225
13249
  setPercent(newPercent);
13250
+ setCursorPosition(relMousePos.left);
13226
13251
  setIsMouseOver(true);
13227
13252
  },
13228
13253
  [isScrubbable, trackStoryboardLoadStatus]
@@ -13230,12 +13255,13 @@ var Thumbnail = (0, import_react72.forwardRef)(
13230
13255
  const handleMouseOut = (0, import_react72.useCallback)(() => {
13231
13256
  if (!isScrubbable) return;
13232
13257
  setIsMouseOver(false);
13258
+ setCursorPosition(null);
13233
13259
  }, [isScrubbable]);
13234
13260
  const shouldRenderStoryboard = (0, import_react72.useMemo)(() => {
13235
13261
  return Boolean(isScrubbable && isMouseOver && isStoryboardReady);
13236
13262
  }, [isScrubbable, isMouseOver, isStoryboardReady]);
13237
13263
  const renderStoryboard = (0, import_react72.useCallback)(() => {
13238
- if (!storyboard || (0, import_type_guards55.isUndefined)(height) || (0, import_type_guards55.isEmptyString)(height)) return null;
13264
+ if (!storyboard || (0, import_type_guards56.isUndefined)(height) || (0, import_type_guards56.isEmptyString)(height)) return null;
13239
13265
  const {
13240
13266
  url,
13241
13267
  width: sbWidth,
@@ -13245,10 +13271,12 @@ var Thumbnail = (0, import_react72.forwardRef)(
13245
13271
  frameCount,
13246
13272
  aspectRatio
13247
13273
  } = storyboard;
13248
- const targetWidth = (0, import_type_guards55.isString)(width) ? parseInt(width, 10) : Number(width);
13274
+ const targetWidth = (0, import_type_guards56.isString)(width) ? parseInt(width, 10) : Number(width);
13275
+ const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
13249
13276
  return /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
13250
13277
  ThumbnailStoryboardViewer,
13251
13278
  {
13279
+ cursorPosition: effectiveCursorPosition,
13252
13280
  frameCount,
13253
13281
  frameHeight,
13254
13282
  frameWidth,
@@ -13260,11 +13288,11 @@ var Thumbnail = (0, import_react72.forwardRef)(
13260
13288
  targetWidth
13261
13289
  }
13262
13290
  );
13263
- }, [storyboard, percent, width, height]);
13291
+ }, [storyboard, percent, width, height, cursorPosition, isStoryboardReady]);
13264
13292
  let thumbnailContent = null;
13265
13293
  if (shouldRenderStoryboard) {
13266
13294
  thumbnailContent = renderStoryboard();
13267
- } else if ((0, import_type_guards55.isNotNil)(thumbnailUrl)) {
13295
+ } else if ((0, import_type_guards56.isNotNil)(thumbnailUrl)) {
13268
13296
  thumbnailContent = /* @__PURE__ */ (0, import_jsx_runtime273.jsx)(
13269
13297
  ThumbnailImage,
13270
13298
  {
@@ -13289,7 +13317,7 @@ var Thumbnail = (0, import_react72.forwardRef)(
13289
13317
  onMouseOut: handleMouseOut,
13290
13318
  role: "presentation",
13291
13319
  children: [
13292
- (0, import_type_guards55.isNotNil)(children) ? children : null,
13320
+ (0, import_type_guards56.isNotNil)(children) ? children : null,
13293
13321
  thumbnailContent
13294
13322
  ]
13295
13323
  }
@@ -13300,13 +13328,13 @@ Thumbnail.displayName = "Thumbnail";
13300
13328
 
13301
13329
  // src/components/ThumbnailCollage/ThumbnailCollage.tsx
13302
13330
  var import_react73 = __toESM(require("react"));
13303
- var import_styled_components93 = __toESM(require("styled-components"));
13304
- var import_type_guards56 = require("@wistia/type-guards");
13331
+ var import_styled_components94 = __toESM(require("styled-components"));
13332
+ var import_type_guards57 = require("@wistia/type-guards");
13305
13333
  var import_jsx_runtime274 = (
13306
13334
  // ThumbnailCollage will fallback to a Thumbnail with a gradient background if no children are provided
13307
13335
  require("react/jsx-runtime")
13308
13336
  );
13309
- var StyledThumbnailCollage = import_styled_components93.default.div`
13337
+ var StyledThumbnailCollage = import_styled_components94.default.div`
13310
13338
  display: grid;
13311
13339
  gap: var(--wui-space-01);
13312
13340
  width: 100%;
@@ -13381,7 +13409,7 @@ var ThumbnailCollage = ({
13381
13409
  }) => {
13382
13410
  const thumbnailArray = import_react73.default.Children.toArray(children);
13383
13411
  const truncatedThumbnails = thumbnailArray.slice(0, 3);
13384
- const thumbnails = (0, import_type_guards56.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
13412
+ const thumbnails = (0, import_type_guards57.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
13385
13413
  return import_react73.default.cloneElement(child, {
13386
13414
  ...child.props,
13387
13415
  children: void 0
@@ -13408,8 +13436,8 @@ var ThumbnailCollage = ({
13408
13436
  };
13409
13437
 
13410
13438
  // src/components/WistiaLogo/WistiaLogo.tsx
13411
- var import_styled_components94 = __toESM(require("styled-components"));
13412
- var import_type_guards57 = require("@wistia/type-guards");
13439
+ var import_styled_components95 = __toESM(require("styled-components"));
13440
+ var import_type_guards58 = require("@wistia/type-guards");
13413
13441
  var import_jsx_runtime275 = require("react/jsx-runtime");
13414
13442
  var renderBrandmark = (brandmarkColor, iconOnly) => {
13415
13443
  if (iconOnly) {
@@ -13450,7 +13478,7 @@ var computedViewBox = (iconOnly) => {
13450
13478
  }
13451
13479
  return "0 0 144 31.47";
13452
13480
  };
13453
- var WistiaLogoComponent = import_styled_components94.default.svg`
13481
+ var WistiaLogoComponent = import_styled_components95.default.svg`
13454
13482
  height: ${({ height }) => `${height}px`};
13455
13483
 
13456
13484
  /* ensure it will always fit on mobile */
@@ -13466,12 +13494,12 @@ var WistiaLogoComponent = import_styled_components94.default.svg`
13466
13494
  ${({ $opticallyCentered, $iconOnly }) => {
13467
13495
  if ($opticallyCentered) {
13468
13496
  if ($iconOnly) {
13469
- return import_styled_components94.css`
13497
+ return import_styled_components95.css`
13470
13498
  aspect-ratio: 1;
13471
13499
  padding: 11.85% 3.12% 13.91%;
13472
13500
  `;
13473
13501
  }
13474
- return import_styled_components94.css`
13502
+ return import_styled_components95.css`
13475
13503
  aspect-ratio: 127 / 32;
13476
13504
  `;
13477
13505
  }
@@ -13522,7 +13550,7 @@ var WistiaLogo = ({
13522
13550
  ...props,
13523
13551
  children: [
13524
13552
  /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("title", { children: title }),
13525
- (0, import_type_guards57.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("desc", { children: description }) : null,
13553
+ (0, import_type_guards58.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime275.jsx)("desc", { children: description }) : null,
13526
13554
  renderBrandmark(brandmarkColor, iconOnly),
13527
13555
  renderLogotype(logotypeColor, iconOnly)
13528
13556
  ]
@@ -13533,18 +13561,18 @@ var WistiaLogo = ({
13533
13561
  WistiaLogo.displayName = "WistiaLogo";
13534
13562
 
13535
13563
  // src/components/List/List.tsx
13536
- var import_type_guards59 = require("@wistia/type-guards");
13537
- var import_styled_components96 = __toESM(require("styled-components"));
13564
+ var import_type_guards60 = require("@wistia/type-guards");
13565
+ var import_styled_components97 = __toESM(require("styled-components"));
13538
13566
 
13539
13567
  // src/components/List/ListItem.tsx
13540
- var import_styled_components95 = __toESM(require("styled-components"));
13541
- var import_type_guards58 = require("@wistia/type-guards");
13568
+ var import_styled_components96 = __toESM(require("styled-components"));
13569
+ var import_type_guards59 = require("@wistia/type-guards");
13542
13570
  var import_jsx_runtime276 = require("react/jsx-runtime");
13543
- var ListItemComponent = import_styled_components95.default.li`
13571
+ var ListItemComponent = import_styled_components96.default.li`
13544
13572
  margin-bottom: var(--wui-space-02);
13545
13573
  `;
13546
13574
  var ListItem = ({ children }) => {
13547
- if ((0, import_type_guards58.isNil)(children)) {
13575
+ if ((0, import_type_guards59.isNil)(children)) {
13548
13576
  return null;
13549
13577
  }
13550
13578
  return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ListItemComponent, { children });
@@ -13553,7 +13581,7 @@ ListItem.displayName = "ListItem";
13553
13581
 
13554
13582
  // src/components/List/List.tsx
13555
13583
  var import_jsx_runtime277 = require("react/jsx-runtime");
13556
- var spacesStyle = import_styled_components96.css`
13584
+ var spacesStyle = import_styled_components97.css`
13557
13585
  overflow: hidden;
13558
13586
  padding-left: 0;
13559
13587
  vertical-align: bottom;
@@ -13575,7 +13603,7 @@ var spacesStyle = import_styled_components96.css`
13575
13603
  }
13576
13604
  }
13577
13605
  `;
13578
- var commasStyle = import_styled_components96.css`
13606
+ var commasStyle = import_styled_components97.css`
13579
13607
  ${spacesStyle};
13580
13608
 
13581
13609
  li {
@@ -13585,7 +13613,7 @@ var commasStyle = import_styled_components96.css`
13585
13613
  }
13586
13614
  }
13587
13615
  `;
13588
- var slashesStyle = import_styled_components96.css`
13616
+ var slashesStyle = import_styled_components97.css`
13589
13617
  ${spacesStyle};
13590
13618
 
13591
13619
  li {
@@ -13596,7 +13624,7 @@ var slashesStyle = import_styled_components96.css`
13596
13624
  }
13597
13625
  }
13598
13626
  `;
13599
- var breadcrumbsStyle = import_styled_components96.css`
13627
+ var breadcrumbsStyle = import_styled_components97.css`
13600
13628
  ${spacesStyle};
13601
13629
 
13602
13630
  li {
@@ -13607,11 +13635,11 @@ var breadcrumbsStyle = import_styled_components96.css`
13607
13635
  }
13608
13636
  }
13609
13637
  `;
13610
- var unbulletedStyle = import_styled_components96.css`
13638
+ var unbulletedStyle = import_styled_components97.css`
13611
13639
  list-style: none;
13612
13640
  padding-left: 0;
13613
13641
  `;
13614
- var ListComponent = import_styled_components96.default.ul`
13642
+ var ListComponent = import_styled_components97.default.ul`
13615
13643
  list-style-position: outside;
13616
13644
  margin: 0 0 var(--wui-space-01);
13617
13645
  padding: 0 0 0 var(--wui-space-04);
@@ -13674,13 +13702,13 @@ var List = ({
13674
13702
  ...otherProps
13675
13703
  }) => {
13676
13704
  const listVariant = variant ?? "bullets";
13677
- if ((0, import_type_guards59.isNotNil)(children)) {
13705
+ if ((0, import_type_guards60.isNotNil)(children)) {
13678
13706
  if (Array.isArray(children) && !children.length) {
13679
13707
  return null;
13680
13708
  }
13681
13709
  return renderListComponent(children, listVariant, otherProps);
13682
13710
  }
13683
- if ((0, import_type_guards59.isNotNil)(items)) {
13711
+ if ((0, import_type_guards60.isNotNil)(items)) {
13684
13712
  if (!items.length) {
13685
13713
  return null;
13686
13714
  }