@royaloperahouse/harmonic 0.18.3-d → 0.18.3-e
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/harmonic.cjs.development.js +37 -11
- package/dist/harmonic.cjs.development.js.map +1 -1
- package/dist/harmonic.cjs.production.min.js +1 -1
- package/dist/harmonic.cjs.production.min.js.map +1 -1
- package/dist/harmonic.esm.js +37 -11
- package/dist/harmonic.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/harmonic.esm.js
CHANGED
|
@@ -5927,21 +5927,43 @@ var Accordion = function Accordion(_ref) {
|
|
|
5927
5927
|
var content = useRef(null);
|
|
5928
5928
|
var timeoutRef = useRef(null);
|
|
5929
5929
|
var rafRef = useRef(null);
|
|
5930
|
+
var resizeObserverRef = useRef(null);
|
|
5930
5931
|
useEffect(function () {
|
|
5931
|
-
if (content
|
|
5932
|
+
if (content.current && initOpen) {
|
|
5932
5933
|
setTextHeight(content.current.scrollHeight + "px");
|
|
5933
5934
|
}
|
|
5934
|
-
}, [
|
|
5935
|
+
}, [initOpen]);
|
|
5935
5936
|
useEffect(function () {
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
setTextHeight(((_content$current$scro = (_content$current = content.current) == null ? void 0 : _content$current.scrollHeight) != null ? _content$current$scro : 0) + "px");
|
|
5940
|
-
});
|
|
5941
|
-
} else if (!openAccordion) {
|
|
5937
|
+
var el = content.current;
|
|
5938
|
+
if (!el) return;
|
|
5939
|
+
if (!openAccordion) {
|
|
5942
5940
|
setTextHeight('0px');
|
|
5941
|
+
if (resizeObserverRef.current) {
|
|
5942
|
+
resizeObserverRef.current.disconnect();
|
|
5943
|
+
resizeObserverRef.current = null;
|
|
5944
|
+
}
|
|
5945
|
+
return;
|
|
5946
|
+
}
|
|
5947
|
+
var updateHeight = function updateHeight() {
|
|
5948
|
+
setTextHeight(el.scrollHeight + "px");
|
|
5949
|
+
};
|
|
5950
|
+
rafRef.current = window.requestAnimationFrame(updateHeight);
|
|
5951
|
+
if ('ResizeObserver' in window) {
|
|
5952
|
+
var ro = new ResizeObserver(updateHeight);
|
|
5953
|
+
ro.observe(el);
|
|
5954
|
+
resizeObserverRef.current = ro;
|
|
5955
|
+
return function () {
|
|
5956
|
+
ro.disconnect();
|
|
5957
|
+
resizeObserverRef.current = null;
|
|
5958
|
+
};
|
|
5943
5959
|
}
|
|
5944
|
-
|
|
5960
|
+
return function () {
|
|
5961
|
+
if (rafRef.current) {
|
|
5962
|
+
window.cancelAnimationFrame(rafRef.current);
|
|
5963
|
+
rafRef.current = null;
|
|
5964
|
+
}
|
|
5965
|
+
};
|
|
5966
|
+
}, [openAccordion, childrenVisibility, children]);
|
|
5945
5967
|
useEffect(function () {
|
|
5946
5968
|
return function () {
|
|
5947
5969
|
if (timeoutRef.current) {
|
|
@@ -5952,6 +5974,10 @@ var Accordion = function Accordion(_ref) {
|
|
|
5952
5974
|
window.cancelAnimationFrame(rafRef.current);
|
|
5953
5975
|
rafRef.current = null;
|
|
5954
5976
|
}
|
|
5977
|
+
if (resizeObserverRef.current) {
|
|
5978
|
+
resizeObserverRef.current.disconnect();
|
|
5979
|
+
resizeObserverRef.current = null;
|
|
5980
|
+
}
|
|
5955
5981
|
};
|
|
5956
5982
|
}, []);
|
|
5957
5983
|
var toggleAccordion = function toggleAccordion() {
|
|
@@ -6000,9 +6026,9 @@ var Accordion = function Accordion(_ref) {
|
|
|
6000
6026
|
"aria-live": openAccordion ? 'polite' : 'off',
|
|
6001
6027
|
tag: "div",
|
|
6002
6028
|
size: "large"
|
|
6003
|
-
}, childrenVisibility && /*#__PURE__*/React__default.createElement(ChildrenContainer, {
|
|
6029
|
+
}, childrenVisibility && (/*#__PURE__*/React__default.createElement(ChildrenContainer, {
|
|
6004
6030
|
isVisible: childrenVisibility
|
|
6005
|
-
}, children)));
|
|
6031
|
+
}, children))));
|
|
6006
6032
|
};
|
|
6007
6033
|
|
|
6008
6034
|
var _templateObject$E;
|