@wistia/ui 0.14.6 → 0.14.7-beta.4f6ae999.afe4f2f

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.14.6
3
+ * @license @wistia/ui v0.14.7-beta.4f6ae999.afe4f2f
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -7273,7 +7273,10 @@ var StyledLink = import_styled_components20.default.a`
7273
7273
  ${({ href }) => (0, import_type_guards14.isNil)(href) && buttonResetCss};
7274
7274
  ${({ $colorScheme }) => getColorScheme($colorScheme)}
7275
7275
  cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "pointer"};
7276
- font-family: var(--wui-typography-family-default);
7276
+ font-family: var(var(--font-family), --wui-typography-body-2-family);
7277
+ font-size: var(var(--font-size), --wui-typography-body-2-size);
7278
+ font-weight: var(var(--font-weight), --wui-typography-weight-body);
7279
+ line-height: var(var(--line-height), --wui-typography-body-2-line-height);
7277
7280
  color: ${({ $disabled }) => $disabled ? "var(--wui-color-text-disabled)" : "var(--wui-color-text-link)"};
7278
7281
  text-decoration: ${({ $underline }) => $underline === "always" ? "underline" : "none"};
7279
7282
  display: inline-flex;
@@ -10061,6 +10064,7 @@ var ColorPickerProvider = ({
10061
10064
  value: valueAsHex
10062
10065
  }) => {
10063
10066
  const [isTransitioning, setIsTransitioning] = (0, import_react41.useState)(false);
10067
+ const [isDragging, setIsDragging] = (0, import_react41.useState)(false);
10064
10068
  const [nonDerivedValueAsHsv, setNonDerivedValueAsHsv] = (0, import_react41.useState)(convertToHsv(valueAsHex));
10065
10069
  const [valueAsHsv, setValueAsHsv] = (0, import_react41.useState)(convertToHsv(valueAsHex));
10066
10070
  const [shouldEnforceMinContrast, setShouldEnforceMinContrast] = (0, import_react41.useState)(false);
@@ -10133,23 +10137,41 @@ var ColorPickerProvider = ({
10133
10137
  valueAsHsv
10134
10138
  ]
10135
10139
  );
10136
- const whatValueAsHexShouldBe = (0, import_fn4.formatHex)(valueAsHsv);
10137
- if (whatValueAsHexShouldBe !== valueAsHex && !isTransitioning) {
10138
- setValueAsHsv(convertToHsv(valueAsHex));
10140
+ const accessibleHsvFromValueAsHex = getAccessibleDerivativeColor(valueAsHex);
10141
+ const whatValueAsHexShouldBe = shouldEnforceMinContrast ? (0, import_fn4.formatHex)(accessibleHsvFromValueAsHex) : valueAsHex;
10142
+ const valueAsHsvConvertedToHex = (0, import_fn4.formatHex)(valueAsHsv);
10143
+ if (whatValueAsHexShouldBe !== valueAsHsvConvertedToHex && !isTransitioning && !isDragging) {
10144
+ setValueAsHsv(
10145
+ shouldEnforceMinContrast ? getAccessibleDerivativeColor(valueAsHex) : convertToHsv(valueAsHex)
10146
+ );
10139
10147
  setNonDerivedValueAsHsv(convertToHsv(valueAsHex));
10140
10148
  }
10149
+ (0, import_react41.useEffect)(() => {
10150
+ if (valueAsHex !== valueAsHsvConvertedToHex && !isTransitioning && !isDragging) {
10151
+ onValueChange(whatValueAsHexShouldBe);
10152
+ }
10153
+ }, [
10154
+ isDragging,
10155
+ isTransitioning,
10156
+ onValueChange,
10157
+ valueAsHex,
10158
+ valueAsHsvConvertedToHex,
10159
+ whatValueAsHexShouldBe
10160
+ ]);
10141
10161
  const contextValue = (0, import_react41.useMemo)(
10142
10162
  () => ({
10143
10163
  colorForComparison,
10144
10164
  currentContrastRatio,
10145
10165
  getAccessibleDerivativeColor,
10146
10166
  hasAccessibleDerivatives: hasAccessibleDerivativesValue,
10167
+ isDragging,
10147
10168
  isTransitioning,
10148
10169
  minimumContrastRatio,
10149
10170
  nonDerivedValueAsHex: (0, import_fn4.formatHex)(nonDerivedValueAsHsv),
10150
10171
  nonDerivedValueAsHsv,
10151
10172
  onChangeNonDerivedValueAsHsv,
10152
10173
  opacityForContrastCalculation,
10174
+ setIsDragging,
10153
10175
  setShouldEnforceMinContrast: setShouldEnforceMinContrastWrapped,
10154
10176
  shouldEnforceMinContrast,
10155
10177
  valueAsHex,
@@ -10160,6 +10182,7 @@ var ColorPickerProvider = ({
10160
10182
  currentContrastRatio,
10161
10183
  getAccessibleDerivativeColor,
10162
10184
  hasAccessibleDerivativesValue,
10185
+ isDragging,
10163
10186
  isTransitioning,
10164
10187
  minimumContrastRatio,
10165
10188
  nonDerivedValueAsHsv,
@@ -11811,11 +11834,13 @@ var SaturationAndValuePicker = ({
11811
11834
  }) => {
11812
11835
  const {
11813
11836
  colorForComparison,
11837
+ isDragging,
11814
11838
  isTransitioning,
11815
11839
  minimumContrastRatio,
11816
11840
  nonDerivedValueAsHsv,
11817
11841
  onChangeNonDerivedValueAsHsv,
11818
11842
  opacityForContrastCalculation,
11843
+ setIsDragging,
11819
11844
  shouldEnforceMinContrast,
11820
11845
  valueAsHex,
11821
11846
  valueAsHsv
@@ -11865,7 +11890,6 @@ var SaturationAndValuePicker = ({
11865
11890
  },
11866
11891
  [nonDerivedValueAsHsv, onChangeNonDerivedValueAsHsv]
11867
11892
  );
11868
- const [isDragging, setIsDragging] = (0, import_react52.useState)(false);
11869
11893
  const updateSaturationAndValueFromCoordinates = (0, import_react52.useCallback)(
11870
11894
  (clientX, clientY) => {
11871
11895
  const container = containerRef.current;
@@ -11892,7 +11916,7 @@ var SaturationAndValuePicker = ({
11892
11916
  setIsDragging(true);
11893
11917
  updateSaturationAndValueFromCoordinates(event.clientX, event.clientY);
11894
11918
  },
11895
- [updateSaturationAndValueFromCoordinates, thumbRef]
11919
+ [setIsDragging, updateSaturationAndValueFromCoordinates]
11896
11920
  );
11897
11921
  const onThumbMouseDown = (0, import_react52.useCallback)(
11898
11922
  (event) => {
@@ -11900,7 +11924,7 @@ var SaturationAndValuePicker = ({
11900
11924
  thumbRef.current?.focus();
11901
11925
  setIsDragging(true);
11902
11926
  },
11903
- [thumbRef]
11927
+ [setIsDragging]
11904
11928
  );
11905
11929
  const onThumbKeyDown = (0, import_react52.useCallback)(
11906
11930
  (event) => {
@@ -11935,7 +11959,7 @@ var SaturationAndValuePicker = ({
11935
11959
  },
11936
11960
  [isDragging, updateSaturationAndValueFromCoordinates]
11937
11961
  );
11938
- const onWindowMouseUp = (0, import_react52.useCallback)(() => setIsDragging(false), []);
11962
+ const onWindowMouseUp = (0, import_react52.useCallback)(() => setIsDragging(false), [setIsDragging]);
11939
11963
  (0, import_react52.useEffect)(() => {
11940
11964
  window.addEventListener("mousemove", onWindowMouseMove);
11941
11965
  window.addEventListener("mouseup", onWindowMouseUp);