@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/dist/index.esm.js
CHANGED
|
@@ -5966,6 +5966,8 @@ var SKU_COLORS = {
|
|
|
5966
5966
|
|
|
5967
5967
|
var _excluded$s = ["className", "size", "color", "backgroundUrl", "focus", "hover", "selected", "soldOut", "onSale", "onClick", "onMouseEnter", "disabled", "title"];
|
|
5968
5968
|
var ColorSwatch = function ColorSwatch(_ref) {
|
|
5969
|
+
var _SKU_COLORS;
|
|
5970
|
+
|
|
5969
5971
|
var className = _ref.className,
|
|
5970
5972
|
size = _ref.size,
|
|
5971
5973
|
color = _ref.color,
|
|
@@ -5987,10 +5989,11 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
5987
5989
|
var handleMouseEnter = useCallback(function (_event) {
|
|
5988
5990
|
onMouseEnter && onMouseEnter(color, title);
|
|
5989
5991
|
}, [color, title, onMouseEnter]);
|
|
5990
|
-
var backgroundColor = SKU_COLORS[color];
|
|
5992
|
+
var backgroundColor = (_SKU_COLORS = SKU_COLORS[color]) !== null && _SKU_COLORS !== void 0 ? _SKU_COLORS : color;
|
|
5993
|
+
var isWhite = !backgroundUrl && (!backgroundColor.startsWith('#') || backgroundColor.toLowerCase() === '#fff' || backgroundColor.toLowerCase() === '#ffffff');
|
|
5991
5994
|
|
|
5992
5995
|
var styles = _objectSpread2({
|
|
5993
|
-
backgroundColor: backgroundColor
|
|
5996
|
+
backgroundColor: backgroundColor
|
|
5994
5997
|
}, backgroundUrl ? {
|
|
5995
5998
|
backgroundImage: "url(".concat(backgroundUrl, ")"),
|
|
5996
5999
|
backgroundSize: 'cover'
|
|
@@ -5998,7 +6001,7 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
5998
6001
|
|
|
5999
6002
|
return /*#__PURE__*/React__default.createElement(Clickable, _extends$1({
|
|
6000
6003
|
className: classNames("ColorSwatch", {
|
|
6001
|
-
'ColorSwatch--light':
|
|
6004
|
+
'ColorSwatch--light': isWhite,
|
|
6002
6005
|
'ColorSwatch--small': size === 'small',
|
|
6003
6006
|
'ColorSwatch--hover': hover,
|
|
6004
6007
|
'ColorSwatch--focus': focus,
|