@royaloperahouse/chord 0.7.48 → 0.7.49

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,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [0.7.49]
4
+ - Extend Card component with secondary CTA
5
+ - Hover effect is optional for CTAs
6
+
3
7
  ## [0.7.48]
4
8
  - Add background themes to Information component
5
9
 
@@ -2086,6 +2086,50 @@ var PrimaryButtonWrapper = /*#__PURE__*/styled__default(Button)(_templateObject$
2086
2086
  ThemeType["Cinema"] = "cinema";
2087
2087
  })(exports.ThemeType || (exports.ThemeType = {}));
2088
2088
 
2089
+ (function (CarouselType) {
2090
+ CarouselType["Image"] = "image";
2091
+ CarouselType["SmallCard"] = "SmallCard";
2092
+ CarouselType["LargeCard"] = "LargeCard";
2093
+ })(exports.CarouselType || (exports.CarouselType = {}));
2094
+
2095
+ (function (AspectRatio) {
2096
+ AspectRatio["1:1"] = "1 / 1";
2097
+ AspectRatio["3:4"] = "3 / 4";
2098
+ AspectRatio["4:3"] = "4 / 3";
2099
+ AspectRatio["16:9"] = "16 / 9";
2100
+ })(exports.AspectRatio || (exports.AspectRatio = {}));
2101
+
2102
+ var AspectRatioLegacy;
2103
+
2104
+ (function (AspectRatioLegacy) {
2105
+ AspectRatioLegacy["1 / 1"] = "100";
2106
+ AspectRatioLegacy["3 / 4"] = "133";
2107
+ AspectRatioLegacy["4 / 3"] = "75";
2108
+ AspectRatioLegacy["16 / 9"] = "56.25";
2109
+ })(AspectRatioLegacy || (AspectRatioLegacy = {}));
2110
+
2111
+ var AspectRatioWidth;
2112
+
2113
+ (function (AspectRatioWidth) {
2114
+ AspectRatioWidth["1 / 1"] = "1";
2115
+ AspectRatioWidth["3 / 4"] = "0.75";
2116
+ AspectRatioWidth["4 / 3"] = "1.33";
2117
+ AspectRatioWidth["16 / 9"] = "1.78";
2118
+ })(AspectRatioWidth || (AspectRatioWidth = {}));
2119
+
2120
+ (function (TickboxMode) {
2121
+ TickboxMode["Dark"] = "dark";
2122
+ TickboxMode["Light"] = "light";
2123
+ })(exports.TickboxMode || (exports.TickboxMode = {}));
2124
+
2125
+ var ButtonType;
2126
+
2127
+ (function (ButtonType) {
2128
+ ButtonType["Primary"] = "Primary";
2129
+ ButtonType["Secondary"] = "Secondary";
2130
+ ButtonType["Tertiary"] = "Tertiary";
2131
+ })(ButtonType || (ButtonType = {}));
2132
+
2089
2133
  var _excluded$1 = ["children"];
2090
2134
 
2091
2135
  var PrimaryButton = function PrimaryButton(_ref) {
@@ -2654,31 +2698,6 @@ var SectionSplitter = function SectionSplitter(_ref) {
2654
2698
  }, /*#__PURE__*/React__default.createElement(Splitter, null)));
2655
2699
  };
2656
2700
 
2657
- (function (AspectRatio) {
2658
- AspectRatio["1:1"] = "1 / 1";
2659
- AspectRatio["3:4"] = "3 / 4";
2660
- AspectRatio["4:3"] = "4 / 3";
2661
- AspectRatio["16:9"] = "16 / 9";
2662
- })(exports.AspectRatio || (exports.AspectRatio = {}));
2663
-
2664
- var AspectRatioLegacy;
2665
-
2666
- (function (AspectRatioLegacy) {
2667
- AspectRatioLegacy["1 / 1"] = "100";
2668
- AspectRatioLegacy["3 / 4"] = "133";
2669
- AspectRatioLegacy["4 / 3"] = "75";
2670
- AspectRatioLegacy["16 / 9"] = "56.25";
2671
- })(AspectRatioLegacy || (AspectRatioLegacy = {}));
2672
-
2673
- var AspectRatioWidth;
2674
-
2675
- (function (AspectRatioWidth) {
2676
- AspectRatioWidth["1 / 1"] = "1";
2677
- AspectRatioWidth["3 / 4"] = "0.75";
2678
- AspectRatioWidth["4 / 3"] = "1.33";
2679
- AspectRatioWidth["16 / 9"] = "1.78";
2680
- })(AspectRatioWidth || (AspectRatioWidth = {}));
2681
-
2682
2701
  var _templateObject$f;
