@royaloperahouse/harmonic 0.18.0 → 0.18.1
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 +3 -0
- package/dist/harmonic.cjs.development.js +20 -9
- 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 +20 -9
- package/dist/harmonic.esm.js.map +1 -1
- package/dist/types/types.d.ts +5 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5831,6 +5831,7 @@ var PrintHideWrapper = /*#__PURE__*/styled__default.div(_templateObject7$5 || (_
|
|
|
5831
5831
|
|
|
5832
5832
|
/* eslint-disable react/no-unstable-nested-components */
|
|
5833
5833
|
var Accordion = function Accordion(_ref) {
|
|
5834
|
+
var _expandedStateIcon$ic, _collapsedStateIcon$i;
|
|
5834
5835
|
var _ref$title = _ref.title,
|
|
5835
5836
|
title = _ref$title === void 0 ? '' : _ref$title,
|
|
5836
5837
|
_ref$showLine = _ref.showLine,
|
|
@@ -5838,16 +5839,26 @@ var Accordion = function Accordion(_ref) {
|
|
|
5838
5839
|
children = _ref.children,
|
|
5839
5840
|
_ref$initOpen = _ref.initOpen,
|
|
5840
5841
|
initOpen = _ref$initOpen === void 0 ? false : _ref$initOpen,
|
|
5841
|
-
className = _ref.className
|
|
5842
|
+
className = _ref.className,
|
|
5843
|
+
expandedStateIcon = _ref.expandedStateIcon,
|
|
5844
|
+
collapsedStateIcon = _ref.collapsedStateIcon;
|
|
5842
5845
|
var _useState = React.useState(initOpen),
|
|
5843
5846
|
openAccordion = _useState[0],
|
|
5844
5847
|
setOpenAccordion = _useState[1];
|
|
5845
5848
|
var _useState2 = React.useState('0px'),
|
|
5846
5849
|
textHeight = _useState2[0],
|
|
5847
5850
|
setTextHeight = _useState2[1];
|
|
5848
|
-
var
|
|
5849
|
-
iconName =
|
|
5850
|
-
|
|
5851
|
+
var expandedStateIconData = {
|
|
5852
|
+
iconName: (_expandedStateIcon$ic = expandedStateIcon == null ? void 0 : expandedStateIcon.iconName) != null ? _expandedStateIcon$ic : 'Detract',
|
|
5853
|
+
direction: expandedStateIcon == null ? void 0 : expandedStateIcon.direction
|
|
5854
|
+
};
|
|
5855
|
+
var collapsedStateIconData = {
|
|
5856
|
+
iconName: (_collapsedStateIcon$i = collapsedStateIcon == null ? void 0 : collapsedStateIcon.iconName) != null ? _collapsedStateIcon$i : 'Expand',
|
|
5857
|
+
direction: collapsedStateIcon == null ? void 0 : collapsedStateIcon.direction
|
|
5858
|
+
};
|
|
5859
|
+
var _useState3 = React.useState(initOpen ? expandedStateIconData : collapsedStateIconData),
|
|
5860
|
+
icon = _useState3[0],
|
|
5861
|
+
setIcon = _useState3[1];
|
|
5851
5862
|
// Contents children visibility is set to prevent it from being keyboard tabbable when the accordion is closed
|
|
5852
5863
|
var _useState4 = React.useState(initOpen),
|
|
5853
5864
|
childrenVisibility = _useState4[0],
|
|
@@ -5862,7 +5873,7 @@ var Accordion = function Accordion(_ref) {
|
|
|
5862
5873
|
if (!children) return;
|
|
5863
5874
|
setOpenAccordion(!openAccordion);
|
|
5864
5875
|
setTextHeight(openAccordion ? '0px' : content.current.scrollHeight + "px");
|
|
5865
|
-
|
|
5876
|
+
setIcon(openAccordion ? collapsedStateIconData : expandedStateIconData);
|
|
5866
5877
|
setChildrenVisibility(!openAccordion);
|
|
5867
5878
|
};
|
|
5868
5879
|
var keyDown = function keyDown(e) {
|
|
@@ -5884,9 +5895,7 @@ var Accordion = function Accordion(_ref) {
|
|
|
5884
5895
|
"aria-expanded": openAccordion,
|
|
5885
5896
|
"aria-controls": contentContainerId,
|
|
5886
5897
|
hasChildren: !!children
|
|
5887
|
-
}, /*#__PURE__*/React__default.createElement(TitleText, null, title), children && (/*#__PURE__*/React__default.createElement(PrintHideWrapper, null, /*#__PURE__*/React__default.createElement(Icon, {
|
|
5888
|
-
iconName: iconName
|
|
5889
|
-
})))), /*#__PURE__*/React__default.createElement(ContentContainer, {
|
|
5898
|
+
}, /*#__PURE__*/React__default.createElement(TitleText, null, title), children && (/*#__PURE__*/React__default.createElement(PrintHideWrapper, null, /*#__PURE__*/React__default.createElement(Icon, Object.assign({}, icon))))), /*#__PURE__*/React__default.createElement(ContentContainer, {
|
|
5890
5899
|
"data-testid": "richcontainer",
|
|
5891
5900
|
ref: content,
|
|
5892
5901
|
textHeight: textHeight,
|
|
@@ -5915,7 +5924,9 @@ var Accordions = function Accordions(_ref) {
|
|
|
5915
5924
|
return /*#__PURE__*/React__default.createElement(Accordion, {
|
|
5916
5925
|
key: accordion.title + "-" + index,
|
|
5917
5926
|
title: accordion.title,
|
|
5918
|
-
showLine: isLastAccordion(index)
|
|
5927
|
+
showLine: isLastAccordion(index),
|
|
5928
|
+
expandedStateIcon: accordion.expandedStateIcon,
|
|
5929
|
+
collapsedStateIcon: accordion.collapsedStateIcon
|
|
5919
5930
|
}, accordion.children);
|
|
5920
5931
|
}));
|
|
5921
5932
|
};
|