@wistia/ui 0.14.2 → 0.14.3-beta.a65ea2b3.ea2330d
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 +25 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +48 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1441,7 +1441,7 @@ type ColorPickerOption = {
|
|
|
1441
1441
|
|
|
1442
1442
|
type ColorGridOptionProps = ColorPickerOption;
|
|
1443
1443
|
declare const ColorGridOption: {
|
|
1444
|
-
({ value, name }: ColorGridOptionProps): JSX.Element;
|
|
1444
|
+
({ value: rawValue, name }: ColorGridOptionProps): JSX.Element;
|
|
1445
1445
|
displayName: string;
|
|
1446
1446
|
};
|
|
1447
1447
|
|
|
@@ -1461,7 +1461,7 @@ declare const ColorListGroup: {
|
|
|
1461
1461
|
|
|
1462
1462
|
type ColorListOptionProps = ColorPickerOption;
|
|
1463
1463
|
declare const ColorListOption: {
|
|
1464
|
-
({ value, name }: ColorListOptionProps): JSX.Element;
|
|
1464
|
+
({ value: rawValue, name }: ColorListOptionProps): JSX.Element;
|
|
1465
1465
|
displayName: string;
|
|
1466
1466
|
};
|
|
1467
1467
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1441,7 +1441,7 @@ type ColorPickerOption = {
|
|
|
1441
1441
|
|
|
1442
1442
|
type ColorGridOptionProps = ColorPickerOption;
|
|
1443
1443
|
declare const ColorGridOption: {
|
|
1444
|
-
({ value, name }: ColorGridOptionProps): JSX.Element;
|
|
1444
|
+
({ value: rawValue, name }: ColorGridOptionProps): JSX.Element;
|
|
1445
1445
|
displayName: string;
|
|
1446
1446
|
};
|
|
1447
1447
|
|
|
@@ -1461,7 +1461,7 @@ declare const ColorListGroup: {
|
|
|
1461
1461
|
|
|
1462
1462
|
type ColorListOptionProps = ColorPickerOption;
|
|
1463
1463
|
declare const ColorListOption: {
|
|
1464
|
-
({ value, name }: ColorListOptionProps): JSX.Element;
|
|
1464
|
+
({ value: rawValue, name }: ColorListOptionProps): JSX.Element;
|
|
1465
1465
|
displayName: string;
|
|
1466
1466
|
};
|
|
1467
1467
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.14.
|
|
3
|
+
* @license @wistia/ui v0.14.3-beta.a65ea2b3.ea2330d
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -9501,7 +9501,7 @@ import styled32 from "styled-components";
|
|
|
9501
9501
|
import { Root as RadioGroupRoot } from "@radix-ui/react-radio-group";
|
|
9502
9502
|
|
|
9503
9503
|
// src/components/ColorPicker/ColorPickerContext.tsx
|
|
9504
|
-
import { createContext as createContext5, useCallback as useCallback9, useContext as useContext4,
|
|
9504
|
+
import { createContext as createContext5, useCallback as useCallback9, useContext as useContext4, useMemo as useMemo8, useState as useState12 } from "react";
|
|
9505
9505
|
import { formatHex as formatHex2 } from "culori/fn";
|
|
9506
9506
|
|
|
9507
9507
|
// src/components/ColorPicker/color-conversion-utils.ts
|
|
@@ -9901,6 +9901,7 @@ var ColorPickerProvider = ({
|
|
|
9901
9901
|
}) => {
|
|
9902
9902
|
const [isTransitioning, setIsTransitioning] = useState12(false);
|
|
9903
9903
|
const [nonDerivedValueAsHsv, setNonDerivedValueAsHsv] = useState12(convertToHsv(valueAsHex));
|
|
9904
|
+
const [valueAsHsv, setValueAsHsv] = useState12(convertToHsv(valueAsHex));
|
|
9904
9905
|
const [shouldEnforceMinContrast, setShouldEnforceMinContrast] = useState12(false);
|
|
9905
9906
|
const getAccessibleDerivativeColor = useCallback9(
|
|
9906
9907
|
(originalColor) => getAccessibleColor({
|
|
@@ -9911,7 +9912,6 @@ var ColorPickerProvider = ({
|
|
|
9911
9912
|
}),
|
|
9912
9913
|
[colorForComparison, minimumContrastRatio, opacityForContrastCalculation]
|
|
9913
9914
|
);
|
|
9914
|
-
const valueAsHsv = shouldEnforceMinContrast ? getAccessibleDerivativeColor(nonDerivedValueAsHsv) : nonDerivedValueAsHsv;
|
|
9915
9915
|
const currentContrastRatio = calculateContrast({
|
|
9916
9916
|
backgroundColor: valueAsHex,
|
|
9917
9917
|
foregroundColor: colorForComparison,
|
|
@@ -9925,9 +9925,18 @@ var ColorPickerProvider = ({
|
|
|
9925
9925
|
opacityForContrastCalculation
|
|
9926
9926
|
});
|
|
9927
9927
|
}, [valueAsHex, colorForComparison, minimumContrastRatio, opacityForContrastCalculation]);
|
|
9928
|
-
const onChangeNonDerivedValueAsHsv = useCallback9(
|
|
9929
|
-
|
|
9930
|
-
|
|
9928
|
+
const onChangeNonDerivedValueAsHsv = useCallback9(
|
|
9929
|
+
(nonDerivedValue) => {
|
|
9930
|
+
const finalValue = shouldEnforceMinContrast ? getAccessibleDerivativeColor(nonDerivedValue) : nonDerivedValue;
|
|
9931
|
+
const finalValueAsHex = formatHex2(finalValue);
|
|
9932
|
+
if (finalValueAsHex !== valueAsHex) {
|
|
9933
|
+
onValueChange(finalValueAsHex);
|
|
9934
|
+
}
|
|
9935
|
+
setValueAsHsv(finalValue);
|
|
9936
|
+
setNonDerivedValueAsHsv(nonDerivedValue);
|
|
9937
|
+
},
|
|
9938
|
+
[getAccessibleDerivativeColor, onValueChange, shouldEnforceMinContrast, valueAsHex]
|
|
9939
|
+
);
|
|
9931
9940
|
const changeValueSmoothly = useCallback9(
|
|
9932
9941
|
(toHsv) => {
|
|
9933
9942
|
setIsTransitioning(true);
|
|
@@ -9937,6 +9946,7 @@ var ColorPickerProvider = ({
|
|
|
9937
9946
|
(colorForStepAsHsv) => {
|
|
9938
9947
|
const hexValue = formatHex2(colorForStepAsHsv);
|
|
9939
9948
|
onValueChange(hexValue);
|
|
9949
|
+
setValueAsHsv(colorForStepAsHsv);
|
|
9940
9950
|
},
|
|
9941
9951
|
() => {
|
|
9942
9952
|
setIsTransitioning(false);
|
|
@@ -9962,12 +9972,11 @@ var ColorPickerProvider = ({
|
|
|
9962
9972
|
valueAsHsv
|
|
9963
9973
|
]
|
|
9964
9974
|
);
|
|
9965
|
-
const
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
}, [valueAsHex, whatValuePropShouldBe, isTransitioning, onValueChange]);
|
|
9975
|
+
const whatValueAsHexShouldBe = formatHex2(valueAsHsv);
|
|
9976
|
+
if (whatValueAsHexShouldBe !== valueAsHex && !isTransitioning) {
|
|
9977
|
+
setValueAsHsv(convertToHsv(valueAsHex));
|
|
9978
|
+
setNonDerivedValueAsHsv(convertToHsv(valueAsHex));
|
|
9979
|
+
}
|
|
9971
9980
|
const contextValue = useMemo8(
|
|
9972
9981
|
() => ({
|
|
9973
9982
|
colorForComparison,
|
|
@@ -10342,7 +10351,8 @@ var Container2 = styled35(RadioGroupItem)`
|
|
|
10342
10351
|
cursor: pointer;
|
|
10343
10352
|
user-select: none;
|
|
10344
10353
|
`;
|
|
10345
|
-
var ColorGridOption = ({ value, name }) => {
|
|
10354
|
+
var ColorGridOption = ({ value: rawValue, name }) => {
|
|
10355
|
+
const value = rawValue.toLocaleLowerCase();
|
|
10346
10356
|
const { valueAsHsv, nonDerivedValueAsHex } = useColorPickerState();
|
|
10347
10357
|
const valueAsHex = formatHex3(valueAsHsv);
|
|
10348
10358
|
const isSelected = valueAsHex === value;
|
|
@@ -10500,7 +10510,8 @@ var Container5 = styled38(ToggleGroupItem)`
|
|
|
10500
10510
|
background-color: var(--wui-color-bg-surface-secondary-hover);
|
|
10501
10511
|
}
|
|
10502
10512
|
`;
|
|
10503
|
-
var ColorListOption = ({ value, name }) => {
|
|
10513
|
+
var ColorListOption = ({ value: rawValue, name }) => {
|
|
10514
|
+
const value = rawValue.toLocaleLowerCase();
|
|
10504
10515
|
const { valueAsHsv, nonDerivedValueAsHex } = useColorPickerState();
|
|
10505
10516
|
const valueAsHex = formatHex4(valueAsHsv);
|
|
10506
10517
|
const isSelected = valueAsHex === value;
|
|
@@ -10553,7 +10564,7 @@ var ColorPicker = ({
|
|
|
10553
10564
|
minimumContrastRatio,
|
|
10554
10565
|
onValueChange,
|
|
10555
10566
|
opacityForContrastCalculation,
|
|
10556
|
-
value,
|
|
10567
|
+
value: value.toLocaleLowerCase(),
|
|
10557
10568
|
children
|
|
10558
10569
|
}
|
|
10559
10570
|
) });
|
|
@@ -10950,7 +10961,7 @@ var ContrastControls = () => {
|
|
|
10950
10961
|
ContrastControls.displayName = "ContrastControls_UI";
|
|
10951
10962
|
|
|
10952
10963
|
// src/components/ColorPicker/HexColorInput.tsx
|
|
10953
|
-
import { useCallback as useCallback13, useEffect as
|
|
10964
|
+
import { useCallback as useCallback13, useEffect as useEffect10, useRef as useRef10, useState as useState13 } from "react";
|
|
10954
10965
|
import { parseHex as parseHex2 } from "culori/fn";
|
|
10955
10966
|
|
|
10956
10967
|
// src/components/Input/Input.tsx
|
|
@@ -11286,7 +11297,7 @@ var HexColorInput = ({ autoFocus = true }) => {
|
|
|
11286
11297
|
}
|
|
11287
11298
|
selectAllButTheHash();
|
|
11288
11299
|
}, [selectAllButTheHash]);
|
|
11289
|
-
|
|
11300
|
+
useEffect10(() => {
|
|
11290
11301
|
if (!autoFocus) {
|
|
11291
11302
|
return;
|
|
11292
11303
|
}
|
|
@@ -11297,7 +11308,7 @@ var HexColorInput = ({ autoFocus = true }) => {
|
|
|
11297
11308
|
inputElem.focus();
|
|
11298
11309
|
selectAllButTheHash();
|
|
11299
11310
|
}, [autoFocus, selectAllButTheHash]);
|
|
11300
|
-
|
|
11311
|
+
useEffect10(() => {
|
|
11301
11312
|
setTextInputValue(valueAsHex);
|
|
11302
11313
|
}, [valueAsHex]);
|
|
11303
11314
|
return /* @__PURE__ */ jsx247(
|
|
@@ -11333,7 +11344,7 @@ import styled46 from "styled-components";
|
|
|
11333
11344
|
import { formatHex as formatHex6 } from "culori/fn";
|
|
11334
11345
|
|
|
11335
11346
|
// src/components/ColorPicker/HSVHueCanvas.tsx
|
|
11336
|
-
import { useEffect as
|
|
11347
|
+
import { useEffect as useEffect11, useRef as useRef11 } from "react";
|
|
11337
11348
|
import styled45 from "styled-components";
|
|
11338
11349
|
import { formatHex as formatHex5 } from "culori/fn";
|
|
11339
11350
|
import { jsx as jsx248 } from "react/jsx-runtime";
|
|
@@ -11344,7 +11355,7 @@ var Canvas = styled45.canvas`
|
|
|
11344
11355
|
`;
|
|
11345
11356
|
var HSVHueCanvas = ({ hsv }) => {
|
|
11346
11357
|
const canvasRef = useRef11(null);
|
|
11347
|
-
|
|
11358
|
+
useEffect11(() => {
|
|
11348
11359
|
const canvas = canvasRef.current;
|
|
11349
11360
|
if (!canvas) {
|
|
11350
11361
|
return;
|
|
@@ -11464,11 +11475,11 @@ var HueSlider = () => {
|
|
|
11464
11475
|
HueSlider.displayName = "HueSlider_UI";
|
|
11465
11476
|
|
|
11466
11477
|
// src/components/ColorPicker/SaturationAndValuePicker.tsx
|
|
11467
|
-
import { useCallback as useCallback15, useEffect as
|
|
11478
|
+
import { useCallback as useCallback15, useEffect as useEffect13, useLayoutEffect as useLayoutEffect4, useMemo as useMemo10, useRef as useRef13, useState as useState14 } from "react";
|
|
11468
11479
|
import styled48 from "styled-components";
|
|
11469
11480
|
|
|
11470
11481
|
// src/components/ColorPicker/HSVSaturationValueCanvas.tsx
|
|
11471
|
-
import { useEffect as
|
|
11482
|
+
import { useEffect as useEffect12, useRef as useRef12 } from "react";
|
|
11472
11483
|
import styled47 from "styled-components";
|
|
11473
11484
|
|
|
11474
11485
|
// src/components/ColorPicker/canvas-utils.ts
|
|
@@ -11559,7 +11570,7 @@ var HSVSaturationValueCanvas = ({
|
|
|
11559
11570
|
opacityForContrastCalculation
|
|
11560
11571
|
}) => {
|
|
11561
11572
|
const canvasRef = useRef12(null);
|
|
11562
|
-
|
|
11573
|
+
useEffect12(() => {
|
|
11563
11574
|
const canvas = canvasRef.current;
|
|
11564
11575
|
if (!canvas) {
|
|
11565
11576
|
return;
|
|
@@ -11776,7 +11787,7 @@ var SaturationAndValuePicker = ({
|
|
|
11776
11787
|
[isDragging, updateSaturationAndValueFromCoordinates]
|
|
11777
11788
|
);
|
|
11778
11789
|
const onWindowMouseUp = useCallback15(() => setIsDragging(false), []);
|
|
11779
|
-
|
|
11790
|
+
useEffect13(() => {
|
|
11780
11791
|
window.addEventListener("mousemove", onWindowMouseMove);
|
|
11781
11792
|
window.addEventListener("mouseup", onWindowMouseUp);
|
|
11782
11793
|
return () => {
|
|
@@ -11842,7 +11853,7 @@ import {
|
|
|
11842
11853
|
useRef as useRef14,
|
|
11843
11854
|
useState as useState15,
|
|
11844
11855
|
useTransition,
|
|
11845
|
-
useEffect as
|
|
11856
|
+
useEffect as useEffect14,
|
|
11846
11857
|
Children as Children5,
|
|
11847
11858
|
isValidElement as isValidElement2
|
|
11848
11859
|
} from "react";
|
|
@@ -12157,7 +12168,7 @@ var Combobox2 = ({
|
|
|
12157
12168
|
const [wrapperWidth, setWrapperWidth] = useState15("auto");
|
|
12158
12169
|
const comboboxWrapperRef = useRef14(null);
|
|
12159
12170
|
const options = useMemo11(() => extractOptions(children), [children]);
|
|
12160
|
-
|
|
12171
|
+
useEffect14(() => {
|
|
12161
12172
|
const comboboxWrapper = comboboxWrapperRef.current;
|
|
12162
12173
|
if (comboboxWrapper) {
|
|
12163
12174
|
const updateWidthVariable = () => {
|
|
@@ -13055,7 +13066,7 @@ var Grid = makePolymorphic(GridComponent);
|
|
|
13055
13066
|
|
|
13056
13067
|
// src/components/InputClickToCopy/InputClickToCopy.tsx
|
|
13057
13068
|
import styled59 from "styled-components";
|
|
13058
|
-
import { forwardRef as forwardRef18, useEffect as
|
|
13069
|
+
import { forwardRef as forwardRef18, useEffect as useEffect15, useState as useState18 } from "react";
|
|
13059
13070
|
import { isFunction as isFunction3 } from "@wistia/type-guards";
|
|
13060
13071
|
import { jsx as jsx264 } from "react/jsx-runtime";
|
|
13061
13072
|
var StyledInput2 = styled59(Input)`
|
|
@@ -13071,7 +13082,7 @@ var COPY_SUCCESS_DURATION = 2e3;
|
|
|
13071
13082
|
var InputClickToCopy = forwardRef18(
|
|
13072
13083
|
({ value, onCopy, ...props }, ref) => {
|
|
13073
13084
|
const [isCopied, setIsCopied] = useState18(false);
|
|
13074
|
-
|
|
13085
|
+
useEffect15(() => {
|
|
13075
13086
|
if (isCopied) {
|
|
13076
13087
|
const timeout = setTimeout(() => {
|
|
13077
13088
|
setIsCopied(false);
|
|
@@ -14129,14 +14140,14 @@ import styled70, { css as css35, keyframes as keyframes4 } from "styled-componen
|
|
|
14129
14140
|
import { Content as DialogContent } from "@radix-ui/react-dialog";
|
|
14130
14141
|
|
|
14131
14142
|
// src/private/hooks/useFocusRestore/useFocusRestore.ts
|
|
14132
|
-
import { useRef as useRef18, useEffect as
|
|
14143
|
+
import { useRef as useRef18, useEffect as useEffect16 } from "react";
|
|
14133
14144
|
import { isNotNil as isNotNil28 } from "@wistia/type-guards";
|
|
14134
14145
|
var useFocusRestore = () => {
|
|
14135
14146
|
const previouslyFocusedRef = useRef18(null);
|
|
14136
|
-
|
|
14147
|
+
useEffect16(() => {
|
|
14137
14148
|
previouslyFocusedRef.current = document.activeElement;
|
|
14138
14149
|
}, []);
|
|
14139
|
-
|
|
14150
|
+
useEffect16(() => {
|
|
14140
14151
|
return () => {
|
|
14141
14152
|
if (isNotNil28(previouslyFocusedRef.current)) {
|
|
14142
14153
|
setTimeout(() => {
|
|
@@ -15262,7 +15273,7 @@ var SegmentedControl = forwardRef29(
|
|
|
15262
15273
|
SegmentedControl.displayName = "SegmentedControl_UI";
|
|
15263
15274
|
|
|
15264
15275
|
// src/components/SegmentedControl/SegmentedControlItem.tsx
|
|
15265
|
-
import { forwardRef as forwardRef30, useEffect as
|
|
15276
|
+
import { forwardRef as forwardRef30, useEffect as useEffect17, useRef as useRef19 } from "react";
|
|
15266
15277
|
import styled82, { css as css42 } from "styled-components";
|
|
15267
15278
|
import { Item as ToggleGroupItem2 } from "@radix-ui/react-toggle-group";
|
|
15268
15279
|
import { isNotNil as isNotNil33 } from "@wistia/type-guards";
|
|
@@ -15350,7 +15361,7 @@ var SegmentedControlItem = forwardRef30(
|
|
|
15350
15361
|
event.preventDefault();
|
|
15351
15362
|
}
|
|
15352
15363
|
};
|
|
15353
|
-
|
|
15364
|
+
useEffect17(() => {
|
|
15354
15365
|
const buttonElem = buttonRef.current;
|
|
15355
15366
|
if (!buttonElem) {
|
|
15356
15367
|
return void 0;
|
|
@@ -15952,7 +15963,7 @@ var TabsList = ({ children, fullWidth = true, ...props }) => {
|
|
|
15952
15963
|
TabsList.displayName = "TabsList_UI";
|
|
15953
15964
|
|
|
15954
15965
|
// src/components/Tabs/TabsTrigger.tsx
|
|
15955
|
-
import { forwardRef as forwardRef33, useEffect as
|
|
15966
|
+
import { forwardRef as forwardRef33, useEffect as useEffect18, useRef as useRef20 } from "react";
|
|
15956
15967
|
import { isNotNil as isNotNil36 } from "@wistia/type-guards";
|
|
15957
15968
|
|
|
15958
15969
|
// src/components/Tabs/StyledRadixTabsTrigger.tsx
|
|
@@ -15974,7 +15985,7 @@ var TabsTrigger = forwardRef33(
|
|
|
15974
15985
|
const { setSelectedItemMeasurements } = useSelectedItemStyle();
|
|
15975
15986
|
const buttonRef = useRef20(null);
|
|
15976
15987
|
const combinedRef = mergeRefs([buttonRef, forwardedRef]);
|
|
15977
|
-
|
|
15988
|
+
useEffect18(() => {
|
|
15978
15989
|
const buttonElem = buttonRef.current;
|
|
15979
15990
|
if (!buttonElem) {
|
|
15980
15991
|
return void 0;
|
|
@@ -16777,7 +16788,7 @@ var InputPassword = forwardRef35(
|
|
|
16777
16788
|
InputPassword.displayName = "InputPassword_UI";
|
|
16778
16789
|
|
|
16779
16790
|
// src/components/ContextMenu/ContextMenu.tsx
|
|
16780
|
-
import { useEffect as
|
|
16791
|
+
import { useEffect as useEffect19, useState as useState24 } from "react";
|
|
16781
16792
|
import { isNil as isNil18, isNotNil as isNotNil42 } from "@wistia/type-guards";
|
|
16782
16793
|
import { jsx as jsx313 } from "react/jsx-runtime";
|
|
16783
16794
|
var ContextMenu = ({
|
|
@@ -16788,7 +16799,7 @@ var ContextMenu = ({
|
|
|
16788
16799
|
}) => {
|
|
16789
16800
|
const [isRightClicked, setIsRightClicked] = useState24(false);
|
|
16790
16801
|
const [menuPosition, setMenuPosition] = useState24(position ?? { x: 0, y: 0 });
|
|
16791
|
-
|
|
16802
|
+
useEffect19(() => {
|
|
16792
16803
|
if (isNil18(position)) {
|
|
16793
16804
|
const onContextMenu = (event) => {
|
|
16794
16805
|
event.preventDefault();
|