@royaloperahouse/harmonic 0.7.1-g → 0.7.1-h

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.
@@ -2852,48 +2852,70 @@ var COLORS$1 = {
2852
2852
  hover: 'var(--button-secondary-hover-color)',
2853
2853
  pressed: 'var(--button-secondary-pressed-color)'
2854
2854
  };
2855
+ var isObjectWithKey = function isObjectWithKey(object, key) {
2856
+ return typeof object === 'object' && object !== null && key in object;
2857
+ };
2858
+ var hasSecondaryButtonColor = function hasSecondaryButtonColor(theme) {
2859
+ return isObjectWithKey(theme, 'colors') && isObjectWithKey(theme.colors, 'secondaryButton') && typeof theme.colors.secondaryButton === 'string';
2860
+ };
2855
2861
  var getTextColor$1 = function getTextColor(_ref) {
2856
2862
  var disabled = _ref.disabled,
2857
- textColor = _ref.textColor;
2863
+ textColor = _ref.textColor,
2864
+ theme = _ref.theme;
2858
2865
  if (disabled) {
2859
2866
  return COLORS$1.darkGrey;
2860
2867
  }
2861
2868
  if (textColor) {
2862
2869
  return "var(--color-" + textColor + ")";
2863
2870
  }
2871
+ if (hasSecondaryButtonColor(theme)) {
2872
+ return theme.colors.secondaryButton;
2873
+ }
2864
2874
  return COLORS$1["default"];
2865
2875
  };
2866
2876
  var getBorderColor = function getBorderColor(_ref2) {
2867
2877
  var disabled = _ref2.disabled,
2868
- borderColor = _ref2.borderColor;
2878
+ borderColor = _ref2.borderColor,
2879
+ theme = _ref2.theme;
2869
2880
  if (disabled) {
2870
2881
  return COLORS$1.disabled;
2871
2882
  }
2872
2883
  if (borderColor) {
2873
2884
  return "var(--color-" + borderColor + ")";
2874
2885
  }
2886
+ if (hasSecondaryButtonColor(theme)) {
2887
+ return theme.colors.secondaryButton;
2888
+ }
2875
2889
  return COLORS$1.border;
2876
2890
  };
2877
2891
  var getHoveredColor$1 = function getHoveredColor(_ref3) {
2878
2892
  var disabled = _ref3.disabled,
2879
- hoveredColor = _ref3.hoveredColor;
2893
+ hoveredColor = _ref3.hoveredColor,
2894
+ theme = _ref3.theme;
2880
2895
  if (disabled) {
2881
2896
  return COLORS$1.disabled;
2882
2897
  }
2883
2898
  if (hoveredColor) {
2884
2899
  return "var(--color-" + hoveredColor + ")";
2885
2900
  }
2901
+ if (hasSecondaryButtonColor(theme)) {
2902
+ return theme.colors.secondaryButton;
2903
+ }
2886
2904
  return COLORS$1.hover;
2887
2905
  };
2888
2906
  var getPressedColor$1 = function getPressedColor(_ref4) {
2889
2907
  var disabled = _ref4.disabled,
2890
- pressedColor = _ref4.pressedColor;
2908
+ pressedColor = _ref4.pressedColor,
2909
+ theme = _ref4.theme;
2891
2910
  if (disabled) {
2892
2911
  return COLORS$1.disabled;
2893
2912
  }
2894
2913
  if (pressedColor) {
2895
2914
  return "var(--color-" + pressedColor + ")";
2896
2915
  }
2916
+ if (hasSecondaryButtonColor(theme)) {
2917
+ return theme.colors.secondaryButton;
2918
+ }
2897
2919
  return COLORS$1.pressed;
2898
2920
  };
2899
2921
 
