@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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [0.9.0]
2
+ - Upsell Card, Upsell Cards, Upsell section:
3
+ - Add secondary CTA
4
+ - Update device styling
5
+
1
6
  ## [0.2.3]
2
7
  - Restyle PromoWithTitle component
3
8
 
@@ -8,7 +8,7 @@ export declare const COLORS: {
8
8
  readonly hover: "var(--button-secondary-hover-color)";
9
9
  readonly pressed: "var(--button-secondary-pressed-color)";
10
10
  };
11
- export declare const getTextColor: ({ disabled, textColor }: SecondaryButtonProps) => string;
12
- export declare const getBorderColor: ({ disabled, borderColor }: SecondaryButtonProps) => string;
13
- export declare const getHoveredColor: ({ disabled, hoveredColor }: SecondaryButtonProps) => string;
14
- export declare const getPressedColor: ({ disabled, pressedColor }: SecondaryButtonProps) => string;
11
+ export declare const getTextColor: ({ disabled, textColor, theme }: SecondaryButtonProps) => string;
12
+ export declare const getBorderColor: ({ disabled, borderColor, theme }: SecondaryButtonProps) => string;
13
+ export declare const getHoveredColor: ({ disabled, hoveredColor, theme }: SecondaryButtonProps) => string;
14
+ export declare const getPressedColor: ({ disabled, pressedColor, theme }: SecondaryButtonProps) => string;
@@ -7,7 +7,9 @@ declare type WithColor = {
7
7
  export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
8
  export declare const PromoLabelWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
9
9
  export declare const PromoLabel: import("styled-components").StyledComponent<"div", any, WithColor, never>;
10
- export declare const ButtonContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
10
+ export declare const ButtonContainer: import("styled-components").StyledComponent<"div", any, {
11
+ stackCtasEarly: boolean;
12
+ }, never>;
11
13
  export declare const TitleContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
12
14
  export declare const OfferTextWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
13
15
  export declare const PriceRow: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -2829,48 +2829,70 @@ var COLORS$1 = {
2829
2829
  hover: 'var(--button-secondary-hover-color)',
2830
2830
  pressed: 'var(--button-secondary-pressed-color)'
2831
2831
  };
2832
+ var isObjectWithKey = function isObjectWithKey(object, key) {
2833
+ return typeof object === 'object' && object !== null && key in object;
2834
+ };
2835
+ var hasSecondaryButtonColor = function hasSecondaryButtonColor(theme) {
2836
+ return isObjectWithKey(theme, 'colors') && isObjectWithKey(theme.colors, 'secondaryButton') && typeof theme.colors.secondaryButton === 'string';
2837
+ };
2832
2838
  var getTextColor$1 = function getTextColor(_ref) {
2833
2839
  var disabled = _ref.disabled,
2834
- textColor = _ref.textColor;
2840
+ textColor = _ref.textColor,
2841
+ theme = _ref.theme;
2835
2842
  if (disabled) {
2836
2843
  return COLORS$1.darkGrey;
2837
2844
  }
2838
2845
  if (textColor) {
2839
2846
  return "var(--color-" + textColor + ")";
2840
2847
  }
2848
+ if (hasSecondaryButtonColor(theme)) {
2849
+ return theme.colors.secondaryButton;
2850
+ }
2841
2851
  return COLORS$1["default"];
2842
2852
  };
2843
2853
  var getBorderColor = function getBorderColor(_ref2) {
2844
2854
  var disabled = _ref2.disabled,
2845
- borderColor = _ref2.borderColor;
2855
+ borderColor = _ref2.borderColor,
2856
+ theme = _ref2.theme;
2846
2857
  if (disabled) {
2847
2858
  return COLORS$1.disabled;
2848
2859
  }
2849
2860
  if (borderColor) {
2850
2861
  return "var(--color-" + borderColor + ")";
2851
2862
  }
2863
+ if (hasSecondaryButtonColor(theme)) {
2864
+ return theme.colors.secondaryButton;
2865
+ }
2852
2866
  return COLORS$1.border;
2853
2867
  };
2854
2868
  var getHoveredColor$1 = function getHoveredColor(_ref3) {
2855
2869
  var disabled = _ref3.disabled,
2856
- hoveredColor = _ref3.hoveredColor;
2870
+ hoveredColor = _ref3.hoveredColor,
2871
+ theme = _ref3.theme;
2857
2872
  if (disabled) {
2858
2873
  return COLORS$1.disabled;
2859
2874
  }
2860
2875
  if (hoveredColor) {
2861
2876
  return "var(--color-" + hoveredColor + ")";
2862
2877
  }
2878
+ if (hasSecondaryButtonColor(theme)) {
2879
+ return theme.colors.secondaryButton;
2880
+ }
2863
2881
  return COLORS$1.hover;
2864
2882
  };
2865
2883
  var getPressedColor$1 = function getPressedColor(_ref4) {
2866
2884
  var disabled = _ref4.disabled,
2867
- pressedColor = _ref4.pressedColor;
2885
+ pressedColor = _ref4.pressedColor,
2886
+ theme = _ref4.theme;
2868
2887
  if (disabled) {
2869
2888
  return COLORS$1.disabled;
2870
2889
  }
2871
2890
  if (pressedColor) {
2872
2891
  return "var(--color-" + pressedColor + ")";
2873
2892
  }
2893
+ if (hasSecondaryButtonColor(theme)) {
2894
+ return theme.colors.secondaryButton;
2895
+ }
2874
2896
  return COLORS$1.pressed;
2875
2897
  };
2876
2898
 
@@ -6934,7 +6956,7 @@ var core = /*#__PURE__*/_extends({}, common, {
6934
6956
  colors: /*#__PURE__*/_extends({}, commonColors, colors, {
6935
6957
  primary: colors.core,
6936
6958
  primaryButton: colors.core,
6937
- secondaryButton: commonColors.white,
6959
+ secondaryButton: colors.core,
6938
6960
  tertiaryButton: 'transparent',
6939
6961
  auxiliaryButton: 'transparent',
6940
6962
  primaryButtonReverseBg: colors.cinema,
@@ -6947,7 +6969,7 @@ var stream = /*#__PURE__*/_extends({}, common, {
6947
6969
  primaryButton: colors.stream,
6948
6970
  primaryButtonReverseBg: colors.cinema,
6949
6971
  primaryButtonReverse: commonColors.white,
6950
- secondaryButton: commonColors.white,
6972
+ secondaryButton: colors.stream,
6951
6973
  tertiaryButton: 'transparent',
6952
6974
  auxiliaryButton: 'transparent'
6953
6975
  })
@@ -6958,7 +6980,7 @@ var cinema = /*#__PURE__*/_extends({}, common, {
6958
6980
  primaryButton: commonColors.white,
6959
6981
  primaryButtonReverseBg: commonColors.white,
6960
6982
  primaryButtonReverse: colors.cinema,
6961
- secondaryButton: commonColors.white,
6983
+ secondaryButton: colors.cinema,
6962
6984
  tertiaryButton: 'transparent',
6963
6985
  auxiliaryButton: 'transparent'
6964
6986
  })
@@ -6969,7 +6991,7 @@ var schools = /*#__PURE__*/_extends({}, common, {
6969
6991
  primaryButton: colors.core,
6970
6992
  primaryButtonReverseBg: colors.cinema,
6971
6993
  primaryButtonReverse: commonColors.white,
6972
- secondaryButton: commonColors.white,
6994
+ secondaryButton: colors.core,
6973
6995
  tertiaryButton: 'transparent',
6974
6996
  auxiliaryButton: 'transparent'
6975
6997
  }),
@@ -7057,17 +7079,23 @@ var TextOnly = function TextOnly(_ref) {
7057
7079
  })(exports.ButtonType || (exports.ButtonType = {}));
7058
7080
 
7059
7081
  var _templateObject$J, _templateObject2$x, _templateObject3$n, _templateObject4$i, _templateObject5$d, _templateObject6$b, _templateObject7$7, _templateObject8$4;
7060
- var Wrapper$2 = /*#__PURE__*/styled__default.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);
7082
+ var Wrapper$2 = /*#__PURE__*/styled__default.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);
7061
7083
  var PromoLabelWrapper = /*#__PURE__*/styled__default.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"])));
7062
7084
  var PromoLabel = /*#__PURE__*/styled__default.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) {
7063
7085
  var theme = _ref.theme;
7064
7086
  return theme.colors.primary;
7065
7087
  }, exports.Colors.White);
