@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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,27 @@
|
|
|
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.3.0](https://github.com/ModaOperandi/om/compare/v17.2.1...v17.3.0) (2022-08-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **colorswatch:** add new colors ([#2854](https://github.com/ModaOperandi/om/issues/2854)) ([a087080](https://github.com/ModaOperandi/om/commit/a0870807d284aab16815673720dca147a895fa09))
|
|
12
|
+
|
|
13
|
+
## [17.2.1](https://github.com/ModaOperandi/om/compare/v17.2.0...v17.2.1) (2022-08-22)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* **colorswatch:** show black dot only on white bg ([046877d](https://github.com/ModaOperandi/om/commit/046877d0e7d33de624b23848f6c8436cb9637853))
|
|
19
|
+
|
|
20
|
+
# [17.2.0](https://github.com/ModaOperandi/om/compare/v17.1.0...v17.2.0) (2022-08-22)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **colorswatch:** add title to the callbacks ([a259d7a](https://github.com/ModaOperandi/om/commit/a259d7a76785dccc30fb6489702e3ab1d5ee0055))
|
|
26
|
+
|
|
6
27
|
# [17.1.0](https://github.com/ModaOperandi/om/compare/v17.0.0...v17.1.0) (2022-08-17)
|
|
7
28
|
|
|
8
29
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -5956,6 +5956,7 @@ var SKU_COLORS = {
|
|
|
5956
5956
|
'rose gold': '#b76e79',
|
|
5957
5957
|
'royal blue': '#0049ff',
|
|
5958
5958
|
animal: undefined,
|
|
5959
|
+
berry: '#8f1e47',
|
|
5959
5960
|
black: '#000',
|
|
5960
5961
|
blue: '#3755a4',
|
|
5961
5962
|
bronze: '#cd7f2e',
|
|
@@ -5986,13 +5987,17 @@ var SKU_COLORS = {
|
|
|
5986
5987
|
silver: '#c0c0c0',
|
|
5987
5988
|
stripe: undefined,
|
|
5988
5989
|
tan: '#baa094',
|
|
5990
|
+
taupe: '#483c32',
|
|
5989
5991
|
turquoise: '#1e83a8',
|
|
5992
|
+
universal: undefined,
|
|
5990
5993
|
white: '#fff',
|
|
5991
5994
|
yellow: '#ffca44'
|
|
5992
5995
|
};
|
|
5993
5996
|
|
|
5994
|
-
var _excluded$s = ["className", "size", "color", "backgroundUrl", "focus", "hover", "selected", "soldOut", "onSale", "onClick", "onMouseEnter", "disabled"];
|
|
5997
|
+
var _excluded$s = ["className", "size", "color", "backgroundUrl", "focus", "hover", "selected", "soldOut", "onSale", "onClick", "onMouseEnter", "disabled", "title"];
|
|
5995
5998
|
var ColorSwatch = function ColorSwatch(_ref) {
|
|
5999
|
+
var _SKU_COLORS;
|
|
6000
|
+
|
|
5996
6001
|
var className = _ref.className,
|
|
5997
6002
|
size = _ref.size,
|
|
5998
6003
|
color = _ref.color,
|
|
@@ -6005,18 +6010,20 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
6005
6010
|
onClick = _ref.onClick,
|
|
6006
6011
|
onMouseEnter = _ref.onMouseEnter,
|
|
6007
6012
|
disabled = _ref.disabled,
|
|
6013
|
+
title = _ref.title,
|
|
6008
6014
|
rest = _objectWithoutProperties(_ref, _excluded$s);
|
|
6009
6015
|
|
|
6010
6016
|
var handleClick = React.useCallback(function (_event) {
|
|
6011
|
-
onClick && onClick(color);
|
|
6012
|
-
}, [color, onClick]);
|
|
6017
|
+
onClick && onClick(color, title);
|
|
6018
|
+
}, [color, title, onClick]);
|
|
6013
6019
|
var handleMouseEnter = React.useCallback(function (_event) {
|
|
6014
|
-
onMouseEnter && onMouseEnter(color);
|
|
6015
|
-
}, [color, onMouseEnter]);
|
|
6016
|
-
var backgroundColor = SKU_COLORS[color];
|
|
6020
|
+
onMouseEnter && onMouseEnter(color, title);
|
|
6021
|
+
}, [color, title, onMouseEnter]);
|
|
6022
|
+
var backgroundColor = (_SKU_COLORS = SKU_COLORS[color]) !== null && _SKU_COLORS !== void 0 ? _SKU_COLORS : color;
|
|
6023
|
+
var isWhite = !backgroundUrl && (!backgroundColor.startsWith('#') || backgroundColor.toLowerCase() === '#fff' || backgroundColor.toLowerCase() === '#ffffff');
|
|
6017
6024
|
|
|
6018
6025
|
var styles = _objectSpread2({
|
|
6019
|
-
backgroundColor: backgroundColor
|
|
6026
|
+
backgroundColor: backgroundColor
|
|
6020
6027
|
}, backgroundUrl ? {
|
|
6021
6028
|
backgroundImage: "url(".concat(backgroundUrl, ")"),
|
|
6022
6029
|
backgroundSize: 'cover'
|
|
@@ -6024,7 +6031,7 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
6024
6031
|
|
|
6025
6032
|
return /*#__PURE__*/React__default["default"].createElement(Clickable, _extends$1({
|
|
6026
6033
|
className: classNames("ColorSwatch", {
|
|
6027
|
-
'ColorSwatch--light':
|
|
6034
|
+
'ColorSwatch--light': isWhite,
|
|
6028
6035
|
'ColorSwatch--small': size === 'small',
|
|
6029
6036
|
'ColorSwatch--hover': hover,
|
|
6030
6037
|
'ColorSwatch--focus': focus,
|
|
@@ -6034,7 +6041,8 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
6034
6041
|
}, className),
|
|
6035
6042
|
onClick: handleClick,
|
|
6036
6043
|
onMouseEnter: handleMouseEnter,
|
|
6037
|
-
disabled: disabled
|
|
6044
|
+
disabled: disabled,
|
|
6045
|
+
title: title
|
|
6038
6046
|
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6039
6047
|
className: "ColorSwatch__chip",
|
|
6040
6048
|
style: styles
|