@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
|
@@ -5902,21 +5902,43 @@ var Accordion = function Accordion(_ref) {
|
|
|
5902
5902
|
var content = React.useRef(null);
|
|
5903
5903
|
var timeoutRef = React.useRef(null);
|
|
5904
5904
|
var rafRef = React.useRef(null);
|
|
5905
|
+
var resizeObserverRef = React.useRef(null);
|
|
5905
5906
|
React.useEffect(function () {
|
|
5906
|
-
if (content
|
|
5907
|
+
if (content.current && initOpen) {
|
|
5907
5908
|
setTextHeight(content.current.scrollHeight + "px");
|
|
5908
5909
|
}
|
|
5909
|
-
}, [
|
|
5910
|
+
}, [initOpen]);
|
|
5910
5911
|
React.useEffect(function () {
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
setTextHeight(((_content$current$scro = (_content$current = content.current) == null ? void 0 : _content$current.scrollHeight) != null ? _content$current$scro : 0) + "px");
|
|
5915
|
-
});
|
|
5916
|
-
} else if (!openAccordion) {
|
|
5912
|
+
var el = content.current;
|
|
5913
|
+
if (!el) return;
|
|
5914
|
+
if (!openAccordion) {
|
|
5917
5915
|
setTextHeight('0px');
|
|
5916
|
+
if (resizeObserverRef.current) {
|
|
5917
|
+
resizeObserverRef.current.disconnect();
|
|
5918
|
+
resizeObserverRef.current = null;
|
|
5919
|
+
}
|
|
5920
|
+
return;
|
|
5921
|
+
}
|
|
5922
|
+
var updateHeight = function updateHeight() {
|
|
5923
|
+
setTextHeight(el.scrollHeight + "px");
|
|
5924
|
+
};
|
|
5925
|
+
rafRef.current = window.requestAnimationFrame(updateHeight);
|
|
5926
|
+
if ('ResizeObserver' in window) {
|
|
5927
|
+
var ro = new ResizeObserver(updateHeight);
|
|
5928
|
+
ro.observe(el);
|
|
5929
|
+
resizeObserverRef.current = ro;
|
|
5930
|
+
return function () {
|
|
5931
|
+
ro.disconnect();
|
|
5932
|
+
resizeObserverRef.current = null;
|
|
5933
|
+
};
|
|
5918
5934
|
}
|
|
5919
|
-
|
|
5935
|
+
return function () {
|
|
5936
|
+
if (rafRef.current) {
|
|
5937
|
+
window.cancelAnimationFrame(rafRef.current);
|
|
5938
|
+
rafRef.current = null;
|
|
5939
|
+
}
|
|
5940
|
+
};
|
|
5941
|
+
}, [openAccordion, childrenVisibility, children]);
|
|
5920
5942
|
React.useEffect(function () {
|
|
5921
5943
|
return function () {
|
|
5922
5944
|
if (timeoutRef.current) {
|
|
@@ -5927,6 +5949,10 @@ var Accordion = function Accordion(_ref) {
|
|
|
5927
5949
|
window.cancelAnimationFrame(rafRef.current);
|
|
5928
5950
|
rafRef.current = null;
|
|
5929
5951
|
}
|
|
5952
|
+
if (resizeObserverRef.current) {
|
|
5953
|
+
resizeObserverRef.current.disconnect();
|
|
5954
|
+
resizeObserverRef.current = null;
|
|
5955
|
+
}
|
|
5930
5956
|
};
|
|
5931
5957
|
}, []);
|
|
5932
5958
|
var toggleAccordion = function toggleAccordion() {
|
|
@@ -5975,9 +6001,9 @@ var Accordion = function Accordion(_ref) {
|
|
|
5975
6001
|
"aria-live": openAccordion ? 'polite' : 'off',
|
|
5976
6002
|
tag: "div",
|
|
5977
6003
|
size: "large"
|
|
5978
|
-
}, childrenVisibility && /*#__PURE__*/React__default.createElement(ChildrenContainer, {
|
|
6004
|
+
}, childrenVisibility && (/*#__PURE__*/React__default.createElement(ChildrenContainer, {
|
|
5979
6005
|
isVisible: childrenVisibility
|
|
5980
|
-
}, children)));
|
|
6006
|
+
}, children))));
|
|
5981
6007
|
};
|
|
5982
6008
|
|
|
5983
6009
|
var _templateObject$E;
|