@moda/om 17.1.0 → 17.3.0
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 +21 -0
- package/dist/index.cjs.js +17 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +17 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/ColorSwatch/ColorSwatch.d.ts +2 -2
- package/dist/src/components/ColorSwatch/skuColors.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/ColorSwatch/ColorSwatch.tsx +17 -9
- package/src/components/ColorSwatch/skuColors.ts +3 -0
package/dist/index.esm.js
CHANGED
|
@@ -5929,6 +5929,7 @@ var SKU_COLORS = {
|
|
|
5929
5929
|
'rose gold': '#b76e79',
|
|
5930
5930
|
'royal blue': '#0049ff',
|
|
5931
5931
|
animal: undefined,
|
|
5932
|
+
berry: '#8f1e47',
|
|
5932
5933
|
black: '#000',
|
|
5933
5934
|
blue: '#3755a4',
|
|
5934
5935
|
bronze: '#cd7f2e',
|
|
@@ -5959,13 +5960,17 @@ var SKU_COLORS = {
|
|
|
5959
5960
|
silver: '#c0c0c0',
|
|
5960
5961
|
stripe: undefined,
|
|
5961
5962
|
tan: '#baa094',
|
|
5963
|
+
taupe: '#483c32',
|
|
5962
5964
|
turquoise: '#1e83a8',
|
|
5965
|
+
universal: undefined,
|
|
5963
5966
|
white: '#fff',
|
|
5964
5967
|
yellow: '#ffca44'
|
|
5965
5968
|
};
|
|
5966
5969
|
|
|
5967
|
-
var _excluded$s = ["className", "size", "color", "backgroundUrl", "focus", "hover", "selected", "soldOut", "onSale", "onClick", "onMouseEnter", "disabled"];
|
|
5970
|
+
var _excluded$s = ["className", "size", "color", "backgroundUrl", "focus", "hover", "selected", "soldOut", "onSale", "onClick", "onMouseEnter", "disabled", "title"];
|
|
5968
5971
|
var ColorSwatch = function ColorSwatch(_ref) {
|
|
5972
|
+
var _SKU_COLORS;
|
|
5973
|
+
|
|
5969
5974
|
var className = _ref.className,
|
|
5970
5975
|
size = _ref.size,
|
|
5971
5976
|
color = _ref.color,
|
|
@@ -5978,18 +5983,20 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
5978
5983
|
onClick = _ref.onClick,
|
|
5979
5984
|
onMouseEnter = _ref.onMouseEnter,
|
|
5980
5985
|
disabled = _ref.disabled,
|
|
5986
|
+
title = _ref.title,
|
|
5981
5987
|
rest = _objectWithoutProperties(_ref, _excluded$s);
|
|
5982
5988
|
|
|
5983
5989
|
var handleClick = useCallback(function (_event) {
|
|
5984
|
-
onClick && onClick(color);
|
|
5985
|
-
}, [color, onClick]);
|
|
5990
|
+
onClick && onClick(color, title);
|
|
5991
|
+
}, [color, title, onClick]);
|
|
5986
5992
|
var handleMouseEnter = useCallback(function (_event) {
|
|
5987
|
-
onMouseEnter && onMouseEnter(color);
|
|
5988
|
-
}, [color, onMouseEnter]);
|
|
5989
|
-
var backgroundColor = SKU_COLORS[color];
|
|
5993
|
+
onMouseEnter && onMouseEnter(color, title);
|
|
5994
|
+
}, [color, title, onMouseEnter]);
|
|
5995
|
+
var backgroundColor = (_SKU_COLORS = SKU_COLORS[color]) !== null && _SKU_COLORS !== void 0 ? _SKU_COLORS : color;
|
|
5996
|
+
var isWhite = !backgroundUrl && (!backgroundColor.startsWith('#') || backgroundColor.toLowerCase() === '#fff' || backgroundColor.toLowerCase() === '#ffffff');
|
|
5990
5997
|
|
|
5991
5998
|
var styles = _objectSpread2({
|
|
5992
|
-
backgroundColor: backgroundColor
|
|
5999
|
+
backgroundColor: backgroundColor
|
|
5993
6000
|
}, backgroundUrl ? {
|
|
5994
6001
|
backgroundImage: "url(".concat(backgroundUrl, ")"),
|
|
5995
6002
|
backgroundSize: 'cover'
|
|
@@ -5997,7 +6004,7 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
5997
6004
|
|
|
5998
6005
|
return /*#__PURE__*/React__default.createElement(Clickable, _extends$1({
|
|
5999
6006
|
className: classNames("ColorSwatch", {
|
|
6000
|
-
'ColorSwatch--light':
|
|
6007
|
+
'ColorSwatch--light': isWhite,
|
|
6001
6008
|
'ColorSwatch--small': size === 'small',
|
|
6002
6009
|
'ColorSwatch--hover': hover,
|
|
6003
6010
|
'ColorSwatch--focus': focus,
|
|
@@ -6007,7 +6014,8 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
6007
6014
|
}, className),
|
|
6008
6015
|
onClick: handleClick,
|
|
6009
6016
|
onMouseEnter: handleMouseEnter,
|
|
6010
|
-
disabled: disabled
|
|
6017
|
+
disabled: disabled,
|
|
6018
|
+
title: title
|
|
6011
6019
|
}, rest), /*#__PURE__*/React__default.createElement("div", {
|
|
6012
6020
|
className: "ColorSwatch__chip",
|
|
6013
6021
|
style: styles
|