2683
2702
  var ImageAspectRatioWrapper = /*#__PURE__*/styled__default.div(_templateObject$f || (_templateObject$f = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n aspect-ratio: ", ";\n\n @supports not (aspect-ratio: ", ") {\n position: relative;\n width: 100%;\n padding-top: ", "%;\n }\n\n img {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n\n @supports not (aspect-ratio: ", ") {\n position: absolute;\n top: 0;\n left: 0;\n }\n }\n"])), function (_ref) {
2684
2703
  var _ref$aspectRatio = _ref.aspectRatio,
@@ -3008,11 +3027,6 @@ var TickboxInput = /*#__PURE__*/styled__default.input(_templateObject3$2 || (_te
3008
3027
  return dark ? 'black' : 'white';
3009
3028
  });
3010
3029
 
3011
- (function (TickboxMode) {
3012
- TickboxMode["Dark"] = "dark";
3013
- TickboxMode["Light"] = "light";
3014
- })(exports.TickboxMode || (exports.TickboxMode = {}));
3015
-
3016
3030
  var Tickbox = function Tickbox(_ref) {
3017
3031
  var children = _ref.children,
3018
3032
  _ref$mode = _ref.mode,
@@ -4193,12 +4207,6 @@ var AnchorTabBar = function AnchorTabBar(_ref) {
4193
4207
  })) : null) : null))));
4194
4208
  };
4195
4209
 
4196
- (function (CarouselType) {
4197
- CarouselType["Image"] = "image";
4198
- CarouselType["SmallCard"] = "SmallCard";
4199
- CarouselType["LargeCard"] = "LargeCard";
4200
- })(exports.CarouselType || (exports.CarouselType = {}));
4201
-
4202
4210
  var _templateObject$y, _templateObject2$i, _templateObject3$c, _templateObject4$8, _templateObject5$5;
