@wistia/ui 0.15.12 → 0.15.13-beta.a8953353.4dacd3e
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 +245 -195
- 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 +96 -46
- 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.
|
|
3
|
+
* @license @wistia/ui v0.15.13-beta.a8953353.4dacd3e
|
|
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,8 +12875,9 @@ 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";
|
|
12880
|
+
import { createPortal } from "react-dom";
|
|
12838
12881
|
|
|
12839
12882
|
// src/components/Menu/Menu.tsx
|
|
12840
12883
|
import {
|
|
@@ -13521,7 +13564,7 @@ var ContextMenu = ({
|
|
|
13521
13564
|
const [isRightClicked, setIsRightClicked] = useState17(false);
|
|
13522
13565
|
const [menuPosition, setMenuPosition] = useState17(position ?? { x: 0, y: 0 });
|
|
13523
13566
|
useEffect16(() => {
|
|
13524
|
-
if (
|
|
13567
|
+
if (isNil16(position)) {
|
|
13525
13568
|
const onContextMenu = (event) => {
|
|
13526
13569
|
event.preventDefault();
|
|
13527
13570
|
setMenuPosition({ x: event.clientX, y: event.clientY });
|
|
@@ -13536,7 +13579,10 @@ var ContextMenu = ({
|
|
|
13536
13579
|
return () => null;
|
|
13537
13580
|
}, [position, triggerRef]);
|
|
13538
13581
|
const isOpen = isNotNil24(position) || isRightClicked;
|
|
13539
|
-
|
|
13582
|
+
if (!isOpen) {
|
|
13583
|
+
return null;
|
|
13584
|
+
}
|
|
13585
|
+
const menu = /* @__PURE__ */ jsx267(
|
|
13540
13586
|
Menu,
|
|
13541
13587
|
{
|
|
13542
13588
|
isOpen,
|
|
@@ -13564,7 +13610,11 @@ var ContextMenu = ({
|
|
|
13564
13610
|
),
|
|
13565
13611
|
children
|
|
13566
13612
|
}
|
|
13567
|
-
)
|
|
13613
|
+
);
|
|
13614
|
+
if (isNotNil24(triggerRef)) {
|
|
13615
|
+
return createPortal(menu, document.body);
|
|
13616
|
+
}
|
|
13617
|
+
return menu;
|
|
13568
13618
|
};
|
|
13569
13619
|
|
|
13570
13620
|
// src/components/DataCards/DataCard.tsx
|
|
@@ -15137,13 +15187,13 @@ import styled72, { css as css37 } from "styled-components";
|
|
|
15137
15187
|
|
|
15138
15188
|
// src/components/List/ListItem.tsx
|
|
15139
15189
|
import styled71 from "styled-components";
|
|
15140
|
-
import { isNil as
|
|
15190
|
+
import { isNil as isNil17 } from "@wistia/type-guards";
|
|
15141
15191
|
import { jsx as jsx289 } from "react/jsx-runtime";
|
|
15142
15192
|
var ListItemComponent = styled71.li`
|
|
15143
15193
|
margin-bottom: var(--wui-space-02);
|
|
15144
15194
|
`;
|
|
15145
15195
|
var ListItem = ({ children }) => {
|
|
15146
|
-
if (
|
|
15196
|
+
if (isNil17(children)) {
|
|
15147
15197
|
return null;
|
|
15148
15198
|
}
|
|
15149
15199
|
return /* @__PURE__ */ jsx289(ListItemComponent, { children });
|
|
@@ -16513,7 +16563,7 @@ ScrollArea.displayName = "ScrollArea_UI";
|
|
|
16513
16563
|
import { forwardRef as forwardRef32 } from "react";
|
|
16514
16564
|
import styled89, { css as css44 } from "styled-components";
|
|
16515
16565
|
import { Root as ToggleGroupRoot2 } from "@radix-ui/react-toggle-group";
|
|
16516
|
-
import { isNil as
|
|
16566
|
+
import { isNil as isNil18 } from "@wistia/type-guards";
|
|
16517
16567
|
|
|
16518
16568
|
// src/components/SegmentedControl/useSelectedItemStyle.tsx
|
|
16519
16569
|
import { createContext as createContext9, useContext as useContext15, useMemo as useMemo16, useState as useState24 } from "react";
|
|
@@ -16621,7 +16671,7 @@ var SegmentedControl = forwardRef32(
|
|
|
16621
16671
|
onSelectedValueChange,
|
|
16622
16672
|
...props
|
|
16623
16673
|
}, ref) => {
|
|
16624
|
-
if (
|
|
16674
|
+
if (isNil18(children)) {
|
|
16625
16675
|
return null;
|
|
16626
16676
|
}
|
|
16627
16677
|
return /* @__PURE__ */ jsx308(
|
|
@@ -17480,7 +17530,7 @@ ThumbnailBadge.displayName = "ThumbnailBadge_UI";
|
|
|
17480
17530
|
// src/components/Thumbnail/Thumbnail.tsx
|
|
17481
17531
|
import { forwardRef as forwardRef37, useState as useState26, useRef as useRef24, useCallback as useCallback20, useMemo as useMemo17 } from "react";
|
|
17482
17532
|
import styled106 from "styled-components";
|
|
17483
|
-
import { isNil as
|
|
17533
|
+
import { isNil as isNil19, isNotNil as isNotNil43, isUndefined as isUndefined7, isEmptyString as isEmptyString2, isString as isString4 } from "@wistia/type-guards";
|
|
17484
17534
|
|
|
17485
17535
|
// src/private/helpers/getBackgroundGradient/getBackgroundGradient.ts
|
|
17486
17536
|
import { isNotNil as isNotNil41 } from "@wistia/type-guards";
|
|
@@ -17785,7 +17835,7 @@ var StyledThumbnail = styled106.div`
|
|
|
17785
17835
|
background-image: ${({ $backgroundUrl }) => isNotNil43($backgroundUrl) ? `url('${$backgroundUrl}')` : void 0};
|
|
17786
17836
|
${({ $backgroundUrl, $gradientBackground }) => (
|
|
17787
17837
|
// if we don't have $backgroundUrl show a gradient
|
|
17788
|
-
|
|
17838
|
+
isNil19($backgroundUrl) ? getBackgroundGradient($gradientBackground) : void 0
|
|
17789
17839
|
)};
|
|
17790
17840
|
background-position: center center;
|
|
17791
17841
|
background-size: cover;
|
|
@@ -17817,7 +17867,7 @@ var StoryboardRenderer = ({
|
|
|
17817
17867
|
frameCount,
|
|
17818
17868
|
aspectRatio
|
|
17819
17869
|
} = storyboard;
|
|
17820
|
-
const targetWidth =
|
|
17870
|
+
const targetWidth = isString4(width) ? parseInt(width, 10) : Number(width);
|
|
17821
17871
|
const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
|
|
17822
17872
|
return /* @__PURE__ */ jsx325(
|
|
17823
17873
|
ThumbnailStoryboardViewer,
|
|
@@ -17894,7 +17944,7 @@ var Thumbnail = forwardRef37(
|
|
|
17894
17944
|
setCursorPosition(null);
|
|
17895
17945
|
}, [isScrubbable]);
|
|
17896
17946
|
const shouldRenderStoryboard = useMemo17(() => {
|
|
17897
|
-
if (
|
|
17947
|
+
if (isNil19(storyboard) || isUndefined7(height) || isEmptyString2(height)) {
|
|
17898
17948
|
return false;
|
|
17899
17949
|
}
|
|
17900
17950
|
return isScrubbable && isMouseOver && isStoryboardReady;
|