7066
- var ButtonContainer = /*#__PURE__*/styled__default.div(_templateObject4$i || (_templateObject4$i = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-top: 2em;\n width: fit-content;\n"])));
7088
+ var ButtonContainer = /*#__PURE__*/styled__default.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) {
7089
+ var stackCtasEarly = _ref2.stackCtasEarly;
7090
+ return stackCtasEarly ? devices.smallDesktop + ", " + devices.mobileAndTablet : devices.mobile;
7091
+ }, function (_ref3) {
7092
+ var stackCtasEarly = _ref3.stackCtasEarly;
7093
+ return stackCtasEarly && "\n @media " + devices.smallDesktop + ", " + devices.mobileAndTablet + " {\n * {\n width: 100%;\n }\n }\n ";
7094
+ });
7067
7095
  var TitleContainer$2 = /*#__PURE__*/styled__default.div(_templateObject5$d || (_templateObject5$d = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n & > * {\n margin-top: 0;\n margin-bottom: 0.5em;\n }\n"])));
7068
7096
  var OfferTextWrapper = /*#__PURE__*/styled__default.div(_templateObject6$b || (_templateObject6$b = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n & > * {\n margin-bottom: 0.5em;\n }\n margin-bottom: 1em;\n"])));
7069
7097
  var PriceRow = /*#__PURE__*/styled__default.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"])));
7070
- var LineThrough = /*#__PURE__*/styled__default.div(_templateObject8$4 || (_templateObject8$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-decoration-line: line-through;\n color: var(--base-color-dark-grey);\n"])));
7098
+ var LineThrough = /*#__PURE__*/styled__default.div(_templateObject8$4 || (_templateObject8$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n text-decoration-line: line-through;\n color: var(--base-color-darkgrey);\n"])));
7071
7099
 
7072
7100
  // Set max. character length
7073
7101
  var setMaxCharLength = function setMaxCharLength(value, maxLength) {
@@ -7110,8 +7138,13 @@ var UpsellCard = function UpsellCard(_ref) {
7110
7138
  flag = _ref.flag,
7111
7139
  offerTexts = _ref.offerTexts,
7112
7140
  link = _ref.link,
7141
+ secondaryLink = _ref.secondaryLink,
7142
+ _ref$stackCtasEarly = _ref.stackCtasEarly,
7143
+ stackCtasEarly = _ref$stackCtasEarly === void 0 ? false : _ref$stackCtasEarly,
7113
7144
  _ref$theme = _ref.theme,
7114
- theme = _ref$theme === void 0 ? exports.ThemeType.Core : _ref$theme;
7145
+ theme = _ref$theme === void 0 ? exports.ThemeType.Core : _ref$theme,
7146
+ _ref$secondaryTheme = _ref.secondaryTheme,
7147
+ secondaryTheme = _ref$secondaryTheme === void 0 ? exports.ThemeType.Core : _ref$secondaryTheme;
7115
7148
  var truncate = function truncate(str, n) {
7116
7149
  return str.length >= n ? str.slice(0, n) : str;
7117
7150
  };
@@ -7130,13 +7163,17 @@ var UpsellCard = function UpsellCard(_ref) {
7130
7163
  level: 4
7131
7164
  }, formatPrice(promoPrice)))) : (/*#__PURE__*/React__default.createElement(PriceRow, null, /*#__PURE__*/React__default.createElement(AltHeader, {
7132
7165
  level: 4
7133
- }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText) {
7166
+ }, formatPrice(price))))), (reducedOfferTexts == null ? void 0 : reducedOfferTexts.length) && reducedOfferTexts.map(function (offerText, index) {
7134
7167
  return /*#__PURE__*/React__default.createElement(OfferText, {
7135
- key: offerText.title,
7168
+ key: "offer-" + index,
7136
7169
  title: offerText.title,
7137
7170
  description: offerText.description
7138
7171
  });
7139
- }), link && (/*#__PURE__*/React__default.createElement(ButtonContainer, null, /*#__PURE__*/React__default.createElement(PrimaryButton, Object.assign({}, link), truncate(link.text, LENGTH_SMALL_TEXT))))));
7172
+ }), ((link == null ? void 0 : link.text) || (secondaryLink == null ? void 0 : secondaryLink.text)) && (/*#__PURE__*/React__default.createElement(ButtonContainer, {
7173
+ stackCtasEarly: stackCtasEarly
7174
+ }, (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, {
7175
+ theme: secondaryTheme
7176
+ }, /*#__PURE__*/React__default.createElement(SecondaryButton, Object.assign({}, secondaryLink), truncate(secondaryLink.text, LENGTH_SMALL_TEXT))))))));
7140
7177
  };
