@moda/om 18.2.0 → 18.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/dist/index.esm.js CHANGED
@@ -4852,34 +4852,65 @@ var _excluded$C = ["aspectWidth", "aspectHeight", "maxWidth", "maxHeight", "outl
4852
4852
  var DEFAULT_PRODUCT_ASPECT_WIDTH = 128;
4853
4853
  var DEFAULT_PRODUCT_ASPECT_HEIGHT = 205;
4854
4854
  var DEFAULT_PRODUCT_ASPECT_RATIO = DEFAULT_PRODUCT_ASPECT_HEIGHT / DEFAULT_PRODUCT_ASPECT_WIDTH;
4855
- var AspectRatioBox = /*#__PURE__*/React__default.forwardRef(function (_ref, forwardedRef) {
4856
- var _ref$aspectWidth = _ref.aspectWidth,
4857
- aspectWidth = _ref$aspectWidth === void 0 ? DEFAULT_PRODUCT_ASPECT_WIDTH : _ref$aspectWidth,
4858
- _ref$aspectHeight = _ref.aspectHeight,
4859
- aspectHeight = _ref$aspectHeight === void 0 ? DEFAULT_PRODUCT_ASPECT_HEIGHT : _ref$aspectHeight,
4855
+ var scaleDimensions = function scaleDimensions(_ref) {
4856
+ var width = _ref.width,
4857
+ height = _ref.height,
4860
4858
  maxWidth = _ref.maxWidth,
4861
- maxHeight = _ref.maxHeight,
4862
- _ref$outlined = _ref.outlined,
4863
- outlined = _ref$outlined === void 0 ? false : _ref$outlined,
4864
- children = _ref.children,
4865
- className = _ref.className,
4866
- rest = _objectWithoutProperties(_ref, _excluded$C);
4867
- var _scale = dist$3.scale({
4859
+ maxHeight = _ref.maxHeight;
4860
+ if (maxWidth && maxHeight) return dist$3.scale({
4861
+ width: width,
4862
+ height: height,
4863
+ maxWidth: maxWidth,
4864
+ maxHeight: maxHeight
4865
+ });
4866
+ if (maxWidth) return dist$3.scale({
4867
+ width: width,
4868
+ height: height,
4869
+ maxWidth: maxWidth
4870
+ });
4871
+ if (maxHeight) return dist$3.scale({
4872
+ width: width,
4873
+ height: height,
4874
+ maxHeight: maxHeight
4875
+ });
4876
+ return {
4877
+ width: width,
4878
+ height: height,
4879
+ paddingBottom: dist$3.paddingBottom({
4880
+ width: width,
4881
+ height: height
4882
+ }),
4883
+ scale: 1
4884
+ };
4885
+ };
4886
+ var AspectRatioBox = /*#__PURE__*/React__default.forwardRef(function (_ref2, forwardedRef) {
4887
+ var _ref2$aspectWidth = _ref2.aspectWidth,
4888
+ aspectWidth = _ref2$aspectWidth === void 0 ? DEFAULT_PRODUCT_ASPECT_WIDTH : _ref2$aspectWidth,
4889
+ _ref2$aspectHeight = _ref2.aspectHeight,
4890
+ aspectHeight = _ref2$aspectHeight === void 0 ? DEFAULT_PRODUCT_ASPECT_HEIGHT : _ref2$aspectHeight,
4891
+ maxWidth = _ref2.maxWidth,
4892
+ maxHeight = _ref2.maxHeight,
4893
+ _ref2$outlined = _ref2.outlined,
4894
+ outlined = _ref2$outlined === void 0 ? false : _ref2$outlined,
4895
+ children = _ref2.children,
4896
+ className = _ref2.className,
4897
+ rest = _objectWithoutProperties(_ref2, _excluded$C);
4898
+ var _scaleDimensions = scaleDimensions({
4868
4899
  width: aspectWidth,
4869
4900
  height: aspectHeight,
4870
4901
  maxWidth: maxWidth,
4871
4902
  maxHeight: maxHeight
4872
4903
  }),
4873
- width = _scale.width,
4874
- paddingBottom = _scale.paddingBottom;
4904
+ width = _scaleDimensions.width,
4905
+ paddingBottom = _scaleDimensions.paddingBottom;
4875
4906
  return /*#__PURE__*/React__default.createElement("div", _extends$1({
4876
4907
  ref: forwardedRef,
4877
4908
  className: classNames('AspectRatioBox', {
4878
4909
  'AspectRatioBox--outlined': outlined
4879
4910
  }, className),
4880
- style: {
4911
+ style: maxWidth || maxHeight ? {
4881
4912
  maxWidth: "".concat(width, "px")
4882
- }
4913
+ } : undefined
4883
4914
  }, rest), /*#__PURE__*/React__default.createElement("div", {
4884
4915
  className: "AspectRatioBox__wrapper",
4885
4916
  style: {