@wistia/ui 0.15.12-beta.bbcd8471.64c2d83 → 0.15.12-beta.e10a1dcd.8034c36
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 +237 -203
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.mjs +88 -54
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1814,6 +1814,11 @@ type TextProps = ComponentPropsWithoutRef<'div'> & {
|
|
|
1814
1814
|
* Display the text as inline content
|
|
1815
1815
|
*/
|
|
1816
1816
|
inline?: boolean;
|
|
1817
|
+
/**
|
|
1818
|
+
* Maximum number of characters to display before truncating. Must be >= 1.
|
|
1819
|
+
* When truncated, an ellipsis (...) will be added to the end.
|
|
1820
|
+
*/
|
|
1821
|
+
maxChars?: number;
|
|
1817
1822
|
/**
|
|
1818
1823
|
* Prevents text from being highlighted and copied
|
|
1819
1824
|
*/
|
|
@@ -1907,6 +1912,11 @@ type HeadingProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT> & {
|
|
|
1907
1912
|
* Display the text as inline content
|
|
1908
1913
|
*/
|
|
1909
1914
|
inline?: boolean;
|
|
1915
|
+
/**
|
|
1916
|
+
* Maximum number of characters to display before truncating. Must be >= 1.
|
|
1917
|
+
* When truncated, an ellipsis (...) will be added to the end.
|
|
1918
|
+
*/
|
|
1919
|
+
maxChars?: number;
|
|
1910
1920
|
/**
|
|
1911
1921
|
* Text prominence affects color. Use 'primary' for main non-interactive text, 'secondary' for supporting text, and 'button' in specific cases where text is used in an interactive component.
|
|
1912
1922
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1814,6 +1814,11 @@ type TextProps = ComponentPropsWithoutRef<'div'> & {
|
|
|
1814
1814
|
* Display the text as inline content
|
|
1815
1815
|
*/
|
|
1816
1816
|
inline?: boolean;
|
|
1817
|
+
/**
|
|
1818
|
+
* Maximum number of characters to display before truncating. Must be >= 1.
|
|
1819
|
+
* When truncated, an ellipsis (...) will be added to the end.
|
|
1820
|
+
*/
|
|
1821
|
+
maxChars?: number;
|
|
1817
1822
|
/**
|
|
1818
1823
|
* Prevents text from being highlighted and copied
|
|
1819
1824
|
*/
|
|
@@ -1907,6 +1912,11 @@ type HeadingProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT> & {
|
|
|
1907
1912
|
* Display the text as inline content
|
|
1908
1913
|
*/
|
|
1909
1914
|
inline?: boolean;
|
|
1915
|
+
/**
|
|
1916
|
+
* Maximum number of characters to display before truncating. Must be >= 1.
|
|
1917
|
+
* When truncated, an ellipsis (...) will be added to the end.
|
|
1918
|
+
*/
|
|
1919
|
+
maxChars?: number;
|
|
1910
1920
|
/**
|
|
1911
1921
|
* Text prominence affects color. Use 'primary' for main non-interactive text, 'secondary' for supporting text, and 'button' in specific cases where text is used in an interactive component.
|
|
1912
1922
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.15.12-beta.
|
|
3
|
+
* @license @wistia/ui v0.15.12-beta.e10a1dcd.8034c36
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -8307,7 +8307,7 @@ Badge.displayName = "Badge_UI";
|
|
|
8307
8307
|
// src/components/Banner/Banner.tsx
|
|
8308
8308
|
import { useEffect as useEffect8, useState as useState10, useMemo as useMemo5 } from "react";
|
|
8309
8309
|
import styled16 from "styled-components";
|
|
8310
|
-
import { isNil as
|
|
8310
|
+
import { isNil as isNil11, isNotNil as isNotNil13 } from "@wistia/type-guards";
|
|
8311
8311
|
|
|
8312
8312
|
// src/components/Box/Box.tsx
|
|
8313
8313
|
import { forwardRef as forwardRef5 } from "react";
|
|
@@ -8510,6 +8510,38 @@ var Box = makePolymorphic(BoxComponent);
|
|
|
8510
8510
|
import { forwardRef as forwardRef6 } from "react";
|
|
8511
8511
|
import styled12, { css as css21 } from "styled-components";
|
|
8512
8512
|
import { isNotNil as isNotNil11 } from "@wistia/type-guards";
|
|
8513
|
+
|
|
8514
|
+
// src/private/helpers/applyMaxCharsToChildren/applyMaxCharsToChildren.ts
|
|
8515
|
+
import { isString as isString2, isNumber, isNil as isNil9 } from "@wistia/type-guards";
|
|
8516
|
+
|
|
8517
|
+
// src/private/helpers/truncateString/truncateString.ts
|
|
8518
|
+
var truncateString = (text, maxChars) => {
|
|
8519
|
+
if (maxChars < 1) {
|
|
8520
|
+
throw new Error("maxChars must be >= 1");
|
|
8521
|
+
}
|
|
8522
|
+
if (text.length <= maxChars) {
|
|
8523
|
+
return text;
|
|
8524
|
+
}
|
|
8525
|
+
return text.slice(0, maxChars);
|
|
8526
|
+
};
|
|
8527
|
+
|
|
8528
|
+
// src/private/helpers/applyMaxCharsToChildren/applyMaxCharsToChildren.ts
|
|
8529
|
+
var applyMaxCharsToChildren = (children, maxChars) => {
|
|
8530
|
+
if (isNil9(maxChars)) {
|
|
8531
|
+
return children;
|
|
8532
|
+
}
|
|
8533
|
+
if (isString2(children)) {
|
|
8534
|
+
return truncateString(children, maxChars);
|
|
8535
|
+
}
|
|
8536
|
+
if (isNumber(children)) {
|
|
8537
|
+
const numberString = String(children);
|
|
8538
|
+
return truncateString(numberString, maxChars);
|
|
8539
|
+
}
|
|
8540
|
+
const textContent = typeof children === "object" ? JSON.stringify(children) : String(children);
|
|
8541
|
+
return truncateString(textContent, maxChars);
|
|
8542
|
+
};
|
|
8543
|
+
|
|
8544
|
+
// src/components/Heading/Heading.tsx
|
|
8513
8545
|
import { jsx as jsx207 } from "react/jsx-runtime";
|
|
8514
8546
|
var heroStyle = css21`
|
|
8515
8547
|
--font-family: var(--wui-typography-heading-hero-family);
|
|
@@ -8618,31 +8650,37 @@ var variantElementMap = {
|
|
|
8618
8650
|
var HeadingComponent = forwardRef6(
|
|
8619
8651
|
({
|
|
8620
8652
|
align = "left",
|
|
8653
|
+
children,
|
|
8621
8654
|
colorScheme = "inherit",
|
|
8622
8655
|
disabled = false,
|
|
8623
8656
|
inline = false,
|
|
8657
|
+
maxChars,
|
|
8624
8658
|
preventUserSelect = false,
|
|
8625
8659
|
prominence = "primary",
|
|
8626
8660
|
truncate,
|
|
8627
8661
|
variant = "heading1",
|
|
8628
8662
|
renderAs,
|
|
8629
8663
|
...props
|
|
8630
|
-
}, ref) =>
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8664
|
+
}, ref) => {
|
|
8665
|
+
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
8666
|
+
return /* @__PURE__ */ jsx207(
|
|
8667
|
+
StyledHeading,
|
|
8668
|
+
{
|
|
8669
|
+
ref,
|
|
8670
|
+
$align: align,
|
|
8671
|
+
$colorScheme: colorScheme,
|
|
8672
|
+
$disabled: disabled,
|
|
8673
|
+
$inline: inline,
|
|
8674
|
+
$preventUserSelect: preventUserSelect,
|
|
8675
|
+
$prominence: prominence,
|
|
8676
|
+
$truncate: truncate,
|
|
8677
|
+
$variant: variant,
|
|
8678
|
+
as: renderAs ?? variantElementMap[variant] ?? DEFAULT_ELEMENT2,
|
|
8679
|
+
...props,
|
|
8680
|
+
children: processedChildren
|
|
8681
|
+
}
|
|
8682
|
+
);
|
|
8683
|
+
}
|
|
8646
8684
|
);
|
|
8647
8685
|
HeadingComponent.displayName = "Heading_UI";
|
|
8648
8686
|
var Heading = makePolymorphic(HeadingComponent);
|
|
@@ -8835,9 +8873,11 @@ var StyledText = styled13.div`
|
|
|
8835
8873
|
var TextComponent = forwardRef7(
|
|
8836
8874
|
({
|
|
8837
8875
|
align = "left",
|
|
8876
|
+
children,
|
|
8838
8877
|
colorScheme = "inherit",
|
|
8839
8878
|
disabled = false,
|
|
8840
8879
|
inline = false,
|
|
8880
|
+
maxChars,
|
|
8841
8881
|
preventUserSelect = false,
|
|
8842
8882
|
prominence = "primary",
|
|
8843
8883
|
truncate,
|
|
@@ -8845,6 +8885,7 @@ var TextComponent = forwardRef7(
|
|
|
8845
8885
|
renderAs,
|
|
8846
8886
|
...props
|
|
8847
8887
|
}, ref) => {
|
|
8888
|
+
const processedChildren = applyMaxCharsToChildren(children, maxChars);
|
|
8848
8889
|
return /* @__PURE__ */ jsx208(
|
|
8849
8890
|
StyledText,
|
|
8850
8891
|
{
|
|
@@ -8858,7 +8899,8 @@ var TextComponent = forwardRef7(
|
|
|
8858
8899
|
$truncate: truncate,
|
|
8859
8900
|
$variant: variant,
|
|
8860
8901
|
as: renderAs ?? variantElementMap2[variant] ?? DEFAULT_ELEMENT3,
|
|
8861
|
-
...props
|
|
8902
|
+
...props,
|
|
8903
|
+
children: processedChildren
|
|
8862
8904
|
}
|
|
8863
8905
|
);
|
|
8864
8906
|
}
|
|
@@ -8868,7 +8910,7 @@ var Text = makePolymorphic(TextComponent);
|
|
|
8868
8910
|
|
|
8869
8911
|
// src/components/ButtonGroup/ButtonGroup.tsx
|
|
8870
8912
|
import styled14, { css as css23 } from "styled-components";
|
|
8871
|
-
import { isNil as
|
|
8913
|
+
import { isNil as isNil10 } from "@wistia/type-guards";
|
|
8872
8914
|
import { jsx as jsx209 } from "react/jsx-runtime";
|
|
8873
8915
|
var getAlignment = (align) => {
|
|
8874
8916
|
if (align === "center") {
|
|
@@ -8928,7 +8970,7 @@ var ButtonGroup = ({
|
|
|
8928
8970
|
...props
|
|
8929
8971
|
}) => {
|
|
8930
8972
|
const responsiveButtonSize = useResponsiveProp(buttonSize);
|
|
8931
|
-
if (
|
|
8973
|
+
if (isNil10(children)) {
|
|
8932
8974
|
return null;
|
|
8933
8975
|
}
|
|
8934
8976
|
return /* @__PURE__ */ jsx209(
|
|
@@ -9048,7 +9090,7 @@ var Banner = ({
|
|
|
9048
9090
|
const hasImage = isNotNil13(image);
|
|
9049
9091
|
const shouldShowImage = hasImage && (isVerticalLayout || width >= MIN_IMAGE_WIDTH);
|
|
9050
9092
|
const iconPosition = useMemo5(() => {
|
|
9051
|
-
if (
|
|
9093
|
+
if (isNil11(icon)) return "none";
|
|
9052
9094
|
if (isSmallContainer) return shouldShowImage ? "inline" : "above";
|
|
9053
9095
|
return prominence === "secondary" ? "inline" : "above";
|
|
9054
9096
|
}, [icon, isSmallContainer, shouldShowImage, prominence]);
|
|
@@ -9324,7 +9366,7 @@ import { forwardRef as forwardRef12, useId as useId2 } from "react";
|
|
|
9324
9366
|
import styled27, { css as css26 } from "styled-components";
|
|
9325
9367
|
|
|
9326
9368
|
// src/private/components/FormControlLabel/FormControlLabel.tsx
|
|
9327
|
-
import { isNil as
|
|
9369
|
+
import { isNil as isNil13, isNotNil as isNotNil15 } from "@wistia/type-guards";
|
|
9328
9370
|
import styled23, { css as css25 } from "styled-components";
|
|
9329
9371
|
|
|
9330
9372
|
// src/components/ScreenReaderOnly/ScreenReaderOnly.tsx
|
|
@@ -9351,7 +9393,7 @@ ScreenReaderOnly.displayName = "ScreenReaderOnly_UI";
|
|
|
9351
9393
|
|
|
9352
9394
|
// src/private/components/FormControlLabel/FormControlLabelDescription.tsx
|
|
9353
9395
|
import styled22, { css as css24 } from "styled-components";
|
|
9354
|
-
import { isNil as
|
|
9396
|
+
import { isNil as isNil12 } from "@wistia/type-guards";
|
|
9355
9397
|
import { jsx as jsx217 } from "react/jsx-runtime";
|
|
9356
9398
|
var disabledStyle = css24`
|
|
9357
9399
|
color: var(--wui-color-text-disabled);
|
|
@@ -9370,7 +9412,7 @@ var FormControlLabelDescription = ({
|
|
|
9370
9412
|
disabled = false,
|
|
9371
9413
|
...props
|
|
9372
9414
|
}) => {
|
|
9373
|
-
if (
|
|
9415
|
+
if (isNil12(children)) {
|
|
9374
9416
|
return null;
|
|
9375
9417
|
}
|
|
9376
9418
|
return /* @__PURE__ */ jsx217(
|
|
@@ -9418,7 +9460,7 @@ var FormControlLabel = ({
|
|
|
9418
9460
|
hideLabel = false,
|
|
9419
9461
|
...props
|
|
9420
9462
|
}) => {
|
|
9421
|
-
if (
|
|
9463
|
+
if (isNil13(label)) {
|
|
9422
9464
|
return null;
|
|
9423
9465
|
}
|
|
9424
9466
|
const labelContent = hideLabel ? /* @__PURE__ */ jsx218(ScreenReaderOnly, { children: label }) : /* @__PURE__ */ jsxs16(StyledLabelWrapper, { children: [
|
|
@@ -11487,7 +11529,7 @@ import { parseHex as parseHex2 } from "culori/fn";
|
|
|
11487
11529
|
// src/components/Input/Input.tsx
|
|
11488
11530
|
import { isValidElement as isValidElement2, forwardRef as forwardRef15, cloneElement as cloneElement4, useRef as useRef9 } from "react";
|
|
11489
11531
|
import styled44, { css as css30 } from "styled-components";
|
|
11490
|
-
import { isNil as
|
|
11532
|
+
import { isNil as isNil14, isNotNil as isNotNil18, isRecord as isRecord4 } from "@wistia/type-guards";
|
|
11491
11533
|
|
|
11492
11534
|
// src/css/inputCss.ts
|
|
11493
11535
|
import { css as css29 } from "styled-components";
|
|
@@ -11638,7 +11680,7 @@ var Input = forwardRef15(
|
|
|
11638
11680
|
const internalRef = useRef9(null);
|
|
11639
11681
|
const ref = isNotNil18(externalRef) && isRecord4(externalRef) && "current" in externalRef ? externalRef : internalRef;
|
|
11640
11682
|
let leftIconToDisplay = leftIcon;
|
|
11641
|
-
if (
|
|
11683
|
+
if (isNil14(leftIcon) && type === "search") {
|
|
11642
11684
|
leftIconToDisplay = /* @__PURE__ */ jsx249(Icon, { type: "search" });
|
|
11643
11685
|
}
|
|
11644
11686
|
if (isNotNil18(leftIconToDisplay) && isValidElement2(leftIconToDisplay)) {
|
|
@@ -12386,12 +12428,12 @@ import {
|
|
|
12386
12428
|
} from "react";
|
|
12387
12429
|
import { matchSorter } from "match-sorter";
|
|
12388
12430
|
import styled50 from "styled-components";
|
|
12389
|
-
import { isArray as isArray2, isString as
|
|
12431
|
+
import { isArray as isArray2, isString as isString3 } from "@wistia/type-guards";
|
|
12390
12432
|
|
|
12391
12433
|
// src/components/Tag/Tag.tsx
|
|
12392
12434
|
import { forwardRef as forwardRef16 } from "react";
|
|
12393
12435
|
import styled49 from "styled-components";
|
|
12394
|
-
import { isNil as
|
|
12436
|
+
import { isNil as isNil15, isNotNil as isNotNil19, isNonEmptyString as isNonEmptyString5 } from "@wistia/type-guards";
|
|
12395
12437
|
import { Fragment as Fragment7, jsx as jsx255, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
12396
12438
|
var TagLabel = styled49.a`
|
|
12397
12439
|
${({ $colorScheme }) => getColorScheme($colorScheme)};
|
|
@@ -12477,10 +12519,10 @@ var StyledTag = styled49.div`
|
|
|
12477
12519
|
}
|
|
12478
12520
|
`;
|
|
12479
12521
|
var RemoveButton = ({ onClickRemove, onClickRemoveLabel, colorScheme }) => {
|
|
12480
|
-
if (
|
|
12522
|
+
if (isNil15(onClickRemove)) {
|
|
12481
12523
|
return null;
|
|
12482
12524
|
}
|
|
12483
|
-
if (
|
|
12525
|
+
if (isNil15(onClickRemoveLabel)) {
|
|
12484
12526
|
throw new Error(
|
|
12485
12527
|
"for accessibility, onClickRemoveLabel must be provided if onClickRemove is provided"
|
|
12486
12528
|
);
|
|
@@ -12750,11 +12792,11 @@ var Combobox2 = ({
|
|
|
12750
12792
|
return () => null;
|
|
12751
12793
|
}, []);
|
|
12752
12794
|
const handleRemoveValue = (valueToRemove) => {
|
|
12753
|
-
if (
|
|
12795
|
+
if (isString3(value)) {
|
|
12754
12796
|
onChange("");
|
|
12755
12797
|
return;
|
|
12756
12798
|
}
|
|
12757
|
-
onChange(
|
|
12799
|
+
onChange(isString3(value) ? "" : value.filter((val) => val !== valueToRemove));
|
|
12758
12800
|
};
|
|
12759
12801
|
const matches = useMemo11(() => {
|
|
12760
12802
|
return matchSorter(Object.keys(options), searchValue);
|
|
@@ -12833,9 +12875,8 @@ var Combobox2 = ({
|
|
|
12833
12875
|
};
|
|
12834
12876
|
|
|
12835
12877
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
12836
|
-
import { isNil as
|
|
12878
|
+
import { isNil as isNil16, isNotNil as isNotNil24 } from "@wistia/type-guards";
|
|
12837
12879
|
import { useEffect as useEffect16, useState as useState17 } from "react";
|
|
12838
|
-
import { createPortal } from "react-dom";
|
|
12839
12880
|
|
|
12840
12881
|
// src/components/Menu/Menu.tsx
|
|
12841
12882
|
import {
|
|
@@ -13522,7 +13563,7 @@ var ContextMenu = ({
|
|
|
13522
13563
|
const [isRightClicked, setIsRightClicked] = useState17(false);
|
|
13523
13564
|
const [menuPosition, setMenuPosition] = useState17(position ?? { x: 0, y: 0 });
|
|
13524
13565
|
useEffect16(() => {
|
|
13525
|
-
if (
|
|
13566
|
+
if (isNil16(position)) {
|
|
13526
13567
|
const onContextMenu = (event) => {
|
|
13527
13568
|
event.preventDefault();
|
|
13528
13569
|
setMenuPosition({ x: event.clientX, y: event.clientY });
|
|
@@ -13537,10 +13578,7 @@ var ContextMenu = ({
|
|
|
13537
13578
|
return () => null;
|
|
13538
13579
|
}, [position, triggerRef]);
|
|
13539
13580
|
const isOpen = isNotNil24(position) || isRightClicked;
|
|
13540
|
-
|
|
13541
|
-
return null;
|
|
13542
|
-
}
|
|
13543
|
-
const menu = /* @__PURE__ */ jsx267(
|
|
13581
|
+
return isOpen ? /* @__PURE__ */ jsx267(
|
|
13544
13582
|
Menu,
|
|
13545
13583
|
{
|
|
13546
13584
|
isOpen,
|
|
@@ -13568,11 +13606,7 @@ var ContextMenu = ({
|
|
|
13568
13606
|
),
|
|
13569
13607
|
children
|
|
13570
13608
|
}
|
|
13571
|
-
);
|
|
13572
|
-
if (isNotNil24(triggerRef)) {
|
|
13573
|
-
return createPortal(menu, document.body);
|
|
13574
|
-
}
|
|
13575
|
-
return menu;
|
|
13609
|
+
) : null;
|
|
13576
13610
|
};
|
|
13577
13611
|
|
|
13578
13612
|
// src/components/DataCards/DataCard.tsx
|
|
@@ -15145,13 +15179,13 @@ import styled72, { css as css37 } from "styled-components";
|
|
|
15145
15179
|
|
|
15146
15180
|
// src/components/List/ListItem.tsx
|
|
15147
15181
|
import styled71 from "styled-components";
|
|
15148
|
-
import { isNil as
|
|
15182
|
+
import { isNil as isNil17 } from "@wistia/type-guards";
|
|
15149
15183
|
import { jsx as jsx289 } from "react/jsx-runtime";
|
|
15150
15184
|
var ListItemComponent = styled71.li`
|
|
15151
15185
|
margin-bottom: var(--wui-space-02);
|
|
15152
15186
|
`;
|
|
15153
15187
|
var ListItem = ({ children }) => {
|
|
15154
|
-
if (
|
|
15188
|
+
if (isNil17(children)) {
|
|
15155
15189
|
return null;
|
|
15156
15190
|
}
|
|
15157
15191
|
return /* @__PURE__ */ jsx289(ListItemComponent, { children });
|
|
@@ -16521,7 +16555,7 @@ ScrollArea.displayName = "ScrollArea_UI";
|
|
|
16521
16555
|
import { forwardRef as forwardRef32 } from "react";
|
|
16522
16556
|
import styled89, { css as css44 } from "styled-components";
|
|
16523
16557
|
import { Root as ToggleGroupRoot2 } from "@radix-ui/react-toggle-group";
|
|
16524
|
-
import { isNil as
|
|
16558
|
+
import { isNil as isNil18 } from "@wistia/type-guards";
|
|
16525
16559
|
|
|
16526
16560
|
// src/components/SegmentedControl/useSelectedItemStyle.tsx
|
|
16527
16561
|
import { createContext as createContext9, useContext as useContext15, useMemo as useMemo16, useState as useState24 } from "react";
|
|
@@ -16629,7 +16663,7 @@ var SegmentedControl = forwardRef32(
|
|
|
16629
16663
|
onSelectedValueChange,
|
|
16630
16664
|
...props
|
|
16631
16665
|
}, ref) => {
|
|
16632
|
-
if (
|
|
16666
|
+
if (isNil18(children)) {
|
|
16633
16667
|
return null;
|
|
16634
16668
|
}
|
|
16635
16669
|
return /* @__PURE__ */ jsx308(
|
|
@@ -17488,7 +17522,7 @@ ThumbnailBadge.displayName = "ThumbnailBadge_UI";
|
|
|
17488
17522
|
// src/components/Thumbnail/Thumbnail.tsx
|
|
17489
17523
|
import { forwardRef as forwardRef37, useState as useState26, useRef as useRef24, useCallback as useCallback20, useMemo as useMemo17 } from "react";
|
|
17490
17524
|
import styled106 from "styled-components";
|
|
17491
|
-
import { isNil as
|
|
17525
|
+
import { isNil as isNil19, isNotNil as isNotNil43, isUndefined as isUndefined7, isEmptyString as isEmptyString2, isString as isString4 } from "@wistia/type-guards";
|
|
17492
17526
|
|
|
17493
17527
|
// src/private/helpers/getBackgroundGradient/getBackgroundGradient.ts
|
|
17494
17528
|
import { isNotNil as isNotNil41 } from "@wistia/type-guards";
|
|
@@ -17793,7 +17827,7 @@ var StyledThumbnail = styled106.div`
|
|
|
17793
17827
|
background-image: ${({ $backgroundUrl }) => isNotNil43($backgroundUrl) ? `url('${$backgroundUrl}')` : void 0};
|
|
17794
17828
|
${({ $backgroundUrl, $gradientBackground }) => (
|
|
17795
17829
|
// if we don't have $backgroundUrl show a gradient
|
|
17796
|
-
|
|
17830
|
+
isNil19($backgroundUrl) ? getBackgroundGradient($gradientBackground) : void 0
|
|
17797
17831
|
)};
|
|
17798
17832
|
background-position: center center;
|
|
17799
17833
|
background-size: cover;
|
|
@@ -17825,7 +17859,7 @@ var StoryboardRenderer = ({
|
|
|
17825
17859
|
frameCount,
|
|
17826
17860
|
aspectRatio
|
|
17827
17861
|
} = storyboard;
|
|
17828
|
-
const targetWidth =
|
|
17862
|
+
const targetWidth = isString4(width) ? parseInt(width, 10) : Number(width);
|
|
17829
17863
|
const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
|
|
17830
17864
|
return /* @__PURE__ */ jsx325(
|
|
17831
17865
|
ThumbnailStoryboardViewer,
|
|
@@ -17902,7 +17936,7 @@ var Thumbnail = forwardRef37(
|
|
|
17902
17936
|
setCursorPosition(null);
|
|
17903
17937
|
}, [isScrubbable]);
|
|
17904
17938
|
const shouldRenderStoryboard = useMemo17(() => {
|
|
17905
|
-
if (
|
|
17939
|
+
if (isNil19(storyboard) || isUndefined7(height) || isEmptyString2(height)) {
|
|
17906
17940
|
return false;
|
|
17907
17941
|
}
|
|
17908
17942
|
return isScrubbable && isMouseOver && isStoryboardReady;
|