7141
7178
 
7142
7179
  var _templateObject$K;
@@ -7146,7 +7183,7 @@ var UpsellCards = function UpsellCards(_ref) {
7146
7183
  var upsellCards = _ref.upsellCards;
7147
7184
  return /*#__PURE__*/React__default.createElement(Wrapper$3, null, upsellCards == null ? void 0 : upsellCards.map(function (card, index) {
7148
7185
  return /*#__PURE__*/React__default.createElement(UpsellCard, {
7149
- key: "upsell-card-" + index,
7186
+ key: "card-" + index,
7150
7187
  title: card.title,
7151
7188
  subTitle: card.subTitle,
7152
7189
  price: card.price,
@@ -7154,7 +7191,10 @@ var UpsellCards = function UpsellCards(_ref) {
7154
7191
  flag: card.flag,
7155
7192
  offerTexts: card.offerTexts,
7156
7193
  link: card.link,
7157
- theme: card.theme
7194
+ secondaryLink: card.secondaryLink,
7195
+ stackCtasEarly: true,
7196
+ theme: card.theme,
7197
+ secondaryTheme: card.secondaryTheme
7158
7198
  });
7159
7199
  }));
7160
7200
  };
@@ -7168,7 +7208,8 @@ var UpsellSection = function UpsellSection(_ref) {
7168
7208
  theme = _ref$theme === void 0 ? exports.ThemeType.Core : _ref$theme;
7169
7209
  var themedUpsellCards = upsellCards ? [].concat(upsellCards).map(function (card) {
7170
7210
  return _extends({}, card, {
7171
- theme: card.theme || theme
7211
+ theme: card.theme || theme,
7212
+ secondaryTheme: card.secondaryTheme || theme
7172
7213
  });
7173
7214
  }) : [];
7174
7215
  return /*#__PURE__*/React__default.createElement(Theme, {
@@ -8774,14 +8815,13 @@ var _excluded$k = ["text", "onClick"];
8774
8815
  var HotFilters = function HotFilters(_ref) {
8775
8816
  var items = _ref.items,
8776
8817
  className = _ref.className,
8777
- defaultSelectedIndex = _ref.defaultSelectedIndex;
8778
- var _useState = React.useState(defaultSelectedIndex != null ? defaultSelectedIndex : 0),
8779
- selectedIndex = _useState[0],
8780
- setSelectedIndex = _useState[1];
8781
- var handleClick = function handleClick(index, onClick) {
8782
- setSelectedIndex(index);
8818
+ _ref$selectedIndex = _ref.selectedIndex,
8819
+ selectedIndex = _ref$selectedIndex === void 0 ? 0 : _ref$selectedIndex,
8820
+ onSelect = _ref.onSelect;
8821
+ var handleClick = React__default.useCallback(function (index, onClick) {
8822
+ if (onSelect) onSelect(index);
8783
8823
  if (onClick) onClick();
8784
- };
8824
+ }, [onSelect]);
8785
8825
  return /*#__PURE__*/React__default.createElement(HotFiltersWrapper, {
8786
8826
  className: className
8787
8827
  }, /*#__PURE__*/React__default.createElement(HotFilterOptionsWrapper, null, items.map(function (item, index) {
@@ -8798,7 +8838,8 @@ var HotFilters = function HotFilters(_ref) {
8798
8838
  backgroundColor: isSelected ? 'base-black' : 'base-white',
8799
8839
  textColor: isSelected ? 'base-white' : 'base-black',
8800
8840
  hoveredColor: "base-black",
8801
- pressedColor: "black-pressed"
8841
+ pressedColor: "black-pressed",
8842
+ "aria-pressed": isSelected
8802
8843
  }, rest), text);
8803
8844
  })));
8804
8845
  };