4203
4211
  var CarouselWrapper = /*#__PURE__*/styled__default.div(_templateObject$y || (_templateObject$y = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n user-select: none;\n\n ", "\n\n @media ", " {\n ", "\n }\n"])), function (_ref) {
4204
4212
  var type = _ref.type,
@@ -4916,10 +4924,16 @@ var TitleContainer$2 = /*#__PURE__*/styled__default.div(_templateObject5$8 || (_
4916
4924
  var TitleContainerMobile = /*#__PURE__*/styled__default.div(_templateObject6$7 || (_templateObject6$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: calc(-1 * var(--editorial-margin-between)) 0 calc(-1 * var(--editorial-margin-between)) 0;\n display: none;\n\n @media ", " {\n display: block;\n }\n"])), devices.mobileAndTablet);
4917
4925
  var TextContainer = /*#__PURE__*/styled__default.div(_templateObject7$4 || (_templateObject7$4 = /*#__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-top: var(--editorial-spacing-hover);\n padding: 0;\n white-space: break-spaces;\n overflow-wrap: break-word;\n\n em {\n font-family: var(--font-family-body-italics);\n }\n"])));
4918
4926
  var SubtitleContainer = /*#__PURE__*/styled__default.span(_templateObject8$4 || (_templateObject8$4 = /*#__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-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 display: block;\n overflow-wrap: break-word;\n"])));
4919
- var ButtonsContainer$1 = /*#__PURE__*/styled__default.div(_templateObject9$3 || (_templateObject9$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n opacity: 0;\n display: flex;\n gap: 16px;\n margin-top: var(--editorial-margin-between);\n\n ", "\n\n @media ", " {\n opacity: 1 !important;\n gap: 24px;\n margin-top: 24px;\n flex-direction: column;\n align-items: center;\n }\n\n @media ", " {\n opacity: 1 !important;\n gap: 24px;\n margin-top: 24px;\n align-items: flex-start;\n\n ", "\n }\n"])), function (_ref3) {
4920
- var size = _ref3.size,
4921
- primaryButtonTextLength = _ref3.primaryButtonTextLength,
4922
- tertiaryButtonTextLength = _ref3.tertiaryButtonTextLength;
4927
+
4928
+ var getButtonsOpacity = function getButtonsOpacity(_ref3) {
4929
+ var onlyShowButtonsOnHover = _ref3.onlyShowButtonsOnHover;
4930
+ return onlyShowButtonsOnHover ? 'opacity: 0;' : 'opacity: 1;';
4931
+ };
4932
+
4933
+ var ButtonsContainer$1 = /*#__PURE__*/styled__default.div(_templateObject9$3 || (_templateObject9$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n ", ";\n display: flex;\n gap: 16px;\n margin-top: var(--editorial-margin-between);\n\n ", "\n\n @media ", " {\n opacity: 1 !important;\n gap: 24px;\n margin-top: 24px;\n flex-direction: column;\n align-items: center;\n }\n\n @media ", " {\n opacity: 1 !important;\n gap: 24px;\n margin-top: 24px;\n align-items: flex-start;\n\n ", "\n }\n"])), getButtonsOpacity, function (_ref4) {
4934
+ var size = _ref4.size,
4935
+ primaryButtonTextLength = _ref4.primaryButtonTextLength,
4936
+ tertiaryButtonTextLength = _ref4.tertiaryButtonTextLength;
4923
4937
  var isLinksLayoutColumn = size === 'small' ? primaryButtonTextLength >= LENGTH_SMALL_TEXT || tertiaryButtonTextLength >= LENGTH_SMALL_TEXT : primaryButtonTextLength >= LENGTH_LARGE_TEXT || tertiaryButtonTextLength >= LENGTH_LARGE_TEXT;
4924
4938
 
4925
4939
  if (isLinksLayoutColumn) {
@@ -4927,9 +4941,9 @@ var ButtonsContainer$1 = /*#__PURE__*/styled__default.div(_templateObject9$3 ||
4927
4941
  }
4928
4942
 
4929
4943
  return '';
4930
- }, devices.mobile, devices.tablet, function (_ref4) {
4931
- var primaryButtonTextLength = _ref4.primaryButtonTextLength,
4932
- tertiaryButtonTextLength = _ref4.tertiaryButtonTextLength;
4944
+ }, devices.mobile, devices.tablet, function (_ref5) {
4945
+ var primaryButtonTextLength = _ref5.primaryButtonTextLength,
4946
+ tertiaryButtonTextLength = _ref5.tertiaryButtonTextLength;
4933
4947
  var isLinksLayoutColumnTablet = primaryButtonTextLength >= LENGTH_TEXT_TABLET || tertiaryButtonTextLength >= LENGTH_TEXT_TABLET;
4934
4948
 
4935
4949
  if (isLinksLayoutColumnTablet) {
@@ -4964,8 +4978,11 @@ var Progress = function Progress(_ref) {
4964
4978
 
4965
4979
  var _excluded$c = ["text"],
4966
4980
  _excluded2$1 = ["text"];
4981
+
4982
+ var _buttonTypeToButton;
4967
4983
  var LENGTH_LARGE_TEXT$1 = 28;
4968
4984
  var LENGTH_SMALL_TEXT$1 = 19;
4985
+ var buttonTypeToButton = (_buttonTypeToButton = {}, _buttonTypeToButton[ButtonType.Primary] = PrimaryButton, _buttonTypeToButton[ButtonType.Secondary] = SecondaryButton, _buttonTypeToButton[ButtonType.Tertiary] = Button$1, _buttonTypeToButton);
4969
4986
 
4970
4987
  var Card = function Card(_ref) {
4971
4988
  var _ref$progress = _ref.progress,
@@ -4986,7 +5003,9 @@ var Card = function Card(_ref) {
4986
5003
  _ref$size = _ref.size,
4987
5004
  size = _ref$size === void 0 ? 'small' : _ref$size,
4988
5005
  _ref$fullWidth = _ref.fullWidth,
4989
- fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth;
5006
+ fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
5007
+ _ref$onlyShowButtonsO = _ref.onlyShowButtonsOnHover,
5008
+ onlyShowButtonsOnHover = _ref$onlyShowButtonsO === void 0 ? true : _ref$onlyShowButtonsO;
4990
5009
 
4991
5010
  var truncate = function truncate(str, n) {
4992
5011
  return str.length >= n ? str.substr(0, n) : str;
@@ -4999,35 +5018,35 @@ var Card = function Card(_ref) {
4999
5018
  setHovered = _useState[1];
5000
5019
 
5001
5020
  var truncatedText = truncateHtmlString(text, 185, true);
5002
- var primaryButton = links == null ? void 0 : links[0];
5021
+ var firstButton = links == null ? void 0 : links[0];
5003
5022
 
5004
- var _ref2 = primaryButton || {},
5023
+ var _ref2 = firstButton || {},
5005
5024
  _ref2$text = _ref2.text,
5006
- primaryButtonText = _ref2$text === void 0 ? '' : _ref2$text,
5007
- restPrimaryButton = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
5025
+ firstButtonText = _ref2$text === void 0 ? '' : _ref2$text,
5026
+ restFirstButton = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
5008
5027
 
5009
- var primaryButtonTextTruncate = size === 'small' ? truncate(primaryButtonText, LENGTH_SMALL_TEXT$1) : truncate(primaryButtonText, LENGTH_LARGE_TEXT$1);
5010
- var tertiaryButton = links == null ? void 0 : links[1];
5028
+ var primaryButtonTextTruncate = size === 'small' ? truncate(firstButtonText, LENGTH_SMALL_TEXT$1) : truncate(firstButtonText, LENGTH_LARGE_TEXT$1);
5029
+ var secondButton = links == null ? void 0 : links[1];
5011
5030
 
5012
- var _ref3 = tertiaryButton || {},
5031
+ var _ref3 = secondButton || {},
5013
5032
  _ref3$text = _ref3.text,
5014
- tertiaryButtonText = _ref3$text === void 0 ? '' : _ref3$text,
5015
- restTertiaryButton = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
5016
-
5017
- var tertiaryButtonTextTruncate = size === 'small' ? truncate(tertiaryButtonText, LENGTH_SMALL_TEXT$1) : truncate(tertiaryButtonText, LENGTH_LARGE_TEXT$1);
5033
+ secondButtonText = _ref3$text === void 0 ? '' : _ref3$text,
5034
+ restSecondButton = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
5018
5035
 
5019
- var hoverHandler = function hoverHandler(value) {
5036
+ var tertiaryButtonTextTruncate = size === 'small' ? truncate(secondButtonText, LENGTH_SMALL_TEXT$1) : truncate(secondButtonText, LENGTH_LARGE_TEXT$1);
5037
+ var hoverHandler = onlyShowButtonsOnHover ? function (value) {
5020
5038
  if (value) {
5021
5039
  node.current.style.opacity = '1';
5022
5040
  node.current.style.transition = 'opacity 0.3s';
5023
- } else {
5024
- node.current.style.opacity = '0';
5025
- node.current.style.transition = 'opacity 0.3s';
5041
+ return;
5026
5042
  }
5027
5043
 
5044
+ node.current.style.opacity = '0';
5045
+ node.current.style.transition = 'opacity 0.3s';
5028
5046
  setHovered(value);
5029
- };
5030
-
5047
+ } : function () {};
5048
+ var FirstButtonComponent = firstButton != null && firstButton.buttonType ? buttonTypeToButton[firstButton.buttonType] : PrimaryButton;
5049
+ var SecondButtonComponent = secondButton != null && secondButton.buttonType ? buttonTypeToButton[secondButton.buttonType] : Button$1;
5031
5050
  return /*#__PURE__*/React__default.createElement(CardContainer, {
5032
5051
  onMouseOver: function onMouseOver() {
5033
5052
  return hoverHandler(true);
@@ -5037,8 +5056,8 @@ var Card = function Card(_ref) {
5037
5056
  },
5038
5057
  "data-testid": "cardcontainer"
5039
5058
  }, ' ', /*#__PURE__*/React__default.createElement("a", {
5040
- href: primaryButton == null ? void 0 : primaryButton.href,
5041
- target: primaryButton == null ? void 0 : primaryButton.target,
5059
+ href: firstButton == null ? void 0 : firstButton.href,
5060
+ target: firstButton == null ? void 0 : firstButton.target,
5042
5061
  className: "targetLink"
5043
5062
  }, hovered && /*#__PURE__*/React__default.createElement(HoverContainer, {
5044
5063
  "data-testid": "hovercontainer"
@@ -5049,12 +5068,8 @@ var Card = function Card(_ref) {
5049
5068
  alt: imageAltText
5050
5069
  })), withContinueWatching && /*#__PURE__*/React__default.createElement(ProgressContainer, null, /*#__PURE__*/React__default.createElement(Progress, {
5051
5070
  progress: progress
5052
- }))), /*#__PURE__*/React__default.createElement(ContentContainer$2, {
5071
+ })), /*#__PURE__*/React__default.createElement(ContentContainer$2, {
5053
5072
  fullWidth: fullWidth
5054
- }, /*#__PURE__*/React__default.createElement("a", {
5055
- href: primaryButton == null ? void 0 : primaryButton.href,
5056
- target: primaryButton == null ? void 0 : primaryButton.target,
5057
- className: "targetLink"
5058
5073
  }, tags ? /*#__PURE__*/React__default.createElement(TypeTags, {
5059
5074
  list: tags
5060
5075
  }) : null, /*#__PURE__*/React__default.createElement(TitleContainer$2, null, /*#__PURE__*/React__default.createElement(Header, {
@@ -5065,13 +5080,14 @@ var Card = function Card(_ref) {
5065
5080
  dangerouslySetInnerHTML: {
5066
5081
  __html: truncatedText
5067
5082
  }
5068
- })), links ? /*#__PURE__*/React__default.createElement(ButtonsContainer$1, {
5083
+ }))), links && /*#__PURE__*/React__default.createElement(ButtonsContainer$1, {
5069
5084
  ref: node,
5070
5085
  "data-testid": "buttonscontainer",
5071
5086
  size: size,
5072
- primaryButtonTextLength: primaryButtonText.length,
5073
- tertiaryButtonTextLength: tertiaryButtonText.length
5074
- }, primaryButton ? /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, restPrimaryButton), primaryButtonTextTruncate) : null, tertiaryButton ? /*#__PURE__*/React__default.createElement(Button$1, Object.assign({}, restTertiaryButton), tertiaryButtonTextTruncate) : null) : null));
5087
+ primaryButtonTextLength: firstButtonText.length,
5088
+ tertiaryButtonTextLength: secondButtonText.length,
5089
+ onlyShowButtonsOnHover: onlyShowButtonsOnHover
5090
+ }, firstButton && /*#__PURE__*/React__default.createElement(FirstButtonComponent, Object.assign({}, restFirstButton), primaryButtonTextTruncate), secondButton && /*#__PURE__*/React__default.createElement(SecondButtonComponent, Object.assign({}, restSecondButton), tertiaryButtonTextTruncate)));
5075
5091
  };
5076
5092
 
5077
5093
  var _templateObject$H, _templateObject2$q;
@@ -5108,7 +5124,8 @@ var Cards = function Cards(_ref) {
5108
5124
  text: card.text,
5109
5125
  links: card.links,
5110
5126
  tags: card.tags,
5111
- withContinueWatching: card.withContinueWatching
5127
+ withContinueWatching: card.withContinueWatching,
5128
+ onlyShowButtonsOnHover: card.onlyShowButtonsOnHover
5112
5129
  }));
5113
5130
  }));
5114
5131
  };