@royaloperahouse/harmonic 0.8.0 → 0.9.1

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
 
@@ -6959,7 +6981,7 @@ var core = /*#__PURE__*/_extends({}, common, {
6959
6981
  colors: /*#__PURE__*/_extends({}, commonColors, colors, {
6960
6982
  primary: colors.core,
6961
6983
  primaryButton: colors.core,
6962
- secondaryButton: commonColors.white,
6984
+ secondaryButton: colors.core,
6963
6985
  tertiaryButton: 'transparent',
6964
6986
  auxiliaryButton: 'transparent',
6965
6987
  primaryButtonReverseBg: colors.cinema,
@@ -6972,7 +6994,7 @@ var stream = /*#__PURE__*/_extends({}, common, {
6972
6994
  primaryButton: colors.stream,
6973
6995
  primaryButtonReverseBg: colors.cinema,
6974
6996
  primaryButtonReverse: commonColors.white,
6975
- secondaryButton: commonColors.white,
6997
+ secondaryButton: colors.stream,
6976
6998
  tertiaryButton: 'transparent',
6977
6999
  auxiliaryButton: 'transparent'
6978
7000
  })
@@ -6983,7 +7005,7 @@ var cinema = /*#__PURE__*/_extends({}, common, {
6983
7005
  primaryButton: commonColors.white,
6984
7006
  primaryButtonReverseBg: commonColors.white,
6985
7007
  primaryButtonReverse: colors.cinema,
6986
- secondaryButton: commonColors.white,
7008
+ secondaryButton: colors.cinema,
6987
7009
  tertiaryButton: 'transparent',
6988
7010
  auxiliaryButton: 'transparent'
6989
7011
  })
@@ -6994,7 +7016,7 @@ var schools = /*#__PURE__*/_extends({}, common, {
6994
7016
  primaryButton: colors.core,
6995
7017
  primaryButtonReverseBg: colors.cinema,
6996
7018
  primaryButtonReverse: commonColors.white,
6997
- secondaryButton: commonColors.white,
7019
+ secondaryButton: colors.core,
6998
7020
  tertiaryButton: 'transparent',
6999
7021
  auxiliaryButton: 'transparent'
7000
7022
  }),
@@ -7084,17 +7106,23 @@ var ButtonType;
7084
7106
  })(ButtonType || (ButtonType = {}));
7085
7107
 
7086
7108
  var _templateObject$J, _templateObject2$x, _templateObject3$n, _templateObject4$i, _templateObject5$d, _templateObject6$b, _templateObject7$7, _templateObject8$4;
7087
- 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);
7109
+ 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);
7088
7110
  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"])));
7089
7111
  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) {
7090
7112
  var theme = _ref.theme;
7091
7113
  return theme.colors.primary;
7092
7114
  }, Colors.White);
7093
- var ButtonContainer = /*#__PURE__*/styled.div(_templateObject4$i || (_templateObject4$i = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 2em;\n width: fit-content;\n"])));
7115
+ 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) {
7116
+ var stackCtasEarly = _ref2.stackCtasEarly;
7117
+ return stackCtasEarly ? devices.smallDesktop + ", " + devices.mobileAndTablet : devices.mobile;
7118
+ }, function (_ref3) {
7119
+ var stackCtasEarly = _ref3.stackCtasEarly;
7120
+ return stackCtasEarly && "\n @media " + devices.smallDesktop + ", " + devices.mobileAndTablet + " {\n * {\n width: 100%;\n }\n }\n ";
7121
+ });
7094
7122
  var TitleContainer$2 = /*#__PURE__*/styled.div(_templateObject5$d || (_templateObject5$d = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n & > * {\n margin-top: 0;\n margin-bottom: 0.5em;\n }\n"])));
7095
7123
  var OfferTextWrapper = /*#__PURE__*/styled.div(_templateObject6$b || (_templateObject6$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n & > * {\n margin-bottom: 0.5em;\n }\n margin-bottom: 1em;\n"])));
7096
7124
  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"])));
7097
- 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"])));
7125
+ var LineThrough = /*#__PURE__*/styled.div(_templateObject8$4 || (_templateObject8$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-decoration-line: line-through;\n color: var(--base-color-darkgrey);\n"])));
7098
7126
 
7099
7127
  // Set max. character length
7100
7128
  var setMaxCharLength = function setMaxCharLength(value, maxLength) {
@@ -7137,8 +7165,13 @@ var UpsellCard = function UpsellCard(_ref) {
7137
7165
  flag = _ref.flag,
7138
7166
  offerTexts = _ref.offerTexts,
7139
7167
  link = _ref.link,
7168
+ secondaryLink = _ref.secondaryLink,
7169
+ _ref$stackCtasEarly = _ref.stackCtasEarly,
7170
+ stackCtasEarly = _ref$stackCtasEarly === void 0 ? false : _ref$stackCtasEarly,
7140
7171
  _ref$theme = _ref.theme,
7141
- theme = _ref$theme === void 0 ? ThemeType.Core : _ref$theme;
7172
+ theme = _ref$theme === void 0 ? ThemeType.Core : _ref$theme,
7173
+ _ref$secondaryTheme = _ref.secondaryTheme,
7174
+ secondaryTheme = _ref$secondaryTheme === void 0 ? ThemeType.Core : _ref$secondaryTheme;
7142
7175
  var truncate = function truncate(str, n) {
7143
7176
  return str.length >= n ? str.slice(0, n) : str;
7144
7177
  };
@@ -7157,13 +7190,17 @@ var UpsellCard = function UpsellCard(_ref) {
7157
7190
  level: 4
7158
7191
  }, formatPrice(promoPrice)))) : (/*#__PURE__*/React__default.createElement(PriceRow, null, /*#__PURE__*/React__default.createElement(AltHeader, {
7159
7192
  level: 4
7160
- }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText) {
7193
+ }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText, index) {
7161
7194
  return /*#__PURE__*/React__default.createElement(OfferText, {
7162
- key: offerText.title,
7195
+ key: "offer-" + index,
7163
7196
  title: offerText.title,
7164
7197
  description: offerText.description
7165
7198
  });
7166
- }), link && (/*#__PURE__*/React__default.createElement(ButtonContainer, null, /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, link), truncate(link.text, LENGTH_SMALL_TEXT))))));
7199
+ }), ((link == null ? void 0 : link.text) || (secondaryLink == null ? void 0 : secondaryLink.text)) && (/*#__PURE__*/React__default.createElement(ButtonContainer, {
7200
+ stackCtasEarly: stackCtasEarly
7201
+ }, (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, {
7202
+ theme: secondaryTheme
7203
+ }, /*#__PURE__*/React__default.createElement(SecondaryButton, Object.assign({}, secondaryLink), truncate(secondaryLink.text, LENGTH_SMALL_TEXT))))))));
7167
7204
  };
