@wistia/ui 0.20.14 → 0.20.15
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.ts +5 -1
- package/dist/index.js +104 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -158,7 +158,11 @@ type UseKeyOptions = {
|
|
|
158
158
|
declare const useKey: (key: KeyFilter, eventHandler: EventHandler, { eventName, eventTarget, eventOptions }?: UseKeyOptions) => void;
|
|
159
159
|
|
|
160
160
|
type KeyPressState = [boolean, KeyboardEvent | null];
|
|
161
|
-
|
|
161
|
+
type UseKeyPressOptions = {
|
|
162
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
163
|
+
onKeyUp?: (event: KeyboardEvent) => void;
|
|
164
|
+
};
|
|
165
|
+
declare const useKeyPress: (keyFilter: Parameters<typeof useKey>[0], options?: UseKeyPressOptions) => KeyPressState;
|
|
162
166
|
|
|
163
167
|
type SetItemType = Storage['setItem'];
|
|
164
168
|
declare const useLocalStorage: <T, _>(key: Parameters<SetItemType>[0], initialValue: T, storage?: Storage) => [T | undefined, (newValue: T) => void, () => void];
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.20.
|
|
3
|
+
* @license @wistia/ui v0.20.15
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -2934,11 +2934,42 @@ var useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOpti
|
|
|
2934
2934
|
|
|
2935
2935
|
// src/hooks/useKeyPress/useKeyPress.ts
|
|
2936
2936
|
import { useState as useState7 } from "react";
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2937
|
+
|
|
2938
|
+
// src/private/hooks/useUpdateEffect/useUpdateEffect.ts
|
|
2939
|
+
import { useEffect as useEffect5, useRef as useRef6 } from "react";
|
|
2940
|
+
var useUpdateEffect = (effect, dependencies) => {
|
|
2941
|
+
const isFirstMount = useRef6(true);
|
|
2942
|
+
useEffect5(() => {
|
|
2943
|
+
if (isFirstMount.current) {
|
|
2944
|
+
isFirstMount.current = false;
|
|
2945
|
+
return () => {
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
return effect();
|
|
2949
|
+
}, dependencies);
|
|
2950
|
+
};
|
|
2951
|
+
|
|
2952
|
+
// src/hooks/useKeyPress/useKeyPress.ts
|
|
2953
|
+
var useKeyPress = (keyFilter, options) => {
|
|
2954
|
+
const [keyPressState, setKeyPressState] = useState7([false, null]);
|
|
2955
|
+
const { onKeyDown, onKeyUp } = options ?? {};
|
|
2956
|
+
useKey(keyFilter, (event) => setKeyPressState([true, event]), {
|
|
2957
|
+
eventName: "keydown"
|
|
2958
|
+
});
|
|
2959
|
+
useKey(keyFilter, (event) => setKeyPressState([false, event]), {
|
|
2960
|
+
eventName: "keyup"
|
|
2961
|
+
});
|
|
2962
|
+
useUpdateEffect(() => {
|
|
2963
|
+
const [pressed, event] = keyPressState;
|
|
2964
|
+
if (!pressed && onKeyUp && event !== null) {
|
|
2965
|
+
onKeyUp(event);
|
|
2966
|
+
} else if (pressed && onKeyDown && event !== null) {
|
|
2967
|
+
onKeyDown(event);
|
|
2968
|
+
}
|
|
2969
|
+
return () => {
|
|
2970
|
+
};
|
|
2971
|
+
}, [keyPressState[0]]);
|
|
2972
|
+
return keyPressState;
|
|
2942
2973
|
};
|
|
2943
2974
|
|
|
2944
2975
|
// src/hooks/useLocalStorage/useLocalStorage.ts
|
|
@@ -3052,9 +3083,9 @@ var useActiveMq = () => {
|
|
|
3052
3083
|
};
|
|
3053
3084
|
|
|
3054
3085
|
// src/hooks/useOnClickOutside/useOnClickOutside.ts
|
|
3055
|
-
import { useEffect as
|
|
3086
|
+
import { useEffect as useEffect6 } from "react";
|
|
3056
3087
|
var useOnClickOutside = (ref, handler, eventTypes = ["mousedown", "touchend"]) => {
|
|
3057
|
-
|
|
3088
|
+
useEffect6(() => {
|
|
3058
3089
|
const listener = (event) => {
|
|
3059
3090
|
if (!ref.current || ref.current.contains(event.target)) {
|
|
3060
3091
|
return;
|
|
@@ -3081,10 +3112,10 @@ var useOnClickOutside = (ref, handler, eventTypes = ["mousedown", "touchend"]) =
|
|
|
3081
3112
|
};
|
|
3082
3113
|
|
|
3083
3114
|
// src/hooks/usePreviousValue/usePreviousValue.ts
|
|
3084
|
-
import { useEffect as
|
|
3115
|
+
import { useEffect as useEffect7, useRef as useRef7 } from "react";
|
|
3085
3116
|
var usePreviousValue = (value) => {
|
|
3086
|
-
const ref =
|
|
3087
|
-
|
|
3117
|
+
const ref = useRef7(void 0);
|
|
3118
|
+
useEffect7(() => {
|
|
3088
3119
|
ref.current = value;
|
|
3089
3120
|
});
|
|
3090
3121
|
return ref.current;
|
|
@@ -8477,7 +8508,7 @@ var ActionButton = forwardRef3(
|
|
|
8477
8508
|
ActionButton.displayName = "ActionButton_UI";
|
|
8478
8509
|
|
|
8479
8510
|
// src/components/Avatar/Avatar.tsx
|
|
8480
|
-
import { useState as useState10, useMemo as useMemo4, useEffect as
|
|
8511
|
+
import { useState as useState10, useMemo as useMemo4, useEffect as useEffect8 } from "react";
|
|
8481
8512
|
import { isNil as isNil8, isNotNil as isNotNil8 } from "@wistia/type-guards";
|
|
8482
8513
|
import { styled as styled10 } from "styled-components";
|
|
8483
8514
|
|
|
@@ -8691,7 +8722,7 @@ var Avatar = ({
|
|
|
8691
8722
|
...props
|
|
8692
8723
|
}) => {
|
|
8693
8724
|
const [imageLoadState, setImageLoadState] = useState10("loading");
|
|
8694
|
-
|
|
8725
|
+
useEffect8(() => {
|
|
8695
8726
|
setImageLoadState("loading");
|
|
8696
8727
|
}, [imageUrl]);
|
|
8697
8728
|
const handleImageLoad = () => {
|
|
@@ -8782,7 +8813,7 @@ var Badge = forwardRef4(
|
|
|
8782
8813
|
Badge.displayName = "Badge_UI";
|
|
8783
8814
|
|
|
8784
8815
|
// src/components/Banner/Banner.tsx
|
|
8785
|
-
import { useEffect as
|
|
8816
|
+
import { useEffect as useEffect9, useState as useState11, useMemo as useMemo5 } from "react";
|
|
8786
8817
|
import { styled as styled17 } from "styled-components";
|
|
8787
8818
|
import { isNil as isNil11, isNotNil as isNotNil13 } from "@wistia/type-guards";
|
|
8788
8819
|
|
|
@@ -9559,7 +9590,7 @@ var Banner = ({
|
|
|
9559
9590
|
const [contentRef, { height: contentHeight }] = useElementObserver();
|
|
9560
9591
|
const [isSmallContainer, setIsSmallContainer] = useState11(false);
|
|
9561
9592
|
const [isVerticalLayout, setIsVerticalLayout] = useState11(orientation === "vertical");
|
|
9562
|
-
|
|
9593
|
+
useEffect9(() => {
|
|
9563
9594
|
const breakpoint = orientation === "vertical" ? VERTICAL_BREAKPOINT_WIDTH : BREAKPOINT_WIDTH;
|
|
9564
9595
|
setIsSmallContainer(width <= breakpoint);
|
|
9565
9596
|
if (orientation === "auto") {
|
|
@@ -10054,7 +10085,7 @@ import { isArray } from "@wistia/type-guards";
|
|
|
10054
10085
|
|
|
10055
10086
|
// src/components/FormGroup/FormGroup.tsx
|
|
10056
10087
|
import { styled as styled27 } from "styled-components";
|
|
10057
|
-
import { useRef as
|
|
10088
|
+
import { useRef as useRef8 } from "react";
|
|
10058
10089
|
import { isNonEmptyString as isNonEmptyString2, isNotNil as isNotNil16 } from "@wistia/type-guards";
|
|
10059
10090
|
|
|
10060
10091
|
// src/components/Stack/Stack.tsx
|
|
@@ -10122,7 +10153,7 @@ var FormGroup = ({
|
|
|
10122
10153
|
description,
|
|
10123
10154
|
...props
|
|
10124
10155
|
}) => {
|
|
10125
|
-
const ref =
|
|
10156
|
+
const ref = useRef8(null);
|
|
10126
10157
|
const hasLabel = isNotNil16(label) && isNonEmptyString2(label);
|
|
10127
10158
|
const hasDescription = isNotNil16(description) && isNonEmptyString2(description);
|
|
10128
10159
|
return /* @__PURE__ */ jsxs18(
|
|
@@ -10160,7 +10191,7 @@ var FormGroup = ({
|
|
|
10160
10191
|
FormGroup.displayName = "FormGroup_UI";
|
|
10161
10192
|
|
|
10162
10193
|
// src/components/Form/Form.tsx
|
|
10163
|
-
import { forwardRef as forwardRef11, useRef as
|
|
10194
|
+
import { forwardRef as forwardRef11, useRef as useRef9, useMemo as useMemo6, createContext as createContext3, useState as useState12, useId } from "react";
|
|
10164
10195
|
import { styled as styled28 } from "styled-components";
|
|
10165
10196
|
import { isNotUndefined as isNotUndefined6, isUndefined as isUndefined3 } from "@wistia/type-guards";
|
|
10166
10197
|
|
|
@@ -10205,7 +10236,7 @@ var Form = forwardRef11(
|
|
|
10205
10236
|
}, forwardedRef) => {
|
|
10206
10237
|
const [errors, setErrors] = useState12({});
|
|
10207
10238
|
const [hasSubmitted, setHasSubmitted] = useState12(false);
|
|
10208
|
-
const innerRef =
|
|
10239
|
+
const innerRef = useRef9(null);
|
|
10209
10240
|
const ref = forwardedRef ?? innerRef;
|
|
10210
10241
|
const autoId = useId();
|
|
10211
10242
|
const id = props.id ?? autoId;
|
|
@@ -10486,7 +10517,7 @@ var Checkbox = forwardRef12(
|
|
|
10486
10517
|
Checkbox.displayName = "Checkbox_UI";
|
|
10487
10518
|
|
|
10488
10519
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
10489
|
-
import { Children as Children3, cloneElement as cloneElement3, useCallback as useCallback8, useEffect as
|
|
10520
|
+
import { Children as Children3, cloneElement as cloneElement3, useCallback as useCallback8, useEffect as useEffect10 } from "react";
|
|
10490
10521
|
var isClickableElement = (element) => {
|
|
10491
10522
|
if (!element) {
|
|
10492
10523
|
return false;
|
|
@@ -10495,7 +10526,7 @@ var isClickableElement = (element) => {
|
|
|
10495
10526
|
return el.closest("button") !== null || el.closest("a") !== null || el.closest("input") !== null || el.closest("select") !== null || el.closest("textarea") !== null || el.closest("label") !== null || el.closest("[data-wui-faux-input]") !== null;
|
|
10496
10527
|
};
|
|
10497
10528
|
var ClickRegion = ({ children, targetRef }) => {
|
|
10498
|
-
|
|
10529
|
+
useEffect10(() => {
|
|
10499
10530
|
if (targetRef.current?.tagName === "A") {
|
|
10500
10531
|
targetRef.current.setAttribute("data-click-region-target-link", "");
|
|
10501
10532
|
} else if (targetRef.current?.tagName === "BUTTON") {
|
|
@@ -10639,7 +10670,7 @@ import { styled as styled34 } from "styled-components";
|
|
|
10639
10670
|
import { Root as RadioGroupRoot } from "@radix-ui/react-radio-group";
|
|
10640
10671
|
|
|
10641
10672
|
// src/components/ColorPicker/ColorPickerContext.tsx
|
|
10642
|
-
import { createContext as createContext5, useCallback as useCallback9, useContext as useContext4, useEffect as
|
|
10673
|
+
import { createContext as createContext5, useCallback as useCallback9, useContext as useContext4, useEffect as useEffect11, useMemo as useMemo8, useState as useState13 } from "react";
|
|
10643
10674
|
import { formatHex as formatHex2 } from "culori/fn";
|
|
10644
10675
|
|
|
10645
10676
|
// src/components/ColorPicker/color-conversion-utils.ts
|
|
@@ -11121,7 +11152,7 @@ var ColorPickerProvider = ({
|
|
|
11121
11152
|
);
|
|
11122
11153
|
setNonDerivedValueAsHsv(convertToHsv(valueAsHex));
|
|
11123
11154
|
}
|
|
11124
|
-
|
|
11155
|
+
useEffect11(() => {
|
|
11125
11156
|
if (valueAsHex !== valueAsHsvConvertedToHex && !isTransitioning && !isDragging) {
|
|
11126
11157
|
onValueChange(whatValueAsHexShouldBe);
|
|
11127
11158
|
}
|
|
@@ -12107,11 +12138,11 @@ var ContrastControls = () => {
|
|
|
12107
12138
|
ContrastControls.displayName = "ContrastControls_UI";
|
|
12108
12139
|
|
|
12109
12140
|
// src/components/ColorPicker/HexColorInput.tsx
|
|
12110
|
-
import { useCallback as useCallback13, useEffect as
|
|
12141
|
+
import { useCallback as useCallback13, useEffect as useEffect12, useRef as useRef11, useState as useState14 } from "react";
|
|
12111
12142
|
import { parseHex as parseHex2 } from "culori/fn";
|
|
12112
12143
|
|
|
12113
12144
|
// src/components/Input/Input.tsx
|
|
12114
|
-
import { isValidElement as isValidElement2, forwardRef as forwardRef15, cloneElement as cloneElement4, useRef as
|
|
12145
|
+
import { isValidElement as isValidElement2, forwardRef as forwardRef15, cloneElement as cloneElement4, useRef as useRef10 } from "react";
|
|
12115
12146
|
import { styled as styled46, css as css30 } from "styled-components";
|
|
12116
12147
|
import { isNil as isNil14, isNotNil as isNotNil18, isRecord as isRecord4 } from "@wistia/type-guards";
|
|
12117
12148
|
|
|
@@ -12306,7 +12337,7 @@ var Input = forwardRef15(
|
|
|
12306
12337
|
rightIcon,
|
|
12307
12338
|
...props
|
|
12308
12339
|
}, externalRef) => {
|
|
12309
|
-
const internalRef =
|
|
12340
|
+
const internalRef = useRef10(null);
|
|
12310
12341
|
const ref = isNotNil18(externalRef) && isRecord4(externalRef) && "current" in externalRef ? externalRef : internalRef;
|
|
12311
12342
|
let leftIconToDisplay = leftIcon;
|
|
12312
12343
|
if (isNil14(leftIcon) && type === "search") {
|
|
@@ -12385,7 +12416,7 @@ var normalizeHexInput = (input) => {
|
|
|
12385
12416
|
};
|
|
12386
12417
|
var HexColorInput = ({ autoFocus = true }) => {
|
|
12387
12418
|
const { valueAsHex, nonDerivedValueAsHsv, onChangeNonDerivedValueAsHsv } = useColorPickerState();
|
|
12388
|
-
const inputRef =
|
|
12419
|
+
const inputRef = useRef11(null);
|
|
12389
12420
|
const [textInputValue, setTextInputValue] = useState14(valueAsHex);
|
|
12390
12421
|
const onChangeInputValue = useCallback13(
|
|
12391
12422
|
(event) => {
|
|
@@ -12496,7 +12527,7 @@ var HexColorInput = ({ autoFocus = true }) => {
|
|
|
12496
12527
|
}
|
|
12497
12528
|
selectAllButTheHash();
|
|
12498
12529
|
}, [selectAllButTheHash]);
|
|
12499
|
-
|
|
12530
|
+
useEffect12(() => {
|
|
12500
12531
|
if (!autoFocus) {
|
|
12501
12532
|
return;
|
|
12502
12533
|
}
|
|
@@ -12507,7 +12538,7 @@ var HexColorInput = ({ autoFocus = true }) => {
|
|
|
12507
12538
|
inputElem.focus();
|
|
12508
12539
|
selectAllButTheHash();
|
|
12509
12540
|
}, [autoFocus, selectAllButTheHash]);
|
|
12510
|
-
|
|
12541
|
+
useEffect12(() => {
|
|
12511
12542
|
setTextInputValue(valueAsHex);
|
|
12512
12543
|
}, [valueAsHex]);
|
|
12513
12544
|
return /* @__PURE__ */ jsx271(
|
|
@@ -12543,7 +12574,7 @@ import { styled as styled48 } from "styled-components";
|
|
|
12543
12574
|
import { formatHex as formatHex6 } from "culori/fn";
|
|
12544
12575
|
|
|
12545
12576
|
// src/components/ColorPicker/HSVHueCanvas.tsx
|
|
12546
|
-
import { useEffect as
|
|
12577
|
+
import { useEffect as useEffect13, useRef as useRef12 } from "react";
|
|
12547
12578
|
import { styled as styled47 } from "styled-components";
|
|
12548
12579
|
import { formatHex as formatHex5 } from "culori/fn";
|
|
12549
12580
|
import { jsx as jsx272 } from "react/jsx-runtime";
|
|
@@ -12553,8 +12584,8 @@ var Canvas = styled47.canvas`
|
|
|
12553
12584
|
width: 100%;
|
|
12554
12585
|
`;
|
|
12555
12586
|
var HSVHueCanvas = ({ hsv }) => {
|
|
12556
|
-
const canvasRef =
|
|
12557
|
-
|
|
12587
|
+
const canvasRef = useRef12(null);
|
|
12588
|
+
useEffect13(() => {
|
|
12558
12589
|
const canvas = canvasRef.current;
|
|
12559
12590
|
if (!canvas) {
|
|
12560
12591
|
return;
|
|
@@ -12676,11 +12707,11 @@ var HueSlider = () => {
|
|
|
12676
12707
|
HueSlider.displayName = "HueSlider_UI";
|
|
12677
12708
|
|
|
12678
12709
|
// src/components/ColorPicker/SaturationAndValuePicker.tsx
|
|
12679
|
-
import { useCallback as useCallback15, useEffect as
|
|
12710
|
+
import { useCallback as useCallback15, useEffect as useEffect15, useLayoutEffect as useLayoutEffect4, useMemo as useMemo10, useRef as useRef14, useState as useState15 } from "react";
|
|
12680
12711
|
import { styled as styled50 } from "styled-components";
|
|
12681
12712
|
|
|
12682
12713
|
// src/components/ColorPicker/HSVSaturationValueCanvas.tsx
|
|
12683
|
-
import { useEffect as
|
|
12714
|
+
import { useEffect as useEffect14, useRef as useRef13 } from "react";
|
|
12684
12715
|
import { styled as styled49 } from "styled-components";
|
|
12685
12716
|
|
|
12686
12717
|
// src/components/ColorPicker/canvas-utils.ts
|
|
@@ -12770,8 +12801,8 @@ var HSVSaturationValueCanvas = ({
|
|
|
12770
12801
|
colorForComparison,
|
|
12771
12802
|
opacityForContrastCalculation
|
|
12772
12803
|
}) => {
|
|
12773
|
-
const canvasRef =
|
|
12774
|
-
|
|
12804
|
+
const canvasRef = useRef13(null);
|
|
12805
|
+
useEffect14(() => {
|
|
12775
12806
|
const canvas = canvasRef.current;
|
|
12776
12807
|
if (!canvas) {
|
|
12777
12808
|
return;
|
|
@@ -12874,8 +12905,8 @@ var SaturationAndValuePicker = ({
|
|
|
12874
12905
|
valueAsHex,
|
|
12875
12906
|
valueAsHsv
|
|
12876
12907
|
} = useColorPickerState();
|
|
12877
|
-
const containerRef =
|
|
12878
|
-
const thumbRef =
|
|
12908
|
+
const containerRef = useRef14(null);
|
|
12909
|
+
const thumbRef = useRef14(null);
|
|
12879
12910
|
const uuid = useMemo10(() => crypto.randomUUID(), []);
|
|
12880
12911
|
const instructionsId = `sv-instructions-${uuid}`;
|
|
12881
12912
|
const valueAsHexConvertedToHsv = convertToHsv(valueAsHex);
|
|
@@ -12989,7 +13020,7 @@ var SaturationAndValuePicker = ({
|
|
|
12989
13020
|
[isDragging, updateSaturationAndValueFromCoordinates]
|
|
12990
13021
|
);
|
|
12991
13022
|
const onWindowMouseUp = useCallback15(() => setIsDragging(false), [setIsDragging]);
|
|
12992
|
-
|
|
13023
|
+
useEffect15(() => {
|
|
12993
13024
|
window.addEventListener("mousemove", onWindowMouseMove);
|
|
12994
13025
|
window.addEventListener("mouseup", onWindowMouseUp);
|
|
12995
13026
|
return () => {
|
|
@@ -13052,10 +13083,10 @@ SaturationAndValuePicker.displayName = "SaturationAndValuePicker_UI";
|
|
|
13052
13083
|
import * as Ariakit from "@ariakit/react";
|
|
13053
13084
|
import {
|
|
13054
13085
|
useMemo as useMemo11,
|
|
13055
|
-
useRef as
|
|
13086
|
+
useRef as useRef15,
|
|
13056
13087
|
useState as useState16,
|
|
13057
13088
|
useTransition,
|
|
13058
|
-
useEffect as
|
|
13089
|
+
useEffect as useEffect16,
|
|
13059
13090
|
Children as Children5,
|
|
13060
13091
|
isValidElement as isValidElement3
|
|
13061
13092
|
} from "react";
|
|
@@ -13406,10 +13437,10 @@ var Combobox2 = ({
|
|
|
13406
13437
|
const [isOpen, setIsOpen] = useState16(false);
|
|
13407
13438
|
const [isPending, startTransition] = useTransition();
|
|
13408
13439
|
const [wrapperWidth, setWrapperWidth] = useState16("auto");
|
|
13409
|
-
const comboboxWrapperRef =
|
|
13440
|
+
const comboboxWrapperRef = useRef15(null);
|
|
13410
13441
|
const options = useMemo11(() => extractOptions(children), [children]);
|
|
13411
13442
|
const isMultiSelect = isArray2(value);
|
|
13412
|
-
|
|
13443
|
+
useEffect16(() => {
|
|
13413
13444
|
const comboboxWrapper = comboboxWrapperRef.current;
|
|
13414
13445
|
if (comboboxWrapper) {
|
|
13415
13446
|
const updateWidthVariable = () => {
|
|
@@ -13509,7 +13540,7 @@ var Combobox2 = ({
|
|
|
13509
13540
|
|
|
13510
13541
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
13511
13542
|
import { isNil as isNil16, isNotNil as isNotNil24 } from "@wistia/type-guards";
|
|
13512
|
-
import { useEffect as
|
|
13543
|
+
import { useEffect as useEffect17, useState as useState18 } from "react";
|
|
13513
13544
|
import { createPortal } from "react-dom";
|
|
13514
13545
|
|
|
13515
13546
|
// src/components/Menu/Menu.tsx
|
|
@@ -14201,7 +14232,7 @@ var ContextMenu = ({
|
|
|
14201
14232
|
}) => {
|
|
14202
14233
|
const [isRightClicked, setIsRightClicked] = useState18(false);
|
|
14203
14234
|
const [menuPosition, setMenuPosition] = useState18(position ?? { x: 0, y: 0 });
|
|
14204
|
-
|
|
14235
|
+
useEffect17(() => {
|
|
14205
14236
|
if (isNil16(position)) {
|
|
14206
14237
|
const onContextMenu = (event) => {
|
|
14207
14238
|
event.preventDefault();
|
|
@@ -14257,7 +14288,7 @@ var ContextMenu = ({
|
|
|
14257
14288
|
};
|
|
14258
14289
|
|
|
14259
14290
|
// src/components/DataCards/DataCard.tsx
|
|
14260
|
-
import { useRef as
|
|
14291
|
+
import { useRef as useRef16 } from "react";
|
|
14261
14292
|
import { styled as styled58, keyframes as keyframes4 } from "styled-components";
|
|
14262
14293
|
import { isNotNil as isNotNil25 } from "@wistia/type-guards";
|
|
14263
14294
|
import { jsx as jsx289, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
@@ -14435,7 +14466,7 @@ var DataCardInner = ({
|
|
|
14435
14466
|
}
|
|
14436
14467
|
);
|
|
14437
14468
|
var DataCard = (props) => {
|
|
14438
|
-
const ref =
|
|
14469
|
+
const ref = useRef16(null);
|
|
14439
14470
|
if (isNotNil25(props.href) || isNotNil25(props.onClick)) {
|
|
14440
14471
|
const { "aria-pressed": ariaPressed, ...dataCardProps } = props;
|
|
14441
14472
|
return /* @__PURE__ */ jsx289(ClickRegion, { targetRef: ref, children: /* @__PURE__ */ jsx289(
|
|
@@ -14702,7 +14733,7 @@ Divider.displayName = "Divider_UI";
|
|
|
14702
14733
|
|
|
14703
14734
|
// src/components/EditableHeading/EditableHeading.tsx
|
|
14704
14735
|
import { styled as styled64, css as css34 } from "styled-components";
|
|
14705
|
-
import { useState as useState19, useRef as
|
|
14736
|
+
import { useState as useState19, useRef as useRef17 } from "react";
|
|
14706
14737
|
import { Fragment as Fragment8, jsx as jsx297, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
14707
14738
|
var StyledInput = styled64(Input)`
|
|
14708
14739
|
&:not([rows]) {
|
|
@@ -14761,7 +14792,7 @@ var EditableHeading = ({
|
|
|
14761
14792
|
const [value, setValue] = useState19(children);
|
|
14762
14793
|
const [previousValue, setPreviousValue] = useState19(children);
|
|
14763
14794
|
const [headingHeight, setHeadingHeight] = useState19("60");
|
|
14764
|
-
const headingRef =
|
|
14795
|
+
const headingRef = useRef17(null);
|
|
14765
14796
|
const handleSetEditing = (editing) => {
|
|
14766
14797
|
if (editingDisabled) {
|
|
14767
14798
|
return;
|
|
@@ -14843,7 +14874,7 @@ var EditableHeading = ({
|
|
|
14843
14874
|
};
|
|
14844
14875
|
|
|
14845
14876
|
// src/components/EditableText/EditableTextDisplay.tsx
|
|
14846
|
-
import { useContext as useContext6, useRef as
|
|
14877
|
+
import { useContext as useContext6, useRef as useRef18, forwardRef as forwardRef21 } from "react";
|
|
14847
14878
|
import { styled as styled66, css as css35 } from "styled-components";
|
|
14848
14879
|
import { isNotNil as isNotNil26 } from "@wistia/type-guards";
|
|
14849
14880
|
|
|
@@ -15041,7 +15072,7 @@ var EditableTextDisplayComponent = forwardRef21(
|
|
|
15041
15072
|
throw new Error("EditableTextDisplay must be used within an EditableTextRoot context");
|
|
15042
15073
|
}
|
|
15043
15074
|
const { value, typographicVariant, setIsEditing, placeholder, maxLines, isEditing, minLines } = context;
|
|
15044
|
-
const triggerButtonRef =
|
|
15075
|
+
const triggerButtonRef = useRef18(null);
|
|
15045
15076
|
const handleTriggerClick = () => {
|
|
15046
15077
|
setIsEditing(true);
|
|
15047
15078
|
};
|
|
@@ -15101,7 +15132,7 @@ var EditableTextDisplay = makePolymorphic(
|
|
|
15101
15132
|
);
|
|
15102
15133
|
|
|
15103
15134
|
// src/components/EditableText/EditableTextInput.tsx
|
|
15104
|
-
import { useContext as useContext7, useEffect as
|
|
15135
|
+
import { useContext as useContext7, useEffect as useEffect18, useRef as useRef19 } from "react";
|
|
15105
15136
|
import { styled as styled67 } from "styled-components";
|
|
15106
15137
|
import { isNotNil as isNotNil27 } from "@wistia/type-guards";
|
|
15107
15138
|
import { jsx as jsx300 } from "react/jsx-runtime";
|
|
@@ -15137,8 +15168,8 @@ var EditableTextInput = (props) => {
|
|
|
15137
15168
|
maxLines,
|
|
15138
15169
|
finalFocusEl
|
|
15139
15170
|
} = context;
|
|
15140
|
-
const inputRef =
|
|
15141
|
-
|
|
15171
|
+
const inputRef = useRef19(null);
|
|
15172
|
+
useEffect18(() => {
|
|
15142
15173
|
if (inputRef.current) {
|
|
15143
15174
|
if (isEditing) {
|
|
15144
15175
|
const element = inputRef.current;
|
|
@@ -15376,14 +15407,14 @@ var useFormState = (action, initialData = {}) => {
|
|
|
15376
15407
|
};
|
|
15377
15408
|
|
|
15378
15409
|
// src/components/Form/FormErrorSummary.tsx
|
|
15379
|
-
import { useContext as useContext12, useRef as
|
|
15410
|
+
import { useContext as useContext12, useRef as useRef20 } from "react";
|
|
15380
15411
|
import { isArray as isArray3, isNotUndefined as isNotUndefined11 } from "@wistia/type-guards";
|
|
15381
15412
|
import { jsx as jsx303, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
15382
15413
|
var ErrorItem = ({ name, error, formId }) => {
|
|
15383
15414
|
return /* @__PURE__ */ jsx303("li", { children: /* @__PURE__ */ jsx303(Link, { href: `#${formId}-${name}`, children: error }) }, name);
|
|
15384
15415
|
};
|
|
15385
15416
|
var FormErrorSummary = ({ description }) => {
|
|
15386
|
-
const ref =
|
|
15417
|
+
const ref = useRef20(null);
|
|
15387
15418
|
const { formId, errors, hasSubmitted } = useContext12(FormContext);
|
|
15388
15419
|
const isValid = Object.keys(errors).length === 0;
|
|
15389
15420
|
if (isValid || !hasSubmitted) {
|
|
@@ -15744,7 +15775,7 @@ var Grid = makePolymorphic(GridComponent);
|
|
|
15744
15775
|
|
|
15745
15776
|
// src/components/InputClickToCopy/InputClickToCopy.tsx
|
|
15746
15777
|
import { styled as styled70 } from "styled-components";
|
|
15747
|
-
import { forwardRef as forwardRef23, useEffect as
|
|
15778
|
+
import { forwardRef as forwardRef23, useEffect as useEffect19, useState as useState22 } from "react";
|
|
15748
15779
|
import { isFunction as isFunction3 } from "@wistia/type-guards";
|
|
15749
15780
|
import { jsx as jsx307 } from "react/jsx-runtime";
|
|
15750
15781
|
var StyledIconButton = styled70(IconButton)`
|
|
@@ -15759,7 +15790,7 @@ var COPY_SUCCESS_DURATION = 2e3;
|
|
|
15759
15790
|
var InputClickToCopy = forwardRef23(
|
|
15760
15791
|
({ value, onCopy, disabled = false, ...props }, ref) => {
|
|
15761
15792
|
const [isCopied, setIsCopied] = useState22(false);
|
|
15762
|
-
|
|
15793
|
+
useEffect19(() => {
|
|
15763
15794
|
if (isCopied) {
|
|
15764
15795
|
const timeout = setTimeout(() => {
|
|
15765
15796
|
setIsCopied(false);
|
|
@@ -16382,14 +16413,14 @@ import { Content as DialogContent } from "@radix-ui/react-dialog";
|
|
|
16382
16413
|
var DEFAULT_MODAL_WIDTH = "532px";
|
|
16383
16414
|
|
|
16384
16415
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
16385
|
-
import { useRef as
|
|
16416
|
+
import { useRef as useRef21, useEffect as useEffect20 } from "react";
|
|
16386
16417
|
import { isNotNil as isNotNil31 } from "@wistia/type-guards";
|
|
16387
16418
|
var useFocusRestore = () => {
|
|
16388
|
-
const previouslyFocusedRef =
|
|
16389
|
-
|
|
16419
|
+
const previouslyFocusedRef = useRef21(null);
|
|
16420
|
+
useEffect20(() => {
|
|
16390
16421
|
previouslyFocusedRef.current = document.activeElement;
|
|
16391
16422
|
}, []);
|
|
16392
|
-
|
|
16423
|
+
useEffect20(() => {
|
|
16393
16424
|
return () => {
|
|
16394
16425
|
if (isNotNil31(previouslyFocusedRef.current)) {
|
|
16395
16426
|
setTimeout(() => {
|
|
@@ -17398,7 +17429,7 @@ var RadioCardImage = forwardRef30(
|
|
|
17398
17429
|
RadioCardImage.displayName = "RadioCardImage_UI";
|
|
17399
17430
|
|
|
17400
17431
|
// src/components/ScrollArea/ScrollArea.tsx
|
|
17401
|
-
import { forwardRef as forwardRef31, useCallback as useCallback18, useEffect as
|
|
17432
|
+
import { forwardRef as forwardRef31, useCallback as useCallback18, useEffect as useEffect21, useMemo as useMemo15, useRef as useRef22, useState as useState24 } from "react";
|
|
17402
17433
|
import { styled as styled90 } from "styled-components";
|
|
17403
17434
|
import { throttle } from "throttle-debounce";
|
|
17404
17435
|
import { jsx as jsx327, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
@@ -17450,7 +17481,7 @@ var ShadowAtRight = styled90(Shadow)`
|
|
|
17450
17481
|
`;
|
|
17451
17482
|
var ScrollArea = forwardRef31(
|
|
17452
17483
|
({ children, onScroll, style, locked = false, ...props }, forwardedRef) => {
|
|
17453
|
-
const scrollContainerRefInternal =
|
|
17484
|
+
const scrollContainerRefInternal = useRef22(null);
|
|
17454
17485
|
const [shadowState, setShadowState] = useState24({
|
|
17455
17486
|
canScrollUp: false,
|
|
17456
17487
|
canScrollLeft: false,
|
|
@@ -17478,7 +17509,7 @@ var ScrollArea = forwardRef31(
|
|
|
17478
17509
|
},
|
|
17479
17510
|
[onScroll, throttledUpdateShadows]
|
|
17480
17511
|
);
|
|
17481
|
-
|
|
17512
|
+
useEffect21(() => {
|
|
17482
17513
|
updateShadows();
|
|
17483
17514
|
}, [updateShadows]);
|
|
17484
17515
|
return /* @__PURE__ */ jsxs59(Container10, { style, children: [
|
|
@@ -17644,7 +17675,7 @@ var SegmentedControl = forwardRef32(
|
|
|
17644
17675
|
SegmentedControl.displayName = "SegmentedControl_UI";
|
|
17645
17676
|
|
|
17646
17677
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
17647
|
-
import { forwardRef as forwardRef33, useEffect as
|
|
17678
|
+
import { forwardRef as forwardRef33, useEffect as useEffect22, useRef as useRef23 } from "react";
|
|
17648
17679
|
import { styled as styled93, css as css47 } from "styled-components";
|
|
17649
17680
|
import { Item as ToggleGroupItem2 } from "@radix-ui/react-toggle-group";
|
|
17650
17681
|
import { isNotNil as isNotNil36 } from "@wistia/type-guards";
|
|
@@ -17724,7 +17755,7 @@ var SegmentedControlItem = forwardRef33(
|
|
|
17724
17755
|
({ disabled, icon, label, "aria-label": ariaLabel, value, ...otherProps }, forwardedRef) => {
|
|
17725
17756
|
const selectedValue = useSegmentedControlValue();
|
|
17726
17757
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
17727
|
-
const buttonRef =
|
|
17758
|
+
const buttonRef = useRef23(null);
|
|
17728
17759
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
17729
17760
|
const handleClick = (event) => {
|
|
17730
17761
|
const target = event.target;
|
|
@@ -17733,7 +17764,7 @@ var SegmentedControlItem = forwardRef33(
|
|
|
17733
17764
|
event.preventDefault();
|
|
17734
17765
|
}
|
|
17735
17766
|
};
|
|
17736
|
-
|
|
17767
|
+
useEffect22(() => {
|
|
17737
17768
|
const buttonElem = buttonRef.current;
|
|
17738
17769
|
if (!buttonElem) {
|
|
17739
17770
|
return void 0;
|
|
@@ -18382,7 +18413,7 @@ var TabsList = ({ children, fullWidth = true, ...props }) => {
|
|
|
18382
18413
|
TabsList.displayName = "TabsList_UI";
|
|
18383
18414
|
|
|
18384
18415
|
// src/components/Tabs/TabsTrigger.tsx
|
|
18385
|
-
import { forwardRef as forwardRef36, useEffect as
|
|
18416
|
+
import { forwardRef as forwardRef36, useEffect as useEffect23, useRef as useRef24 } from "react";
|
|
18386
18417
|
import { isNotNil as isNotNil39 } from "@wistia/type-guards";
|
|
18387
18418
|
|
|
18388
18419
|
// src/components/Tabs/StyledRadixTabsTrigger.tsx
|
|
@@ -18402,9 +18433,9 @@ var TabsTrigger = forwardRef36(
|
|
|
18402
18433
|
({ disabled = false, icon, label, "aria-label": ariaLabel, value, ...otherProps }, forwardedRef) => {
|
|
18403
18434
|
const selectedValue = useTabsValue();
|
|
18404
18435
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
18405
|
-
const buttonRef =
|
|
18436
|
+
const buttonRef = useRef24(null);
|
|
18406
18437
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
18407
|
-
|
|
18438
|
+
useEffect23(() => {
|
|
18408
18439
|
const buttonElem = buttonRef.current;
|
|
18409
18440
|
if (!buttonElem) {
|
|
18410
18441
|
return void 0;
|
|
@@ -18486,7 +18517,7 @@ var ThumbnailBadge = ({ icon, label, ...props }) => {
|
|
|
18486
18517
|
ThumbnailBadge.displayName = "ThumbnailBadge_UI";
|
|
18487
18518
|
|
|
18488
18519
|
// src/components/Thumbnail/Thumbnail.tsx
|
|
18489
|
-
import { forwardRef as forwardRef37, useState as useState27, useRef as
|
|
18520
|
+
import { forwardRef as forwardRef37, useState as useState27, useRef as useRef25, useCallback as useCallback20, useMemo as useMemo17 } from "react";
|
|
18490
18521
|
import { styled as styled109 } from "styled-components";
|
|
18491
18522
|
import {
|
|
18492
18523
|
isNil as isNil19,
|
|
@@ -18890,7 +18921,7 @@ var Thumbnail = forwardRef37(
|
|
|
18890
18921
|
const [percent, setPercent] = useState27(0);
|
|
18891
18922
|
const [isMouseOver, setIsMouseOver] = useState27(false);
|
|
18892
18923
|
const [isStoryboardReady, setIsStoryboardReady] = useState27(false);
|
|
18893
|
-
const storyboardElementRef =
|
|
18924
|
+
const storyboardElementRef = useRef25(null);
|
|
18894
18925
|
const [cursorPosition, setCursorPosition] = useState27(null);
|
|
18895
18926
|
const backgroundUrl = useMemo17(
|
|
18896
18927
|
() => thumbnailImageType === "square" && hasValidThumbnailUrl(thumbnailUrl) ? thumbnailUrl : void 0,
|