@royaloperahouse/chord 0.7.44 → 0.7.45

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/chord.esm.js CHANGED
@@ -5448,7 +5448,7 @@ var PeopleListing = function PeopleListing(_ref) {
5448
5448
  }));
5449
5449
  };
5450
5450
 
5451
- var _templateObject$O, _templateObject2$w, _templateObject3$o, _templateObject4$i, _templateObject5$e, _templateObject6$b, _templateObject7$7, _templateObject8$6, _templateObject9$4, _templateObject10$3, _templateObject11$2;
5451
+ var _templateObject$O, _templateObject2$w, _templateObject3$o, _templateObject4$i, _templateObject5$e, _templateObject6$b, _templateObject7$7, _templateObject8$6, _templateObject9$4, _templateObject10$3, _templateObject11$2, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
5452
5452
  var LENGTH_TEXT = 28;
5453
5453
  var LENGTH_TEXT_TABLET$1 = 10;
5454
5454
  var PromoWithTagsGrid = /*#__PURE__*/styled(Grid)(_templateObject$O || (_templateObject$O = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n grid-template-areas: ", ";\n\n @media ", " {\n & {\n grid-template-areas: ", ";\n }\n }\n\n @media ", " {\n & {\n grid-template-columns: var(--grid-margin) minmax(0, 1fr) var(--grid-margin);\n grid-template-rows: min-content 24px min-content;\n gap: 0;\n grid-template-areas:\n 'row1 row1 row1'\n '. . .'\n '. row2 .';\n }\n }\n"])), function (_ref) {
@@ -5458,34 +5458,37 @@ var PromoWithTagsGrid = /*#__PURE__*/styled(Grid)(_templateObject$O || (_templat
5458
5458
  var imageToLeft = _ref2.imageToLeft;
5459
5459
  return imageToLeft ? "'left left left left left left left right right right right right right .'" : "'. left left left left left left right right right right right right right'";
5460
5460
  }, devices.mobile);
5461
- var PromoWithTagsImageWrapper = /*#__PURE__*/styled.div(_templateObject2$w || (_templateObject2$w = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n grid-area: ", ";\n align-self: center;\n @media ", " {\n & {\n grid-area: row1;\n }\n }\n"])), function (_ref3) {
5461
+ var PromoWithTagsExtraContentWrapper = /*#__PURE__*/styled.div(_templateObject2$w || (_templateObject2$w = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n grid-area: ", ";\n align-self: center;\n @media ", " {\n & {\n grid-area: row1;\n }\n }\n"])), function (_ref3) {
5462
5462
  var imageToLeft = _ref3.imageToLeft;
5463
5463
  return imageToLeft ? 'left' : 'right';
5464
5464
  }, devices.mobile);
5465
- var PromoWithTagsContentWrapper = /*#__PURE__*/styled.div(_templateObject3$o || (_templateObject3$o = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n grid-area: ", ";\n align-self: center;\n @media ", " {\n & {\n grid-area: row2;\n align-self: start;\n }\n }\n"])), function (_ref4) {
5465
+ var PromoWithTagsContentWrapper = /*#__PURE__*/styled.div(_templateObject3$o || (_templateObject3$o = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n grid-area: ", ";\n align-self: center;\n @media ", " {\n & {\n display: ", ";\n grid-area: row2;\n align-self: start;\n }\n }\n"])), function (_ref4) {
5466
5466
  var imageToLeft = _ref4.imageToLeft;
5467
5467
  return imageToLeft ? 'right' : 'left';
5468
- }, devices.mobile);
5468
+ }, devices.mobile, function (_ref5) {
5469
+ var hideSection = _ref5.hideSection;
5470
+ return hideSection ? 'none' : 'block';
5471
+ });
5469
5472
  var PromoWithTagsContainer = /*#__PURE__*/styled.div(_templateObject4$i || (_templateObject4$i = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n h2,\n h3 {\n margin: 0 0 16px;\n }\n"])));
5470
5473
  var PromoWithTagsSubtitle = /*#__PURE__*/styled.span(_templateObject5$e || (_templateObject5$e = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-family: var(--font-family-subtitle);\n font-feature-settings: var(--font-feature-settings-subtitle);\n font-size: var(--font-size-subtitle-1);\n font-weight: var(--font-weight-subtitle-1);\n line-height: var(--line-height-subtitle-1);\n letter-spacing: var(--letter-spacing-subtitle-1);\n text-transform: var(--text-transform-subtitle);\n margin-bottom: var(--editorial-subtitle-margin-bottom);\n display: block;\n overflow-wrap: break-word;\n"])));
5471
- var PromoWithTagsText = /*#__PURE__*/styled.div(_templateObject6$b || (_templateObject6$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-family: var(--font-family-body);\n font-feature-settings: var(--font-feature-settings-body);\n font-size: var(--font-size-body-1);\n font-weight: var(--font-weight-body-1);\n line-height: var(--line-height-body-1);\n letter-spacing: var(--letter-spacing-body-1);\n text-transform: var(--text-transform-body);\n margin: 0;\n padding: 0;\n white-space: break-spaces;\n overflow-wrap: break-word;\n\n h5,\n h6 {\n margin: 0 0 4px 0;\n font-family: var(--font-family-subtitle);\n font-feature-settings: var(--font-feature-settings-subtitle);\n font-size: var(--font-size-subtitle-2);\n font-weight: var(--font-weight-subtitle-2);\n line-height: var(--line-height-subtitle-2);\n letter-spacing: var(--letter-spacing-subtitle-2);\n text-transform: var(--text-transform-subtitle);\n overflow-wrap: break-word;\n }\n\n em {\n font-family: var(--font-family-body-italics);\n }\n\n a {\n text-decoration: underline;\n cursor: pointer;\n\n &[href^='tel:'] {\n text-decoration: none;\n }\n\n &:link {\n color: ", ";\n }\n\n &:visited {\n color: ", ";\n }\n\n &:hover {\n color: ", ";\n }\n }\n"])), function (_ref5) {
5472
- var theme = _ref5.theme;
5473
- return theme.colors.black;
5474
- }, function (_ref6) {
5474
+ var PromoWithTagsText = /*#__PURE__*/styled.div(_templateObject6$b || (_templateObject6$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-family: var(--font-family-body);\n font-feature-settings: var(--font-feature-settings-body);\n font-size: var(--font-size-body-1);\n font-weight: var(--font-weight-body-1);\n line-height: var(--line-height-body-1);\n letter-spacing: var(--letter-spacing-body-1);\n text-transform: var(--text-transform-body);\n margin: 0;\n padding: 0;\n white-space: break-spaces;\n overflow-wrap: break-word;\n\n h5,\n h6 {\n margin: 0 0 4px 0;\n font-family: var(--font-family-subtitle);\n font-feature-settings: var(--font-feature-settings-subtitle);\n font-size: var(--font-size-subtitle-2);\n font-weight: var(--font-weight-subtitle-2);\n line-height: var(--line-height-subtitle-2);\n letter-spacing: var(--letter-spacing-subtitle-2);\n text-transform: var(--text-transform-subtitle);\n overflow-wrap: break-word;\n }\n\n em {\n font-family: var(--font-family-body-italics);\n }\n\n a {\n text-decoration: underline;\n cursor: pointer;\n\n &[href^='tel:'] {\n text-decoration: none;\n }\n\n &:link {\n color: ", ";\n }\n\n &:visited {\n color: ", ";\n }\n\n &:hover {\n color: ", ";\n }\n }\n"])), function (_ref6) {
5475
5475
  var theme = _ref6.theme;
5476
- return theme.colors.darkgrey;
5476
+ return theme.colors.black;
5477
5477
  }, function (_ref7) {
5478
5478
  var theme = _ref7.theme;
5479
+ return theme.colors.darkgrey;
5480
+ }, function (_ref8) {
5481
+ var theme = _ref8.theme;
5479
5482
  return theme.colors.primary;
5480
5483
  });
5481
- var ButtonsContainer$2 = /*#__PURE__*/styled.div(_templateObject7$7 || (_templateObject7$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 16px;\n margin-top: 24px;\n\n ", ";\n\n ", "\n\n @media ", " {\n gap: 24px;\n flex-direction: column;\n align-items: center;\n }\n\n @media ", " {\n gap: 24px;\n align-items: flex-start;\n\n ", "\n }\n"])), function (_ref8) {
5482
- var hasTextLinks = _ref8.hasTextLinks;
5484
+ var ButtonsContainer$2 = /*#__PURE__*/styled.div(_templateObject7$7 || (_templateObject7$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 16px;\n margin-top: 24px;\n\n ", ";\n\n ", "\n\n @media ", " {\n gap: 24px;\n flex-direction: column;\n align-items: center;\n }\n\n @media ", " {\n gap: 24px;\n align-items: flex-start;\n\n ", "\n }\n"])), function (_ref9) {
5485
+ var hasTextLinks = _ref9.hasTextLinks;
5483
5486
  return "margin-top: " + (hasTextLinks ? '0' : '24px') + ";";
5484
- }, function (_ref9) {
5485
- var _ref9$primaryButtonTe = _ref9.primaryButtonTextLength,
5486
- primaryButtonTextLength = _ref9$primaryButtonTe === void 0 ? 0 : _ref9$primaryButtonTe,
5487
- _ref9$tertiaryButtonT = _ref9.tertiaryButtonTextLength,
5488
- tertiaryButtonTextLength = _ref9$tertiaryButtonT === void 0 ? 0 : _ref9$tertiaryButtonT;
5487
+ }, function (_ref10) {
5488
+ var _ref10$primaryButtonT = _ref10.primaryButtonTextLength,
5489
+ primaryButtonTextLength = _ref10$primaryButtonT === void 0 ? 0 : _ref10$primaryButtonT,
5490
+ _ref10$tertiaryButton = _ref10.tertiaryButtonTextLength,
5491
+ tertiaryButtonTextLength = _ref10$tertiaryButton === void 0 ? 0 : _ref10$tertiaryButton;
5489
5492
  var isLinksLayoutColumn = primaryButtonTextLength >= LENGTH_TEXT || tertiaryButtonTextLength >= LENGTH_TEXT;
5490
5493
 
5491
5494
  if (isLinksLayoutColumn) {
@@ -5493,11 +5496,11 @@ var ButtonsContainer$2 = /*#__PURE__*/styled.div(_templateObject7$7 || (_templat
5493
5496
  }
5494
5497
 
5495
5498
  return '';
5496
- }, devices.mobile, devices.tablet, function (_ref10) {
5497
- var _ref10$primaryButtonT = _ref10.primaryButtonTextLength,
5498
- primaryButtonTextLength = _ref10$primaryButtonT === void 0 ? 0 : _ref10$primaryButtonT,
5499
- _ref10$tertiaryButton = _ref10.tertiaryButtonTextLength,
5500
- tertiaryButtonTextLength = _ref10$tertiaryButton === void 0 ? 0 : _ref10$tertiaryButton;
5499
+ }, devices.mobile, devices.tablet, function (_ref11) {
5500
+ var _ref11$primaryButtonT = _ref11.primaryButtonTextLength,
5501
+ primaryButtonTextLength = _ref11$primaryButtonT === void 0 ? 0 : _ref11$primaryButtonT,
5502
+ _ref11$tertiaryButton = _ref11.tertiaryButtonTextLength,
5503
+ tertiaryButtonTextLength = _ref11$tertiaryButton === void 0 ? 0 : _ref11$tertiaryButton;
5501
5504
  var isLinksLayoutColumnTablet = primaryButtonTextLength >= LENGTH_TEXT_TABLET$1 || tertiaryButtonTextLength >= LENGTH_TEXT_TABLET$1;
5502
5505
 
5503
5506
  if (isLinksLayoutColumnTablet) {
@@ -5506,13 +5509,17 @@ var ButtonsContainer$2 = /*#__PURE__*/styled.div(_templateObject7$7 || (_templat
5506
5509
 
5507
5510
  return '';
5508
5511
  });
5509
- var PromoWithTagsTagWrapper = /*#__PURE__*/styled.div(_templateObject8$6 || (_templateObject8$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: ", ";\n"])), function (_ref11) {
5510
- var marginBottom = _ref11.marginBottom;
5512
+ var PromoWithTagsTagWrapper = /*#__PURE__*/styled.div(_templateObject8$6 || (_templateObject8$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: ", ";\n"])), function (_ref12) {
5513
+ var marginBottom = _ref12.marginBottom;
5511
5514
  return marginBottom + "px";
5512
5515
  });
5513
5516
  var PromoWithTagsAdditionalText = /*#__PURE__*/styled(PromoWithTagsText)(_templateObject9$4 || (_templateObject9$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 24px 0;\n"])));
5514
5517
  var TextLinksContainer = /*#__PURE__*/styled.div(_templateObject10$3 || (_templateObject10$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: wrap;\n margin: 24px 0 4px 0;\n"])));
5515
5518
  var TextLinkWrapper$2 = /*#__PURE__*/styled.div(_templateObject11$2 || (_templateObject11$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-right: 24px;\n margin-bottom: 20px;\n\n &:last-child {\n margin-right: 0;\n }\n"])));
5519
+ var ExtraContentWrapper = /*#__PURE__*/styled.div(_templateObject12 || (_templateObject12 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n padding-right: 68px;\n\n @media ", " {\n padding: 30px 0 0;\n }\n\n @media ", " {\n padding: 0;\n position: initial;\n }\n"])), devices.tablet, devices.mobile);
5520
+ var IconWrapper$2 = /*#__PURE__*/styled.div(_templateObject13 || (_templateObject13 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: pointer;\n position: absolute;\n top: 25px;\n right: 35px;\n width: 24px;\n height: 24px;\n\n @media ", " {\n top: 30px;\n right: 30px;\n }\n\n @media ", " {\n top: 3px;\n right: 20px;\n }\n"])), devices.tablet, devices.mobile);
5521
+ var PrimaryButtonWrapper$2 = /*#__PURE__*/styled.div(_templateObject14 || (_templateObject14 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n height: var(--button-height);\n"])));
5522
+ var MobileTitleWrapper = /*#__PURE__*/styled.div(_templateObject15 || (_templateObject15 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: none;\n margin: 0 50px 0 20px;\n\n h2,\n h3 {\n margin: 0;\n }\n\n @media ", " {\n display: block;\n }\n"])), devices.mobile);
5516
5523
 
5517
5524
  var _excluded$i = ["text"],
5518
5525
  _excluded2$2 = ["text"],
@@ -5534,7 +5541,12 @@ var PromoWithTags = function PromoWithTags(_ref) {
5534
5541
  aboveTitleTags = _ref.aboveTitleTags,
5535
5542
  belowTitleTags = _ref.belowTitleTags,
5536
5543
  middleText = _ref.middleText,
5537
- bottomText = _ref.bottomText;
5544
+ bottomText = _ref.bottomText,
5545
+ image = _ref.image;
5546
+
5547
+ var _useState = useState(false),
5548
+ showExtraContent = _useState[0],
5549
+ setShowExtraContent = _useState[1];
5538
5550
 
5539
5551
  var truncate = function truncate(str, n) {
5540
5552
  return str.length >= n ? str.substr(0, n) : str;
@@ -5542,6 +5554,19 @@ var PromoWithTags = function PromoWithTags(_ref) {
5542
5554
 
5543
5555
  var imageToLeft = imagePosition === 'left';
5544
5556
  var titleLevel = titleSize === 'large' ? 2 : 3;
5557
+ var isExtraContentPresent = !!children;
5558
+ var anchorLink = title.replace(' ', '-').toLocaleLowerCase() + "-content";
5559
+
5560
+ var handleExtraContent = function handleExtraContent(e) {
5561
+ e.preventDefault();
5562
+ setShowExtraContent(true);
5563
+
5564
+ if (window.matchMedia && window.matchMedia(devices.mobile).matches) {
5565
+ window.location.href = "#" + anchorLink;
5566
+ }
5567
+ };
5568
+
5569
+ var defaultOnClickHandler = isExtraContentPresent ? handleExtraContent : undefined;
5545
5570
  var primaryButton = links == null ? void 0 : links[0];
5546
5571
 
5547
5572
  var _ref2 = primaryButton || {},
@@ -5566,15 +5591,31 @@ var PromoWithTags = function PromoWithTags(_ref) {
5566
5591
  return /*#__PURE__*/React__default.createElement(TextLinkWrapper$2, null, /*#__PURE__*/React__default.createElement(TextLink, Object.assign({}, restTextLink), textLinkText));
5567
5592
  }) : null;
5568
5593
  return /*#__PURE__*/React__default.createElement(PromoWithTagsGrid, {
5594
+ id: anchorLink,
5569
5595
  imageToLeft: imageToLeft
5570
- }, /*#__PURE__*/React__default.createElement(PromoWithTagsImageWrapper, {
5571
- "data-testid": "image-wrapper",
5596
+ }, /*#__PURE__*/React__default.createElement(PromoWithTagsExtraContentWrapper, {
5597
+ "data-testid": "extra-content-wrapper",
5572
5598
  imageToLeft: imageToLeft
5573
- }, /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
5599
+ }, showExtraContent && /*#__PURE__*/React__default.createElement(MobileTitleWrapper, null, /*#__PURE__*/React__default.createElement(Header, {
5600
+ level: titleLevel
5601
+ }, title)), /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
5574
5602
  aspectRatio: AspectRatio['4:3']
5575
- }, children)), /*#__PURE__*/React__default.createElement(PromoWithTagsContentWrapper, {
5603
+ }, isExtraContentPresent && showExtraContent ? /*#__PURE__*/React__default.createElement(ExtraContentWrapper, null, children, /*#__PURE__*/React__default.createElement(IconWrapper$2, {
5604
+ "data-testid": "extra-content-close-button",
5605
+ onClick: function onClick() {
5606
+ return setShowExtraContent(false);
5607
+ }
5608
+ }, /*#__PURE__*/React__default.createElement(Icon, {
5609
+ iconName: "Close",
5610
+ color: Colors.Black
5611
+ }))) : image && /*#__PURE__*/React__default.createElement("img", {
5612
+ "data-testid": "promo-with-tags-image",
5613
+ src: image.src,
5614
+ alt: image.alt
5615
+ }))), /*#__PURE__*/React__default.createElement(PromoWithTagsContentWrapper, {
5576
5616
  "data-testid": "content-wrapper",
5577
- imageToLeft: imageToLeft
5617
+ imageToLeft: imageToLeft,
5618
+ hideSection: showExtraContent
5578
5619
  }, /*#__PURE__*/React__default.createElement(PromoWithTagsContainer, null, !!(aboveTitleTags != null && aboveTitleTags.length) && /*#__PURE__*/React__default.createElement(PromoWithTagsTagWrapper, {
5579
5620
  marginBottom: 16
5580
5621
  }, /*#__PURE__*/React__default.createElement(TypeTags, {
@@ -5602,7 +5643,9 @@ var PromoWithTags = function PromoWithTags(_ref) {
5602
5643
  "data-testid": "buttons-wrapper",
5603
5644
  primaryButtonTextLength: primaryButtonText.length,
5604
5645
  tertiaryButtonTextLength: tertiaryButtonText.length
5605
- }, primaryButton && /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, restPrimaryButton), primaryButtonTextTruncate), tertiaryButton && /*#__PURE__*/React__default.createElement(Button$1, Object.assign({}, restTertiaryButton), tertiaryButtonTextTruncate))));
5646
+ }, primaryButton && /*#__PURE__*/React__default.createElement(PrimaryButtonWrapper$2, null, !showExtraContent && /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({
5647
+ onClick: defaultOnClickHandler
5648
+ }, restPrimaryButton), primaryButtonTextTruncate)), tertiaryButton && /*#__PURE__*/React__default.createElement(Button$1, Object.assign({}, restTertiaryButton), tertiaryButtonTextTruncate))));
5606
5649
  };
5607
5650
 
5608
5651
  var _templateObject$P, _templateObject2$x, _templateObject3$p, _templateObject4$j, _templateObject5$f, _templateObject6$c, _templateObject7$8;