@royaloperahouse/chord 0.7.5 → 0.7.6

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
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [0.7.6]
4
+ - Add new initOpen prop to Accordion component
5
+
3
6
  ## [0.7.5]
4
7
  - Fix Styling in PeopleListing on Desktop
5
8
 
@@ -4596,9 +4596,11 @@ var Accordion = function Accordion(_ref) {
4596
4596
  title = _ref$title === void 0 ? '' : _ref$title,
4597
4597
  _ref$showLine = _ref.showLine,
4598
4598
  showLine = _ref$showLine === void 0 ? true : _ref$showLine,
4599
- children = _ref.children;
4599
+ children = _ref.children,
4600
+ _ref$initOpen = _ref.initOpen,
4601
+ initOpen = _ref$initOpen === void 0 ? false : _ref$initOpen;
4600
4602
 
4601
- var _useState = React.useState(false),
4603
+ var _useState = React.useState(initOpen),
4602
4604
  openAccordion = _useState[0],
4603
4605
  setOpenAccordion = _useState[1];
4604
4606
 
@@ -4606,11 +4608,16 @@ var Accordion = function Accordion(_ref) {
4606
4608
  textHeight = _useState2[0],
4607
4609
  setTextHeight = _useState2[1];
4608
4610
 
4609
- var _useState3 = React.useState('Expand'),
4611
+ var _useState3 = React.useState(initOpen ? 'Detract' : 'Expand'),
4610
4612
  iconName = _useState3[0],
4611
4613
  setIconName = _useState3[1];
4612
4614
 
4613
4615
  var content = React.useRef(null);
4616
+ React.useEffect(function () {
4617
+ if (content != null && content.current && initOpen) {
4618
+ setTextHeight(content.current.scrollHeight + "px");
4619
+ }
4620
+ }, [content, initOpen]);
4614
4621
 
4615
4622
  var toggleAccordion = function toggleAccordion() {
4616
4623
  setOpenAccordion(!openAccordion);