@moda/om 17.0.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 +21 -0
- package/dist/index.cjs.js +19 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/ColorSwatch/ColorSwatch.d.ts +2 -2
- package/dist/src/components/Expandable/Expandable.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/ColorSwatch/ColorSwatch.tsx +17 -9
- package/src/components/Expandable/Expandable.tsx +6 -1
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.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
|
+
|
|
13
|
+
# [17.2.0](https://github.com/ModaOperandi/om/compare/v17.1.0...v17.2.0) (2022-08-22)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **colorswatch:** add title to the callbacks ([a259d7a](https://github.com/ModaOperandi/om/commit/a259d7a76785dccc30fb6489702e3ab1d5ee0055))
|
|
19
|
+
|
|
20
|
+
# [17.1.0](https://github.com/ModaOperandi/om/compare/v17.0.0...v17.1.0) (2022-08-17)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* **expandable:** onToggle ([4a63534](https://github.com/ModaOperandi/om/commit/4a635341fab096716b343fbac498f804dc5eed4c))
|
|
26
|
+
|
|
6
27
|
# [17.0.0](https://github.com/ModaOperandi/om/compare/v16.3.0...v17.0.0) (2022-08-17)
|
|
7
28
|
|
|
8
29
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -5991,8 +5991,10 @@ var SKU_COLORS = {
|
|
|
5991
5991
|
yellow: '#ffca44'
|
|
5992
5992
|
};
|
|
5993
5993
|
|
|
5994
|
-
var _excluded$s = ["className", "size", "color", "backgroundUrl", "focus", "hover", "selected", "soldOut", "onSale", "onClick", "onMouseEnter", "disabled"];
|
|
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,
|
|
@@ -6005,18 +6007,20 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
6005
6007
|
onClick = _ref.onClick,
|
|
6006
6008
|
onMouseEnter = _ref.onMouseEnter,
|
|
6007
6009
|
disabled = _ref.disabled,
|
|
6010
|
+
title = _ref.title,
|
|
6008
6011
|
rest = _objectWithoutProperties(_ref, _excluded$s);
|
|
6009
6012
|
|
|
6010
6013
|
var handleClick = React.useCallback(function (_event) {
|
|
6011
|
-
onClick && onClick(color);
|
|
6012
|
-
}, [color, onClick]);
|
|
6014
|
+
onClick && onClick(color, title);
|
|
6015
|
+
}, [color, title, onClick]);
|
|
6013
6016
|
var handleMouseEnter = React.useCallback(function (_event) {
|
|
6014
|
-
onMouseEnter && onMouseEnter(color);
|
|
6015
|
-
}, [color, onMouseEnter]);
|
|
6016
|
-
var backgroundColor = SKU_COLORS[color];
|
|
6017
|
+
onMouseEnter && onMouseEnter(color, title);
|
|
6018
|
+
}, [color, title, onMouseEnter]);
|
|
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');
|
|
6017
6021
|
|
|
6018
6022
|
var styles = _objectSpread2({
|
|
6019
|
-
backgroundColor: backgroundColor
|
|
6023
|
+
backgroundColor: backgroundColor
|
|
6020
6024
|
}, backgroundUrl ? {
|
|
6021
6025
|
backgroundImage: "url(".concat(backgroundUrl, ")"),
|
|
6022
6026
|
backgroundSize: 'cover'
|
|
@@ -6024,7 +6028,7 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
6024
6028
|
|
|
6025
6029
|
return /*#__PURE__*/React__default["default"].createElement(Clickable, _extends$1({
|
|
6026
6030
|
className: classNames("ColorSwatch", {
|
|
6027
|
-
'ColorSwatch--light':
|
|
6031
|
+
'ColorSwatch--light': isWhite,
|
|
6028
6032
|
'ColorSwatch--small': size === 'small',
|
|
6029
6033
|
'ColorSwatch--hover': hover,
|
|
6030
6034
|
'ColorSwatch--focus': focus,
|
|
@@ -6034,7 +6038,8 @@ var ColorSwatch = function ColorSwatch(_ref) {
|
|
|
6034
6038
|
}, className),
|
|
6035
6039
|
onClick: handleClick,
|
|
6036
6040
|
onMouseEnter: handleMouseEnter,
|
|
6037
|
-
disabled: disabled
|
|
6041
|
+
disabled: disabled,
|
|
6042
|
+
title: title
|
|
6038
6043
|
}, rest), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6039
6044
|
className: "ColorSwatch__chip",
|
|
6040
6045
|
style: styles
|
|
@@ -11370,7 +11375,7 @@ var DefinitionList = function DefinitionList(_ref) {
|
|
|
11370
11375
|
}, rest), /*#__PURE__*/React__default["default"].createElement("dt", null, term), /*#__PURE__*/React__default["default"].createElement("dd", null, children));
|
|
11371
11376
|
};
|
|
11372
11377
|
|
|
11373
|
-
var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "defaultExpanded", "expanded"];
|
|
11378
|
+
var _excluded$f = ["name", "children", "className", "virtual", "icon", "data-testid", "defaultExpanded", "expanded", "onToggle"];
|
|
11374
11379
|
var Expandable = function Expandable(_ref) {
|
|
11375
11380
|
var name = _ref.name,
|
|
11376
11381
|
children = _ref.children,
|
|
@@ -11383,6 +11388,7 @@ var Expandable = function Expandable(_ref) {
|
|
|
11383
11388
|
_ref$defaultExpanded = _ref.defaultExpanded,
|
|
11384
11389
|
defaultExpanded = _ref$defaultExpanded === void 0 ? false : _ref$defaultExpanded,
|
|
11385
11390
|
__expanded__ = _ref.expanded,
|
|
11391
|
+
onToggle = _ref.onToggle,
|
|
11386
11392
|
rest = _objectWithoutProperties(_ref, _excluded$f);
|
|
11387
11393
|
|
|
11388
11394
|
var _useState = React.useState(defaultExpanded),
|
|
@@ -11394,10 +11400,11 @@ var Expandable = function Expandable(_ref) {
|
|
|
11394
11400
|
if (__expanded__ != null && __expanded__ !== expanded) setExpanded(__expanded__);
|
|
11395
11401
|
}, [expanded, __expanded__]);
|
|
11396
11402
|
var handleClick = React.useCallback(function () {
|
|
11397
|
-
|
|
11403
|
+
setExpanded(function (expanded) {
|
|
11398
11404
|
return !expanded;
|
|
11399
11405
|
});
|
|
11400
|
-
|
|
11406
|
+
onToggle === null || onToggle === void 0 ? void 0 : onToggle();
|
|
11407
|
+
}, [onToggle]);
|
|
11401
11408
|
return /*#__PURE__*/React__default["default"].createElement("div", _extends$1({
|
|
11402
11409
|
className: classNames('Expandable', {
|
|
11403
11410
|
'Expandable--expanded': expanded
|