7168
7205
 
7169
7206
  var _templateObject$K;
@@ -7173,7 +7210,7 @@ var UpsellCards = function UpsellCards(_ref) {
7173
7210
  var upsellCards = _ref.upsellCards;
7174
7211
  return /*#__PURE__*/React__default.createElement(Wrapper$3, null, upsellCards == null ? void 0 : upsellCards.map(function (card, index) {
7175
7212
  return /*#__PURE__*/React__default.createElement(UpsellCard, {
7176
- key: "upsell-card-" + index,
7213
+ key: "card-" + index,
7177
7214
  title: card.title,
7178
7215
  subTitle: card.subTitle,
7179
7216
  price: card.price,
@@ -7181,7 +7218,10 @@ var UpsellCards = function UpsellCards(_ref) {
7181
7218
  flag: card.flag,
7182
7219
  offerTexts: card.offerTexts,
7183
7220
  link: card.link,
7184
- theme: card.theme
7221
+ secondaryLink: card.secondaryLink,
7222
+ stackCtasEarly: true,
7223
+ theme: card.theme,
7224
+ secondaryTheme: card.secondaryTheme
7185
7225
  });
7186
7226
  }));
7187
7227
  };
@@ -7195,7 +7235,8 @@ var UpsellSection = function UpsellSection(_ref) {
7195
7235
  theme = _ref$theme === void 0 ? ThemeType.Core : _ref$theme;
7196
7236
  var themedUpsellCards = upsellCards ? [].concat(upsellCards).map(function (card) {
7197
7237
  return _extends({}, card, {
7198
- theme: card.theme || theme
7238
+ theme: card.theme || theme,
7239
+ secondaryTheme: card.secondaryTheme || theme
7199
7240
  });
7200
7241
  }) : [];
7201
7242
  return /*#__PURE__*/React__default.createElement(Theme, {
@@ -8801,14 +8842,13 @@ var _excluded$k = ["text", "onClick"];
8801
8842
  var HotFilters = function HotFilters(_ref) {
8802
8843
  var items = _ref.items,
8803
8844
  className = _ref.className,
8804
- defaultSelectedIndex = _ref.defaultSelectedIndex;
8805
- var _useState = useState(defaultSelectedIndex != null ? defaultSelectedIndex : 0),
8806
- selectedIndex = _useState[0],
8807
- setSelectedIndex = _useState[1];
8808
- var handleClick = function handleClick(index, onClick) {
8809
- setSelectedIndex(index);
8845
+ _ref$selectedIndex = _ref.selectedIndex,
8846
+ selectedIndex = _ref$selectedIndex === void 0 ? 0 : _ref$selectedIndex,
8847
+ onSelect = _ref.onSelect;
8848
+ var handleClick = React__default.useCallback(function (index, onClick) {
8849
+ if (onSelect) onSelect(index);
8810
8850
  if (onClick) onClick();
8811
- };
8851
+ }, [onSelect]);
8812
8852
  return /*#__PURE__*/React__default.createElement(HotFiltersWrapper, {
8813
8853
  className: className
8814
8854
  }, /*#__PURE__*/React__default.createElement(HotFilterOptionsWrapper, null, items.map(function (item, index) {
@@ -8825,7 +8865,8 @@ var HotFilters = function HotFilters(_ref) {
8825
8865
  backgroundColor: isSelected ? 'base-black' : 'base-white',
8826
8866
  textColor: isSelected ? 'base-white' : 'base-black',
8827
8867
  hoveredColor: "base-black",
8828
- pressedColor: "black-pressed"
8868
+ pressedColor: "black-pressed",
8869
+ "aria-pressed": isSelected
8829
8870
  }, rest), text);
8830
8871
  })));
8831
8872
  };