@moda/om 17.2.0 → 17.2.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [17.2.1](https://github.com/ModaOperandi/om/compare/v17.2.0...v17.2.1) (2022-08-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **colorswatch:** show black dot only on white bg ([046877d](https://github.com/ModaOperandi/om/commit/046877d0e7d33de624b23848f6c8436cb9637853))
12
+
6
13
  # [17.2.0](https://github.com/ModaOperandi/om/compare/v17.1.0...v17.2.0) (2022-08-22)
7
14
 
8
15
 
package/dist/index.cjs.js CHANGED
@@ -5993,6 +5993,8 @@ var SKU_COLORS = {
5993
5993
 
5994
5994
  var _excluded$s = ["className", "size", "color", "backgroundUrl", "focus", "hover", "selected", "soldOut", "onSale", "onClick", "onMouseEnter", "disabled", "title"];
5995
5995
  var ColorSwatch = function ColorSwatch(_ref) {
5996
+ var _SKU_COLORS;
5997
+
5996
5998
  var className = _ref.className,
5997
5999
  size = _ref.size,
5998
6000
  color = _ref.color,
@@ -6014,10 +6016,11 @@ var ColorSwatch = function ColorSwatch(_ref) {
6014
6016
  var handleMouseEnter = React.useCallback(function (_event) {
6015
6017
  onMouseEnter && onMouseEnter(color, title);
6016
6018
  }, [color, title, onMouseEnter]);
6017
- var backgroundColor = SKU_COLORS[color];
6019
+ var backgroundColor = (_SKU_COLORS = SKU_COLORS[color]) !== null && _SKU_COLORS !== void 0 ? _SKU_COLORS : color;
6020
+ var isWhite = !backgroundUrl && (!backgroundColor.startsWith('#') || backgroundColor.toLowerCase() === '#fff' || backgroundColor.toLowerCase() === '#ffffff');
6018
6021
 
6019
6022
  var styles = _objectSpread2({
6020
- backgroundColor: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : color
6023
+ backgroundColor: backgroundColor
6021
6024
  }, backgroundUrl ? {
6022
6025
  backgroundImage: "url(".concat(backgroundUrl, ")"),
6023
6026
  backgroundSize: 'cover'
@@ -6025,7 +6028,7 @@ var ColorSwatch = function ColorSwatch(_ref) {
6025
6028
 
6026
6029
  return /*#__PURE__*/React__default["default"].createElement(Clickable, _extends$1({
6027
6030
  className: classNames("ColorSwatch", {
6028
- 'ColorSwatch--light': !backgroundColor || backgroundColor === '#fff',
6031
+ 'ColorSwatch--light': isWhite,
6029
6032
  'ColorSwatch--small': size === 'small',
6030
6033
  'ColorSwatch--hover': hover,
6031
6034
  'ColorSwatch--focus': focus,