@moda/om 18.1.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/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
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
+ # [18.3.0](https://github.com/ModaOperandi/om/compare/v18.2.0...v18.3.0) (2023-01-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **AspectRatioBox:** make maxWidth and maxHeight optional ([#3168](https://github.com/ModaOperandi/om/issues/3168)) ([4b35e54](https://github.com/ModaOperandi/om/commit/4b35e5410bb90250adb4bb795b894d127f81061c))
12
+
13
+ # [18.2.0](https://github.com/ModaOperandi/om/compare/v18.1.0...v18.2.0) (2023-01-04)
14
+
15
+
16
+ ### Features
17
+
18
+ * move from node-sass to sass ([#3159](https://github.com/ModaOperandi/om/issues/3159)) ([fc30fb4](https://github.com/ModaOperandi/om/commit/fc30fb4a3efa80d34f0c43ee043a6fad9169296d))
19
+
6
20
  # [18.1.0](https://github.com/ModaOperandi/om/compare/v18.0.0...v18.1.0) (2022-12-29)
7
21
 
8
22
 
package/dist/index.cjs.js CHANGED
@@ -4872,34 +4872,65 @@ var _excluded$C = ["aspectWidth", "aspectHeight", "maxWidth", "maxHeight", "outl
4872
4872
  var DEFAULT_PRODUCT_ASPECT_WIDTH = 128;
4873
4873
  var DEFAULT_PRODUCT_ASPECT_HEIGHT = 205;
4874
4874
  var DEFAULT_PRODUCT_ASPECT_RATIO = DEFAULT_PRODUCT_ASPECT_HEIGHT / DEFAULT_PRODUCT_ASPECT_WIDTH;
4875
- var AspectRatioBox = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
4876
- var _ref$aspectWidth = _ref.aspectWidth,
4877
- aspectWidth = _ref$aspectWidth === void 0 ? DEFAULT_PRODUCT_ASPECT_WIDTH : _ref$aspectWidth,
4878
- _ref$aspectHeight = _ref.aspectHeight,
4879
- aspectHeight = _ref$aspectHeight === void 0 ? DEFAULT_PRODUCT_ASPECT_HEIGHT : _ref$aspectHeight,
4875
+ var scaleDimensions = function scaleDimensions(_ref) {
4876
+ var width = _ref.width,
4877
+ height = _ref.height,
4880
4878
  maxWidth = _ref.maxWidth,
4881
- maxHeight = _ref.maxHeight,
4882
- _ref$outlined = _ref.outlined,
4883
- outlined = _ref$outlined === void 0 ? false : _ref$outlined,
4884
- children = _ref.children,
4885
- className = _ref.className,
4886
- rest = _objectWithoutProperties(_ref, _excluded$C);
4887
- var _scale = dist$3.scale({
4879
+ maxHeight = _ref.maxHeight;
4880
+ if (maxWidth && maxHeight) return dist$3.scale({
4881
+ width: width,
4882
+ height: height,
4883
+ maxWidth: maxWidth,
4884
+ maxHeight: maxHeight
4885
+ });
4886
+ if (maxWidth) return dist$3.scale({
4887
+ width: width,
4888
+ height: height,
4889
+ maxWidth: maxWidth
4890
+ });
4891
+ if (maxHeight) return dist$3.scale({
4892
+ width: width,
4893
+ height: height,
4894
+ maxHeight: maxHeight
4895
+ });
4896
+ return {
4897
+ width: width,
4898
+ height: height,
4899
+ paddingBottom: dist$3.paddingBottom({
4900
+ width: width,
4901
+ height: height
4902
+ }),
4903
+ scale: 1
4904
+ };
4905
+ };
4906
+ var AspectRatioBox = /*#__PURE__*/React.forwardRef(function (_ref2, forwardedRef) {
4907
+ var _ref2$aspectWidth = _ref2.aspectWidth,
4908
+ aspectWidth = _ref2$aspectWidth === void 0 ? DEFAULT_PRODUCT_ASPECT_WIDTH : _ref2$aspectWidth,
4909
+ _ref2$aspectHeight = _ref2.aspectHeight,
4910
+ aspectHeight = _ref2$aspectHeight === void 0 ? DEFAULT_PRODUCT_ASPECT_HEIGHT : _ref2$aspectHeight,
4911
+ maxWidth = _ref2.maxWidth,
4912
+ maxHeight = _ref2.maxHeight,
4913
+ _ref2$outlined = _ref2.outlined,
4914
+ outlined = _ref2$outlined === void 0 ? false : _ref2$outlined,
4915
+ children = _ref2.children,
4916
+ className = _ref2.className,
4917
+ rest = _objectWithoutProperties(_ref2, _excluded$C);
4918
+ var _scaleDimensions = scaleDimensions({
4888
4919
  width: aspectWidth,
4889
4920
  height: aspectHeight,
4890
4921
  maxWidth: maxWidth,
4891
4922
  maxHeight: maxHeight
4892
4923
  }),
4893
- width = _scale.width,
4894
- paddingBottom = _scale.paddingBottom;
4924
+ width = _scaleDimensions.width,
4925
+ paddingBottom = _scaleDimensions.paddingBottom;
4895
4926
  return /*#__PURE__*/React.createElement("div", _extends$1({
4896
4927
  ref: forwardedRef,
4897
4928
  className: classNames('AspectRatioBox', {
4898
4929
  'AspectRatioBox--outlined': outlined
4899
4930
  }, className),
4900
- style: {
4931
+ style: maxWidth || maxHeight ? {
4901
4932
  maxWidth: "".concat(width, "px")
4902
- }
4933
+ } : undefined
4903
4934
  }, rest), /*#__PURE__*/React.createElement("div", {
4904
4935
  className: "AspectRatioBox__wrapper",
4905
4936
  style: {