@@ -5790,8 +5812,12 @@ var InputContainer = /*#__PURE__*/styled.div(_templateObject5$a || (_templateObj
5790
5812
  var TextLinkWrapper$1 = /*#__PURE__*/styled(TextLink)(_templateObject6$7 || (_templateObject6$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: var(--color-primary-red);\n"])));
5791
5813
  var SearchArrowContainer = /*#__PURE__*/styled.a(_templateObject7$4 || (_templateObject7$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding-right: 8px;\n\n svg {\n width: var(--navigation-large-gap);\n height: var(--navigation-large-gap);\n }\n"])));
5792
5814
 
5793
- function useFocusTrap(containerRef, onEscape) {
5815
+ function useFocusTrap(containerRef, onEscape, enabled) {
5816
+ if (enabled === void 0) {
5817
+ enabled = true;
5818
+ }
5794
5819
  useEffect(function () {
5820
+ if (!enabled) return undefined;
5795
5821
  var container = containerRef.current;
5796
5822
  if (!container) return undefined;
5797
5823
  var focusableSelectors = 'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])';
@@ -5824,7 +5850,9 @@ var SearchBar = function SearchBar(_ref) {
5824
5850
  var onClick = _ref.onClick,
5825
5851
  onClose = _ref.onClose,
5826
5852
  className = _ref.className,
5827
- inputRef = _ref.inputRef;
5853
+ inputRef = _ref.inputRef,
5854
+ _ref$trapFocus = _ref.trapFocus,
5855
+ trapFocus = _ref$trapFocus === void 0 ? true : _ref$trapFocus;
5828
5856
  var _useState = useState(false),
5829
5857
  showSearchLink = _useState[0],
5830
5858
  setShowSearchLink = _useState[1];
@@ -5834,7 +5862,7 @@ var SearchBar = function SearchBar(_ref) {
5834
5862
  var internalRef = useRef(null);
5835
5863
  var finalInputRef = inputRef != null ? inputRef : internalRef;
5836
5864
  var containerRef = useRef(null);
5837
- useFocusTrap(containerRef, onClose);
5865
+ useFocusTrap(containerRef, onClose, trapFocus);
5838
5866
  var onSearchHandler = function onSearchHandler(value) {
5839
5867
  onClick(value);
5840
5868
  setSearchValue('');
@@ -5914,7 +5942,7 @@ var SearchBar = function SearchBar(_ref) {
5914
5942
  onClick: onCloseHandler,
5915
5943
  onKeyDown: onKeyboardCloseHandler,
5916
5944
  "data-testid": "close-icon",
5917
- "aria-label": "Close search bar"
5945
+ "aria-label": "Clear the search bar"
5918
5946
  }, /*#__PURE__*/React__default.createElement(Icon, {
5919
5947
  iconName: "Close"
5920
5948
  })));
@@ -6958,7 +6986,7 @@ var core = /*#__PURE__*/_extends({}, common, {
6958
6986
  colors: /*#__PURE__*/_extends({}, commonColors, colors, {
6959
6987
  primary: colors.core,
6960
6988
  primaryButton: colors.core,
6961
- secondaryButton: commonColors.white,
6989
+ secondaryButton: colors.core,
6962
6990
  tertiaryButton: 'transparent',
6963
6991
  auxiliaryButton: 'transparent',
6964
6992
  primaryButtonReverseBg: colors.cinema,
@@ -6971,7 +6999,7 @@ var stream = /*#__PURE__*/_extends({}, common, {
6971
6999
  primaryButton: colors.stream,
6972
7000
  primaryButtonReverseBg: colors.cinema,
6973
7001
  primaryButtonReverse: commonColors.white,
6974
- secondaryButton: commonColors.white,
7002
+ secondaryButton: colors.stream,
6975
7003
  tertiaryButton: 'transparent',
6976
7004
  auxiliaryButton: 'transparent'
6977
7005
  })
@@ -6982,7 +7010,7 @@ var cinema = /*#__PURE__*/_extends({}, common, {
6982
7010
  primaryButton: commonColors.white,
6983
7011
  primaryButtonReverseBg: commonColors.white,
6984
7012
  primaryButtonReverse: colors.cinema,
6985
- secondaryButton: commonColors.white,
7013
+ secondaryButton: colors.cinema,
6986
7014
  tertiaryButton: 'transparent',
6987
7015
  auxiliaryButton: 'transparent'
6988
7016
  })
@@ -6993,7 +7021,7 @@ var schools = /*#__PURE__*/_extends({}, common, {
6993
7021
  primaryButton: colors.core,
6994
7022
  primaryButtonReverseBg: colors.cinema,
6995
7023
  primaryButtonReverse: commonColors.white,
6996
- secondaryButton: commonColors.white,
7024
+ secondaryButton: colors.core,
6997
7025
  tertiaryButton: 'transparent',
6998
7026
  auxiliaryButton: 'transparent'
6999
7027
  }),
@@ -7083,17 +7111,23 @@ var ButtonType;
7083
7111
  })(ButtonType || (ButtonType = {}));
7084
7112
 
7085
7113
  var _templateObject$J, _templateObject2$x, _templateObject3$n, _templateObject4$i, _templateObject5$d, _templateObject6$b, _templateObject7$7, _templateObject8$4;
7086
- var Wrapper$2 = /*#__PURE__*/styled.div(_templateObject$J || (_templateObject$J = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: var(--base-color-light-grey);\n padding: 40px;\n\n display: block;\n position: relative;\n\n @media ", " {\n margin-top: 0;\n padding: 40px 20px;\n }\n"])), devices.tablet);
7114
+ var Wrapper$2 = /*#__PURE__*/styled.div(_templateObject$J || (_templateObject$J = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: var(--base-color-lightgrey);\n padding: 40px;\n\n display: block;\n position: relative;\n\n @media ", " {\n margin-top: 0;\n padding: 40px 20px;\n }\n"])), devices.tablet);
7087
7115
  var PromoLabelWrapper = /*#__PURE__*/styled.div(_templateObject2$x || (_templateObject2$x = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-self: flex-end;\n height: 15px;\n"])));
7088
7116
  var PromoLabel = /*#__PURE__*/styled.div(_templateObject3$n || (_templateObject3$n = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n color: ", ";\n padding: 6px 8px;\n width: fit-content;\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n right: 20px;\n top: 0;\n width: auto;\n margin: auto;\n font-family: var(--font-family-header);\n font-feature-settings:\n 'tnum' on,\n 'lnum' on,\n 'liga' off,\n 'calt' off;\n font-size: var(--font-size-overline-2);\n line-height: 12px;\n text-align: center;\n letter-spacing: 1px;\n text-transform: uppercase;\n"])), function (_ref) {
7089
7117
  var theme = _ref.theme;
7090
7118
  return theme.colors.primary;
7091
7119
  }, Colors.White);
7092
- var ButtonContainer = /*#__PURE__*/styled.div(_templateObject4$i || (_templateObject4$i = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 2em;\n width: fit-content;\n"])));
7120
+ var ButtonContainer = /*#__PURE__*/styled.div(_templateObject4$i || (_templateObject4$i = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 2em;\n width: fit-content;\n display: flex;\n flex-direction: row;\n gap: 20px;\n\n @media ", " {\n width: 100%;\n flex-direction: column;\n gap: 16px;\n }\n\n ", "\n"])), function (_ref2) {
7121
+ var stackCtasEarly = _ref2.stackCtasEarly;
7122
+ return stackCtasEarly ? devices.smallDesktop + ", " + devices.mobileAndTablet : devices.mobile;
7123
+ }, function (_ref3) {
7124
+ var stackCtasEarly = _ref3.stackCtasEarly;
7125
+ return stackCtasEarly && "\n @media " + devices.smallDesktop + ", " + devices.mobileAndTablet + " {\n * {\n width: 100%;\n }\n }\n ";
7126
+ });
7093
7127
  var TitleContainer$2 = /*#__PURE__*/styled.div(_templateObject5$d || (_templateObject5$d = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n & > * {\n margin-top: 0;\n margin-bottom: 0.5em;\n }\n"])));
7094
7128
  var OfferTextWrapper = /*#__PURE__*/styled.div(_templateObject6$b || (_templateObject6$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n & > * {\n margin-bottom: 0.5em;\n }\n margin-bottom: 1em;\n"])));
7095
7129
  var PriceRow = /*#__PURE__*/styled.div(_templateObject7$7 || (_templateObject7$7 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-wrap: wrap;\n gap: 6px 12px;\n padding: 5px 0 8px 0;\n"])));
7096
- var LineThrough = /*#__PURE__*/styled.div(_templateObject8$4 || (_templateObject8$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-decoration-line: line-through;\n color: var(--base-color-dark-grey);\n"])));
7130
+ var LineThrough = /*#__PURE__*/styled.div(_templateObject8$4 || (_templateObject8$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-decoration-line: line-through;\n color: var(--base-color-darkgrey);\n"])));
7097
7131
 
7098
7132
  // Set max. character length
7099
7133
  var setMaxCharLength = function setMaxCharLength(value, maxLength) {
@@ -7136,8 +7170,13 @@ var UpsellCard = function UpsellCard(_ref) {
7136
7170
  flag = _ref.flag,
7137
7171
  offerTexts = _ref.offerTexts,
7138
7172
  link = _ref.link,
7173
+ secondaryLink = _ref.secondaryLink,
7174
+ _ref$stackCtasEarly = _ref.stackCtasEarly,
7175
+ stackCtasEarly = _ref$stackCtasEarly === void 0 ? false : _ref$stackCtasEarly,
7139
7176
  _ref$theme = _ref.theme,
7140
- theme = _ref$theme === void 0 ? ThemeType.Core : _ref$theme;
7177
+ theme = _ref$theme === void 0 ? ThemeType.Core : _ref$theme,
7178
+ _ref$secondaryTheme = _ref.secondaryTheme,
7179
+ secondaryTheme = _ref$secondaryTheme === void 0 ? ThemeType.Core : _ref$secondaryTheme;
7141
7180
  var truncate = function truncate(str, n) {
7142
7181
  return str.length >= n ? str.slice(0, n) : str;
7143
7182
  };
@@ -7156,13 +7195,17 @@ var UpsellCard = function UpsellCard(_ref) {
7156
7195
  level: 4
7157
7196
  }, formatPrice(promoPrice)))) : (/*#__PURE__*/React__default.createElement(PriceRow, null, /*#__PURE__*/React__default.createElement(AltHeader, {
7158
7197
  level: 4
7159
- }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText) {
7198
+ }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText, index) {
7160
7199
  return /*#__PURE__*/React__default.createElement(OfferText, {
7161
- key: offerText.title,
7200
+ key: "offer-" + index,
7162
7201
  title: offerText.title,
7163
7202
  description: offerText.description
7164
7203
  });
7165
- }), link && (/*#__PURE__*/React__default.createElement(ButtonContainer, null, /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, link), truncate(link.text, LENGTH_SMALL_TEXT))))));
7204
+ }), ((link == null ? void 0 : link.text) || (secondaryLink == null ? void 0 : secondaryLink.text)) && (/*#__PURE__*/React__default.createElement(ButtonContainer, {
7205
+ stackCtasEarly: stackCtasEarly
7206
+ }, (link == null ? void 0 : link.text) && /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, link), truncate(link.text, LENGTH_SMALL_TEXT)), (secondaryLink == null ? void 0 : secondaryLink.text) && (/*#__PURE__*/React__default.createElement(Theme, {
7207
+ theme: secondaryTheme
7208
+ }, /*#__PURE__*/React__default.createElement(SecondaryButton, Object.assign({}, secondaryLink), truncate(secondaryLink.text, LENGTH_SMALL_TEXT))))))));
7166
7209
  };
7167
7210
 
7168
7211
  var _templateObject$K;
@@ -7172,7 +7215,7 @@ var UpsellCards = function UpsellCards(_ref) {
7172
7215
  var upsellCards = _ref.upsellCards;
7173
7216
  return /*#__PURE__*/React__default.createElement(Wrapper$3, null, upsellCards == null ? void 0 : upsellCards.map(function (card, index) {
7174
7217
  return /*#__PURE__*/React__default.createElement(UpsellCard, {
7175
- key: "upsell-card-" + index,
7218
+ key: "card-" + index,
7176
7219
  title: card.title,
7177
7220
  subTitle: card.subTitle,
7178
7221
  price: card.price,
@@ -7180,7 +7223,10 @@ var UpsellCards = function UpsellCards(_ref) {
7180
7223
  flag: card.flag,
7181
7224
  offerTexts: card.offerTexts,
7182
7225
  link: card.link,
7183
- theme: card.theme
7226
+ secondaryLink: card.secondaryLink,
7227
+ stackCtasEarly: true,
7228
+ theme: card.theme,
7229
+ secondaryTheme: card.secondaryTheme
7184
7230
  });
7185
7231
  }));
7186
7232
  };
@@ -7194,7 +7240,8 @@ var UpsellSection = function UpsellSection(_ref) {
7194
7240
  theme = _ref$theme === void 0 ? ThemeType.Core : _ref$theme;
7195
7241
  var themedUpsellCards = upsellCards ? [].concat(upsellCards).map(function (card) {
7196
7242
  return _extends({}, card, {
7197
- theme: card.theme || theme
7243
+ theme: card.theme || theme,
7244
+ secondaryTheme: card.secondaryTheme || theme
7198
7245
  });
7199
7246
  }) : [];
7200
7247
  return /*#__PURE__*/React__default.createElement(Theme, {
@@ -8710,14 +8757,16 @@ var ContentSummary = function ContentSummary(_ref) {
8710
8757
  "data-roh": "content-summary-item"
8711
8758
  }, showImage && image && (/*#__PURE__*/React__default.createElement(ContentSummaryImageWrapper, {
8712
8759
  "data-testid": "image-wrapper"
8713
- }, /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
8714
- aspectRatio: AspectRatio['4:3']
8715
8760
  }, link != null && link.href ? (/*#__PURE__*/React__default.createElement("a", {
8716
8761
  href: link.href
8762
+ }, /*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
8763
+ aspectRatio: AspectRatio['4:3']
8717
8764
  }, /*#__PURE__*/React__default.createElement("img", {
8718
8765
  src: image.src,
8719
8766
  alt: image.alt
8720
- }))) : (/*#__PURE__*/React__default.createElement("img", {
8767
+ })))) : (/*#__PURE__*/React__default.createElement(ImageAspectRatioWrapper, {
8768
+ aspectRatio: AspectRatio['4:3']
8769
+ }, /*#__PURE__*/React__default.createElement("img", {
8721
8770
  src: image.src,
8722
8771
  alt: image.alt
8723
8772
  }))))), /*#__PURE__*/React__default.createElement(ContentSummaryTextWrapper, {