@wistia/ui 0.14.3 → 0.14.4-beta.6646ad7a.f524d7b

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.3
3
+ * @license @wistia/ui v0.14.4-beta.6646ad7a.f524d7b
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2015,7 +2015,7 @@ var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date(), includeTime
2015
2015
  if (differenceInDays < daysInWeek && !includeTime) {
2016
2016
  return `on ${dayOfWeekString(date)}`;
2017
2017
  }
2018
- return includeTime ? dateTimeString(date, { omitYear: isSameYear }) : dateOnlyString(date, { omitYear: isSameYear });
2018
+ return includeTime ? dateTimeString(date, { omitYear: isSameYear }) : dateOnlyString(date, { omitYear: false });
2019
2019
  };
2020
2020
 
2021
2021
  // src/helpers/dateTime/timeOnlyString.ts
@@ -10062,6 +10062,7 @@ var ColorPickerProvider = ({
10062
10062
  }) => {
10063
10063
  const [isTransitioning, setIsTransitioning] = (0, import_react41.useState)(false);
10064
10064
  const [nonDerivedValueAsHsv, setNonDerivedValueAsHsv] = (0, import_react41.useState)(convertToHsv(valueAsHex));
10065
+ const [valueAsHsv, setValueAsHsv] = (0, import_react41.useState)(convertToHsv(valueAsHex));
10065
10066
  const [shouldEnforceMinContrast, setShouldEnforceMinContrast] = (0, import_react41.useState)(false);
10066
10067
  const getAccessibleDerivativeColor = (0, import_react41.useCallback)(
10067
10068
  (originalColor) => getAccessibleColor({
@@ -10072,7 +10073,6 @@ var ColorPickerProvider = ({
10072
10073
  }),
10073
10074
  [colorForComparison, minimumContrastRatio, opacityForContrastCalculation]
10074
10075
  );
10075
- const valueAsHsv = shouldEnforceMinContrast ? getAccessibleDerivativeColor(nonDerivedValueAsHsv) : nonDerivedValueAsHsv;
10076
10076
  const currentContrastRatio = calculateContrast({
10077
10077
  backgroundColor: valueAsHex,
10078
10078
  foregroundColor: colorForComparison,
@@ -10086,9 +10086,18 @@ var ColorPickerProvider = ({
10086
10086
  opacityForContrastCalculation
10087
10087
  });
10088
10088
  }, [valueAsHex, colorForComparison, minimumContrastRatio, opacityForContrastCalculation]);
10089
- const onChangeNonDerivedValueAsHsv = (0, import_react41.useCallback)((nonDerivedValue) => {
10090
- setNonDerivedValueAsHsv(nonDerivedValue);
10091
- }, []);
10089
+ const onChangeNonDerivedValueAsHsv = (0, import_react41.useCallback)(
10090
+ (nonDerivedValue) => {
10091
+ const finalValue = shouldEnforceMinContrast ? getAccessibleDerivativeColor(nonDerivedValue) : nonDerivedValue;
10092
+ const finalValueAsHex = (0, import_fn4.formatHex)(finalValue);
10093
+ if (finalValueAsHex !== valueAsHex) {
10094
+ onValueChange(finalValueAsHex);
10095
+ }
10096
+ setValueAsHsv(finalValue);
10097
+ setNonDerivedValueAsHsv(nonDerivedValue);
10098
+ },
10099
+ [getAccessibleDerivativeColor, onValueChange, shouldEnforceMinContrast, valueAsHex]
10100
+ );
10092
10101
  const changeValueSmoothly = (0, import_react41.useCallback)(
10093
10102
  (toHsv) => {
10094
10103
  setIsTransitioning(true);
@@ -10098,6 +10107,7 @@ var ColorPickerProvider = ({
10098
10107
  (colorForStepAsHsv) => {
10099
10108
  const hexValue = (0, import_fn4.formatHex)(colorForStepAsHsv);
10100
10109
  onValueChange(hexValue);
10110
+ setValueAsHsv(colorForStepAsHsv);
10101
10111
  },
10102
10112
  () => {
10103
10113
  setIsTransitioning(false);
@@ -10123,12 +10133,11 @@ var ColorPickerProvider = ({
10123
10133
  valueAsHsv
10124
10134
  ]
10125
10135
  );
10126
- const whatValuePropShouldBe = shouldEnforceMinContrast ? (0, import_fn4.formatHex)(getAccessibleDerivativeColor((0, import_fn4.formatHex)(nonDerivedValueAsHsv))) : (0, import_fn4.formatHex)(nonDerivedValueAsHsv);
10127
- (0, import_react41.useEffect)(() => {
10128
- if (valueAsHex !== whatValuePropShouldBe && !isTransitioning) {
10129
- onValueChange(whatValuePropShouldBe);
10130
- }
10131
- }, [valueAsHex, whatValuePropShouldBe, isTransitioning, onValueChange]);
10136
+ const whatValueAsHexShouldBe = (0, import_fn4.formatHex)(valueAsHsv);
10137
+ if (whatValueAsHexShouldBe !== valueAsHex && !isTransitioning) {
10138
+ setValueAsHsv(convertToHsv(valueAsHex));
10139
+ setNonDerivedValueAsHsv(convertToHsv(valueAsHex));
10140
+ }
10132
10141
  const contextValue = (0, import_react41.useMemo)(
10133
10142
  () => ({
10134
10143
  colorForComparison,