@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/dist/chord.esm.js CHANGED
@@ -2082,6 +2082,56 @@ var ThemeType;
2082
2082
  ThemeType["Cinema"] = "cinema";
2083
2083
  })(ThemeType || (ThemeType = {}));
2084
2084
 
2085
+ var CarouselType;
2086
+
2087
+ (function (CarouselType) {
2088
+ CarouselType["Image"] = "image";
2089
+ CarouselType["SmallCard"] = "SmallCard";
2090
+ CarouselType["LargeCard"] = "LargeCard";
2091
+ })(CarouselType || (CarouselType = {}));
2092
+
2093
+ var AspectRatio;
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
+ })(AspectRatio || (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
+ var TickboxMode;
2121
+
2122
+ (function (TickboxMode) {
2123
+ TickboxMode["Dark"] = "dark";
2124
+ TickboxMode["Light"] = "light";
2125
+ })(TickboxMode || (TickboxMode = {}));
2126
+
2127
+ var ButtonType;
2128
+
2129
+ (function (ButtonType) {
2130
+ ButtonType["Primary"] = "Primary";
2131
+ ButtonType["Secondary"] = "Secondary";
2132
+ ButtonType["Tertiary"] = "Tertiary";
2133
+ })(ButtonType || (ButtonType = {}));
2134
+
2085
2135
  var _excluded$1 = ["children"];
2086
2136
 
2087
2137
  var PrimaryButton = function PrimaryButton(_ref) {
@@ -2650,33 +2700,6 @@ var SectionSplitter = function SectionSplitter(_ref) {
2650
2700
  }, /*#__PURE__*/React__default.createElement(Splitter, null)));
2651
2701
  };
2652
2702
 
2653
- var AspectRatio;
2654
-
2655
- (function (AspectRatio) {
2656
- AspectRatio["1:1"] = "1 / 1";
2657
- AspectRatio["3:4"] = "3 / 4";
2658
- AspectRatio["4:3"] = "4 / 3";
2659
- AspectRatio["16:9"] = "16 / 9";
2660
- })(AspectRatio || (AspectRatio = {}));
2661
-
2662
- var AspectRatioLegacy;
2663
-
2664
- (function (AspectRatioLegacy) {
2665
- AspectRatioLegacy["1 / 1"] = "100";
2666
- AspectRatioLegacy["3 / 4"] = "133";
2667
- AspectRatioLegacy["4 / 3"] = "75";
2668
- AspectRatioLegacy["16 / 9"] = "56.25";
2669
- })(AspectRatioLegacy || (AspectRatioLegacy = {}));
2670
-
2671
- var AspectRatioWidth;
2672
-
2673
- (function (AspectRatioWidth) {
2674
- AspectRatioWidth["1 / 1"] = "1";
2675
- AspectRatioWidth["3 / 4"] = "0.75";
2676
- AspectRatioWidth["4 / 3"] = "1.33";
2677
- AspectRatioWidth["16 / 9"] = "1.78";
2678
- })(AspectRatioWidth || (AspectRatioWidth = {}));
2679
-
2680
2703
  var _templateObject$f;
2681
2704
  var ImageAspectRatioWrapper = /*#__PURE__*/styled.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) {
2682
2705
  var _ref$aspectRatio = _ref.aspectRatio,
@@ -3006,13 +3029,6 @@ var TickboxInput = /*#__PURE__*/styled.input(_templateObject3$2 || (_templateObj
3006
3029
  return dark ? 'black' : 'white';
3007
3030
  });
3008
3031
 
3009
- var TickboxMode;
3010
-
3011
- (function (TickboxMode) {
3012
- TickboxMode["Dark"] = "dark";
3013
- TickboxMode["Light"] = "light";
3014
- })(TickboxMode || (TickboxMode = {}));
3015
-
3016
3032
  var Tickbox = function Tickbox(_ref) {
3017
3033
  var children = _ref.children,
3018
3034
  _ref$mode = _ref.mode,
@@ -4193,14 +4209,6 @@ var AnchorTabBar = function AnchorTabBar(_ref) {
4193
4209
  })) : null) : null))));
4194
4210
  };
4195
4211
 
