@lumx/react 3.7.6-alpha.13 → 3.7.6-alpha.14
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/index.js +20 -7
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/heading/Heading.test.tsx +3 -1
- package/src/components/heading/Heading.tsx +3 -2
- package/src/components/image-lightbox/internal/ImageSlide.tsx +1 -1
- package/src/components/thumbnail/Thumbnail.stories.tsx +4 -1
- package/src/components/thumbnail/Thumbnail.tsx +4 -4
- package/src/utils/object/isEqual.test.js +25 -0
- package/src/utils/object/isEqual.ts +11 -0
package/index.js
CHANGED
|
@@ -17,7 +17,6 @@ import memoize from 'lodash/memoize';
|
|
|
17
17
|
import castArray from 'lodash/castArray';
|
|
18
18
|
import pick from 'lodash/pick';
|
|
19
19
|
import isInteger from 'lodash/isInteger';
|
|
20
|
-
import isEqual from 'lodash/isEqual';
|
|
21
20
|
import throttle from 'lodash/throttle';
|
|
22
21
|
import take from 'lodash/take';
|
|
23
22
|
import uniqueId from 'lodash/uniqueId';
|
|
@@ -7360,13 +7359,14 @@ const Heading = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
7360
7359
|
const {
|
|
7361
7360
|
headingElement
|
|
7362
7361
|
} = useHeadingLevel();
|
|
7362
|
+
const computedHeadingElement = as || headingElement;
|
|
7363
7363
|
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
7364
7364
|
ref: ref,
|
|
7365
7365
|
className: classnames(className, handleBasicClasses({
|
|
7366
7366
|
prefix: CLASSNAME$p
|
|
7367
7367
|
})),
|
|
7368
|
-
as:
|
|
7369
|
-
typography: DEFAULT_TYPOGRAPHY_BY_LEVEL[
|
|
7368
|
+
as: computedHeadingElement,
|
|
7369
|
+
typography: DEFAULT_TYPOGRAPHY_BY_LEVEL[computedHeadingElement]
|
|
7370
7370
|
}, forwardedProps), children);
|
|
7371
7371
|
});
|
|
7372
7372
|
Heading.displayName = COMPONENT_NAME$s;
|
|
@@ -7863,6 +7863,18 @@ function getPrefersReducedMotion() {
|
|
|
7863
7863
|
return WINDOW === null || WINDOW === void 0 ? void 0 : (_WINDOW$matchMedia = WINDOW.matchMedia) === null || _WINDOW$matchMedia === void 0 ? void 0 : _WINDOW$matchMedia.call(WINDOW, '(prefers-reduced-motion: reduce)').matches;
|
|
7864
7864
|
}
|
|
7865
7865
|
|
|
7866
|
+
/** Minimal recursive deep equal of JS values */
|
|
7867
|
+
function isEqual(obj1, obj2) {
|
|
7868
|
+
if (obj1 === obj2) return true;
|
|
7869
|
+
if (typeof obj1 === 'object' && typeof obj2 === 'object') {
|
|
7870
|
+
const keys1 = Object.keys(obj1);
|
|
7871
|
+
const keys2 = Object.keys(obj2);
|
|
7872
|
+
if (keys1.length !== keys2.length) return false;
|
|
7873
|
+
return keys1.every(key1 => isEqual(obj1[key1], obj2[key1]));
|
|
7874
|
+
}
|
|
7875
|
+
return false;
|
|
7876
|
+
}
|
|
7877
|
+
|
|
7866
7878
|
/**
|
|
7867
7879
|
* Listen to mouse wheel + ctrl and multi-pointer pinch to zoom
|
|
7868
7880
|
*/
|
|
@@ -13722,15 +13734,16 @@ const Thumbnail = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
13722
13734
|
}), fillHeight && `${CLASSNAME$1f}--fill-height`)
|
|
13723
13735
|
}), /*#__PURE__*/React.createElement("span", {
|
|
13724
13736
|
className: `${CLASSNAME$1f}__background`
|
|
13725
|
-
}, /*#__PURE__*/React.createElement("img", _extends({
|
|
13726
|
-
width:
|
|
13727
|
-
height:
|
|
13737
|
+
}, /*#__PURE__*/React.createElement("img", _extends({
|
|
13738
|
+
width: loadingPlaceholderImage === null || loadingPlaceholderImage === void 0 ? void 0 : loadingPlaceholderImage.naturalWidth,
|
|
13739
|
+
height: loadingPlaceholderImage === null || loadingPlaceholderImage === void 0 ? void 0 : loadingPlaceholderImage.naturalHeight
|
|
13740
|
+
}, imgProps, {
|
|
13728
13741
|
style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, imgProps === null || imgProps === void 0 ? void 0 : imgProps.style), imageErrorStyle), focusPointStyle), loadingStyle),
|
|
13729
13742
|
ref: mergeRefs(setImgElement, propImgRef),
|
|
13730
13743
|
className: classnames(handleBasicClasses({
|
|
13731
13744
|
prefix: `${CLASSNAME$1f}__image`,
|
|
13732
13745
|
isLoading,
|
|
13733
|
-
hasDefinedSize: Boolean((imgProps === null || imgProps === void 0 ? void 0 : imgProps.height) && imgProps.width)
|
|
13746
|
+
hasDefinedSize: !isLoading && Boolean((imgProps === null || imgProps === void 0 ? void 0 : imgProps.height) && imgProps.width)
|
|
13734
13747
|
}), imgProps === null || imgProps === void 0 ? void 0 : imgProps.className),
|
|
13735
13748
|
crossOrigin: crossOrigin,
|
|
13736
13749
|
src: image,
|