4196
- var CarouselType;
4197
-
4198
- (function (CarouselType) {
4199
- CarouselType["Image"] = "image";
4200
- CarouselType["SmallCard"] = "SmallCard";
4201
- CarouselType["LargeCard"] = "LargeCard";
4202
- })(CarouselType || (CarouselType = {}));
4203
-
4204
4212
  var _templateObject$y, _templateObject2$i, _templateObject3$c, _templateObject4$8, _templateObject5$5;
4205
4213
  var CarouselWrapper = /*#__PURE__*/styled.div(_templateObject$y || (_templateObject$y = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n user-select: none;\n\n ", "\n\n @media ", " {\n ", "\n }\n"])), function (_ref) {
4206
4214
  var type = _ref.type,
@@ -4918,10 +4926,16 @@ var TitleContainer$2 = /*#__PURE__*/styled.div(_templateObject5$8 || (_templateO
4918
4926
  var TitleContainerMobile = /*#__PURE__*/styled.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);
4919
4927
  var TextContainer = /*#__PURE__*/styled.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"])));
4920
4928
  var SubtitleContainer = /*#__PURE__*/styled.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"])));
4921
- var ButtonsContainer$1 = /*#__PURE__*/styled.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) {
4922
- var size = _ref3.size,
4923
- primaryButtonTextLength = _ref3.primaryButtonTextLength,
4924
- tertiaryButtonTextLength = _ref3.tertiaryButtonTextLength;
4929
+
4930
+ var getButtonsOpacity = function getButtonsOpacity(_ref3) {
4931
+ var onlyShowButtonsOnHover = _ref3.onlyShowButtonsOnHover;
4932
+ return onlyShowButtonsOnHover ? 'opacity: 0;' : 'opacity: 1;';
4933
+ };
4934
+
4935
+ var ButtonsContainer$1 = /*#__PURE__*/styled.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) {
4936
+ var size = _ref4.size,
4937
+ primaryButtonTextLength = _ref4.primaryButtonTextLength,
4938
+ tertiaryButtonTextLength = _ref4.tertiaryButtonTextLength;
4925
4939
  var isLinksLayoutColumn = size === 'small' ? primaryButtonTextLength >= LENGTH_SMALL_TEXT || tertiaryButtonTextLength >= LENGTH_SMALL_TEXT : primaryButtonTextLength >= LENGTH_LARGE_TEXT || tertiaryButtonTextLength >= LENGTH_LARGE_TEXT;
4926
4940
 
4927
4941
  if (isLinksLayoutColumn) {
@@ -4929,9 +4943,9 @@ var ButtonsContainer$1 = /*#__PURE__*/styled.div(_templateObject9$3 || (_templat
4929
4943
  }
4930
4944
 
4931
4945
  return '';
4932
- }, devices.mobile, devices.tablet, function (_ref4) {
4933
- var primaryButtonTextLength = _ref4.primaryButtonTextLength,
4934
- tertiaryButtonTextLength = _ref4.tertiaryButtonTextLength;
4946
+ }, devices.mobile, devices.tablet, function (_ref5) {
4947
+ var primaryButtonTextLength = _ref5.primaryButtonTextLength,
4948
+ tertiaryButtonTextLength = _ref5.tertiaryButtonTextLength;
4935
4949
  var isLinksLayoutColumnTablet = primaryButtonTextLength >= LENGTH_TEXT_TABLET || tertiaryButtonTextLength >= LENGTH_TEXT_TABLET;
4936
4950
 
4937
4951
  if (isLinksLayoutColumnTablet) {
@@ -4966,8 +4980,11 @@ var Progress = function Progress(_ref) {
4966
4980
 
4967
4981
  var _excluded$c = ["text"],
4968
4982
  _excluded2$1 = ["text"];
4983
+
4984
+ var _buttonTypeToButton;
4969
4985
  var LENGTH_LARGE_TEXT$1 = 28;
4970
4986
  var LENGTH_SMALL_TEXT$1 = 19;
4987
+ var buttonTypeToButton = (_buttonTypeToButton = {}, _buttonTypeToButton[ButtonType.Primary] = PrimaryButton, _buttonTypeToButton[ButtonType.Secondary] = SecondaryButton, _buttonTypeToButton[ButtonType.Tertiary] = Button$1, _buttonTypeToButton);
4971
4988
 
4972
4989
  var Card = function Card(_ref) {
4973
4990
  var _ref$progress = _ref.progress,
@@ -4988,7 +5005,9 @@ var Card = function Card(_ref) {
4988
5005
  _ref$size = _ref.size,
4989
5006
  size = _ref$size === void 0 ? 'small' : _ref$size,
4990
5007
  _ref$fullWidth = _ref.fullWidth,
4991
- fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth;
5008
+ fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
5009
+ _ref$onlyShowButtonsO = _ref.onlyShowButtonsOnHover,
5010
+ onlyShowButtonsOnHover = _ref$onlyShowButtonsO === void 0 ? true : _ref$onlyShowButtonsO;
4992
5011
 
4993
5012
  var truncate = function truncate(str, n) {
4994
5013
  return str.length >= n ? str.substr(0, n) : str;
@@ -5001,35 +5020,35 @@ var Card = function Card(_ref) {
5001
5020
  setHovered = _useState[1];
5002
5021
 
5003
5022
  var truncatedText = truncateHtmlString(text, 185, true);
5004
- var primaryButton = links == null ? void 0 : links[0];
5023
+ var firstButton = links == null ? void 0 : links[0];
5005
5024
 
5006
- var _ref2 = primaryButton || {},
5025
+ var _ref2 = firstButton || {},
5007
5026
  _ref2$text = _ref2.text,
5008
- primaryButtonText = _ref2$text === void 0 ? '' : _ref2$text,
5009
- restPrimaryButton = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
5027
+ firstButtonText = _ref2$text === void 0 ? '' : _ref2$text,
5028
+ restFirstButton = _objectWithoutPropertiesLoose(_ref2, _excluded$c);
5010
5029
 
5011
- var primaryButtonTextTruncate = size === 'small' ? truncate(primaryButtonText, LENGTH_SMALL_TEXT$1) : truncate(primaryButtonText, LENGTH_LARGE_TEXT$1);
5012
- var tertiaryButton = links == null ? void 0 : links[1];
5030
+ var primaryButtonTextTruncate = size === 'small' ? truncate(firstButtonText, LENGTH_SMALL_TEXT$1) : truncate(firstButtonText, LENGTH_LARGE_TEXT$1);
5031
+ var secondButton = links == null ? void 0 : links[1];
5013
5032
 
5014
- var _ref3 = tertiaryButton || {},
5033
+ var _ref3 = secondButton || {},
5015
5034
  _ref3$text = _ref3.text,
5016
- tertiaryButtonText = _ref3$text === void 0 ? '' : _ref3$text,
5017
- restTertiaryButton = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
5018
-
5019
- var tertiaryButtonTextTruncate = size === 'small' ? truncate(tertiaryButtonText, LENGTH_SMALL_TEXT$1) : truncate(tertiaryButtonText, LENGTH_LARGE_TEXT$1);
5035
+ secondButtonText = _ref3$text === void 0 ? '' : _ref3$text,
5036
+ restSecondButton = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
5020
5037
 
5021
- var hoverHandler = function hoverHandler(value) {
5038
+ var tertiaryButtonTextTruncate = size === 'small' ? truncate(secondButtonText, LENGTH_SMALL_TEXT$1) : truncate(secondButtonText, LENGTH_LARGE_TEXT$1);
5039
+ var hoverHandler = onlyShowButtonsOnHover ? function (value) {
5022
5040
  if (value) {
5023
5041
  node.current.style.opacity = '1';
5024
5042
  node.current.style.transition = 'opacity 0.3s';
5025
- } else {
5026
- node.current.style.opacity = '0';
5027
- node.current.style.transition = 'opacity 0.3s';
5043
+ return;
5028
5044
  }
5029
5045
 
5046
+ node.current.style.opacity = '0';
5047
+ node.current.style.transition = 'opacity 0.3s';
5030
5048
  setHovered(value);
5031
- };
5032
-
5049
+ } : function () {};
5050
+ var FirstButtonComponent = firstButton != null && firstButton.buttonType ? buttonTypeToButton[firstButton.buttonType] : PrimaryButton;
5051
+ var SecondButtonComponent = secondButton != null && secondButton.buttonType ? buttonTypeToButton[secondButton.buttonType] : Button$1;
5033
5052
  return /*#__PURE__*/React__default.createElement(CardContainer, {
5034
5053
  onMouseOver: function onMouseOver() {
5035
5054
  return hoverHandler(true);
@@ -5039,8 +5058,8 @@ var Card = function Card(_ref) {
5039
5058
  },
5040
5059
  "data-testid": "cardcontainer"
5041
5060
  }, ' ', /*#__PURE__*/React__default.createElement("a", {
5042
- href: primaryButton == null ? void 0 : primaryButton.href,
5043
- target: primaryButton == null ? void 0 : primaryButton.target,
5061
+ href: firstButton == null ? void 0 : firstButton.href,
5062
+ target: firstButton == null ? void 0 : firstButton.target,
5044
5063
  className: "targetLink"
5045
5064
  }, hovered && /*#__PURE__*/React__default.createElement(HoverContainer, {
5046
5065
  "data-testid": "hovercontainer"
@@ -5051,12 +5070,8 @@ var Card = function Card(_ref) {
5051
5070
  alt: imageAltText
5052
5071
  })), withContinueWatching && /*#__PURE__*/React__default.createElement(ProgressContainer, null, /*#__PURE__*/React__default.createElement(Progress, {
5053
5072
  progress: progress
5054
- }))), /*#__PURE__*/React__default.createElement(ContentContainer$2, {
5073
+ })), /*#__PURE__*/React__default.createElement(ContentContainer$2, {
5055
5074
  fullWidth: fullWidth
5056
- }, /*#__PURE__*/React__default.createElement("a", {
5057
- href: primaryButton == null ? void 0 : primaryButton.href,
5058
- target: primaryButton == null ? void 0 : primaryButton.target,
5059
- className: "targetLink"
5060
5075
  }, tags ? /*#__PURE__*/React__default.createElement(TypeTags, {
5061
5076
  list: tags
5062
5077
  }) : null, /*#__PURE__*/React__default.createElement(TitleContainer$2, null, /*#__PURE__*/React__default.createElement(Header, {
@@ -5067,13 +5082,14 @@ var Card = function Card(_ref) {
5067
5082
  dangerouslySetInnerHTML: {
5068
5083
  __html: truncatedText
5069
5084
  }
5070
- })), links ? /*#__PURE__*/React__default.createElement(ButtonsContainer$1, {
5085
+ }))), links && /*#__PURE__*/React__default.createElement(ButtonsContainer$1, {
5071
5086
  ref: node,
5072
5087
  "data-testid": "buttonscontainer",
5073
5088
  size: size,
5074
- primaryButtonTextLength: primaryButtonText.length,
5075
- tertiaryButtonTextLength: tertiaryButtonText.length
5076
- }, primaryButton ? /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, restPrimaryButton), primaryButtonTextTruncate) : null, tertiaryButton ? /*#__PURE__*/React__default.createElement(Button$1, Object.assign({}, restTertiaryButton), tertiaryButtonTextTruncate) : null) : null));
5089
+ primaryButtonTextLength: firstButtonText.length,
5090
+ tertiaryButtonTextLength: secondButtonText.length,
5091
+ onlyShowButtonsOnHover: onlyShowButtonsOnHover
5092
+ }, firstButton && /*#__PURE__*/React__default.createElement(FirstButtonComponent, Object.assign({}, restFirstButton), primaryButtonTextTruncate), secondButton && /*#__PURE__*/React__default.createElement(SecondButtonComponent, Object.assign({}, restSecondButton), tertiaryButtonTextTruncate)));
5077
5093
  };
5078
5094
 
5079
5095
  var _templateObject$H, _templateObject2$q;
@@ -5110,7 +5126,8 @@ var Cards = function Cards(_ref) {
5110
5126
  text: card.text,
5111
5127
  links: card.links,
5112
5128
  tags: card.tags,
5113
- withContinueWatching: card.withContinueWatching
5129
+ withContinueWatching: card.withContinueWatching,
5130
+ onlyShowButtonsOnHover: card.onlyShowButtonsOnHover
5114
5131
  }));
5115
5132
  }));
5116
5133
  };